FINERACT-1981: Prepayment calculation

This commit is contained in:
Adam Saghy
2024-11-06 15:04:17 +01:00
parent 474623b6e3
commit 492ec44cef
16 changed files with 391 additions and 255 deletions
@@ -100,15 +100,15 @@ public class ProgressiveLoanInterestRefundServiceImpl implements InterestRefundS
loan.getRepaymentScheduleInstallments().stream().filter(i -> !i.isReAged() && !i.isAdditional()).toList());
Pair<ChangedTransactionDetail, ProgressiveLoanInterestScheduleModel> reprocessResult = processor
.reprocessProgressiveLoanTransactions(loan.getDisbursementDate(), transactionsToReprocess, loan.getCurrency(),
installmentsToReprocess, loan.getActiveCharges());
.reprocessProgressiveLoanTransactions(loan.getDisbursementDate(), relatedRefundTransactionDate, transactionsToReprocess,
loan.getCurrency(), installmentsToReprocess, loan.getActiveCharges());
loan.getLoanTransactions().addAll(reprocessResult.getLeft().getCurrentTransactionToOldId().keySet());
ProgressiveLoanInterestScheduleModel modelAfter = reprocessResult.getRight();
payableInterest = installmentsToReprocess.stream() //
.map(installment -> emiCalculator //
.getPayableDetails(modelAfter, installment.getDueDate(), relatedRefundTransactionDate) //
.getPayableInterest() //
.getDueAmounts(modelAfter, installment.getDueDate(), relatedRefundTransactionDate) //
.getDueInterest() //
.getAmount()) //
.reduce(BigDecimal.ZERO, BigDecimal::add); //
}