From 10496309bfe3a0d65ed012c5598732f5bfac2efd Mon Sep 17 00:00:00 2001
From: lingling <kety1122@163.com>
Date: 星期三, 16 四月 2025 17:44:09 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/LifePaymentApi

---
 LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs |   33 +++++++++++++++++++++++++++------
 1 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
index e2cbb0a..1dc7f00 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
@@ -1,4 +1,5 @@
 锘縰sing Alipay.AopSdk.F2FPay.Model;
+using Castle.Core.Internal;
 using LifePayment.Application.Contracts;
 using LifePayment.Domain.Shared;
 using Microsoft.AspNetCore.Authorization;
@@ -11,6 +12,7 @@
 using System.Threading.Tasks;
 using Volo.Abp.AspNetCore.Mvc;
 using Volo.Abp.Uow;
+using ZeroD.Util;
 
 namespace LifePayment.HttpApi
 {
@@ -57,18 +59,37 @@
 
             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,
-                        Amount = input.ReceiptAmount.Value });
+                    await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+                    {
+                        OrderNo = input.OutTradeNo,
+                        OutOrderNo = input.TradeNo,
+                        LifePayType = LifePayTypeEnum.AliPay,
+                        ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses
+                    });
+                }
+                else if (((input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛 || input.TradeStatus == LifePaymentConstant.AliPayStatus.瓒呮椂鍏抽棴)
+                    && input.OutBizNo.IsNotNullOrEmpty()
+                    && (input.RefundFee.HasValue && input.RefundFee > 0)))
+                {
+                    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
             {
-                   _logger.LogError($"鐢熸椿绠″鏀粯瀹濆厖鍊煎洖璋冮�氱煡锛氳鍗曞彿寮傚父 "+ input.OutTradeNo);
+                _logger.LogError($"鐢熸椿绠″鏀粯瀹濆厖鍊煎洖璋冮�氱煡锛氳鍗曞彿寮傚父 " + input.OutTradeNo);
             }
 
             return new ContentResult
@@ -99,7 +120,7 @@
         }
 
 
-        
+
 #endif
 
         /// <summary>

--
Gitblit v1.9.1