作者 魏强

支付回掉

@@ -16,6 +16,9 @@ class IndexController extends HomeBaseController @@ -16,6 +16,9 @@ class IndexController extends HomeBaseController
16 protected $abc; 16 protected $abc;
17 public function index() 17 public function index()
18 { 18 {
  19 + echo cache('test');
  20 + var_dump(cache('message'));
  21 + var_dump(cache('reqInfo'));
19 return $this->fetch(':index'); 22 return $this->fetch(':index');
20 } 23 }
21 } 24 }
@@ -125,9 +125,9 @@ class PayController extends HomeBaseController @@ -125,9 +125,9 @@ class PayController extends HomeBaseController
125 $app = new Application($this->options); 125 $app = new Application($this->options);
126 $payment = $app->payment; 126 $payment = $app->payment;
127 //使用商户订单号退款 PS.其他形式参考文档 127 //使用商户订单号退款 PS.其他形式参考文档
128 - $orderNo = "2018080210097519";//商户系统内部的订单号(out_trade_no) 128 + $orderNo = "2018080397100101";//商户系统内部的订单号(out_trade_no)
129 $refundNo = cmf_get_order_sn();//退款单号 129 $refundNo = cmf_get_order_sn();//退款单号
130 - $result = $payment->refund($orderNo, $refundNo, 100, 80); // 总金额 100, 退款 80,refundFee可选(为空时全额退款) 130 + $result = $payment->refund($orderNo, $refundNo, 1, 1); // 总金额 100, 退款 80,refundFee可选(为空时全额退款)
131 var_dump($result); 131 var_dump($result);
132 } 132 }
133 133
@@ -146,11 +146,11 @@ class PayController extends HomeBaseController @@ -146,11 +146,11 @@ class PayController extends HomeBaseController
146 * 退款结果回调 146 * 退款结果回调
147 */ 147 */
148 public function refundNotify() { 148 public function refundNotify() {
  149 + cache('test',123123);
149 $app = new Application($this->options); 150 $app = new Application($this->options);
150 - $response = $app->payment->handleRefundNotify(function ($message, $reqInfo, $fail) { 151 + $response = $app->payment->handleRefundNotify(function ($message, $reqInfo) {
151 cache('message',$message); 152 cache('message',$message);
152 cache('reqInfo',$reqInfo); 153 cache('reqInfo',$reqInfo);
153 - cache('fail',$fail);  
154 // 其中 $message['req_info'] 获取到的是加密信息 154 // 其中 $message['req_info'] 获取到的是加密信息
155 // $reqInfo 为 message['req_info'] 解密后的信息 155 // $reqInfo 为 message['req_info'] 解密后的信息
156 // 你的业务逻辑... 156 // 你的业务逻辑...