示例#1
0
	public function pay()
	{
		$orderName = $_GET['orderName'];

		if (!$orderName) {
			$orderName = microtime();
		}

		$orderid = $_GET['orderid'];

		if (!$orderid) {
			$orderid = $_GET['single_orderid'];
		}

		$payHandel = new payHandle($this->token, $_GET['from'], 'daofu');
		$orderInfo = $payHandel->beforePay($orderid);

		if (!$orderInfo['price']) {
			exit('必须有价格才能支付');
		}

		$orderInfo = $payHandel->afterPay($orderid, '');
		$from = $payHandel->getFrom();
		$this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&nohandle=1&orderid=' . $orderid);
	}
示例#2
0
 public function pay()
 {
     $from = $this->_request('from');
     $single_orderid = $this->_request('single_orderid');
     $orderName = $this->_request('orderName');
     $redirect = $this->_request('redirect');
     $payHandel = new payHandle($this->token, $from, 'CardPay');
     $orderInfo = $payHandel->beforePay($single_orderid);
     $price = $orderInfo['price'];
     if ($price <= 0) {
         $this->error('请输入有效金额');
     }
     $paypass = M('Userinfo')->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->getField('paypass');
     //未设密码
     if ($paypass == NULL) {
         $this->error('请先设置支付密码', U('Userinfo/index', array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'redirect' => 'CardPay/pay|token:' . $this->token . ',wecha_id:' . $this->wecha_id . ',from:' . $from . ',price:' . $price . ',single_orderid:' . $single_orderid . ',orderName:' . $orderName . ',redirect:' . $redirect)));
     }
     //已输入密码
     if ($_POST['pass'] != false) {
         if (md5($_POST['pass']) == $paypass) {
             if ($redirect) {
                 $this->gotopay($single_orderid, $price, $from, $orderName, $redirect);
             } else {
                 $this->gotopay($single_orderid, $price, $from, $orderName);
             }
         } else {
             $this->error('密码错误');
         }
     }
     $this->display();
 }
示例#3
0
 public function pay()
 {
     $from = $this->_request('from');
     $single_orderid = $this->_request('single_orderid');
     $orderName = $this->_request('orderName');
     $redirect = $this->_request('redirect');
     $payHandel = new payHandle($this->token, $from, 'CardPay');
     $orderInfo = $payHandel->beforePay($single_orderid);
     $price = $orderInfo['price'];
     if ($price <= 0) {
         $this->error('请输入有效金额');
     }
     $paypass = M('Userinfo')->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->getField('paypass');
     if ($_POST['pass'] != false) {
         if (md5($_POST['pass']) == $paypass) {
             if ($redirect) {
                 $this->gotopay($single_orderid, $price, $from, $orderName, $redirect);
             } else {
                 $this->gotopay($single_orderid, $price, $from, $orderName);
             }
         } else {
             $this->error('密码错误');
         }
     }
     $this->display();
 }
示例#4
0
	public function pay()
	{
		$orderName = $_GET['orderName'];

		if (!$orderName) {
			$orderName = microtime();
		}

		$orderid = $_GET['orderid'];

		if (!$orderid) {
			$orderid = $_GET['single_orderid'];
		}

		$payHandel = new payHandle($this->token, $_GET['from'], 'yeepay');
		$orderInfo = $payHandel->beforePay($orderid);

		if ($orderInfo['paid']) {
			exit('您已经支付过此次订单!');
		}

		if (!$orderInfo['price']) {
			exit('必须有价格才能支付!');
		}

		$database_yeepay_tmp = M('Yeepay_tmp');
		$data_yeepay_tmp['order_id'] = $orderid;
		$data_yeepay_tmp['token'] = $this->token;
		$data_yeepay_tmp['wecha_id'] = $this->wecha_id;
		$data_yeepay_tmp['from'] = $_GET['from'];
		$data_yeepay_tmp['time'] = $_SERVER['REQUEST_TIME'];

		if (!empty($_GET['platform'])) {
			$data_yeepay_tmp['platform'] = 1;
		}

		if (!($tmp_id = $database_yeepay_tmp->data($data_yeepay_tmp)->add())) {
			$this->error('下订单出现错误!请重试。');
		}

		import('@.ORG.Yeepay.yeepayMPay');
		$yeepay = new yeepayMPay($this->payConfig['merchantaccount'], $this->payConfig['merchantPublicKey'], $this->payConfig['merchantPrivateKey'], $this->payConfig['yeepayPublicKey']);
		$order_id = 'ORDER_' . $tmp_id;
		$transtime = time();
		$product_catalog = $this->payConfig['product_catalog'];
		$identity_id = $this->wecha_id;
		$identity_type = 0;
		$user_ip = $_SERVER['REMOTE_ADDR'];
		$user_ua = $_SERVER['HTTP_USER_AGENT'];
		$callbackurl = $this->siteUrl . '/index.php?g=Wap&m=Yeepay&a=notify_url';
		$fcallbackurl = $this->siteUrl . '/wxpay/yeepay.php';
		$product_name = $orderName;
		$product_desc = $orderName;
		$other = '';
		$amount = floatval($orderInfo['price'] * 100);
		$url = $yeepay->webPay($order_id, $transtime, $amount, $product_catalog, $identity_id, $identity_type, $user_ip, $user_ua, $callbackurl, $fcallbackurl, $currency = 156, $product_name, $product_desc, $other);
		$_SESSION['yeepay']['token'] = $this->token;
		header('Location: ' . $url);
		exit();
	}
