feat 一些开放接口的请求地址调整

This commit is contained in:
bootx
2024-05-26 22:48:11 +08:00
parent d6b1c8cd54
commit ab7fc45aa1
9 changed files with 114 additions and 41 deletions

View File

@@ -143,7 +143,7 @@ table-modify:
update-type: update
database-type: mysql
fail-fast: true
scan-package: cn.bootx.platform.daxpay
scan-package: cn.daxpay.single
dromara:
#文件存储配置,
x-file-storage:

View File

@@ -14,6 +14,8 @@ public interface PaymentApiCode {
String CLOSE = "close";
/** 分账 */
String ALLOCATION = "allocation";
/** 转账 */
String TRANSFER = "transfer";
/** 分账完结 */
String ALLOCATION_FINISH = "allocationFinish";
/** 支付同步 */
@@ -22,14 +24,18 @@ public interface PaymentApiCode {
String SYNC_REFUND = "syncRefund";
/** 分账同步 */
String SYNC_ALLOCATION = "syncAllocation";
/** 转账同步 */
String SYNC_TRANSFER = "syncTransfer";
/** 查询支付订单 */
String QUERY_PAY_ORDER = "queryPayOrder";
/** 查询退款订单 */
String QUERY_REFUND_ORDER = "queryRefundOrder";
/** 查询分账订单 */
String QUERY_ALLOCATION_ORDER = "queryAllocationOrder";
/** 查询转账订单 */
String QUERY_TRANSFER_ORDER = "queryTransferOrder";
/** 查询分账接收方 */
String QUERY_ALLOCATION_RECEIVER = "QueryAllocationReceiver";
String QUERY_ALLOCATION_RECEIVER = "queryAllocationReceiver";
/** 获取微信授权链接 */
String GET_WX_AUTH_URL = "getWxAuthUrl";
/** 获取微信AccessToken */

View File

@@ -0,0 +1,19 @@
package cn.daxpay.single.param.payment.transfer;
import cn.daxpay.single.param.PaymentCommonParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 转账参数
* @author xxm
* @since 2024/5/26
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@Schema(title = "转账参数")
public class TransferParam extends PaymentCommonParam {
}

View File

@@ -1,17 +1,18 @@
package cn.daxpay.single.gateway.controller;
import cn.daxpay.single.code.PaymentApiCode;
import cn.daxpay.single.param.payment.allocation.*;
import cn.daxpay.single.param.payment.allocation.AllocFinishParam;
import cn.daxpay.single.param.payment.allocation.AllocReceiverAddParam;
import cn.daxpay.single.param.payment.allocation.AllocReceiverRemoveParam;
import cn.daxpay.single.param.payment.allocation.AllocationParam;
import cn.daxpay.single.result.DaxResult;
import cn.daxpay.single.result.allocation.AllocReceiverAddResult;
import cn.daxpay.single.result.allocation.AllocReceiverRemoveResult;
import cn.daxpay.single.result.allocation.AllocationResult;
import cn.daxpay.single.result.allocation.AllocationSyncResult;
import cn.daxpay.single.service.annotation.PaymentSign;
import cn.daxpay.single.service.annotation.PlatformInitContext;
import cn.daxpay.single.service.core.payment.allocation.service.AllocationReceiverService;
import cn.daxpay.single.service.core.payment.allocation.service.AllocationService;
import cn.daxpay.single.service.core.payment.allocation.service.AllocationSyncService;
import cn.daxpay.single.util.DaxRes;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -34,8 +35,6 @@ public class UniAllocationController {
private final AllocationService allocationService;
private final AllocationSyncService allocationSyncService;
private final AllocationReceiverService receiverService;
@PaymentSign
@@ -54,13 +53,6 @@ public class UniAllocationController {
return DaxRes.ok(allocationService.finish(param));
}
@PaymentSign
@PlatformInitContext(PaymentApiCode.SYNC_ALLOCATION)
@Operation(summary = "分账同步接口")
@PostMapping("/sync")
public DaxResult<AllocationSyncResult> sync(@RequestBody AllocSyncParam param){
return DaxRes.ok(allocationSyncService.sync(param));
}
@PaymentSign
@PlatformInitContext(PaymentApiCode.ALLOCATION_RECEIVER_ADD)

View File

@@ -4,16 +4,14 @@ import cn.bootx.platform.common.core.annotation.IgnoreAuth;
import cn.daxpay.single.code.PaymentApiCode;
import cn.daxpay.single.param.payment.pay.PayCloseParam;
import cn.daxpay.single.param.payment.pay.PayParam;
import cn.daxpay.single.param.payment.pay.PaySyncParam;
import cn.daxpay.single.param.payment.refund.RefundParam;
import cn.daxpay.single.param.payment.refund.RefundSyncParam;
import cn.daxpay.single.param.payment.transfer.TransferParam;
import cn.daxpay.single.result.DaxResult;
import cn.daxpay.single.result.pay.PayCloseResult;
import cn.daxpay.single.result.pay.PayResult;
import cn.daxpay.single.result.pay.RefundResult;
import cn.daxpay.single.result.pay.SyncResult;
import cn.daxpay.single.service.annotation.PlatformInitContext;
import cn.daxpay.single.service.annotation.PaymentSign;
import cn.daxpay.single.service.annotation.PlatformInitContext;
import cn.daxpay.single.service.core.payment.close.service.PayCloseService;
import cn.daxpay.single.service.core.payment.pay.service.PayService;
import cn.daxpay.single.service.core.payment.refund.service.RefundService;
@@ -69,20 +67,14 @@ public class UniPayController {
return DaxRes.ok(refundService.refund(param));
}
@PaymentSign
@PlatformInitContext(PaymentApiCode.SYNC_PAY)
@Operation(summary = "支付同步接口")
@PostMapping("/syncPay")
public DaxResult<SyncResult> syncPay(@RequestBody PaySyncParam param){
return DaxRes.ok(paySyncService.sync(param));
}
@PaymentSign
@PlatformInitContext(PaymentApiCode.SYNC_REFUND)
@Operation(summary = "退款同步接口")
@PostMapping("/syncRefund")
public DaxResult<SyncResult> syncRefund(@RequestBody RefundSyncParam param){
return DaxRes.ok(refundSyncService.sync(param));
@PlatformInitContext(PaymentApiCode.TRANSFER)
@Operation(summary = "统一转账接口")
@PostMapping("/transfer")
public DaxResult<Void> transfer(@RequestBody TransferParam param){
return DaxRes.ok();
}
}

View File

@@ -0,0 +1,63 @@
package cn.daxpay.single.gateway.controller;
import cn.daxpay.single.code.PaymentApiCode;
import cn.daxpay.single.param.payment.allocation.AllocSyncParam;
import cn.daxpay.single.param.payment.pay.PaySyncParam;
import cn.daxpay.single.param.payment.refund.RefundSyncParam;
import cn.daxpay.single.result.DaxResult;
import cn.daxpay.single.result.allocation.AllocationSyncResult;
import cn.daxpay.single.result.pay.SyncResult;
import cn.daxpay.single.service.annotation.PaymentSign;
import cn.daxpay.single.service.annotation.PlatformInitContext;
import cn.daxpay.single.service.core.payment.allocation.service.AllocationSyncService;
import cn.daxpay.single.service.core.payment.sync.service.PaySyncService;
import cn.daxpay.single.service.core.payment.sync.service.RefundSyncService;
import cn.daxpay.single.util.DaxRes;
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;
import org.springframework.web.bind.annotation.RestController;
/**
* 统一同步接口
* @author xxm
* @since 2024/5/26
*/
@Tag(name = "")
@RestController
@RequestMapping("/unipay/sync/")
@RequiredArgsConstructor
public class UniPaySyncController {
private final PaySyncService paySyncService;
private final RefundSyncService refundSyncService;
private final AllocationSyncService allocationSyncService;
@PaymentSign
@PlatformInitContext(PaymentApiCode.SYNC_PAY)
@Operation(summary = "支付同步接口")
@PostMapping("/pay")
public DaxResult<SyncResult> syncPay(@RequestBody PaySyncParam param){
return DaxRes.ok(paySyncService.sync(param));
}
@PaymentSign
@PlatformInitContext(PaymentApiCode.SYNC_REFUND)
@Operation(summary = "退款同步接口")
@PostMapping("/refund")
public DaxResult<SyncResult> syncRefund(@RequestBody RefundSyncParam param){
return DaxRes.ok(refundSyncService.sync(param));
}
@PaymentSign
@PlatformInitContext(PaymentApiCode.SYNC_ALLOCATION)
@Operation(summary = "分账同步接口")
@PostMapping("/sync")
public DaxResult<AllocationSyncResult> sync(@RequestBody AllocSyncParam param){
return DaxRes.ok(allocationSyncService.sync(param));
}
}

View File

@@ -35,12 +35,14 @@ public class PayReturnService {
* 支付宝同步回调
*/
public String alipay(AliPayReturnParam param){
PayOrderExtra payOrderExtra = payOrderExtraManager.findById(param.getOut_trade_no()).orElse(null);
PayOrder payOrder = payOrderQueryService.findById(param.getOut_trade_no()).orElse(null);
if (Objects.isNull(payOrderExtra) || Objects.isNull(payOrder)){
PayOrder payOrder = payOrderQueryService.findByOrderNo(param.getOutTradeNo()).orElse(null);
if ( Objects.isNull(payOrder)){
return StrUtil.format("{}/result/error?msg={}", properties.getFrontH5Url(), URLEncodeUtil.encode("支付订单有问题,请排查"));
}
PayOrderExtra payOrderExtra = payOrderExtraManager.findById(payOrder.getId()).orElse(null);
if ( Objects.isNull(payOrderExtra)){
return StrUtil.format("{}/result/error?msg={}", properties.getFrontH5Url(), URLEncodeUtil.encode("支付订单有问题,请排查"));
}
// 如果同步跳转参数为空, 获取系统配置地址, 系统配置如果也为空, 则返回默认地址
String returnUrl = payOrderExtra.getReturnUrl();
if (StrUtil.isBlank(returnUrl)){

View File

@@ -54,7 +54,6 @@ public class TradeFlowRecordService {
.setType(TradeFlowRecordTypeEnum.PAY.getCode())
.setAmount(payOrder.getAmount());
tradeFlowRecordManager.save(tradeFlowRecord);
}
/**

View File

@@ -27,7 +27,7 @@ public class AliPayReturnParam {
*/
@Schema(description = "支付订单号")
@JsonAlias("out_trade_no")
private Long out_trade_no;
private String outTradeNo;
/**
* 该交易在支付宝系统中的交易流水号。最长 64 位。
@@ -35,7 +35,7 @@ public class AliPayReturnParam {
*/
@Schema(description = "网关订单号")
@JsonAlias("trade_no")
private String trade_no;
private String tradeNo;
@Schema(description = "接口名称")
@JsonAlias("method")
@@ -51,7 +51,7 @@ public class AliPayReturnParam {
@Schema(description = "不确定是什么")
@JsonAlias("auth_app_id")
private String auth_app_id;
private String authAppId;
/**
* 支付宝分配给开发者的应用ID。
@@ -59,14 +59,14 @@ public class AliPayReturnParam {
*/
@Schema(description = "应用ID")
@JsonAlias("app_id")
private String app_id;
private String appId;
/**
* 签名算法类型,目前支持 RSA2 和 RSA推荐使用RSA2
*/
@Schema(description = "签名算法类型")
@JsonAlias("sign_type")
private String sign_type;
private String signType;
/**
* 收款支付宝账号对应的支付宝唯一用户号。以 2088 开头的纯 16 位数字。
@@ -74,7 +74,7 @@ public class AliPayReturnParam {
*/
@Schema(description = "收款支付宝账号对应的支付宝唯一用户号")
@JsonAlias("seller_id")
private String seller_id;
private String sellerId;
/**
* 前台回跳的时间格式yyyy-MM-dd HH:mm:ss。