统一多种支付方式创建订单的入参

This commit is contained in:
2025-01-07 14:31:43 +08:00
parent de73536d1c
commit ee676614f8
12 changed files with 47 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.model.dto.ProductPurchaseDTO;
import com.ai.da.service.PayPalCheckoutService;
import com.paypal.http.HttpResponse;
import com.paypal.http.exceptions.SerializeException;
@@ -14,6 +15,7 @@ import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.HashMap;
@@ -26,9 +28,9 @@ public class PayPalCheckoutController {
private PayPalCheckoutService payPalCheckoutService;
@ApiOperation(value = "创建订单")
@PostMapping(value = "/trade/{amount}")
public Response<HashMap<String, String>> createOrder(@PathVariable Integer amount, @RequestParam String returnUrl, HttpServletRequest request) throws SerializeException {
HashMap<String, String> approvalUrl = payPalCheckoutService.createOrder(amount, returnUrl, request);
@PostMapping(value = "/trade")
public Response<HashMap<String, String>> createOrder(@Valid @RequestBody ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request) throws SerializeException {
HashMap<String, String> approvalUrl = payPalCheckoutService.createOrder(productPurchaseDTO, request);
return Response.success(approvalUrl);
}