Skip to content

Commit c84ba08

Browse files
committed
Revert "FINERACT-2181: Fix overdue balance updates in advanced payment schedu…"
This reverts commit 46e1bd0.
1 parent 81d6d2e commit c84ba08

File tree

2 files changed

+15
-35
lines changed

2 files changed

+15
-35
lines changed

fineract-e2e-tests-runner/src/test/resources/features/EMICalculation.feature

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,12 +2949,12 @@ Feature: EMI calculation and repayment schedule checks for interest bearing loan
29492949
| 1 | 31 | 01 February 2024 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 |
29502950
| 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 10.0 | 0.0 | 10.0 | 7.01 |
29512951
| 3 | 31 | 01 April 2024 | | 50.53 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
2952-
| 4 | 30 | 01 May 2024 | | 33.81 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
2953-
| 5 | 31 | 01 June 2024 | | 17.0 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
2954-
| 6 | 30 | 01 July 2024 | | 0.0 | 17.0 | 0.1 | 0.0 | 0.0 | 17.1 | 0.0 | 0.0 | 0.0 | 17.1 |
2952+
| 4 | 30 | 01 May 2024 | | 33.91 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
2953+
| 5 | 31 | 01 June 2024 | | 17.19 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
2954+
| 6 | 30 | 01 July 2024 | | 0.0 | 17.19 | 0.2 | 0.0 | 0.0 | 17.39 | 0.0 | 0.0 | 0.0 | 17.39 |
29552955
Then Loan Repayment schedule has the following data in Total row:
29562956
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
2957-
| 100.0 | 2.15 | 0.0 | 0.0 | 102.15 | 27.01 | 0.0 | 10.0 | 75.14 |
2957+
| 100.0 | 2.44 | 0.0 | 0.0 | 102.44 | 27.01 | 0.0 | 10.0 | 75.43 |
29582958
Then Loan Transactions tab has the following data:
29592959
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
29602960
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
@@ -2969,12 +2969,12 @@ Feature: EMI calculation and repayment schedule checks for interest bearing loan
29692969
| 1 | 31 | 01 February 2024 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 |
29702970
| 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 10.0 | 0.0 | 10.0 | 7.01 |
29712971
| 3 | 31 | 01 April 2024 | | 50.53 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
2972-
| 4 | 30 | 01 May 2024 | | 33.81 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
2973-
| 5 | 31 | 01 June 2024 | | 17.0 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
2974-
| 6 | 30 | 01 July 2024 | | 0.0 | 17.0 | 0.1 | 0.0 | 0.0 | 17.1 | 0.0 | 0.0 | 0.0 | 17.1 |
2972+
| 4 | 30 | 01 May 2024 | | 33.95 | 16.58 | 0.43 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
2973+
| 5 | 31 | 01 June 2024 | | 17.27 | 16.68 | 0.33 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
2974+
| 6 | 30 | 01 July 2024 | | 0.0 | 17.27 | 0.24 | 0.0 | 0.0 | 17.51 | 0.0 | 0.0 | 0.0 | 17.51 |
29752975
Then Loan Repayment schedule has the following data in Total row:
29762976
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
2977-
| 100.0 | 2.15 | 0.0 | 0.0 | 102.15 | 27.01 | 0.0 | 10.0 | 75.14 |
2977+
| 100.0 | 2.56 | 0.0 | 0.0 | 102.56 | 27.01 | 0.0 | 10.0 | 75.55 |
29782978
Then Loan Transactions tab has the following data:
29792979
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
29802980
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
@@ -7890,10 +7890,10 @@ Feature: EMI calculation and repayment schedule checks for interest bearing loan
78907890
| 3 | 31 | 01 April 2025 | | 4661.9 | 1112.7 | 576.13 | 0.0 | 0.0 | 1688.83 | 0.0 | 0.0 | 0.0 | 1688.83 |
78917891
| 4 | 30 | 01 May 2025 | | 3549.2 | 1112.7 | 576.13 | 0.0 | 0.0 | 1688.83 | 0.0 | 0.0 | 0.0 | 1688.83 |
78927892
| 5 | 31 | 01 June 2025 | | 2436.5 | 1112.7 | 576.13 | 0.0 | 0.0 | 1688.83 | 0.0 | 0.0 | 0.0 | 1688.83 |
7893-
| 6 | 30 | 01 July 2025 | | 0.0 | 2436.5 | 576.13 | 0.0 | 0.0 | 3012.63 | 0.0 | 0.0 | 0.0 | 3012.63 |
7893+
| 6 | 30 | 01 July 2025 | | 0.0 | 2436.5 | 896.66 | 0.0 | 0.0 | 3333.16 | 0.0 | 0.0 | 0.0 | 3333.16 |
78947894
And Loan Repayment schedule has the following data in Total row:
78957895
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
7896-
| 8000.0 | 3456.78 | 0.0 | 0.0 | 11456.78 | 0.05 | 0.0 | 0.04 | 11456.73 |
7896+
| 8000.0 | 3777.31 | 0.0 | 0.0 | 11777.31 | 0.05 | 0.0 | 0.04 | 11777.26 |
78977897

