FINERACT-2265: Progressive Loan - Interest Recalculation fails for - RecalculationRestFrequencyType SameAsRepaymentPeriod

This commit is contained in:
Soma Sörös
2025-04-22 15:19:11 +02:00
committed by Adam Saghy
parent 9660ca8f97
commit a1d51e1e34
3 changed files with 63 additions and 29 deletions
@@ -675,8 +675,8 @@ public class LoanCOBCreateAccrualsTest extends BaseLoanIntegrationTest {
validateTransactionsExist(loanDetails, //
transaction(0.30, "Accrual", "19 February 2025", 0.0, 0.0, 0.30, 0.0, 0.0, 0.0, 0.0), //
transaction(0.30, "Accrual", "20 February 2025", 0.0, 0.0, 0.30, 0.0, 0.0, 0.0, 0.0), //
transaction(0.23, "Accrual", "21 February 2025", 0.0, 0.0, 0.23, 0.0, 0.0, 0.0, 0.0), //
transaction(0.22, "Accrual", "22 February 2025", 0.0, 0.0, 0.22, 0.0, 0.0, 0.0, 0.0)); //
transaction(0.33, "Accrual", "21 February 2025", 0.0, 0.0, 0.33, 0.0, 0.0, 0.0, 0.0), //
transaction(0.34, "Accrual", "22 February 2025", 0.0, 0.0, 0.34, 0.0, 0.0, 0.0, 0.0)); //
});
}
@@ -93,6 +93,53 @@ public class LoanInterestRecalculationCOBTest extends BaseLoanIntegrationTest {
period.getPrincipalDue(), period.getFeeChargesDue(), period.getPenaltyChargesDue(), period.getInterestDue()));
}
@Test
public void testInterestRecalculationInCaseOfTinyAmountOfRepaymentsEveryRepaymentPeriodForProgressiveLoanSameAsRepaymentPeriod() {
AtomicReference<Long> loanIdRef = new AtomicReference<>();
runAt("1 January 2023", () -> {
PostLoanProductsResponse loanProduct = loanProductHelper.createLoanProduct(create4IProgressive() //
.recalculationRestFrequencyType(RecalculationRestFrequencyType.SAME_AS_REPAYMENT_PERIOD) //
);//
Long loanId = applyAndApproveProgressiveLoan(client.getClientId(), loanProduct.getResourceId(), "1 January 2023", 10000.0,
86.42, 6, null);
loanIdRef.set(loanId);
disburseLoan(loanId, BigDecimal.valueOf(8000), "1 January 2023");
});
runAt("1 February 2023", () -> {
Long loanId = loanIdRef.get();
loanTransactionHelper.makeLoanRepayment(loanId, "Repayment", "1 February 2023", 0.01);
});
runAt("1 March 2023", () -> {
Long loanId = loanIdRef.get();
loanTransactionHelper.makeLoanRepayment(loanId, "Repayment", "1 March 2023", 0.01);
});
runAt("1 April 2023", () -> {
Long loanId = loanIdRef.get();
loanTransactionHelper.makeLoanRepayment(loanId, "Repayment", "1 April 2023", 0.01);
});
runAt("1 May 2023", () -> {
Long loanId = loanIdRef.get();
loanTransactionHelper.makeLoanRepayment(loanId, "Repayment", "1 May 2023", 0.01);
});
runAt("1 June 2023", () -> {
Long loanId = loanIdRef.get();
loanTransactionHelper.makeLoanRepayment(loanId, "Repayment", "1 June 2023", 0.01);
});
runAt("17 June 2023", () -> {
Long loanId = loanIdRef.get();
inlineLoanCOBHelper.executeInlineCOB(List.of(loanId));
verifyRepaymentSchedule(loanId, //
installment(8000.0, null, "01 January 2023"), //
installment(1112.7, 576.13, 1688.78, false, "01 February 2023"), //
installment(1112.7, 576.13, 1688.83, false, "01 March 2023"), //
installment(1112.7, 576.13, 1688.83, false, "01 April 2023"), //
installment(1112.7, 576.13, 1688.83, false, "01 May 2023"), //
installment(1112.7, 576.13, 1688.83, false, "01 June 2023"), //
installment(2436.5, 576.13, 3012.63, false, "01 July 2023") //
);
});
}
@Test
public void verifyLoanInstallmentRecalculatedIfThereIsOverdueInstallmentOn4IProgressiveLoanCOBStepDaily() {
AtomicReference<Long> loanIdRef = new AtomicReference<>();