Merge branch 'refs/heads/master' into gateway

# Conflicts:
#	README.md
#	daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayService.java
This commit is contained in:
xxm1995
2024-04-18 13:40:05 +08:00
136 changed files with 9510 additions and 378 deletions

View File

@@ -6,7 +6,7 @@
<groupId>cn.bootx.platform</groupId>
<artifactId>daxpay-single-sdk</artifactId>
<version>2.0.4</version>
<version>2.0.5</version>
<packaging>jar</packaging>
<!-- 项目信息 -->

View File

@@ -0,0 +1,17 @@
package cn.bootx.platform.daxpay.sdk.model.allocation;
import cn.bootx.platform.daxpay.sdk.net.DaxPayResponseModel;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* 分账结果
* @author xxm
* @since 2024/4/18
*/
@Getter
@Setter
@ToString
public class AllocationModel extends DaxPayResponseModel {
}

View File

@@ -1,20 +0,0 @@
package cn.bootx.platform.daxpay.sdk.model.divide;
import cn.bootx.platform.daxpay.sdk.net.DaxPayResponseModel;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* 分账结果(目前未支持)
* @author xxm
* @since 2024/2/7
*/
@Getter
@Setter
@ToString
public class DivideOrderModel extends DaxPayResponseModel {
/** 分账状态 */
private String status;
}

View File

@@ -1,6 +1,6 @@
package cn.bootx.platform.daxpay.sdk.param.divide;
package cn.bootx.platform.daxpay.sdk.param.allocation;
import cn.bootx.platform.daxpay.sdk.model.divide.DivideOrderModel;
import cn.bootx.platform.daxpay.sdk.model.allocation.AllocationModel;
import cn.bootx.platform.daxpay.sdk.net.DaxPayRequest;
import cn.bootx.platform.daxpay.sdk.response.DaxPayResult;
import cn.hutool.core.lang.TypeReference;
@@ -15,27 +15,38 @@ import lombok.Setter;
*/
@Getter
@Setter
public class DivideOrderParam extends DaxPayRequest<DivideOrderModel> {
public class AllocationParam extends DaxPayRequest<AllocationModel> {
/** 支付ID */
/** 支付ID */
private Long paymentId;
/** 业务号 */
private String businessNo;
/** 分账单号(保证唯一) */
private String allocationNo;
/** 分账描述 */
private String description;
/**
* 分账组ID, 不传输分账组使用默认分账组进行分账
*/
private Long allocationGroupId;
/**
* 方法请求路径
*/
@Override
public String path() {
return "/unipay/divide";
return "/unipay/allocation";
}
/**
* 将请求返回结果反序列化为实体类
*/
@Override
public DaxPayResult<DivideOrderModel> toModel(String json) {
return JSONUtil.toBean(json, new TypeReference<DaxPayResult<DivideOrderModel>>() {}, false);
public DaxPayResult<AllocationModel> toModel(String json) {
return JSONUtil.toBean(json, new TypeReference<DaxPayResult<AllocationModel>>() {}, false);
}
}

View File

@@ -33,6 +33,9 @@ public class PayParam extends DaxPayRequest<PayOrderModel> {
/** 过期时间, 多次传输以第一次为准 */
private Long expiredTime;
/** 是否开启分账 */
private boolean allocation;
/** 用户付款中途退出返回商户网站的地址(部分支付场景中可用) */
private String quitUrl;

View File

@@ -41,6 +41,9 @@ public class SimplePayParam extends DaxPayRequest<PayOrderModel> {
/** 过期时间 */
private Long expiredTime;
/** 是否开启分账 */
private boolean allocation;
/** 用户付款中途退出返回商户网站的地址(部分支付场景中可用) */
private String quitUrl;

View File

@@ -0,0 +1,73 @@
package cn.bootx.platform.daxpay.sdk.payment;
import cn.bootx.platform.daxpay.sdk.code.PayChannelEnum;
import cn.bootx.platform.daxpay.sdk.code.PayWayEnum;
import cn.bootx.platform.daxpay.sdk.code.SignTypeEnum;
import cn.bootx.platform.daxpay.sdk.model.allocation.AllocationModel;
import cn.bootx.platform.daxpay.sdk.model.pay.PayOrderModel;
import cn.bootx.platform.daxpay.sdk.net.DaxPayConfig;
import cn.bootx.platform.daxpay.sdk.net.DaxPayKit;
import cn.bootx.platform.daxpay.sdk.param.allocation.AllocationParam;
import cn.bootx.platform.daxpay.sdk.param.pay.SimplePayParam;
import cn.bootx.platform.daxpay.sdk.response.DaxPayResult;
import cn.hutool.core.util.RandomUtil;
import org.junit.Before;
import org.junit.Test;
/**
* 支付分账测试
* @author xxm
* @since 2024/4/6
*/
public class PayAllocationTest {
@Before
public void init() {
// 初始化支付配置
DaxPayConfig config = DaxPayConfig.builder()
.serviceUrl("http://127.0.0.1:9000")
.signSecret("123456")
.signType(SignTypeEnum.HMAC_SHA256)
.build();
DaxPayKit.initConfig(config);
}
/**
* 创建用于分账的订单
*/
@Test
public void simplePay() {
// 简单支付参数
SimplePayParam param = new SimplePayParam();
param.setBusinessNo("P"+ RandomUtil.randomNumbers(5));
param.setAmount(10);
param.setTitle("测试分账支付");
param.setChannel(PayChannelEnum.WECHAT.getCode());
param.setPayWay(PayWayEnum.QRCODE.getCode());
param.setClientIp("127.0.0.1");
param.setNotNotify(true);
param.setAllocation(true);
DaxPayResult<PayOrderModel> execute = DaxPayKit.execute(param);
System.out.println(execute);
PayOrderModel data = execute.getData();
System.out.println(data);
}
/**
* 开启分账
*/
@Test
public void allocation() {
// 分账参数
AllocationParam param = new AllocationParam();
param.setAllocationNo("A"+ RandomUtil.randomNumbers(5));
param.setDescription("测试分账");
param.setAllocationGroupId(1L);
param.setClientIp("127.0.0.1");
param.setPaymentId(1L);
DaxPayResult<AllocationModel> execute = DaxPayKit.execute(param);
System.out.println(execute);
}
}