This is an automated email from the ASF dual-hosted git repository.

aleks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit 23080c50413e79e6fc2d9cbab69557cae53a6db5
Author: MarianaDmytrivBinariks <[email protected]>
AuthorDate: Thu Sep 11 08:48:56 2025 +0300

    FINERACT-2354: e2e tests for N+1 installment with re-age trn
---
 .../test/resources/features/LoanReAging.feature    | 487 +++++++++++++++++++++
 1 file changed, 487 insertions(+)

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 c6a9a456e8..0da3fbbd4e 100644
--- a/fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature
+++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature
@@ -1165,3 +1165,490 @@ Feature: LoanReAging
       | 27 February 2024 | Re-age            | 855.0  | 855.0     | 0.0      | 
0.0  | 0.0       | 0.0          | true     |
       | 27 February 2024 | Re-age            | 855.0  | 855.0     | 0.0      | 
0.0  | 0.0       | 0.0          | false    |
 
+  @TestRailId:C4044 @AdvancedPaymentAllocation
+  Scenario: Verify that Loan re-aging transaction - with charge N+1 
installment after maturity date prior to re-aging - UC1
+    When Admin sets the business date to "01 January 2025"
+    When Admin creates a client with random data
+    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_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 
01 January 2025   | 1000           | 0                      | FLAT          | 
SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS | 3                 | MONTHS   
              | 1             | MONTHS                 | 3                  | 0 
                      | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 January 2025" with "1000" 
amount and expected disbursement date on "01 January 2025"
+    When Admin successfully disburse the loan on "01 January 2025" with "1000" 
EUR transaction amount
+    Then Loan Repayment schedule has 4 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 2025  |           | 1000.0          |           
    |          | 0.0  |           | 0.0   | 0.0  |            |      |          
   |
+      | 1  | 0    | 01 January 2025  |           | 750.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 2  | 31   | 01 February 2025 |           | 500.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 3  | 28   | 01 March 2025    |           | 250.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 4  | 31   | 01 April 2025    |           | 0.0             | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 0.0       | 1000.0 | 0.0   | 0.0     
   | 0.0  | 1000.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+# --- add charge a month later --- #
+    When Admin sets the business date to "3 May 2025"
+    And Admin adds "LOAN_NSF_FEE" due date charge with "3 May 2025" due date 
and 10 EUR transaction amount
+    Then Loan Repayment schedule has 5 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 2025  |           | 1000.0          |           
    |          | 0.0  |           | 0.0   | 0.0  |            |      |          
   |
+      | 1  | 0    | 01 January 2025  |           | 750.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 2  | 31   | 01 February 2025 |           | 500.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 3  | 28   | 01 March 2025    |           | 250.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 4  | 31   | 01 April 2025    |           | 0.0             | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 5  | 32   | 03 May 2025      |           | 0.0             |   0.0     
    | 0.0      | 0.0  | 10.0      |  10.0 | 0.0  | 0.0        | 0.0  |  10.0    
   |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 10.0      | 1010.0 | 0.0   | 0.0     
   | 0.0  | 1010.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 03 May 2025 | Flat        
     | 10.0 | 0.0  | 0.0    | 10.0        |
+# --- add re-aging trn with start date as maturity date --- #
+    When Admin creates a Loan re-aging transaction by Loan external ID with 
the following data:
+      | frequencyNumber | frequencyType | startDate     | numberOfInstallments 
|
+      | 1               | WEEKS        | 01 April 2025  | 1                    
|
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 10.0       | 1010.0 | 0.0   | 0.0    
    | 0.0  | 1010.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 03 May 2025      | Re-age            | 1000.0 | 1000.0    | 0.0      | 
0.0  | 0.0       |    0.0       | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 03 May 2025 | Flat        
     | 10.0 | 0.0  | 0.0    | 10.0        |
