Authored by 郝肖肖

支付宝银行回调地址修改

@@ -233,8 +233,6 @@ class PayData @@ -233,8 +233,6 @@ class PayData
233 public static function pcpayNotify($orderCode, $payment, $amount, $bankName = '', $bankCode = '', $tradeNo = '', $bankBillNo = '') 233 public static function pcpayNotify($orderCode, $payment, $amount, $bankName = '', $bankCode = '', $tradeNo = '', $bankBillNo = '')
234 { 234 {
235 $param = Yohobuy::param(); 235 $param = Yohobuy::param();
236 - $param['client_type'] = 'web';  
237 - $param['private_key'] = Yohobuy::$privateKeyList['web'];  
238 $param['method'] = 'web.SpaceOrders.pcpayNotify'; 236 $param['method'] = 'web.SpaceOrders.pcpayNotify';
239 $param['order_code'] = $orderCode; 237 $param['order_code'] = $orderCode;
240 $param['payment'] = $payment; 238 $param['payment'] = $payment;
@@ -243,7 +241,6 @@ class PayData @@ -243,7 +241,6 @@ class PayData
243 $param['amount'] = $amount; 241 $param['amount'] = $amount;
244 $param['trade_no'] = $tradeNo; 242 $param['trade_no'] = $tradeNo;
245 $param['bank_bill_no'] = $bankBillNo; 243 $param['bank_bill_no'] = $bankBillNo;
246 -  
247 $param['client_secret'] = Sign::getSign($param); 244 $param['client_secret'] = Sign::getSign($param);
248 245
249 return Yohobuy::get(Yohobuy::API_URL, $param); 246 return Yohobuy::get(Yohobuy::API_URL, $param);
@@ -33,14 +33,14 @@ class Config @@ -33,14 +33,14 @@ class Config
33 * Enter description here ... 33 * Enter description here ...
34 * @var String 34 * @var String
35 */ 35 */
36 - var $notify_url = "notice/alibanknotice"; 36 + var $notify_url = "payment/alibank_notice";
37 37
38 /** 38 /**
39 * 浏览器的返回 39 * 浏览器的返回
40 * Enter description here ... 40 * Enter description here ...
41 * @var string 41 * @var string
42 */ 42 */
43 - var $return_url = "notice/alibankreturn"; 43 + var $return_url = "/pay/payreturn/alibankreturn";
44 44
45 /** 45 /**
46 * 签名方式 46 * 签名方式
@@ -7,6 +7,8 @@ use WebPlugin\Pay\PayAbstract; @@ -7,6 +7,8 @@ use WebPlugin\Pay\PayAbstract;
7 use WebPlugin\Pay\Reqparams; 7 use WebPlugin\Pay\Reqparams;
8 use WebPlugin\Pay\Rspparams; 8 use WebPlugin\Pay\Rspparams;
9 use WebPlugin\PhpLog; 9 use WebPlugin\PhpLog;
  10 +use Api\Yohobuy;
  11 +use Plugin\Helpers;
10 12
11 class Service extends PayAbstract 13 class Service extends PayAbstract
12 { 14 {
@@ -42,19 +44,19 @@ class Service extends PayAbstract @@ -42,19 +44,19 @@ class Service extends PayAbstract
42 44
43 public function getPayRequestPars(Reqparams $params) 45 public function getPayRequestPars(Reqparams $params)
44 { 46 {
45 - $baseUrl = $this->getBaseNoticeUrl($params->isTest);  
46 - $loseTime = intval(($params->orderTime + 7200 - time()) / 60); 47 +// $baseUrl = $this->getBaseNoticeUrl($params->isTest);
  48 +// $loseTime = intval(($params->orderTime + 7200 - time()) / 60);
47 // $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60); 49 // $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60);
48 50
49 $parameter = array( 51 $parameter = array(
50 'service' => $this->config->service, 52 'service' => $this->config->service,
51 'partner' => $this->config->partner, 53 'partner' => $this->config->partner,
52 '_input_charset' => $this->config->input_charset, 54 '_input_charset' => $this->config->input_charset,
53 - 'notify_url' => $baseUrl . $this->config->notify_url,  
54 - 'return_url' => $baseUrl . $this->config->return_url, 55 + 'notify_url' => Yohobuy::SERVICE_URL . $this->config->notify_url,
  56 + 'return_url' => Helpers::url($this->config->return_url),
55 /* 业务参数 */ 57 /* 业务参数 */
56 'subject' => $params->goodsName, 58 'subject' => $params->goodsName,
57 - 'out_trade_no' => $params->orderCode . '_' . $params->paymentParameter, 59 + 'out_trade_no' => $params->orderCode,
58 'total_fee' => $params->totalFee / 100, //单位为元 60 'total_fee' => $params->totalFee / 100, //单位为元
59 'payment_type' => $this->config->payment_type, 61 'payment_type' => $this->config->payment_type,
60 'defaultbank' => $params->paymentParameter, 62 'defaultbank' => $params->paymentParameter,
@@ -134,14 +136,8 @@ class Service extends PayAbstract @@ -134,14 +136,8 @@ class Service extends PayAbstract
134 // $outTradeNo = substr($outTradeNo, 2); 136 // $outTradeNo = substr($outTradeNo, 2);
135 // } 137 // }
136 //支付订单处理 138 //支付订单处理
137 - $orderCodeArr = explode('_', $outTradeNo);  
138 - if (count($orderCodeArr) == 2) {  
139 - $rsp->orderCode = $orderCodeArr[0];  
140 - $rsp->bankName = $orderCodeArr[1];  
141 - } else {  
142 - $rsp->orderCode = $outTradeNo;  
143 - $rsp->bankName = "";  
144 - } 139 + $rsp->orderCode = intval($outTradeNo);
  140 + $rsp->bankName = "";
145 $rsp->payResult = $this->convertResult($arrResponse["trade_status"]); 141 $rsp->payResult = $this->convertResult($arrResponse["trade_status"]);
146 $rsp->payTime = isset($arrResponse["gmt_payment"]) ? $arrResponse["gmt_payment"] : time(); 142 $rsp->payTime = isset($arrResponse["gmt_payment"]) ? $arrResponse["gmt_payment"] : time();
147 $rsp->totalFee = $arrResponse["total_fee"]; 143 $rsp->totalFee = $arrResponse["total_fee"];
@@ -67,13 +67,26 @@ class PayreturnController extends WebAction @@ -67,13 +67,26 @@ class PayreturnController extends WebAction
67 */ 67 */
68 public function unionpaywebreturnAction() 68 public function unionpaywebreturnAction()
69 { 69 {
70 - $payment = PayModel::getPaymentById(25); 70 + $payment = PaymentModel::getPaymentById(25);
71 $payService = PayFactory::factory($payment); 71 $payService = PayFactory::factory($payment);
72 $res = $payService->parseResponse($_REQUEST); 72 $res = $payService->parseResponse($_REQUEST);
73 $dealResult = $this->payResultProc($res, 25); 73 $dealResult = $this->payResultProc($res, 25);
74 $dealResult['payData'] = array('payWay' => '银联在线支付'); 74 $dealResult['payData'] = array('payWay' => '银联在线支付');
75 $this->commonShowResult($dealResult); 75 $this->commonShowResult($dealResult);
76 } 76 }
  77 + /*
  78 + * 支付宝银行支付回调-同步地址
  79 + */
  80 + public function alibankreturnAction()
  81 + {
  82 + $payment = PaymentModel::getPaymentById(12);
  83 +
  84 + $payService = PayFactory::factory($payment);
  85 + $res = $payService->parseResponse($_GET);
  86 + $dealResult = $this->payResultProc($res, 12);
  87 + $dealResult['payData'] = array('payWay' => '支联支付');
  88 + $this->commonShowResult($dealResult);
  89 + }
77 /** 90 /**
78 * 通用显示结果的方法 91 * 通用显示结果的方法
79 * @param array $dealResult 92 * @param array $dealResult
@@ -115,7 +128,7 @@ class PayreturnController extends WebAction @@ -115,7 +128,7 @@ class PayreturnController extends WebAction
115 if (!empty($payResult->orderCode)) { 128 if (!empty($payResult->orderCode)) {
116 //支付成功,发送一次支付确认 129 //支付成功,发送一次支付确认
117 $uid = $this->getUid(true); 130 $uid = $this->getUid(true);
118 - PaymentModel::sendPayConfirm($payResult, $payment, $uid); 131 + PaymentModel::sendPayConfirm($payResult->orderCode, $payment, $uid);
119 } 132 }
120 133
121 //支付成功 134 //支付成功