mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
1. AlipayBarPayClient 增加小额支付的成功返回
This commit is contained in:
parent
5ae43a238d
commit
0fcc0072c2
@ -81,6 +81,8 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
PayOrderRespDTO resp;
|
PayOrderRespDTO resp;
|
||||||
try {
|
try {
|
||||||
resp = doUnifiedOrder(reqDTO);
|
resp = doUnifiedOrder(reqDTO);
|
||||||
|
} catch (ServiceException ex) { // 业务异常,都是实现类已经翻译,所以直接抛出即可
|
||||||
|
throw ex;
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
// 系统异常,则包装成 PayException 异常抛出
|
// 系统异常,则包装成 PayException 异常抛出
|
||||||
log.error("[unifiedOrder][客户端({}) request({}) 发起支付异常]",
|
log.error("[unifiedOrder][客户端({}) request({}) 发起支付异常]",
|
||||||
@ -97,6 +99,8 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
public final PayOrderRespDTO parseOrderNotify(Map<String, String> params, String body) {
|
public final PayOrderRespDTO parseOrderNotify(Map<String, String> params, String body) {
|
||||||
try {
|
try {
|
||||||
return doParseOrderNotify(params, body);
|
return doParseOrderNotify(params, body);
|
||||||
|
} catch (ServiceException ex) { // 业务异常,都是实现类已经翻译,所以直接抛出即可
|
||||||
|
throw ex;
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
log.error("[parseOrderNotify][客户端({}) params({}) body({}) 解析失败]",
|
log.error("[parseOrderNotify][客户端({}) params({}) body({}) 解析失败]",
|
||||||
getId(), params, body, ex);
|
getId(), params, body, ex);
|
||||||
@ -111,6 +115,8 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
public final PayOrderRespDTO getOrder(String outTradeNo) {
|
public final PayOrderRespDTO getOrder(String outTradeNo) {
|
||||||
try {
|
try {
|
||||||
return doGetOrder(outTradeNo);
|
return doGetOrder(outTradeNo);
|
||||||
|
} catch (ServiceException ex) { // 业务异常,都是实现类已经翻译,所以直接抛出即可
|
||||||
|
throw ex;
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
log.error("[getOrder][客户端({}) outTradeNo({}) 查询支付单异常]",
|
log.error("[getOrder][客户端({}) outTradeNo({}) 查询支付单异常]",
|
||||||
getId(), outTradeNo, ex);
|
getId(), outTradeNo, ex);
|
||||||
@ -130,8 +136,7 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
PayRefundRespDTO resp;
|
PayRefundRespDTO resp;
|
||||||
try {
|
try {
|
||||||
resp = doUnifiedRefund(reqDTO);
|
resp = doUnifiedRefund(reqDTO);
|
||||||
} catch (ServiceException ex) {
|
} catch (ServiceException ex) { // 业务异常,都是实现类已经翻译,所以直接抛出即可
|
||||||
// 业务异常,都是实现类已经翻译,所以直接抛出即可
|
|
||||||
throw ex;
|
throw ex;
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
// 系统异常,则包装成 PayException 异常抛出
|
// 系统异常,则包装成 PayException 异常抛出
|
||||||
@ -148,6 +153,8 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
public final PayRefundRespDTO parseRefundNotify(Map<String, String> params, String body) {
|
public final PayRefundRespDTO parseRefundNotify(Map<String, String> params, String body) {
|
||||||
try {
|
try {
|
||||||
return doParseRefundNotify(params, body);
|
return doParseRefundNotify(params, body);
|
||||||
|
} catch (ServiceException ex) { // 业务异常,都是实现类已经翻译,所以直接抛出即可
|
||||||
|
throw ex;
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
log.error("[parseRefundNotify][客户端({}) params({}) body({}) 解析失败]",
|
log.error("[parseRefundNotify][客户端({}) params({}) body({}) 解析失败]",
|
||||||
getId(), params, body, ex);
|
getId(), params, body, ex);
|
||||||
@ -162,6 +169,8 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
public final PayRefundRespDTO getRefund(String outTradeNo, String outRefundNo) {
|
public final PayRefundRespDTO getRefund(String outTradeNo, String outRefundNo) {
|
||||||
try {
|
try {
|
||||||
return doGetRefund(outTradeNo, outRefundNo);
|
return doGetRefund(outTradeNo, outRefundNo);
|
||||||
|
} catch (ServiceException ex) { // 业务异常,都是实现类已经翻译,所以直接抛出即可
|
||||||
|
throw ex;
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
log.error("[getRefund][客户端({}) outTradeNo({}) outRefundNo({}) 查询退款单异常]",
|
log.error("[getRefund][客户端({}) outTradeNo({}) outRefundNo({}) 查询退款单异常]",
|
||||||
getId(), outTradeNo, outRefundNo, ex);
|
getId(), outTradeNo, outRefundNo, ex);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
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.pay.core.client.dto.order.PayOrderRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
||||||
@ -55,13 +56,17 @@ public class AlipayBarPayClient extends AbstractAlipayPayClient {
|
|||||||
request.setNotifyUrl(reqDTO.getNotifyUrl());
|
request.setNotifyUrl(reqDTO.getNotifyUrl());
|
||||||
request.setReturnUrl(reqDTO.getReturnUrl());
|
request.setReturnUrl(reqDTO.getReturnUrl());
|
||||||
|
|
||||||
// TODO 芋艿:各种边界的处理
|
|
||||||
// 2.1 执行请求
|
// 2.1 执行请求
|
||||||
AlipayTradePayResponse response = client.execute(request);
|
AlipayTradePayResponse response = client.execute(request);
|
||||||
// 2.2 处理结果
|
// 2.2 处理结果
|
||||||
if (!response.isSuccess()) {
|
if (!response.isSuccess()) {
|
||||||
return buildClosedPayOrderRespDTO(reqDTO, response);
|
return buildClosedPayOrderRespDTO(reqDTO, response);
|
||||||
}
|
}
|
||||||
|
if ("10000".equals(response.getCode())) { // 免密支付
|
||||||
|
return PayOrderRespDTO.successOf(response.getTradeNo(), response.getBuyerUserId(), LocalDateTimeUtil.of(response.getGmtPayment()),
|
||||||
|
response.getOutTradeNo(), response);
|
||||||
|
}
|
||||||
|
// 大额支付,需要用户输入密码,所以返回 waiting。此时,前端一般会进行轮询
|
||||||
return PayOrderRespDTO.waitingOf(displayMode, "",
|
return PayOrderRespDTO.waitingOf(displayMode, "",
|
||||||
reqDTO.getOutTradeNo(), response);
|
reqDTO.getOutTradeNo(), response);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user