-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathPaymentController.java
More file actions
40 lines (35 loc) · 1.48 KB
/
PaymentController.java
File metadata and controls
40 lines (35 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.bravo.user.controller;
import com.bravo.user.model.dto.PaymentDto;
import com.bravo.user.service.PaymentService;
import com.bravo.user.validator.PaymentValidator;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Tag(name = "Payment", description = "Payment Actions")
@RequestMapping(value = "/payment")
public class PaymentController {
private final PaymentService paymentService;
private final PaymentValidator paymentValidator;
public PaymentController(PaymentService paymentService, PaymentValidator paymentValidator) {
this.paymentService = paymentService;
this.paymentValidator = paymentValidator;
}
@Operation(summary = "Retrieve Payment Information")
@ApiResponse(responseCode = "200", content = {
@Content(schema = @Schema(implementation = List.class), mediaType = "application/json")
})
@ApiResponse(responseCode = "400", content = {@Content(schema = @Schema())})
@GetMapping(value = "/retrieve/{userId}")
@ResponseBody
public List<PaymentDto> retrieve(
final @PathVariable String userId
) {
paymentValidator.validateUserId(userId);
return paymentService.retrieveByUserID(userId);
}
}