| | |
| | | package com.tourguide.modules.order.service; |
| | | |
| | | import com.tourguide.common.huifu.RequestSeqUtil; |
| | | import com.tourguide.modules.order.domain.PaymentMethod; |
| | | import com.tourguide.modules.order.domain.RefundStatus; |
| | | import com.tourguide.modules.order.entity.TourOrder; |
| | | import com.tourguide.modules.order.mapper.TourOrderMapper; |
| | |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Service |
| | | public class OrderRefundService { |
| | |
| | | order.setRefundStatus(RefundStatus.REFUNDING.getCode()); |
| | | order.setRefundAmount(refundAmount); |
| | | order.setRefundMethod(order.getPaymentMethod()); |
| | | if (PaymentMethod.TEMPORARY_BYPASS.matches(order.getPaymentMethod())) { |
| | | order.setRefundStatus(RefundStatus.REFUNDED.getCode()); |
| | | order.setRefundTime(LocalDateTime.now()); |
| | | orderMapper.updateById(order); |
| | | return; |
| | | } |
| | | orderMapper.updateById(order); |
| | | try { |
| | | paymentRefundGateway.refund(order, refundAmount); |