示例#5
0
 public function pay()
 {
     //参数数据
     $orderName = $_GET['orderName'];
     $orderid = $_GET['orderid'];
     if (!$orderid) {
         $orderid = $_GET['single_orderid'];
         //单个订单
     }
     //before
     $payHandel = new payHandle($this->token, $_GET['from']);
     $orderInfo = $payHandel->beforePay($orderid);
     $price = $orderInfo['price'];
     if (!$price) {
         exit('必须有价格才能支付');
     }
     $from = isset($_GET['from']) ? $_GET['from'] : 'shop';
     $alipayConfig = $this->alipayConfig;
     //反序列化得到支付的配置信息
     $now_pay_type = '';
     if ($alipayConfig) {
         $pay_setting = array();
         $config_info = unserialize($alipayConfig['info']);
         foreach ($config_info as $key => $value) {
             if (is_array($value)) {
                 if ($value['open']) {
                     $key = $key == 'alipay' ? 'Alipaytype' : ucwords($key);
                     $pay_setting[$key] = $value;
                     $now_pay_type = $key;
                 }
             }
         }
     }
     if (empty($alipayConfig) || empty($now_pay_type)) {
         $now_pay_type = 'Alipaytype';
     }
     /*
     if(count($pay_setting) == 1){
     	if($now_pay_type == 'Weixin'){
     		header('Location:/wxpay/index.php?g=Wap&m=Weixin&a=pay&price='.$price.'&orderName='.$orderName.'&single_orderid='.$orderid.'&showwxpaytitle=1&from='.$from.'&token='.$this->token.'&wecha_id='.$this->wecha_id);
     	}else if($now_pay_type != 'Platform'){
     		header('Location:/index.php?g=Wap&m='.$now_pay_type.'&a=pay&price='.$price.'&orderName='.$orderName.'&single_orderid='.$orderid.'&from='.$from.'&token='.$this->token.'&wecha_id='.$this->wecha_id);
     	}
     }
     */
     $this->assign('isFuwu', $this->isFuwu);
     $this->assign('isWechat', $this->isWechat);
     $this->assign('price', $price);
     $this->assign('orderName', $orderName);
     $this->assign('orderid', $orderid);
     $this->assign('from', $from);
     $this->assign('token', $this->token);
     $this->assign('wecha_id', $this->wecha_id);
     $this->assign('pay_setting', $pay_setting);
     $this->display();
 }
示例#6
0
	public function pay()
	{
		$orderName = $_GET['orderName'];

		if (!$orderName) {
			$orderName = microtime();
		}

		$orderid = $_GET['orderid'];

		if (!$orderid) {
			$orderid = $_GET['single_orderid'];
		}

		$payHandel = new payHandle($this->token, $_GET['from'], 'allinpay');
		$orderInfo = $payHandel->beforePay($orderid);

		if ($orderInfo['paid']) {
			exit('您已经支付过此次订单!');
		}

		if (!$orderInfo['price']) {
			exit('必须有价格才能支付');
		}

		$database_userinfo = D('Userinfo');
		$condition_userinfo['wecha_id'] = $this->wecha_id;
		$now_user_info = $database_userinfo->field('`id` `wid`')->where($condition_userinfo)->find();

		if (empty($now_user_info)) {
			$this->error('查询数据异常!请重试。');
		}

		if (empty($_GET['platform'])) {
			$return_url = $this->siteUrl . '/index.php?g=Wap&m=Allinpay&a=r_u&wid=' . $now_user_info['wid'] . '&from=' . $_GET['from'];
		}
		else {
			$return_url = $this->siteUrl . '/index.php?g=Wap&m=Allinpay&a=r_u&wid=' . $now_user_info['wid'] . '&from=' . $_GET['from'] . '&platform=1';
		}

		import('@.ORG.Allinpay.allinpayCore');
		$allinpayClass = new allinpayCore();
		$allinpayClass->setParameter('payUrl', 'https://service.allinpay.com/mobilepayment/mobile/SaveMchtOrderServlet.action');
		$allinpayClass->setParameter('pickupUrl', $return_url);
		$allinpayClass->setParameter('receiveUrl', $this->siteUrl . '/index.php?g=Wap&m=Allinpay&a=notify_url');
		$allinpayClass->setParameter('merchantId', $this->payConfig['merchantId']);
		$allinpayClass->setParameter('orderNo', $orderInfo['orderid']);
		$allinpayClass->setParameter('orderAmount', floatval($orderInfo['price']) * 100);
		$allinpayClass->setParameter('orderDatetime', date('YmdHis', $_SERVER['REQUEST_TIME']));
		$allinpayClass->setParameter('productName', $orderName);
		$allinpayClass->setParameter('payType', 0);
		$allinpayClass->setParameter('key', $this->payConfig['merchantKey']);
		$allinpayClass->sendRequestForm();
	}
示例#7
0
	public function pay()
	{
		$orderName = $_GET['orderName'];

		if (!$orderName) {
			$orderName = microtime();
		}

		$orderid = $_GET['orderid'];

		if (!$orderid) {
			$orderid = $_GET['single_orderid'];
		}

		$payHandel = new payHandle($this->token, $_GET['from'], 'chinabank');
		$orderInfo = $payHandel->beforePay($orderid);

		if ($orderInfo['paid']) {
			exit('您已经支付过此次订单!');
		}

		if (!$orderInfo['price']) {
			exit('必须有价格才能支付!');
		}

		$data_vid = trim($this->payConfig['chinabank_account']);
		$data_orderid = $orderid;
		$data_vamount = $orderInfo['price'];
		$data_vmoneytype = 'CNY';
		$data_vpaykey = trim($this->payConfig['chinabank_key']);
		$data_vreturnurl = C('site_url') . '/index.php?g=Wap&m=Chinabank&a=return_url&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from'];
		$MD5KEY = $data_vamount . $data_vmoneytype . $data_orderid . $data_vid . $data_vreturnurl . $data_vpaykey;
		$MD5KEY = strtoupper(md5($MD5KEY));
		$def_url = '<span style="display:none;">';
		$def_url .= '<form  method="post" action="https://pay3.chinabank.com.cn/PayGate" id="chinabanksubmit" name="chinabanksubmit">';
		$def_url .= '<input type=HIDDEN name=\'v_mid\' value=\'' . $data_vid . '\'>';
		$def_url .= '<input type=HIDDEN name=\'v_oid\' value=\'' . $data_orderid . '\'>';
		$def_url .= '<input type=HIDDEN name=\'v_amount\' value=\'' . $data_vamount . '\'>';
		$def_url .= '<input type=HIDDEN name=\'v_moneytype\'  value=\'' . $data_vmoneytype . '\'>';
		$def_url .= '<input type=HIDDEN name=\'v_url\'  value=\'' . $data_vreturnurl . '\'>';
		$def_url .= '<input type=HIDDEN name=\'v_md5info\' value=\'' . $MD5KEY . '\'>';
		$def_url .= '<input type=HIDDEN name=\'remark1\' value=\'' . $remark1 . '\'>';
		$def_url .= '<input type=submit class=\'button\' value=\'去付款...\'>';
		$def_url .= '</form>';
		$def_url .= '</span>';
		$def_url .= '<script>document.forms[\'chinabanksubmit\'].submit();</script>';
		exit($def_url);
	}
