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


The following commit(s) were added to refs/heads/develop by this push:
     new faaf44d91 FINERACT-2148: Process monetary transaction after zero 
interest charge-off.
faaf44d91 is described below

commit faaf44d91aa0917ad90b551638915b0f7584a083
Author: mariiaKraievska <[email protected]>
AuthorDate: Tue Dec 24 12:48:36 2024 +0200

    FINERACT-2148: Process monetary transaction after zero interest charge-off.
---
 .../test/resources/features/LoanChargeOff.feature  | 204 +++++++++++++++++++++
 ...dvancedPaymentScheduleTransactionProcessor.java |   7 +-
 .../impl/ProgressiveTransactionCtx.java            |   2 +
 3 files changed, 210 insertions(+), 3 deletions(-)

diff --git 
a/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature 
b/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature
index 28bd5583b..e0690c69c 100644
--- 
a/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature
+++ 
b/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature
@@ -1920,4 +1920,208 @@ Feature: Charge-off
       | 01 January 2023  | Disbursement     | 100.0   | 0.0       | 0.0      | 
0.0   | 0.0       | 100.0        |
       | 14 February 2023 | Charge-off       | 100.85  | 100.0     | 0.85     | 
0.0   | 0.0       | 0.0          |
 
+  Scenario: Charge-off on due date when loan behaviour is zero-interest and 
interestRecalculation - repayment after charge off
+    When Admin sets the business date to "1 January 2024"
+    And Admin creates a client with random data
+    And 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_ZERO_INTEREST_CHARGE_OFF_BEHAVIOUR
 | 01 January 2024   | 100            | 7                      | 
DECLINING_BALANCE | DAILY                       | EQUAL_INSTALLMENTS | 6        
         | MONTHS                | 1              | MONTHS                 | 6  
                | 0                       | 0                      | 0          
          | ADVANCED_PAYMENT_ALLOCATION |
+    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           | 2.05     | 0    | 0         | 102.05  | 0    | 0       
   | 0    | 102.05      |
+    And Admin successfully approves the loan on "1 January 2024" with "100" 
amount and expected disbursement date on "1 January 2024"
+    And Admin successfully disburse the loan on "1 January 2024" with "100" 
EUR transaction amount
+    When Admin sets the business date to "1 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       |
+      | 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           | 2.05     | 0    | 0         | 102.05  | 17.01| 0       
   | 0    | 85.04       |
+    When Admin sets the business date to "29 February 2024"
+    And Admin does charge-off the loan on "29 February 2024"
+    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.03           | 
16.54         | 0.47     | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 3  | 31   | 01 April 2024    |                  | 50.02           | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 4  | 30   | 01 May 2024      |                  | 33.01           | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 5  | 31   | 01 June 2024     |                  | 16.0            | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 6  | 30   | 01 July 2024     |                  | 0.0             | 
16.0          | 0.0      | 0.0   | 0.0       | 16.0    | 0.0   | 0.0        | 
0.0  | 16.0        |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due     | Paid  | In 
advance | Late | Outstanding |
+      | 100           | 1.05     | 0    | 0         | 101.05  | 17.01 | 0      
    | 0    | 84.04       |
+    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    |
+      | 29 February 2024 | Charge-off       | 84.04   | 83.57     | 0.47     | 
0.0   | 0.0       | 0.0          | false    | false    |
+#  ----- repayment after charge off on 1st March  ----- #
+    When Admin sets the business date to "01 March 2024"
+    And Customer makes "AUTOPAY" repayment on "01 March 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    | 01 March 2024    | 67.03           | 
16.54         | 0.47     | 0.0   | 0.0       | 17.01   | 17.01 | 0.0        | 
0.0  | 0.0         |
+      | 3  | 31   | 01 April 2024    |                  | 50.02           | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 4  | 30   | 01 May 2024      |                  | 33.01           | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 5  | 31   | 01 June 2024     |                  | 16.0            | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 6  | 30   | 01 July 2024     |                  | 0.0             | 
16.0          | 0.0      | 0.0   | 0.0       | 16.0    | 0.0   | 0.0        | 
0.0  | 16.0        |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due     | Paid  | In 
advance | Late | Outstanding |
+      | 100           | 1.05     | 0    | 0         | 101.05  | 34.02 | 0      
    | 0    | 67.03       |
+    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    |
+      | 29 February 2024 | Charge-off       | 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    |
+
+  @PS-2137-s5
+  Scenario: Charge-off on due date when loan behaviour is zero-interest and 
interestRecalculation - charge off after one installment is overdue (31st March)
+    When Admin sets the business date to "1 January 2024"
+    And Admin creates a client with random data
+    And 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_ZERO_INTEREST_CHARGE_OFF_BEHAVIOUR
 | 01 January 2024   | 100            | 7                      | 
