From 5e918c353d039a75f552f4eb0cc251e96ef809ab Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期二, 01 四月 2025 09:58:54 +0800
Subject: [PATCH] fix:bug修复

---
 LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
index 3d41c9c..9d79c31 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
@@ -1,4 +1,6 @@
-锘縰sing LifePayment.Application.Contracts;
+锘縰sing Alipay.AopSdk.F2FPay.Model;
+using Castle.Core.Internal;
+using LifePayment.Application.Contracts;
 using LifePayment.Domain.Shared;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
@@ -10,6 +12,7 @@
 using System.Threading.Tasks;
 using Volo.Abp.AspNetCore.Mvc;
 using Volo.Abp.Uow;
+using ZeroD.Util;
 
 namespace LifePayment.HttpApi
 {
@@ -21,6 +24,7 @@
     {
 
         private readonly ILifePayService _lifePayService;
+        private readonly ILifePayOrderService _lifePayOrderService;
 
         private readonly ILogger<AliPayNotifyController> _logger;
 
@@ -28,10 +32,12 @@
 
                ILogger<AliPayNotifyController> logger,
 
-               ILifePayService lifePayService)
+               ILifePayService lifePayService,
+               ILifePayOrderService lifePayOrderService)
         {
             _logger = logger;
             _lifePayService = lifePayService;
+            _lifePayOrderService = lifePayOrderService;
         }
 
         /// <summary>
@@ -53,9 +59,26 @@
 
             if (input.OutTradeNo.Contains("JF"))
             {
-                if (input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛)
+                if (input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛 && input.OutBizNo.IsNullOrEmpty())
                 {
                     await _lifePayService.LifePaySuccessHandler(input.OutTradeNo, input.TradeNo);
+                    // 鎻掑叆鏀舵敮娴佹按
+                    await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() { OrderNo = input.OutTradeNo, 
+                        OutOrderNo = input.TradeNo ,LifePayType = LifePayTypeEnum.AliPay,ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses });
+                }
+                else if((input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛 && input.OutBizNo.IsNotNullOrEmpty() && input.RefundFee.HasValue) ||
+                    input.TradeStatus == LifePaymentConstant.AliPayStatus.瓒呮椂鍏抽棴)
+                {
+                    await _lifePayService.LifePayRefundsHandler(input.OutTradeNo, LifePayRefundStatusEnum.宸查��娆�);
+                    // 鎻掑叆鏀舵敮娴佹按
+                    await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+                    {
+                        OrderNo = input.OutTradeNo,
+                        OutRefundNo = input.OutBizNo,
+                        OutOrderNo = input.TradeNo,
+                        LifePayType = LifePayTypeEnum.AliPay,
+                        ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts
+                    });
                 }
             }
             else
@@ -90,6 +113,8 @@
             };
         }
 
+
+        
 #endif
 
         /// <summary>

--
Gitblit v1.9.1