+
+  @TestRailId:C4045 @AdvancedPaymentAllocation
+  Scenario: Verify that Loan re-aging transaction with backdated repayment and 
charge - N+1 installment after maturity date prior to re-aging - UC2
+    When Admin sets the business date to "01 January 2025"
+    When Admin creates a client with random data
+    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_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 
01 January 2025   | 1000           | 0                      | FLAT          | 
SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS | 3                 | MONTHS   
              | 1             | MONTHS                 | 3                  | 0 
                      | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 January 2025" with "1000" 
amount and expected disbursement date on "01 January 2025"
+    When Admin successfully disburse the loan on "01 January 2025" with "1000" 
EUR transaction amount
+    Then Loan Repayment schedule has 4 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 2025  |           | 1000.0          |           
    |          | 0.0  |           | 0.0   | 0.0  |            |      |          
   |
+      | 1  | 0    | 01 January 2025  |           | 750.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 2  | 31   | 01 February 2025 |           | 500.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 3  | 28   | 01 March 2025    |           | 250.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 4  | 31   | 01 April 2025    |           | 0.0             | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 0.0       | 1000.0 | 0.0   | 0.0     
   | 0.0  | 1000.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+# --- add charge a month later --- #
+    When Admin sets the business date to "3 May 2025"
+    And Customer makes "AUTOPAY" repayment on "01 March 2025" with 250 EUR 
transaction amount
+    And Admin adds "LOAN_NSF_FEE" due date charge with "3 May 2025" due date 
and 10 EUR transaction amount
+    Then Loan Repayment schedule has 5 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 2025  |               | 1000.0          |       
        |          | 0.0  |           | 0.0   | 0.0  |            |      |      
       |
+      | 1  | 0    | 01 January 2025  | 01 March 2025 | 750.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 250.0| 0.0        | 250.0|   
0.0       |
+      | 2  | 31   | 01 February 2025 |               | 500.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 3  | 28   | 01 March 2025    |               | 250.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 4  | 31   | 01 April 2025    |               | 0.0             | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 5  | 32   | 03 May 2025      |               | 0.0             |   0.0 
        | 0.0      | 0.0  | 10.0      |  10.0 | 0.0  | 0.0        | 0.0  |  
10.0       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late  | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 10.0      | 1010.0 | 250.0 | 0.0     
   | 250.0 | 760.0       |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 March 2025    | Repayment         | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       | 750.0        | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 03 May 2025 | Flat        
     | 10.0 | 0.0  | 0.0    | 10.0        |
+# --- add re-aging trn with start date as maturity date --- #
+    When Admin creates a Loan re-aging transaction by Loan external ID with 
the following data:
+      | frequencyNumber | frequencyType | startDate     | numberOfInstallments 
|
+      | 1               | WEEKS        | 01 April 2025  | 1                    
|
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late  | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 10.0      | 1010.0 | 250.0 | 0.0     
   | 250.0 | 760.0       |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 March 2025    | Repayment         | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       |  750.0       | false    |
+      | 03 May 2025      | Re-age            | 750.0  | 750.0     | 0.0      | 
0.0  | 0.0       |    0.0       | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 03 May 2025 | Flat        
     | 10.0 | 0.0  | 0.0    | 10.0        |
+
+  @TestRailId:C4046 @AdvancedPaymentAllocation
+  Scenario: Verify that Loan re-aging transaction with downpayment, payoff and 
charge - N+1 installment after maturity date prior to re-aging - UC3
+    When Admin sets the business date to "01 January 2025"
+    When Admin creates a client with random data
+    When Admin set "LP2_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" 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_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2025   | 
1000           | 0                      | FLAT          | 
SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS | 45                | DAYS     
             | 15             | DAYS                   | 3                  | 0 
                      | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 January 2025" with "1000" 
amount and expected disbursement date on "01 January 2025"
+    When Admin successfully disburse the loan on "01 January 2025" with "1000" 
EUR transaction amount
+    Then Loan Repayment schedule has 4 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 2025  |                 | 1000.0          |     
          |          | 0.0  |           | 0.0   | 0.0   |            |      |   
          |
