فهرست منبع

OMG渠道承接Apple Pay(payType=5):修复创建支付被拒

按023已确认的信用卡+ApplePay同组同商语义,新增isCardWalletPayType(2或5);替换OMG创建校验/接单支付门槛/状态推进在线支付要求/平台交易号查询四处单值比较;被拒订单991788429392064部署后重新创建即恢复

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
qmj 1 روز پیش
والد
کامیت
07715c2dd1

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 79 - 0
.claude/homunculus/observations.jsonl


+ 3 - 1
ruoyi-admin/src/main/java/com/ruoyi/app/omgpay/OmgPaymentCreateService.java

@@ -1,5 +1,7 @@
 package com.ruoyi.app.omgpay;
 
+import com.ruoyi.app.order.OrderLifecycleService;
+
 import com.ruoyi.app.omgpay.dto.OmgCreatePaymentResponse;
 import com.ruoyi.system.domain.PosStoreOmg;
 import com.ruoyi.system.omgpay.domain.OmgPaymentAttempt;
@@ -150,7 +152,7 @@ public class OmgPaymentCreateService {
         if (order.getPayStatus() == null || order.getPayStatus() != 0) {
             throw business(ORDER_ALREADY_PAID, storeId);
         }
-        if (!"2".equals(order.getPayType())) {
+        if (!OrderLifecycleService.isCardWalletPayType(order.getPayType())) {
             throw business(PAYMENT_TYPE_INVALID, storeId);
         }
         if (order.getAmount() == null || order.getAmount() <= 0) {

+ 9 - 2
ruoyi-admin/src/main/java/com/ruoyi/app/order/OrderLifecycleService.java

@@ -36,6 +36,13 @@ public class OrderLifecycleService {
     public static final String PAY_TYPE_CASH = "4";
     /** 線下轉賬支付:用户线下银行转账,商家确认收款(payStatus 从 0 置 1)后解锁骑手接单 */
     public static final String PAY_TYPE_TRANSFER = "6";
+    /** Apple Pay(023 重定义:历史 payType=5 无业务价值,5 现专指 Apple Pay) */
+    public static final String PAY_TYPE_APPLE_PAY = "5";
+
+    /** 银行卡类支付组(023):信用卡与 Apple Pay 共用同一支付商(当前为 OMG);判定订单是否走 OMG 渠道时用本方法而非单比 payType */
+    public static boolean isCardWalletPayType(String payType) {
+        return PAY_TYPE_OMG.equals(payType) || PAY_TYPE_APPLE_PAY.equals(payType);
+    }
 
     private final IPosOrderService posOrderService;
     private final OrderService billingService;
@@ -386,7 +393,7 @@ public class OrderLifecycleService {
             throw new ServiceException("订单状态只能按规则向前推进");
         }
         if (current == 0L && targetState == 1L
-                && PAY_TYPE_OMG.equals(order.getPayType()) && order.getPayStatus() != 1L) {
+                && isCardWalletPayType(order.getPayType()) && order.getPayStatus() != 1L) {
             throw new ServiceException("OMG 订单支付成功后才能接单");
         }
         if (targetState == 4L && order.getPayStatus() != 0L) {
@@ -631,7 +638,7 @@ public class OrderLifecycleService {
         if (order.getPayStatus() == 1L) {
             return false;
         }
-        if (PAY_TYPE_OMG.equals(order.getPayType())) {
+        if (isCardWalletPayType(order.getPayType())) {
             return true;
         }
         return "3".equals(order.getPayType()) && linePaymentService != null

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/app/order/PosOrderController.java

@@ -665,7 +665,7 @@ public class PosOrderController extends BaseController {
             return null;
         }
         JSONObject trade = new JSONObject();
-        if (OrderLifecycleService.PAY_TYPE_OMG.equals(order.getPayType())) {
+        if (OrderLifecycleService.isCardWalletPayType(order.getPayType())) {
             OmgPaymentAttempt attempt = omgPaymentAttemptService.selectPaidByDdId(order.getDdId());
             if (attempt == null) {
                 return null;

+ 2 - 0
specs/023-payment-provider-routing/spec.md

@@ -6,6 +6,8 @@
 
 **状态**:设计讨论暂停;已记录确认项,尚未进入 plan、tasks 或 implement
 
+**2026-09-03 部分落地**:Apple Pay(payType=5)线上联调被 OMG 创建校验拒绝(只认 payType=2)。按本规格已确认的「信用卡与 Apple Pay 同组同商」语义,先落地渠道归组判断 `OrderLifecycleService.isCardWalletPayType`(2 或 5 均走 OMG),替换了 OMG 创建校验、接单支付门槛、状态推进在线支付要求、平台交易号查询四处单值比较。门店级路由表与支付商切换仍按本规格后续推进。
+
 **关联规格**:
 
 - `specs/019-line-pay`

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است