@@ -0,0 +1,3210 @@
+package nl.kreditor.controller.api;%0A%0Aimport io.swagger.v3.oas.annotations.Parameter;%0Aimport io.swagger.v3.oas.annotations.media.Schema;%0Aimport nl.kreditor.form.PaymentForm;%0Aimport nl.kreditor.model.Book;%0Aimport nl.kreditor.model.Operation;%0Aimport nl.kreditor.model.Payment;%0Aimport nl.kreditor.repository.AllotmentRepository;%0Aimport nl.kreditor.repository.CategoryRepository;%0Aimport nl.kreditor.repository.ContactRepository;%0Aimport nl.kreditor.repository.PaymentRepository;%0Aimport nl.kreditor.response.PaymentResponse;%0Aimport nl.kreditor.service.BookService;%0Aimport nl.kreditor.service.OperationService;%0Aimport nl.kreditor.service.UserService;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.http.HttpStatus;%0Aimport org.springframework.http.ResponseEntity;%0Aimport org.springframework.web.bind.annotation.*;%0A%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0A%0A@RestController%0A@CrossOrigin(%22*%22)%0A@RequestMapping(%22/api/v1/books/%7BbookId%7D/operations/%7BoperationId%7D/payments%22)%0Apublic class PaymentController %7B%0A    @Autowired%0A    private BookService bookService;%0A%0A    @Autowired%0A    private UserService userService;%0A%0A    @Autowired%0A    private OperationService operationService;%0A%0A    @Autowired%0A    private ContactRepository contactRepository;%0A%0A    @Autowired%0A    private CategoryRepository categoryRepository;%0A%0A    @Autowired%0A    private PaymentRepository paymentRepository;%0A%0A    @Autowired%0A    private AllotmentRepository allotmentRepository;%0A%0A    @GetMapping(%22/%22)%0A    @io.swagger.v3.oas.annotations.Operation(tags = %7B%22app%22%7D)%0A    List%3CPaymentResponse%3E getPayments(%0A            @PathVariable(%22bookId%22) @Parameter(schema = @Schema(type = %22integer%22)) Book book,%0A            @PathVariable(%22operationId%22) @Parameter(schema = @Schema(type = %22integer%22)) Operation operation%0A    ) %7B%0A        return operation.getPayments()%0A                .stream()%0A                .map(PaymentResponse::new)%0A                .collect(Collectors.toList());%0A    %7D%0A%0A    @PostMapping(%22/%22)%0A    @io.swagger.v3.oas.annotations.Operation(tags = %7B%22app%22%7D)%0A    PaymentResponse postPayment(%0A            @PathVariable(%22bookId%22) @Parameter(schema = @Schema(type = %22integer%22)) Book book,%0A            @PathVariable(%22operationId%22) @Parameter(schema = @Schema(type = %22integer%22)) Operation operation,%0A            @RequestBody @Parameter(name = %22payment%22) PaymentForm paymentForm%0A    ) %7B%0A        Payment payment = new Payment(%0A                paymentForm.getAmount(),%0A                contactRepository.findById(paymentForm.getContactId()),%0A                operation%0A        );%0A%0A        return new PaymentResponse(paymentRepository.save(payment));%0A    %7D%0A%0A%0A    @DeleteMapping(%22/%7BpaymentId%7D%22)%0A    @io.swagger.v3.oas.annotations.Operation(tags = %22app%22)%0A    ResponseEntity%3CVoid%3E deletePayment(%0A            @PathVariable(%22bookId%22) @Parameter(schema = @Schema(type = %22integer%22)) Book book,%0A            @PathVariable(%22operationId%22) @Parameter(schema = @Schema(type = %22integer%22)) Operation operation,%0A            @PathVariable(%22paymentId%22) @Parameter(schema = @Schema(type = %22integer%22)) Payment payment%0A    ) %7B%0A        paymentRepository.delete(payment);%0A        return new ResponseEntity%3C%3E(HttpStatus.NO_CONTENT);%0A    %7D%0A%7D%0A

Add controller for payments