+      | 1  | 0    | 01 January 2025  | 01 January 2025 | 750.0           | 
250.0         | 0.0      | 0.0  | 0.0       | 250.0 | 250.0 | 0.0        | 0.0  
| 0.0         |
+      | 2  | 15   | 16 January 2025  |                 | 500.0           | 
250.0         | 0.0      | 0.0  | 0.0       | 250.0 | 0.0   | 0.0        | 0.0  
| 250.0       |
+      | 3  | 15   | 31 January 2025  |                 | 250.0           | 
250.0         | 0.0      | 0.0  | 0.0       | 250.0 | 0.0   | 0.0        | 0.0  
| 250.0       |
+      | 4  | 15   | 15 February 2025 |                 | 0.0             | 
250.0         | 0.0      | 0.0  | 0.0       | 250.0 | 0.0   | 0.0        | 0.0  
| 250.0       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 0.0       | 1000.0 | 250.0 | 0.0     
   | 0.0  | 750.0       |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 January 2025  | Down Payment      | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       | 750.0        | false    |
+# --- add charge a month later --- #
+    When Admin sets the business date to "20 March 2025"
+    When Loan Pay-off is made on "20 March 2025"
+    And Admin adds "LOAN_NSF_FEE" due date charge with "20 March 2025" due 
date and 10 EUR transaction amount
+    Then Loan Repayment schedule has 5 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 2025  |                 | 1000.0          |     
          |          | 0.0  |           | 0.0   | 0.0   |            |       |  
           |
+      | 1  | 0    | 01 January 2025  | 01 January 2025 | 750.0           | 
250.0         | 0.0      | 0.0  | 0.0       | 250.0 | 250.0 | 0.0        |   
0.0 |   0.0       |
+      | 2  | 15   | 16 January 2025  | 20 March 2025   | 500.0           | 
250.0         | 0.0      | 0.0  | 0.0       | 250.0 | 250.0 | 0.0        | 
250.0 |   0.0       |
+      | 3  | 15   | 31 January 2025  | 20 March 2025   | 250.0           | 
250.0         | 0.0      | 0.0  | 0.0       | 250.0 | 250.0 | 0.0        | 
250.0 |   0.0       |
+      | 4  | 15   | 15 February 2025 | 20 March 2025   | 0.0             | 
250.0         | 0.0      | 0.0  | 0.0       | 250.0 | 250.0 | 0.0        | 
250.0 |   0.0       |
+      | 5  | 33   | 20 March 2025    |                 | 0.0             |   
0.0         | 0.0      | 0.0  | 10.0      |  10.0 |   0.0 | 0.0        |   0.0 
|  10.0       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid   | In 
advance | Late  | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 10.0      | 1010.0 | 1000.0 | 0.0    
    | 750.0 | 10.0        |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 January 2025  | Down Payment      | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       | 750.0        | false    |
+      | 20 March 2025    | Repayment         | 750.0  | 750.0     | 0.0      | 
0.0  | 0.0       |   0.0        | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of     | 
Calculation type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 20 March 2025 | Flat      
       | 10.0 | 0.0  | 0.0    | 10.0        |
+# --- add re-aging trn with start date as maturity date --- #
+    When Admin creates a Loan re-aging transaction by Loan external ID with 
the following data:
+      | frequencyNumber | frequencyType | startDate        | 
numberOfInstallments |
+      | 1               | WEEKS         | 15 February 2025 | 1                 
   |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid   | In 
advance | Late  | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 10.0      | 1010.0 | 1000.0 | 0.0    
    | 750.0 | 10.0        |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 January 2025  | Down Payment      | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       |  750.0       | false    |
+      | 20 March 2025    | Repayment         | 750.0  | 750.0     | 0.0      | 
0.0  | 0.0       |    0.0       | false    |
+      | 20 March 2025    | Re-age            |   0.0  |   0.0     | 0.0      | 
0.0  | 0.0       |    0.0       | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of     | 
Calculation type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 20 March 2025 | Flat      
       | 10.0 | 0.0  | 0.0    | 10.0        |
