初始化
parent
d8e580efe0
commit
8465ec2f33
|
@ -40,7 +40,7 @@ public class AliPayController {
|
||||||
|
|
||||||
@GetMapping("/pay")
|
@GetMapping("/pay")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public void pay(@Validated AliPay aliPay, HttpServletResponse httpResponse) throws Exception {
|
public Result pay(@Validated AliPay aliPay, HttpServletResponse httpResponse) throws Exception {
|
||||||
AlipayClient alipayClient = new DefaultAlipayClient(GATEWAY_URL, aliPayConfig.getAppId(),
|
AlipayClient alipayClient = new DefaultAlipayClient(GATEWAY_URL, aliPayConfig.getAppId(),
|
||||||
aliPayConfig.getAppPrivateKey(), FORMAT, CHARSET, aliPayConfig.getAlipayPublicKey(), SIGN_TYPE);
|
aliPayConfig.getAppPrivateKey(), FORMAT, CHARSET, aliPayConfig.getAlipayPublicKey(), SIGN_TYPE);
|
||||||
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
|
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
|
||||||
|
@ -62,10 +62,11 @@ public class AliPayController {
|
||||||
httpResponse.getWriter().write(form);
|
httpResponse.getWriter().write(form);
|
||||||
httpResponse.getWriter().flush();
|
httpResponse.getWriter().flush();
|
||||||
httpResponse.getWriter().close();
|
httpResponse.getWriter().close();
|
||||||
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/notify") // 注意这里必须是POST接口
|
@PostMapping("/notify") // 注意这里必须是POST接口
|
||||||
public String payNotify(HttpServletRequest request) throws Exception {
|
public Result payNotify(HttpServletRequest request) throws Exception {
|
||||||
if (request.getParameter("trade_status").equals("TRADE_SUCCESS")) {
|
if (request.getParameter("trade_status").equals("TRADE_SUCCESS")) {
|
||||||
System.out.println("=========支付宝异步回调========");
|
System.out.println("=========支付宝异步回调========");
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ public class AliPayController {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "success";
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue