Example #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);
	}
 public function return_url()
 {
     $v_oid = trim($_POST['v_oid']);
     $v_pmode = trim($_POST['v_pmode']);
     $v_pstatus = trim($_POST['v_pstatus']);
     $v_pstring = trim($_POST['v_pstring']);
     $v_amount = trim($_POST['v_amount']);
     $v_moneytype = trim($_POST['v_moneytype']);
     $remark1 = trim($_POST['remark1']);
     $remark2 = trim($_POST['remark2']);
     $v_md5str = trim($_POST['v_md5str']);
     $key = $this->payConfig['chinabank_key'];
     $md5string = strtoupper(md5($v_oid . $v_pstatus . $v_amount . $v_moneytype . $key));
     if ($v_md5str == $md5string) {
         if ($v_pstatus == '20') {
             $order_id = $_POST['v_oid'];
             $payHandel = new payHandle($_GET['token'], $_GET['from'], 'chinabank');
             $orderInfo = $payHandel->afterPay($order_id, $_POST['v_idx']);
             $from = $payHandel->getFrom();
             $this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $order_id);
         }
     } else {
         $this->error('支付时发生错误!请检查。');
     }
 }
Example #3
0
 private function gotopay($orderid, $price, $from, $orderName, $redirect = NULL)
 {
     $userinfo = M('Userinfo');
     $payrecord = M('Member_card_pay_record');
     $create = M('Member_card_create');
     $exchange = M('Member_card_exchange');
     $cardid = $create->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->getField('cardid');
     $cardid = (int) $cardid;
     $reward = $exchange->where(array('token' => $this->token, 'cardid' => $cardid))->getField('reward');
     $reward = (int) $reward;
     $uinfo = $userinfo->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->field('id,balance,expensetotal,total_score')->find();
     if (!$orderid) {
         $this->error('请传入订单号');
     }
     if ($uinfo['balance'] < $price) {
         $this->error('余额不足');
     }
     if ($payrecord->where('orderid = \'' . $orderid . '\'')->getField('id')) {
         $flag1 = true;
     } else {
         $record['orderid'] = $orderid;
         $record['ordername'] = $orderName;
         $record['paytype'] = 'CardPay';
         $record['createtime'] = time();
         $record['paid'] = 0;
         $record['price'] = $price;
         $record['token'] = $this->token;
         $record['wecha_id'] = $this->wecha_id;
         $record['type'] = 0;
         $record['cardid'] = $cardid;
         $flag1 = $payrecord->add($record);
     }
     $udata['balance'] = $uinfo['balance'] - $price;
     $flag2 = $userinfo->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->save($udata);
     $payHandel = new payHandle($this->token, $from, 'CardPay');
     $payHandel->afterPay($orderid);
     if ($flag1 && $flag2) {
         $payrecord->where(array('orderid' => $orderid, 'token' => $this->token))->setField('paid', 1);
         if (isset($redirect)) {
             $urlinfo = explode('|', $_GET['redirect']);
             $parmArr = explode(',', $urlinfo[1]);
             $parms = array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'paytype' => 'CardPay', 'orderid' => $orderid);
             if ($parmArr) {
                 foreach ($parmArr as $pa) {
                     $pas = explode(':', $pa);
                     $parms[$pas[0]] = $pas[1];
                 }
             }
             $this->redirect(U($urlinfo[0], $parms));
         } else {
             $this->redirect(U($from . '/payReturn', array('orderid' => $orderid, 'token' => $this->token, 'wecha_id' => $this->wecha_id, 'paytype' => 'CardPay')));
         }
     } else {
         $this->error('支付失败');
     }
 }
Example #4
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();
 }
Example #5
0
 public function r_u()
 {
     import('@.ORG.Allinpay.allinpayCore');
     $allinpayClass = new allinpayCore();
     $verify_result = $allinpayClass->verify_pay($this->payConfig['merchantKey']);
     if (!$verify_result['error']) {
         $payHandel = new payHandle($this->token, $_GET['from'], 'allinpay');
         $orderInfo = $payHandel->afterPay($verify_result['order_id'], $verify_result['paymentOrderId']);
         $from = $payHandel->getFrom();
         $this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $verify_result['order_id']);
     } else {
         $this->error($verify_result['msg']);
     }
 }
