修改code review

This commit is contained in:
jason 2021-11-05 00:10:32 +08:00
parent 87d8b55b41
commit 26798a8816
7 changed files with 23 additions and 22 deletions

View File

@ -159,7 +159,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService {
* @return * @return
*/ */
private String genChannelReturnUrl(PayChannelDO channel) { private String genChannelReturnUrl(PayChannelDO channel) {
return payProperties.getReturnUrl() + "/" + StrUtil.replace(channel.getCode(), "_", "-") return payProperties.getPayReturnUrl() + "/" + StrUtil.replace(channel.getCode(), "_", "-")
+ "/" + channel.getId(); + "/" + channel.getId();
} }

View File

@ -23,15 +23,16 @@ public class PayProperties {
* 退款回调地址 * 退款回调地址
* 注意点 {@link #payNotifyUrl} 属性 * 注意点 {@link #payNotifyUrl} 属性
*/ */
@NotEmpty(message = "短信发送频率不能为空") @NotEmpty(message = "退款回调地址不能为空")
@URL(message = "退款回调地址的格式必须是 URL") @URL(message = "退款回调地址的格式必须是 URL")
private String refundNotifyUrl; private String refundNotifyUrl;
// TODO @jason改成 payReturnUrl 另外可以加个 @NotEmpty避免未填写
/** /**
* 支付完成的返回地址 * 支付完成的返回地址
*/ */
@URL(message = "支付返回的地址的格式必须是 URL") @URL(message = "支付返回的地址的格式必须是 URL")
private String returnUrl; @NotEmpty(message = "支付返回的地址不能为空")
private String payReturnUrl;
} }

View File

@ -19,7 +19,7 @@ public class AlipayPayCodeMapping extends AbstractPayCodeMapping {
return GlobalErrorCodeConstants.SUCCESS; return GlobalErrorCodeConstants.SUCCESS;
} }
// alipay wap api code 返回为null, 暂时定为-9999 // alipay wap api code 返回为null, 暂时定为-9999
if(Objects.equals(apiCode, "-9999")){ // TODO @jason空格要注意哈if () { if (Objects.equals(apiCode, "-9999")) {
return GlobalErrorCodeConstants.SUCCESS; return GlobalErrorCodeConstants.SUCCESS;
} }
return null; return null;

View File

@ -51,7 +51,8 @@ public class AlipayWapPayClient extends AbstractPayClient<AlipayPayClientConfig>
model.setTotalAmount(calculateAmount(reqDTO.getAmount()).toString()); model.setTotalAmount(calculateAmount(reqDTO.getAmount()).toString());
model.setProductCode("QUICK_WAP_PAY"); // TODO 芋艿这里咋整 model.setProductCode("QUICK_WAP_PAY"); // TODO 芋艿这里咋整
//TODO 芋艿这里咋整 jason @芋艿 可以去掉吧, //TODO 芋艿这里咋整 jason @芋艿 可以去掉吧,
// TODO @jason: 这个支付方式需要有 sellerId // TODO 芋艿 似乎这里不用传sellerId
// https://opendocs.alipay.com/apis/api_1/alipay.trade.wap.pay
//model.setSellerId("2088102147948060"); //model.setSellerId("2088102147948060");
model.setTimeExpire(DateUtil.format(reqDTO.getExpireTime(),"yyyy-MM-dd HH:mm:ss")); model.setTimeExpire(DateUtil.format(reqDTO.getExpireTime(),"yyyy-MM-dd HH:mm:ss"));
// TODO 芋艿userIp // TODO 芋艿userIp
@ -77,12 +78,13 @@ public class AlipayWapPayClient extends AbstractPayClient<AlipayPayClientConfig>
} }
} }
// TODO @jason: 注释记得补下哈
/** /**
* 从支付宝通知返回参数中解析 PayOrderNotifyRespDTO, 通知具体参数参考
* //https://opendocs.alipay.com/open/203/105286 * //https://opendocs.alipay.com/open/203/105286
* @param data 通知结果 * @param data 通知结果
* @return * @return 解析结果 PayOrderNotifyRespDTO
* @throws Exception * @throws Exception 解析失败抛出异常
*/ */
@Override @Override
public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyDataDTO data) throws Exception { public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyDataDTO data) throws Exception {

View File

@ -84,22 +84,21 @@ public class PayOrderController {
public String notifyAliPayWapPayOrder(@PathVariable("channelId") Long channelId, public String notifyAliPayWapPayOrder(@PathVariable("channelId") Long channelId,
@RequestParam Map<String, String> params, @RequestParam Map<String, String> params,
@RequestBody String originData) throws Exception { @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()); payOrderCoreService.notifyPayOrder(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), PayNotifyDataDTO.builder().params(params).body(originData).build());
return "success"; 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 * 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 * @param channelId 渠道id
* @return * @return 返回跳转页面
* @throws Exception
*/ */
@GetMapping(value = "/return/alipay-wap/{channelId}") @GetMapping(value = "/return/alipay-wap/{channelId}")
@ApiOperation("支付宝wap页面回跳") @ApiOperation("支付宝wap页面回跳")
public String returnAliPayWapPayOrder(@PathVariable("channelId") Long channelId){ public String returnAliPayWapPayOrder(@PathVariable("channelId") Long channelId){
//TODO @jason 校验 是否支付宝调用 支付宝publickey 可以根据 appId 跳转不同的页面 //TODO 校验 是否支付宝调用 可以根据 appId 跳转不同的页面
return "支付成功"; return "支付成功";
} }

View File

@ -155,4 +155,4 @@ yudao:
pay: pay:
pay-notify-url: http://jg6rde.natappfree.cc/api/pay/order/notify pay-notify-url: http://jg6rde.natappfree.cc/api/pay/order/notify
refund-notify-url: http://jg6rde.natappfree.cc/api/pay/refund/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

View File

@ -9,18 +9,17 @@
<body> <body>
<div>点击如下按钮,发起支付的测试</div> <div>点击如下按钮,发起支付的测试</div>
<div> <div>
<button id="alipay_wap">支付宝h5</button> <button id="alipay_wap">支付宝手机网站支付</button>
</div> </div>
<div id="dynamic_form"></div> <div id="dynamic_form"></div>
</body> </body>
<script> <script>
// TODO @jasoncopy 过来后,有些注释要改过来哈
let shopOrderId = undefined; let shopOrderId = undefined;
let payOrderId = undefined; let payOrderId = undefined;
let server = 'http://127.0.0.1:28080'; let server = 'http://127.0.0.1:28080';
//let server = 'http://niubi.natapp1.cc'; //let server = 'http://niubi.natapp1.cc';
// TODO openid
//let openid = "ockUAwIZ-0OeMZl9ogcZ4ILrGba0";
$(function() { $(function() {
// 自动发起商城订单编号 // 自动发起商城订单编号
$.ajax({ $.ajax({
@ -38,7 +37,7 @@
} }
}) })
}); });
// 微信公众号
$( "#alipay_wap").on( "click", function() { $( "#alipay_wap").on( "click", function() {
// 提交支付 // 提交支付
$.ajax({ $.ajax({
@ -56,7 +55,7 @@
return; return;
} }
alert('点击确定,开始支付'); alert('点击确定,开始支付');
// 开始调用微信支付 //支付宝 手机WAP 返回表单,自动跳到支付宝支付页面
let data = result.data.invokeResponse; let data = result.data.invokeResponse;
$("#dynamic_form").html(data.body); $("#dynamic_form").html(data.body);
} }