增加免押支付扣款逻辑
This commit is contained in:
@ -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
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -11,4 +11,5 @@ public class AlipayCreateRequest {
|
||||
private String totalAmount; // 订单总金额
|
||||
private String body; // 订单描述
|
||||
private String openId; // 用户ID
|
||||
private String authNo; //支付宝资金授权操作处理号
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
/**
|
||||
* 查询订单接口
|
||||
*/
|
||||
|
||||
@ -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("支付宝免押扣款失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单接口
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user