feat 去除支付发起时的NotReturn属性,SQL脚本更新,部署调试

This commit is contained in:
bootx
2024-02-13 20:51:19 +08:00
parent 5ff2c5c389
commit ed03a55811
26 changed files with 3076 additions and 5652 deletions

View File

@@ -16,6 +16,9 @@ public class DaxPayProperties {
/** 服务地址 */
private String serverUrl;
/** 前端地址 */
private String frontUrl;
/** 前端地址(h5) */
private String frontH5Url;
/** 前端地址(web) */
private String frontWebUrl;
}

View File

@@ -5,6 +5,7 @@ import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderExtraManager;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderQueryService;
import cn.bootx.platform.daxpay.service.core.system.config.service.PlatformConfigService;
import cn.bootx.platform.daxpay.service.param.channel.alipay.AliPayReturnParam;
import cn.hutool.core.net.URLEncodeUtil;
import cn.hutool.core.util.StrUtil;
@@ -25,6 +26,7 @@ import java.util.Objects;
public class PayReturnService {
private final PayOrderQueryService payOrderQueryService;
private final PayOrderExtraManager payOrderExtraManager;
private final PlatformConfigService platformConfigService;
private final DaxPayProperties properties;
@@ -35,13 +37,18 @@ public class PayReturnService {
PayOrderExtra payOrderExtra = payOrderExtraManager.findById(param.getOut_trade_no()).orElse(null);
PayOrder prOrder = payOrderQueryService.findById(param.getOut_trade_no()).orElse(null);
if (Objects.isNull(payOrderExtra) || Objects.isNull(prOrder)){
return StrUtil.format("{}/result/error?msg={}", properties.getFrontUrl(), URLEncodeUtil.encode("支付订单有问题,请排查"));
return StrUtil.format("{}/result/error?msg={}", properties.getFrontH5Url(), URLEncodeUtil.encode("支付订单有问题,请排查"));
}
// 如果不需要同步回调, 跳转到支付成功页面
if (payOrderExtra.isNotReturn()){
return StrUtil.format("{}/result/success?msg={}", properties.getFrontUrl(), URLEncodeUtil.encode("支付成功..."));
// 如果同步跳转参数为空, 获取系统配置地址, 系统配置如果也为空, 则返回默认地址
String returnUrl = payOrderExtra.getReturnUrl();
if (StrUtil.isBlank(returnUrl)){
returnUrl = platformConfigService.getConfig().getReturnUrl();
}
return StrUtil.format("{}?paymentId={}&businessNo={}", payOrderExtra.getReturnUrl(),prOrder.getId(),prOrder.getBusinessNo());
if (StrUtil.isNotBlank(returnUrl)){
return StrUtil.format("{}?paymentId={}&businessNo={}", payOrderExtra.getReturnUrl(),prOrder.getId(),prOrder.getBusinessNo());
}
// 跳转到默认页
return StrUtil.format("{}/result/success?msg={}", properties.getFrontH5Url(), URLEncodeUtil.encode("支付成功..."));
}
}

View File

@@ -76,7 +76,6 @@ public class PayBuilder {
.setDescription(payParam.getDescription())
.setNotNotify(payParam.isNotNotify())
.setNotifyUrl(noticeInfo.getNotifyUrl())
.setNotReturn(payParam.isNotReturn())
.setReturnUrl(noticeInfo.getReturnUrl())
.setSign(payParam.getSign())
.setSignType(platform.getSignType())

View File

@@ -45,10 +45,6 @@ public class PayOrderExtra extends MpBaseEntity implements EntityBaseFunction<Pa
@TableField(updateStrategy = FieldStrategy.ALWAYS)
private String notifyUrl;
/** 是否不需要同步调转通知 */
@DbColumn(comment = "是否不需要同步调转通知")
private boolean notReturn;
/** 同步调转地址 */
@DbColumn(comment = "同步调转地址,以最后一次为准")
@TableField(updateStrategy = FieldStrategy.ALWAYS)

View File

@@ -104,9 +104,7 @@ public class PayAssistService {
}
}
// 同步回调
if (!payParam.isNotReturn()){
noticeInfo.setReturnUrl(payParam.getReturnUrl());
}
noticeInfo.setReturnUrl(payParam.getReturnUrl());
// 退出回调地址
noticeInfo.setQuitUrl(payParam.getQuitUrl());
}
@@ -161,7 +159,6 @@ public class PayAssistService {
.setSign(payParam.getSign())
.setNotNotify(payParam.isNotNotify())
.setNotifyUrl(notifyUrl)
.setNotReturn(payParam.isNotReturn())
.setReturnUrl(returnUrl)
.setAttach(payParam.getAttach())
.setClientIp(payParam.getClientIp());

View File

@@ -35,7 +35,7 @@ public class WeChatPayConfigDto extends BaseDto implements Serializable {
@Schema(description = "异步通知地址")
private String notifyUrl;
@Schema(description = "同步通知地址")
@Schema(description = "同步跳转地址")
private String returnUrl;
@Schema(description = "商户平台「API安全」中的 APIv2 密钥")

View File

@@ -30,7 +30,7 @@ public class PlatformConfigDto {
@Schema(description ="异步支付通知地址")
private String notifyUrl;
@Schema(description ="同步支付通知地址")
@Schema(description ="同步支付跳转地址")
private String returnUrl;
@Schema(description ="订单默认超时时间(分钟)")

View File

@@ -31,7 +31,7 @@ public class PlatformConfigParam {
@DbColumn(comment = "支付通知地址")
private String notifyUrl;
@Schema(description ="同步支付通知地址")
@Schema(description ="同步支付跳转地址")
private String returnUrl;
@DbColumn(comment = "订单默认超时时间")

View File

@@ -28,7 +28,6 @@ class PayParamSignTest {
payParam.setBusinessNo("123");
payParam.setClientIp("127.0.0.1");
payParam.setNotNotify(true);
payParam.setNotReturn(true);
payParam.setNotifyUrl("http://127.0.0.1:8080/pay/notify");
payParam.setReturnUrl("http://127.0.0.1:8080/pay/return");
payParam.setVersion("1.0");