From 985f6eecfda7b243cffe7b2c5b221965029d7ec4 Mon Sep 17 00:00:00 2001 From: Lincpay Tech Date: Tue, 25 Nov 2025 18:52:28 +0530 Subject: [PATCH] make validation after inbound --- .../serviceImpl/MasterDataServiceImpl.java | 50 +++++++------------ 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/billpaymentservice/bbps/serviceImpl/MasterDataServiceImpl.java b/src/main/java/com/billpaymentservice/bbps/serviceImpl/MasterDataServiceImpl.java index d493ef0..70363d9 100644 --- a/src/main/java/com/billpaymentservice/bbps/serviceImpl/MasterDataServiceImpl.java +++ b/src/main/java/com/billpaymentservice/bbps/serviceImpl/MasterDataServiceImpl.java @@ -109,13 +109,12 @@ public class MasterDataServiceImpl implements MasterDataService { String requestId = masterRequest.getReqId(); String mid = masterRequest.getMid(); LOGGER.info("[{}] START | reqId={} | mid={}", apiName, requestId, mid); - // Merchant Validation - helper.validateMerchant(mid); String txnID = helper.generateTxnId(15); String requestJson = helper.convertObjectToJson(masterRequest); InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, masterRequest.getMid(), BBPSConstant.HTTP_POST, requestJson); + helper.validateMerchant(mid); try { // check Tenant Id is present DB BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); @@ -167,9 +166,6 @@ public class MasterDataServiceImpl implements MasterDataService { @Override public ResponseModel getBillerByBillerId(BillerDetailRequest billerDetailRequest) { - - helper.validateMerchant(billerDetailRequest.getMid()); - String apiName = BBPSConstant.API_GET_BILLER_BY_ID; String requestId = billerDetailRequest.getReqId(); String billerId = billerDetailRequest.getBillerId(); @@ -186,6 +182,7 @@ public class MasterDataServiceImpl implements MasterDataService { InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, billerDetailRequest.getMid(), BBPSConstant.HTTP_POST, requestJson); + helper.validateMerchant(mid); OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, fullUrl, BBPSConstant.HTTP_GET, null); @@ -236,7 +233,6 @@ public class MasterDataServiceImpl implements MasterDataService { LOGGER.info("[{}] START | reqId={} | mid={} | billerId={}", apiName, requestId, mid, customerParamRequest.getBillerId()); - helper.validateMerchant(mid); String txnID = helper.generateTxnId(15); String billerId = customerParamRequest.getBillerId(); String fullUrl = masterRegisterUrl + BBPSConstant.CUSTOMPARAM_URL + billerId; @@ -244,7 +240,7 @@ public class MasterDataServiceImpl implements MasterDataService { String requestJson = helper.convertObjectToJson(customerParamRequest); InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, customerParamRequest.getMid(), BBPSConstant.HTTP_POST, requestJson); - + helper.validateMerchant(mid); try { OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, fullUrl, @@ -300,10 +296,9 @@ public class MasterDataServiceImpl implements MasterDataService { String apiName = BBPSConstant.API_FETCH_CATEGORY_MASTER_DATA; String requestId = contactMasterRequest.getReqId(); + String mid = contactMasterRequest.getMid(); LOGGER.info("[{}] START | reqId={} | mid={} | category={}", apiName, requestId, contactMasterRequest.getMid(), contactMasterRequest.getCategory()); - // Validated - helper.validateMerchant(contactMasterRequest.getMid()); String txnID = helper.generateTxnId(15); BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); @@ -313,6 +308,7 @@ public class MasterDataServiceImpl implements MasterDataService { String requestJson = helper.convertObjectToJson(contactMasterRequest); InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, contactMasterRequest.getMid(), BBPSConstant.HTTP_POST, requestJson); + helper.validateMerchant(mid); try { LOGGER.info("Contact Master Full URL-:" + fullUrl); @@ -370,8 +366,7 @@ public class MasterDataServiceImpl implements MasterDataService { LOGGER.info("[{}] START | reqId={} | mid={} | billerName={} | category={}", apiName, requestId, mid, masterRequest.getBillerName(), masterRequest.getCategory()); - helper.validateMerchant(mid); - String txnID = helper.generateTxnId(15); + String txnID = helper.generateTxnId(15); String fullUrl = String.format("%s%s?billerName=%s&category=%s&page=%d&pagesize=%d", masterRegisterUrl, BBPSConstant.BILLER_URL, masterRequest.getBillerName(), masterRequest.getCategory(), masterRequest.getPageNo(), masterRequest.getPageSize()); @@ -380,7 +375,7 @@ public class MasterDataServiceImpl implements MasterDataService { InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, masterRequest.getMid(), BBPSConstant.HTTP_POST, requestJson); - + helper.validateMerchant(mid); OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, fullUrl, BBPSConstant.HTTP_GET, null); @@ -434,16 +429,16 @@ public class MasterDataServiceImpl implements MasterDataService { String apiName = BBPSConstant.API_GET_TICKET_DISPOSITIONS; String requestId = dispositionDetailRequest.getReqId(); String mid = dispositionDetailRequest.getMid(); + String requestJson = helper.convertObjectToJson(dispositionDetailRequest); LOGGER.info("[{}] START | reqId={} | mid={}", apiName, requestId, mid); - // validate - helper.validateMerchant(mid); - // generate Txn Id String txnID = helper.generateTxnId(15); String fullUrl = masterRegisterUrl + BBPSConstant.DISPOSTION_URL; InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, - dispositionDetailRequest.getMid(), BBPSConstant.HTTP_GET, "N/A"); + dispositionDetailRequest.getMid(), BBPSConstant.HTTP_GET, requestJson); + helper.validateMerchant(mid); + OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, fullUrl, - BBPSConstant.HTTP_GET, null); + BBPSConstant.HTTP_GET, requestJson); try { LOGGER.info("Calling external API: {}", fullUrl); @@ -569,13 +564,11 @@ public class MasterDataServiceImpl implements MasterDataService { LOGGER.info("[{}] START | reqId={} | mid={} | billerId={}", apiName, requestId, mid, requestModel.getBillerId()); - helper.validateMerchant(mid); - String txnID = helper.generateTxnId(15); String fullUrl = masterRegisterUrl + BBPSConstant.AMOUNT_OPTIONS + requestModel.getBillerId(); InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, requestModel.getMid(), BBPSConstant.HTTP_POST, helper.convertObjectToJson(requestModel)); - + helper.validateMerchant(mid); try { LOGGER.info("[{}] Calling External API | URL={} | Method=GET", apiName, fullUrl); @@ -635,13 +628,12 @@ public class MasterDataServiceImpl implements MasterDataService { String mid = requestModel.getMid(); LOGGER.info("[{}] START | reqId={} | mid={} | billerId={}", apiName, requestId, mid, requestModel.getBillerId()); - helper.validateMerchant(requestModel.getMid()); String txnID = helper.generateTxnId(15); String fullUrl = masterRegisterUrl + BBPSConstant.PLAN_CATEGORIES + requestModel.getBillerId(); InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, requestModel.getMid(), BBPSConstant.HTTP_POST, helper.convertObjectToJson(requestModel)); - + helper.validateMerchant(mid); try { LOGGER.info("[{}] Calling External API | URL={} | Method=GET", apiName, fullUrl); @@ -697,15 +689,12 @@ public class MasterDataServiceImpl implements MasterDataService { String apiName = BBPSConstant.API_FETCH_INITIATING_CHANNEL; String requestId = requestModel.getReqId(); String mid = requestModel.getMid(); - LOGGER.info("[{}] START | reqId={} | mid={}", apiName, requestId, mid); - - helper.validateMerchant(mid); String txnID = helper.generateTxnId(15); String fullUrl = masterRegisterUrl + BBPSConstant.INITIATING_CHANNEL; InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, requestModel.getMid(), BBPSConstant.HTTP_POST, helper.convertObjectToJson(requestModel)); - + helper.validateMerchant(mid); try { LOGGER.info("[{}] Calling Master API | URL={} | Method=GET", apiName, fullUrl); @@ -756,12 +745,9 @@ public class MasterDataServiceImpl implements MasterDataService { String apiName = BBPSConstant.API_FETCH_PLAN_BY_CATEGORIES; String requestId = requestModel.getReqId(); String mid = requestModel.getMid(); - LOGGER.info("[{}] START | reqId={} | mid={} | billerId={}", apiName, requestId, mid, requestModel.getBillerId()); - helper.validateMerchant(mid); String txnID = helper.generateTxnId(15); - String url = String.format("%s%s?billerId=%s%s%s%s&page=%d&pagesize=%d", masterRegisterUrl, BBPSConstant.PLANS_URL, requestModel.getBillerId(), requestModel.getCategory() != null ? "&category=" + requestModel.getCategory() : "", @@ -776,6 +762,7 @@ public class MasterDataServiceImpl implements MasterDataService { InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, requestModel.getMid(), BBPSConstant.HTTP_POST, requestJson); + helper.validateMerchant(mid); OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, url, BBPSConstant.HTTP_GET, null); try { @@ -825,19 +812,16 @@ public class MasterDataServiceImpl implements MasterDataService { @Override public ResponseModel getTicketDispositions(DispositionRequest dispositionDetailRequest) { - String apiName = BBPSConstant.API_GET_TICKET_DISPOSITIONS; String requestId = dispositionDetailRequest.getReqId(); String mid = dispositionDetailRequest.getMid(); LOGGER.info("[{}] START | reqId={} | mid={}", apiName, requestId, mid); - - helper.validateMerchant(dispositionDetailRequest.getMid()); String txnID = helper.generateTxnId(15); String fullUrl = masterRegisterUrl + BBPSConstant.TICKET_DISPOSTION_URL; InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnID, apiName, dispositionDetailRequest.getMid(), BBPSConstant.HTTP_GET, "N/A"); - + helper.validateMerchant(mid); OutboundTraceLog outboundLog = helper.createOutboundLog(txnID, requestId, apiName, fullUrl, BBPSConstant.HTTP_GET, null);