示例#8
0
 public function pay()
 {
     //得到GET传参的订单名称,若为空则使用系统时间
     $orderName = $_GET['orderName'];
     if (!$orderName) {
         $orderName = microtime();
     }
     //得到GET传参的系统唯一订单号
     $orderid = $_GET['orderid'];
     if (!$orderid) {
         $orderid = $_GET['single_orderid'];
         //单个订单
     }
     //惯例,获取此订单号的信息
     $payHandel = new payHandle($this->token, $_GET['from'], 'chinabank');
     $orderInfo = $payHandel->beforePay($orderid);
     //判断是否已经支付过
     if ($orderInfo['paid']) {
         exit('您已经支付过此次订单!');
     }
     //判断价格是否为空。此做法可顺带查出是否是不存的订单号
     if (!$orderInfo['price']) {
         exit('必须有价格才能支付!');
     }
     //创建支付表单并显示
     $data_vid = trim($this->payConfig['chinabank_account']);
     $data_orderid = $orderid;
     $data_vamount = $orderInfo['price'];
     $data_vmoneytype = 'CNY';
     $data_vpaykey = trim($this->payConfig['chinabank_key']);
     $data_vreturnurl = C('site_url') . '/index.php?g=Wap&m=Chinabank&a=return_url&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from'];
     $MD5KEY = $data_vamount . $data_vmoneytype . $data_orderid . $data_vid . $data_vreturnurl . $data_vpaykey;
     $MD5KEY = strtoupper(md5($MD5KEY));
     $def_url = '<span style="display:none;">';
     $def_url .= '<form  method="post" action="https://pay3.chinabank.com.cn/PayGate" id="chinabanksubmit" name="chinabanksubmit">';
     $def_url .= "<input type=HIDDEN name='v_mid' value='" . $data_vid . "'>";
     $def_url .= "<input type=HIDDEN name='v_oid' value='" . $data_orderid . "'>";
     $def_url .= "<input type=HIDDEN name='v_amount' value='" . $data_vamount . "'>";
     $def_url .= "<input type=HIDDEN name='v_moneytype'  value='" . $data_vmoneytype . "'>";
     $def_url .= "<input type=HIDDEN name='v_url'  value='" . $data_vreturnurl . "'>";
     $def_url .= "<input type=HIDDEN name='v_md5info' value='" . $MD5KEY . "'>";
     $def_url .= "<input type=HIDDEN name='remark1' value='" . $remark1 . "'>";
     $def_url .= "<input type=submit class='button' value='去付款...'>";
     $def_url .= "</form>";
     $def_url .= "</span>";
     $def_url .= "<script>document.forms['chinabanksubmit'].submit();</script>";
     exit($def_url);
 }
示例#9
0
 public function pay()
 {
     $orderName = $_GET['orderName'];
     $orderid = $_GET['orderid'];
     if (!$orderid) {
         $orderid = $_GET['single_orderid'];
     }
     $payHandel = new payHandle($this->token, $_GET['from']);
     $orderInfo = $payHandel->beforePay($orderid);
     $price = $orderInfo['price'];
     if (!$price) {
         exit('必须有价格才能支付');
     }
     $from = isset($_GET['from']) ? $_GET['from'] : 'shop';
     $alipayConfig = $this->alipayConfig;
     $now_pay_type = '';
     if ($alipayConfig) {
         $pay_setting = array();
         $config_info = unserialize($alipayConfig['info']);
         foreach ($config_info as $key => $value) {
             if (is_array($value)) {
                 if ($value['open']) {
                     $key = $key == 'alipay' ? 'Alipaytype' : ucwords($key);
                     $pay_setting[$key] = $value;
                     $now_pay_type = $key;
                 }
             }
         }
     }
     if (empty($alipayConfig) || empty($now_pay_type)) {
         $now_pay_type = 'Alipaytype';
     }
     $this->assign('isFuwu', $this->isFuwu);
     $this->assign('isWechat', $this->isWechat);
     $this->assign('price', $price);
     $this->assign('orderName', $orderName);
     $this->assign('orderid', $orderid);
     $this->assign('from', $from);
     $this->assign('token', $this->token);
     $this->assign('wecha_id', $this->wecha_id);
     $this->assign('pay_setting', $pay_setting);
     $this->display();
 }
