mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-07 21:17:42 +00:00
refactor(sdk): 重构 SDK 参数和响应模型
- 更新了多个 SDK 参数和响应模型类的结构 - 优化了字段注解和数据校验 -统一了代码风格,提高了可读性和可维护性
This commit is contained in:
@@ -3,7 +3,9 @@ package org.dromara.daxpay.service.controller.unipay;
|
||||
import cn.bootx.platform.core.annotation.IgnoreAuth;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import cn.bootx.platform.core.util.ValidationUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.daxpay.core.param.assist.AuthCodeParam;
|
||||
import org.dromara.daxpay.core.param.assist.GenerateAuthUrlParam;
|
||||
import org.dromara.daxpay.core.result.DaxResult;
|
||||
@@ -13,9 +15,6 @@ import org.dromara.daxpay.core.util.DaxRes;
|
||||
import org.dromara.daxpay.service.common.anno.PaymentVerify;
|
||||
import org.dromara.daxpay.service.service.assist.ChannelAuthService;
|
||||
import org.dromara.daxpay.service.service.assist.PaymentAssistService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -37,10 +36,10 @@ public class ChannelUniAuthController {
|
||||
|
||||
private final PaymentAssistService paymentAssistService;
|
||||
|
||||
@PaymentVerify
|
||||
@Operation(summary = "获取授权链接")
|
||||
@PostMapping("/generateAuthUrl")
|
||||
public Result<AuthUrlResult> generateAuthUrl(@RequestBody GenerateAuthUrlParam param){
|
||||
ValidationUtil.validateParam(param);
|
||||
paymentAssistService.initMchApp(param.getAppId());
|
||||
return Res.ok(channelAuthService.generateAuthUrl(param));
|
||||
}
|
||||
|
@@ -7,16 +7,14 @@ import cn.bootx.platform.core.util.ValidationUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.daxpay.core.param.checkout.CheckoutAuthCodeParam;
|
||||
import org.dromara.daxpay.core.param.checkout.CheckoutAuthUrlParam;
|
||||
import org.dromara.daxpay.core.param.checkout.CheckoutCreatParam;
|
||||
import org.dromara.daxpay.core.param.checkout.CheckoutPayParam;
|
||||
import org.dromara.daxpay.core.param.checkout.*;
|
||||
import org.dromara.daxpay.core.result.DaxResult;
|
||||
import org.dromara.daxpay.core.result.assist.AuthResult;
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutAggregateOrderAndConfigResult;
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutOrderAndConfigResult;
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutPayResult;
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutUrlResult;
|
||||
import org.dromara.daxpay.core.result.trade.pay.PayResult;
|
||||
import org.dromara.daxpay.core.util.DaxRes;
|
||||
import org.dromara.daxpay.service.common.anno.PaymentVerify;
|
||||
import org.dromara.daxpay.service.service.checkout.CheckoutQueryService;
|
||||
@@ -28,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
* @author xxm
|
||||
* @since 2024/11/26
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@Tag(name = "收银台服务")
|
||||
@RestController
|
||||
@RequestMapping("/unipay/checkout")
|
||||
@@ -43,21 +42,18 @@ public class CheckoutController {
|
||||
return DaxRes.ok(checkoutService.creat(checkoutParam));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@Operation(summary = "获取收银台订单和配置信息")
|
||||
@GetMapping("/getOrderAndConfig")
|
||||
public Result<CheckoutOrderAndConfigResult> getOrderAndConfig(String orderNo, String checkoutType){
|
||||
return Res.ok(checkoutQueryService.getOrderAndConfig(orderNo, checkoutType));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@Operation(summary = "获取聚合支付配置")
|
||||
@GetMapping("/getAggregateConfig")
|
||||
public Result<CheckoutAggregateOrderAndConfigResult> getAggregateConfig(String orderNo, String aggregateType){
|
||||
return Res.ok(checkoutQueryService.getAggregateConfig(orderNo, aggregateType));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@Operation(summary = "获取收银台所需授权链接, 用于获取OpenId一类的信息")
|
||||
@PostMapping("/generateAuthUrl")
|
||||
public Result<String> generateAuthUrl(@RequestBody CheckoutAuthUrlParam param){
|
||||
@@ -65,7 +61,6 @@ public class CheckoutController {
|
||||
return Res.ok(checkoutService.generateAuthUrl(param));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@Operation(summary = "获取授权结果")
|
||||
@PostMapping("/auth")
|
||||
public Result<AuthResult> auth(@RequestBody CheckoutAuthCodeParam param){
|
||||
@@ -74,11 +69,21 @@ public class CheckoutController {
|
||||
}
|
||||
|
||||
|
||||
@IgnoreAuth
|
||||
@Operation(summary = "发起支付")
|
||||
@Operation(summary = "发起支付(普通)")
|
||||
@PostMapping("/pay")
|
||||
public Result<CheckoutPayResult> pay(@RequestBody CheckoutPayParam checkoutParam){
|
||||
return Res.ok(checkoutService.pay(checkoutParam));
|
||||
public Result<CheckoutPayResult> pay(@RequestBody CheckoutPayParam param){
|
||||
ValidationUtil.validateParam(param);
|
||||
return Res.ok(checkoutService.pay(param));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "发起支付(聚合)")
|
||||
@PostMapping("/aggregatePay")
|
||||
public Result<PayResult> aggregatePay(@RequestBody CheckoutAggregatePayParam param){
|
||||
ValidationUtil.validateParam(param);
|
||||
return Res.ok(checkoutService.aggregatePay(param));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user