43 lines
1.9 KiB
Java
43 lines
1.9 KiB
Java
package com.billpaymentservice.bbps.controller;
|
|
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import com.billpaymentservice.bbps.dto.ResponseModel;
|
|
import com.billpaymentservice.bbps.dto.request.PollBackRequest;
|
|
import com.billpaymentservice.bbps.service.PollBackService;
|
|
import com.billpaymentservice.bbps.util.ApiDocCommonResponses;
|
|
import com.billpaymentservice.bbps.util.BBPSConstant;
|
|
|
|
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.responses.ApiResponses;
|
|
|
|
@RequestMapping("/payment")
|
|
@RestController
|
|
public class PaymentPollBackController {
|
|
|
|
private final PollBackService pollBackService;
|
|
|
|
public PaymentPollBackController(PollBackService pollBackService) {
|
|
this.pollBackService = pollBackService;
|
|
}
|
|
|
|
@PostMapping(value = "/pollback")
|
|
@Operation(summary = "Process poll-back request", description = "This API handles the poll-back request from biller.")
|
|
@ApiResponses(value = {
|
|
@ApiResponse(responseCode = BBPSConstant.OK_STR, description = "Poll Back processed successfully", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseModel.class))) })
|
|
@ApiDocCommonResponses
|
|
public ResponseEntity<ResponseModel> startIntentPayment(@Validated @RequestBody PollBackRequest pollBackRequest) {
|
|
ResponseModel response = pollBackService.managePollBack(pollBackRequest);
|
|
return ResponseEntity.ok(response);
|
|
}
|
|
}
|