added intentbased pg

This commit is contained in:
Lincpay Tech
2025-12-01 16:57:48 +05:30
parent dd30885b34
commit 29d54147d3
18 changed files with 781 additions and 7 deletions
@@ -12,9 +12,10 @@ import com.billpaymentservice.bbps.dto.ResponseModel;
import com.billpaymentservice.bbps.dto.request.BillPaymentRequest;
import com.billpaymentservice.bbps.dto.request.TransactionStatusRequest;
import com.billpaymentservice.bbps.dto.request.TrasactionStatusByClientReqIdRequest;
import com.billpaymentservice.bbps.dto.response.FetchBillValidateResponse;
import com.billpaymentservice.bbps.dto.response.TransactionStatusResponse;
import com.billpaymentservice.bbps.service.PaymentService;
import com.billpaymentservice.bbps.service.PaymentStartService;
import com.billpaymentservice.bbps.dto.request.PaymentStartUserRequest;
@RestController
@RequestMapping("/agent/payment")
@@ -25,9 +26,12 @@ public class PaymentController {
*/
private final PaymentService paymentService;
private final PaymentStartService paymentStartService;
public PaymentController(PaymentService paymentService) {
// New constructor used by Spring to inject both services
public PaymentController(PaymentService paymentService, PaymentStartService paymentStartService) {
this.paymentService = paymentService;
this.paymentStartService = paymentStartService;
}
@PostMapping(value = "/intiatePayment", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@@ -62,5 +66,15 @@ public class PaymentController {
return ResponseEntity.ok(genralResp);
}
}
@PostMapping(value = "/startPayment", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseModel> startPayment(@Validated @RequestBody PaymentStartUserRequest paymentStartUserRequest) {
if (this.paymentStartService == null) {
// Defensive: if bean not injected, return failure
return ResponseEntity.badRequest().body(new ResponseModel("PaymentStartService not available", "FAILED", 400, null));
}
ResponseModel response = paymentStartService.startPayment(paymentStartUserRequest);
return ResponseEntity.ok(response);
}
}