implemented customerParam Api

This commit is contained in:
himanshu
2025-10-27 18:02:52 +05:30
parent 01394580f3
commit 4d501f7b4a
11 changed files with 238 additions and 48 deletions
@@ -17,9 +17,13 @@ import org.springframework.web.bind.annotation.RestController;
import com.billpaymentservice.bbps.dto.MasterApiResponse;
import com.billpaymentservice.bbps.dto.request.BillerDetailRequest;
import com.billpaymentservice.bbps.dto.request.ContactMasterRequest;
import com.billpaymentservice.bbps.dto.request.CustomerParamRequest;
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;
@@ -35,45 +39,33 @@ public class MasterDataController {
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<BillerDataResponse> getBillerDetails(
@Validated @RequestBody BillerDetailRequest billerDetailRequest) {
log.info("Received biller details request for billerId: {}", billerDetailRequest.getBillerId());
BillerDataResponse response = masterDataService.getBillerByBillerId(billerDetailRequest);
HttpStatus status;
String statusCode = response.getGeneralResp() != null ? response.getGeneralResp().getStatusCode() : "500";
switch (statusCode) {
case "200":
status = HttpStatus.OK;
break;
case "404":
status = HttpStatus.NOT_FOUND;
break;
case "500":
status = HttpStatus.INTERNAL_SERVER_ERROR;
break;
default:
status = HttpStatus.BAD_REQUEST;
break;
}
log.info("Returning response for billerId: {} with HTTP status: {}", billerDetailRequest.getBillerId(), status);
return new ResponseEntity<>(response, status);
return ResponseEntity.ok(masterDataService.getBillerByBillerId(billerDetailRequest));
}
/**Get Master Contact**/
@PostMapping(value = "/getContactMasterResponse", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ContactMasterResponse> getContactMaster(
@Validated @RequestBody ContactMasterRequest contactMasterRequest ) {
@PostMapping("/getBillerById")
public String getBillerById(@RequestBody BillerDetailRequest billerRequestRequest) {
masterDataService.getBillerByBillerId(billerRequestRequest);
return "Abc";
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<CustomParamResp> getBillerDetails(
@Validated @RequestBody CustomerParamRequest customerParamRequest) {
log.info("Received biller details request for billerId: {}",customerParamRequest.getBillerId() );
return ResponseEntity.ok(masterDataService.getCustomerParamByBillerId(customerParamRequest));
}
/** Get All Masters API Fetch All Category from BBPS URL **/
@GetMapping("/getAllMasters")
public ResponseEntity<List<MasterApiResponse>> fetchMasterData(