微调支付函数
This commit is contained in:
parent
9ad976efda
commit
4c15dfef9e
@ -47,7 +47,7 @@ public class AliPayController extends BaseController {
|
|||||||
@Parameters({
|
@Parameters({
|
||||||
@Parameter(name = "orderId", description = "订单号", required = true)
|
@Parameter(name = "orderId", description = "订单号", required = true)
|
||||||
})
|
})
|
||||||
@GetMapping("/pay/{orderNumber}")
|
@GetMapping("/url/{orderNumber}")
|
||||||
public AjaxResult pay(@PathVariable(name = "orderNumber") String orderNumber) {
|
public AjaxResult pay(@PathVariable(name = "orderNumber") String orderNumber) {
|
||||||
AlipayTradePagePayResponse response;
|
AlipayTradePagePayResponse response;
|
||||||
PayOrder aliPay = payOrderService.selectPayOrderByOrderNumber(orderNumber);
|
PayOrder aliPay = payOrderService.selectPayOrderByOrderNumber(orderNumber);
|
||||||
@ -68,9 +68,8 @@ public class AliPayController extends BaseController {
|
|||||||
@Operation(summary = "支付宝支付回调")
|
@Operation(summary = "支付宝支付回调")
|
||||||
@Transactional
|
@Transactional
|
||||||
@PostMapping("/notify")
|
@PostMapping("/notify")
|
||||||
public AjaxResult payNotify(HttpServletRequest request) throws Exception {
|
public AjaxResult notify(HttpServletRequest request) throws Exception {
|
||||||
if (request.getParameter("trade_status").equals("TRADE_SUCCESS")) {
|
if (request.getParameter("trade_status").equals("TRADE_SUCCESS")) {
|
||||||
System.out.println("=========支付宝异步回调========");
|
|
||||||
|
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
Map<String, String[]> requestParams = request.getParameterMap();
|
Map<String, String[]> requestParams = request.getParameterMap();
|
||||||
@ -81,15 +80,6 @@ public class AliPayController extends BaseController {
|
|||||||
String orderNumber = params.get("out_trade_no");
|
String orderNumber = params.get("out_trade_no");
|
||||||
// 支付宝验签
|
// 支付宝验签
|
||||||
if (Factory.Payment.Common().verifyNotify(params)) {
|
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"));
|
|
||||||
|
|
||||||
// // 更新订单未已支付
|
// // 更新订单未已支付
|
||||||
payOrderService.updateStatus(orderNumber, "已支付");
|
payOrderService.updateStatus(orderNumber, "已支付");
|
||||||
|
@ -45,7 +45,7 @@ public class SQBController extends BaseController {
|
|||||||
})
|
})
|
||||||
@PostMapping("/url/{orderNumber}")
|
@PostMapping("/url/{orderNumber}")
|
||||||
@Anonymous
|
@Anonymous
|
||||||
public R<String> payUrl(@PathVariable(name = "orderNumber") String orderNumber) throws Exception {
|
public R<String> url(@PathVariable(name = "orderNumber") String orderNumber) throws Exception {
|
||||||
PayOrder payOrder = payOrderServicer.selectPayOrderByOrderNumber(orderNumber);
|
PayOrder payOrder = payOrderServicer.selectPayOrderByOrderNumber(orderNumber);
|
||||||
String url = sqbServiceImpl.payUrl(payOrder);
|
String url = sqbServiceImpl.payUrl(payOrder);
|
||||||
return R.ok(url);
|
return R.ok(url);
|
||||||
@ -74,7 +74,7 @@ public class SQBController extends BaseController {
|
|||||||
@PostMapping("/notify")
|
@PostMapping("/notify")
|
||||||
@Anonymous
|
@Anonymous
|
||||||
@Operation(summary = "支付回调")
|
@Operation(summary = "支付回调")
|
||||||
public AjaxResult payNotify(@RequestBody JSONObject jsonObject) throws IOException {
|
public AjaxResult notify(@RequestBody JSONObject jsonObject) throws IOException {
|
||||||
// 验签
|
// 验签
|
||||||
// 修改订单状态
|
// 修改订单状态
|
||||||
// 用户自定义行为
|
// 用户自定义行为
|
||||||
|
@ -30,7 +30,6 @@ public class WxPayConfig {
|
|||||||
private String wxchantId;
|
private String wxchantId;
|
||||||
@Value("${pay.wechat.merchantSerialNumber}")
|
@Value("${pay.wechat.merchantSerialNumber}")
|
||||||
private String wxchantSerialNumber;
|
private String wxchantSerialNumber;
|
||||||
|
|
||||||
@Value("${pay.wechat.apiV3Key}")
|
@Value("${pay.wechat.apiV3Key}")
|
||||||
private String wxapiV3Key;
|
private String wxapiV3Key;
|
||||||
@Value("${pay.wechat.privateKeyPath}")
|
@Value("${pay.wechat.privateKeyPath}")
|
||||||
|
@ -60,7 +60,7 @@ public class WxPayController extends BaseController {
|
|||||||
@Parameter(name = "orderNumber", description = "订单号", required = true)
|
@Parameter(name = "orderNumber", description = "订单号", required = true)
|
||||||
})
|
})
|
||||||
@GetMapping("/url/{orderNumber}")
|
@GetMapping("/url/{orderNumber}")
|
||||||
public AjaxResult pay(@PathVariable(name = "orderNumber") String orderNumber) throws Exception {
|
public AjaxResult url(@PathVariable(name = "orderNumber") String orderNumber) throws Exception {
|
||||||
PayOrder aliPay = payOrderService.selectPayOrderByOrderNumber(orderNumber);
|
PayOrder aliPay = payOrderService.selectPayOrderByOrderNumber(orderNumber);
|
||||||
String amountStr = aliPay.getActualAmount();
|
String amountStr = aliPay.getActualAmount();
|
||||||
double amountDouble = Double.parseDouble(amountStr);
|
double amountDouble = Double.parseDouble(amountStr);
|
||||||
@ -81,7 +81,7 @@ public class WxPayController extends BaseController {
|
|||||||
@Anonymous
|
@Anonymous
|
||||||
@Operation(summary = "微信支付查询订单")
|
@Operation(summary = "微信支付查询订单")
|
||||||
@PostMapping("/notify")
|
@PostMapping("/notify")
|
||||||
public AjaxResult WxPayList(HttpServletRequest servletRequest, HttpServletResponse response)
|
public AjaxResult notify(HttpServletRequest servletRequest, HttpServletResponse response)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
String timeStamp = servletRequest.getHeader("Wechatpay-Timestamp");
|
String timeStamp = servletRequest.getHeader("Wechatpay-Timestamp");
|
||||||
String nonce = servletRequest.getHeader("Wechatpay-Nonce");
|
String nonce = servletRequest.getHeader("Wechatpay-Nonce");
|
||||||
|
Loading…
Reference in New Issue
Block a user