zhengyuxuan
2025-03-28 83971e864fbee9e1a12d25239fbf005760ee983f
LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
@@ -21,16 +21,19 @@
        private readonly IWxPayApi _wxPayApi;
        private readonly ILifePayService _lifePayService;
        private readonly ILifePayOrderService _lifePayOrderService;
        private readonly ILogger<WxPayNotifyController> _logger;
        public WxPayNotifyController(
               IWxPayApi wxPayApi,
               ILogger<WxPayNotifyController> logger,
               ILifePayService lifePayService)
               ILifePayService lifePayService,
               ILifePayOrderService lifePayOrderService)
        {
            _wxPayApi = wxPayApi;
            _logger = logger;
            _lifePayService = lifePayService;
            _lifePayOrderService = lifePayOrderService;
        }
        /// <summary>
@@ -53,6 +56,14 @@
                    if (wxPayNotice.TradeState == LifePaymentConstant.WxPayStatus.支付成功)
                    {
                        await _lifePayService.LifePaySuccessHandler(wxPayNotice.OutTradeNo, wxPayNotice.TransactionId);
                        await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
                        {
                            OrderNo = wxPayNotice.OutTradeNo,
                            OutOrderNo = wxPayNotice.TransactionId,
                            LifePayType = LifePayTypeEnum.WxPay,
                            ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses,
                            Amount = wxPayNotice.Amount.Total
                        });
                    }
                }
            }
@@ -72,7 +83,11 @@
            };
        }
        /// <summary>
        /// 微信退款通知回调
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [UnitOfWork]
        public async Task<WxRechargeNotifyResult> WxPayDomesticRefundsNotify(WxRechargeNotifyInput input)
@@ -92,8 +107,6 @@
                    switch (wxPayNotice.RefundStatus)
                    {
                        case LifePaymentConstant.WxPayRefundStatus.退款成功:
                            await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.已退款);
                            break;
                        case LifePaymentConstant.WxPayRefundStatus.退款关闭:
                            await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.已退款);
                            break;