added initatePayment and checkTxnStatus

This commit is contained in:
himanshu
2025-10-30 17:57:12 +05:30
parent 78dd74475a
commit 65cd50567d
43 changed files with 1319 additions and 124 deletions
@@ -0,0 +1,55 @@
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.BillPaymentRequest;
import com.billpaymentservice.bbps.dto.request.FetchBillRequest;
import com.billpaymentservice.bbps.dto.request.TransactionStatusRequest;
import com.billpaymentservice.bbps.service.PaymentService;
@RestController
@RequestMapping("/agent/payment")
public class PaymentController {
/**
* Fetches bill details from external BBPS service
*/
private final PaymentService paymentService;
public PaymentController(PaymentService paymentService) {
this.paymentService=paymentService;
}
@PostMapping(
value = "/intiatePayment",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
public ResponseEntity<ResponseModel> requestBillFetch(
@Validated @RequestBody BillPaymentRequest billPaymentRequest) {
ResponseModel response = paymentService.initiatePayment(billPaymentRequest);
return ResponseEntity.ok(response);
}
@PostMapping(
value = "/checkTransactionStatus",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
public ResponseEntity<ResponseModel> checkTransactionStatus(
@Validated @RequestBody TransactionStatusRequest transactionStatusRequest) {
ResponseModel response = paymentService.checkTrasactionStatus(transactionStatusRequest);
return ResponseEntity.ok(response);
}
}