mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-06 04:27:55 +00:00
feat 支付同步/发起支付时, 如果订单已经超时, 但状态还是待支付, 触发修复操作关闭订单, 增加支付单关闭记录功能, 同步记录/关闭记录/修复记录 增加记录请求ID, 支付单存在异步支付时, 支付时间需要读取支付网关的返回的时间
fix 支付宝关闭支付订单,如果网关已经关闭,会返回错误导致本地订单无法关闭
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package cn.bootx.platform.daxpay.code;
|
||||
|
||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
* @author xxm
|
||||
@@ -27,4 +31,14 @@ public enum PayStatusEnum {
|
||||
/** 名称 */
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* 根据编码获取枚举
|
||||
*/
|
||||
public static PayStatusEnum findByCode(String code){
|
||||
return Arrays.stream(PayStatusEnum.values())
|
||||
.filter(payStatusEnum -> Objects.equals(payStatusEnum.getCode(), code))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new DataNotExistException("该枚举不存在"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,18 +16,14 @@ import java.util.Objects;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PaySyncStatusEnum {
|
||||
|
||||
NOT_SYNC("not_sync", "不需要同步"),
|
||||
FAIL("fail", "查询失败"),
|
||||
PAY_SUCCESS("pay_success", "支付成功"),
|
||||
PAY_WAIT("pay_wait", "等待付款中"),
|
||||
CLOSED("closed", "已关闭"),
|
||||
REFUND("refund", "已退款"),
|
||||
NOT_FOUND("not_found", "未查询到订单"),
|
||||
/** 例如支付宝支付后, 客户未进行操作, 将不会创建出订单, 所以同步会返回未查询到订单 */
|
||||
IGNORE("ignore", "忽略"),
|
||||
/** 本地订单到了超时时间, 但是网关和本地都未关闭, 需要触发关闭相关处理 */
|
||||
TIMEOUT("timeout", "超时未关闭"),
|
||||
FAIL("fail", "查询失败");
|
||||
TIMEOUT("timeout", "超时未关闭");
|
||||
|
||||
/** 编码 */
|
||||
private final String code;
|
||||
|
@@ -27,7 +27,7 @@ public abstract class PayCommonParam {
|
||||
|
||||
/** 商户扩展参数,回调时会原样返回 */
|
||||
@Schema(description = "商户扩展参数,回调时会原样返回")
|
||||
private String extraParam;
|
||||
private String attach;
|
||||
|
||||
@Schema(description = "是否不进行同步通知的跳转")
|
||||
private boolean notReturn;
|
||||
|
@@ -18,5 +18,5 @@ public class PayCommonResult {
|
||||
private String reqId = MDC.get(CommonCode.TRACE_ID);
|
||||
|
||||
@Schema(description = "商户扩展参数,回调时会原样返回")
|
||||
private String extraParam;
|
||||
private String attach;
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import static cn.bootx.platform.daxpay.code.PaySyncStatusEnum.NOT_SYNC;
|
||||
import static cn.bootx.platform.daxpay.code.PaySyncStatusEnum.FAIL;
|
||||
|
||||
/**
|
||||
* 支付单同步结果
|
||||
@@ -21,13 +21,23 @@ public class PaySyncResult extends PayCommonResult{
|
||||
|
||||
/**
|
||||
* 支付网关同步状态
|
||||
* @see PaySyncStatusEnum#NOT_SYNC
|
||||
* @see PaySyncStatusEnum
|
||||
*/
|
||||
private String syncStatus = NOT_SYNC.getCode();
|
||||
private String syncStatus = FAIL.getCode();
|
||||
|
||||
@Schema(description = "是否同步成功")
|
||||
private boolean success;
|
||||
|
||||
@Schema(description = "失败原因")
|
||||
private String errorMsg;
|
||||
|
||||
@Schema(description = "是否进行了修复")
|
||||
private boolean repair;
|
||||
|
||||
@Schema(description = "支付单修复前状态")
|
||||
private String oldStatus;
|
||||
|
||||
@Schema(description = "支付单修复后状态")
|
||||
private String repairStatus;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user