xieruidong 2 년 전
부모
커밋
f6d6f7f4fe

+ 2 - 2
application/common/library/upacp_demo_b2c/sdk/acp_service.php

@@ -535,7 +535,7 @@ eot;
 		return $file_content_base64;
 	}
 
-	public static function refund($orderNo,$payNo,$amount){
+	public static function refund($orderNo,$payNo,$amount,$notifyUrl=''){
         $params = array(
 
             //以下信息非特殊情况不需要改动
@@ -547,7 +547,7 @@ eot;
             'bizType' => '000201',		      //业务类型
             'accessType' => '0',		      //接入类型
             'channelType' => '07',		      //渠道类型
-            'backUrl' => SDKConfig::getSDKConfig()->backUrl, //后台通知地址
+            'backUrl' => $notifyUrl, //后台通知地址
 
             //TODO 以下信息需要填写
             'orderId' => $orderNo,	    //商户订单号,8-32位数字字母,不能含“-”或“_”,可以自行定制规则,重新产生,不同于原消费,此处默认取demo演示页面传递的参数

+ 4 - 1
application/common/service/OrderRefundService.php

@@ -72,9 +72,12 @@ class OrderRefundService{
            throw_user($e->raw['alipay_trade_refund_response']['sub_msg']);
        }
    }
+   protected function notifyUrl(){
+       return request()->root(true)."/index/payment/refund/order_no/".$this->refund->order_no;
+   }
    public function bankUnion(){
        require __DIR__.'/../library/upacp_demo_b2c/sdk/acp_service.php';
-        list($bool,$msg)=AcpService::refund($this->refund->order_no,$this->payment->pay_no,$this->getAmount('f'));
+        list($bool,$msg)=AcpService::refund($this->refund->order_no,$this->payment->pay_no,$this->getAmount('f'),$this->notifyUrl());
         user_log("OrderRefundService/bankUnion/{$this->refund->order_no}",compact('bool','msg'));
         if(!$bool){
             throw_user($msg);

+ 9 - 0
application/index/controller/Payment.php

@@ -43,4 +43,13 @@ class Payment extends Frontend
         }
         return $succ;
     }
+    /**
+     * 退款回调
+     */
+    public function refund($order_no){
+        user_log('refund',[
+            'order_no'=>$order_no,
+            'post'=>input(),
+        ]);
+    }
 }