update swagger configure

This commit is contained in:
Mohd-Arham
2025-12-09 18:30:22 +05:30
parent 74e4f86d67
commit 13bfd34bbd
11 changed files with 322 additions and 119 deletions
@@ -12,9 +12,17 @@ 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.PaymentStartUserRequest;
import com.billpaymentservice.bbps.dto.request.CallbackRequest;
import com.billpaymentservice.bbps.dto.request.PaymentStartUserRequest;
import com.billpaymentservice.bbps.service.PaymentStartService;
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;
@RestController
@RequestMapping("/payment")
@@ -24,15 +32,24 @@ public class PaymentStartController {
public PaymentStartController(PaymentStartService paymentStartService) {
this.paymentStartService = paymentStartService;
}
@PostMapping(value = "/startWebPayment", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseModel> startWebPayment(@Validated @RequestBody PaymentStartUserRequest paymentStartUserRequest) {
ResponseModel response = paymentStartService.startWebPayment(paymentStartUserRequest);
return ResponseEntity.ok(response);
}
@PostMapping(value = "/callback/startPayment", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/startWebPayment")
@Operation(summary = "Start web payment process", description = "This API initiates the payment process for a web-based transaction using user and bill details.")
@ApiResponses(value = {
@ApiResponse(responseCode = BBPSConstant.OK_STR, description = "Payment process started successfully", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseModel.class))) })
@ApiDocCommonResponses
public ResponseEntity<ResponseModel> startWebPayment(
@Validated @RequestBody PaymentStartUserRequest paymentStartUserRequest) {
ResponseModel response = paymentStartService.startWebPayment(paymentStartUserRequest);
return ResponseEntity.ok(response);
}
@PostMapping(value = "/callback/startPayment")
@Operation(summary = "Handle start payment callback", description = "This callback API is invoked by the payment gateway/BBPS to confirm the payment initiation status.")
@ApiResponses(value = {
@ApiResponse(responseCode = BBPSConstant.OK_STR, description = "Start Payment Callback handled successfully", content = @Content(mediaType = "application/json")) })
@ApiDocCommonResponses
public ResponseEntity<Map<String, String>> handleCallback(@RequestBody CallbackRequest callbackRequest) {
ResponseModel resp = paymentStartService.handleStartCallback(callbackRequest);
Map<String, String> result = new HashMap<>();
@@ -40,12 +57,17 @@ public class PaymentStartController {
result.put("status", resp.getStatus());
return ResponseEntity.ok(result);
}
@PostMapping(value = "/startIntentPayment", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseModel> startIntentPayment(@Validated @RequestBody PaymentStartUserRequest paymentStartUserRequest) {
ResponseEntity.badRequest().body(new ResponseModel("PaymentStartService not available", "FAILED", 400, null));
ResponseModel response = paymentStartService.startIntentPayment(paymentStartUserRequest);
return ResponseEntity.ok(response);
}
@PostMapping(value = "/startIntentPayment")
@Operation(summary = "Start intent payment process", description = "This API initiates the intent-based payment process for a user.")
@ApiResponses(value = {
@ApiResponse(responseCode = BBPSConstant.OK_STR, description = "Intent payment started successfully", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseModel.class))), })
@ApiDocCommonResponses
public ResponseEntity<ResponseModel> startIntentPayment(
@Validated @RequestBody PaymentStartUserRequest paymentStartUserRequest) {
ResponseEntity.badRequest().body(new ResponseModel("PaymentStartService not available", "FAILED", 400, null));
ResponseModel response = paymentStartService.startIntentPayment(paymentStartUserRequest);
return ResponseEntity.ok(response);
}
}