shinnosuke
2026-09-25 66c0d9abbcb9f7b4407784ba4c886ce94a8b55dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.talentcard.server.business.portal;
 
import java.util.Map;
import com.talentcard.server.common.ApiResponse;
import jakarta.validation.Valid;
import org.springframework.http.CacheControl;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
 
@RestController
@RequestMapping("/api/app/pending-use-orders")
public class PendingUsePortalController {
    private final PendingUsePortalService service;
    public PendingUsePortalController(PendingUsePortalService service) { this.service = service; }
    @GetMapping("/{orderNo}") public ApiResponse<Map<String,Object>> detail(@PathVariable String orderNo, @RequestParam Long talentId) { return ApiResponse.success(service.detail(orderNo, talentId)); }
    @PostMapping("/{orderNo}/verification-code") public ApiResponse<Map<String,Object>> code(@PathVariable String orderNo, @Valid @RequestBody PendingUseCodeRequest request) { return ApiResponse.success(service.issueCode(orderNo, request.talentId())); }
    @GetMapping(value = "/verification-codes/{token}/image", produces = MediaType.IMAGE_PNG_VALUE)
    public ResponseEntity<byte[]> image(@PathVariable String token) { return ResponseEntity.ok().cacheControl(CacheControl.noStore()).body(service.codeImage(token)); }
    @PostMapping("/{orderNo}/refund") public ApiResponse<Map<String,Object>> refund(@PathVariable String orderNo, @Valid @RequestBody PendingUseRefundRequest request) { return ApiResponse.success(service.refund(orderNo, request)); }
}