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


##########
fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalAmortizationScheduleMatrixPt1.feature:
##########
@@ -0,0 +1,385 @@
+@WorkingCapital
+@WorkingCapitalAmortizationScheduleMatrixPt1Feature
+Feature: WorkingCapitalAmortizationScheduleMatrixPt1
+
+  # 
=============================================================================
+  # Scope 1: Amortization schedule & EIR math (S1-S4)
+  # Matrix variations: accounting NONE/ACC_DEF_REV_AM, NPV 360/365,
+  #                    period payment frequency DAYS(1/7/30)/DAYS(7)/MONTHS,
+  #                    discount modes, business date enabled/disabled + 
timezone.
+  # 
=============================================================================
+
+  @TestRailId:C102481
+  Scenario: Verify amortization schedule & EIR math - UC1: baseline daily, NPV 
360, NONE accounting, business date enabled, UTC
+    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
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has the following summary fields:
+      | discountFeeAmount | netDisbursementAmount | totalPaymentVolume | 
periodPaymentRate | npvDayCount | expectedPaymentAmount | originalPaymentNumber 
|
+      | 1000.00           | 9000.00               | 100000.00          | 18    
            | 360         | 50.00                 | 200                   |
+    And The retrieved amortization schedule has payments with the following 
details for the listed payment numbers:
+      | paymentNo | date       | expectedPaymentAmount | expectedBalance | 
expectedAmortizationAmount | actualPaymentAmount | actualAmortizationAmount | 
expectedDiscountFeeBalance | actualBalance | actualDiscountFeeBalance |
+      | 0         | 2026-01-01 | -9000.00              | 9000.00         |     
                       |                     |                          | 
1000.00                    | 9000.00       | 1000.00                  |
+      | 1         | 2026-01-02 | 50.00                 | 8959.61         | 
9.61                       |                     |                          | 
990.39                     |               |                          |
+      | 2         | 2026-01-03 | 50.00                 | 8919.18         | 
9.57                       |                     |                          | 
980.82                     |               |                          |
+
+  @TestRailId:C102482
+  Scenario: Verify amortization schedule & EIR math - UC2: daily, 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 
|
+      | NONE           | 365         | 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          | 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
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has the following summary fields:
+      | discountFeeAmount | netDisbursementAmount | totalPaymentVolume | 
periodPaymentRate | npvDayCount | expectedPaymentAmount | originalPaymentNumber 
|
+      | 1000.00           | 9000.00               | 100000.00          | 18    
            | 365         | 49.32                 | 203                   |
