diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java index 06d0bc048..bef3d36d9 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java @@ -159,7 +159,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { * @return */ private String genChannelReturnUrl(PayChannelDO channel) { - return payProperties.getReturnUrl() + "/" + StrUtil.replace(channel.getCode(), "_", "-") + return payProperties.getPayReturnUrl() + "/" + StrUtil.replace(channel.getCode(), "_", "-") + "/" + channel.getId(); } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/config/PayProperties.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/config/PayProperties.java index 525ec876d..057a75541 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/config/PayProperties.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/config/PayProperties.java @@ -23,15 +23,16 @@ public class PayProperties { * 退款回调地址 * 注意点,同 {@link #payNotifyUrl} 属性 */ - @NotEmpty(message = "短信发送频率不能为空") + @NotEmpty(message = "退款回调地址不能为空") @URL(message = "退款回调地址的格式必须是 URL") private String refundNotifyUrl; - // TODO @jason:改成 payReturnUrl 。另外,可以加个 @NotEmpty,避免未填写 + /** * 支付完成的返回地址 */ @URL(message = "支付返回的地址的格式必须是 URL") - private String returnUrl; + @NotEmpty(message = "支付返回的地址不能为空") + private String payReturnUrl; } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPayCodeMapping.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPayCodeMapping.java index b44dcb6aa..d9662a01b 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPayCodeMapping.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPayCodeMapping.java @@ -19,7 +19,7 @@ public class AlipayPayCodeMapping extends AbstractPayCodeMapping { return GlobalErrorCodeConstants.SUCCESS; } // alipay wap api code 返回为null, 暂时定为-9999 - if(Objects.equals(apiCode, "-9999")){ // TODO @jason:空格要注意哈。if () { + if (Objects.equals(apiCode, "-9999")) { return GlobalErrorCodeConstants.SUCCESS; } return null; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayWapPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayWapPayClient.java index 3c097b302..b14ece3fa 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayWapPayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayWapPayClient.java @@ -51,7 +51,8 @@ public class AlipayWapPayClient extends AbstractPayClient model.setTotalAmount(calculateAmount(reqDTO.getAmount()).toString()); model.setProductCode("QUICK_WAP_PAY"); // TODO 芋艿:这里咋整 //TODO 芋艿:这里咋整 jason @芋艿 可以去掉吧, - // TODO @jason: 这个支付方式,需要有 sellerId 么? + // TODO 芋艿 似乎这里不用传sellerId + // https://opendocs.alipay.com/apis/api_1/alipay.trade.wap.pay //model.setSellerId("2088102147948060"); model.setTimeExpire(DateUtil.format(reqDTO.getExpireTime(),"yyyy-MM-dd HH:mm:ss")); // TODO 芋艿:userIp @@ -77,12 +78,13 @@ public class AlipayWapPayClient extends AbstractPayClient } } - // TODO @jason: 注释记得补下哈 + /** + * 从支付宝通知返回参数中解析 PayOrderNotifyRespDTO, 通知具体参数参考 * //https://opendocs.alipay.com/open/203/105286 * @param data 通知结果 - * @return - * @throws Exception + * @return 解析结果 PayOrderNotifyRespDTO + * @throws Exception 解析失败,抛出异常 */ @Override public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyDataDTO data) throws Exception { diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java index e80cb398b..169d60a35 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java @@ -84,22 +84,21 @@ public class PayOrderController { public String notifyAliPayWapPayOrder(@PathVariable("channelId") Long channelId, @RequestParam Map params, @RequestBody String originData) throws Exception { - //TODO @jason 校验 是否支付宝调用。 使用 支付宝publickey payclient 或许加一个校验方法 + //TODO @jason 校验 是否支付宝调用。 payclient 中加一个校验方法 payOrderCoreService.notifyPayOrder(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), PayNotifyDataDTO.builder().params(params).body(originData).build()); return "success"; } - // TODO @jason 如果有些字段不注释,可以删除哈。不然 IDEA 会报警 + /** * https://opendocs.alipay.com/open/203/105285#%E5%89%8D%E5%8F%B0%E5%9B%9E%E8%B7%B3%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E - * @param channelId - * @return - * @throws Exception + * @param channelId 渠道id + * @return 返回跳转页面 */ @GetMapping(value = "/return/alipay-wap/{channelId}") @ApiOperation("支付宝wap页面回跳") public String returnAliPayWapPayOrder(@PathVariable("channelId") Long channelId){ - //TODO @jason 校验 是否支付宝调用。 支付宝publickey 可以根据 appId 跳转不同的页面 + //TODO 校验 是否支付宝调用。 可以根据 appId 跳转不同的页面 return "支付成功"; } diff --git a/yudao-user-server/src/main/resources/application-local.yaml b/yudao-user-server/src/main/resources/application-local.yaml index ff0a29d96..a40a07d42 100644 --- a/yudao-user-server/src/main/resources/application-local.yaml +++ b/yudao-user-server/src/main/resources/application-local.yaml @@ -155,4 +155,4 @@ yudao: pay: pay-notify-url: http://jg6rde.natappfree.cc/api/pay/order/notify refund-notify-url: http://jg6rde.natappfree.cc/api/pay/refund/notify - return-url: http://jg6rde.natappfree.cc/api/pay/order/return + pay-return-url: http://jg6rde.natappfree.cc/api/pay/order/return diff --git a/yudao-user-server/src/main/resources/static/pay_alipay_wap.html b/yudao-user-server/src/main/resources/static/pay_alipay_wap.html index 5f48dfce4..26438f21f 100644 --- a/yudao-user-server/src/main/resources/static/pay_alipay_wap.html +++ b/yudao-user-server/src/main/resources/static/pay_alipay_wap.html @@ -9,18 +9,17 @@
点击如下按钮,发起支付的测试
- +