78987898
@TestRailId:C3657
78997899
Scenario: Verify tranche interest bearing progressive loan that expects two tranches with repayment and undo last disbursement - UC1
@@ -9631,4 +9631,4 @@ Feature: EMI calculation and repayment schedule checks for interest bearing loan
96319631
| Type | Account code | Account name | Debit | Credit |
96329632
| ASSET | 112601 | Loans Receivable | | 906.25 |
96339633
| ASSET | 112603 | Interest/Fee Receivable | | 16.87 |
9634-
| LIABILITY | 145023 | Suspense/Clearing account | 923.12 | |
9634+
| LIABILITY | 145023 | Suspense/Clearing account | 923.12 | |

fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,8 +1570,10 @@ private void adjustOverduePrincipalForInstallment(LocalDate currentDate, LoanRep
15701570
} else {
15711571
lastOverdueBalanceChange = currentDate;
15721572
}
1573-
emiCalculator.addBalanceCorrection(ctx.getModel(), lastOverdueBalanceChange, aggregatedOverDuePrincipal.negated());
1574-
ctx.getModel().lastOverdueBalanceChange(lastOverdueBalanceChange);
1573+
if (DateUtils.isBefore(ctx.getModel().lastOverdueBalanceChange(), toDate)) {
1574+
emiCalculator.addBalanceCorrection(ctx.getModel(), lastOverdueBalanceChange, aggregatedOverDuePrincipal.negated());
1575+
ctx.getModel().lastOverdueBalanceChange(lastOverdueBalanceChange);
1576+
}
15751577
}
15761578
}
15771579

@@ -1597,32 +1599,10 @@ private void handleRepayment(LoanTransaction loanTransaction, TransactionCtx tra
15971599
if (loanTransaction.isRepaymentLikeType() || loanTransaction.isInterestWaiver() || loanTransaction.isRecoveryRepayment()) {
15981600
loanTransaction.resetDerivedComponents();
15991601
}
1600-
calculateUnrecognizedInterestForClosedPeriodByInterestRecalculationStrategy(loanTransaction, transactionCtx);
1601-
16021602
Money transactionAmountUnprocessed = loanTransaction.getAmount(transactionCtx.getCurrency());
16031603
processTransaction(loanTransaction, transactionCtx, transactionAmountUnprocessed);
16041604
}
16051605

1606-
private void calculateUnrecognizedInterestForClosedPeriodByInterestRecalculationStrategy(LoanTransaction loanTransaction,
1607-
TransactionCtx transactionCtx) {
1608-
if (transactionCtx instanceof ProgressiveTransactionCtx progressiveTransactionCtx && progressiveTransactionCtx.isPrepayAttempt()
1609-
&& loanTransaction.isRepaymentLikeType() && loanTransaction.getLoan().getLoanInterestRecalculationDetails()
1610-
.getPreCloseInterestCalculationStrategy().calculateTillRestFrequencyEnabled()) {
1611-
Optional<RepaymentPeriod> oCurrentRepaymentPeriod = progressiveTransactionCtx.getModel().repaymentPeriods().stream()
1612-
.filter(rm -> DateUtils.isDateInRangeFromInclusiveToExclusive(rm.getFromDate(), rm.getDueDate(),
1613-
loanTransaction.getTransactionDate()))
1614-
.findFirst();
1615-
if (oCurrentRepaymentPeriod.isPresent() && oCurrentRepaymentPeriod.get().isFullyPaid()) {
1616-
RepaymentPeriod currentRepaymentPeriod = oCurrentRepaymentPeriod.get();
1617-
OutstandingDetails outstandingAmountsTillDate = emiCalculator
1618-
.getOutstandingAmountsTillDate(progressiveTransactionCtx.getModel(), currentRepaymentPeriod.getDueDate());
1619-
if (outstandingAmountsTillDate.getOutstandingInterest().isGreaterThanZero()) {
1620-
currentRepaymentPeriod.setFutureUnrecognizedInterest(outstandingAmountsTillDate.getOutstandingInterest());
1621-
}
1622-
}
1623-
}
1624-
}
1625-
16261606
private LoanTransactionToRepaymentScheduleMapping getTransactionMapping(
16271607
List<LoanTransactionToRepaymentScheduleMapping> transactionMappings, LoanTransaction loanTransaction,
16281608
LoanRepaymentScheduleInstallment currentInstallment, MonetaryCurrency currency) {

0 commit comments

Comments
 (0)