Compare commits
No commits in common. "5e40809b6e42a2043007600af5c443053a2e5324" and "3a04eb58f95cec4e3c0f04e92f2ba72589450300" have entirely different histories.
5e40809b6e
...
3a04eb58f9
10
pom.xml
10
pom.xml
|
@ -17,16 +17,6 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
|
||||
|
||||
<!--引入支付宝支付 -->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-easysdk</artifactId>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
|
|
|
@ -6,21 +6,16 @@ import com.alipay.api.AlipayClient;
|
|||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||
import com.alipay.api.response.AlipayTradePagePayResponse;
|
||||
import com.alipay.easysdk.factory.Factory;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.PaymentParam;
|
||||
import com.muyu.config.util.SfUtil;
|
||||
import com.muyu.config.util.StandingRes;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/8/25 下午3:21
|
||||
|
@ -82,38 +77,6 @@ public class PaymentController {
|
|||
return Result.success(response.getBody());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/notify") // 注意这里必须是POST接口
|
||||
public String payNotify(HttpServletRequest request) throws Exception {
|
||||
if (request.getParameter("trade_status").equals("TRADE_SUCCESS")) {
|
||||
System.out.println("=========支付宝异步回调========");
|
||||
|
||||
Map<String, String> params = new HashMap<>();
|
||||
Map<String, String[]> requestParams = request.getParameterMap();
|
||||
for (String name : requestParams.keySet()) {
|
||||
params.put(name, request.getParameter(name));
|
||||
// System.out.println(name + " = " + request.getParameter(name));
|
||||
}
|
||||
|
||||
String tradeNo = params.get("out_trade_no");
|
||||
String gmtPayment = params.get("gmt_payment");
|
||||
String alipayTradeNo = params.get("trade_no");
|
||||
// 支付宝验签
|
||||
if (Factory.Payment.Common().verifyNotify(params)) {
|
||||
// 验签通过
|
||||
System.out.println("交易名称: " + params.get("subject"));
|
||||
System.out.println("交易状态: " + params.get("trade_status"));
|
||||
System.out.println("支付宝交易凭证号: " + params.get("trade_no"));
|
||||
System.out.println("商户订单号: " + params.get("out_trade_no"));
|
||||
System.out.println("交易金额: " + params.get("total_amount"));
|
||||
System.out.println("买家在支付宝唯一id: " + params.get("buyer_id"));
|
||||
System.out.println("买家付款时间: " + params.get("gmt_payment"));
|
||||
System.out.println("买家付款金额: " + params.get("buyer_pay_amount"));
|
||||
}
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
//TODO 充值记录添加
|
||||
|
|
Loading…
Reference in New Issue