peter-kovacs-dpc commented on code in PR #6432:
URL: https://github.com/apache/fineract/pull/6432#discussion_r3996251169


##########
fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalAmortizationScheduleMatrixPt2.feature:
##########
@@ -0,0 +1,431 @@
+@WorkingCapital
+@WorkingCapitalAmortizationScheduleMatrixPt2Feature
+Feature: WorkingCapitalAmortizationScheduleMatrixPt2
+
+  # 
=============================================================================
+  # Scope 6: Tiny rate (many rows)
+  # 
=============================================================================
+
+  @TestRailId:C102498
+  Scenario: Verify tiny rate schedule - UC1: low periodPaymentRate produces 
many rows and sampled values still sum correctly
+    When Admin sets the business date to "01 January 2026"
+    And Admin creates a client with random data
+    And Admin creates a new Working Capital Loan Product with the following 
matrix data:
+      | accountingRule | npvDayCount | repaymentFrequencyType | repaymentEvery 
|
+      | NONE           | 360         | DAYS                   | 1              
|
+    And Admin creates a working capital loan using created product with the 
following data:
+      | submittedOnDate | expectedDisbursementDate | principalAmount | 
totalPaymentVolume | periodPaymentRate | discount |
+      | 01 January 2026 | 01 January 2026          | 90              | 10000   
           | 0.36              | 10       |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "90" amount and "10" discount amount and expected disbursement date 
on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "90" EUR transaction amount and "10" discount amount
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has at least 1000 payment rows
+    And The retrieved amortization schedule has payments with the following 
details for the listed payment numbers:
+      | paymentNo | date       | expectedPaymentAmount | expectedBalance | 
expectedDiscountFeeBalance |
+      | 0         | 2026-01-01 | -90.00                | 90.00           | 
10.00                      |
+    And The retrieved amortization schedule expected amortization sums to the 
discount fee and both expected balances close to zero
+
+  # 
=============================================================================
+  # Scope 7: 0.005 rounding boundaries
+  # 
=============================================================================
+
+  @TestRailId:C102499
+  Scenario: Verify 0.005 rounding boundary - UC1: 3-decimal currency leaves 
exactly 0.005 residual on NPV 365
+    When Admin sets the business date to "01 January 2026"
+    And Admin creates a client with random data
+    And Admin creates a new Working Capital Loan Product with the following 
matrix data:
+      | accountingRule | npvDayCount | repaymentFrequencyType | repaymentEvery 
| digitsAfterDecimal |
+      | NONE           | 365         | DAYS                   | 1              
| 3                  |
+    And Admin creates a working capital loan using created product with the 
following data:
+      | submittedOnDate | expectedDisbursementDate | principalAmount | 
totalPaymentVolume | periodPaymentRate | discount |
+      | 01 January 2026 | 01 January 2026          | 9000            | 100000  
           | 17                | 1000     |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" amount and "1000" discount amount and expected disbursement 
date on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "9000" EUR transaction amount and "1000" discount amount
+    When Admin sets the business date to "03 January 2026"
+    And Customer makes repayment on "03 January 2026" with 46 transaction 
amount on Working Capital loan
+    When Admin sets the business date to "04 January 2026"
+    And Customer makes repayment on "04 January 2026" with 46 transaction 
amount on Working Capital loan
+    And Customer makes repayment on "02 January 2026" with 9907.995 
transaction amount on Working Capital loan
+    Then Working Capital loan balance payload contains the following fields:
+      | field                | value |
+      | principalOutstanding | 0.005 |
+    When Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has payments with the following 
details for the listed payment numbers:
+      | paymentNo | expectedPaymentAmount | expectedBalance | actualBalance | 
actualDiscountFeeBalance |
+      | 4         | 0.005                 | 0.000           |               |  
                        |
+    And The retrieved amortization schedule actual amortization total is "1000"
+    And The retrieved amortization schedule has no negative monetary amounts
+
+  @TestRailId:C102500
+  Scenario: Verify 0.005 rounding boundary - UC2: 3-decimal currency residual 
0.006 is rounded to 0.01 and closed
+    When Admin sets the business date to "01 January 2026"
+    And Admin creates a client with random data
+    And Admin creates a new Working Capital Loan Product with the following 
matrix data:
+      | accountingRule | npvDayCount | repaymentFrequencyType | repaymentEvery 
| digitsAfterDecimal |
+      | NONE           | 365         | DAYS                   | 1              
| 3                  |
+    And Admin creates a working capital loan using created product with the 
following data:
+      | submittedOnDate | expectedDisbursementDate | principalAmount | 
totalPaymentVolume | periodPaymentRate | discount |
+      | 01 January 2026 | 01 January 2026          | 9000            | 100000  
           | 17                | 1000     |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" amount and "1000" discount amount and expected disbursement 
