Skip to content

Commit a5a290d

Browse files
Jose Alberto Hernandezadamsaghy
authored andcommitted
FINERACT-2389: Pay-Off amount calculated after Contract Termination
1 parent 00e9ac8 commit a5a290d

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

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

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11846,4 +11846,64 @@ Feature: LoanReAging
1184611846
When Loan Pay-off is made on "01 April 2024"
1184711847
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
1184811848

11849+
@TestRailId:C4XXX @AdvancedPaymentAllocation
11850+
Scenario: Verify Pay-Off done successfully after contract terminated loan
11851+
When Admin sets the business date to "01 January 2024"
11852+
When Admin creates a client with random data
11853+
When Admin set "LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule
11854+
When Admin creates a fully customized loan with the following data:
11855+
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
11856+
| LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION | 01 January 2024 | 100 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
11857+
And Admin successfully approves the loan on "01 January 2024" with "100" amount and expected disbursement date on "01 January 2024"
11858+
When Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount
11859+
Then Loan Repayment schedule has 6 periods, with the following data for periods:
11860+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
11861+
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
11862+
| 1 | 31 | 01 February 2024| | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
11863+
| 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
11864+
| 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
11865+
| 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
11866+
| 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
11867+
| 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.0 | 0.0 | 17.0 | 0.0 | 0.0 | 0.0 | 17.0 |
11868+
Then Loan Repayment schedule has the following data in Total row:
11869+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
11870+
| 100.0 | 2.05 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
11871+
Then Loan Transactions tab has the following data:
11872+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
11873+
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
11874+
When Admin sets the business date to "01 February 2024"
11875+
And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01 EUR transaction amount
11876+
Then Loan Repayment schedule has 6 periods, with the following data for periods:
11877+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
11878+
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
11879+
| 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 |
11880+
| 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
11881+
| 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
11882+
| 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
11883+
| 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.0 | 0.0 | 17.0 | 0.0 | 0.0 | 0.0 | 17.0 |
11884+
Then Loan Repayment schedule has the following data in Total row:
11885+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
11886+
| 100.0 | 2.05 | 0.0 | 0.0 | 102.05 | 17.01 | 0.0 | 0.0 | 85.04 |
11887+
Then Loan Transactions tab has the following data:
11888+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
11889+
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
11890+
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false |
11891+
When Admin sets the business date to "1 March 2024"
11892+
And Admin successfully terminates loan contract
11893+
Then Loan Repayment schedule has 2 periods, with the following data for periods:
11894+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
11895+
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
11896+
| 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 |
11897+
| 2 | 29 | 01 March 2024 | | 0.0 | 83.57 | 0.49 | 0.0 | 0.0 | 84.06 | 0.0 | 0.0 | 0.0 | 84.06 |
11898+
Then Loan Repayment schedule has the following data in Total row:
11899+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
11900+
| 100.0 | 1.07 | 0.0 | 0.0 | 101.07 | 17.01 | 0.0 | 0.0 | 84.06 |
11901+
Then Loan Transactions tab has the following data:
11902+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
11903+
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
11904+
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
11905+
| 01 March 2024 | Accrual | 1.07 | 0.0 | 1.07 | 0.0 | 0.0 | 0.0 | false | false |
11906+
| 01 March 2024 | Contract Termination | 84.06 | 83.57 | 0.49 | 0.0 | 0.0 | 0.0 | false | false |
1184911907

11908+
When Loan Pay-off is made on "01 March 2024"
11909+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,8 +3087,8 @@ private void updateRepaymentPeriodsAfterAccelerateMaturityDate(final Progressive
30873087

30883088
final RepaymentPeriod lastPeriod = periodsBeforeAccelerateMaturity.getLast();
30893089

3090-
final List<RepaymentPeriod> periodsToRemove = repaymentPeriods.stream().filter(rp -> rp.getFromDate().isAfter(transactionDate))
3091-
.toList();
3090+
final List<RepaymentPeriod> periodsToRemove = repaymentPeriods.stream()
3091+
.filter(rp -> DateUtils.isAfterInclusive(rp.getFromDate(), transactionDate)).toList();
30923092

30933093
lastPeriod.setDueDate(transactionDate);
30943094
lastPeriod.getInterestPeriods().removeIf(interestPeriod -> !interestPeriod.getFromDate().isBefore(transactionDate));

0 commit comments

Comments
 (0)