优化微信支付、支付宝支付多种支付终端情况下的一一对应处理。

This commit is contained in:
jianweie
2023-04-26 10:27:06 +08:00
parent 04a8b30413
commit 8a12ab7ea5
5 changed files with 149 additions and 49 deletions

View File

@@ -85,6 +85,9 @@ namespace CoreCms.Net.Services
return jm;
}
var notifyUrl = config.notifyUrl.EndsWith("/") ? config.notifyUrl + "m-" + config.appId : config.notifyUrl + "/m-" + config.appId;
//构建linkPay请求配置实体
var payOptions = new AlipayOptions
{
@@ -112,7 +115,7 @@ namespace CoreCms.Net.Services
};
var req = new AlipayTradePrecreateRequest();
req.SetBizModel(model);
req.SetNotifyUrl(config.notifyUrl);
req.SetNotifyUrl(notifyUrl);
//req.SetReturnUrl("https://pc.pro.demo.corecms.cn/order/payment/result");
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝ScanQRCodes支付拼接APP入参", JsonConvert.SerializeObject(model));
@@ -139,7 +142,7 @@ namespace CoreCms.Net.Services
};
var req = new AlipayTradePagePayRequest();
req.SetBizModel(model);
req.SetNotifyUrl(config.notifyUrl);
req.SetNotifyUrl(notifyUrl);
req.SetReturnUrl(config.jumpUrl);
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝JSAPI_PC支付拼接APP入参", JsonConvert.SerializeObject(model));
@@ -166,7 +169,7 @@ namespace CoreCms.Net.Services
};
var req = new AlipayTradeAppPayRequest();
req.SetBizModel(model);
req.SetNotifyUrl(config.notifyUrl);
req.SetNotifyUrl(notifyUrl);
//req.SetReturnUrl(config.jumpUrl);
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝APP支付拼接APP入参", JsonConvert.SerializeObject(model));
@@ -194,7 +197,7 @@ namespace CoreCms.Net.Services
};
var req = new AlipayTradeWapPayRequest();
req.SetBizModel(model);
req.SetNotifyUrl(config.notifyUrl);
req.SetNotifyUrl(notifyUrl);
req.SetReturnUrl(config.jumpUrl);
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝MWEB支付拼接APP入参", JsonConvert.SerializeObject(model));

View File

@@ -180,13 +180,16 @@ namespace CoreCms.Net.Services
openId = user.openid;
}
var notifyUrl = config.notifyUrl.EndsWith("/") ? config.notifyUrl + "m-" + config.appId : config.notifyUrl + "/m-" + config.appId;
var orderRequest = new WeChatPayUnifiedOrderRequest
{
Body = entity.payTitle.Length > 40 ? entity.payTitle[..40] : entity.payTitle,
OutTradeNo = entity.paymentId,
TotalFee = Convert.ToInt32(entity.money * 100),
SpBillCreateIp = entity.ip,
NotifyUrl = config.notifyUrl,
NotifyUrl = notifyUrl,
TradeType = tradeType,
//OpenId = openId
};
@@ -233,7 +236,7 @@ namespace CoreCms.Net.Services
jm.status = true;
jm.msg = "创建JSAPI支付环境成功";
jm.data = parameter;
//jm.otherData = response;
jm.otherData = response;
}
//扫码支付
else if (tradeType == GlobalEnumVars.WeiChatPayTradeType.NATIVE.ToString())