소스 검색

Merge branch 'v4.7.0dev' into v5.0.0dev

evoxwht 2 년 전
부모
커밋
45a7c1d032
2개의 변경된 파일14개의 추가작업 그리고 8개의 파일을 삭제
  1. 3 1
      crmeb/crmeb/services/pay/storage/AllinPay.php
  2. 11 7
      crmeb/crmeb/services/pay/storage/WechatPay.php

+ 3 - 1
crmeb/crmeb/services/pay/storage/AllinPay.php

@@ -14,6 +14,7 @@
 namespace crmeb\services\pay\storage;
 
 use app\services\pay\PayServices;
+use crmeb\exceptions\AdminException;
 use crmeb\exceptions\PayException;
 use crmeb\services\pay\BasePay;
 use crmeb\services\pay\PayInterface;
@@ -115,7 +116,8 @@ class AllinPay extends BasePay implements PayInterface
      */
     public function refund(string $outTradeNo, array $options = [])
     {
-        return $this->pay->refund($options['refund_price'], $options['order_id'], $outTradeNo);
+        $result = $this->pay->refund($options['refund_price'], $options['order_id'], $outTradeNo);
+        if ($result['retcode'] != 'SUCCESS') throw new AdminException($result['retmsg']);
     }
 
     public function queryRefund(string $outTradeNo, string $outRequestNo, array $other = [])

+ 11 - 7
crmeb/crmeb/services/pay/storage/WechatPay.php

@@ -103,18 +103,22 @@ class WechatPay extends BasePay implements PayInterface
         $refundNo = $opt['refund_id'] ?? $outTradeNo;
         $opUserId = $opt['op_user_id'] ?? null;
         $type = $opt['type'] ?? 'out_trade_no';
-        /*仅针对老资金流商户使用
-        REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款(默认使用未结算资金退款)
-        REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款
-        */
+        /**
+         * 仅针对老资金流商户使用
+         * REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款(默认使用未结算资金退款)
+         * REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款
+         */
         $refundAccount = $opt['refund_account'] ?? 'REFUND_SOURCE_UNSETTLED_FUNDS';
         if (isset($opt['wechat'])) {
-            return WechatService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount);
+            $result = WechatService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount);
+            if ($result['status'] != 'SUCCESS') throw new AdminException($result['status']);
         } else {
             if ($opt['pay_new_weixin_open']) {
-                return MiniProgramService::miniRefund($outTradeNo, $totalFee, $refundFee, $opt);
+                $result = MiniProgramService::miniRefund($outTradeNo, $totalFee, $refundFee, $opt);
+                if ($result['errcode'] != 0) throw new AdminException($result['errmsg']);
             } else {
-                return MiniProgramService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount);
+                $result = MiniProgramService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount);
+                if ($result['status'] != 'SUCCESS') throw new AdminException($result['status']);
             }
         }
     }