示例#10
0
 public function pay()
 {
     //参数数据
     $orderName = $_GET['orderName'];
     $orderid = $_GET['orderid'];
     if (!$orderid) {
         $orderid = $_GET['single_orderid'];
         //单个订单
     }
     //before
     $payHandel = new payHandle($this->token, $_GET['from']);
     $orderInfo = $payHandel->beforePay($orderid);
     $price = $orderInfo['price'];
     //
     $from = isset($_GET['from']) ? $_GET['from'] : 'shop';
     //
     $alipayConfig = $this->alipayConfig;
     //
     if (!$price) {
         exit('必须有价格才能支付');
     }
     import("@.ORG.Alipay.AlipaySubmit");
     switch ($alipayConfig['paytype']) {
         default:
             $alipayConfig['paytype'] = 'Alipaytype';
             break;
         case 'tenpay':
             $alipayConfig['paytype'] = 'Tenpay';
             break;
         case 'weixin':
             $alipayConfig['paytype'] = 'Weixin';
             break;
         case 'tenpayComputer':
             $alipayConfig['paytype'] = 'TenpayComputer';
             break;
     }
     if ($alipayConfig['paytype'] == 'Weixin') {
         header('Location:/wxpay/index.php?g=Wap&m=' . $alipayConfig['paytype'] . '&a=pay&price=' . $price . '&orderName=' . $orderName . '&single_orderid=' . $orderid . '&showwxpaytitle=1&from=' . $from . '&token=' . $this->token . '&wecha_id=' . $this->wecha_id);
     } else {
         header('Location:/index.php?g=Wap&m=' . $alipayConfig['paytype'] . '&a=pay&price=' . $price . '&orderName=' . $orderName . '&single_orderid=' . $orderid . '&from=' . $from . '&token=' . $this->token . '&wecha_id=' . $this->wecha_id);
     }
 }
	public function pay(){
		import("@.ORG.Weixinpay.CommonUtil");
		import("@.ORG.Weixinpay.WxPayHelper");
		$commonUtil = new CommonUtil();
		//before
		$orderid=$_GET['single_orderid'];
		$payHandel=new payHandle($this->token,$_GET['from'],'wechat');
		$orderInfo=$payHandel->beforePay($orderid);
		$price=$orderInfo['price'];
		//var_export($this->payConfig);
		//exit();
		$wxPayHelper = new WxPayHelper($this->payConfig['appid'],$this->payConfig['paysignkey'],$this->payConfig['partnerkey']);

		$wxPayHelper->setParameter("bank_type", "WX");
		$wxPayHelper->setParameter("body", $orderid);
		$wxPayHelper->setParameter("partner", $this->payConfig['partnerid']);
		$wxPayHelper->setParameter("out_trade_no",$orderid);
		$wxPayHelper->setParameter("total_fee", $price*100);
		$wxPayHelper->setParameter("fee_type", "1");
		$wxPayHelper->setParameter("notify_url", C('site_url').'/index.php?g=Wap&m=Weixin&a=return_url&token='.$_GET['token'].'&wecha_id='.$_GET['wecha_id'].'&from='.$_GET['from']);
		//$wxPayHelper->setParameter("notify_url", 'http://www.baidu.com');
		$wxPayHelper->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
		$wxPayHelper->setParameter("input_charset", "GBK");
		$url=$wxPayHelper->create_biz_package();
		$this->assign('url',$url);
		//
		$from=$_GET['from'];
		$from=$from?$from:'Groupon';
		$from=$from!='groupon'?$from:'Groupon';
		switch ($from){
			default:
			case 'Groupon':
				break;
		}
		$returnUrl='/index.php?g=Wap&m='.$from.'&a=payReturn&token='.$_GET['token'].'&wecha_id='.$_GET['wecha_id'].'&orderid='.$orderid;
		$this->assign('returnUrl',$returnUrl);
		//$this->display('Weixin_pay.html');
		echo '<html><head><meta http-equiv="Content-Type"content="text/html; charset=UTF-8"><meta name="viewport"content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;"><meta name="apple-mobile-web-app-capable"content="yes"><meta name="apple-mobile-web-app-status-bar-style"content="black"><meta name="format-detection"content="telephone=no"><link href="/tpl/Wap/default/common/css/style/css/hotels.css"rel="stylesheet"type="text/css"><title>微信支付</title></head><script language="javascript">function callpay()
{WeixinJSBridge.invoke(\'getBrandWCPayRequest\','.$url.',function(res){WeixinJSBridge.log(res.err_msg);if(res.err_msg==\'get_brand_wcpay_request:ok\'){document.getElementById(\'payDom\').style.display=\'none\';document.getElementById(\'successDom\').style.display=\'\';setTimeout("window.location.href = \''.$returnUrl.'\'",2000);}else{document.getElementById(\'payDom\').style.display=\'none\';document.getElementById(\'failDom\').style.display=\'\';document.getElementById(\'failRt\').innerHTML=res.err_code+\'|\'+res.err_desc+\'|\'+res.err_msg;}});}</script><body style="padding-top:20px;"><style>.deploy_ctype_tip{z-index:1001;width:100%;text-align:center;position:fixed;top:50%;margin-top:-23px;left:0;}.deploy_ctype_tip p{display:inline-block;padding:13px 24px;border:solid#d6d482 1px;background:#f5f4c5;font-size:16px;color:#8f772f;line-height:18px;border-radius:3px;}</style><div id="payDom"class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付信息</span></li><li class="nob"><table width="100%"border="0"cellspacing="0"cellpadding="0"class="kuang"><tr><th>金额</th><td>'.$price.'元</td></tr></table></li></ul><div class="footReturn"style="text-align:center"><input type="button"style="margin:0 auto 20px auto;width:100%"onclick="callpay()"class="submit"value="点击进行微信支付"/></div></div><div id="failDom"style="display:none"class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付结果</span></li><li class="nob"><table width="100%"border="0"cellspacing="0"cellpadding="0"class="kuang"><tr><th>支付失败</th><td><div id="failRt"></div></td></tr></table></li></ul><div class="footReturn"style="text-align:center"><input type="button"style="margin:0 auto 20px auto;width:100%"onclick="callpay()"class="submit"value="重新进行支付"/></div></div><div id="successDom"style="display:none"class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付成功</span></li><li class="nob"><table width="100%"border="0"cellspacing="0"cellpadding="0"class="kuang"><tr><th>您已支付成功,页面正在跳转...</td></tr></table><div id="failRt"></div></td></tr></table></li></ul></div></body></html>';
	}
示例#12
0
 public function pay()
 {
     //得到GET传参的订单名称,若为空则使用系统时间
     $orderName = $_GET['orderName'];
     if (!$orderName) {
         $orderName = microtime();
     }
     //得到GET传参的系统唯一订单号
     $orderid = $_GET['orderid'];
     if (!$orderid) {
         $orderid = $_GET['single_orderid'];
         //单个订单
     }
     //惯例,获取此订单号的信息
     $payHandel = new payHandle($this->token, $_GET['from'], 'dianfu');
     $orderInfo = $payHandel->beforePay($orderid);
     //判断价格是否为空。此做法可顺带查出是否是错误的订单号
     if (!$orderInfo['price']) {
         exit('必须有价格才能支付');
     }
     $orderInfo = $payHandel->afterPay($orderid, '');
     $from = $payHandel->getFrom();
     $this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $orderid);
 }
示例#13
0
	public function pay()
	{
		import('@.ORG.Weixinpay.CommonUtil');
		import('@.ORG.Weixinpay.WxPayHelper');
		$commonUtil = new CommonUtil();
		$orderid = $_GET['single_orderid'];
		$payHandel = new payHandle($this->token, $_GET['from'], 'weixin');
		$orderInfo = $payHandel->beforePay($orderid);
		$price = $orderInfo['price'];

		if ($orderInfo['paid']) {
			exit('您已经支付过此次订单!');
		}

		$wxPayHelper = new WxPayHelper($this->payConfig['appid'], $this->payConfig['paysignkey'], $this->payConfig['partnerkey']);
		$wxPayHelper->setParameter('bank_type', 'WX');
		$wxPayHelper->setParameter('body', $orderid);
		$wxPayHelper->setParameter('partner', $this->payConfig['partnerid']);
		$wxPayHelper->setParameter('out_trade_no', $orderid);
		$wxPayHelper->setParameter('total_fee', $price * 100);
		$wxPayHelper->setParameter('fee_type', '1');
		$wxPayHelper->setParameter('notify_url', $this->siteUrl . '/index.php?g=Wap&m=Weixin&nohandle=1&a=return_url&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from']);
		$wxPayHelper->setParameter('spbill_create_ip', $_SERVER['REMOTE_ADDR']);
		$wxPayHelper->setParameter('input_charset', 'GBK');
		$url = $wxPayHelper->create_biz_package();
		$this->assign('url', $url);
		$from = $_GET['from'];
		$from = ($from ? $from : 'Groupon');
		$from = ($from != 'groupon' ? $from : 'Groupon');

		switch ($from) {
		default:
		case 'Groupon':
			break;
		}

		$returnUrl = $this->siteUrl . '/index.php?g=Wap&m=' . $from . '&a=payReturn&nohandle=1&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&orderid=' . $orderid;
		$this->assign('returnUrl', $returnUrl);
		$message = '';
		$message .= '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="apple-mobile-web-app-status-bar-style" content="black" /><meta name="format-detection" content="telephone=no" /><link href="/tpl/Wap/default/common/css/style/css/hotels.css" rel="stylesheet" type="text/css" /><title>微信支付</title>';

		if (empty($this->_issystem)) {
			$message .= '<script language="javascript">function callpay(){WeixinJSBridge.invoke("getBrandWCPayRequest",' . $jsApiParameters . ',function(res){WeixinJSBridge.log(res.err_msg);if(res.err_msg=="get_brand_wcpay_request:ok"){document.getElementById("payDom").style.display="none";document.getElementById("successDom").style.display="";setTimeout("window.location.href = \'' . $returnUrl . '\'",2000);}else{if(res.err_msg == "get_brand_wcpay_request:cancel"){var err_msg = "您取消了支付";}else if(res.err_msg == "get_brand_wcpay_request:fail"){var err_msg = "支付失败<br/>错误信息:"+res.err_desc;}else{var err_msg = res.err_msg +"<br/>"+res.err_desc;}document.getElementById("payDom").style.display = "none";document.getElementById("failDom").style.display = "";document.getElementById("failRt").innerHTML = err_msg;}});}</script>';
		}

		$message .= '</head><body style="padding-top:20px;"><style>.deploy_ctype_tip{z-index:1001;width:100%;text-align:center;position:fixed;top:50%;margin-top:-23px;left:0;}.deploy_ctype_tip p{display:inline-block;padding:13px 24px;border:solid #d6d482 1px;background:#f5f4c5;font-size:16px;color:#8f772f;line-height:18px;border-radius:3px;}</style><div id="payDom" class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付信息</span></li><li class="nob"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><th>金额</th><td>' . $price . '元</td></tr></table></li></ul>';

		if ($this->_issystem) {
			$message .= '<ul class="round" id="cross_pay"><li class="title mb" style="text-align:center"><span class="none">微信扫描支付</span></li><li class="nob" style="margin-bottom: 18px;"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><td style="text-align:center" ><img src="' . U('Weixin/qrcode', array('url' => $url)) . '" height="200" id="show_success"></td></tr><tr><td style="text-align:center">长按图片[识别二维码]付款</td></tr></table></li><li class="mb" style="text-align:center;margin-top: 20px;border-top: 1px solid #C6C6C6;" id="success"><span class="none"><a href="' . $returnUrl . '" style="color:#459ae9">我已经支付成功</a></span></li></ul>';
		}
		else {
			$message .= '<div class="footReturn" style="text-align:center" id="pay_div"><input type="button" style="margin:0 auto 20px auto;width:100%"  onclick="callpay()"  class="submit" value="点击进行微信支付" /></div>';
		}

		$message .= '</div><div id="failDom" style="display:none" class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付结果</span></li><li class="nob"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><th>支付失败</th><td><div id="failRt"></div></td></tr></table></li></ul><div class="footReturn" style="text-align:center"><input type="button" style="margin:0 auto 20px auto;width:100%"  onclick="callpay()"  class="submit" value="重新进行支付" /></div></div><div id="successDom" style="display:none" class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付成功</span></li><li class="nob"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><td>您已支付成功,页面正在跳转...</td></tr></table><div id="failRt"></div></li></ul></div></body></html>';
		echo $message;
	}