+
+  @TestRailId:C4047 @AdvancedPaymentAllocation
+  Scenario: Verify that Loan re-aging transaction with backdated repayment and 
chargeback - N+1 installment after maturity date prior to re-aging - UC4
+    When Admin sets the business date to "01 January 2025"
+    When Admin creates a client with random data
+    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_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 
01 January 2025   | 1000           | 0                      | FLAT          | 
SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS | 3                 | MONTHS   
              | 1             | MONTHS                 | 3                  | 0 
                      | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 January 2025" with "1000" 
amount and expected disbursement date on "01 January 2025"
+    When Admin successfully disburse the loan on "01 January 2025" with "1000" 
EUR transaction amount
+    Then Loan Repayment schedule has 4 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 2025  |           | 1000.0          |           
    |          | 0.0  |           | 0.0   | 0.0  |            |      |          
   |
+      | 1  | 0    | 01 January 2025  |           | 750.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 2  | 31   | 01 February 2025 |           | 500.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 3  | 28   | 01 March 2025    |           | 250.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 4  | 31   | 01 April 2025    |           | 0.0             | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 0.0       | 1000.0 | 0.0   | 0.0     
   | 0.0  | 1000.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+# --- add charge a month later --- #
+    When Admin sets the business date to "3 May 2025"
+    And Customer makes "AUTOPAY" repayment on "01 March 2025" with 250 EUR 
transaction amount
+    When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR 
transaction amount
+    Then Loan Repayment schedule has 5 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 2025  |               | 1000.0          |       
        |          | 0.0  |           | 0.0   | 0.0  |            |      |      
       |
+      | 1  | 0    | 01 January 2025  | 01 March 2025 | 750.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 250.0| 0.0        | 250.0|   
0.0       |
+      | 2  | 31   | 01 February 2025 |               | 500.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 3  | 28   | 01 March 2025    |               | 250.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 4  | 31   | 01 April 2025    |               | 0.0             | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 5  | 32   | 03 May 2025      |               | 0.0             | 125.0 
        | 0.0      | 0.0  | 0.0       | 125.0 | 0.0  | 0.0        | 0.0  | 
125.0       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1125.0        | 0.0      | 0.0  | 0.0       | 1125.0 | 250.0 | 0.0     
   | 250.0| 875.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 March 2025    | Repayment         | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       | 750.0        | false    |
+      | 03 May 2025      | Chargeback        | 125.0  | 125.0     | 0.0      | 
0.0  | 0.0       | 875.0        | false    |
+# --- add re-aging trn with start date as maturity date --- #
+    When Admin creates a Loan re-aging transaction by Loan external ID with 
the following data:
+      | frequencyNumber | frequencyType | startDate     | numberOfInstallments 
|
+      | 1               | WEEKS        | 01 April 2025  | 1                    
|
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1125.0        | 0.0      | 0.0  | 0.0       | 1125.0 | 250.0 | 0.0     
   | 250.0| 875.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 March 2025    | Repayment         | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       |  750.0       | false    |
+      | 03 May 2025      | Chargeback        | 125.0  | 125.0     | 0.0      | 
0.0  | 0.0       |  875.0       | false    |
+      | 03 May 2025      | Re-age            | 875.0  | 875.0     | 0.0      | 
0.0  | 0.0       |    0.0       | false    |
+
+  @TestRailId:C4048 @AdvancedPaymentAllocation
+  Scenario: Verify that Loan re-aging transaction with repayment, chargeback 
and charge - N+1 installment after maturity date prior to re-aging - UC5
+    When Admin sets the business date to "01 January 2025"
+    When Admin creates a client with random data
+    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_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 
01 January 2025   | 1000           | 0                      | FLAT          | 
SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS | 3                 | MONTHS   
              | 1             | MONTHS                 | 3                  | 0 
                      | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 January 2025" with "1000" 
amount and expected disbursement date on "01 January 2025"
+    When Admin successfully disburse the loan on "01 January 2025" with "1000" 
EUR transaction amount
+    Then Loan Repayment schedule has 4 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 2025  |           | 1000.0          |           
    |          | 0.0  |           | 0.0   | 0.0  |            |      |          
   |
