Exemple #1
0
 public function get_payment_code($payment_notice_id)
 {
     $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
     $order = $GLOBALS['db']->getRow("select order_sn,user_id from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']);
     $money = round($payment_notice['money'], 2);
     $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
     $payment_info['config'] = unserialize($payment_info['config']);
     $order_sn = $order['order_sn'];
     $user_id = $order['user_id'];
     include "yeepay/yeepayMPay.php";
     $yeepay = new yeepayMPay($payment_info['config']['merchantaccount'], $payment_info['config']['merchantPublicKey'], $payment_info['config']['merchantPrivateKey'], $payment_info['config']['yeepayPublicKey']);
     //print_r($payment_info['config']);exit;
     $data_return_url = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=response&class_name=Yjpay';
     $data_notify_url = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=Yjpay';
     $order_id = $payment_notice['notice_sn'];
     //网页支付的订单在订单有效期内可以进行多次支付请求,但是需要注意的是每次请求的业务参数都要一致,交易时间也要保持一致。否则会报错“订单与已存在的订单信息不符”
     $transtime = get_gmtime();
     // time();//交易时间,是每次支付请求的时间,注意此参数在进行多次支付的时候要保持一致。
     $product_catalog = '1';
     //商品类编码是我们业管根据商户业务本身的特性进行配置的业务参数。
     $identity_id = $user_id;
     //用户身份标识,是生成绑卡关系的因素之一,在正式环境此值不能固定为一个,要一个用户有唯一对应一个用户标识,以防出现盗刷的风险且一个支付身份标识只能绑定5张银行卡
     $identity_type = 2;
     //支付身份标识类型码
     $user_ip = get_client_ip();
     //此参数不是固定的商户服务器IP,而是用户每次支付时使用的网络终端IP,否则的话会有不友好提示:“检测到您的IP地址发生变化,请注意支付安全”。
     $user_ua = $_SERVER['HTTP_USER_AGENT'];
     //'NokiaN70/3.0544.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1';//用户ua
     $callbackurl = $data_notify_url;
     //商户后台系统回调地址,前后台的回调结果一样
     $fcallbackurl = $data_return_url;
     //商户前台系统回调地址,前后台的回调结果一样
     $product_name = '订单号-' . $order_sn;
     //出于风控考虑,请按下面的格式传递值:应用-商品名称,如“诛仙-3 阶成品天琊”
     $product_desc = '';
     //商品描述
     $terminaltype = 3;
     $terminalid = '';
     //其他支付身份信息
     $amount = $money * 100;
     //订单金额单位为分,支付时最低金额为2分,因为测试和生产环境的商户都有手续费(如2%),易宝支付收取手续费如果不满1分钱将按照1分钱收取。
     $url = $yeepay->pcWebPay($order_id, $transtime, $amount, $product_catalog, $identity_id, $identity_type, $user_ip, $user_ua, $callbackurl, $fcallbackurl, $currency = 156, $product_name, $product_desc, $terminaltype, $terminalid, $orderexp_date = 60);
     $arr = explode("&", $url);
     $encrypt = explode("=", $arr[1]);
     $data = explode("=", $arr[2]);
     $code = "<a target='' href={$url}>一键支付</a>";
     $code .= "<br /><span class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</span>";
     return $code;
 }
Exemple #2
0
    public function CreateLink($payment, $parameter)
    {
		if (!class_exists('yeepayMPay')){
			include DRIVER_PATH.'payment/yeepay/yeepayMPay.php';
		}
		$yeepay = new yeepayMPay($payment);
		$data = $this->getdata($payment, $parameter);
		if($payment['site'] == 'pc_web'){
			$request = $yeepay->pcWebPay($data);
			$back_url = $this->build_web_url($request);
		}elseif($payment['site'] == 'mobile_debit'){
			$back_url = $yeepay->debitWebPay($data);
		}elseif($payment['site'] == 'mobile_credit'){
			$back_url = $yeepay->creditWebPay($data);
		}
		return $back_url;
    }
Exemple #3
0
 public function web_pay()
 {
     import("@.ORG.pay.Yeepay.yeepayMPay");
     $yeepay = new yeepayMPay($this->pay_config["pay_yeepay_merchantaccount"], $this->pay_config["pay_yeepay_merchantpublickey"], $this->pay_config["pay_yeepay_merchantprivatekey"], $this->pay_config["pay_yeepay_yeepaypublickey"]);
     $order_id = $this->order_info["order_type"] . "_" . $this->order_info["order_id"];
     $transtime = $_SERVER["REQUEST_TIME"];
     $product_catalog = $this->pay_config["pay_yeepay_productcatalog"];
     $identity_id = "user_" . $this->user_info["uid"];
     $identity_type = 0;
     $user_ip = get_client_ip(0);
     $user_ua = $_SERVER["HTTP_USER_AGENT"];
     $callbackurl = C("config.site_url") . "/index.php?c=Pay&a=return_url&pay_type=yeepay";
     $fcallbackurl = C("config.site_url") . "/source/web_yeepay.php";
     $product_name = $this->order_info["order_name"];
     $product_desc = $this->order_info["order_name"] . "_" . $this->order_info["order_num"];
     $terminaltype = 3;
     $terminalid = "05-16-DC-59-C2-34";
     $amount = floatval($this->order_info["order_total_money"] * 100);
     $url = $yeepay->pcWebPay($order_id, $transtime, $amount, $product_catalog, $identity_id, $identity_type, $user_ip, $user_ua, $terminaltype, $terminalid, $paytypes = "1|2", $orderexp_date = 60, $callbackurl, $fcallbackurl, 156, $product_name, $product_desc);
     return array("error" => 0, "url" => $url);
 }
Exemple #4
0
$user_ua = 'NokiaN70/3.0544.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1';
//用户ua
$callbackurl = 'http://mobiletest.yeepay.com/demo/pay/callback';
//商户后台系统回调地址,前后台的回调结果一样
$fcallbackurl = 'http://mobiletest.yeepay.com/demo/pay/callback';
//商户前台系统回调地址,前后台的回调结果一样
$product_name = '诛仙-3 阶成品天琊';
//出于风控考虑,请按下面的格式传递值:应用-商品名称,如“诛仙-3 阶成品天琊”
$product_desc = '钻石';
//商品描述
$terminaltype = 3;
$terminalid = '05-16-DC-59-C2-34';
//其他支付身份信息
$amount = 4;
//订单金额单位为分,支付时最低金额为2分,因为测试和生产环境的商户都有手续费(如2%),易宝支付收取手续费如果不满1分钱将按照1分钱收取。
$url = $yeepay->pcWebPay($order_id, $transtime, $amount, $product_catalog, $identity_id, $identity_type, $user_ip, $user_ua, $terminaltype, $terminalid, $paytypes = '1|2', $orderexp_date = 60, $callbackurl, $fcallbackurl, 156, $product_name, $product_desc);
$arr = explode("&", $url);
$encrypt = explode("=", $arr[1]);
$data = explode("=", $arr[2]);
echo $url;
//var_dump($url);
function create_str($length = 8)
{
    // 密码字符集,可任意添加你需要的字符
    $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
    $str = '';
    for ($i = 0; $i < $length; $i++) {
        // 这里提供两种字符获取方式
        // 第一种是使用 substr 截取$chars中的任意一位字符;
        // 第二种是取字符数组 $chars 的任意元素
        // $password .= substr($chars, mt_rand(0, strlen($chars) – 1), 1);