示例#14
0
	public function order()
	{
		if (empty($_GET['from'])) {
			$result = $this->_db('update');

			if (!empty($_POST['toOrder'])) {
				$result['model'] = $this->_activityToOrder[$result['model']];
			}

			$from = htmlentities($_POST['from']);
			$transactionid = $_POST['transactionid'];
			$token = $_POST['token'];
			$orderid = $_POST['option']['where']['orderid'];
			$payType = $_POST['data']['paytype'];
			$payHandel = new payHandle($token, $from, $payType);
			$orderInfo = $payHandel->beforePay($orderid);

			if (empty($orderInfo['paid'])) {
				$orderInfo = $payHandel->afterPay($orderid, $transactionid);
				$url = C('site_url') . '/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&rget=1&orderid=' . $orderid;
				file_get_contents($url);
			}
		}
		else {
			$sign = $_GET['sign'];
			unset($_GET['sign']);

			if ($this->_signVeryfy($_GET, $sign)) {
				$from = htmlentities($_GET['from']);
				$transactionid = $_GET['transactionid'];
				$token = $_GET['token'];
				$orderid = $_GET['orderid'];
				$payType = $_GET['paytype'];
				$payHandel = new payHandle($token, $from, $payType);
				$orderInfo = $payHandel->beforePay($orderid);

				if (empty($orderInfo['paid'])) {
					$orderInfo = $payHandel->afterPay($orderid, $transactionid);
					$url = C('site_url') . '/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $orderid;
					header('Location:' . $url);
				}
				else {
					exit('付款失败');
				}
			}
		}
	}
 public function pay()
 {
     ////////////////////////////////////
     //before
     $orderid = $_GET['orderid'];
     $payHandel = new payHandle($this->token, $_GET['from'], 'tenpayComputer');
     $orderInfo = $payHandel->beforePay($orderid);
     $price = $orderInfo['price'];
     //参数数据
     $orderName = $_GET['orderName'];
     if (!$orderid) {
         $orderid = $_GET['single_orderid'];
         //单个订单
     }
     $notify_url = C('site_url') . '/index.php?g=Wap&m=TenpayComputer&a=notify_url';
     //需http://格式的完整路径,不能加?id=123这类自定义参数
     //页面跳转同步通知页面路径
     $return_url = C('site_url') . '/index.php?g=Wap&m=TenpayComputer&a=return_url&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from'];
     //
     if (!$price) {
         exit('必须有价格才能支付');
     }
     $total_fee = floatval($price) * 100;
     import("@.ORG.TenpayComputer.RequestHandler");
     $out_trade_no = $orderid;
     $reqHandler = new RequestHandler();
     $reqHandler->init();
     $key = $this->payConfig['partnerkey'];
     $partner = $this->payConfig['partnerid'];
     $reqHandler->setKey($key);
     $reqHandler->setGateUrl("https://gw.tenpay.com/gateway/pay.htm");
     //----------------------------------------
     //设置支付参数
     //----------------------------------------
     $reqHandler->setParameter("partner", $partner);
     $reqHandler->setParameter("out_trade_no", $out_trade_no);
     $reqHandler->setParameter("total_fee", $total_fee);
     //总金额
     $reqHandler->setParameter("return_url", $return_url);
     $reqHandler->setParameter("notify_url", $notify_url);
     $reqHandler->setParameter("body", '财付通在线支付');
     $reqHandler->setParameter("bank_type", "DEFAULT");
     //银行类型,默认为财付通
     //用户ip
     $reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
     //客户端IP
     $reqHandler->setParameter("fee_type", "1");
     //币种
     $reqHandler->setParameter("subject", 'weixin');
     //商品名称,(中介交易时必填)
     //系统可选参数
     $reqHandler->setParameter("sign_type", "MD5");
     //签名方式,默认为MD5,可选RSA
     $reqHandler->setParameter("service_version", "1.0");
     //接口版本号
     $reqHandler->setParameter("input_charset", "utf-8");
     //字符集
     $reqHandler->setParameter("sign_key_index", "1");
     //密钥序号
     //业务可选参数
     $reqHandler->setParameter("attach", "");
     //附件数据,原样返回就可以了
     $reqHandler->setParameter("product_fee", "");
     //商品费用
     $reqHandler->setParameter("transport_fee", "0");
     //物流费用
     $reqHandler->setParameter("time_start", date("YmdHis"));
     //订单生成时间
     $reqHandler->setParameter("time_expire", "");
     //订单失效时间
     $reqHandler->setParameter("buyer_id", "");
     //买方财付通帐号
     $reqHandler->setParameter("goods_tag", "");
     //商品标记
     $reqHandler->setParameter("trade_mode", 1);
     //交易模式(1.即时到帐模式,2.中介担保模式,3.后台选择(卖家进入支付中心列表选择))
     $reqHandler->setParameter("transport_desc", "");
     //物流说明
     $reqHandler->setParameter("trans_type", "1");
     //交易类型
     $reqHandler->setParameter("agentid", "");
     //平台ID
     $reqHandler->setParameter("agent_type", "");
     //代理模式(0.无代理,1.表示卡易售模式,2.表示网店模式)
     $reqHandler->setParameter("seller_id", "");
     //卖家的商户号
     //请求的URL
     $reqUrl = $reqHandler->getRequestURL();
     //获取debug信息,建议把请求和debug信息写入日志,方便定位问题
     /**/
     $debugInfo = $reqHandler->getDebugInfo();
     header('Location:' . $reqUrl);
     //echo "<br/>" . $reqUrl . "<br/>";
     //echo "<br/>" . $debugInfo . "<br/>";
 }
