Added validation for the requested amount in the application.
This commit is contained in:
@@ -387,5 +387,6 @@ public class GepafinConstant {
|
|||||||
public static final String APPLICATION_PER_CALL="applicationPerCall";
|
public static final String APPLICATION_PER_CALL="applicationPerCall";
|
||||||
public static final String APPLICATION_PER_STATUS="applicationPerStatus";
|
public static final String APPLICATION_PER_STATUS="applicationPerStatus";
|
||||||
public static final String CALL_EXPIRED="call.expired";
|
public static final String CALL_EXPIRED="call.expired";
|
||||||
|
public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1260,6 +1260,9 @@ public class ApplicationDao {
|
|||||||
if (Boolean.FALSE.equals(ApplicationStatusTypeEnum.DRAFT.getValue().equals(applicationEntity.getStatus()))) {
|
if (Boolean.FALSE.equals(ApplicationStatusTypeEnum.DRAFT.getValue().equals(applicationEntity.getStatus()))) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
|
||||||
}
|
}
|
||||||
|
if (applicationEntity.getAmountRequested() == null || applicationEntity.getAmountRequested().compareTo(BigDecimal.ZERO) <= 0 ) {
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO));
|
||||||
|
}
|
||||||
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId());
|
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId());
|
||||||
Long totalSteps = flowFormDao.calculateTotalSteps(flowEdgesList);
|
Long totalSteps = flowFormDao.calculateTotalSteps(flowEdgesList);
|
||||||
Integer completedSteps = flowFormDao.getCompletedSteps(applicationEntity);
|
Integer completedSteps = flowFormDao.getCompletedSteps(applicationEntity);
|
||||||
|
|||||||
Reference in New Issue
Block a user