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 requestBillFetch( @Validated @RequestBody FetchBillRequest fetchBillRequest) { ResponseModel response = agentService.initiateBillFetch(fetchBillRequest); return ResponseEntity.ok(response); } }