+    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 | -9000.00              | 9000.00         | 
1000.00                    |
+      | 1         | 2026-01-02 | 49.32                 | 8960.16         | 
990.52                     |
+
+  # repaymentFrequencyType/repaymentEvery is not consumed by the amortization 
schedule calculation (it walks daily
+  # regardless), so this scenario is redundant with UC1/UC6 for schedule math 
- skipped pending re-scope.
+  @Skip @TestRailId:C102483
+  Scenario: Verify amortization schedule & EIR math - UC3: DAYS(7) frequency, 
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
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has the following summary fields:
+      | discountFeeAmount | netDisbursementAmount | totalPaymentVolume | 
periodPaymentRate | npvDayCount | expectedPaymentAmount | originalPaymentNumber 
|
+      | 1000.00           | 9000.00               | 100000.00          | 18    
            | 360         | 50.00                 | 200                   |
+    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 | -9000.00              | 9000.00         | 
1000.00                    |
+      | 1         | 2026-01-08 | 50.00                 | 8959.61         | 
990.39                     |
+
+  # repaymentFrequencyType/repaymentEvery is not consumed by the amortization 
schedule calculation (it walks daily
+  # regardless), so this scenario is redundant with UC1/UC6 for schedule math 
- skipped pending re-scope.
+  @Skip @TestRailId:C102484
+  Scenario: Verify amortization schedule & EIR math - UC4: MONTHS frequency 
with month-end anchor, 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         | MONTHS                 | 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          | 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
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has the following summary fields:
+      | discountFeeAmount | netDisbursementAmount | totalPaymentVolume | 
periodPaymentRate | npvDayCount | expectedPaymentAmount | originalPaymentNumber 
|
+      | 1000.00           | 9000.00               | 100000.00          | 18    
            | 360         | 50.00                 | 200                   |
+    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 | -9000.00              | 9000.00         | 
1000.00                    |
+      | 1         | 2026-02-01 | 50.00                 | 8959.61         | 
990.39                     |
+
+  # repaymentFrequencyType/repaymentEvery is not consumed by the amortization 
schedule calculation (it walks daily
+  # regardless), so this scenario is redundant with UC1/UC6 for schedule math 
- skipped pending re-scope.
+  @Skip @TestRailId:C102485
+  Scenario: Verify amortization schedule & EIR math - UC5: DAYS(7) frequency, 
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
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has the following summary fields:
+      | discountFeeAmount | netDisbursementAmount | totalPaymentVolume | 
periodPaymentRate | npvDayCount | expectedPaymentAmount | originalPaymentNumber 
|
+      | 1000.00           | 9000.00               | 100000.00          | 18    
            | 360         | 50.00                 | 200                   |
+    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 | -9000.00              | 9000.00         | 
1000.00                    |
+      | 1         | 2026-01-08 | 50.00                 | 8959.61         | 
990.39                     |
+
+  @TestRailId:C102486
+  Scenario: Verify amortization schedule & EIR math - UC6: DAYS(1) frequency, 
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                   | 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          | 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
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has the following summary fields:
+      | discountFeeAmount | netDisbursementAmount | totalPaymentVolume | 
periodPaymentRate | npvDayCount | expectedPaymentAmount | originalPaymentNumber 
|
+      | 1000.00           | 9000.00               | 100000.00          | 18    
            | 360         | 50.00                 | 200                   |
+    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 | -9000.00              | 9000.00         | 
1000.00                    |
+      | 1         | 2026-01-02 | 50.00                 | 8959.61         | 
990.39                     |
+
+  @TestRailId:C102487
+  Scenario: Verify amortization schedule & EIR math - UC7: ACC_DEF_REV_AM 
accounting, 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 new Working Capital Loan Product with the following 
matrix data:
+      | accountingRule | npvDayCount | repaymentFrequencyType | repaymentEvery 
|
+      | ACC_DEF_REV_AM | 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          | 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
+    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 the following summary fields:
+      | discountFeeAmount | netDisbursementAmount | totalPaymentVolume | 
periodPaymentRate | npvDayCount | expectedPaymentAmount | originalPaymentNumber 
|
+      | 1000.00           | 9000.00               | 100000.00          | 18    
            | 360         | 50.00                 | 200                   |
+    And The retrieved amortization schedule has payments with the following 
details for the listed payment numbers:
+      | paymentNo | date       | expectedPaymentAmount | expectedBalance | 
expectedAmortizationAmount | expectedDiscountFeeBalance | actualPaymentAmount | 
actualBalance | actualAmortizationAmount | actualDiscountFeeBalance |
+      | 0         | 2026-01-01 | -9000.00              | 9000.00         |     
                       | 1000.00                    |                     | 
9000.00       |                          | 1000.00                  |
+      | 1         | 2026-01-02 | 50.00                 | 8959.61         | 
9.61                       | 990.39                     | 50.00               | 
8959.61       | 9.61                     | 990.39                   |
+    And The retrieved amortization schedule actual amortization is consistent 
with the loan realized and unrealized income after close of business
+
+  @TestRailId:C102488
+  Scenario: Verify amortization schedule & EIR math - UC8: no discount, 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 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          | 10000           | 100000  
           | 18                | 0        |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "10000" amount and "0" discount amount and expected disbursement 
date on "01 January 2026"
+    And Admin successfully disburse the Working Capital loan on "01 January 
2026" with "10000" EUR transaction amount and "0" discount amount
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has the following summary fields:
+      | discountFeeAmount | netDisbursementAmount | totalPaymentVolume | 
periodPaymentRate | npvDayCount | expectedPaymentAmount | originalPaymentNumber 
|
+      | 0.00              | 10000.00              | 100000.00          | 18    
            | 360         |                       |                       |
+    And The retrieved amortization schedule has payments with the following 
details for the listed payment numbers:
+      | paymentNo | date       | expectedPaymentAmount | expectedBalance | 
expectedAmortizationAmount | expectedDiscountFeeBalance |
+      | 0         | 2026-01-01 | -10000.00             | 10000.00        |     
                       | 0.00                       |
+      | 1         | 2026-01-02 | 50.00                 | 9950.00         | 
0.00                       | 0.00                       |
+
+  @TestRailId:C102489
+  Scenario: Verify amortization schedule & EIR math - UC9: discount at 
approval, daily NPV 360

Review Comment:
   removed
   Reason: if we create a loan without discount and try to add discount at 
approval we got the error message: amount.cannot.exceed.created.discount.
   That Negative case is checked already in E2E tests
   With that this scenario would be the same as our new baseline (old UC6) so I 
removed it



-- 
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