mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
code review 退款逻辑
This commit is contained in:
parent
5bf3045544
commit
19b574fd4b
@ -98,6 +98,7 @@ public class PayRefundDO extends BaseDO {
|
|||||||
* 退款单请求号,根据规则生成
|
* 退款单请求号,根据规则生成
|
||||||
* 例如说,R202109181134287570000
|
* 例如说,R202109181134287570000
|
||||||
*/
|
*/
|
||||||
|
// TODO @jason:merchantRefundNo =》merchantRefundOId
|
||||||
private String merchantRefundNo;
|
private String merchantRefundNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,6 +102,7 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService {
|
|||||||
//可以重复提交,保证 退款请求号 一致,由渠道保证幂等
|
//可以重复提交,保证 退款请求号 一致,由渠道保证幂等
|
||||||
}else {
|
}else {
|
||||||
// 成功,插入退款单 状态为生成.没有和渠道交互
|
// 成功,插入退款单 状态为生成.没有和渠道交互
|
||||||
|
// TODO @jason:搞到 convert 里。一些额外的自动,手动 set 下;
|
||||||
payRefundDO = PayRefundDO.builder().channelOrderNo(order.getChannelOrderNo())
|
payRefundDO = PayRefundDO.builder().channelOrderNo(order.getChannelOrderNo())
|
||||||
.appId(order.getAppId())
|
.appId(order.getAppId())
|
||||||
.channelOrderNo(order.getChannelOrderNo())
|
.channelOrderNo(order.getChannelOrderNo())
|
||||||
@ -123,6 +124,7 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService {
|
|||||||
.build();
|
.build();
|
||||||
payRefundCoreMapper.insert(payRefundDO);
|
payRefundCoreMapper.insert(payRefundDO);
|
||||||
}
|
}
|
||||||
|
// TODO @jason:搞到 convert 里。一些额外的自动,手动 set 下;
|
||||||
PayRefundUnifiedReqDTO unifiedReqDTO = new PayRefundUnifiedReqDTO();
|
PayRefundUnifiedReqDTO unifiedReqDTO = new PayRefundUnifiedReqDTO();
|
||||||
unifiedReqDTO.setUserIp(req.getUserIp())
|
unifiedReqDTO.setUserIp(req.getUserIp())
|
||||||
.setAmount(req.getAmount())
|
.setAmount(req.getAmount())
|
||||||
@ -133,7 +135,8 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService {
|
|||||||
// 向渠道发起退款申请
|
// 向渠道发起退款申请
|
||||||
PayCommonResult<PayRefundUnifiedRespDTO> refundUnifiedResult = client.unifiedRefund(unifiedReqDTO);
|
PayCommonResult<PayRefundUnifiedRespDTO> refundUnifiedResult = client.unifiedRefund(unifiedReqDTO);
|
||||||
// 检查是否失败,失败抛出业务异常。
|
// 检查是否失败,失败抛出业务异常。
|
||||||
//TODO 渠道的异常记录
|
// TODO 渠道的异常记录。
|
||||||
|
// TODO @jason:可以先打个 warn log 哈;
|
||||||
refundUnifiedResult.checkError();
|
refundUnifiedResult.checkError();
|
||||||
// 成功在 退款回调中处理
|
// 成功在 退款回调中处理
|
||||||
return PayRefundRespDTO.builder().refundId(payRefundDO.getId()).build();
|
return PayRefundRespDTO.builder().refundId(payRefundDO.getId()).build();
|
||||||
|
@ -118,10 +118,9 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl
|
|||||||
PayRefundUnifiedRespDTO respDTO = new PayRefundUnifiedRespDTO();
|
PayRefundUnifiedRespDTO respDTO = new PayRefundUnifiedRespDTO();
|
||||||
respDTO.setChannelRefundId("");
|
respDTO.setChannelRefundId("");
|
||||||
return PayCommonResult.build(response.getCode(), response.getMsg(), respDTO, codeMapping);
|
return PayCommonResult.build(response.getCode(), response.getMsg(), respDTO, codeMapping);
|
||||||
}else{
|
}
|
||||||
// 失败。需要抛出异常
|
// 失败。需要抛出异常
|
||||||
return PayCommonResult.build(response.getCode(), response.getMsg(), null, codeMapping);
|
return PayCommonResult.build(response.getCode(), response.getMsg(), null, codeMapping);
|
||||||
}
|
|
||||||
} catch (AlipayApiException e) {
|
} catch (AlipayApiException e) {
|
||||||
// TODO 记录异常日志
|
// TODO 记录异常日志
|
||||||
log.error("[doUnifiedRefund][request({}) 发起退款失败,网络读超时,退款状态未知]", toJsonString(reqDTO), e);
|
log.error("[doUnifiedRefund][request({}) 发起退款失败,网络读超时,退款状态未知]", toJsonString(reqDTO), e);
|
||||||
|
Loading…
Reference in New Issue
Block a user