FINERACT-2421: Pay-off amount incorrectly calculated if the loan has more than one downpayment
This commit is contained in:
committed by
Adam Saghy
parent
115063b89e
commit
2634e54fdd
+4
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user