+      | 1  | 0    | 01 January 2025  |           | 750.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 2  | 31   | 01 February 2025 |           | 500.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 3  | 28   | 01 March 2025    |           | 250.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 4  | 31   | 01 April 2025    |           | 0.0             | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 0.0       | 1000.0 | 0.0   | 0.0     
   | 0.0  | 1000.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+# --- add charge a month later --- #
+    When Admin sets the business date to "3 May 2025"
+    And Customer makes "AUTOPAY" repayment on "01 March 2025" with 250 EUR 
transaction amount
+    When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR 
transaction amount
+    And Admin adds "LOAN_NSF_FEE" due date charge with "3 May 2025" due date 
and 10 EUR transaction amount
+    Then Loan Repayment schedule has 5 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 2025  |               | 1000.0          |       
        |          | 0.0  |           | 0.0   | 0.0  |            |      |      
       |
+      | 1  | 0    | 01 January 2025  | 01 March 2025 | 750.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 250.0| 0.0        | 250.0|   
0.0       |
+      | 2  | 31   | 01 February 2025 |               | 500.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 3  | 28   | 01 March 2025    |               | 250.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 4  | 31   | 01 April 2025    |               | 0.0             | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 5  | 32   | 03 May 2025      |               | 0.0             | 125.0 
        | 0.0      | 0.0  | 10.0      | 135.0 | 0.0  | 0.0        | 0.0  | 
135.0       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1125.0        | 0.0      | 0.0  | 10.0      | 1135.0 | 250.0 | 0.0     
   | 250.0| 885.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 March 2025    | Repayment         | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       | 750.0        | false    |
+      | 03 May 2025      | Chargeback        | 125.0  | 125.0     | 0.0      | 
0.0  | 0.0       | 875.0        | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 03 May 2025 | Flat        
     | 10.0 | 0.0  | 0.0    | 10.0        |
+# --- add re-aging trn with start date as maturity date --- #
+    When Admin creates a Loan re-aging transaction by Loan external ID with 
the following data:
+      | frequencyNumber | frequencyType | startDate     | numberOfInstallments 
|
+      | 1               | WEEKS        | 01 April 2025  | 1                    
|
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1125.0        | 0.0      | 0.0  | 10.0      | 1135.0 | 250.0 | 0.0     
   | 250.0| 885.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 March 2025    | Repayment         | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       |  750.0       | false    |
+      | 03 May 2025      | Chargeback        | 125.0  | 125.0     | 0.0      | 
0.0  | 0.0       |  875.0       | false    |
+      | 03 May 2025      | Re-age            | 875.0  | 875.0     | 0.0      | 
0.0  | 0.0       |    0.0       | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 03 May 2025 | Flat        
     | 10.0 | 0.0  | 0.0    | 10.0        |
+
+  @TestRailId:C4049 @AdvancedPaymentAllocation
+  Scenario: Verify that Loan re-aging transaction with repayment, charge and 
charge adjustment - N+1 installment after maturity date prior to re-aging - UC6
+    When Admin sets the business date to "01 January 2025"
+    When Admin creates a client with random data
+    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_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 
01 January 2025   | 1000           | 0                      | FLAT          | 
SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS | 3                 | MONTHS   
              | 1             | MONTHS                 | 3                  | 0 
                      | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 January 2025" with "1000" 
amount and expected disbursement date on "01 January 2025"
+    When Admin successfully disburse the loan on "01 January 2025" with "1000" 
EUR transaction amount
+    Then Loan Repayment schedule has 4 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 2025  |           | 1000.0          |           
    |          | 0.0  |           | 0.0   | 0.0  |            |      |          
   |
+      | 1  | 0    | 01 January 2025  |           | 750.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 2  | 31   | 01 February 2025 |           | 500.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 3  | 28   | 01 March 2025    |           | 250.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 4  | 31   | 01 April 2025    |           | 0.0             | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 0.0       | 1000.0 | 0.0   | 0.0     
   | 0.0  | 1000.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+# --- add charge a month later --- #