DECLINING_BALANCE | DAILY                       | EQUAL_INSTALLMENTS | 6        
         | MONTHS                | 1              | MONTHS                 | 6  
                | 0                       | 0                      | 0          
          | ADVANCED_PAYMENT_ALLOCATION |
+    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           | 2.05     | 0    | 0         | 102.05  | 0    | 0       
   | 0    | 102.05      |
+    And Admin successfully approves the loan on "1 January 2024" with "100" 
amount and expected disbursement date on "1 January 2024"
+    And Admin successfully disburse the loan on "1 January 2024" with "100" 
EUR transaction amount
+    When Admin sets the business date to "1 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       |
+      | 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           | 2.05     | 0    | 0         | 102.05  | 17.01| 0       
   | 0    | 85.04       |
+    When Admin sets the business date to "31 March 2024"
+    And Admin does charge-off the loan on "31 March 2024"
+    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.51           | 
16.54         | 0.47     | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 4  | 30   | 01 May 2024      |                  | 33.5            | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 5  | 31   | 01 June 2024     |                  | 16.49           | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 6  | 30   | 01 July 2024     |                  | 0.0             | 
16.49         | 0.0      | 0.0   | 0.0       | 16.49   | 0.0   | 0.0        | 
0.0  | 16.49       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due     | Paid  | In 
advance | Late | Outstanding |
+      | 100           | 1.54     | 0    | 0         | 101.54  | 17.01 | 0      
    | 0    | 84.53      |
+    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    |
+      | 31 March 2024    | Charge-off       | 84.53   | 83.57     | 0.96     | 
0.0   | 0.0       | 0.0          | false    | false    |
+
+  @PS-2137-s6
+  Scenario: Charge-off on due date when loan behaviour is zero-interest and 
interestRecalculation - backdated repayment
+    When Admin sets the business date to "1 January 2024"
+    And Admin creates a client with random data
+    And 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_ZERO_INTEREST_CHARGE_OFF_BEHAVIOUR
 | 01 January 2024   | 100            | 7                      | 
DECLINING_BALANCE | DAILY                       | EQUAL_INSTALLMENTS | 6        
         | MONTHS                | 1              | MONTHS                 | 6  
                | 0                       | 0                      | 0          
          | ADVANCED_PAYMENT_ALLOCATION |
+    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           | 2.05     | 0    | 0         | 102.05  | 0    | 0       
   | 0    | 102.05      |
+    And Admin successfully approves the loan on "1 January 2024" with "100" 
amount and expected disbursement date on "1 January 2024"
+    And Admin successfully disburse the loan on "1 January 2024" with "100" 
EUR transaction amount
+    When Admin sets the business date to "1 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       |
+      | 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           | 2.05     | 0    | 0         | 102.05  | 17.01| 0       
   | 0    | 85.04       |
+    When Admin sets the business date to "31 March 2024"
+    And Admin does charge-off the loan on "31 March 2024"
+    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.51           | 
16.54         | 0.47     | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 4  | 30   | 01 May 2024      |                  | 33.5            | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 5  | 31   | 01 June 2024     |                  | 16.49           | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 6  | 30   | 01 July 2024     |                  | 0.0             | 
16.49         | 0.0      | 0.0   | 0.0       | 16.49   | 0.0   | 0.0        | 
0.0  | 16.49       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due     | Paid  | In 
advance | Late | Outstanding |
+      | 100           | 1.54     | 0    | 0         | 101.54  | 17.01 | 0      
    | 0    | 84.53     |
+    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    |
+      | 31 March 2024    | Charge-off       | 84.53   | 83.57     | 0.96     | 
0.0   | 0.0       | 0.0          | false    | false    |
+#  ----- backdated repayment  on 1 March made on 31 March ----- #
+    And Customer makes "AUTOPAY" repayment on "01 March 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    | 01 March 2024    | 67.05           | 
16.52         | 0.49     | 0.0   | 0.0       | 17.01   | 17.01 | 0.0        | 
0.0  | 0.0         |
+      | 3  | 31   | 01 April 2024    |                  | 50.42           | 
16.63         | 0.38     | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 4  | 30   | 01 May 2024      |                  | 33.41           | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 5  | 31   | 01 June 2024     |                  | 16.4            | 
17.01         | 0.0      | 0.0   | 0.0       | 17.01   | 0.0   | 0.0        | 
0.0  | 17.01       |
+      | 6  | 30   | 01 July 2024     |                  | 0.0             | 
16.4          | 0.0      | 0.0   | 0.0       | 16.4    | 0.0   | 0.0        | 
0.0  | 16.4        |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due     | Paid  | In 
advance | Late | Outstanding |
+      | 100           | 1.45     | 0    | 0         | 101.45  | 34.02 | 0      
    | 0    | 67.43       |
