From e80d0c59be1dd43fa5ce8c89ebc57764f091b2ae Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期一, 31 三月 2025 18:36:34 +0800
Subject: [PATCH] fix:退款bug

---
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 499e20d..472ffdb 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -29,6 +29,7 @@
 using StackExchange.Redis;
 using static Volo.Abp.Identity.Settings.IdentitySettingNames;
 using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
+using LifePayment.Application.LifePay;
 
 namespace LifePayment.Application;
 
@@ -47,6 +48,7 @@
     private readonly IRepository<LifePayAccount, Guid> _lifePayAccount;
     private readonly IRepository<OperateHistory, Guid> _operateHistory;
     private readonly IRepository<LifePayChannlesRake, Guid> _lifePayChannlesRakeRepository;
+    private readonly ILifePayOrderService _lifePayOrderService;
     private readonly IDataFilter dataFilter;
     private readonly IChannelFilter _channelFilter;
     private readonly IAliPayApi _aliPayApi;
@@ -67,6 +69,7 @@
                           IRepository<LifePayIntroInfo, Guid> lifePayIntroInfoRepository,
                           IRepository<LifePayChannlesRake, Guid> lifePayChannlesRakeRepository,
                           IRepository<OperateHistory, Guid> operateHistory,
+                          ILifePayOrderService lifePayOrderService,
                           IAliPayApi aliPayApi,
                           IAlipayInterfaceManager aliPayInterfaceManager,
                           IWxPayApi wxPayApi,
@@ -86,6 +89,7 @@
         _lifePayPremiumRepository = lifePayPremiumRepository;
         _lifePayIntroInfoRepository = lifePayIntroInfoRepository;
         _aliPayApi = aliPayApi;
+        _lifePayOrderService = lifePayOrderService;
         _alipayInterfaceManager = aliPayInterfaceManager;
         _wxPayApi = wxPayApi;
         _wxPayOptions = wxPayOptions.Value;
@@ -850,6 +854,13 @@
         {
             order.LifePayOrderStatus = LifePayOrderStatusEnum.宸查��娆�;
             order.LifePayRefundStatus = LifePayRefundStatusEnum.宸查��娆�;
+            await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+            {
+                OrderNo = result.OutTradeNo,
+                OutOrderNo = result.TradeNo,
+                LifePayType = LifePayTypeEnum.AliPay,
+                ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts
+            });
         }
 
         return result;
@@ -1431,7 +1442,6 @@
         }
 
         var outRefundNo = order.ChannelId + CreateRefundOrderNo();
-        order.RefundOrderNo = outRefundNo;
         switch (order.LifePayType)
         {
             case LifePayTypeEnum.WxPay:
@@ -1466,6 +1476,7 @@
             default: throw new UserFriendlyException("閫�娆惧け璐�");
         }
 
+        order.RefundOrderNo = outRefundNo;
         order.RefundCredentialsImgUrl = input.RefundCredentialsImgUrl;
         order.RefundCheckRemark = input.RefundCheckRemark;
         order.RefundTime = DateTime.Now;

--
Gitblit v1.9.1