Skip to content

Commit

Permalink
FINERACT-671 loan charge specific due date fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ShruthiRajaram committed Dec 19, 2018
1 parent b3c36f1 commit 37b61d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ public class LoanCharge extends AbstractPersistableCustom<Long> {

public static LoanCharge createNewFromJson(final Loan loan, final Charge chargeDefinition, final JsonCommand command) {
final LocalDate dueDate = command.localDateValueOfParameterNamed("dueDate");
if (dueDate == null) {
final String defaultUserMessage = "Loan charge is missing due date.";
throw new LoanChargeWithoutMandatoryFieldException("loanCharge", "dueDate", defaultUserMessage, chargeDefinition.getId(),
chargeDefinition.getName());
}
return createNewFromJson(loan, chargeDefinition, command, dueDate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ public void validateAddLoanCharge(final String json) {
baseDataValidator.reset().parameter("amount").value(amount).notNull().positiveAmount();

if (this.fromApiJsonHelper.parameterExists("dueDate", element)) {
this.fromApiJsonHelper.extractLocalDateNamed("dueDate", element);
final LocalDate dueDate = this.fromApiJsonHelper.extractLocalDateNamed("dueDate", element);
baseDataValidator.reset().parameter("dueDate").value(dueDate).notBlank();
}

throwExceptionIfValidationWarningsExist(dataValidationErrors);
Expand Down

0 comments on commit 37b61d1

Please sign in to comment.