+    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    | Repayment        | 17.01   | 16.52     | 0.49     | 
0.0   | 0.0       | 67.05        | false    | false    |
+      | 31 March 2024    | Charge-off       | 67.43   | 67.05     | 0.38     | 
0.0   | 0.0       | 0.0          | false    | true     |
 
diff --git 
a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java
 
b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java
index d08bb6288..f82a2c142 100644
--- 
a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java
+++ 
b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java
@@ -1175,6 +1175,7 @@ public class AdvancedPaymentScheduleTransactionProcessor 
extends AbstractLoanRep
             if 
(LoanChargeOffBehaviour.ZERO_INTEREST.equals(loanTransaction.getLoan().getLoanProductRelatedDetail().getChargeOffBehaviour())
                     && !loanTransaction.isReversed()) {
                 handleZeroInterestChargeOff(loanTransaction, 
progressiveTransactionCtx);
+                progressiveTransactionCtx.setChargedOff(true);
             }
         }
 
@@ -1583,7 +1584,7 @@ public class AdvancedPaymentScheduleTransactionProcessor 
extends AbstractLoanRep
                                     transactionMappings, loanTransaction, 
oldestPastDueInstallment, currency);
                             Loan loan = loanTransaction.getLoan();
                             if (transactionCtx instanceof 
ProgressiveTransactionCtx ctx && loan.isInterestBearing()
-                                    && 
loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled()) {
+                                    && 
loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled() && 
!ctx.isChargedOff()) {
                                 paidPortion = 
handlingPaymentAllocationForInterestBearingProgressiveLoan(loanTransaction,
                                         transactionAmountUnprocessed, 
balances, paymentAllocationType, oldestPastDueInstallment, ctx,
                                         
loanTransactionToRepaymentScheduleMapping, oldestPastDueInstallmentCharges);
@@ -1605,7 +1606,7 @@ public class AdvancedPaymentScheduleTransactionProcessor 
extends AbstractLoanRep
                                     transactionMappings, loanTransaction, 
dueInstallment, currency);
                             Loan loan = loanTransaction.getLoan();
                             if (transactionCtx instanceof 
ProgressiveTransactionCtx ctx && loan.isInterestBearing()
-                                    && 
loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled()) {
+                                    && 
loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled() && 
!ctx.isChargedOff()) {
                                 paidPortion = 
handlingPaymentAllocationForInterestBearingProgressiveLoan(loanTransaction,
                                         transactionAmountUnprocessed, 
balances, paymentAllocationType, dueInstallment, ctx,
                                         
loanTransactionToRepaymentScheduleMapping, dueInstallmentCharges);
@@ -1636,7 +1637,7 @@ public class AdvancedPaymentScheduleTransactionProcessor 
extends AbstractLoanRep
 
                                 Loan loan = loanTransaction.getLoan();
                                 if (transactionCtx instanceof 
ProgressiveTransactionCtx ctx && loan.isInterestBearing()
-                                        && 
loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled()) {
+                                        && 
loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled() && 
!ctx.isChargedOff()) {
                                     paidPortion = 
handlingPaymentAllocationForInterestBearingProgressiveLoan(loanTransaction, 
evenPortion,
                                             balances, paymentAllocationType, 
inAdvanceInstallment, ctx,
                                             
loanTransactionToRepaymentScheduleMapping, inAdvanceInstallmentCharges);
diff --git 
a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ProgressiveTransactionCtx.java
 
b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ProgressiveTransactionCtx.java
index 3ce525715..859f6bfd0 100644
--- 
a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ProgressiveTransactionCtx.java
+++ 
b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ProgressiveTransactionCtx.java
@@ -43,6 +43,8 @@ public class ProgressiveTransactionCtx extends TransactionCtx 
{
     private List<LoanTransaction> alreadyProcessedTransactions = new 
ArrayList<>();
     @Setter
     private Money sumOfInterestRefundAmount;
+    @Setter
+    private boolean isChargedOff = false;
 
     public ProgressiveTransactionCtx(MonetaryCurrency currency, 
List<LoanRepaymentScheduleInstallment> installments,
             Set<LoanCharge> charges, MoneyHolder overpaymentHolder, 
ChangedTransactionDetail changedTransactionDetail,

Reply via email to