Example #6
0
 public function return_url()
 {
     S('pay', $_GET);
     $out_trade_no = $this->_get('out_trade_no');
     if (intval($_GET['total_fee']) && !intval($_GET['trade_state'])) {
         //after
         $payHandel = new payHandle($_GET['token'], $_GET['from']);
         $orderInfo = $payHandel->afterPay($out_trade_no, $this->get('transaction_id'));
         $from = $payHandel->getFrom();
         //
         if (strtolower($from) == 'groupon') {
             //$order_model->where(array('orderid'=>$out_trade_no))->save(array('transactionid'=>$this->_get('transaction_id'),'paytype'=>'weixin'));
         }
     } else {
         exit('付款失败');
     }
 }
Example #7
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();
 }
Example #8
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);
     }
 }
Example #9
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);
 }
Example #10
0
	public function return_url()
	{
		S('pay2' . $this->token, $_GET);
		F('pay2' . $this->token, $_GET);
		$out_trade_no = $this->_get('out_trade_no');
		$out_trade_no = str_replace(array('_system', '_other'), '', $out_trade_no);
		if (intval($_GET['total_fee']) && !intval($_GET['trade_state'])) {
			$payHandel = new payHandle($_GET['token'], $_GET['from'], 'weixin');
			$orderInfo = $payHandel->afterPay($out_trade_no, $_GET['transaction_id'], $_GET['transaction_id']);
			$className = 'ThirdPay' . $_GET['from'];

			if (class_exists('ThirdPay' . $_GET['from'])) {
				$className::index($out_trade_no, 'weixin', $_GET['transaction_id']);
			}

			exit('<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>');
			exit('SUCCESS');
		}
		else {
			exit('付款失败');
		}
	}
Example #11
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 return_url()
 {
     import("@.ORG.TenpayComputer.ResponseHandler");
     $resHandler = new ResponseHandler();
     $key = $this->payConfig['partnerkey'];
     $resHandler->setKey($key);
     $out_trade_no = $this->_get('out_trade_no');
     //if($resHandler->isTenpaySign()) {
     $notify_id = $resHandler->getParameter("notify_id");
     //商户订单号
     $out_trade_no = $resHandler->getParameter("out_trade_no");
     //财付通订单号
     $transaction_id = $resHandler->getParameter("transaction_id");
     //金额,以分为单位
     $total_fee = $resHandler->getParameter("total_fee");
     //如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee
     $discount = $resHandler->getParameter("discount");
     //支付结果
     $trade_state = $resHandler->getParameter("trade_state");
     //交易模式,1即时到账
     $trade_mode = $resHandler->getParameter("trade_mode");
     if ("0" == $trade_state) {
         //after
         $payHandel = new payHandle($_GET['token'], $_GET['from'], 'tenpayComputer');
         $orderInfo = $payHandel->afterPay($out_trade_no);
         $from = $payHandel->getFrom();
         //
         $this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $out_trade_no);
     } else {
         exit('付款失败');
     }
     //}else {
     //exit('sign error');
     //	}
 }
Example #13
0
 public function return_url()
 {
     S('pay2' . $this->token, $_GET);
     F('pay2' . $this->token, $_GET);
     $out_trade_no = $this->_get('out_trade_no');
     if (intval($_GET['total_fee']) && !intval($_GET['trade_state'])) {
         $payHandel = new payHandle($_GET['token'], $_GET['from'], 'weixin');
         $orderInfo = $payHandel->afterPay($out_trade_no, $_GET['transaction_id'], $_GET['transaction_id']);
         $className = 'ThirdPay' . $_GET['from'];
         if (class_exists('ThirdPay' . $_GET['from'])) {
             $className::index($out_trade_no, 'weixin', $_GET['transaction_id']);
         }
         exit('SUCCESS');
     } else {
         exit('付款失败');
     }
 }
Example #14
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']));
		}
	}
