Merge pull request #500 from ShruthiRajaram/FINERACT-671
FINERACT-671 loan charge specific due date fix
This commit is contained in:
+5
@@ -134,6 +134,11 @@ public class LoanCharge extends AbstractPersistableCustom<Long> {
|
|||||||
|
|
||||||
public static LoanCharge createNewFromJson(final Loan loan, final Charge chargeDefinition, final JsonCommand command) {
|
public static LoanCharge createNewFromJson(final Loan loan, final Charge chargeDefinition, final JsonCommand command) {
|
||||||
final LocalDate dueDate = command.localDateValueOfParameterNamed("dueDate");
|
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);
|
return createNewFromJson(loan, chargeDefinition, command, dueDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -248,7 +248,8 @@ public final class LoanEventApiJsonValidator {
|
|||||||
baseDataValidator.reset().parameter("amount").value(amount).notNull().positiveAmount();
|
baseDataValidator.reset().parameter("amount").value(amount).notNull().positiveAmount();
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists("dueDate", element)) {
|
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);
|
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||||
|
|||||||
Reference in New Issue
Block a user