| | |
| | | |
| | | 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> |
| | |
| | | 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 |
| | | }); |
| | | } |
| | | } |
| | | } |
| | |
| | | }; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 微信退款通知回调 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [UnitOfWork] |
| | | public async Task<WxRechargeNotifyResult> WxPayDomesticRefundsNotify(WxRechargeNotifyInput input) |
| | |
| | | switch (wxPayNotice.RefundStatus) |
| | | { |
| | | case LifePaymentConstant.WxPayRefundStatus.退款成功: |
| | | await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.已退款); |
| | | break; |
| | | case LifePaymentConstant.WxPayRefundStatus.退款关闭: |
| | | await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.已退款); |
| | | // 插入收支流水 |
| | | await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() |
| | | { |
| | | OrderNo = wxPayNotice.OutTradeNo, |
| | | OutOrderNo = wxPayNotice.TransactionId, |
| | | LifePayType = LifePayTypeEnum.WxPay, |
| | | ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts, |
| | | Amount = wxPayNotice.Amount.Total |
| | | }); |
| | | break; |
| | | case LifePaymentConstant.WxPayRefundStatus.退款处理中: |
| | | await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.退款中); |