Example #15
0
 public function return_url()
 {
     import("@.ORG.Tenpay.ResponseHandler");
     import("@.ORG.Tenpay.WapResponseHandler");
     /* 密钥 */
     $partner = $this->payConfig['partnerid'];
     $key = $this->payConfig['partnerkey'];
     /* 创建支付应答对象 */
     $resHandler = new WapResponseHandler();
     $resHandler->setKey($key);
     //判断签名
     if ($resHandler->isTenpaySign()) {
         //商户订单号
         $out_trade_no = $resHandler->getParameter("sp_billno");
         //财付通交易单号
         $transaction_id = $resHandler->getParameter("transaction_id");
         //金额,以分为单位
         $total_fee = $resHandler->getParameter("total_fee");
         //支付结果
         $pay_result = $resHandler->getParameter("pay_result");
         if ("0" == $pay_result) {
             //after
             $payHandel = new payHandle($_GET['token'], $_GET['from']);
             $orderInfo = $payHandel->afterPay($out_trade_no);
             $from = $payHandel->getFrom();
             $this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $out_trade_no);
         } else {
             //当做不成功处理
             $string = "<br/>" . "支付失败" . "<br/>";
             echo $string;
         }
     } else {
         $string = "<br/>" . "认证签名失败" . "<br/>";
         echo $string;
     }
 }
Example #16
0
		private function gotopay($orderid,$price,$from,$orderName,$redirect=NULL){
			
				$userinfo = M('Userinfo');
				$payrecord = M('Member_card_pay_record');
				$create = M('Member_card_create');
				$exchange = M('Member_card_exchange');

				$cardid = $create->where(array('token'=>$this->token,'wecha_id'=>$this->wecha_id))->getField('cardid');
				$cardid = (int)$cardid;
				$reward = $exchange->where(array('token'=>$this->token,'cardid'=>$cardid))->getField('reward');
				$reward = (int)$reward;
				$uinfo = $userinfo->where(array('token'=>$this->token,'wecha_id'=>$this->wecha_id))->field('id,balance,expensetotal,total_score')->find();

				if(!$orderid)$this->error('请传入订单号');
				if($uinfo['balance'] < $price){
					$this->error('余额不足');
				}
				if($payrecord->where("orderid = '$orderid'")->getField('id')){
					$flag1 = true;
				}else{
					$record['orderid'] = $orderid;
					$record['ordername'] = $orderName;
					$record['paytype'] = 'CardPay';
					$record['createtime'] = time();
					$record['paid'] = 0;
					$record['price'] = $price;
					$record['token'] = $this->token;
					$record['wecha_id'] = $this->wecha_id;
					$record['type'] = 0;
					$record['cardid'] = $cardid;
					$flag1 = $payrecord->add($record);
				}				
					$payHandel=new payHandle($this->token,$from,'CardPay');
					$payHandel->afterPay($orderid);
					$udata['balance'] = $uinfo['balance'] - $price;
		$set_exchange = M("Member_card_exchange")->where(array("cardid" => $cardid))->find();

		if (0 < $set_exchange["reward"]) {
			$arr["score"] = intval($price * $set_exchange["reward"]);
		}

		$udata["total_score"] = $uinfo["total_score"] + $arr["score"];
		$udata["expensetotal"] = $uinfo["expensetotal"] + $price;
					$flag2 = $userinfo->where(array('token'=>$this->token,'wecha_id'=>$this->wecha_id))->save($udata);
	
						if($flag1 && $flag2){
							// 2015-08-13 修改会员卡支付
							if ( 'card' == strtolower($this->_get('from'))) {
								$rwhere     = array('token'=>$this->token,'wecha_id'=>$this->wecha_id,'id'=>$this->_get('consume_id'));
								M('Member_card_coupon_record')->where($rwhere)->save(array('use_time'=>time(),'is_use'=>'1','staff_id'=>-1));
							}
							$payrecord->where(array('orderid'=>$orderid,'token'=>$this->token))->setField('paid',1);
									if (isset($redirect)){
									$urlinfo=explode('|',$_GET['redirect']);
									$parmArr=explode(',',$urlinfo[1]);
									$parms=array('token'=>$this->token,'wecha_id'=>$this->wecha_id,'paytype'=>'CardPay','orderid'=>$orderid);
									if ($parmArr){
										foreach ($parmArr as $pa){
											$pas=explode(':',$pa);
											$parms[$pas[0]]=$pas[1];
										}
									}
									$this->redirect(U($urlinfo[0],$parms));
									
								}else{
									$this->redirect(U("$from/payReturn",array('orderid'=>$orderid,'token'=>$this->token,'wecha_id'=>$this->wecha_id,'paytype'=>'CardPay')));
								}
							
						}else{
						
							$this->error('支付失败');
						}
		
		}
 public function return_url()
 {
     import("@.ORG.Alipay.AlipayNotify");
     $alipayNotify = new AlipayNotify($this->setconfig());
     $verify_result = $alipayNotify->verifyReturn();
     //if($verify_result) {
     $out_trade_no = $this->_get('out_trade_no');
     //支付宝交易号
     $trade_no = $this->_get('trade_no');
     //交易状态
     $trade_status = $this->_get('trade_status');
     if ($this->_get('trade_status') == 'TRADE_FINISHED' || $this->_get('trade_status') == 'TRADE_SUCCESS') {
         //after
         $payHandel = new payHandle($_GET['token'], $_GET['from']);
         $orderInfo = $payHandel->afterPay($out_trade_no);
         $from = $payHandel->getFrom();
         $this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $out_trade_no);
     } else {
         exit('付款失败');
     }
     //}else {
     //exit('不存在的订单');
     //}
 }