示例#16
0
	public function pay()
	{
		$orderid = $_GET['orderid'];

		if (!$orderid) {
			$orderid = $_GET['single_orderid'];
		}

		$payHandel = new payHandle($this->token, $_GET['from'], 'tenpayComputer');
		$orderInfo = $payHandel->beforePay($orderid);
		$price = $orderInfo['price'];
		$orderName = $_GET['orderName'];
		$notify_url = C('site_url') . '/index.php?g=Wap&m=TenpayComputer&a=notify_url';

		if ($_GET['platform']) {
			$return_url = C('site_url') . '/index.php?g=Wap&m=TenpayComputer&a=return_url&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from'] . '&pl=1';
		}
		else {
			$return_url = C('site_url') . '/index.php?g=Wap&m=TenpayComputer&a=return_url&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from'];
		}

		if ($orderInfo['paid']) {
			exit('您已经支付过此次订单!');
		}

		if (!$price) {
			exit('必须有价格才能支付');
		}

		$total_fee = floatval($price) * 100;
		import('@.ORG.TenpayComputer.RequestHandler');
		$out_trade_no = $orderid;
		$reqHandler = new RequestHandler();
		$reqHandler->init();
		$key = $this->payConfig['partnerkey'];
		$partner = $this->payConfig['partnerid'];
		$reqHandler->setKey($key);
		$reqHandler->setGateUrl('https://gw.tenpay.com/gateway/pay.htm');
		$reqHandler->setParameter('partner', $partner);
		$reqHandler->setParameter('out_trade_no', $out_trade_no);
		$reqHandler->setParameter('total_fee', $total_fee);
		$reqHandler->setParameter('return_url', $return_url);
		$reqHandler->setParameter('notify_url', $notify_url);
		$reqHandler->setParameter('body', '财付通在线支付');
		$reqHandler->setParameter('bank_type', 'DEFAULT');
		$reqHandler->setParameter('spbill_create_ip', $_SERVER['REMOTE_ADDR']);
		$reqHandler->setParameter('fee_type', '1');
		$reqHandler->setParameter('subject', 'weixin');
		$reqHandler->setParameter('sign_type', 'MD5');
		$reqHandler->setParameter('service_version', '1.0');
		$reqHandler->setParameter('input_charset', 'utf-8');
		$reqHandler->setParameter('sign_key_index', '1');
		$reqHandler->setParameter('attach', '');
		$reqHandler->setParameter('product_fee', '');
		$reqHandler->setParameter('transport_fee', '0');
		$reqHandler->setParameter('time_start', date('YmdHis'));
		$reqHandler->setParameter('time_expire', '');
		$reqHandler->setParameter('buyer_id', '');
		$reqHandler->setParameter('goods_tag', '');
		$reqHandler->setParameter('trade_mode', 1);
		$reqHandler->setParameter('transport_desc', '');
		$reqHandler->setParameter('trans_type', '1');
		$reqHandler->setParameter('agentid', '');
		$reqHandler->setParameter('agent_type', '');
		$reqHandler->setParameter('seller_id', '');
		$reqUrl = $reqHandler->getRequestURL();
		$debugInfo = $reqHandler->getDebugInfo();
		header('Location:' . $reqUrl);
	}
