added constant in bbps constant
This commit is contained in:
@@ -59,4 +59,80 @@ public class BBPSConstant {
|
||||
public static final String ADD_COMPLAIN_ENDPOINT = "/couapp/ticket/raise";
|
||||
public static final String VIEW_ALL_COMPLAINTS_BASE = "/couapp/tickets";
|
||||
|
||||
}
|
||||
// New centralized string/constants used across services
|
||||
public static final String API_INITIATE_BILL_FETCH = "InitiateBillFetch";
|
||||
public static final String API_FETCH_BILL_BY_ID = "FetchBillById";
|
||||
public static final String API_INITIATE_BILL_VALIDATE = "InitiateBillValidate";
|
||||
public static final String API_FETCH_BILL_VALIDATE_BY_CLIENT_ID = "FetchBillValidateByClientIdRequest";
|
||||
public static final String API_FETCH_BILL_BY_CLIENT_ID = "FetchBillByClientIdRequest";
|
||||
|
||||
public static final String HTTP_POST = "POST";
|
||||
public static final String HTTP_GET = "GET";
|
||||
|
||||
public static final String INVALID_RESPONSE = "INVALID_RESPONSE";
|
||||
public static final String JSON_ERROR = "JSON_ERROR";
|
||||
|
||||
public static final String CALLBACK_RECEIVED_SUCCESS = "CallBack Recieved Successfully";
|
||||
public static final String NO_BILL_FOUND = "No Bill Found for given Client Req Id";
|
||||
|
||||
public static final String SUCCESS_CODE_STR = "200";
|
||||
|
||||
// Added constants referenced by ComplainServiceImpl
|
||||
public static final String ORG_ID = "ORG001";
|
||||
|
||||
public static final String API_ADD_COMPLAIN = "ADD_COMPLAIN";
|
||||
public static final String API_COMPLAINT_STATUS = "COMPLAINT_STATUS";
|
||||
public static final String API_VIEW_COMPLAINT_HISTORY = "View_Complaint_History";
|
||||
public static final String API_VIEW_COMPLAINT_BY_ID = "View_Complaint_By_ID";
|
||||
public static final String API_GET_ALL_MASTER_OPTIONS = "View All Options Fetch By Id";
|
||||
public static final String API_CHECK_TXN_STATUS = "CheckTxnStatus";
|
||||
public static final String API_VIEW_ALL_COMPLAINTS_BY_STATUS = "View_All_Complaint_By_Status_Type";
|
||||
|
||||
// API names used by MasterDataServiceImpl
|
||||
public static final String API_GET_MASTER_DATA = "GetMasterData";
|
||||
public static final String API_GET_BILLER_BY_ID = "GetBillerByBillerId";
|
||||
public static final String API_GET_CUSTOMER_PARAM_BY_BILLER_ID = "GetCustomerParamByBillerId";
|
||||
public static final String API_FETCH_MASTER_DATA_CATEGORY_WISE = "FetchMasterDataCategoryWise";
|
||||
public static final String API_FETCH_CUSTOMER_PARAM_GROUP = "FetchCustomerParamGroup";
|
||||
public static final String API_FETCH_ALL_MASTER_AMOUNT_OPTION = "FetchAllMasterAmountOption";
|
||||
public static final String API_FETCH_PLAN_CATEGORIES = "FetchPlanCategorie";
|
||||
public static final String API_FETCH_INITIATING_CHANNEL = "FetchInitiatingChannel";
|
||||
public static final String API_FETCH_PLAN_BY_CATEGORIES = "FetchPlanByCategories";
|
||||
public static final String API_GET_TICKET_DISPOSITIONS = "GetTicketDispositionDetails";
|
||||
|
||||
// Payment related API names
|
||||
public static final String API_INITIATE_PAYMENT = "InitiatePayment";
|
||||
public static final String API_CHECK_TRANSACTION_STATUS = "CheckTransactionStatus";
|
||||
public static final String API_CHECK_TRANSACTION_PUBLIC = "checkTrasactionStatus";
|
||||
public static final String API_CHECK_BY_CLIENT_REQ_ID = "checkTrasactionStatusbyClientReqId";
|
||||
|
||||
// Response and helper keys (already existing ones kept)
|
||||
public static final String RESPONSE_GENERIC_KEY = "genericResponse";
|
||||
|
||||
// Common messages used in PaymentServiceImpl
|
||||
public static final String EMPTY_RESPONSE_FROM_BBPS = "Empty response from BBPS";
|
||||
public static final String INVALID_STRUCTURE = "INVALID_STRUCTURE";
|
||||
public static final String FAILED_STR = "FAILED";
|
||||
|
||||
public static final int HTTP_OK_INT = 200;
|
||||
public static final int HTTP_NOT_FOUND = 404;
|
||||
public static final int HTTP_INTERNAL_SERVER_ERROR = 500;
|
||||
|
||||
// Response and helper keys
|
||||
public static final String HTTP_SERVICE_ERROR_PREFIX = "HttpService Error";
|
||||
public static final String RESPONSE_DATA_KEY = "data";
|
||||
public static final String RESPONSE_MESSAGE_KEY = "message";
|
||||
public static final String RESPONSE_STATUS_KEY = "status";
|
||||
public static final String RESPONSE_STATUSCODE_KEY = "statusCode";
|
||||
public static final String RESPONSE_REMARKS_KEY = "remarks";
|
||||
public static final String RESPONSE_GENERAL_RESP = "generalResp";
|
||||
public static final String SUCCESS_RESPONSE = "SUCCESS";
|
||||
|
||||
// Newly added constants used by ComplainServiceImpl
|
||||
public static final String DB_OPTIONS = "/db/options"; // used as a logical URL/identifier for master options
|
||||
public static final String NULL_DATA_FROM_DB = "NULL_DATA_FROM_DB";
|
||||
public static final String NO_MASTER_FIELDS_FOUND = "No master fields found";
|
||||
public static final String ALL_MASTER_FIELDS_FETCH = "All master fields fetched successfully";
|
||||
public static final String SOMETHING_WENT_WRONG = "Something went wrong";
|
||||
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
package com.billpaymentservice.bbps.util;
|
||||
|
||||
import com.billpaymentservice.bbps.dto.request.FetchBillRequest;
|
||||
import com.billpaymentservice.bbps.dto.sentRequest.FetchBillForwardRequest;
|
||||
import com.billpaymentservice.bbps.entites.BillerDetails;
|
||||
import com.billpaymentservice.bbps.entites.BillerResponseParams;
|
||||
import com.billpaymentservice.bbps.entites.InterchangeFee;
|
||||
|
||||
@@ -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 ---------- */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user