From a3bfd6cd7ee9580db08aa03a8656ad5572089756 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 31 三月 2025 16:19:36 +0800
Subject: [PATCH] Merge branch 'dev-lifepay-v1.3' of http://120.26.58.240:8888/r/LifePaymentApi into dev-lifepay-v1.3
---
LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs | 79 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
index 54d3114..970139a 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
+++ b/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>
@@ -48,11 +51,21 @@
var data = _wxPayApi.AesGcmDecrypt(input.Resource.AssociatedData, input.Resource.Nonce, input.Resource.Ciphertext);
var wxPayNotice = JsonConvert.DeserializeObject<WxPayNotice>(data);
- if (wxPayNotice.OutTradeNo.StartsWith("JF") && Regex.IsMatch(wxPayNotice.OutTradeNo, @"^JF\d+$"))
+ if (wxPayNotice.OutTradeNo.Contains("JF") )
{
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
+ });
}
}
}
@@ -71,5 +84,67 @@
Code = "SUCCESS",
};
}
+
+ /// <summary>
+ /// 寰俊閫�娆鹃�氱煡鍥炶皟
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [HttpPost]
+ [UnitOfWork]
+ public async Task<WxRechargeNotifyResult> WxPayDomesticRefundsNotify(WxRechargeNotifyInput input)
+ {
+ try
+ {
+ _logger.LogError($"寰俊閫�娆惧洖璋冮�氱煡锛氳繘鍏ュ井淇″洖璋�");
+ var data = _wxPayApi.AesGcmDecrypt(input.Resource.AssociatedData, input.Resource.Nonce, input.Resource.Ciphertext);
+ var wxPayNotice = JsonConvert.DeserializeObject<WxPayDomesticRefundsNotice>(data);
+
+ if (wxPayNotice.OutTradeNo.Contains("JF"))
+ {
+ if (wxPayNotice.RefundStatus == LifePaymentConstant.WxPayRefundStatus.閫�娆炬垚鍔�)
+ {
+
+ }
+ switch (wxPayNotice.RefundStatus)
+ {
+ case LifePaymentConstant.WxPayRefundStatus.閫�娆炬垚鍔�:
+ 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.閫�娆句腑);
+ break;
+ case LifePaymentConstant.WxPayRefundStatus.閫�娆惧紓甯�:
+ await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.閫�娆句腑);
+ break;
+ default : await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.閫�娆句腑);break;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+
+ return new WxRechargeNotifyResult
+ {
+ Code = "FAIL",
+ Message = ex.Message,
+ };
+ }
+
+ return new WxRechargeNotifyResult
+ {
+ Code = "SUCCESS",
+ };
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.1