mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-10-13 21:30:25 +00:00
feat 分账SDK相关接口, 版本号升级
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.dromara.daxpay</groupId>
|
||||
<artifactId>daxpay-single</artifactId>
|
||||
<version>3.0.0.beta2</version>
|
||||
<version>3.0.0.beta3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>daxpay-single-core</artifactId>
|
||||
|
@@ -40,6 +40,11 @@ public class AllocationParam extends PaymentCommonParam {
|
||||
@Schema(description = "商户支付订单号")
|
||||
private String bizOrderNo;
|
||||
|
||||
/** 分账标题 */
|
||||
@Size(max = 100, message = "分账描述不可超过100位")
|
||||
@Schema(description = "分账标题")
|
||||
private String title;
|
||||
|
||||
/** 分账描述 */
|
||||
@Size(max = 150, message = "分账描述不可超过150位")
|
||||
@Schema(description = "分账描述")
|
||||
|
@@ -3,6 +3,8 @@ package org.dromara.daxpay.core.result.allocation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.AllocationResultEnum;
|
||||
import org.dromara.daxpay.core.enums.AllocationStatusEnum;
|
||||
|
||||
/**
|
||||
* 分账同步接口返回类
|
||||
@@ -13,4 +15,18 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "分账同步接口")
|
||||
public class AllocSyncResult {
|
||||
|
||||
/**
|
||||
* 分账状态
|
||||
* @see AllocationStatusEnum
|
||||
*/
|
||||
@Schema(description = "分账状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 分账结果
|
||||
* @see AllocationResultEnum
|
||||
*/
|
||||
@Schema(description = "分账结果")
|
||||
private String result;
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ package org.dromara.daxpay.core.result.allocation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.AllocationResultEnum;
|
||||
import org.dromara.daxpay.core.enums.AllocationStatusEnum;
|
||||
|
||||
/**
|
||||
@@ -28,4 +29,11 @@ public class AllocationResult {
|
||||
*/
|
||||
@Schema(description = "分账状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 分账结果
|
||||
* @see AllocationResultEnum
|
||||
*/
|
||||
@Schema(description = "分账结果")
|
||||
private String result;
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ import org.dromara.daxpay.core.enums.AllocationResultEnum;
|
||||
import org.dromara.daxpay.core.enums.AllocationStatusEnum;
|
||||
import org.dromara.daxpay.core.enums.ChannelEnum;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@@ -63,7 +64,7 @@ public class AllocOrderResult {
|
||||
* 总分账金额
|
||||
*/
|
||||
@Schema(description = "总分账金额")
|
||||
private Integer amount;
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 分账描述
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.dromara.daxpay</groupId>
|
||||
<artifactId>daxpay-single</artifactId>
|
||||
<version>3.0.0.beta2</version>
|
||||
<version>3.0.0.beta3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>daxpay-single-service</artifactId>
|
||||
|
@@ -110,7 +110,8 @@ public class AllocationService {
|
||||
return new AllocationResult()
|
||||
.setAllocNo(order.getAllocNo())
|
||||
.setBizAllocNo(order.getBizAllocNo())
|
||||
.setStatus(order.getStatus());
|
||||
.setStatus(order.getStatus())
|
||||
.setResult(order.getResult());
|
||||
}
|
||||
// 创建分账策略并初始化
|
||||
var allocationStrategy = PaymentStrategyFactory.create(payOrder.getChannel(),AbsAllocationStrategy.class);
|
||||
@@ -137,7 +138,8 @@ public class AllocationService {
|
||||
return new AllocationResult()
|
||||
.setAllocNo(order.getAllocNo())
|
||||
.setBizAllocNo(order.getBizAllocNo())
|
||||
.setStatus(order.getStatus());
|
||||
.setStatus(order.getStatus())
|
||||
.setResult(order.getResult());
|
||||
} finally {
|
||||
lockTemplate.releaseLock(lock);
|
||||
}
|
||||
@@ -214,7 +216,8 @@ public class AllocationService {
|
||||
return new AllocationResult()
|
||||
.setAllocNo(order.getAllocNo())
|
||||
.setBizAllocNo(order.getBizAllocNo())
|
||||
.setStatus(order.getStatus());
|
||||
.setStatus(order.getStatus())
|
||||
.setResult(order.getResult());
|
||||
} finally {
|
||||
lockTemplate.releaseLock(lock);
|
||||
}
|
||||
@@ -296,7 +299,8 @@ public class AllocationService {
|
||||
return new AllocationResult()
|
||||
.setAllocNo(allocOrder.getAllocNo())
|
||||
.setBizAllocNo(allocOrder.getBizAllocNo())
|
||||
.setStatus(allocOrder.getStatus());
|
||||
.setStatus(allocOrder.getStatus())
|
||||
.setResult(allocOrder.getResult());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -95,7 +95,7 @@ public class AllocationSyncService {
|
||||
|
||||
// 调用同步逻辑
|
||||
this.sync(allocOrder);
|
||||
return new AllocSyncResult();
|
||||
return new AllocSyncResult().setResult(allocOrder.getResult()).setStatus(allocOrder.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -4,6 +4,7 @@ import cn.bootx.platform.core.exception.ValidationFailedException;
|
||||
import cn.bootx.platform.core.util.BigDecimalUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.core.enums.AllocDetailResultEnum;
|
||||
@@ -163,10 +164,10 @@ public class AllocOrderService {
|
||||
.setOrderNo(payOrder.getOrderNo())
|
||||
.setBizOrderNo(payOrder.getBizOrderNo())
|
||||
.setOutOrderNo(payOrder.getOutOrderNo())
|
||||
.setTitle(payOrder.getTitle())
|
||||
.setAllocNo(TradeNoGenerateUtil.allocation())
|
||||
.setBizAllocNo(param.getBizAllocNo())
|
||||
.setChannel(payOrder.getChannel())
|
||||
.setTitle(param.getTitle())
|
||||
.setDescription(param.getDescription())
|
||||
.setStatus(AllocationStatusEnum.PROCESSING.getCode())
|
||||
.setResult(AllocationResultEnum.ALL_PENDING.getCode())
|
||||
@@ -174,6 +175,10 @@ public class AllocOrderService {
|
||||
.setNotifyUrl(param.getNotifyUrl())
|
||||
.setAttach(param.getAttach())
|
||||
.setClientIp(param.getClientIp());
|
||||
// 订单标题为空, 则使用支付订单标题
|
||||
if (StrUtil.isBlank(allocOrder.getTitle())){
|
||||
allocOrder.setTitle(payOrder.getTitle());
|
||||
}
|
||||
// 如果分账订单金额为0, 设置为忽略状态
|
||||
if (BigDecimalUtil.isEqual(sumAmount, BigDecimal.ZERO)) {
|
||||
allocOrder.setStatus(AllocationStatusEnum.IGNORE.getCode())
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.dromara.daxpay</groupId>
|
||||
<artifactId>daxpay-single</artifactId>
|
||||
<version>3.0.0.beta2</version>
|
||||
<version>3.0.0.beta3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>daxpay-single-unisdk</artifactId>
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
<groupId>org.dromara.daxpay</groupId>
|
||||
<artifactId>daxpay-single</artifactId>
|
||||
<version>3.0.0.beta2</version>
|
||||
<version>3.0.0.beta3</version>
|
||||
<packaging>pom</packaging>
|
||||
<description>单商户支付核心功能实现</description>
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
<lombok-mapstruct.version>0.2.0</lombok-mapstruct.version>
|
||||
<minio.version>8.5.2</minio.version>
|
||||
|
||||
<bootx-platform.version>3.0.0.beta2</bootx-platform.version>
|
||||
<daxpay.version>3.0.0.beta2</daxpay.version>
|
||||
<bootx-platform.version>3.0.0.beta3</bootx-platform.version>
|
||||
<daxpay.version>3.0.0.beta3</daxpay.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
Reference in New Issue
Block a user