package com.billpaymentservice.bbps.controller; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.billpaymentservice.bbps.dto.MasterApiResponse; import com.billpaymentservice.bbps.dto.ResponseModel; import com.billpaymentservice.bbps.dto.request.BillerDetailRequest; import com.billpaymentservice.bbps.dto.request.ContactMasterRequest; import com.billpaymentservice.bbps.dto.request.CustomParamRequest; import com.billpaymentservice.bbps.dto.request.MasterRequest; import com.billpaymentservice.bbps.dto.request.MerchantRequestModel; import com.billpaymentservice.bbps.dto.response.BillerDataResponse; import com.billpaymentservice.bbps.dto.response.BillerResponse; import com.billpaymentservice.bbps.dto.response.ContactMasterResponse; import com.billpaymentservice.bbps.dto.response.CustomParamResp; import com.billpaymentservice.bbps.service.MasterDataService; import jakarta.servlet.http.HttpServletRequest; @RequestMapping("/masterData") @RestController public class MasterDataController { private static final Logger log = LoggerFactory.getLogger(MasterDataController.class); private final MasterDataService masterDataService; public MasterDataController(MasterDataService masterDataService) { this.masterDataService = masterDataService; } /**Get Details of the biller by billId **/ @PostMapping(value = "/getBillerDetails", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity getBillerDetails(@Validated @RequestBody BillerDetailRequest billerDetailRequest) { log.info("Received biller details request for billerId: {}", billerDetailRequest.getBillerId()); return ResponseEntity.ok(masterDataService.getBillerByBillerId(billerDetailRequest)); } /**Get Master Contact**/ @PostMapping(value = "/getContactMasterResponse", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity getContactMaster( @Validated @RequestBody ContactMasterRequest contactMasterRequest ) { return ResponseEntity.ok(masterDataService.getContactMaster(contactMasterRequest)); } /** Get CustomerParam by billerId.The parameter is different from the data we are getting in the billerDetail **/ @PostMapping(value = "/getCustomerParamDetails", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity getBillerDetails( @Validated @RequestBody CustomParamRequest customerParamRequest) { log.info("Received biller details request for billerId: {}",customerParamRequest.getBillerId() ); return ResponseEntity.ok(masterDataService.getCustomerParamByBillerId(customerParamRequest)); } @PostMapping("/getAllMastersData") public ResponseModel fetchMasterData(@Validated @RequestBody MasterRequest masterRequest) { return masterDataService.getMasterData(masterRequest); } }