取消验券整理
This commit is contained in:
@ -24,4 +24,14 @@ public interface GroupBuyCouponService {
|
||||
* @return
|
||||
*/
|
||||
RentCarThirdPlatformOrderReq getThirdPlatformOrder(SimpleUserInfoDTO userInfoDTO, VerifyGroupBuyCouponsReq req);
|
||||
|
||||
/**
|
||||
* 取消验券
|
||||
* @param paymentType
|
||||
* @param storeId
|
||||
* @param paymentId
|
||||
* @param transactionId
|
||||
* @return
|
||||
*/
|
||||
boolean cancelVerifyCoupon(String paymentType,Integer storeId, String paymentId, String transactionId);
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.meituan.sdk.MeituanResponse;
|
||||
import com.meituan.sdk.model.ddzh.tuangou.tuangouReceiptConsume.TuangouReceiptConsumeResponse;
|
||||
import com.meituan.sdk.model.ddzh.tuangou.tuangouReceiptPrepare.TuangouReceiptPrepareResponse;
|
||||
import com.sczx.order.common.enums.CouponTypeEnum;
|
||||
import com.sczx.order.common.enums.PaymentTypeEnum;
|
||||
import com.sczx.order.dto.RentCarThirdPlatformOrderReq;
|
||||
import com.sczx.order.dto.SimpleUserInfoDTO;
|
||||
import com.sczx.order.dto.VerifyGroupBuyCouponsReq;
|
||||
@ -173,6 +174,24 @@ public class GroupBuyCouponServiceImpl implements GroupBuyCouponService {
|
||||
return thirdRentCarOrder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancelVerifyCoupon(String paymentType, Integer storeId, String paymentId, String transactionId) {
|
||||
try {
|
||||
if(paymentType.equals(PaymentTypeEnum.MT.getCode())){
|
||||
meiTuanService.reverseconsume(storeId, paymentId, transactionId);
|
||||
} else if (paymentType.equals(PaymentTypeEnum.DY.getCode())){
|
||||
douyinService.cancel(transactionId, paymentId);
|
||||
} else {
|
||||
log.info("非团购支付,无需退券");
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("取消验券失败", e);
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private boolean comparePhoneNumbers(String maskedPhone, String actualPhone) {
|
||||
// 检查输入参数
|
||||
if (maskedPhone == null || actualPhone == null) {
|
||||
|
||||
@ -1267,27 +1267,25 @@ public class OrderServiceImpl implements OrderService {
|
||||
updateWrapper.eq(OrderMainPO::getOrderNo, rejectOrderReq.getOrderNo());
|
||||
orderMainRepo.update(updateWrapper);
|
||||
if (Objects.nonNull(orderSubPO)) {
|
||||
if(orderSubPO.getPaymentMethod().equals(PaymentTypeEnum.MT.getCode())){
|
||||
meiTuanService.reverseconsume(orderMainPO.getStoreId().intValue(), orderSubPO.getPaymentId(), orderSubPO.getTransactionId());
|
||||
}else if (orderSubPO.getPaymentMethod().equals(PaymentTypeEnum.DY.getCode())){
|
||||
douyinService.cancel(orderSubPO.getTransactionId(), orderSubPO.getPaymentId());
|
||||
} else {
|
||||
//退款调用成功则添加退款子订单
|
||||
String outRefundNo = payService.refundOrder(orderSubPO.getPaymentMethod(), orderMainPO.getOperatorId(), orderSubPO.getPaymentId(), orderMainPO.getOrderAmount(), orderMainPO.getOrderAmount());
|
||||
if (StringUtils.isNotBlank(outRefundNo)) {
|
||||
OrderSubPO fdSubOrder = new OrderSubPO();
|
||||
fdSubOrder.setOrderId(orderMainPO.getOrderId());
|
||||
fdSubOrder.setSuborderNo(OrderUtil.generateSubOrderNo(OrderUtil.FD_PREFIX));
|
||||
fdSubOrder.setSuborderType(SubOrderTypeEnum.FD_REJECT.getCode());
|
||||
fdSubOrder.setAmount(orderMainPO.getOrderAmount());
|
||||
fdSubOrder.setPaymentMethod(orderSubPO.getPaymentMethod());
|
||||
fdSubOrder.setPayStatus(PayStatusEnum.REFUNDING.getCode());
|
||||
fdSubOrder.setPaymentId(orderSubPO.getPaymentId());
|
||||
fdSubOrder.setRefundId(outRefundNo);
|
||||
fdSubOrder.setRemark(rejectOrderReq.getRejectReason());
|
||||
fdSubOrder.setCreatedAt(LocalDateTime.now());
|
||||
orderSubRepo.save(fdSubOrder);
|
||||
}
|
||||
|
||||
//验券取消
|
||||
groupBuyCouponService.cancelVerifyCoupon(orderSubPO.getPaymentMethod(),orderMainPO.getStoreId().intValue(), orderSubPO.getPaymentId(), orderSubPO.getTransactionId());
|
||||
|
||||
//退款调用成功则添加退款子订单
|
||||
String outRefundNo = payService.refundOrder(orderSubPO.getPaymentMethod(), orderMainPO.getOperatorId(), orderSubPO.getPaymentId(), orderMainPO.getOrderAmount(), orderMainPO.getOrderAmount());
|
||||
if (StringUtils.isNotBlank(outRefundNo)) {
|
||||
OrderSubPO fdSubOrder = new OrderSubPO();
|
||||
fdSubOrder.setOrderId(orderMainPO.getOrderId());
|
||||
fdSubOrder.setSuborderNo(OrderUtil.generateSubOrderNo(OrderUtil.FD_PREFIX));
|
||||
fdSubOrder.setSuborderType(SubOrderTypeEnum.FD_REJECT.getCode());
|
||||
fdSubOrder.setAmount(orderMainPO.getOrderAmount());
|
||||
fdSubOrder.setPaymentMethod(orderSubPO.getPaymentMethod());
|
||||
fdSubOrder.setPayStatus(PayStatusEnum.REFUNDING.getCode());
|
||||
fdSubOrder.setPaymentId(orderSubPO.getPaymentId());
|
||||
fdSubOrder.setRefundId(outRefundNo);
|
||||
fdSubOrder.setRemark(rejectOrderReq.getRejectReason());
|
||||
fdSubOrder.setCreatedAt(LocalDateTime.now());
|
||||
orderSubRepo.save(fdSubOrder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user