improved code and added logs in paymentserviceimpl
This commit is contained in:
@@ -81,7 +81,6 @@ public class AgentServiceImpl implements AgentService {
|
||||
String mid = fetchBillRequest.getMid();
|
||||
LOGGER.info("[{}] START | reqId={} | mid={} | billerId={}", apiName, requestId, mid,
|
||||
fetchBillRequest.getBillerId());
|
||||
helper.validateMerchant(mid);
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_INTI;
|
||||
fetchBillRequest.setClientReqId(txnId);
|
||||
@@ -92,12 +91,12 @@ public class AgentServiceImpl implements AgentService {
|
||||
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(requestId, txnId, apiName, fetchBillRequest.getMid(),
|
||||
BBPSConstant.HTTP_POST, requestJson);
|
||||
helper.validateMerchant(mid);
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, requestId, apiName, fullUrl,
|
||||
BBPSConstant.HTTP_POST, forwardJson);
|
||||
LOGGER.debug("Outbound log created successfully for txnId: {} and reqId: {}", txnId, requestId);
|
||||
|
||||
try {
|
||||
|
||||
LOGGER.info("[{}] Calling external API | URL={}", apiName, fullUrl);
|
||||
Map<String, String> responseMap = httpService.postRequest(fullUrl, forwardJson,
|
||||
helper.buildHeaders(beneficiaryDetailsRepository.findByOrgId(BBPSConstant.ORG_ID)));
|
||||
@@ -164,8 +163,6 @@ public class AgentServiceImpl implements AgentService {
|
||||
String reqId = billFetchByBillIdRequest.getReqId();
|
||||
String billId = billFetchByBillIdRequest.getBillId();
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_BY_ID + billFetchByBillIdRequest.getBillId();
|
||||
helper.validateMerchant(billFetchByBillIdRequest.getMid());
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET,
|
||||
null);
|
||||
LOGGER.debug("Outbound log created successfully for FetchBillById: {}", fullUrl);
|
||||
@@ -217,13 +214,12 @@ public class AgentServiceImpl implements AgentService {
|
||||
String reqId = billFetchByBillIdRequest.getReqId();
|
||||
String billId = billFetchByBillIdRequest.getBillId();
|
||||
String mid = billFetchByBillIdRequest.getMid();
|
||||
String requestJson = helper.convertObjectToJson(billFetchByBillIdRequest);
|
||||
LOGGER.info("[{}] START | reqId={} | mid={} | billId={}", apiName, reqId, mid, billId);
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_FETCH_BY_ID + billFetchByBillIdRequest.getBillId();
|
||||
|
||||
helper.validateMerchant(mid);
|
||||
String txnId = helper.generateTxnId(15);
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, billFetchByBillIdRequest.getMid(),
|
||||
BBPSConstant.HTTP_GET, null);
|
||||
BBPSConstant.HTTP_GET, requestJson);
|
||||
LOGGER.info("Initiating {} API for billId={} and reqId={}", apiName, billId, reqId);
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET,
|
||||
null);
|
||||
@@ -274,10 +270,8 @@ public class AgentServiceImpl implements AgentService {
|
||||
String apiName = BBPSConstant.API_INITIATE_BILL_VALIDATE;
|
||||
String reqId = fetchBillValidateRequest.getReqId();
|
||||
String mid = fetchBillValidateRequest.getMid();
|
||||
|
||||
LOGGER.info("[{}] START | reqId={} | mid={} | billerId={}", apiName, fetchBillValidateRequest, mid,
|
||||
fetchBillValidateRequest.getBillerId());
|
||||
helper.validateMerchant(fetchBillValidateRequest.getMid());
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILLER_VALIDATE_URL;
|
||||
fetchBillValidateRequest.setClientReqId(txnId);
|
||||
@@ -291,6 +285,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, fetchBillValidateRequest.getMid(),
|
||||
BBPSConstant.HTTP_POST, requestJson);
|
||||
helper.validateMerchant(fetchBillValidateRequest.getMid());
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_POST,
|
||||
forwardJson);
|
||||
LOGGER.debug("Outbound log created successfully for txnId: {} and reqId: {}", txnId, reqId);
|
||||
@@ -364,8 +359,6 @@ public class AgentServiceImpl implements AgentService {
|
||||
String billId = billRequest.getBillId();
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_ID_URL + billRequest.getBillId();
|
||||
|
||||
helper.validateMerchant(billRequest.getMid());
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl,
|
||||
BBPSConstant.HTTP_GET, null);
|
||||
LOGGER.debug("Outbound log created successfully for FetchBillById: {}", fullUrl);
|
||||
@@ -417,23 +410,20 @@ public class AgentServiceImpl implements AgentService {
|
||||
|
||||
@Override
|
||||
public ResponseModel initiateBillValidateByBillId(BillFetchByBillIdRequest billRequest) {
|
||||
|
||||
String apiName = BBPSConstant.API_FETCH_BILL_BY_ID;
|
||||
|
||||
String reqId = billRequest.getReqId();
|
||||
String billId = billRequest.getBillId();
|
||||
String mid = billRequest.getMid();
|
||||
|
||||
String requestJson = helper.convertObjectToJson(billRequest);
|
||||
LOGGER.info("[{}] START | reqId={} | mid={} | billId={}", apiName, billRequest, mid, billId);
|
||||
helper.validateMerchant(billRequest.getMid());
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_ID_URL + billRequest.getBillId();
|
||||
|
||||
LOGGER.info("Initiating {} API for billId={} and reqId={}", apiName, billId, reqId);
|
||||
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, billRequest.getMid(),
|
||||
BBPSConstant.HTTP_GET, null);
|
||||
|
||||
BBPSConstant.HTTP_GET, requestJson);
|
||||
helper.validateMerchant(billRequest.getMid());
|
||||
try {
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl,
|
||||
@@ -492,12 +482,14 @@ public class AgentServiceImpl implements AgentService {
|
||||
String reqId = billValidateByClientIdRequest.getReqId();
|
||||
String clientReqId = billValidateByClientIdRequest.getClientReqId();
|
||||
String mid = billValidateByClientIdRequest.getMid();
|
||||
|
||||
String txnId = helper.generateTxnId(15);
|
||||
String requestJson = helper.convertObjectToJson(billValidateByClientIdRequest);
|
||||
LOGGER.info("[{}] START | reqId={} | mid={} | clientReqId={}", apiName, reqId, mid,
|
||||
billValidateByClientIdRequest.getClientReqId());
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName,
|
||||
billValidateByClientIdRequest.getMid(), BBPSConstant.HTTP_GET,requestJson);
|
||||
|
||||
helper.validateMerchant(billValidateByClientIdRequest.getMid());
|
||||
String txnId = helper.generateTxnId(15);
|
||||
Optional<BillInitiate> billInitiate = billIntiateRepository.findByReqId(clientReqId);
|
||||
if (billInitiate.isEmpty()) {
|
||||
throw new CustomException(BBPSConstant.NO_BILL_FOUND);
|
||||
@@ -505,9 +497,6 @@ public class AgentServiceImpl implements AgentService {
|
||||
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_BY_CLIENT_REQ_ID + billInitiate.get().getTxnId();
|
||||
helper.validateMerchant(billValidateByClientIdRequest.getMid());
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName,
|
||||
billValidateByClientIdRequest.getMid(), BBPSConstant.HTTP_GET, null);
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET,
|
||||
null);
|
||||
|
||||
@@ -552,21 +541,21 @@ public class AgentServiceImpl implements AgentService {
|
||||
String reqId = billFetchByClientIdRequest.getReqId();
|
||||
String clientReqId = billFetchByClientIdRequest.getClientReqId();
|
||||
String mid = billFetchByClientIdRequest.getMid();
|
||||
String requestJson = helper.convertObjectToJson(billFetchByClientIdRequest);
|
||||
|
||||
LOGGER.info("[{}] START | reqId={} | mid={} | clientReqId={}", apiName, reqId, mid,
|
||||
billFetchByClientIdRequest.getClientReqId());
|
||||
helper.validateMerchant(billFetchByClientIdRequest.getMid());
|
||||
String txnId = helper.generateTxnId(15);
|
||||
helper.validateMerchant(billFetchByClientIdRequest.getMid());
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, billFetchByClientIdRequest.getMid(),
|
||||
BBPSConstant.HTTP_GET, requestJson);
|
||||
helper.validateMerchant(billFetchByClientIdRequest.getMid());
|
||||
|
||||
Optional<BillInitiate> billInitiate = billIntiateRepository.findByReqId(clientReqId);
|
||||
if (billInitiate.isEmpty()) {
|
||||
throw new CustomException(BBPSConstant.NO_BILL_FOUND);
|
||||
}
|
||||
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_BY_CLIENT_REQ_ID + billInitiate.get().getTxnId();
|
||||
helper.validateMerchant(billFetchByClientIdRequest.getMid());
|
||||
InboundTraceLog inboundLog = helper.createInboundLog(reqId, txnId, apiName, billFetchByClientIdRequest.getMid(),
|
||||
BBPSConstant.HTTP_GET, null);
|
||||
|
||||
OutboundTraceLog outboundLog = helper.createOutboundLog(txnId, reqId, apiName, fullUrl, BBPSConstant.HTTP_GET,
|
||||
null);
|
||||
|
||||
Reference in New Issue
Block a user