示例#17
0
	public function call_back_url()
	{
		require_once $this->base_path . 'lib/alipay_notify.class.php';
		$from = htmlentities($_GET['from']);
		$pl = $_GET['pl'];
		unset($_GET['g']);
		unset($_GET['m']);
		unset($_GET['a']);
		unset($_GET['token']);
		unset($_GET['wecha_id']);
		unset($_GET['from']);
		unset($_GET['rget']);
		unset($_GET['user_params']);
		unset($_GET['pl']);
		$alipayNotify = new AlipayNotify($this->alipay_config);
		$verify_result = $alipayNotify->verifyReturn();

		if ($verify_result) {
			$out_trade_no = $_GET['out_trade_no'];
			$trade_no = $_GET['trade_no'];
			$result = $_GET['result'];

			if ($result == 'success') {
				if (!empty($pl)) {
					$_GET['pl'] = 1;
				}

				$payHandel = new payHandle($this->token, $from, 'alipay');
				$orderInfo = $payHandel->beforePay($out_trade_no);
				$nohandle = '';

				if (empty($orderInfo['paid'])) {
					$orderInfo = $payHandel->afterPay($out_trade_no, $trade_no);
				}
				else {
					$nohandle = '&nohandle=1';
				}

				$url = '/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $out_trade_no . $nohandle;
				echo '<script type="text/javascript">if (window.parent.breakIframe) {window.parent.breakIframe("' . $url . '");}else{window.location.href="' . $url . '"}</script>';
			}
			else {
				exit('付款失败');
			}
		}
		else {
			echo '验证失败';
			exit();
		}
	}
示例#18
0
 public function pay()
 {
     import("@.ORG.Tenpay.RequestHandler");
     import("@.ORG.Tenpay.client.ClientResponseHandler");
     import("@.ORG.Tenpay.client.TenpayHttpClient");
     $partner = $this->payConfig['partnerid'];
     $key = $this->payConfig['partnerkey'];
     $orderid = $_GET['orderid'];
     if (!$orderid) {
         $orderid = $_GET['single_orderid'];
         //单个订单
     }
     $out_trade_no = $orderid;
     //before
     $payHandel = new payHandle($this->token, $_GET['from']);
     $orderInfo = $payHandel->beforePay($orderid);
     $price = $orderInfo['price'];
     //
     if (!$price) {
         exit('必须有价格才能支付');
     }
     $orderName = $_GET['orderName'];
     $total_fee = floatval($price);
     /* 创建支付请求对象 */
     $reqHandler = new RequestHandler();
     $reqHandler->init();
     $reqHandler->setKey($key);
     $reqHandler->setGateUrl("http://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_init.cgi");
     $httpClient = new TenpayHttpClient();
     //应答对象
     $resHandler = new ClientResponseHandler();
     //----------------------------------------
     //设置支付参数
     //----------------------------------------
     $reqHandler->setParameter("total_fee", $total_fee * 100);
     //总金额
     //用户ip
     $reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
     //客户端IP
     $reqHandler->setParameter("ver", "2.0");
     //版本类型
     $reqHandler->setParameter("bank_type", "0");
     //银行类型,财付通填写0
     $return_url = C('site_url') . '/index.php?g=Wap&m=Tenpay&a=return_url&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&from=' . $_GET['from'];
     $reqHandler->setParameter("callback_url", $return_url);
     //交易完成后跳转的URL
     $reqHandler->setParameter("bargainor_id", $partner);
     //商户号
     $reqHandler->setParameter("sp_billno", $out_trade_no);
     //商户订单号
     $notify_url = C('site_url') . '/index.php?g=Wap&m=Tenpay&a=notify_url';
     $reqHandler->setParameter("notify_url", $notify_url);
     //接收财付通通知的URL,需绝对路径
     $reqHandler->setParameter("desc", $orderName ? $orderName : 'wechat');
     $reqHandler->setParameter("attach", "");
     $httpClient->setReqContent($reqHandler->getRequestURL());
     //后台调用
     if ($httpClient->call()) {
         $resHandler->setContent($httpClient->getResContent());
         //获得的token_id,用于支付请求
         $token_id = $resHandler->getParameter('token_id');
         $reqHandler->setParameter("token_id", $token_id);
         //请求的URL
         //$reqHandler->setGateUrl("https://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_gate.cgi");
         //此次请求只需带上参数token_id就可以了,$reqUrl和$reqUrl2效果是一样的
         //$reqUrl = $reqHandler->getRequestURL();
         $reqUrl = "http://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_gate.cgi?token_id=" . $token_id;
     }
     header('Location:' . $reqUrl);
 }
示例#19
0
	public function to_pay()
	{
		if (($_GET['pay_type'] != 'Daofu') && ($_GET['pay_type'] != 'Dianfu')) {
			$orderid = (isset($_GET['orderid']) ? $_GET['orderid'] : $_GET['single_orderid']);
			$payHandel = new payHandle($this->token, $_GET['from']);
			$orderInfo = $payHandel->beforePay($orderid);
			$price = $orderInfo['old_price'];
			$coupon_id = (isset($_REQUEST['coupon_id']) ? intval($_REQUEST['coupon_id']) : 0);

			if ($coupon_id) {
				$obj = new Member_card_coupon_recordModel();
				$coupon = $obj->check_coupon($coupon_id, $this->wecha_id, $this->token, $price);

				if ($coupon['error']) {
					$this->error($coupon['msg']);
					exit();
				}
				else {
					$coupon = $coupon['data'];
					$cpr = D('Coupon_pay_record')->where(array('orderid' => $_GET['orderid'], 'token' => $this->token, 'from' => $_GET['from'], 'wechat_id' => $this->wecha_id, 'coupon_id' => $coupon_id))->find();

					if (empty($cpr)) {
						D('Coupon_pay_record')->add(array('orderid' => $_GET['orderid'], 'token' => $this->token, 'from' => $_GET['from'], 'wechat_id' => $this->wecha_id, 'coupon_id' => $coupon_id, 'least_cost' => $coupon['least_cost'], 'reduce_cost' => $coupon['reduce_cost']));
					}

					if ($price <= $coupon['reduce_cost']) {
						$payHandel = new payHandle($_GET['token'], $_GET['from'], 'coupon');
						$orderInfo = $payHandel->afterPay($orderid, $orderid, $orderid);
						$className = 'ThirdPay' . $_GET['from'];

						if (class_exists('ThirdPay' . $_GET['from'])) {
							$className::index($orderid, 'coupon', $orderid);
						}

						exit();
					}
				}
			}
		}

		if ($_GET['pay_type'] == 'Weixin') {
			if (strpos(CONF_PATH, 'DataPig')) {
				$fileName = 'index_datapig.php';
			}
			else if (strpos(CONF_PATH, 'PigData')) {
				$fileName = 'index_pigdata.php';
			}
			else {
				$fileName = 'index.php';
			}

			header('Location:/wxpay/' . $fileName . '?g=Wap&m=Weixin&a=pay&price=' . $_GET['price'] . '&orderName=' . $_GET['orderName'] . '&single_orderid=' . $_GET['orderid'] . '&showwxpaytitle=1&from=' . $_GET['from'] . '&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&platform=' . intval($_GET['platform']));
		}
		else {
			header('Location:/index.php?g=Wap&m=' . $_GET['pay_type'] . '&a=pay&price=' . $_GET['price'] . '&orderName=' . $_GET['orderName'] . '&single_orderid=' . $_GET['orderid'] . '&from=' . $_GET['from'] . '&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&platform=' . intval($_GET['platform']));
		}
	}
