初始化

master
法外狂徒张三 2024-08-30 20:27:02 +08:00
parent d8e580efe0
commit 8465ec2f33
1 changed files with 4 additions and 3 deletions

View File

@ -40,7 +40,7 @@ public class AliPayController {
@GetMapping("/pay")
@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(),
aliPayConfig.getAppPrivateKey(), FORMAT, CHARSET, aliPayConfig.getAlipayPublicKey(), SIGN_TYPE);
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
@ -62,10 +62,11 @@ public class AliPayController {
httpResponse.getWriter().write(form);
httpResponse.getWriter().flush();
httpResponse.getWriter().close();
return Result.success();
}
@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")) {
System.out.println("=========支付宝异步回调========");
@ -94,7 +95,7 @@ public class AliPayController {
}
}
return "success";
return Result.success();
}
}