FINERACT-1748: Loan prepayment issue after advance payment

This commit is contained in:
logoutdhaval
2022-10-10 15:56:50 +02:00
committed by Arnold Gálovics
parent 47c9b93d27
commit ba1d0ce66c
3 changed files with 219 additions and 2 deletions
@@ -2225,7 +2225,9 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
.adjustRepaymentDate(actualRepaymentDate, loanApplicationTerms, holidayDetailDTO).getChangedScheduleDate();
LocalDate modifiedLastInstDate = null;
LoanTermVariationsData variation1 = null;
boolean hasDueDateVariation = false;
while (loanApplicationTerms.getLoanTermVariations().hasDueDateVariation(lastInstallmentDate)) {
hasDueDateVariation = true;
LoanTermVariationsData variation = loanApplicationTerms.getLoanTermVariations().nextDueDateVariation();
if (!variation.isSpecificToInstallment()) {
modifiedLastInstDate = variation.getDateValue();
@@ -2233,7 +2235,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
}
}
if (!lastInstallmentDate.isEqual(installment.getDueDate())
if (hasDueDateVariation && !lastInstallmentDate.isEqual(installment.getDueDate())
&& !installment.getDueDate().equals(modifiedLastInstDate)) {
lastInstallmentDate = prevLastInstDate;
actualRepaymentDate = lastInstallmentDate;