Files
bbps-backend/src/main/java/com/billpaymentservice/bbps/controller/AgentController.java
T
2025-10-29 10:11:35 +05:30

37 lines
1.1 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.*;
import com.billpaymentservice.bbps.dto.ResponseModel;
import com.billpaymentservice.bbps.dto.request.FetchBillRequest;
import com.billpaymentservice.bbps.service.AgentService;
@RestController
@RequestMapping("/agent")
public class AgentController {
private final AgentService agentService;
public AgentController(AgentService agentService) {
this.agentService = agentService;
}
/**
* Fetches bill details from external BBPS service
*/
@PostMapping(
value = "/requestBillFetch",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
public ResponseEntity<ResponseModel> requestBillFetch(
@Validated @RequestBody FetchBillRequest fetchBillRequest) {
ResponseModel response = agentService.initiateBillFetch(fetchBillRequest);
return ResponseEntity.ok(response);
}
}