FINERACT-2065: Schedule handling for fixed length configuration
This commit is contained in:
committed by
Adam Saghy
parent
6458094a5e
commit
b64b4b7105
+39
@@ -1832,4 +1832,43 @@ public final class LoanApplicationTerms {
|
||||
public Money getDownPaymentAmount() {
|
||||
return downPaymentAmount;
|
||||
}
|
||||
|
||||
public Integer getFixedLength() {
|
||||
return fixedLength;
|
||||
}
|
||||
|
||||
public LocalDate calculateMaxDateForFixedLength() {
|
||||
final LocalDate startDate = getRepaymentStartDate();
|
||||
LocalDate maxDateForFixedLength = null;
|
||||
if (fixedLength == null) {
|
||||
return maxDateForFixedLength;
|
||||
}
|
||||
switch (repaymentPeriodFrequencyType) {
|
||||
case DAYS:
|
||||
maxDateForFixedLength = startDate.plusDays(fixedLength);
|
||||
break;
|
||||
case WEEKS:
|
||||
maxDateForFixedLength = startDate.plusWeeks(fixedLength);
|
||||
break;
|
||||
case MONTHS:
|
||||
maxDateForFixedLength = startDate.plusMonths(fixedLength);
|
||||
break;
|
||||
case YEARS:
|
||||
maxDateForFixedLength = startDate.plusYears(fixedLength);
|
||||
break;
|
||||
case INVALID:
|
||||
break;
|
||||
case WHOLE_TERM:
|
||||
log.error("TODO Implement repaymentPeriodFrequencyType for WHOLE_TERM");
|
||||
break;
|
||||
}
|
||||
return maxDateForFixedLength;
|
||||
}
|
||||
|
||||
public LocalDate getRepaymentStartDate() {
|
||||
final RepaymentStartDateType repaymentStartDateType = getRepaymentStartDateType();
|
||||
return RepaymentStartDateType.DISBURSEMENT_DATE.equals(repaymentStartDateType) ? getExpectedDisbursementDate()
|
||||
: getSubmittedOnDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user