date on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "9000" EUR transaction amount and "1000" discount amount
+    When Admin sets the business date to "03 January 2026"
+    And Customer makes repayment on "03 January 2026" with 46 transaction 
amount on Working Capital loan
+    When Admin sets the business date to "04 January 2026"
+    And Customer makes repayment on "04 January 2026" with 46 transaction 
amount on Working Capital loan
+    And Customer makes repayment on "02 January 2026" with 9907.994 
transaction amount on Working Capital loan
+    Then Working Capital loan balance payload contains the following fields:
+      | field                | value |
+      | principalOutstanding | 0.006 |
+    When Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has payments with the following 
details for the listed payment numbers:
+      | paymentNo | expectedPaymentAmount | expectedBalance | actualBalance | 
actualDiscountFeeBalance |
+      | 4         | 0.006                 | 0.000           |               |  
                        |
+    And The retrieved amortization schedule actual amortization total is "1000"
+    And The retrieved amortization schedule has no negative monetary amounts
+
+  # 
=============================================================================
+  # Scope 8: Expected vs actual columns (PS-3240)
+  # 
=============================================================================
+
+  @TestRailId:C102501
+  Scenario: Verify expected vs actual columns - UC1: exact on-time payments 
keep columns aligned
+    When Admin sets the business date to "01 January 2026"
+    And Admin creates a client with random data
+    And Admin creates a working capital loan with the following data:
+      | LoanProduct | submittedOnDate | expectedDisbursementDate | 
principalAmount | totalPaymentVolume | periodPaymentRate | discount |
+      | WCLP        | 01 January 2026 | 01 January 2026          | 9000        
    | 100000             | 18                | 1000     |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" amount and "1000" discount amount and expected disbursement 
date on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "9000" EUR transaction amount and "1000" discount amount
+    When Admin sets the business date to "02 January 2026"
+    And Customer makes repayment on "02 January 2026" with 50 transaction 
amount on Working Capital loan
+    When Admin sets the business date to "03 January 2026"
+    And Customer makes repayment on "03 January 2026" with 50 transaction 
amount on Working Capital loan
+    And Admin runs inline COB job for Working Capital Loan by loanId
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has payments with the following 
details for the listed payment numbers:
+      | paymentNo | date       | expectedPaymentAmount | expectedBalance | 
actualPaymentAmount | actualBalance | actualAmortizationAmount |
+      | 0         | 2026-01-01 | -9000.00              | 9000.00         |     
                | 9000.00       |                          |
+      | 1         | 2026-01-02 | 50.00                 | 8959.61         | 
50.00               | 8959.61       | 9.61                     |
+      | 2         | 2026-01-03 | 50.00                 | 8919.18         | 
50.00               | 8919.18       | 9.57                     |
+    And Every fully paid amortization schedule period has actual amortization 
equal to expected amortization
+    And The retrieved amortization schedule has no negative monetary amounts
+
+  @TestRailId:C102502
+  Scenario: Verify expected vs actual columns - UC2: partial payment leaves 
expected unchanged and actual reduced
+    When Admin sets the business date to "01 January 2026"
+    And Admin creates a client with random data
+    And Admin creates a working capital loan with the following data:
+      | LoanProduct | submittedOnDate | expectedDisbursementDate | 
principalAmount | totalPaymentVolume | periodPaymentRate | discount |
+      | WCLP        | 01 January 2026 | 01 January 2026          | 9000        
    | 100000             | 18                | 1000     |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" amount and "1000" discount amount and expected disbursement 
date on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "9000" EUR transaction amount and "1000" discount amount
+    When Admin sets the business date to "02 January 2026"
+    And Customer makes repayment on "02 January 2026" with 25 transaction 
amount on Working Capital loan
+    And Admin runs inline COB job for Working Capital Loan by loanId
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has payments with the following 
details for the listed payment numbers:
+      | paymentNo | date       | expectedPaymentAmount | expectedBalance | 
actualPaymentAmount | actualBalance | actualAmortizationAmount |
+      | 0         | 2026-01-01 | -9000.00              | 9000.00         |     
                | 9000.00       |                          |
+      | 1         | 2026-01-02 | 50.00                 | 8959.61         | 
25.00               | 8979.81       | 4.81                     |
+    And The retrieved amortization schedule has no negative monetary amounts
+
+  @TestRailId:C102503
+  Scenario: Verify expected vs actual columns - UC3: missed payment day leaves 
actual columns blank
+    When Admin sets the business date to "01 January 2026"
+    And Admin creates a client with random data
+    And Admin creates a working capital loan with the following data:
+      | LoanProduct | submittedOnDate | expectedDisbursementDate | 
principalAmount | totalPaymentVolume | periodPaymentRate | discount |
+      | WCLP        | 01 January 2026 | 01 January 2026          | 9000        
    | 100000             | 18                | 1000     |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" amount and "1000" discount amount and expected disbursement 
