added constant in bbps constant

This commit is contained in:
Lincpay Tech
2025-11-24 17:48:54 +05:30
parent c9dfb6f9ba
commit 435ee0dacf
7 changed files with 368 additions and 351 deletions
@@ -2,44 +2,14 @@ package com.billpaymentservice.bbps.util;
import java.security.SecureRandom;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.modelmapper.ModelMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import com.billpaymentservice.bbps.dto.AdditionalInfoBillDTO;
import com.billpaymentservice.bbps.dto.CustomerParamDAO;
import com.billpaymentservice.bbps.dto.ResponseModel;
import com.billpaymentservice.bbps.dto.request.BillFetchByBillIdRequest;
import com.billpaymentservice.bbps.dto.request.BillPaymentRequest;
import com.billpaymentservice.bbps.dto.request.FetchBillRequest;
import com.billpaymentservice.bbps.dto.request.FetchBillValidatestRequest;
import com.billpaymentservice.bbps.dto.response.BillDataResponse;
import com.billpaymentservice.bbps.dto.response.FetchBillValidateResponse;
import com.billpaymentservice.bbps.dto.sentRequest.BillPaymentForwardRequest;
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillForwardRequest;
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillValidatestForwardRequest;
import com.billpaymentservice.bbps.entites.AdditionalInfoBill;
import com.billpaymentservice.bbps.entites.AdditionalInfoBillValidate;
import com.billpaymentservice.bbps.entites.BBPSMastersData;
import com.billpaymentservice.bbps.entites.BillMaster;
import com.billpaymentservice.bbps.entites.BillValidation;
import com.billpaymentservice.bbps.entites.BillerDetails;
import com.billpaymentservice.bbps.entites.BillerResponse;
import com.billpaymentservice.bbps.entites.CustomerParamBill;
import com.billpaymentservice.bbps.entites.CustomerParamBillValidation;
import com.billpaymentservice.bbps.entites.InboundTraceLog;
import com.billpaymentservice.bbps.entites.OutboundTraceLog;
import com.billpaymentservice.bbps.entites.PaymentChannel;
import com.billpaymentservice.bbps.entites.PaymentMode;
import com.billpaymentservice.bbps.entites.BharatConnectMaster;
import com.billpaymentservice.bbps.exception.CustomException;
import com.billpaymentservice.bbps.repository.BBPSMasterDataRepo;
@@ -81,34 +51,6 @@ public class Helper {
*
*
*/
public <T> void startPolling(T requestObject, // Request object (any type)
Function<T, ResponseModel> apiCallFunction, // Function to call API
int intervalSeconds, // gap between two polls
int maxDurationSeconds // total polling time
) {
new Thread(() -> {
try {
int maxAttempts = maxDurationSeconds / intervalSeconds;
for (int i = 0; i < maxAttempts; i++) {
LOGGER.info("⏳ Polling attempt {}...", i + 1);
ResponseModel response = apiCallFunction.apply(requestObject);
LOGGER.info("📥 Poll response: {}", response);
if ("SUCCESS".equalsIgnoreCase(response.getStatus())) {
LOGGER.info("✅ Polling successful, stopping early.");
break;
}
Thread.sleep(intervalSeconds * 1000L);
}
} catch (Exception e) {
LOGGER.error("❌ Error in polling thread: {}", e.getMessage(), e);
}
}).start();
}
public void validateMerchant(String mid) {
if (mid == null || mid == "") {
LOGGER.warn("MerchantRequestModel or MID is null");
@@ -206,7 +148,6 @@ public class Helper {
outboundLog.setResponsePayload(responsePayload);
outboundLog.setResponseReceiveTime(LocalDateTime.now());
outboundTraceLogRepository.save(outboundLog);
}
/* ---------- End helpers ---------- */