示例#20
0
 public function pay()
 {
     //参数数据
     $orderName = $_GET['orderName'];
     if (!$orderName) {
         $orderName = microtime();
     }
     $orderid = $_GET['orderid'];
     if (!$orderid) {
         $orderid = $_GET['single_orderid'];
         //单个订单
     }
     //before
     $payHandel = new payHandle($this->token, $_GET['from']);
     $orderInfo = $payHandel->beforePay($orderid);
     $price = $orderInfo['price'];
     //
     $alipayConfig = $this->alipayConfig;
     //
     if (!$price) {
         exit('必须有价格才能支付');
     }
     import("@.ORG.Alipay.AlipaySubmit");
     //支付类型
     $payment_type = "1";
     //必填,不能修改
     //服务器异步通知页面路径
     $notify_url = C('site_url') . '/index.php?g=Wap&m=Alipaytype&a=notify_url';
     //需http://格式的完整路径,不能加?id=123这类自定义参数
     //页面跳转同步通知页面路径
     $return_url = C('site_url') . '/index.php?g=Wap&m=Alipaytype&a=return_url&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from'];
     //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
     //卖家支付宝帐户
     $seller_email = trim($alipayConfig['name']);
     //商户订单号
     $out_trade_no = $orderid;
     //商户网站订单系统中唯一订单号,必填
     //订单名称
     $subject = $orderName;
     //必填
     //付款金额
     $total_fee = floatval($price);
     $body = $orderName;
     //商品展示地址
     $show_url = C('site_url') . U('Home/Index/price');
     //需以http://开头的完整路径,例如:http://www.xxx.com/myorder.html
     //防钓鱼时间戳
     $anti_phishing_key = "";
     //若要使用请调用类文件submit中的query_timestamp函数
     //客户端的IP地址
     $exter_invoke_ip = "";
     //非局域网的外网IP地址,如:221.0.0.1
     $body = $subject;
     $show_url = rtrim(C('site_url'), '/');
     //构造要请求的参数数组,无需改动
     $parameter = array("service" => "create_direct_pay_by_user", "partner" => trim($alipayConfig['pid']), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $out_trade_no, "subject" => $subject, "total_fee" => $total_fee, "body" => $body, "show_url" => $show_url, "anti_phishing_key" => $anti_phishing_key, "exter_invoke_ip" => $exter_invoke_ip, "_input_charset" => trim(strtolower('utf-8')));
     //建立请求
     $alipaySubmit = new AlipaySubmit($this->setconfig());
     $html_text = $alipaySubmit->buildRequestForm($parameter, "get", "进行支付");
     echo '正在跳转到支付宝进行支付...<div style="display:none">' . $html_text . '</div>';
 }
示例#21
0
 public function pay()
 {
     //得到GET传参的订单名称,若为空则使用系统时间
     $orderName = $_GET['orderName'];
     if (!$orderName) {
         $orderName = microtime();
     }
     //得到GET传参的系统唯一订单号
     $orderid = $_GET['orderid'];
     if (!$orderid) {
         $orderid = $_GET['single_orderid'];
         //单个订单
     }
     //惯例,获取此订单号的信息
     $payHandel = new payHandle($this->token, $_GET['from'], 'allinpay');
     $orderInfo = $payHandel->beforePay($orderid);
     //判断是否已经支付过
     if ($orderInfo['paid']) {
         exit('您已经支付过此次订单!');
     }
     //判断价格是否为空。此做法可顺带查出是否是错误的订单号
     if (!$orderInfo['price']) {
         exit('必须有价格才能支付');
     }
     //为了应用 通联支付坑爹的要求(跳转地址长度为100个以内,通联数据库字段就是100的长度),,,将数据转换成ID。。。。
     //公众号
     $database_wxuser = D('Wxuser');
     $condition_wxuser['token'] = $this->token;
     $now_wxuser = $database_wxuser->field('`id` `wx_id`')->where($condition_wxuser)->find();
     if (empty($now_wxuser)) {
         $this->error('查询数据异常!请重试。');
     }
     //微信用户
     $database_wecha_user = D('Wecha_user');
     $condition_wecha_user['wecha_id'] = $this->wecha_id;
     $now_wecha_user = $database_wecha_user->field('`id` `we_id`')->where($condition_wecha_user)->find();
     if (empty($now_wecha_user)) {
         $this->error('查询数据异常!请重试。');
     }
     if (empty($_GET['platform'])) {
         $return_url = C('site_url') . '/index.php?g=Wap&m=Allinpay&a=r_u&wx_id=' . $now_wxuser['wx_id'] . '&we_id=' . $now_wecha_user['we_id'] . '&from=' . $_GET['from'];
     } else {
         $return_url = C('site_url') . '/index.php?g=Wap&m=Allinpay&a=r_u&wx_id=' . $now_wxuser['wx_id'] . '&we_id=' . $now_wecha_user['we_id'] . '&from=' . $_GET['from'] . '&pl=1';
     }
     //在此引入通联处理类,防止引入又被价格错误返回导致终止
     import('@.ORG.Allinpay.allinpayCore');
     $allinpayClass = new allinpayCore();
     $allinpayClass->setParameter('payUrl', 'http://ceshi.allinpay.com/mobilepayment/mobile/SaveMchtOrderServlet.action');
     //提交地址
     $allinpayClass->setParameter('pickupUrl', $return_url);
     //跳转通知地址
     $allinpayClass->setParameter('receiveUrl', C('site_url') . '/index.php?g=Wap&m=Allinpay&a=notify_url');
     //异步通知地址
     $allinpayClass->setParameter('merchantId', $this->payConfig['merchantId']);
     //商户号
     $allinpayClass->setParameter('orderNo', $orderInfo['orderid']);
     //订单号
     $allinpayClass->setParameter('orderAmount', floatval($orderInfo['price']) * 100);
     //订单金额(单位分)
     $allinpayClass->setParameter('orderDatetime', date('YmdHis', $_SERVER['REQUEST_TIME']));
     //订单提交时间
     $allinpayClass->setParameter('productName', $orderName);
     //商品名称
     $allinpayClass->setParameter('payType', 0);
     //支付方式
     $allinpayClass->setParameter('key', $this->payConfig['merchantKey']);
     //支付方式
     //开始跳转支付
     $allinpayClass->sendRequestForm();
 }