| | |
| | | |
| | | import com.tourguide.common.api.ApiResponse; |
| | | import com.tourguide.common.api.PageResponse; |
| | | import com.tourguide.modules.order.dto.AdminOrderRefundRequest; |
| | | import com.tourguide.modules.order.dto.TourOrderResponse; |
| | | import com.tourguide.modules.order.service.TourOrderService; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.validation.Valid; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 对指定可退款订单执行全额退款登记,并生成退款单号和退款时间。 |
| | | * 对指定可退款订单执行指定金额退款登记,并生成退款单号和退款时间。 |
| | | * 已取消、已退款或当前状态不可退款的订单会被业务层拒绝。 |
| | | * |
| | | * @param id 订单主键 |
| | | * @return 退款后的订单详情 |
| | | */ |
| | | @PutMapping("/{id}/refund") |
| | | public ApiResponse<TourOrderResponse> refund(@PathVariable Long id) { |
| | | return ApiResponse.success(orderService.refund(id)); |
| | | public ApiResponse<TourOrderResponse> refund(@PathVariable Long id, |
| | | @Valid @RequestBody AdminOrderRefundRequest request) { |
| | | return ApiResponse.success(orderService.refund(id, request.getRefundAmount())); |
| | | } |
| | | } |