Exemple #1
0
         $key = $settings['ten_key'];
         $return_url = $settings['phpdisk_url'] . "payment.php?action=tenpay";
         $strDate = date("Ymd");
         $strTime = date("His");
         $randNum = rand(1000, 9999);
         $strReq = $strTime . $randNum;
         $sp_billno = $strReq;
         $transaction_id = $bargainor_id . $strDate . $strReq;
         $total_fee = $money * 100;
         $desc = __('ali_body_pay') . ' ' . $money . ' RMB';
         $num = @$db->result_first("select count(*) from {$tpf}vip_orders where order_number='{$transaction_id}' and pay_method='{$task}' and userid='{$pd_uid}'");
         if (!$num) {
             $ins = array('pay_method' => $task, 'userid' => $pd_uid, 'vip_id' => $vip_id, 'order_number' => $transaction_id, 'total_fee' => $money, 'pay_status' => 'pendding', 'in_time' => $timestamp, 'ip' => $onlineip);
             $db->query("insert into {$tpf}vip_orders set " . $db->sql_array($ins) . ";");
         }
         $reqHandler = new PayRequestHandler();
         $reqHandler->init();
         $reqHandler->setKey($key);
         $reqHandler->setParameter("bargainor_id", $bargainor_id);
         $reqHandler->setParameter("sp_billno", $sp_billno);
         $reqHandler->setParameter("transaction_id", $transaction_id);
         $reqHandler->setParameter("total_fee", $total_fee);
         $reqHandler->setParameter("return_url", $return_url);
         $reqHandler->setParameter("desc", iconv('utf-8', 'gbk', $desc));
         $reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
         $reqUrl = $reqHandler->getRequestURL();
         header("Location: {$reqUrl}");
     } else {
         redirect('back', $sysmsg);
     }
 } elseif ($task == 'chinabank') {
Exemple #2
0
    $text = $v_amount . $v_moneytype . $v_oid . $v_mid . $v_url . $key;
    $v_md5info = strtoupper(md5($text));
    include template('order_charge');
} elseif ($_POST['paytype'] == 'tenpay') {
    $v_mid = $INI['tenpay']['mid'];
    $v_url = $INI['system']['wwwprefix'] . '/order/tenpay/return.php';
    $key = $INI['tenpay']['sec'];
    $v_oid = "charge-{$login_user_id}-{$now}-{$randno}";
    $v_amount = intval($total_money * 100);
    $v_moneytype = 'CNY';
    /* must */
    $sp_billno = $v_oid;
    $transaction_id = $v_mid . date('Ymd') . date('His') . rand(1000, 9999);
    $desc = $title;
    /* end */
    $reqHandler = new PayRequestHandler();
    $reqHandler->init();
    $reqHandler->setKey($key);
    $reqHandler->setParameter("bargainor_id", $v_mid);
    $reqHandler->setParameter("cs", "UTF-8");
    $reqHandler->setParameter("sp_billno", $sp_billno);
    $reqHandler->setParameter("transaction_id", $transaction_id);
    $reqHandler->setParameter("total_fee", $v_amount);
    $reqHandler->setParameter("return_url", $v_url);
    $reqHandler->setParameter("desc", $desc);
    $reqHandler->setParameter("spbill_create_ip", Utility::GetRemoteIp());
    $reqUrl = $reqHandler->getRequestURL();
    include template('order_charge');
} else {
    if ($_POST['paytype'] == 'alipay') {
        $_input_charset = 'utf-8';
Exemple #3
0
 /**
  * 获取支付表单
  *
  * @param 
  * @return array
  */
 public function get_payurl()
 {
     require_once "classes/PayRequestHandler.class.php";
     /* 商户号 */
     $bargainor_id = $this->payment['payment_config']['tenpay_account'];
     //"1900000109";
     /* 密钥 */
     $key = $this->payment['payment_config']['tenpay_key'];
     //"8934e7d15453e97507ef794cf7b0519d";
     /* 返回处理地址 */
     $return_url = SiteUrl . "/api/gold_payment/tenpay/return_url.php";
     //date_default_timezone_set(PRC);
     $strDate = date("Ymd");
     $strTime = date("His");
     //4位随机数
     $randNum = rand(1000, 9999);
     //10位序列号,可以自行调整。
     $strReq = $strTime . $randNum;
     /* 商家订单号,长度若超过32位,取前32位。财付通只记录商家订单号,不保证唯一。 */
     $sp_billno = $this->order['order_sn'];
     /* 财付通交易单号,规则为:10位商户号+8位时间(YYYYmmdd)+10位流水号 */
     $transaction_id = $bargainor_id . $strDate . $strReq;
     /* 商品价格(包含运费),以分为单位 */
     $total_fee = floatval($this->order['order_amount']) * 100;
     /* 商品名称 */
     $desc = $transaction_id;
     /* 创建支付请求对象 */
     $reqHandler = new PayRequestHandler();
     $reqHandler->init();
     $reqHandler->setKey($key);
     //----------------------------------------
     //设置支付参数
     //----------------------------------------
     $reqHandler->setParameter("bargainor_id", $bargainor_id);
     //商户号
     $reqHandler->setParameter("sp_billno", $sp_billno);
     //商户订单号
     $reqHandler->setParameter("transaction_id", $transaction_id);
     //财付通交易单号
     $reqHandler->setParameter("total_fee", $total_fee);
     //商品总金额,以分为单位
     $reqHandler->setParameter("return_url", $return_url);
     //返回处理地址
     $reqHandler->setParameter("desc", $transaction_id);
     //商品名称
     $modeltype = intval($this->order['modeltype']);
     //模块类型 1表示金币充值,2表示积分兑换
     if ($modeltype > 0) {
         $reqHandler->setParameter("attach", "{$modeltype}");
         //自定义参数
     } else {
         $reqHandler->setParameter("attach", '1');
         //自定义参数
     }
     //用户ip,测试环境时不要加这个ip参数,正式环境再加此参数
     $reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
     //请求的URL
     $reqUrl = $reqHandler->getRequestURL();
     return $reqUrl;
     //debug信息
     //$debugInfo = $reqHandler->getDebugInfo();
     //echo "<br/>" . $reqUrl . "<br/>";
     //echo "<br/>" . $debugInfo . "<br/>";
     //重定向到财付通支付
     //$reqHandler->doSend();
 }
Exemple #4
0
function pay_charge_tenpay($total_money, $charge_id, $title)
{
    global $INI;
    if ($total_money <= 0 || !$title) {
        return null;
    }
    $order_id = 'charge';
    $v_mid = $INI['tenpay']['mid'];
    $v_url = $INI['system']['wwwprefix'] . '/order/tenpay/return.php';
    $key = $INI['tenpay']['sec'];
    $v_oid = $charge_id;
    $v_amount = strval($total_money * 100);
    $v_moneytype = $INI['system']['currencyname'];
    $text = $v_amount . $v_moneytype . $v_oid . $v_mid . $v_url . $key;
    /* must */
    $sp_billno = $v_oid;
    $transaction_id = $v_mid . date('Ymd') . date('His') . rand(1000, 9999);
    $desc = mb_convert_encoding($title, 'GBK', 'UTF-8');
    /* end */
    $reqHandler = new PayRequestHandler();
    $reqHandler->init();
    $reqHandler->setKey($key);
    $reqHandler->setParameter("bargainor_id", $v_mid);
    $reqHandler->setParameter("cs", "GBK");
    $reqHandler->setParameter("sp_billno", $sp_billno);
    $reqHandler->setParameter("transaction_id", $transaction_id);
    $reqHandler->setParameter("total_fee", $v_amount);
    $reqHandler->setParameter("return_url", $v_url);
    $reqHandler->setParameter("desc", $desc);
    $reqHandler->setParameter("spbill_create_ip", Utility::GetRemoteIp());
    $reqUrl = $reqHandler->getRequestURL();
    if (is_post() && $_POST['paytype'] != 'tenpay') {
        $reqHandler->setParameter('bank_type', pay_getqqbank($_POST['paytype']));
        $reqUrl = $reqHandler->getRequestURL();
        redirect($reqUrl);
    }
    return render('block_pay_tenpay', array('order_id' => $order_id, 'reqUrl' => $reqUrl));
}
Exemple #5
0
 function get_code($order,$payment) {
     require_once ("tenpay/PayRequestHandler.class.php");
     $strReq = date("His") . rand(1000, 9999);
     $transaction_id = $payment['tenpay_account'] . date("Ymd") . $strReq;
     $reqHandler = new PayRequestHandler();
     $reqHandler->init();
     $reqHandler->setKey($payment['tenpay_key']);
     $reqHandler->setParameter("bargainor_id", $payment['tenpay_account']);			//商户号
     $reqHandler->setParameter("sp_billno",$order['ordersn']);					//商户订单号
     $reqHandler->setParameter("transaction_id", $transaction_id);		//财付通交易单号
     $reqHandler->setParameter("total_fee", $order['orderamount']*100);					//商品总金额,以分为单位
     $reqHandler->setParameter("return_url", pay::url(basename(__FILE__,'.php')));				//返回处理地址
     $reqHandler->setParameter("desc", $order['ordersn']);	//商品名称
     $reqHandler->setParameter("spbill_create_ip", front::ip());
     $reqUrl = $reqHandler->getRequestURL();
     $button = '<div style="text-align:center"><input type="button" onclick="window.open(\''.$reqUrl.'\')" value="财付通网上支付" /></div>';
     return $button;
 }
Exemple #6
0
function get_pay_url($charge_type, $pay_amount, $payment_config, $subject, $order_id, $model_id = null, $obj_id = null, $service = "DEFAULT", $sign_type = 'MD5', $show_url = 'index.php?do=user&view=finance&op=details')
{
    global $_K, $uid, $username;
    $tenpayid = $payment_config['seller_id'];
    $tenpaykey = $payment_config['safekey'];
    $tenpay_return_url = $_K['siteurl'] . '/include/payment/tenpay/return.php';
    $order_no = $order_id;
    $product_name = $subject;
    $order_price = $pay_amount;
    $out_trade_no = "charge-{$charge_type}-{$uid}-{$obj_id}-{$order_id}-{$model_id}-" . time();
    $remarkexplain = $out_trade_no;
    $bargainor_id = $tenpayid;
    $key = $tenpaykey;
    $return_url = $tenpay_return_url;
    $strDate = date("Ymd");
    $strTime = date("His");
    $randNum = rand(1000, 9999);
    $strReq = $strTime . $randNum;
    $sp_billno = $order_no;
    $transaction_id = $bargainor_id . $strDate . $strReq;
    $total_fee = $order_price * 100;
    $desc = $product_name;
    $reqHandler = new PayRequestHandler();
    $reqHandler->init();
    $reqHandler->setKey($key);
    $reqHandler->setParameter("bargainor_id", $bargainor_id);
    $reqHandler->setParameter("sp_billno", $sp_billno);
    $reqHandler->setParameter("transaction_id", $transaction_id);
    $reqHandler->setParameter("total_fee", $total_fee);
    $reqHandler->setParameter("return_url", $return_url);
    $reqHandler->setParameter("desc", $desc);
    $reqHandler->setParameter("attach", $remarkexplain);
    $reqHandler->setParameter("bank_type", $service);
    $reqHandler->setParameter('cs', CHARSET);
    $reqHandler->setParameter("spbill_create_ip", kekezu::get_ip());
    $reqUrl = $reqHandler->getRequestURL();
    keke_order_class::create_order_charge('online_charge', 'tenpay', null, $obj_id, $uid, $username, $pay_amount, 'wait', '用户充值', $out_trade_no);
    return build_postform($reqUrl);
}
Exemple #7
0
 private function pay($data = array())
 {
     $this->log->debug("Tenpay :: exciting tenpay init.");
     require_once "tenpay_class/PayRequestHandler.class.php";
     /* 商户号 */
     $bargainor_id = $data['bargainor_id'];
     /* 密钥 */
     $key = $data['key'];
     /* 返回处理地址 */
     $callback_url = $data['callback'];
     //date_default_timezone_set(PRC);
     $strDate = date("Ymd");
     $strTime = date("His");
     //4位随机数
     $randNum = rand(1000, 9999);
     //10位序列号,可以自行调整。
     $strReq = $strTime . $randNum;
     /* 商家订单号,长度若超过32位,取前32位。财付通只记录商家订单号,不保证唯一。 */
     $sp_billno = $data['order_id'];
     /* 财付通交易单号,规则为:10位商户号+8位时间(YYYYmmdd)+10位流水号 */
     $transaction_id = $bargainor_id . $strDate . $strReq;
     /* 商品价格(包含运费),以分为单位 */
     $total_fee = $data['total_fee'];
     /* 商品名称 */
     $desc = iconv('utf-8', 'gbk', $data['store'] . ", 订单号:" . $data['order_id']);
     /* 创建支付请求对象 */
     $reqHandler = new PayRequestHandler();
     $reqHandler->init();
     $reqHandler->setKey($key);
     //----------------------------------------
     //设置支付参数
     //----------------------------------------
     $reqHandler->setParameter("attach", "1");
     $reqHandler->setParameter("bargainor_id", $bargainor_id);
     //商户号
     $reqHandler->setParameter("sp_billno", $sp_billno);
     //商户订单号
     $reqHandler->setParameter("transaction_id", $transaction_id);
     //财付通交易单号
     $reqHandler->setParameter("total_fee", $total_fee);
     //商品总金额,以分为单位
     $reqHandler->setParameter("return_url", $callback_url);
     //返回处理地址
     $reqHandler->setParameter("desc", $desc);
     //商品名称
     $reqHandler->setParameter("encode_type", "2");
     //用户ip,测试环境时不要加这个ip参数,正式环境再加此参数
     $reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
     //请求的URL
     $reqUrl = $reqHandler->getRequestURL();
     return $reqUrl;
 }
Exemple #8
0
        mysql_fetch_array($up_order);
    }
}
$bargainor_id = $tenpaydata[sy_tenpayid];
$key = $tenpaydata[sy_tenpaycode];
$return_url = $tenpaydata[sy_weburl] . "/api/tenpay/return_url.php";
$strDate = date("Ymd");
$strTime = date("His");
$randNum = rand(1000, 9999);
$attach = $_POST[pay_type];
$strReq = $strTime . $randNum;
$sp_billno = $_POST[dingdan];
$transaction_id = trim($bargainor_id . $strDate . $strReq);
$total_fee = $row[order_price] * 100;
$desc = "订单号:" . $transaction_id;
$reqHandler = new PayRequestHandler();
$reqHandler->init();
$reqHandler->setKey($key);
$reqHandler->setParameter("bargainor_id", $bargainor_id);
$reqHandler->setParameter("transaction_id", $transaction_id);
$reqHandler->setParameter("sp_billno", $sp_billno);
$reqHandler->setParameter("total_fee", $total_fee);
$reqHandler->setParameter("return_url", $return_url);
$reqHandler->setParameter("desc", "订单号:" . $transaction_id);
$reqHandler->setParameter("attach", $attach);
$reqUrl = $reqHandler->getRequestURL();
Header("Location:{$reqUrl}");
?>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=gbk">
Exemple #9
0
function get_code($order, $payment)
{
    global $_CFG;
    if (!is_array($order) || !is_array($payment)) {
        return false;
    }
    $bargainor_id = trim($payment['partnerid']);
    ////商户编号
    $key = trim($payment['ytauthkey']);
    //MD5密钥
    $return_url = $order['v_url'];
    //返回url,地址应为绝对路径,带有http协议
    //date_default_timezone_set(PRC);
    $strDate = date("Ymd");
    $strTime = date("His");
    $randNum = rand(1000, 9999);
    //4位随机数
    $strReq = $strTime . $randNum;
    //10位序列号,可以自行调整。
    $transaction_id = $bargainor_id . $strDate . $strReq;
    /* 财付通交易单号,规则为:10位商户号+8位时间(YYYYmmdd)+10位流水号 */
    $sp_billno = $order['oid'];
    //订单号 商家订单号,长度若超过32位,取前32位。财付通只记录商家订单号,不保证唯一。
    //$total_fee ="1";/* 商品价格(包含运费),以分为单位 */
    $total_fee = intval($order['v_amount']) * 100;
    /* 商品价格(包含运费),以分为单位 */
    $desc = "订单号:" . $transaction_id;
    /* 创建支付请求对象 */
    $reqHandler = new PayRequestHandler();
    $reqHandler->init();
    $reqHandler->setKey($key);
    $reqHandler->setParameter("bargainor_id", $bargainor_id);
    //商户号
    $reqHandler->setParameter("sp_billno", $sp_billno);
    //商户订单号
    $reqHandler->setParameter("transaction_id", $transaction_id);
    //财付通交易单号
    $reqHandler->setParameter("total_fee", $total_fee);
    //商品总金额,以分为单位
    $reqHandler->setParameter("return_url", $return_url);
    //返回处理地址
    $reqHandler->setParameter("desc", $desc);
    //商品名称
    $reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
    $reqUrl = $reqHandler->getRequestURL();
    $def_url = "<a href=\"" . $reqUrl . "\" target=\"_blank\"><img src=\"" . $_CFG['site_template'] . "images/25.gif\" border=\"0\"/></a>";
    $def_url = "<input type=\"button\" class=\"but130lan intrgration_but\" value=\"确认支付\"  onclick=\"javascript:window.open('" . $reqUrl . "')\"/>";
    return $def_url;
}
Exemple #10
0
function makeurl(&$pay)
{
    global $mcharset, $cms_abs;
    $order_sn = $pay->account . date('Ymd0000') . substr($pay->order_sn, strlen($pay->order_sn) - 6, 6);
    /* 创建支付请求对象 */
    $reqHandler = new PayRequestHandler();
    $reqHandler->init();
    $reqHandler->setKey($pay->keyt);
    //----------------------------------------
    //设置支付参数
    //----------------------------------------
    $reqHandler->setParameter("bargainor_id", $pay->account);
    //商户号
    $reqHandler->setParameter("sp_billno", $pay->order_id);
    //商户订单号
    $reqHandler->setParameter("transaction_id", $order_sn);
    //财付通交易单号
    $reqHandler->setParameter("total_fee", $pay->totalfee * 100);
    //商品总价,单位为分
    $reqHandler->setParameter("return_url", $pay->notify_url);
    //返回处理地址
    $reqHandler->setParameter("desc", $pay->subject);
    //商品名称
    $reqHandler->setParameter("attach", $pay->order_sn);
    //商家数据包,原样返回
    //用户ip,测试环境时不要加这个ip参数,正式环境再加此参数
    #$reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
    //请求的URL
    return $reqHandler->getRequestURL();
    //debug信息
    //$debugInfo = $reqHandler->getDebugInfo();
    //echo "<br/>" . $reqUrl . "<br/>";
    //echo "<br/>" . $debugInfo . "<br/>";
    //重定向到财付通支付
    //$reqHandler->doSend();
}