FINERACT-1839: Fix N+1 installment due date

This commit is contained in:
Adam Saghy
2023-08-29 14:05:13 +02:00
committed by Arnold Gálovics
parent f1e70111b4
commit 001ad2fa1f
2 changed files with 19 additions and 3 deletions
@@ -372,9 +372,13 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen
loanTransactionMapped = true;
break;
// If already exists an additional installment just update
// If already exists an additional installment just update the due date and
// principal from the Loan chargeback / CBR transaction
} else if (currentInstallment.isAdditional()) {
if (transactionDate.isAfter(currentInstallment.getDueDate())) {
currentInstallment.updateDueDate(transactionDate);
}
currentInstallment.updateCredits(transactionDate, transactionAmount);
if (repaidAmount.isGreaterThanZero()) {
currentInstallment.payPrincipalComponent(loanTransaction.getTransactionDate(), repaidAmount);