From 31fb262e8aefcd3505f280be1559363e9f74ce72 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期一, 24 三月 2025 16:10:43 +0800
Subject: [PATCH] fix:bug修复
---
LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs | 51 +++++++++++++++++++++++++
LifePayment/LifePayment.Domain/WeChat/WxRechargeInfo.cs | 38 +++++++++++++++++++
LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs | 2 +
LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs | 2 +
LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 17 ++++++++
5 files changed, 110 insertions(+), 0 deletions(-)
diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
index dd567e3..ae63d78 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
@@ -49,6 +49,8 @@
/// <returns></returns>
Task LifePaySuccessHandler(string orderNo, string outOrderNo);
+ Task WxPayDomesticRefundsHandler(string orderNo, LifePayRefundStatusEnum refundStatus);
+
/// <summary>
/// 渚涘簲鍟嗗洖璋冨鐞�
/// </summary>
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 64c30f2..06231b6 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -1264,6 +1264,23 @@
await _lifePayOrderRepository.UpdateAsync(order);
}
+ public async Task WxPayDomesticRefundsHandler(string orderNo, LifePayRefundStatusEnum refundStatus)
+ {
+ var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync();
+ CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
+ order.LifePayRefundStatus = refundStatus;
+ switch (refundStatus)
+ {
+ case LifePayRefundStatusEnum.宸查��娆�:
+ order.LifePayOrderStatus = LifePayOrderStatusEnum.宸查��娆�;
+ break;
+ case LifePayRefundStatusEnum.閫�娆句腑:
+ order.LifePayOrderStatus = LifePayOrderStatusEnum.閫�娆句腑;
+ break;
+ default:break;
+ }
+ }
+
/// <summary>
/// ACOOLYO璁㈠崟閫氱煡澶勭悊
/// </summary>
diff --git a/LifePayment/LifePayment.Domain/WeChat/WxRechargeInfo.cs b/LifePayment/LifePayment.Domain/WeChat/WxRechargeInfo.cs
index 7fc0310..31035da 100644
--- a/LifePayment/LifePayment.Domain/WeChat/WxRechargeInfo.cs
+++ b/LifePayment/LifePayment.Domain/WeChat/WxRechargeInfo.cs
@@ -204,6 +204,44 @@
public PromotionDetail PromotionDetail { get; set; }
}
+
+ public class WxPayDomesticRefundsNotice
+ {
+ /// <summary>
+ /// <summary>
+ /// 鍟嗘埛鍙�
+ /// </summary>
+ [JsonProperty("mchid")]
+ public string Mchid { get; set; }
+
+ /// <summary>
+ /// 鍟嗘埛璁㈠崟鍙�
+ /// </summary>
+ [JsonProperty("out_trade_no")]
+ public string OutTradeNo { get; set; }
+
+ /// <summary>
+ /// 寰俊鏀粯璁㈠崟鍙�
+ /// </summary>
+ [JsonProperty("transaction_id")]
+ public string TransactionId { get; set; }
+
+ /// <summary>
+ /// 鍟嗘埛閫�娆惧崟鍙�
+ /// </summary>
+ [JsonProperty("out_refund_no")]
+ public string OutRefundNo { get; set; }
+
+ /// <summary>
+ /// 閫�娆剧姸鎬�
+ /// SUCCESS鈥旈��娆炬垚鍔�
+ /// CLOSED鈥旈��娆惧叧闂��
+ /// PROCESSING鈥旈��娆惧鐞嗕腑
+ /// ABNORMAL鈥旈��娆惧紓甯革紝閫�娆惧埌閾惰鍙戠幇鐢ㄦ埛鐨勫崱浣滃簾鎴栬�呭喕缁撲簡锛屽鑷村師璺��娆鹃摱琛屽崱澶辫触锛屽彲鍓嶅線鍟嗘埛骞冲彴-浜ゆ槗涓績锛屾墜鍔ㄥ鐞嗘绗旈��娆撅紝鍙弬鑰冿細 閫�娆惧紓甯哥殑澶勭悊锛屾垨鑰呴�氳繃鍙戣捣寮傚父閫�娆炬帴鍙h繘琛屽鐞嗐��
+ /// </summary>
+ [JsonProperty("refund_status")]
+ public string RefundStatus { get; set; }
+ }
public class WxRechargeNotifyResult
{
/// <summary>
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs b/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
index 2add6da..a0e2a9f 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
@@ -40,6 +40,8 @@
[HttpPost]
public async Task<Guid> CreateBackClientUser(CreateBackClientUserInput input)
{
+
+
return await _accountService.CreateAccount(ObjectMapper.Map<CreateBackClientUserInput, CreateAccountInput>(input), isAdminCreate: true);
}
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
index 430f3ac..454dc62 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
@@ -71,5 +71,56 @@
Code = "SUCCESS",
};
}
+
+
+ [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.閫�娆炬垚鍔�:
+ await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.宸查��娆�);
+ break;
+ case LifePaymentConstant.WxPayRefundStatus.閫�娆惧叧闂�:
+ await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.宸查��娆�);
+ 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