mall + pay:

1. 将 payNotifyUrl 统一改成 orderNotifyUrl
This commit is contained in:
YunaiV 2023-07-17 16:38:31 +08:00
parent d0a7f41875
commit 7cf4c5415e
6 changed files with 13 additions and 13 deletions

View File

@ -46,7 +46,7 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
*/
public final void init() {
doInit();
log.info("[init][配置({}) 初始化完成]", config);
log.info("[init][客户端({}) 初始化完成]", getId());
}
/**
@ -59,7 +59,7 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
if (config.equals(this.config)) {
return;
}
log.info("[refresh][配置({})发生变化,重新初始化]", config);
log.info("[refresh][客户端({})发生变化,重新初始化]", getId());
this.config = config;
// 初始化
this.init();

View File

@ -29,7 +29,7 @@ public class PayAppBaseVO {
@Schema(description = "支付结果的回调地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://127.0.0.1:48080/pay-callback")
@NotNull(message = "支付结果的回调地址不能为空")
@URL(message = "支付结果的回调地址必须为 URL 格式")
private String payNotifyUrl;
private String orderNotifyUrl;
@Schema(description = "退款结果的回调地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://127.0.0.1:48080/refund-callback")
@NotNull(message = "退款结果的回调地址不能为空")

View File

@ -155,7 +155,7 @@ public class PayOrderServiceImpl implements PayOrderService {
// 商户相关的字段
.setOutTradeNo(orderExtension.getNo()) // 注意此处使用的是 PayOrderExtensionDO.no 属性
.setSubject(order.getSubject()).setBody(order.getBody())
.setNotifyUrl(genChannelPayNotifyUrl(channel))
.setNotifyUrl(genChannelOrderNotifyUrl(channel))
.setReturnUrl(reqVO.getReturnUrl())
// 订单相关字段
.setPrice(order.getPrice()).setExpireTime(order.getExpireTime());
@ -205,7 +205,7 @@ public class PayOrderServiceImpl implements PayOrderService {
* @param channel 支付渠道
* @return 支付渠道的回调地址 配置地址 + "/" + channel id
*/
private String genChannelPayNotifyUrl(PayChannelDO channel) {
private String genChannelOrderNotifyUrl(PayChannelDO channel) {
return payProperties.getOrderNotifyUrl() + "/" + channel.getId();
}

View File

@ -134,7 +134,7 @@ public class PayRefundServiceImpl implements PayRefundService {
.setRefundPrice(reqDTO.getPrice())
.setOutTradeNo(orderExtension.getNo())
.setOutRefundNo(refund.getNo())
.setNotifyUrl(genChannelPayNotifyUrl(channel))
.setNotifyUrl(genChannelRefundNotifyUrl(channel))
.setReason(reqDTO.getReason());
PayRefundRespDTO refundRespDTO = client.unifiedRefund(unifiedReqDTO); // TODO 增加一个 channelErrorCodechannelErrorMsg 字段
// 2.3 处理退款返回
@ -182,7 +182,7 @@ public class PayRefundServiceImpl implements PayRefundService {
* @param channel 支付渠道
* @return 支付渠道的回调地址 配置地址 + "/" + channel id
*/
private String genChannelPayNotifyUrl(PayChannelDO channel) {
private String genChannelRefundNotifyUrl(PayChannelDO channel) {
return payProperties.getRefundNotifyUrl() + "/" + channel.getId();
}

View File

@ -54,7 +54,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
// 准备参数
PayAppCreateReqVO reqVO = randomPojo(PayAppCreateReqVO.class, o ->
o.setStatus((RandomUtil.randomEle(CommonStatusEnum.values()).getStatus()))
.setPayNotifyUrl(randomURL())
.setOrderNotifyUrl(randomURL())
.setRefundNotifyUrl(randomURL()));
// 调用
@ -73,7 +73,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
// 准备参数
PayAppUpdateReqVO reqVO = randomPojo(PayAppUpdateReqVO.class, o -> {
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setPayNotifyUrl(randomURL()).setRefundNotifyUrl(randomURL());
o.setOrderNotifyUrl(randomURL()).setRefundNotifyUrl(randomURL());
o.setId(dbApp.getId()); // 设置更新的 ID
});

View File

@ -197,8 +197,8 @@
</el-radio-group>
</el-form-item>
<el-form-item label="支付结果的回调地址" prop="payNotifyUrl">
<el-input v-model="form.payNotifyUrl" placeholder="请输入支付结果的回调地址"/>
<el-form-item label="支付结果的回调地址" prop="orderNotifyUrl">
<el-input v-model="form.orderNotifyUrl" placeholder="请输入支付结果的回调地址"/>
</el-form-item>
<el-form-item label="退款结果的回调地址" prop="refundNotifyUrl">
<el-input v-model="form.refundNotifyUrl" placeholder="请输入退款结果的回调地址"/>
@ -259,7 +259,7 @@ export default {
rules: {
name: [{required: true, message: "应用名不能为空", trigger: "blur"}],
status: [{required: true, message: "开启状态不能为空", trigger: "blur"}],
payNotifyUrl: [{required: true, message: "支付结果的回调地址不能为空", trigger: "blur"}],
orderNotifyUrl: [{required: true, message: "支付结果的回调地址不能为空", trigger: "blur"}],
refundNotifyUrl: [{required: true, message: "退款结果的回调地址不能为空", trigger: "blur"}],
},
//
@ -319,7 +319,7 @@ export default {
name: undefined,
status: undefined,
remark: undefined,
payNotifyUrl: undefined,
orderNotifyUrl: undefined,
refundNotifyUrl: undefined,
};
this.resetForm("form");