-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathPaymentController.java
More file actions
53 lines (45 loc) · 1.84 KB
/
PaymentController.java
File metadata and controls
53 lines (45 loc) · 1.84 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
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.bravo.user.controller;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.bravo.user.model.dto.PaymentDto;
import com.bravo.user.service.PaymentService;
import com.bravo.user.validator.UserValidator;
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 jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@Tag(name="Payment", description="Payment Actions")
@RequestMapping(value = "/payment")
public class PaymentController {
private final PaymentService paymentService;
private final UserValidator userValidator;
public PaymentController(PaymentService paymentService, UserValidator userValidator) {
this.paymentService = paymentService;
this.userValidator = userValidator;
}
@Operation(summary = "Retrieve User 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,
final HttpServletResponse httpResponse
)
{
log.info("Userid:{}", userId);
userValidator.validateId(userId);
return paymentService.retrieveByUserId(userId);
}
}