FINERACT-2421: Pay-off amount incorrectly calculated if the loan has more than one downpayment

This commit is contained in:
mariiaKraievska
2026-02-18 11:01:35 +00:00
committed by Adam Saghy
parent 115063b89e
commit 2634e54fdd
3 changed files with 184 additions and 7 deletions
@@ -208,11 +208,10 @@ public class ProgressiveLoanScheduleGenerator implements LoanScheduleGenerator {
.interest(outstandingAmounts.getOutstandingInterest());//
if (loan.isProgressiveSchedule()) {
final LoanRepaymentScheduleInstallment downPaymentInstallment = loan.getRepaymentScheduleInstallments(i -> i.isDownPayment())
.stream().findFirst().orElse(null);
if (downPaymentInstallment != null) {
result.principal(downPaymentInstallment.getPrincipalOutstanding(loan.getCurrency())
.add(outstandingAmounts.getOutstandingPrincipal()));
final List<LoanRepaymentScheduleInstallment> downPaymentInstallments = loan
.getRepaymentScheduleInstallments(LoanRepaymentScheduleInstallment::isDownPayment).stream().toList();
for (final LoanRepaymentScheduleInstallment installment : downPaymentInstallments) {
result.plusPrincipal(installment.getPrincipalOutstanding(loan.getCurrency()));
}
}
// We need to deduct any paid amount if there is no interest recalculation