From c8cf2d58b7f1cd03c8b0ae24442614ddbe80a772 Mon Sep 17 00:00:00 2001 From: Mohd-Arham Date: Tue, 25 Nov 2025 18:19:44 +0530 Subject: [PATCH] add logger in complaint --- .../bbps/serviceImpl/ComplainServiceImpl.java | 69 ++++++++----------- .../resources/application-local.properties | 4 +- 2 files changed, 29 insertions(+), 44 deletions(-) diff --git a/src/main/java/com/billpaymentservice/bbps/serviceImpl/ComplainServiceImpl.java b/src/main/java/com/billpaymentservice/bbps/serviceImpl/ComplainServiceImpl.java index 8cf93cf..4b69980 100644 --- a/src/main/java/com/billpaymentservice/bbps/serviceImpl/ComplainServiceImpl.java +++ b/src/main/java/com/billpaymentservice/bbps/serviceImpl/ComplainServiceImpl.java @@ -89,25 +89,23 @@ public class ComplainServiceImpl implements ComplainService { String apiName = BBPSConstant.API_ADD_COMPLAIN; String requestId = complainRequestDTO.getReqId(); String mid = complainRequestDTO.getMid(); - LOGGER.info("[{}] START | reqId={} | mid={}", apiName, requestId, mid); - helper.validateMerchant(mid); String txnId = helper.generateTxnId(15); String fullUrl = complainDataUrl + BBPSConstant.ADD_COMPLAIN_ENDPOINT; LOGGER.info("[{}] Full URL={}", apiName, fullUrl); // Fetch tenant & agent from DB - BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); FetchComplaintForwardRequest forwardReq = mapperHelper.fetchComplaintForwardRequestMap(complainRequestDTO); - String forwardJson = helper.convertObjectToJson(forwardReq); String requestJson = helper.convertObjectToJson(complainRequestDTO); - HttpHeaders headers = helper.buildHeaders(headersData); - InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnId, apiName, complainRequestDTO.getMid(), BBPSConstant.HTTP_POST, requestJson); + helper.validateMerchant(mid); + BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); + HttpHeaders headers = helper.buildHeaders(headersData); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, requestId, apiName, fullUrl, BBPSConstant.HTTP_POST, null); @@ -182,22 +180,19 @@ public class ComplainServiceImpl implements ComplainService { LOGGER.info("[{}] START | reqId={} | mid={} | ticketId={}", apiName, reqId, mid, ticketId); String fullUrl = agentDtaUrl + BBPSConstant.COMPALINT_STATUS; - helper.validateMerchant(request.getMid()); String txnId = helper.generateTxnId(15); - BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); - - HttpHeaders headers = helper.buildHeaders(headersData); - - // Convert request to JSON - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); FetchTicketLatestStatusRequest forwardReq = mapperHelper.fetchTicketLatestStatusRequestMap(request); - String forwardJson = helper.convertObjectToJson(forwardReq); String requestJson = helper.convertObjectToJson(request); InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, request.getMid(), BBPSConstant.HTTP_POST, requestJson); + helper.validateMerchant(request.getMid()); + BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); + HttpHeaders headers = helper.buildHeaders(headersData); + // Convert request to JSON + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_POST, complaintId); @@ -259,8 +254,6 @@ public class ComplainServiceImpl implements ComplainService { @Override public ResponseModel viewComplaintHistory(ComplainStatusRequest request) { - LOGGER.info("Fetching View Complaint History Complaint by Complaint Id={}", request.getTicketId(), - request.getReqId()); String apiName = BBPSConstant.API_VIEW_COMPLAINT_HISTORY; String reqId = request.getReqId(); String ticketId = request.getTicketId(); @@ -269,16 +262,13 @@ public class ComplainServiceImpl implements ComplainService { LOGGER.info("[{}] START | reqId={} | mid={} | ticketId={}", apiName, reqId, mid, ticketId); String fullUrl = agentDtaUrl + BBPSConstant.COMPLAINT_HISTORY + request.getTicketId(); - helper.validateMerchant(request.getMid()); String txnId = helper.generateTxnId(15); - - BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); - HttpHeaders headers = helper.buildHeaders(headersData); - String requestJson = helper.convertObjectToJson(request); - InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, request.getMid(), BBPSConstant.HTTP_GET, requestJson); + helper.validateMerchant(request.getMid()); + BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); + HttpHeaders headers = helper.buildHeaders(headersData); OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET, ticketId); LOGGER.debug("Outbound log created successfully for Complaint : {}", fullUrl); @@ -334,20 +324,17 @@ public class ComplainServiceImpl implements ComplainService { String reqId = request.getReqId(); String ticketId = request.getTicketId(); String mid = request.getMid(); - LOGGER.info("[{}] START | reqId={} | mid={} | ticketId={}", apiName, reqId, mid, ticketId); - helper.validateMerchant(request.getMid()); String txnId = helper.generateTxnId(15); String fullUrl = agentDtaUrl + BBPSConstant.VIEW_COMPLAINT_BY_ID + request.getTicketId(); - BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); - HttpHeaders headers = helper.buildHeaders(headersData); - String requestJson = helper.convertObjectToJson(request); - InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, request.getMid(), BBPSConstant.HTTP_GET, requestJson); + helper.validateMerchant(request.getMid()); + BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); + HttpHeaders headers = helper.buildHeaders(headersData); OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET, ticketId); LOGGER.debug("Outbound log created successfully for Complaint : {}", fullUrl); @@ -405,10 +392,10 @@ public class ComplainServiceImpl implements ComplainService { String fullUrl = BBPSConstant.DB_OPTIONS; String requestJson = helper.convertObjectToJson(request); - // Validate merchant - helper.validateMerchant(request.getMid()); InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, request.getMid(), BBPSConstant.HTTP_GET, requestJson); + // Validate merchant + helper.validateMerchant(request.getMid()); OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET, null); LOGGER.debug("Outbound log created successfully for Complaint : {}", fullUrl); @@ -452,17 +439,17 @@ public class ComplainServiceImpl implements ComplainService { String transactionId = request.getId(); LOGGER.info("[{}] START | reqId={} | mid={} | txnId={}", apiName, reqId, mid, transactionId); - helper.validateMerchant(request.getMid()); String txnId = helper.generateTxnId(15); String fullUrl = agentDtaUrl + BBPSConstant.CHECK_TRANSACTION_URL + request.getId(); - BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); - HttpHeaders headers = helper.buildHeaders(headersData); - String requestJson = helper.convertObjectToJson(request); InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, request.getMid(), BBPSConstant.HTTP_GET, requestJson); + helper.validateMerchant(request.getMid()); + + BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); + HttpHeaders headers = helper.buildHeaders(headersData); OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET, ID); LOGGER.debug("Outbound log created successfully for Complaint : {}", fullUrl); @@ -515,19 +502,17 @@ public class ComplainServiceImpl implements ComplainService { String statusType = request.getStatusType(); LOGGER.info("[{}] START | reqId={} | mid={} | statusType={}", apiName, reqId, mid, statusType); - - helper.validateMerchant(request.getMid()); String txnId = helper.generateTxnId(15); String fullUrl = complainDataUrl + BBPSConstant.VIEW_ALL_COMPLAINTS_BASE + "?pageNo=" + request.getPageNo() + "&pageSize=" + request.getPageSize() + "&statusType=" + request.getStatusType() + "&ticketType=" + request.getTicketType(); - BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); - HttpHeaders headers = helper.buildHeaders(headersData); - String requestJson = helper.convertObjectToJson(request); InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, request.getMid(), BBPSConstant.HTTP_POST, requestJson); + helper.validateMerchant(request.getMid()); + BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID); + HttpHeaders headers = helper.buildHeaders(headersData); OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET, request.getStatusType()); LOGGER.debug("Outbound log created successfully for Complaint : {}", fullUrl); diff --git a/src/main/resources/application-local.properties b/src/main/resources/application-local.properties index b9b1818..17c421e 100644 --- a/src/main/resources/application-local.properties +++ b/src/main/resources/application-local.properties @@ -20,9 +20,9 @@ swagger.server.description=Local Development Server # DataSource spring.datasource.url=jdbc:postgresql://localhost:5432/BBPS spring.datasource.username=postgres -#spring.datasource.password=UAT@DB_2025 +spring.datasource.password=UAT@DB_2025 -spring.datasource.password=himanshu@123 +#spring.datasource.password=himanshu@123 spring.datasource.driver-class-name=org.postgresql.Driver spring.datasource.type=com.zaxxer.hikari.HikariDataSource