初始化
parent
0b58a657de
commit
a77fe1f505
|
@ -38,15 +38,19 @@ public class AliPayController {
|
|||
private static final String SIGN_TYPE ="RSA2";
|
||||
|
||||
@GetMapping("/pay") // 前端路径参数格式?subject=xxx&traceNo=xxx&totalAmount=xxx
|
||||
public void pay(String traceNo, HttpServletResponse httpResponse) throws Exception {
|
||||
public void pay(@RequestParam(name = "traceNo") String traceNo, HttpServletResponse httpResponse) throws Exception {
|
||||
AliPay aliPay = new AliPay();
|
||||
aliPay.setTraceNo(traceNo);
|
||||
aliPay.setSubject(traceNo);
|
||||
aliPay.setTotalAmount(1);
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(GATEWAY_URL, aliPayConfig.getAppId(),
|
||||
aliPayConfig.getAppPrivateKey(), FORMAT, CHARSET, aliPayConfig.getAlipayPublicKey(), SIGN_TYPE);
|
||||
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
|
||||
request.setNotifyUrl(aliPayConfig.getNotifyUrl());
|
||||
request.setReturnUrl(aliPayConfig.getReturnUrl());
|
||||
request.setBizContent("{\"out_trade_no\":\"" + traceNo + "\","
|
||||
+ "\"total_amount\":\"" + 10 + "\","
|
||||
+ "\"subject\":\"" + "鸡你太美" + "\","
|
||||
+ "\"total_amount\":\"" + aliPay.getTotalAmount() + "\","
|
||||
+ "\"subject\":\"" + aliPay.getSubject() + "\","
|
||||
+ "\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}");
|
||||
String form = "";
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue