فهرست منبع

fix(wechatpay):优化支付通知处理逻辑- 将未实现事件类型的异常抛出改为记录警告日志并抛出逻辑异常
- 更新订单查询条件以使用解析后的数据字段
- 增强对非成功交易事件的处理能力

runphp 5 ماه پیش
والد
کامیت
b532c75752
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      src/PaymentProvider.php

+ 3 - 2
src/PaymentProvider.php

@@ -108,11 +108,12 @@ class PaymentProvider implements PaymentProviderInterface
         $inBody = $request['inBody'];
         $data = $this->notifyService->transactionSuccess($request['headers'], json_encode($request['inBody']));
         if ($inBody['event_type'] !== 'TRANSACTION.SUCCESS') {
-            throw new \RuntimeException('Not implemented: ' . $inBody['event_type']);
+            Log::warning('Not implemented: ' . $inBody['event_type']. ' ' . json_encode($data));
+            throw_logic_exception('Not implemented: ' . $inBody['event_type']);
         }
         Log::debug(__METHOD__ . json_encode($data));
         $payment = $this->extensionPaymentEntity->where([
-            'out_trade_no' => $inBody['data']['out_trade_no'],
+            'out_trade_no' => $data['out_trade_no'],
         ])->findOrEmpty();
         if ($payment->isEmpty()) {
             throw new \RuntimeException('订单不存在或已结束');