+    When Admin sets the business date to "3 May 2025"
+    And Customer makes "AUTOPAY" repayment on "01 March 2025" with 250 EUR 
transaction amount
+    And Admin adds "LOAN_NSF_FEE" due date charge with "03 May 2025" due date 
and 20 EUR transaction amount
+    When Admin sets the business date to "04 May 2025"
+    When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type 
charge which is due on "03 May 2025" with 20 EUR transaction amount and 
externalId ""
+    Then Loan Repayment schedule has 5 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 2025  |               | 1000.0          |       
        |          | 0.0  |           | 0.0   | 0.0  |            |      |      
       |
+      | 1  | 0    | 01 January 2025  | 01 March 2025 | 750.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 250.0| 0.0        | 250.0|   
0.0       |
+      | 2  | 31   | 01 February 2025 |               | 500.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 20.0 | 0.0        | 20.0 | 
230.0       |
+      | 3  | 28   | 01 March 2025    |               | 250.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 4  | 31   | 01 April 2025    |               | 0.0             | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 5  | 32   | 03 May 2025      |               | 0.0             |   0.0 
        | 0.0      | 0.0  | 20.0      |  20.0 | 0.0  | 0.0        | 0.0  |  
20.0       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 20.0      | 1020.0 | 270.0 | 0.0     
   | 270.0| 750.0       |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 March 2025    | Repayment         | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       | 750.0        | false    |
+      | 04 May 2025      | Charge Adjustment |  20.0  |  20.0     | 0.0      | 
0.0  | 0.0       | 730.0        | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 03 May 2025 | Flat        
     | 20.0 | 0.0  | 0.0    | 20.0        |
+# --- add re-aging trn with start date as maturity date --- #
+    When Admin creates a Loan re-aging transaction by Loan external ID with 
the following data:
+      | frequencyNumber | frequencyType | startDate     | numberOfInstallments 
|
+      | 1               | WEEKS        | 01 April 2025  | 1                    
|
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 20.0      | 1020.0 | 270.0 | 0.0     
   | 270.0| 750.0       |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+      | 01 March 2025    | Repayment         | 250.0  | 250.0     | 0.0      | 
0.0  | 0.0       | 750.0        | false    |
+      | 04 May 2025      | Charge Adjustment |  20.0  |  20.0     | 0.0      | 
0.0  | 0.0       | 730.0        | false    |
+      | 04 May 2025      | Re-age            | 730.0  | 730.0     | 0.0      | 
0.0  | 0.0       |    0.0       | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 03 May 2025 | Flat        
     | 20.0 | 0.0  | 0.0    | 20.0        |
+
+  @TestRailId:C4050 @AdvancedPaymentAllocation
+  Scenario: Verify that Loan re-aging transaction with MIR and charge - N+1 
installment after maturity date prior to re-aging - UC7
+    When Admin sets the business date to "01 January 2025"
+    When Admin creates a client with random data
+    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_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 
01 January 2025   | 1000           | 0                      | FLAT          | 
SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS | 3                 | MONTHS   
              | 1             | MONTHS                 | 3                  | 0 
                      | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 January 2025" with "1000" 
amount and expected disbursement date on "01 January 2025"
+    When Admin successfully disburse the loan on "01 January 2025" with "1000" 
EUR transaction amount
+    Then Loan Repayment schedule has 4 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 2025  |           | 1000.0          |           
    |          | 0.0  |           | 0.0   | 0.0  |            |      |          
   |
+      | 1  | 0    | 01 January 2025  |           | 750.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 2  | 31   | 01 February 2025 |           | 500.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 3  | 28   | 01 March 2025    |           | 250.0           | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+      | 4  | 31   | 01 April 2025    |           | 0.0             | 250.0     
    | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 250.0    
   |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 0.0       | 1000.0 | 0.0   | 0.0     
   | 0.0  | 1000.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 1000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 1000.0       | false    |
+# --- add charge a month later --- #
+    When Admin sets the business date to "03 May 2025"
+    When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" 
payment type on "01 April 2025" with 100 EUR transaction amount
+    And Admin adds "LOAN_NSF_FEE" due date charge with "03 May 2025" due date 
and 20 EUR transaction amount
+    Then Loan Repayment schedule has 5 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 2025  |               | 1000.0          |       
        |          | 0.0  |           | 0.0   | 0.0  |            |      |      
       |
