From 84913d997c70c2e3cc8406cf23eaba710cd5c9d6 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期一, 14 九月 2026 13:53:47 +0800
Subject: [PATCH] fix(payment): 扫码核销也要确认资金,并补上确认失败的补偿重试

---
 talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantVerificationService.java |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantVerificationService.java b/talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantVerificationService.java
index d4745ed..94e45fa 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantVerificationService.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantVerificationService.java
@@ -12,6 +12,7 @@
 import com.talentcard.server.business.DatabaseRows;
 import com.talentcard.server.business.merchant.auth.MerchantPrincipal;
 import com.talentcard.server.business.order.OrderFundBoundaryService;
+import com.talentcard.server.business.payment.PaymentFundConfirmationService;
 import com.talentcard.server.common.BusinessException;
 import com.talentcard.server.common.ErrorCode;
 import org.springframework.dao.DataAccessException;
@@ -28,12 +29,15 @@
     private final JdbcTemplate jdbc;
     private final ManualConsumptionService manualConsumptionService;
     private final OrderFundBoundaryService orderFundBoundary;
+    private final PaymentFundConfirmationService fundConfirmation;
 
     public MerchantVerificationService(JdbcTemplate jdbc, ManualConsumptionService manualConsumptionService,
-                                       OrderFundBoundaryService orderFundBoundary) {
+                                       OrderFundBoundaryService orderFundBoundary,
+                                       PaymentFundConfirmationService fundConfirmation) {
         this.jdbc = jdbc;
         this.manualConsumptionService = manualConsumptionService;
         this.orderFundBoundary = orderFundBoundary;
+        this.fundConfirmation = fundConfirmation;
     }
 
     /**
@@ -214,6 +218,9 @@
                 number(code.get("cardId")), number(code.get("benefitId")), ORDER_CODE,
                 number(code.get("payAmount")), number(code.get("subsidyAmount")), "订单动态核销码");
         finishAttempt(attempt, verifyNo);
+        // 核销通过后把钱放给商户:延迟入账的支付此前停在通道「待确认」,确认成功商户才真正拿到钱。
+        // 扫码核销和订单管理里的核销是两条不同入口,两条都必须确认,否则线上主要走的那条不会出款。
+        fundConfirmation.confirmForOrder(number(code.get("orderId")));
         return confirmed(verifyNo, code.get("cardLevel"));
     }
 

--
Gitblit v1.7.1