增加免押支付扣款逻辑

This commit is contained in:
2025-09-29 23:43:19 +08:00
parent e2958b47ca
commit 19a5bde9b0
6 changed files with 57 additions and 2 deletions

View File

@ -7,6 +7,8 @@ import java.math.BigDecimal;
public interface PayService {
/**
* 预支付下单
* @param payType
@ -30,6 +32,18 @@ public interface PayService {
String refundOrder(String payType,Long companyId,String outTradeNo, BigDecimal totalFee, BigDecimal refundFee);
/**
* 支付宝免押扣款
* @param body
* @param companyId
* @param outTradeNo
* @param authNo
* @param totalFee
* @return
*/
UnifiedPaymentInfoDTO zhimaPayOrder(String body, Long companyId, String outTradeNo, String authNo, BigDecimal totalFee);
/**
* 冻结
* @param companyId

View File

@ -423,8 +423,9 @@ public class OrderServiceImpl implements OrderService {
throw new BizException("无租车待支付单,支付失败");
}
//开始发起支付
UnifiedPaymentInfoDTO unifiedPaymentInfoDTO = payService.prepayOrder(rentCarOrder.getPaymentMethod(),orderMainPO.getRentCarRuleId().toString(),orderMainPO.getOperatorId(),rentCarOrder.getPaymentId(),userInfoDTO
,orderMainPO.getOrderAmount());
// UnifiedPaymentInfoDTO unifiedPaymentInfoDTO = payService.prepayOrder(rentCarOrder.getPaymentMethod(),orderMainPO.getRentCarRuleId().toString(),orderMainPO.getOperatorId(),rentCarOrder.getPaymentId(),userInfoDTO
// ,orderMainPO.getOrderAmount());
UnifiedPaymentInfoDTO unifiedPaymentInfoDTO = payService.zhimaPayOrder("闪充智行租车免押支付",orderMainPO.getOperatorId(),rentCarOrder.getPaymentId(),noDepositOrder.getTransactionId(),orderMainPO.getOrderAmount());
LambdaUpdateWrapper<OrderSubPO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(OrderSubPO::getSuborderId, noDepositOrder.getSuborderId())
.eq(OrderSubPO::getDelFlag, "0")

View File

@ -89,6 +89,19 @@ public class PayServiceImpl implements PayService {
return null;
}
@Override
public UnifiedPaymentInfoDTO zhimaPayOrder(String body, Long companyId, String outTradeNo, String authNo, BigDecimal totalFee) {
AlipayCreateRequest alipayCreateRequest = new AlipayCreateRequest();
alipayCreateRequest.setCompanyId(companyId);
alipayCreateRequest.setSubject(body);
alipayCreateRequest.setBody(body);
alipayCreateRequest.setOutTradeNo(outTradeNo);
alipayCreateRequest.setAuthNo(authNo);
alipayCreateRequest.setTotalAmount(totalFee.toString());
return payInteg.zhiMaOrder(alipayCreateRequest);
}
@Override
public UnifiedPaymentInfoDTO freezeOrder(Long companyId, String outOrderNo, BigDecimal freezeFee) {
AlipayFundFreezeRequest request = new AlipayFundFreezeRequest();

View File

@ -11,4 +11,5 @@ public class AlipayCreateRequest {
private String totalAmount; // 订单总金额
private String body; // 订单描述
private String openId; // 用户ID
private String authNo; //支付宝资金授权操作处理号
}

View File

@ -60,6 +60,12 @@ public interface PayFacade {
@PostMapping("/api/alipay/unifiedOrder")
AlipayCreateResponse alipayUnifiedOrder(@RequestBody AlipayCreateRequest request);
/**
* 支付宝统一下单接口
*/
@PostMapping("/api/alipay/zhiMaOrder")
AlipayCreateResponse zhiMaOrder(@RequestBody AlipayCreateRequest request);
/**
* 查询订单接口
*/

View File

@ -152,6 +152,26 @@ public class PayInteg {
}
}
/**
* 支付宝免押扣款接口
*/
public UnifiedPaymentInfoDTO zhiMaOrder(AlipayCreateRequest request){
try {
AlipayCreateResponse result = payFacade.zhiMaOrder(request);
if(StringUtils.isNotBlank(result.getCode()) && "SUCCESS".equals(result.getCode())){
UnifiedPaymentInfoDTO unifiedPaymentInfo = new UnifiedPaymentInfoDTO();
unifiedPaymentInfo.setOutTradeNo(result.getOutTradeNo());
unifiedPaymentInfo.setTradeNo(result.getTradeNo());
return unifiedPaymentInfo;
}else {
throw new InnerException("支付宝免押扣款失败");
}
} catch (Exception e){
log.error("支付宝免押扣款失败",e);
throw new InnerException("支付宝免押扣款失败");
}
}
/**
* 查询订单接口
*/