增加支付回调地址的配置

This commit is contained in:
YunaiV
2021-10-25 09:56:49 +08:00
parent 1b0aaec9ab
commit 20628987c9
9 changed files with 93 additions and 6 deletions

View File

@ -32,7 +32,7 @@ public class PayOrderController {
@PostMapping("/submit")
@ApiOperation("提交支付订单")
// @PreAuthenticated // TODO 暂时不加登陆验证,前端暂时没做好
public CommonResult<PayOrderSubmitRespVO> submit(@RequestBody PayOrderSubmitReqVO reqVO) {
public CommonResult<PayOrderSubmitRespVO> submitPayOrder(@RequestBody PayOrderSubmitReqVO reqVO) {
// 获得订单
PayOrderDO payOrder = payOrderCoreService.getPayOrder(reqVO.getId());
@ -47,4 +47,13 @@ public class PayOrderController {
return success(PayOrderSubmitRespVO.builder().invokeResponse(respDTO.getInvokeResponse()).build());
}
// ========== 支付渠道的回调 ==========
@PostMapping("/notify/wx-pub")
@ApiOperation("通知微信公众号的结果")
public String notifyWxPayOrder(@RequestBody String xmlData) {
System.out.println(xmlData);
return "success";
}
}

View File

@ -138,3 +138,6 @@ yudao:
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
demo: true # 开启演示模式
pay:
pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify
refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify

View File

@ -152,3 +152,6 @@ yudao:
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
demo: false # 关闭演示模式
pay:
pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify
refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify

View File

@ -18,6 +18,8 @@
let payOrderId = undefined;
// let server = 'http://127.0.0.1:28080';
let server = 'http://niubi.natapp1.cc';
// TODO openid
let openid = "ockUAwIZ-0OeMZl9ogcZ4ILrGba0";
$(function() {
// 获得 JsapiTicket
// 参考 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html 文档
@ -73,6 +75,8 @@
}
// 提交支付
// 参考 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6 文档
// 参考 https://segmentfault.com/a/1190000020704650 文档
$.ajax({
url: server + "/api/pay/order/submit",
method: 'POST',
@ -81,6 +85,9 @@
data: JSON.stringify({
"id": payOrderId,
"channelCode": 'wx_pub',
"channelExtras": {
"openid": openid
}
}),
success: function( result ) {
if (result.code !== 0) {