Example #18
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();
		}
	}
Example #19
0
 public function return_url()
 {
     import('@.ORG.Yeepay.yeepayMPay');
     $yeepay = new yeepayMPay($this->payConfig['merchantaccount'], $this->payConfig['merchantPublicKey'], $this->payConfig['merchantPrivateKey'], $this->payConfig['yeepayPublicKey']);
     try {
         $data = str_replace(' ', '+', $_GET['data']);
         $encryptkey = str_replace(' ', '+', $_GET['encryptkey']);
         $return = $yeepay->callback($data, $encryptkey);
         $database_yeepay_tmp = M('Yeepay_tmp');
         $condition_yeepay_tmp['id'] = str_replace('ORDER_', '', $return['orderid']);
         $yeepay_tmp = $database_yeepay_tmp->field(true)->where($condition_yeepay_tmp)->find();
         $_GET['platform'] = $yeepay_tmp['platform'];
         $payHandel = new payHandle($yeepay_tmp['token'], $yeepay_tmp['from'], 'yeepay');
         $orderInfo = $payHandel->afterPay($yeepay_tmp['order_id'], $return['yborderid']);
         $from = $payHandel->getFrom();
         unset($_SESSION['yeepay']);
         $this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $yeepay_tmp['order_id']);
     } catch (yeepayMPayException $e) {
         $this->error('支付时发生错误!错误提示:' . $e->GetMessage() . ';错误代码:' . $e->Getcode());
     }
 }
	public function return_url()
	{
		import('@.ORG.TenpayComputer.ResponseHandler');
		$resHandler = new ResponseHandler();
		$key = $this->payConfig['partnerkey'];
		$resHandler->setKey($key);
		$out_trade_no = $this->_get('out_trade_no');
		$notify_id = $resHandler->getParameter('notify_id');
		$out_trade_no = $resHandler->getParameter('out_trade_no');
		$transaction_id = $resHandler->getParameter('transaction_id');
		$total_fee = $resHandler->getParameter('total_fee');
		$discount = $resHandler->getParameter('discount');
		$trade_state = $resHandler->getParameter('trade_state');
		$trade_mode = $resHandler->getParameter('trade_mode');

		if ('0' == $trade_state) {
			$payHandel = new payHandle($_GET['token'], $_GET['from'], 'tenpayComputer');
			$orderInfo = $payHandel->afterPay($out_trade_no, $_GET['transaction_id']);
			$from = $payHandel->getFrom();
			$this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $out_trade_no);
		}
		else {
			exit('付款失败');
		}
	}