FINERACT-2389: Pay-Off amount incorrectly calculated when downpayment
This commit is contained in:
committed by
Adam Saghy
parent
60526f0ce9
commit
2681ee3518
@@ -1699,7 +1699,6 @@ Feature: Capitalized Income
|
|||||||
| 100.0 | 83.33 | 16.67 | 0.0 | 0.0 |
|
| 100.0 | 83.33 | 16.67 | 0.0 | 0.0 |
|
||||||
|
|
||||||
When Loan Pay-off is made on "26 January 2024"
|
When Loan Pay-off is made on "26 January 2024"
|
||||||
And Customer makes "AUTOPAY" repayment on "26 January 2024" with 225 EUR transaction amount
|
|
||||||
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
|
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
|
||||||
|
|
||||||
@TestRailId:C3673
|
@TestRailId:C3673
|
||||||
|
|||||||
+9
@@ -205,10 +205,19 @@ public class ProgressiveLoanScheduleGenerator implements LoanScheduleGenerator {
|
|||||||
ProgressiveLoanInterestScheduleModel model = savedModel.orElseThrow();
|
ProgressiveLoanInterestScheduleModel model = savedModel.orElseThrow();
|
||||||
OutstandingDetails outstandingAmounts = emiCalculator.getOutstandingAmountsTillDate(model, transactionDate);
|
OutstandingDetails outstandingAmounts = emiCalculator.getOutstandingAmountsTillDate(model, transactionDate);
|
||||||
// TODO: We should add all the past due outstanding amounts as well
|
// TODO: We should add all the past due outstanding amounts as well
|
||||||
|
|
||||||
OutstandingAmountsDTO result = new OutstandingAmountsDTO(currency) //
|
OutstandingAmountsDTO result = new OutstandingAmountsDTO(currency) //
|
||||||
.principal(outstandingAmounts.getOutstandingPrincipal()) //
|
.principal(outstandingAmounts.getOutstandingPrincipal()) //
|
||||||
.interest(outstandingAmounts.getOutstandingInterest());//
|
.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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
// We need to deduct any paid amount if there is no interest recalculation
|
// We need to deduct any paid amount if there is no interest recalculation
|
||||||
if (!loan.isInterestRecalculationEnabled()) {
|
if (!loan.isInterestRecalculationEnabled()) {
|
||||||
BigDecimal paidInterest = installments.stream().map(LoanRepaymentScheduleInstallment::getInterestPaid).reduce(BigDecimal.ZERO,
|
BigDecimal paidInterest = installments.stream().map(LoanRepaymentScheduleInstallment::getInterestPaid).reduce(BigDecimal.ZERO,
|
||||||
|
|||||||
Reference in New Issue
Block a user