mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-02-20 03:00:34 +08:00
支付宝统一退款接口 subCode == ACQ.SYSTEM_ERROR 返回 WAITING 状态
This commit is contained in:
parent
0f0e6eb8ba
commit
6fcff0863a
@ -13,6 +13,11 @@ import java.time.LocalDateTime;
|
|||||||
@Data
|
@Data
|
||||||
public class PayTransferRespDTO {
|
public class PayTransferRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账状态
|
||||||
|
*
|
||||||
|
* 关联 {@link PayTransferStatusRespEnum#getStatus()}
|
||||||
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,7 @@ public class PayTransferUnifiedReqDTO {
|
|||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收款方信息,转账类型不同信息不同
|
* 收款方信息,转账类型不同,收款方信息不同
|
||||||
*/
|
*/
|
||||||
@NotEmpty(message = "收款方信息 不能为空")
|
@NotEmpty(message = "收款方信息 不能为空")
|
||||||
private Map<String, String> payeeInfo;
|
private Map<String, String> payeeInfo;
|
||||||
|
@ -50,6 +50,8 @@ public class PayClientFactoryImpl implements PayClientFactory {
|
|||||||
clientClass.put(ALIPAY_APP, AlipayAppPayClient.class);
|
clientClass.put(ALIPAY_APP, AlipayAppPayClient.class);
|
||||||
clientClass.put(ALIPAY_PC, AlipayPcPayClient.class);
|
clientClass.put(ALIPAY_PC, AlipayPcPayClient.class);
|
||||||
clientClass.put(ALIPAY_BAR, AlipayBarPayClient.class);
|
clientClass.put(ALIPAY_BAR, AlipayBarPayClient.class);
|
||||||
|
// 支付包转账客户端
|
||||||
|
clientClass.put(ALIPAY_TRANSFER, AlipayTransferClient.class);
|
||||||
// Mock 支付客户端
|
// Mock 支付客户端
|
||||||
clientClass.put(MOCK, MockPayClient.class);
|
clientClass.put(MOCK, MockPayClient.class);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPa
|
|||||||
AlipayTradeRefundResponse response = client.execute(request);
|
AlipayTradeRefundResponse response = client.execute(request);
|
||||||
if (!response.isSuccess()) {
|
if (!response.isSuccess()) {
|
||||||
// 当出现 ACQ.SYSTEM_ERROR, 退款可能成功也可能失败。 返回 WAIT 状态. 后续 job 会轮询
|
// 当出现 ACQ.SYSTEM_ERROR, 退款可能成功也可能失败。 返回 WAIT 状态. 后续 job 会轮询
|
||||||
if (Objects.equals(response.getSubCode(), "ACQ.SYSTEM_ERROR")) {
|
if (ObjectUtils.equalsAny(response.getSubCode(), "ACQ.SYSTEM_ERROR", "SYSTEM_ERROR")) {
|
||||||
return PayRefundRespDTO.waitingOf(null, reqDTO.getOutRefundNo(), response);
|
return PayRefundRespDTO.waitingOf(null, reqDTO.getOutRefundNo(), response);
|
||||||
}
|
}
|
||||||
return PayRefundRespDTO.failureOf(response.getSubCode(), response.getSubMsg(), reqDTO.getOutRefundNo(), response);
|
return PayRefundRespDTO.failureOf(response.getSubCode(), response.getSubMsg(), reqDTO.getOutRefundNo(), response);
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
|||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
|
||||||
@ -18,8 +19,6 @@ import com.alipay.api.request.AlipayFundTransUniTransferRequest;
|
|||||||
import com.alipay.api.response.AlipayFundTransUniTransferResponse;
|
import com.alipay.api.response.AlipayFundTransUniTransferResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
|
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||||
|
|
||||||
@ -82,12 +81,11 @@ public class AlipayTransferClient extends AbstractAlipayPayClient {
|
|||||||
// 处理结果
|
// 处理结果
|
||||||
if (!response.isSuccess()) {
|
if (!response.isSuccess()) {
|
||||||
// 当出现 SYSTEM_ERROR, 转账可能成功也可能失败。 返回 WAIT 状态. 后续 job 会轮询
|
// 当出现 SYSTEM_ERROR, 转账可能成功也可能失败。 返回 WAIT 状态. 后续 job 会轮询
|
||||||
if (Objects.equals(response.getSubCode(), "SYSTEM_ERROR")) {
|
if (ObjectUtils.equalsAny(response.getSubCode(), "SYSTEM_ERROR", "ACQ.SYSTEM_ERROR")) {
|
||||||
return PayTransferRespDTO.waitingOf(null, reqDTO.getOutTransferNo(), response);
|
return PayTransferRespDTO.waitingOf(null, reqDTO.getOutTransferNo(), response);
|
||||||
}
|
}
|
||||||
return PayTransferRespDTO.failureOf(response.getSubCode(), response.getSubMsg(),
|
return PayTransferRespDTO.failureOf(response.getSubCode(), response.getSubMsg(),
|
||||||
reqDTO.getOutTransferNo(), response);
|
reqDTO.getOutTransferNo(), response);
|
||||||
|
|
||||||
}
|
}
|
||||||
return PayTransferRespDTO.successOf(response.getOrderId(), parseTime(response.getTransDate()),
|
return PayTransferRespDTO.successOf(response.getOrderId(), parseTime(response.getTransDate()),
|
||||||
response.getOutBizNo(), response);
|
response.getOutBizNo(), response);
|
||||||
|
Loading…
Reference in New Issue
Block a user