FINERACT-1981: When paying down payment, that should not be reflected on the InterestModel

This commit is contained in:
Andrii Kulminskyi
2024-11-04 12:38:09 +01:00
committed by Adam Saghy
parent d202145a88
commit 7288037614
2 changed files with 92 additions and 0 deletions
@@ -1549,6 +1549,14 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep
Money paidPortion;
ProgressiveLoanInterestScheduleModel model = ctx.getModel();
LocalDate payDate = loanTransaction.getTransactionDate();
if (installment.isDownPayment() || installment.getDueDate().isAfter(ctx.getModel().getMaturityDate())) {
// Skip interest and principal payment processing for down payment period or periods after loan maturity
// date
return processPaymentAllocation(paymentAllocationType, installment, loanTransaction, transactionAmountUnprocessed,
loanTransactionToRepaymentScheduleMapping, charges, balances, LoanRepaymentScheduleInstallment.PaymentAction.PAY);
}
if (DueType.IN_ADVANCE.equals(paymentAllocationType.getDueType())) {
payDate = calculateNewPayDateInCaseOfInAdvancePayment(loanTransaction, installment);
updateRepaymentPeriodBalances(paymentAllocationType, installment, model, payDate);