Applied validation for few fields in call

This commit is contained in:
nisha
2024-10-01 18:05:35 +05:30
parent f6de2a012e
commit 7bde0e91e7
4 changed files with 30 additions and 5 deletions

View File

@@ -126,7 +126,7 @@ public class CallDao {
callEntity.setConfidi(createCallRequest.getConfidi());
}
callEntity.setDocumentationRequested(createCallRequest.getDocumentationRequested());
if (createCallRequest.getAmountMin().compareTo(BigDecimal.ZERO) < 0) {
if (createCallRequest.getAmountMin() != null && createCallRequest.getAmountMin().compareTo(BigDecimal.ZERO) < 0) {
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.AMOUNT_GREATER_THAN_ZERO_MSG));
}
callEntity.setAmountMin(createCallRequest.getAmountMin());
@@ -474,6 +474,18 @@ public class CallDao {
setIfUpdated(callEntity::getAmountMax, callEntity::setAmountMax, updateCallRequest.getAmountMax());
setIfUpdated(callEntity::getDocumentationRequested, callEntity::setDocumentationRequested,
updateCallRequest.getDocumentationRequested());
if (updateCallRequest.getAmountMin() != null && updateCallRequest.getAmountMin().compareTo(BigDecimal.ZERO) < 0) {
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.AMOUNT_GREATER_THAN_ZERO_MSG));
}
if(updateCallRequest.getEmail()==null || Boolean.FALSE.equals(Utils.isValidEmail(updateCallRequest.getEmail()))){
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.VALIDATION_EMAIL,updateCallRequest.getEmail()));
}
setIfUpdated(callEntity::getAmountMin, callEntity::setAmountMin, updateCallRequest.getAmountMin());
setIfUpdated(callEntity::getEmail, callEntity::setEmail, updateCallRequest.getEmail());
setIfUpdated(callEntity::getPhoneNumber, callEntity::setPhoneNumber, updateCallRequest.getPhoneNumber());
setIfUpdated(callEntity::getStartTime, callEntity::setStartTime, DateTimeUtil.parseTime(updateCallRequest.getStartTime()));
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
setIfUpdated(callEntity::getConfidi, callEntity::setConfidi, updateCallRequest.getConfidi());
updateLookUpData(callEntity, updateCallRequest.getAimedTo(), LookUpDataTypeEnum.AIMED_TO);
updateFaq(updateCallRequest.getFaq(), callEntity, userEntity, LookUpDataTypeEnum.FAQ);