mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	支付宝统一退款接口 subCode == ACQ.SYSTEM_ERROR 返回 WAITING 状态
This commit is contained in:
		| @@ -13,6 +13,11 @@ import java.time.LocalDateTime; | ||||
| @Data | ||||
| public class PayTransferRespDTO { | ||||
|  | ||||
|     /** | ||||
|      * 转账状态 | ||||
|      * | ||||
|      * 关联 {@link  PayTransferStatusRespEnum#getStatus()} | ||||
|      */ | ||||
|     private Integer status; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -51,7 +51,7 @@ public class PayTransferUnifiedReqDTO { | ||||
|     private String title; | ||||
|  | ||||
|     /** | ||||
|      * 收款方信息,转账类型不同信息不同 | ||||
|      * 收款方信息,转账类型不同,收款方信息不同 | ||||
|      */ | ||||
|     @NotEmpty(message = "收款方信息 不能为空") | ||||
|     private Map<String, String> payeeInfo; | ||||
|   | ||||
| @@ -50,6 +50,8 @@ public class PayClientFactoryImpl implements PayClientFactory { | ||||
|         clientClass.put(ALIPAY_APP, AlipayAppPayClient.class); | ||||
|         clientClass.put(ALIPAY_PC, AlipayPcPayClient.class); | ||||
|         clientClass.put(ALIPAY_BAR, AlipayBarPayClient.class); | ||||
|         // 支付包转账客户端 | ||||
|         clientClass.put(ALIPAY_TRANSFER, AlipayTransferClient.class); | ||||
|         // Mock 支付客户端 | ||||
|         clientClass.put(MOCK, MockPayClient.class); | ||||
|     } | ||||
|   | ||||
| @@ -151,7 +151,7 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPa | ||||
|         AlipayTradeRefundResponse response = client.execute(request); | ||||
|         if (!response.isSuccess()) { | ||||
|             // 当出现 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.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.util.StrUtil; | ||||
| 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.PayOrderUnifiedReqDTO; | ||||
| 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 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.util.ServiceExceptionUtil.exception0; | ||||
|  | ||||
| @@ -82,12 +81,11 @@ public class AlipayTransferClient extends AbstractAlipayPayClient { | ||||
|                 // 处理结果 | ||||
|                 if (!response.isSuccess()) { | ||||
|                     // 当出现 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.failureOf(response.getSubCode(), response.getSubMsg(), | ||||
|                             reqDTO.getOutTransferNo(), response); | ||||
|  | ||||
|                 } | ||||
|                 return  PayTransferRespDTO.successOf(response.getOrderId(), parseTime(response.getTransDate()), | ||||
|                         response.getOutBizNo(), response); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jason
					jason