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
@@ -0,0 +1,31 @@
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.RestController;
import com.billpaymentservice.bbps.dto.ResponseModel;
import com.billpaymentservice.bbps.dto.request.PaymentStartUserRequest;
import com.billpaymentservice.bbps.service.PaymentStartService;
@RestController
public class PaymentStartController {
private final PaymentStartService paymentStartService;
public PaymentStartController(PaymentStartService paymentStartService) {
this.paymentStartService = paymentStartService;
}
@PostMapping(value = "/startWebPayment", 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);
}
}