+      | 1  | 0    | 01 January 2025  |               | 750.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 100.0| 0.0        | 100.0| 
150.0       |
+      | 2  | 31   | 01 February 2025 |               | 500.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 3  | 28   | 01 March 2025    |               | 250.0           | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 4  | 31   | 01 April 2025    |               | 0.0             | 250.0 
        | 0.0      | 0.0  | 0.0       | 250.0 | 0.0  | 0.0        | 0.0  | 
250.0       |
+      | 5  | 32   | 03 May 2025      |               | 0.0             |   0.0 
        | 0.0      | 0.0  | 20.0      |  20.0 | 0.0  | 0.0        | 0.0  |  
20.0       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late  | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 20.0      | 1020.0 | 100.0 | 0.0     
   | 100.0 | 920.0       |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type       | Amount | Principal | 
Interest | Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement           | 1000.0 | 0.0       | 0.0   
   | 0.0  | 0.0       | 1000.0       | false    |
+      | 01 April 2025    | Merchant Issued Refund | 100.0  | 100.0     | 0.0   
   | 0.0  | 0.0       | 900.0        | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 03 May 2025 | Flat        
     | 20.0 | 0.0  | 0.0    | 20.0        |
+# --- add re-aging trn with start date as maturity date --- #
+    When Admin creates a Loan re-aging transaction by Loan external ID with 
the following data:
+      | frequencyNumber | frequencyType | startDate     | numberOfInstallments 
|
+      | 1               | WEEKS        | 01 April 2025  | 1                    
|
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late  | Outstanding |
+      | 1000.0        | 0.0      | 0.0  | 20.0      | 1020.0 | 100.0 | 0.0     
   | 100.0 | 920.0       |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type       | Amount | Principal | 
Interest | Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement           | 1000.0 | 0.0       | 0.0   
   | 0.0  | 0.0       | 1000.0       | false    |
+      | 01 April 2025    | Merchant Issued Refund | 100.0  | 100.0     | 0.0   
   | 0.0  | 0.0       |  900.0       | false    |
+      | 03 May 2025      | Re-age                 | 900.0  | 900.0     | 0.0   
   | 0.0  | 0.0       |    0.0       | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 03 May 2025 | Flat        
     | 20.0 | 0.0  | 0.0    | 20.0        |
+
+  @TestRailId:C4051 @AdvancedPaymentAllocation
+  Scenario: Verify that Loan re-aging transaction with 2nd disbursement and 
charge - N+1 installment after maturity date prior to re-aging - UC8
+    When Admin sets the business date to "01 January 2025"
+    When Admin creates a client with random data
+    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_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 
01 January 2025   | 1000              | 0                      | FLAT          
| SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS  | 3                 | 
MONTHS                | 1              | MONTHS                 | 3             
     | 0                       | 0                      | 0                    
| ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 January 2025" with "500" 
amount and expected disbursement date on "01 January 2025"
+    When Admin successfully disburse the loan on "01 January 2025" with "500" 
EUR transaction amount
+    Then Loan Repayment schedule has 4 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 2025  |                  | 500.0           |    
           |          | 0.0  |           | 0.0   | 0.0   |            |      |  
           |
+      | 1  | 0    | 01 January 2025  |                  | 375.0           | 
125.0         | 0.0      | 0.0  | 0.0       | 125.0 | 0.0   | 0.0        | 0.0  
| 125.0       |
+      | 2  | 31   | 01 February 2025 |                  | 250.0           | 
125.0         | 0.0      | 0.0  | 0.0       | 125.0 | 0.0   | 0.0        | 0.0  
| 125.0       |
+      | 3  | 28   | 01 March 2025    |                  | 125.0           | 
125.0         | 0.0      | 0.0  | 0.0       | 125.0 | 0.0   | 0.0        | 0.0  
| 125.0       |
+      | 4  | 31   | 01 April 2025    |                  | 0.0             | 
125.0         | 0.0      | 0.0  | 0.0       | 125.0 | 0.0   | 0.0        | 0.0  
| 125.0       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 500.0         | 0.0      | 0.0  | 0.0       | 500.0  | 0.0   | 0.0     
   | 0.0  | 500.0       |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 500.0  | 0.0       | 0.0      | 
