FINERACT-2065: Fix schedule handling with higher fixed length value than Loan term

This commit is contained in:
Jose Alberto Hernandez
2024-04-11 15:35:21 +02:00
committed by Adam Saghy
parent 5ad63752c9
commit 35bdbccd2e
5 changed files with 225 additions and 10 deletions
@@ -69,6 +69,7 @@ public final class LoanApplicationTerms {
private final Integer repaymentEvery;
private final PeriodFrequencyType repaymentPeriodFrequencyType;
private long variationDays = 0L;
private final Integer fixedLength;
private final Integer nthDay;
@@ -1845,16 +1846,16 @@ public final class LoanApplicationTerms {
}
switch (repaymentPeriodFrequencyType) {
case DAYS:
maxDateForFixedLength = startDate.plusDays(fixedLength);
maxDateForFixedLength = startDate.plusDays(fixedLength + variationDays);
break;
case WEEKS:
maxDateForFixedLength = startDate.plusWeeks(fixedLength);
maxDateForFixedLength = startDate.plusWeeks(fixedLength + variationDays);
break;
case MONTHS:
maxDateForFixedLength = startDate.plusMonths(fixedLength);
maxDateForFixedLength = startDate.plusMonths(fixedLength + variationDays);
break;
case YEARS:
maxDateForFixedLength = startDate.plusYears(fixedLength);
maxDateForFixedLength = startDate.plusYears(fixedLength + variationDays);
break;
case INVALID:
break;
@@ -1871,4 +1872,12 @@ public final class LoanApplicationTerms {
: getSubmittedOnDate();
}
public boolean isLastPeriod(final Integer periodNumber) {
return getNumberOfRepayments().equals(periodNumber);
}
public void updateVariationDays(final long daysToAdd) {
this.variationDays += daysToAdd;
}
}