You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ad...@apache.org on 2025/12/01 18:12:30 UTC
(fineract) 02/02: FINERACT-2389: e2e test scenarios with pay-off after contract termination
This is an automated email from the ASF dual-hosted git repository.
adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
commit 949fcc9e0e285ffaecca1a46c4bd1654f08a3884
Author: MarianaDmytrivBinariks <md...@binariks.com>
AuthorDate: Thu Nov 27 17:57:39 2025 +0200
FINERACT-2389: e2e test scenarios with pay-off after contract termination
---
.../features/LoanContractTermination.feature | 136 ++++++++++++++++++++-
.../test/resources/features/LoanReAging.feature | 67 +---------
.../resources/features/LoanReAgingPreview.feature | 6 +
.../LoanTransactionProcessingServiceImpl.java | 2 +-
4 files changed, 148 insertions(+), 63 deletions(-)
diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanContractTermination.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanContractTermination.feature
index 920a71f49d..c06637716e 100644
--- a/fineract-e2e-tests-runner/src/test/resources/features/LoanContractTermination.feature
+++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanContractTermination.feature
@@ -60,6 +60,9 @@ Feature: Contract Termination
| 01 March 2024 | Accrual | 1.07 | 0.0 | 1.07 | 0.0 | 0.0 | 0.0 | false | false |
| 01 March 2024 | Contract Termination | 84.06 | 83.57 | 0.49 | 0.0 | 0.0 | 0.0 | false | false |
+ When Loan Pay-off is made on "1 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C3679
Scenario: As a user I want to perform contract termination to a progressive loan with interest recalculation before installment date - S2
When Admin sets the business date to "01 January 2024"
@@ -119,6 +122,9 @@ Feature: Contract Termination
| 29 February 2024 | Accrual | 1.05 | 0.0 | 1.05 | 0.0 | 0.0 | 0.0 | false | false |
| 29 February 2024 | Contract Termination | 84.04 | 83.57 | 0.47 | 0.0 | 0.0 | 0.0 | false | false |
+ When Loan Pay-off is made on "29 February 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C3680
Scenario: As a user I want to perform contract termination to a progressive loan with interest recalculation in the middle of installment period - S3
When Admin sets the business date to "01 January 2024"
@@ -178,6 +184,9 @@ Feature: Contract Termination
| 14 February 2024 | Accrual | 0.8 | 0.0 | 0.8 | 0.0 | 0.0 | 0.0 | false | false |
| 14 February 2024 | Contract Termination | 83.79 | 83.57 | 0.22 | 0.0 | 0.0 | 0.0 | false | false |
+ When Loan Pay-off is made on "14 February 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C3681
Scenario: As a user I want to perform contract termination to a progressive loan with interest recalculation after maturity date - S4
Given Global configuration "is-principal-compounding-disabled-for-overdue-loans" is enabled
@@ -253,6 +262,10 @@ Feature: Contract Termination
| 01 May 2024 | Repayment | 17.01 | 16.72 | 0.29 | 0.0 | 0.0 | 33.71 | false | false |
| 15 July 2024 | Accrual | 2.15 | 0.0 | 2.15 | 0.0 | 0.0 | 0.0 | false | false |
| 15 July 2024 | Contract Termination | 34.11 | 33.71 | 0.4 | 0.0 | 0.0 | 0.0 | false | false |
+
+ When Loan Pay-off is made on "15 July 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
Given Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C3682
@@ -333,6 +346,9 @@ Feature: Contract Termination
| 31 March 2024 | Accrual | 1.54 | 0.0 | 1.54 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Contract Termination | 84.53 | 83.57 | 0.96 | 0.0 | 0.0 | 0.0 | false | false |
+ When Loan Pay-off is made on "02 April 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C3683
Scenario: As a user I want to perform contract termination to a progressive loan with interest recalculation when backdated repayment occurs after - S6
Given Global configuration "is-principal-compounding-disabled-for-overdue-loans" is enabled
@@ -411,6 +427,10 @@ Feature: Contract Termination
| 31 March 2024 | Accrual | 1.54 | 0.0 | 1.54 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Accrual Adjustment | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Contract Termination | 67.43 | 67.05 | 0.38 | 0.0 | 0.0 | 0.0 | false | true |
+
+ When Loan Pay-off is made on "31 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C3684
@@ -488,6 +508,10 @@ Feature: Contract Termination
| 29 February 2024 | Accrual | 1.05 | 0.0 | 1.05 | 0.0 | 0.0 | 0.0 | false | false |
| 29 February 2024 | Accrual | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false |
| 29 February 2024 | Contract Termination | 101.14 | 100.0 | 1.14 | 0.0 | 0.0 | 0.0 | false | true |
+
+ When Loan Pay-off is made on "29 February 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C3685
@@ -566,6 +590,10 @@ Feature: Contract Termination
| 29 February 2024 | Accrual | 1.05 | 0.0 | 1.05 | 0.0 | 0.0 | 0.0 | false | false |
| 29 February 2024 | Contract Termination | 84.04 | 83.57 | 0.47 | 0.0 | 0.0 | 0.0 | false | false |
| 01 March 2024 | Repayment | 17.01 | 16.54 | 0.47 | 0.0 | 0.0 | 67.03 | false | false |
+
+ When Loan Pay-off is made on "01 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C3686
@@ -628,6 +656,9 @@ Feature: Contract Termination
| 01 March 2024 | Accrual | 1.07 | 0.0 | 1.07 | 0.0 | 0.0 | 0.0 | false | false |
| 01 March 2024 | Contract Termination | 89.06 | 83.57 | 0.49 | 5.0 | 0.0 | 0.0 | false | false |
+ When Loan Pay-off is made on "01 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C3687
Scenario: As a user I want to perform contract termination to a progressive loan with interest recalculation when one fee charge is added after contract termination - S9-2
When Admin sets the business date to "01 January 2024"
@@ -689,6 +720,9 @@ Feature: Contract Termination
| 01 March 2024 | Accrual | 1.07 | 0.0 | 1.07 | 0.0 | 0.0 | 0.0 | false | false |
| 01 March 2024 | Contract Termination | 89.06 | 83.57 | 0.49 | 5.0 | 0.0 | 0.0 | false | false |
+ When Loan Pay-off is made on "01 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C3688
Scenario: As a user I want to perform contract termination to a progressive loan with interest recalculation when contract termination occurs with adjustment to last installment - S10
When Admin sets the business date to "01 January 2024"
@@ -748,6 +782,9 @@ Feature: Contract Termination
| 29 February 2024 | Accrual | 1.0 | 0.0 | 1.0 | 0.0 | 0.0 | 0.0 | false | false |
| 29 February 2024 | Contract Termination | 83.99 | 82.99 | 1.0 | 0.0 | 0.0 | 0.0 | false | false |
+ When Loan Pay-off is made on "29 February 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C3689
Scenario: As a user I want to perform contract termination to a progressive loan with interest recalculation when contract termination occurs with allocation to last installment with interest allocation change - S11
When Admin sets the business date to "01 January 2024"
@@ -827,6 +864,9 @@ Feature: Contract Termination
| 29 February 2024 | Accrual | 1.0 | 0.0 | 1.0 | 0.0 | 0.0 | 0.0 | false | false |
| 29 February 2024 | Contract Termination | 66.98 | 66.8 | 0.18 | 0.0 | 0.0 | 0.0 | false | false |
+ When Loan Pay-off is made on "29 February 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C3724
Scenario: As a user I want to perform contract termination to a progressive loan with interest recalculation when backdated full repayment occurs after - S12
Given Global configuration "is-principal-compounding-disabled-for-overdue-loans" is enabled
@@ -907,6 +947,8 @@ Feature: Contract Termination
| 01 March 2024 | Repayment | 84.06 | 83.57 | 0.49 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Accrual | 1.54 | 0.0 | 1.54 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Accrual Adjustment | 0.47 | 0.0 | 0.47 | 0.0 | 0.0 | 0.0 | false | false |
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C3725
@@ -987,6 +1029,10 @@ Feature: Contract Termination
| 31 March 2024 | Accrual | 1.54 | 0.0 | 1.54 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Accrual Adjustment | 0.15 | 0.0 | 0.15 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Contract Termination | 57.37 | 57.05 | 0.32 | 0.0 | 0.0 | 0.0 | false | true |
+
+ When Loan Pay-off is made on "31 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C3726
@@ -1047,6 +1093,10 @@ Feature: Contract Termination
| 31 March 2024 | Accrual | 1.72 | 0.0 | 1.72 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Accrual Adjustment | 0.56 | 0.0 | 0.56 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Contract Termination | 31.16 | 31.16 | 0.0 | 0.0 | 0.0 | 0.0 | false | true |
+
+ When Loan Pay-off is made on "31 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C3738
@@ -1127,6 +1177,9 @@ Feature: Contract Termination
| 01 March 2024 | Accrual | 1.07 | 0.0 | 1.07 | 0.0 | 0.0 | 0.0 | false | false |
| 01 March 2024 | Contract Termination | 84.06 | 83.57 | 0.49 | 0.0 | 0.0 | 0.0 | true | false |
+ When Loan Pay-off is made on "01 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C3760
Scenario: Verify contract termination undo when backdated repayment occurs - S6
Given Global configuration "is-principal-compounding-disabled-for-overdue-loans" is enabled
@@ -1176,7 +1229,11 @@ Feature: Contract Termination
| 01 March 2024 | Repayment | 17.01 | 16.52 | 0.49 | 0.0 | 0.0 | 67.05 | false | false |
| 31 March 2024 | Accrual | 1.54 | 0.0 | 1.54 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Accrual Adjustment | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false |
- | 31 March 2024 | Contract Termination | 67.43 | 67.05 | 0.38 | 0.0 | 0.0 | 0.0 | true | true |
+ | 31 March 2024 | Contract Termination | 67.43 | 67.05 | 0.38 | 0.0 | 0.0 | 0.0 | true | true |
+
+ When Loan Pay-off is made on "31 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C3761
@@ -1227,6 +1284,10 @@ Feature: Contract Termination
| 29 February 2024 | Accrual | 1.05 | 0.0 | 1.05 | 0.0 | 0.0 | 0.0 | false | false |
| 29 February 2024 | Accrual | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false |
| 29 February 2024 | Contract Termination | 101.14 | 100.0 | 1.14 | 0.0 | 0.0 | 0.0 | true | true |
+
+ When Loan Pay-off is made on "29 February 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C3762
@@ -1269,6 +1330,8 @@ Feature: Contract Termination
| 01 March 2024 | Repayment | 84.06 | 83.57 | 0.49 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Accrual | 1.54 | 0.0 | 1.54 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Accrual Adjustment | 0.47 | 0.0 | 0.47 | 0.0 | 0.0 | 0.0 | false | false |
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C3763
@@ -1316,6 +1379,10 @@ Feature: Contract Termination
| 31 March 2024 | Accrual | 1.54 | 0.0 | 1.54 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Accrual Adjustment | 0.15 | 0.0 | 0.15 | 0.0 | 0.0 | 0.0 | false | false |
| 31 March 2024 | Contract Termination | 57.37 | 57.05 | 0.32 | 0.0 | 0.0 | 0.0 | true | true |
+
+ When Loan Pay-off is made on "31 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
@TestRailId:C4133
@@ -1340,6 +1407,9 @@ Feature: Contract Termination
| 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
| 01 January 2025 | Contract Termination | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
+ When Loan Pay-off is made on "01 January 2025"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C4134
Scenario: Contract termination on disbursement date with interest recognition
When Admin sets the business date to "01 January 2025"
@@ -1362,3 +1432,67 @@ Feature: Contract Termination
| 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
| 01 January 2025 | Contract Termination | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
+ When Loan Pay-off is made on "01 January 2025"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
+ @TestRailId:C4267 @AdvancedPaymentAllocation
+ Scenario: Verify Pay-Off done successfully after contract terminated loan
+ When Admin sets the business date to "01 January 2024"
+ When Admin creates a client with random data
+ When Admin set "LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule
+ When Admin creates a fully customized loan with the following data:
+ | 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 |
+ | 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 |
+ And Admin successfully approves the loan on "01 January 2024" with "100" amount and expected disbursement date on "01 January 2024"
+ When Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount
+ Then Loan Repayment schedule has 6 periods, with the following data for periods:
+ | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
+ | 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 |
+ | 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 |
+ | 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 |
+ | 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 |
+ | 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 |
+ | 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 |
+ Then Loan Repayment schedule has the following data in Total row:
+ | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | 100.0 | 2.05 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
+ Then Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
+ | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
+ When Admin sets the business date to "01 February 2024"
+ And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01 EUR transaction amount
+ Then Loan Repayment schedule has 6 periods, with the following data for periods:
+ | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
+ | 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 |
+ | 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 |
+ | 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 |
+ | 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 |
+ | 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 |
+ Then Loan Repayment schedule has the following data in Total row:
+ | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | 100.0 | 2.05 | 0.0 | 0.0 | 102.05 | 17.01 | 0.0 | 0.0 | 85.04 |
+ Then Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
+ | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
+ | 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false |
+ When Admin sets the business date to "1 March 2024"
+ And Admin successfully terminates loan contract
+ Then Loan Repayment schedule has 2 periods, with the following data for periods:
+ | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
+ | 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 |
+ | 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 |
+ Then Loan Repayment schedule has the following data in Total row:
+ | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | 100.0 | 1.07 | 0.0 | 0.0 | 101.07 | 17.01 | 0.0 | 0.0 | 84.06 |
+ Then Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
+ | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
+ | 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
+ | 01 March 2024 | Accrual | 1.07 | 0.0 | 1.07 | 0.0 | 0.0 | 0.0 | false | false |
+ | 01 March 2024 | Contract Termination | 84.06 | 83.57 | 0.49 | 0.0 | 0.0 | 0.0 | false | false |
+
+ When Loan Pay-off is made on "01 March 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature
index 7aa231a07b..b3ea78b1a5 100644
--- a/fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature
+++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature
@@ -5421,6 +5421,7 @@ Feature: LoanReAging
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
+
When Admin sets the business date to "01 February 2024"
And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01 EUR transaction amount
Then Loan Repayment schedule has 6 periods, with the following data for periods:
@@ -5439,6 +5440,7 @@ Feature: LoanReAging
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false |
+
When Admin sets the business date to "1 March 2024"
And Admin successfully terminates loan contract
Then Loan Repayment schedule has 2 periods, with the following data for periods:
@@ -5455,11 +5457,15 @@ Feature: LoanReAging
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
| 01 March 2024 | Accrual | 1.07 | 0.0 | 1.07 | 0.0 | 0.0 | 0.0 | false | false |
| 01 March 2024 | Contract Termination | 84.06 | 83.57 | 0.49 | 0.0 | 0.0 | 0.0 | false | false |
+
When Admin sets the business date to "15 April 2024"
Then Admin fails to create a Loan re-aging transaction with the following data because loan was contract terminated:
| frequencyNumber | frequencyType | startDate | numberOfInstallments |
| 1 | MONTHS | 01 May 2024 | 6 |
+ When Loan Pay-off is made on "15 April 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C4090 @AdvancedPaymentAllocation
Scenario: Verify that Re-aging is forbidden on charged-off loan, interest bearing loan, Interest calculation: Default Behavior, Charge-off scenario (accelerate maturity) - UC11
When Admin sets the business date to "01 January 2024"
@@ -11846,64 +11852,3 @@ Feature: LoanReAging
When Loan Pay-off is made on "01 April 2024"
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
- @TestRailId:C4XXX @AdvancedPaymentAllocation
- Scenario: Verify Pay-Off done successfully after contract terminated loan
- When Admin sets the business date to "01 January 2024"
- When Admin creates a client with random data
- When Admin set "LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule
- When Admin creates a fully customized loan with the following data:
- | 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 |
- | 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 |
- And Admin successfully approves the loan on "01 January 2024" with "100" amount and expected disbursement date on "01 January 2024"
- When Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount
- Then Loan Repayment schedule has 6 periods, with the following data for periods:
- | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
- | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
- | 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 |
- | 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 |
- | 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 |
- | 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 |
- | 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 |
- | 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 |
- Then Loan Repayment schedule has the following data in Total row:
- | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
- | 100.0 | 2.05 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
- Then Loan Transactions tab has the following data:
- | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
- | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
- When Admin sets the business date to "01 February 2024"
- And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01 EUR transaction amount
- Then Loan Repayment schedule has 6 periods, with the following data for periods:
- | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
- | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
- | 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 |
- | 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 |
- | 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 |
- | 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 |
- | 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 |
- Then Loan Repayment schedule has the following data in Total row:
- | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
- | 100.0 | 2.05 | 0.0 | 0.0 | 102.05 | 17.01 | 0.0 | 0.0 | 85.04 |
- Then Loan Transactions tab has the following data:
- | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
- | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
- | 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false |
- When Admin sets the business date to "1 March 2024"
- And Admin successfully terminates loan contract
- Then Loan Repayment schedule has 2 periods, with the following data for periods:
- | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
- | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
- | 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 |
- | 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 |
- Then Loan Repayment schedule has the following data in Total row:
- | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
- | 100.0 | 1.07 | 0.0 | 0.0 | 101.07 | 17.01 | 0.0 | 0.0 | 84.06 |
- Then Loan Transactions tab has the following data:
- | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
- | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
- | 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
- | 01 March 2024 | Accrual | 1.07 | 0.0 | 1.07 | 0.0 | 0.0 | 0.0 | false | false |
- | 01 March 2024 | Contract Termination | 84.06 | 83.57 | 0.49 | 0.0 | 0.0 | 0.0 | false | false |
-
- When Loan Pay-off is made on "01 March 2024"
- Then Loan is closed with zero outstanding balance and it's all installments have obligations met
diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanReAgingPreview.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanReAgingPreview.feature
index 3c8de56223..d31754af19 100644
--- a/fineract-e2e-tests-runner/src/test/resources/features/LoanReAgingPreview.feature
+++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanReAgingPreview.feature
@@ -1033,6 +1033,7 @@ Feature: LoanReAgingPreview
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
+
When Admin sets the business date to "01 February 2024"
And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01 EUR transaction amount
Then Loan Repayment schedule has 6 periods, with the following data for periods:
@@ -1051,6 +1052,7 @@ Feature: LoanReAgingPreview
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false |
+
When Admin sets the business date to "1 March 2024"
And Admin successfully terminates loan contract
Then Loan Repayment schedule has 2 periods, with the following data for periods:
@@ -1067,11 +1069,15 @@ Feature: LoanReAgingPreview
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
| 01 March 2024 | Accrual | 1.07 | 0.0 | 1.07 | 0.0 | 0.0 | 0.0 | false | false |
| 01 March 2024 | Contract Termination | 84.06 | 83.57 | 0.49 | 0.0 | 0.0 | 0.0 | false | false |
+
When Admin sets the business date to "15 April 2024"
Then Admin fails to create a Loan re-aging preview with the following data because loan was contract terminated:
| frequencyNumber | frequencyType | startDate | numberOfInstallments |
| 1 | MONTHS | 01 May 2024 | 6 |
+ When Loan Pay-off is made on "15 April 2024"
+ Then Loan is closed with zero outstanding balance and it's all installments have obligations met
+
@TestRailId:C4217 @AdvancedPaymentAllocation
Scenario: Verify Re-aging preview on interest bearing loan - Interest calculation: Default Behavior - Fees and Interest Split after re-aging - UC12
When Admin sets the business date to "01 January 2024"
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java
index a23fa37ac0..41d7f4a1f0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java
@@ -153,7 +153,7 @@ public class LoanTransactionProcessingServiceImpl implements LoanTransactionProc
public OutstandingAmountsDTO fetchPrepaymentDetail(final ScheduleGeneratorDTO scheduleGeneratorDTO, final LocalDate onDate, Loan loan) {
OutstandingAmountsDTO outstandingAmounts;
- if (loan.isInterestBearingAndInterestRecalculationEnabled() && !loan.isChargeOffOnDate(onDate)) {
+ if (loan.isInterestBearingAndInterestRecalculationEnabled() && !loan.isChargeOffOnDate(onDate) && !loan.isContractTermination()) {
final MathContext mc = MoneyHelper.getMathContext();
final InterestMethod interestMethod = loan.getLoanRepaymentScheduleDetail().getInterestMethod();