0.0  | 0.0       | 500.0        | false    |
+#    --- backdated disbursement --- #
+    When Admin sets the business date to "01 May 2025"
+    When Admin successfully disburse the loan on "16 January 2025" with "100" 
EUR transaction amount
+# --- add charge a month later after maturity date --- #
+    And Admin adds "LOAN_NSF_FEE" due date charge with "01 May 2025" due date 
and 20 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 2025  |                  | 500.0           |    
           |          | 0.0  |           | 0.0   | 0.0   |            |      |  
           |
+      | 1  | 0    | 01 January 2025  |                  | 375.0           | 
125.0         | 0.0      | 0.0  | 0.0       | 125.0 | 0.0   | 0.0        | 0.0  
| 125.0       |
+      |    |      | 16 January 2025  |                  | 100.0           |    
           |          | 0.0  |           | 0.0   | 0.0   |            |      |  
           |
+      | 2  | 0   | 16 January 2025   |                  | 450.0           |  
25.0         | 0.0      | 0.0  | 0.0       |  25.0 | 0.0   | 0.0        | 0.0  
|  25.0       |
+      | 3  | 31   | 01 February 2025 |                  | 300.0           | 
150.0         | 0.0      | 0.0  | 0.0       | 150.0 | 0.0   | 0.0        | 0.0  
| 150.0       |
+      | 4  | 28   | 01 March 2025    |                  | 150.0           | 
150.0         | 0.0      | 0.0  | 0.0       | 150.0 | 0.0   | 0.0        | 0.0  
| 150.0       |
+      | 5  | 31   | 01 April 2025    |                  | 0.0             | 
150.0         | 0.0      | 0.0  | 0.0       | 150.0 | 0.0   | 0.0        | 0.0  
| 150.0       |
+      | 6  | 30   | 01 May 2025      |                  | 0.0             |   
0.0         | 0.0      | 0.0  | 20.0      |  20.0 | 0.0   | 0.0        | 0.0  | 
 20.0       |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 600.0         | 0.0      | 0.0  | 20.0      | 620.0  | 0.0   | 0.0     
   | 0.0  | 620.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 500.0  | 0.0       | 0.0      | 
0.0  | 0.0       | 500.0        | false    |
+      | 16 January 2025  | Disbursement      | 100.0  | 0.0       | 0.0      | 
0.0  | 0.0       | 600.0        | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 01 May 2025 | Flat        
     | 20.0 | 0.0  | 0.0    | 20.0        |
+# --- add re-aging trn with start date as maturity date --- #
+    When Admin creates a Loan re-aging transaction by Loan external ID with 
the following data:
+      | frequencyNumber | frequencyType | startDate     | numberOfInstallments 
|
+      | 1               | WEEKS        | 01 April 2025  | 1                    
|
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due    | Paid  | In 
advance | Late | Outstanding |
+      | 600.0         | 0.0      | 0.0  | 20.0      | 620.0  | 0.0   | 0.0     
   | 0.0  | 620.0      |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type  | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted |
+      | 01 January 2025  | Disbursement      | 500.0  | 0.0       | 0.0      | 
0.0  | 0.0       | 500.0        | false    |
+      | 16 January 2025  | Disbursement      | 100.0  | 0.0       | 0.0      | 
0.0  | 0.0       | 600.0        | false    |
+      | 01 May 2025      | Re-age            | 600.0  | 600.0     | 0.0      | 
0.0  | 0.0       |   0.0        | false    |
+    Then Loan Charges tab has the following data:
+      | Name    | isPenalty | Payment due at       | Due as of   | Calculation 
type | Due  | Paid | Waived | Outstanding |
+      | NSF fee | true      | Specified due date   | 01 May 2025 | Flat        
     | 20.0 | 0.0  | 0.0    | 20.0        |
+

Reply via email to