初始化

master
法外狂徒张三 2024-08-28 20:45:43 +08:00
parent 82f10ee8f0
commit e68abea98d
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package com.muyu.pay.controller;
import com.alipay.easysdk.factory.Factory;
import com.muyu.common.core.domain.Result;
import com.muyu.pay.domain.AliPay;
import com.muyu.pay.domain.AliPayConfig;
import jakarta.servlet.http.HttpServletRequest;
@ -37,7 +38,7 @@ public class AliPayController {
private static final String SIGN_TYPE ="RSA2";
@PostMapping("/pay") // 前端路径参数格式?subject=xxx&traceNo=xxx&totalAmount=xxx
public void pay(@RequestBody AliPay aliPay, HttpServletResponse httpResponse) throws Exception {
public Result pay(@RequestBody 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();
@ -59,6 +60,7 @@ public class AliPayController {
httpResponse.getWriter().write(form);
httpResponse.getWriter().flush();
httpResponse.getWriter().close();
return Result.success();
}
@PostMapping("/notify") // 注意这里必须是POST接口