date on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "9000" EUR transaction amount and "1000" discount amount
+    When Admin sets the business date to "03 January 2026"
+    And Customer makes repayment on "03 January 2026" with 50 transaction 
amount on Working Capital loan
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has payments with the following 
details for the listed payment numbers:
+      | paymentNo | date       | expectedPaymentAmount | expectedBalance | 
actualPaymentAmount |
+      | 0         | 2026-01-01 | -9000.00              | 9000.00         |     
                |
+      | 1         | 2026-01-02 | 50.00                 | 8959.61         | 
0.00                |
+      | 2         | 2026-01-03 | 50.00                 | 8959.61         | 
50.00               |
+    And The retrieved amortization schedule has no negative monetary amounts
+
+  # 
=============================================================================
+  # Scope 9: Annual EIR (PS-3218)
+  # 
=============================================================================
+
+  @TestRailId:C102504
+  Scenario: Verify annual EIR - UC1: daily NPV 360
+    When Admin sets the business date to "01 January 2026"
+    And Admin creates a client with random data
+    And Admin creates a working capital loan with the following data:
+      | LoanProduct | submittedOnDate | expectedDisbursementDate | 
principalAmount | totalPaymentVolume | periodPaymentRate | discount |
+      | WCLP        | 01 January 2026 | 01 January 2026          | 9000        
    | 100000             | 18                | 1000     |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" amount and "1000" discount amount and expected disbursement 
date on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "9000" EUR transaction amount and "1000" discount amount
+    Then Working capital loan details has annual EIR "0.476307952775034048"
+
+  # repaymentFrequencyType/repaymentEvery is not consumed by the amortization 
schedule calculation (it walks daily
+  # regardless), so this scenario is redundant with UC1 for schedule math - 
skipped pending re-scope.
+  @Skip @TestRailId:C102505
+  Scenario: Verify annual EIR - UC2: DAYS(7) NPV 360
+    When Admin sets the business date to "01 January 2026"
+    And Admin creates a client with random data
+    And Admin creates a new Working Capital Loan Product with the following 
matrix data:
+      | accountingRule | npvDayCount | repaymentFrequencyType | repaymentEvery 
|
+      | NONE           | 360         | DAYS                   | 7              
|
+    And Admin creates a working capital loan using created product with the 
following data:
+      | submittedOnDate | expectedDisbursementDate | principalAmount | 
totalPaymentVolume | periodPaymentRate | discount |
+      | 01 January 2026 | 01 January 2026          | 9000            | 100000  
           | 18                | 1000     |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" amount and "1000" discount amount and expected disbursement 
date on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "9000" EUR transaction amount and "1000" discount amount
+    Then Working capital loan details has annual EIR "0.476307952775034048"
+
+  # 
=============================================================================
+  # Scope 10: Rate changes
+  # 
=============================================================================
+
+  @TestRailId:C102506
+  Scenario: Verify rate change - UC1: single rate decrease and schedule 
reprojects
+    When Admin sets the business date to "01 January 2026"
+    And Admin creates a client with random data
+    And Admin creates a working capital loan with the following data:
+      | LoanProduct | submittedOnDate | expectedDisbursementDate | 
principalAmount | totalPaymentVolume | periodPaymentRate | discount |
+      | WCLP        | 01 January 2026 | 01 January 2026          | 9000        
    | 100000             | 18                | 1000     |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" amount and "1000" discount amount and expected disbursement 
date on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "9000" EUR transaction amount and "1000" discount amount
+    When Admin sets the business date to "02 January 2026"
+    And Admin update Working Capital period payment rate with "9" value
+    And Admin retrieves the projected amortization schedule
+    Then Working Capital Loan period payment rate in effect is "9"
+    And The retrieved amortization schedule has no negative monetary amounts
+
+  @TestRailId:C102507
+  Scenario: Verify rate change - UC2: single rate increase effective from a 
future date
+    When Admin sets the business date to "01 January 2026"
+    And Admin creates a client with random data
+    And Admin creates a working capital loan with the following data:
+      | LoanProduct | submittedOnDate | expectedDisbursementDate | 
principalAmount | totalPaymentVolume | periodPaymentRate | discount |
+      | WCLP        | 01 January 2026 | 01 January 2026          | 9000        
    | 100000             | 9                 | 1000     |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" amount and "1000" discount amount and expected disbursement 
date on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "9000" EUR transaction amount and "1000" discount amount
+    And Admin update Working Capital period payment rate with "18" value 
effective from "15 January 2026"
+    And Admin retrieves the projected amortization schedule
+    Then Working Capital Loan period payment rate in effect on "01 January 
2026" is "9"
+    And Working Capital Loan period payment rate in effect on "15 January 
2026" is "18"
+    And The retrieved amortization schedule has no negative monetary amounts
+
+  @TestRailId:C102508
+  Scenario: Verify rate change - UC3: multiple sequential rate changes

Review Comment:
   fixed
   check before and after and mid-stat to see what exactly changed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to