【优化】完善微信退款回调流程中如果微信端自己的退款业务出现异常的情况下我们对数据的更新处理。

This commit is contained in:
jianweie code
2023-09-15 15:54:27 +08:00
parent 4e983472c3
commit 198692f89d

View File

@@ -124,15 +124,20 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
var notify = await _client.ExecuteAsync<WeChatPayRefundNotify>(Request, payOptions);
NLogUtil.WriteAll(LogLevel.Trace, LogType.Refund, "微信退款结果通知", JsonConvert.SerializeObject(notify));
if (notify.ReturnCode == WeChatPayCode.Success)
if (notify.RefundStatus == WeChatPayCode.Success)
{
//Console.WriteLine("OutTradeNo: " + notify.OutTradeNo);
var memo = JsonConvert.SerializeObject(notify);
await _billRefundServices.UpdateAsync(p => new CoreCmsBillRefund { memo = memo }, p => p.refundId == notify.OutTradeNo);
return WeChatPayNotifyResult.Success;
}
return NoContent();
if (notify.ReturnCode != WeChatPayCode.Success) return NoContent();
{
var memo = JsonConvert.SerializeObject(notify);
var status = notify.RefundStatus == WeChatPayCode.Success
? (int)GlobalEnumVars.BillRefundStatus.STATUS_REFUND
: (int)GlobalEnumVars.BillRefundStatus.STATUS_FAIL;
await _billRefundServices.UpdateAsync(p => new CoreCmsBillRefund { memo = memo, updateTime = DateTime.Now, status = status }, p => p.refundId == notify.OutTradeNo);
//这个返回只是告诉回调这个业务我们接收到了。
return WeChatPayNotifyResult.Success;
}
}
catch (Exception ex)
{