Commit 7cf4c5415ef375897a256a34383064b1dae095e6

Authored by YunaiV
1 parent d0a7f418

mall + pay:

1. 将 payNotifyUrl 统一改成 orderNotifyUrl
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java
@@ -46,7 +46,7 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen @@ -46,7 +46,7 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
46 */ 46 */
47 public final void init() { 47 public final void init() {
48 doInit(); 48 doInit();
49 - log.info("[init][配置({}) 初始化完成]", config); 49 + log.info("[init][客户端({}) 初始化完成]", getId());
50 } 50 }
51 51
52 /** 52 /**
@@ -59,7 +59,7 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen @@ -59,7 +59,7 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
59 if (config.equals(this.config)) { 59 if (config.equals(this.config)) {
60 return; 60 return;
61 } 61 }
62 - log.info("[refresh][配置({})发生变化,重新初始化]", config); 62 + log.info("[refresh][客户端({})发生变化,重新初始化]", getId());
63 this.config = config; 63 this.config = config;
64 // 初始化 64 // 初始化
65 this.init(); 65 this.init();
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppBaseVO.java
@@ -29,7 +29,7 @@ public class PayAppBaseVO { @@ -29,7 +29,7 @@ public class PayAppBaseVO {
29 @Schema(description = "支付结果的回调地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://127.0.0.1:48080/pay-callback") 29 @Schema(description = "支付结果的回调地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://127.0.0.1:48080/pay-callback")
30 @NotNull(message = "支付结果的回调地址不能为空") 30 @NotNull(message = "支付结果的回调地址不能为空")
31 @URL(message = "支付结果的回调地址必须为 URL 格式") 31 @URL(message = "支付结果的回调地址必须为 URL 格式")
32 - private String payNotifyUrl; 32 + private String orderNotifyUrl;
33 33
34 @Schema(description = "退款结果的回调地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://127.0.0.1:48080/refund-callback") 34 @Schema(description = "退款结果的回调地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://127.0.0.1:48080/refund-callback")
35 @NotNull(message = "退款结果的回调地址不能为空") 35 @NotNull(message = "退款结果的回调地址不能为空")
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
@@ -155,7 +155,7 @@ public class PayOrderServiceImpl implements PayOrderService { @@ -155,7 +155,7 @@ public class PayOrderServiceImpl implements PayOrderService {
155 // 商户相关的字段 155 // 商户相关的字段
156 .setOutTradeNo(orderExtension.getNo()) // 注意,此处使用的是 PayOrderExtensionDO.no 属性! 156 .setOutTradeNo(orderExtension.getNo()) // 注意,此处使用的是 PayOrderExtensionDO.no 属性!
157 .setSubject(order.getSubject()).setBody(order.getBody()) 157 .setSubject(order.getSubject()).setBody(order.getBody())
158 - .setNotifyUrl(genChannelPayNotifyUrl(channel)) 158 + .setNotifyUrl(genChannelOrderNotifyUrl(channel))
159 .setReturnUrl(reqVO.getReturnUrl()) 159 .setReturnUrl(reqVO.getReturnUrl())
160 // 订单相关字段 160 // 订单相关字段
161 .setPrice(order.getPrice()).setExpireTime(order.getExpireTime()); 161 .setPrice(order.getPrice()).setExpireTime(order.getExpireTime());
@@ -205,7 +205,7 @@ public class PayOrderServiceImpl implements PayOrderService { @@ -205,7 +205,7 @@ public class PayOrderServiceImpl implements PayOrderService {
205 * @param channel 支付渠道 205 * @param channel 支付渠道
206 * @return 支付渠道的回调地址 配置地址 + "/" + channel id 206 * @return 支付渠道的回调地址 配置地址 + "/" + channel id
207 */ 207 */
208 - private String genChannelPayNotifyUrl(PayChannelDO channel) { 208 + private String genChannelOrderNotifyUrl(PayChannelDO channel) {
209 return payProperties.getOrderNotifyUrl() + "/" + channel.getId(); 209 return payProperties.getOrderNotifyUrl() + "/" + channel.getId();
210 } 210 }
211 211
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java
@@ -134,7 +134,7 @@ public class PayRefundServiceImpl implements PayRefundService { @@ -134,7 +134,7 @@ public class PayRefundServiceImpl implements PayRefundService {
134 .setRefundPrice(reqDTO.getPrice()) 134 .setRefundPrice(reqDTO.getPrice())
135 .setOutTradeNo(orderExtension.getNo()) 135 .setOutTradeNo(orderExtension.getNo())
136 .setOutRefundNo(refund.getNo()) 136 .setOutRefundNo(refund.getNo())
137 - .setNotifyUrl(genChannelPayNotifyUrl(channel)) 137 + .setNotifyUrl(genChannelRefundNotifyUrl(channel))
138 .setReason(reqDTO.getReason()); 138 .setReason(reqDTO.getReason());
139 PayRefundRespDTO refundRespDTO = client.unifiedRefund(unifiedReqDTO); // TODO 增加一个 channelErrorCode、channelErrorMsg 字段 139 PayRefundRespDTO refundRespDTO = client.unifiedRefund(unifiedReqDTO); // TODO 增加一个 channelErrorCode、channelErrorMsg 字段
140 // 2.3 处理退款返回 140 // 2.3 处理退款返回
@@ -182,7 +182,7 @@ public class PayRefundServiceImpl implements PayRefundService { @@ -182,7 +182,7 @@ public class PayRefundServiceImpl implements PayRefundService {
182 * @param channel 支付渠道 182 * @param channel 支付渠道
183 * @return 支付渠道的回调地址 配置地址 + "/" + channel id 183 * @return 支付渠道的回调地址 配置地址 + "/" + channel id
184 */ 184 */
185 - private String genChannelPayNotifyUrl(PayChannelDO channel) { 185 + private String genChannelRefundNotifyUrl(PayChannelDO channel) {
186 return payProperties.getRefundNotifyUrl() + "/" + channel.getId(); 186 return payProperties.getRefundNotifyUrl() + "/" + channel.getId();
187 } 187 }
188 188
yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceTest.java
@@ -54,7 +54,7 @@ public class PayAppServiceTest extends BaseDbUnitTest { @@ -54,7 +54,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
54 // 准备参数 54 // 准备参数
55 PayAppCreateReqVO reqVO = randomPojo(PayAppCreateReqVO.class, o -> 55 PayAppCreateReqVO reqVO = randomPojo(PayAppCreateReqVO.class, o ->
56 o.setStatus((RandomUtil.randomEle(CommonStatusEnum.values()).getStatus())) 56 o.setStatus((RandomUtil.randomEle(CommonStatusEnum.values()).getStatus()))
57 - .setPayNotifyUrl(randomURL()) 57 + .setOrderNotifyUrl(randomURL())
58 .setRefundNotifyUrl(randomURL())); 58 .setRefundNotifyUrl(randomURL()));
59 59
60 // 调用 60 // 调用
@@ -73,7 +73,7 @@ public class PayAppServiceTest extends BaseDbUnitTest { @@ -73,7 +73,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
73 // 准备参数 73 // 准备参数
74 PayAppUpdateReqVO reqVO = randomPojo(PayAppUpdateReqVO.class, o -> { 74 PayAppUpdateReqVO reqVO = randomPojo(PayAppUpdateReqVO.class, o -> {
75 o.setStatus(CommonStatusEnum.ENABLE.getStatus()); 75 o.setStatus(CommonStatusEnum.ENABLE.getStatus());
76 - o.setPayNotifyUrl(randomURL()).setRefundNotifyUrl(randomURL()); 76 + o.setOrderNotifyUrl(randomURL()).setRefundNotifyUrl(randomURL());
77 o.setId(dbApp.getId()); // 设置更新的 ID 77 o.setId(dbApp.getId()); // 设置更新的 ID
78 }); 78 });
79 79
yudao-ui-admin/src/views/pay/app/index.vue
@@ -197,8 +197,8 @@ @@ -197,8 +197,8 @@
197 </el-radio-group> 197 </el-radio-group>
198 </el-form-item> 198 </el-form-item>
199 199
200 - <el-form-item label="支付结果的回调地址" prop="payNotifyUrl">  
201 - <el-input v-model="form.payNotifyUrl" placeholder="请输入支付结果的回调地址"/> 200 + <el-form-item label="支付结果的回调地址" prop="orderNotifyUrl">
  201 + <el-input v-model="form.orderNotifyUrl" placeholder="请输入支付结果的回调地址"/>
202 </el-form-item> 202 </el-form-item>
203 <el-form-item label="退款结果的回调地址" prop="refundNotifyUrl"> 203 <el-form-item label="退款结果的回调地址" prop="refundNotifyUrl">
204 <el-input v-model="form.refundNotifyUrl" placeholder="请输入退款结果的回调地址"/> 204 <el-input v-model="form.refundNotifyUrl" placeholder="请输入退款结果的回调地址"/>
@@ -259,7 +259,7 @@ export default { @@ -259,7 +259,7 @@ export default {
259 rules: { 259 rules: {
260 name: [{required: true, message: "应用名不能为空", trigger: "blur"}], 260 name: [{required: true, message: "应用名不能为空", trigger: "blur"}],
261 status: [{required: true, message: "开启状态不能为空", trigger: "blur"}], 261 status: [{required: true, message: "开启状态不能为空", trigger: "blur"}],
262 - payNotifyUrl: [{required: true, message: "支付结果的回调地址不能为空", trigger: "blur"}], 262 + orderNotifyUrl: [{required: true, message: "支付结果的回调地址不能为空", trigger: "blur"}],
263 refundNotifyUrl: [{required: true, message: "退款结果的回调地址不能为空", trigger: "blur"}], 263 refundNotifyUrl: [{required: true, message: "退款结果的回调地址不能为空", trigger: "blur"}],
264 }, 264 },
265 // 数据字典 265 // 数据字典
@@ -319,7 +319,7 @@ export default { @@ -319,7 +319,7 @@ export default {
319 name: undefined, 319 name: undefined,
320 status: undefined, 320 status: undefined,
321 remark: undefined, 321 remark: undefined,
322 - payNotifyUrl: undefined, 322 + orderNotifyUrl: undefined,
323 refundNotifyUrl: undefined, 323 refundNotifyUrl: undefined,
324 }; 324 };
325 this.resetForm("form"); 325 this.resetForm("form");