From 483ea509b5f1429ee76916e8556c803b241bad89 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期五, 18 七月 2025 13:02:39 +0800
Subject: [PATCH] fix: s

---
 LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
index e958bac..cf0adc1 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
@@ -1,4 +1,5 @@
-锘縰sing LifePayment.Application.Contracts;
+锘縰sing Alipay.AopSdk.Core.Domain;
+using LifePayment.Application.Contracts;
 using LifePayment.Domain;
 using LifePayment.Domain.Shared;
 using Medallion.Threading;
@@ -95,7 +96,7 @@
                                 AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(10)
                             });
 
-                            await CurrentUnitOfWork.CompleteAsync();
+                            await CurrentUnitOfWork.SaveChangesAsync();
                             _logger.LogInformation("浜嬪姟瀹屾垚");
                         }
                         else
@@ -141,7 +142,8 @@
         {
             try
             {
-                _logger.LogError($"寰俊閫�娆惧洖璋冮�氱煡锛氳繘鍏ュ井淇″洖璋�");
+                var req = input.ToJson();
+                _logger.LogError($"寰俊閫�娆惧洖璋冮�氱煡锛氳繘鍏ュ井淇″洖璋冿細" + req);
                 var data = _wxPayApi.AesGcmDecrypt(input.Resource.AssociatedData, input.Resource.Nonce, input.Resource.Ciphertext);
                 _logger.LogError($"寰俊閫�娆惧洖璋冮�氱煡data锛�" + data);
                 var wxPayNotice = JsonConvert.DeserializeObject<WxPayDomesticRefundsNotice>(data);
@@ -175,7 +177,7 @@
             }
             catch (Exception ex)
             {
-
+                _logger.LogError($"寰俊閫�娆惧洖璋冮�氱煡閿欒锛�" + ex.Message);
                 return new WxRechargeNotifyResult
                 {
                     Code = "FAIL",
@@ -188,5 +190,38 @@
                 Code = "SUCCESS",
             };
         }
+
+        [HttpPost]
+        [UnitOfWork]
+        public async Task WxPayDomesticRefundsNotifyImp(WxPayDomesticRefundsNotice input)
+        {
+            var wxPayNotice = input;
+            if (wxPayNotice.OutTradeNo.Contains("JF"))
+            {
+
+                switch (wxPayNotice.RefundStatus)
+                {
+                    case LifePaymentConstant.WxPayRefundStatus.閫�娆炬垚鍔�:
+                        await _lifePayService.LifePayRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.宸查��娆�);
+                        // 鎻掑叆鏀舵敮娴佹按
+                        await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+                        {
+                            OrderNo = wxPayNotice.OutTradeNo,
+                            OutRefundNo = wxPayNotice.OutRefundNo,
+                            OutOrderNo = wxPayNotice.TransactionId,
+                            LifePayType = LifePayTypeEnum.WxPay,
+                            ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts,
+                            Amount = wxPayNotice.Amount.Total
+                        });
+                        break;
+                    case LifePaymentConstant.WxPayRefundStatus.閫�娆惧叧闂�:
+                    case LifePaymentConstant.WxPayRefundStatus.閫�娆惧鐞嗕腑:
+                    case LifePaymentConstant.WxPayRefundStatus.閫�娆惧紓甯�:
+                        await _lifePayService.LifePayRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.閫�娆句腑);
+                        break;
+                    default: await _lifePayService.LifePayRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.閫�娆句腑); break;
+                }
+            }
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1