resolve conflict
This commit is contained in:
@@ -4,6 +4,8 @@ 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;
|
||||
@@ -16,6 +18,7 @@ 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.MerchantRequestModel;
|
||||
import com.billpaymentservice.bbps.dto.response.BillerDataResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.BillerResponse;
|
||||
import com.billpaymentservice.bbps.service.MasterDataService;
|
||||
|
||||
@@ -25,7 +28,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
@RestController
|
||||
public class MasterDataController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MasterDataController.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(MasterDataController.class);
|
||||
|
||||
private final MasterDataService masterDataService;
|
||||
|
||||
@@ -33,6 +36,38 @@ public class MasterDataController {
|
||||
this.masterDataService = masterDataService;
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/getBillerById")
|
||||
public String getBillerById(@RequestBody BillerDetailRequest billerRequestRequest) {
|
||||
masterDataService.getBillerByBillerId(billerRequestRequest);
|
||||
@@ -43,7 +78,7 @@ public class MasterDataController {
|
||||
@GetMapping("/getAllMasters")
|
||||
public ResponseEntity<List<MasterApiResponse>> fetchMasterData(
|
||||
@Validated @RequestBody MerchantRequestModel requestModel, HttpServletRequest request) {
|
||||
LOGGER.info("Fetching Master Data Registered URL");
|
||||
log.info("Fetching Master Data Registered URL");
|
||||
return masterDataService.getMasterData(requestModel, request);
|
||||
}
|
||||
|
||||
@@ -53,7 +88,7 @@ public class MasterDataController {
|
||||
@Validated @RequestBody MerchantRequestModel requestModel, HttpServletRequest request,
|
||||
@RequestParam String category, @RequestParam(defaultValue = "0") int pageStart, @RequestParam int pageEnd) {
|
||||
|
||||
LOGGER.info("Request received: category=" + category + ", pageNumber=" + pageStart + ", pageSize=" + pageEnd);
|
||||
return masterDataService.fetchMasterDataCategoryWise(requestModel,category, pageStart, pageEnd);
|
||||
log.info("Request received: category=" + category + ", pageNumber=" + pageStart + ", pageSize=" + pageEnd);
|
||||
return masterDataService.fetchMasterDataCategoryWise(requestModel, category, pageStart, pageEnd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdditionalInfo {
|
||||
private String paramConfigId;
|
||||
private String paramName;
|
||||
private String dataTypeDAO;
|
||||
private String dataTypeModel;
|
||||
private boolean optional;
|
||||
private boolean visibility;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AmountOption {
|
||||
private String amountOptionId;
|
||||
private List<String> amountBreakupSets;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class BillerDAO {
|
||||
private String billerId;
|
||||
private String billerName;
|
||||
private String billerAliasName;
|
||||
private String billerCategoryName;
|
||||
private String billerMode;
|
||||
private boolean billerAcceptsAdhoc;
|
||||
private boolean parentBiller;
|
||||
private String parentBillerId;
|
||||
private String billerOwnerShp;
|
||||
private String billerCoverage;
|
||||
private String fetchRequirement;
|
||||
private String paymentAmountExactness;
|
||||
private String supportBillValidation;
|
||||
private String billerEffctvFrom;
|
||||
private String billerEffctvTo;
|
||||
private String billerTempDeactivationStart;
|
||||
private String billerTempDeactivationEnd;
|
||||
|
||||
private List<PaymentMode> billerPaymentModes;
|
||||
private List<PaymentChannel> billerPaymentChannels;
|
||||
private List<CustomerParam> billerCustomerParams;
|
||||
private CustomerParamGroups customerParamGroups;
|
||||
private BillerResponseParams billerResponseParams;
|
||||
private List<AdditionalInfo> billerAdditionalInfos;
|
||||
private List<AdditionalInfo> billerAdditionalInfoPayments;
|
||||
private List<InterchangeFeeConf> interchangeFeeConves;
|
||||
private List<InterchangeFee> interchangeFees;
|
||||
|
||||
private String status;
|
||||
private String billerDescription;
|
||||
private String supportDeemed;
|
||||
private String supportPendingStatus;
|
||||
private String billerTimeOut;
|
||||
private String routeUrl;
|
||||
private String billerResponseType;
|
||||
private BillerPlanResponseParams billerPlanResponseParams;
|
||||
private String planMDMRequirement;
|
||||
private List<Object> planAdditionalInfos;
|
||||
private String upmsEnabled;
|
||||
private String clickpayEnabled;
|
||||
private String deemedSuccessEnabled;
|
||||
private String selectionType;
|
||||
|
||||
// getters and setters
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class BillerPlanResponseParams {
|
||||
private String billerPlanResponseId;
|
||||
private List<Object> params;
|
||||
private List<Object> amountOptions;
|
||||
|
||||
// getters and setters
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class BillerResponseParams {
|
||||
private String billerResponseId;
|
||||
private List<Object> params;
|
||||
private List<AmountOption> amountOptions;
|
||||
|
||||
// getters and setters
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CustomerParam {
|
||||
private String paramConfigId;
|
||||
private String paramName;
|
||||
private String dataTypeDAO;
|
||||
private String dataTypeModel;
|
||||
private boolean optional;
|
||||
private int minLength;
|
||||
private int maxLength;
|
||||
private String regex;
|
||||
private boolean visibility;
|
||||
|
||||
// getters and setters
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CustomerParamGroups {
|
||||
private List<Group> groups;
|
||||
|
||||
// getters and setters
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class GeneralResp {
|
||||
private String statusCode;
|
||||
private String status;
|
||||
private String message;
|
||||
private String remarks;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class Group {
|
||||
private String groupId;
|
||||
private List<String> params; // e.g., ["Admission No/Application No/GR No"]
|
||||
private List<Group> groups; // nested groups
|
||||
private String name; // group name
|
||||
private String input; // input count as string
|
||||
// getters and setters
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class InterchangeFee {
|
||||
private String interchangeFeeId;
|
||||
private String feeCode;
|
||||
private String feeDesc;
|
||||
private String feeDirection;
|
||||
private List<InterchangeFeeDetail> interchangeFeeDetails;
|
||||
|
||||
// getters and setters
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class InterchangeFeeConf {
|
||||
private String interChangeFeeConfId;
|
||||
private String mti;
|
||||
private String paymentMode;
|
||||
private String paymentChannel;
|
||||
private String responseCode;
|
||||
private List<String> fees;
|
||||
private boolean defaultFee;
|
||||
private String effctvFrom;
|
||||
private String effctvTo;
|
||||
|
||||
// getters and setters
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class InterchangeFeeDetail {
|
||||
private String interchangeFeeDetId;
|
||||
private long tranAmtRangeMax;
|
||||
private long tranAmtRangeMin;
|
||||
private double percentFee;
|
||||
private double flatFee;
|
||||
private String effctvFrom;
|
||||
|
||||
// getters and setters
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class PaymentChannel {
|
||||
private String paymentChannelLimitId;
|
||||
private String paymentChannel;
|
||||
private long maxLimit;
|
||||
private long minLimit;
|
||||
private String supportPendingStatus;
|
||||
|
||||
// getters and setters
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.billpaymentservice.bbps.dto;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class PaymentMode {
|
||||
private String paymentModelLimitId;
|
||||
private String paymentMode;
|
||||
private long maxLimit;
|
||||
private long minLimit;
|
||||
private String supportPendingStatus;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,15 @@ package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
import com.billpaymentservice.bbps.entites.BaseClass;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class BillerDetailRequest extends BaseClass{
|
||||
|
||||
@NotNull
|
||||
private String billerId;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
package com.billpaymentservice.bbps.dto.response;
|
||||
|
||||
public class BillerDataResponse {
|
||||
import com.billpaymentservice.bbps.dto.BillerDAO;
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class BillerDataResponse {
|
||||
private BillerDAO billerDAO;
|
||||
|
||||
private GeneralResp generalResp;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ import lombok.Setter;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BaseClass {
|
||||
|
||||
|
||||
|
||||
private String mid;
|
||||
private String secretKey;
|
||||
private String txnId;
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
package com.billpaymentservice.bbps.exception;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CustomException extends RuntimeException {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
String message;
|
||||
public CustomException( String message) {
|
||||
super();
|
||||
|
||||
this.message = message;
|
||||
}
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final GeneralResp generalResp;
|
||||
|
||||
public CustomException(String statusCode, String status,String message,String remark) {
|
||||
super(message);
|
||||
this.generalResp = new GeneralResp();
|
||||
this.generalResp.setStatusCode(statusCode);
|
||||
this.generalResp.setStatus(status);
|
||||
this.generalResp.setMessage(message);
|
||||
this.generalResp.setRemarks(remark);
|
||||
}
|
||||
public CustomException(String message) {
|
||||
super(message);
|
||||
this.generalResp = new GeneralResp();
|
||||
this.generalResp.setStatusCode("500");
|
||||
this.generalResp.setStatus("Failure");
|
||||
this.generalResp.setMessage(message);
|
||||
this.generalResp.setRemarks("");
|
||||
}
|
||||
public GeneralResp getGeneralResp() {
|
||||
return generalResp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
package com.billpaymentservice.bbps.exception;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import com.billpaymentservice.bbps.dto.GeneralResp;
|
||||
|
||||
@RestControllerAdvice
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
|
||||
|
||||
@ExceptionHandler(CustomException.class)
|
||||
public ResponseEntity<GeneralResp> handleCustomException(CustomException ex) {
|
||||
return new ResponseEntity<>(ex.getGeneralResp(), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.billpaymentservice.bbps.serviceImpl;
|
||||
|
||||
|
||||
import java.net.http.HttpClient;
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.JdkClientHttpRequestFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.time.Duration;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.HttpServerErrorException;
|
||||
import org.springframework.web.client.RestClient;
|
||||
|
||||
@Service
|
||||
public class HttpService {
|
||||
private static final Logger log = LoggerFactory.getLogger(HttpService.class);
|
||||
private final RestClient restClient;
|
||||
|
||||
HttpService() {
|
||||
HttpClient httpClient = HttpClient.newBuilder()
|
||||
.connectTimeout(Duration.ofSeconds(5))
|
||||
.build();
|
||||
|
||||
JdkClientHttpRequestFactory factory = new JdkClientHttpRequestFactory(httpClient);
|
||||
factory.setReadTimeout(Duration.ofSeconds(10));
|
||||
|
||||
this.restClient = RestClient.builder()
|
||||
.requestFactory(factory)
|
||||
.build();
|
||||
}
|
||||
|
||||
public HashMap<String, String> postRequest(String url, String payload) {
|
||||
HashMap<String, String> response = new HashMap<>();
|
||||
try {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
log.info("📡 Bank POST Request to URL: {}", url);
|
||||
|
||||
ResponseEntity<String> restResponse = restClient.post()
|
||||
.uri(url)
|
||||
.headers(h -> h.addAll(headers))
|
||||
.body(payload)
|
||||
.retrieve()
|
||||
.toEntity(String.class);
|
||||
|
||||
response.put("respCode", String.valueOf(restResponse.getStatusCode().value()));
|
||||
response.put("data", restResponse.getBody());
|
||||
|
||||
} catch (HttpClientErrorException | HttpServerErrorException httpException) {
|
||||
response.put("respCode", String.valueOf(httpException.getStatusCode()));
|
||||
response.put("data", "Exception : " + httpException.getResponseBodyAsString());
|
||||
} catch (Exception e) {
|
||||
response.put("data", "Exception :" + e.getMessage());
|
||||
log.error("❌ Exception during POST call to {} -> {}", url, e.getMessage());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public HashMap<String, String> getRequest(String url) {
|
||||
HashMap<String, String> response = new HashMap<>();
|
||||
try {
|
||||
log.info("🌐 Bank GET Request to URL: {}", url);
|
||||
|
||||
ResponseEntity<String> restResponse = restClient.get()
|
||||
.uri(url)
|
||||
.retrieve()
|
||||
.toEntity(String.class);
|
||||
|
||||
response.put("data", restResponse.getBody());
|
||||
|
||||
} catch (HttpClientErrorException | HttpServerErrorException httpException) {
|
||||
response.put("data", "Exception : " + httpException.getResponseBodyAsString());
|
||||
} catch (Exception e) {
|
||||
response.put("data", "Exception :" + e.getMessage());
|
||||
log.error("❌ Exception during GET call to {} -> {}", url, e.getMessage());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.billpaymentservice.bbps.serviceImpl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -19,10 +20,14 @@ import com.billpaymentservice.bbps.dto.response.BillerDataResponse;
|
||||
import com.billpaymentservice.bbps.dto.response.BillerResponse;
|
||||
import com.billpaymentservice.bbps.entites.BBPSMerchantValidation;
|
||||
import com.billpaymentservice.bbps.exception.AppException;
|
||||
import com.billpaymentservice.bbps.exception.CustomException;
|
||||
import com.billpaymentservice.bbps.repository.MerchantRepository;
|
||||
import com.billpaymentservice.bbps.service.MasterDataService;
|
||||
import com.billpaymentservice.bbps.util.BBPSConstant;
|
||||
import com.billpaymentservice.bbps.util.ResponseParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -43,10 +48,46 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
@Autowired
|
||||
private ResponseParser responseParser;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MasterDataServiceImpl.class);
|
||||
private final HttpService httpService;
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
@Value("${bbps.billerDataFetch.url}")
|
||||
private String billerDataFetchUrl;
|
||||
|
||||
// Inject HttpService
|
||||
public MasterDataServiceImpl(HttpService httpService) {
|
||||
this.httpService = httpService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BillerDataResponse getBillerByBillerId(BillerDetailRequest billerDetailRequest) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
||||
String billerId = billerDetailRequest.getBillerId();
|
||||
String url = billerDataFetchUrl + billerId;
|
||||
|
||||
Map<String, String> responseMap = httpService.getRequest(url);
|
||||
String responseData = responseMap.get("data");
|
||||
log.info("data is :{}", responseData);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
Map<String, Object> dataMap = objectMapper.readValue(responseData,
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
if (!dataMap.containsKey("generalResp")) {
|
||||
throw new CustomException(String.valueOf(dataMap.get("statusCode")),
|
||||
String.valueOf(dataMap.get("status")), String.valueOf(dataMap.get("message")),
|
||||
String.valueOf(dataMap.get("remarks")));
|
||||
}
|
||||
BillerDataResponse responseWrapper = objectMapper.convertValue(dataMap, BillerDataResponse.class);
|
||||
return responseWrapper;
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Error parsing responseData JSON: {}", e.getMessage());
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,8 +142,7 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
String category, int pageStart, int pageEnd) {
|
||||
LOGGER.info("Fetching Master Data Category-wise for MID={}, Category={}, PageStart={}, PageEnd={}",
|
||||
requestModel.getMid(), category, pageStart, pageEnd);
|
||||
//bollean
|
||||
//if(validate(arequetsModel)
|
||||
|
||||
BBPSMerchantValidation merchantValidation = merchantRegisterRepo.findByMid(requestModel.getMid());
|
||||
BillerResponse responseModel = new BillerResponse();
|
||||
// if Start merchant validations
|
||||
@@ -146,5 +186,4 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
return ResponseEntity.ok(responseModel);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ spring.datasource.hikari.auto-commit=true
|
||||
# Logging levels
|
||||
logging.level.io.github.resilience4j.retry=DEBUG
|
||||
|
||||
# BBPS URLs
|
||||
bbps.billerDataFetch.url=https://bbps-staging.digiledge.in/agent/cou-master/masters/billersById?billerId=
|
||||
|
||||
# BBPS URLs
|
||||
master.data.url = https://bbps-staging.digiledge.in/agent/cou-master/masters
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.billpaymentservice.bbps.controller;
|
||||
|
||||
import com.billpaymentservice.bbps.serviceImpl.HttpService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
public class TestHttpControllerTest {
|
||||
|
||||
@Autowired
|
||||
private HttpService httpService;
|
||||
|
||||
@Test
|
||||
void testGetRequest() {
|
||||
String url = "https://bbps-staging.digiledge.in/agent/cou-master/masters/billersById?billerId=ADAN00000HAR02"; // Dummy public GET API
|
||||
HashMap<String, String> response = httpService.getRequest(url);
|
||||
System.out.println("✅ GET Response: " + response);
|
||||
|
||||
System.out.println(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user