FINERACT-1450-fix (#2177)

This commit is contained in:
Manoj
2022-03-28 22:41:36 +05:30
committed by GitHub
parent 35d0c4fbce
commit bc0b5c00bb
7 changed files with 317 additions and 18 deletions
@@ -177,7 +177,6 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
isFirstRepayment = false;
}
while (!scheduleParams.getOutstandingBalance().isZero() || !scheduleParams.getDisburseDetailMap().isEmpty()) {
LocalDate previousRepaymentDate = scheduleParams.getActualRepaymentDate();
scheduleParams.setActualRepaymentDate(this.scheduledDateGenerator
@@ -2196,16 +2195,32 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
actualRepaymentDate = lastInstallmentDate;
}
isFirstRepayment = false;
LocalDate prevLastInstDate = lastInstallmentDate;
lastInstallmentDate = this.scheduledDateGenerator
.adjustRepaymentDate(actualRepaymentDate, loanApplicationTerms, holidayDetailDTO).getChangedScheduleDate();
LocalDate modifiedLastInstDate = null;
LoanTermVariationsData variation1 = null;
while (loanApplicationTerms.getLoanTermVariations().hasDueDateVariation(lastInstallmentDate)) {
LoanTermVariationsData variation = loanApplicationTerms.getLoanTermVariations().nextDueDateVariation();
if (!variation.isSpecificToInstallment()) {
actualRepaymentDate = variation.getDateValue();
lastInstallmentDate = actualRepaymentDate;
modifiedLastInstDate = variation.getDateValue();
variation1 = variation;
}
dueDateVariationsDataList.add(variation);
}
if (!lastInstallmentDate.isEqual(installment.getDueDate())
&& !installment.getDueDate().equals(modifiedLastInstDate)) {
lastInstallmentDate = prevLastInstDate;
actualRepaymentDate = lastInstallmentDate;
if (modifiedLastInstDate != null) {
loanApplicationTerms.getLoanTermVariations().previousDueDateVariation();
}
} else if (installment.getDueDate().equals(modifiedLastInstDate)) {
actualRepaymentDate = modifiedLastInstDate;
lastInstallmentDate = actualRepaymentDate;
dueDateVariationsDataList.add(variation1);
}
loanTermVariationParams = applyExceptionLoanTermVariations(loanApplicationTerms, lastInstallmentDate,
exceptionDataListIterator, instalmentNumber, totalCumulativePrincipal, totalCumulativeInterest, mc);
} while (loanTermVariationParams != null && loanTermVariationParams.isSkipPeriod());
@@ -338,11 +338,12 @@ public class DefaultScheduledDateGenerator implements ScheduledDateGenerator {
generatedDate = loanApplicationTerms.getNewScheduledDueDateStart();
isFirstRepayment = false;
}
while (!generatedDate.isAfter(lastRepaymentDate)) {
LocalDate adjustedDate = generatedDate;
while (!adjustedDate.isAfter(lastRepaymentDate)) {
generatedDate = generateNextRepaymentDate(generatedDate, loanApplicationTerms, isFirstRepayment);
adjustedDate = adjustRepaymentDate(generatedDate, loanApplicationTerms, holidayDetailDTO).getChangedScheduleDate();
isFirstRepayment = false;
}
generatedDate = adjustRepaymentDate(generatedDate, loanApplicationTerms, holidayDetailDTO).getChangedScheduleDate();
return generatedDate;
return adjustedDate;
}
}