Merge pull request #174 from Kitzanos/requested-amount-validation-prod

Cherry pick (Added validation for the requested amount in the application)
This commit is contained in:
Rinaldo
2025-01-29 10:20:22 +01:00
committed by GitHub
4 changed files with 6 additions and 0 deletions

View File

@@ -368,5 +368,6 @@ public class GepafinConstant {
public static final String APPLICATION_PER_CALL="applicationPerCall";
public static final String APPLICATION_PER_STATUS="applicationPerStatus";
public static final String CALL_EXPIRED="call.expired";
public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero";
}

View File

@@ -1258,6 +1258,9 @@ public class ApplicationDao {
if (Boolean.FALSE.equals(ApplicationStatusTypeEnum.DRAFT.getValue().equals(applicationEntity.getStatus()))) {
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());
Long totalSteps = flowFormDao.calculateTotalSteps(flowEdgesList);
Integer completedSteps = flowFormDao.getCompletedSteps(applicationEntity);

View File

@@ -348,3 +348,4 @@ notification.updated.successfully=Notification updated successfully.
user.with.company.not.found = User with company not found for user or company.
amount.accepted.required=Amount accepted is required while approving the application.
call.expired=Call has been expired.
amount.request.should.greated.then.zero=Requested amount should not be empty and should be greater than zero.

View File

@@ -343,3 +343,4 @@ user.action.fetched.successfully = Dettagli sull'azione dell'utente recuperati c
action.context.labels.fetched.successfully = Etichette del contesto dell'azione recuperate correttamente.
amount.accepted.required=L'importo accettato <20> obbligatorio durante l'approvazione della domanda.
call.expired=La chiamata <20> scaduta.
amount.request.should.greated.then.zero=L'importo richiesto non deve essere vuoto e deve essere maggiore di zero.