improved the error handling and updated link paymentstartrecord and transactionmaster
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.billpaymentservice.bbps.serviceImpl;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -153,7 +152,8 @@ public class AgentServiceImpl implements AgentService {
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error("JSON Parsing Error: {}", e.getMessage(), e);
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR);
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
// Use standardized user-facing message and status, keep internal details in remarks
|
||||
throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error("Error parsing BillById JSON: {}", e.getMessage(), e);
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR);
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
catch (JsonProcessingException e) {
|
||||
LOGGER.error("Error parsing responseData JSON for billId={} : {}", billId, e.getMessage(), e);
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR);
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error("JSON Parsing Error: {}", e.getMessage(), e);
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR);
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error("Error parsing BillById JSON: {}", e.getMessage(), e);
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR);
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -465,7 +465,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
} catch (com.fasterxml.jackson.core.JsonProcessingException e) {
|
||||
LOGGER.error("Error parsing ValidateByBillId JSON: {}", e.getMessage(), e);
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR);
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage());
|
||||
}
|
||||
}
|
||||
// ================================== Bill fetch and Bill Validate by Client Req
|
||||
@@ -494,7 +494,12 @@ public class AgentServiceImpl implements AgentService {
|
||||
helper.validateMerchant(billValidateByClientIdRequest.getMid());
|
||||
Optional<BillInitiate> billInitiate = billIntiateRepository.findByReqId(clientReqId);
|
||||
if (billInitiate.isEmpty()) {
|
||||
throw new CustomException(BBPSConstant.NO_BILL_FOUND);
|
||||
new CustomException(
|
||||
BBPSConstant.NO_BILL_FOUND, // message // status
|
||||
BBPSConstant.FAILED_STATUS,
|
||||
BBPSConstant.HTTP_NOT_FOUND, // statusCode
|
||||
"Bill not found in database for given clientReqId"
|
||||
);
|
||||
}
|
||||
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_BY_CLIENT_REQ_ID + billInitiate.get().getTxnId();
|
||||
@@ -531,7 +536,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR);
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,7 +557,12 @@ public class AgentServiceImpl implements AgentService {
|
||||
|
||||
Optional<BillInitiate> billInitiate = billIntiateRepository.findByReqId(clientReqId);
|
||||
if (billInitiate.isEmpty()) {
|
||||
throw new CustomException(BBPSConstant.NO_BILL_FOUND);
|
||||
throw new CustomException(
|
||||
BBPSConstant.NO_BILL_FOUND, // message // status
|
||||
BBPSConstant.FAILED_STATUS,
|
||||
BBPSConstant.HTTP_NOT_FOUND, // statusCode
|
||||
"Bill not found in database for given clientReqId"
|
||||
);
|
||||
}
|
||||
String fullUrl = agentDtaUrl + BBPSConstant.BILL_VALIDATE_BY_CLIENT_REQ_ID + billInitiate.get().getTxnId();
|
||||
|
||||
@@ -588,7 +598,7 @@ public class AgentServiceImpl implements AgentService {
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
helper.updateInboundLogFailure(inboundLog, e.getMessage(), BBPSConstant.JSON_ERROR);
|
||||
throw new CustomException("Invalid JSON received from API");
|
||||
throw new CustomException(BBPSConstant.MSG_INVALID_JSON_FROM_UPSTREAM, "FAILED", BBPSConstant.INVALID_JSON_STATUS_CODE, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user