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


##########
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
+    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         |                       |                       |
+    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                    |
+
+  @TestRailId:C102490
+  Scenario: Verify amortization schedule & EIR math - UC10: discount added 
after disbursement, 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          | 9000            | 100000  
           | 18                | 0        |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" 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 "9000" EUR transaction amount and "0" discount amount
+    And Admin adds Discount fee with "1000" amount on Working Capital loan 
account for last disbursement
+    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         |                       |                       |
+    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                    |
+
+  @TestRailId:C102491
+  Scenario: Verify amortization schedule & EIR math - UC11: discount fee 
adjustment, 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          | 9000            | 100000  
           | 18                | 0        |
+    When Admin successfully approves the working capital loan on "01 January 
2026" with "9000" 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 "9000" EUR transaction amount and "0" discount amount
+    And Admin adds Discount fee with "1000" amount on Working Capital loan 
account for last disbursement
+    When Admin sets the business date to "02 January 2026"
+    And Admin adds Discount fee adjustment with "500" amount on transaction 
date "02 January 2026" on Working Capital loan account for last discount
+    And Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule has the following summary fields:
+      | discountFeeAmount | netDisbursementAmount | totalPaymentVolume | 
periodPaymentRate | npvDayCount | expectedPaymentAmount | originalPaymentNumber 
|
+      | 500.00            | 9000.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 | 
expectedDiscountFeeBalance |
+      | 0         | 2026-01-01 | -9000.00              | 9000.00         | 
500.00                     |
+
+  # 
=============================================================================
+  # Scope 2: Non-multiple payments
+  # 
=============================================================================
+
+  @TestRailId:C102492
+  Scenario: Verify non-multiple payments - UC1: daily loan, payment not equal 
to scheduled daily amount
+    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 1234 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 | actualBalance | actualDiscountFeeBalance |
+      | 0         | 2026-01-01 | -9000.00              | 9000.00         |     
                | 9000.00       | 1000.00                  |
+      | 1         | 2026-01-02 | 50.00                 | 8959.61         | 
1234.00             | 7990.47       | 775.53                   |
+
+  # 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:C102493
+  Scenario: Verify non-multiple payments - UC2: DAYS(7) loan, payment not 
equal to scheduled weekly amount
+    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
+    When Admin sets the business date to "08 January 2026"
+    And Customer makes repayment on "08 January 2026" with 1234 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 | actualBalance | actualDiscountFeeBalance |
+      | 0         | 2026-01-01 | -9000.00              | 9000.00         |     
                | 9000.00       | 1000.00                  |
+      | 1         | 2026-01-08 | 50.00                 | 8959.61         | 
0.00                | 9000.00       | 1000.00                  |
+
+  # 
=============================================================================
+  # Scope 3: Overpayment to a few cents
+  # 
=============================================================================
+
+  @TestRailId:C102494
+  Scenario: Verify overpayment to a few cents - UC1: daily loan, pay a few 
cents more than total due
+    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 10000.05 
transaction amount on Working Capital loan
+    Then Working Capital loan status will be "OVERPAID"
+    And Working Capital loan balance payload contains the following fields:
+      | field                | value |
+      | principalOutstanding | 0.0   |
+      | overpaymentAmount    | 0.05  |
+    When Admin retrieves the projected amortization schedule
+    Then The retrieved amortization schedule actual amortization total is 
"1000.00"
+    And The retrieved amortization schedule actual payments plus future 
expected payments total "10000.00"
+    And The retrieved amortization schedule has no negative monetary amounts
+
+  # 
=============================================================================
+  # Scope 4: Last-period tail
+  # 
=============================================================================
+
+  @TestRailId:C102495
+  Scenario: Verify last-period tail - UC1: daily loan, final payment is the 
smaller remainder
+    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 last projected payment amount is the smaller tail remainder
+    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                    |
+
+  # 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:C102496
+  Scenario: Verify last-period tail - UC2: DAYS(7) loan, final payment is the 
smaller remainder
+    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 last projected payment amount is the smaller tail remainder
+    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                     |
+
+  # 
=============================================================================
+  # Scope 5: 1-day term
+  # 
=============================================================================
+
+  @TestRailId:C102497
+  Scenario: Verify 1-day term - UC1: daily loan disbursed and fully repaid on 
the same day
+    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          | 100             | 100     
           | 1                 | 0        |

Review Comment:
   rewrote with given data
   Also added 2 more cases to check payment



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