FINERACT-2456: added e2e test covering charge off calculation after repayment reversal with multiple merchant refunds and credit balance refund

This commit is contained in:
Rustam Zeinalov
2026-02-02 18:55:17 +01:00
committed by Adam Saghy
parent 3b0d053d52
commit 01d3049538
@@ -10077,7 +10077,8 @@ Feature: Charge-off
Then Loan has 11.51 total unpaid payable due interest
Then Loan has 0.0 total unpaid payable not due interest
Scenario: Verify charge-off after repayment reversal with merchant refunds and credit balance refund
@TestRailId:C4579
Scenario: Verify charge-off after repayment reversal with merchant refund and credit balance refund
When Admin sets the business date to "03 November 2025"
When Admin creates a client with random data
When Admin creates a fully customized loan with the following data:
@@ -10139,3 +10140,286 @@ Feature: Charge-off
| 151.0 | 1.45 | 0.0 | 0.0 | 152.45 | 146.45 | 140.61 | 5.84 | 6.0 |
When Loan Pay-off is made on "23 January 2026"
Then Loan's all installments have obligations met
@TestRailId:C4580
Scenario: Verify charge-off after repayment reversal with multiple merchant refunds and credit balance refund
When Admin sets the business date to "12 March 2023"
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_ADV_CUSTOM_PMT_ALLOC_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_RECALC_ZERO_CHARGE_OFF_ACCRUAL | 12 March 2023 | 127.17 | 9.51 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 24 | MONTHS | 1 | MONTHS | 24 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
And Admin successfully approves the loan on "12 March 2023" with "127.17" amount and expected disbursement date on "12 March 2023"
# --- Step 1: Disbursement ---
When Admin successfully disburse the loan on "12 March 2023" with "127.17" EUR transaction amount
Then Loan Repayment schedule has 24 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 |
| | | 12 March 2023 | | 127.17 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 12 April 2023 | | 122.36 | 4.81 | 1.03 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 2 | 30 | 12 May 2023 | | 117.48 | 4.88 | 0.96 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 3 | 31 | 12 June 2023 | | 112.59 | 4.89 | 0.95 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 4 | 30 | 12 July 2023 | | 107.63 | 4.96 | 0.88 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 5 | 31 | 12 August 2023 | | 102.66 | 4.97 | 0.87 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 6 | 31 | 12 September 2023 | | 97.65 | 5.01 | 0.83 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 7 | 30 | 12 October 2023 | | 92.57 | 5.08 | 0.76 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 8 | 31 | 12 November 2023 | | 87.48 | 5.09 | 0.75 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 9 | 30 | 12 December 2023 | | 82.32 | 5.16 | 0.68 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 10 | 31 | 12 January 2024 | | 77.14 | 5.18 | 0.66 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 11 | 31 | 12 February 2024 | | 71.92 | 5.22 | 0.62 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 12 | 29 | 12 March 2024 | | 66.62 | 5.3 | 0.54 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 13 | 31 | 12 April 2024 | | 61.32 | 5.3 | 0.54 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 14 | 30 | 12 May 2024 | | 55.96 | 5.36 | 0.48 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 15 | 31 | 12 June 2024 | | 50.57 | 5.39 | 0.45 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 16 | 30 | 12 July 2024 | | 45.13 | 5.44 | 0.4 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 17 | 31 | 12 August 2024 | | 39.65 | 5.48 | 0.36 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 18 | 31 | 12 September 2024 | | 34.13 | 5.52 | 0.32 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 19 | 30 | 12 October 2024 | | 28.56 | 5.57 | 0.27 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 20 | 31 | 12 November 2024 | | 22.95 | 5.61 | 0.23 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 21 | 30 | 12 December 2024 | | 17.29 | 5.66 | 0.18 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 22 | 31 | 12 January 2025 | | 11.59 | 5.7 | 0.14 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 23 | 31 | 12 February 2025 | | 5.84 | 5.75 | 0.09 | 0.0 | 0.0 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 |
| 24 | 28 | 12 March 2025 | | 0.0 | 5.84 | 0.04 | 0.0 | 0.0 | 5.88 | 0.0 | 0.0 | 0.0 | 5.88 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 127.17 | 13.03 | 0.0 | 0.0 | 140.20 | 0.0 | 0.0 | 0.0 | 140.20 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
# --- Step 2: First Repayment ---
When Admin sets the business date to "12 April 2023"
When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "12 April 2023" with 5.84 EUR transaction amount and system-generated Idempotency key
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 127.17 | 13.03 | 0.0 | 0.0 | 140.20 | 5.84 | 0.0 | 0.0 | 134.36 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
# --- Step 3: Merchant Issued Refunds (2x 42.39) ---
When Admin sets the business date to "20 April 2023"
When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "20 April 2023" with 42.39 EUR transaction amount and system-generated Idempotency key
When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "20 April 2023" with 42.39 EUR transaction amount and system-generated Idempotency key
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 127.17 | 4.4 | 0.0 | 0.0 | 131.57 | 91.49 | 85.65 | 0.0 | 40.08 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 79.97 | false | false |
| 20 April 2023 | Interest Refund | 0.44 | 0.44 | 0.0 | 0.0 | 0.0 | 79.53 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 37.14 | false | false |
| 20 April 2023 | Interest Refund | 0.43 | 0.43 | 0.0 | 0.0 | 0.0 | 36.71 | false | false |
# --- Step 4: Repayment on 12 May 2023 (will be reversed later) ---
When Admin sets the business date to "12 May 2023"
When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "12 May 2023" with 5.84 EUR transaction amount and system-generated Idempotency key
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 127.17 | 4.32 | 0.0 | 0.0 | 131.49 | 97.33 | 90.29 | 0.0 | 34.16 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 79.97 | false | false |
| 20 April 2023 | Interest Refund | 0.44 | 0.44 | 0.0 | 0.0 | 0.0 | 79.53 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 37.14 | false | false |
| 20 April 2023 | Interest Refund | 0.43 | 0.43 | 0.0 | 0.0 | 0.0 | 36.71 | false | false |
| 12 May 2023 | Repayment | 5.84 | 5.37 | 0.47 | 0.0 | 0.0 | 31.34 | false | false |
# --- Step 5: Undo Repayment from 12 May 2023 ---
When Admin sets the business date to "13 May 2023"
When Customer undo "1"th "Repayment" transaction made on "12 May 2023"
Then On Loan Transactions tab the "Repayment" Transaction with date "12 May 2023" is reverted
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 127.17 | 4.4 | 0.0 | 0.0 | 131.57 | 91.49 | 85.65 | 0.0 | 40.08 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 79.97 | false | false |
| 20 April 2023 | Interest Refund | 0.44 | 0.44 | 0.0 | 0.0 | 0.0 | 79.53 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 37.14 | false | false |
| 20 April 2023 | Interest Refund | 0.43 | 0.43 | 0.0 | 0.0 | 0.0 | 36.71 | false | false |
| 12 May 2023 | Repayment | 5.84 | 5.37 | 0.47 | 0.0 | 0.0 | 31.34 | true | false |
# --- Step 6: Repayment on 22 May 2023 ---
When Admin sets the business date to "22 May 2023"
When Customer makes "REPAYMENT" transaction with "REAL_TIME" payment type on "22 May 2023" with 5.84 EUR transaction amount and system-generated Idempotency key
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 127.17 | 4.35 | 0.0 | 0.0 | 131.52 | 97.33 | 90.29 | 1.2 | 34.19 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 79.97 | false | false |
| 20 April 2023 | Interest Refund | 0.44 | 0.44 | 0.0 | 0.0 | 0.0 | 79.53 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 37.14 | false | false |
| 20 April 2023 | Interest Refund | 0.43 | 0.43 | 0.0 | 0.0 | 0.0 | 36.71 | false | false |
| 12 May 2023 | Repayment | 5.84 | 5.37 | 0.47 | 0.0 | 0.0 | 31.34 | true | false |
| 22 May 2023 | Repayment | 5.84 | 5.27 | 0.57 | 0.0 | 0.0 | 31.44 | false | false |
When Admin sets the business date to "12 June 2023"
When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "12 June 2023" with 5.84 EUR transaction amount and system-generated Idempotency key
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 127.17 | 4.17 | 0.0 | 0.0 | 131.34 | 103.17 | 96.13 | 1.2 | 28.17 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 79.97 | false | false |
| 20 April 2023 | Interest Refund | 0.44 | 0.44 | 0.0 | 0.0 | 0.0 | 79.53 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 37.14 | false | false |
| 20 April 2023 | Interest Refund | 0.43 | 0.43 | 0.0 | 0.0 | 0.0 | 36.71 | false | false |
| 12 May 2023 | Repayment | 5.84 | 5.37 | 0.47 | 0.0 | 0.0 | 31.34 | true | false |
| 22 May 2023 | Repayment | 5.84 | 5.27 | 0.57 | 0.0 | 0.0 | 31.44 | false | false |
| 12 June 2023 | Repayment | 5.84 | 5.67 | 0.17 | 0.0 | 0.0 | 25.77 | false | false |
# --- Step 8: Repayment on 12 July 2023 (will be reversed later) ---
When Admin sets the business date to "12 July 2023"
When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "12 July 2023" with 5.84 EUR transaction amount and system-generated Idempotency key
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 127.17 | 3.9 | 0.0 | 0.0 | 131.07 | 109.01 | 101.97 | 1.2 | 22.06 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 79.97 | false | false |
| 20 April 2023 | Interest Refund | 0.44 | 0.44 | 0.0 | 0.0 | 0.0 | 79.53 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 37.14 | false | false |
| 20 April 2023 | Interest Refund | 0.43 | 0.43 | 0.0 | 0.0 | 0.0 | 36.71 | false | false |
| 12 May 2023 | Repayment | 5.84 | 5.37 | 0.47 | 0.0 | 0.0 | 31.34 | true | false |
| 22 May 2023 | Repayment | 5.84 | 5.27 | 0.57 | 0.0 | 0.0 | 31.44 | false | false |
| 12 June 2023 | Repayment | 5.84 | 5.67 | 0.17 | 0.0 | 0.0 | 25.77 | false | false |
| 12 July 2023 | Repayment | 5.84 | 5.64 | 0.2 | 0.0 | 0.0 | 20.13 | false | false |
# --- Step 9: Merchant Issued Refund on 24 July 2023 ---
When Admin sets the business date to "24 July 2023"
When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "24 July 2023" with 42.39 EUR transaction amount and system-generated Idempotency key
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 127.17 | 2.03 | 0.0 | 0.0 | 129.2 | 129.2 | 122.16 | 1.2 | 0.0 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
| 12 April 2023 | Accrual Activity | 1.03 | 0.0 | 1.03 | 0.0 | 0.0 | 0.0 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 79.97 | false | false |
| 20 April 2023 | Interest Refund | 0.44 | 0.44 | 0.0 | 0.0 | 0.0 | 79.53 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 37.14 | false | false |
| 20 April 2023 | Interest Refund | 0.43 | 0.43 | 0.0 | 0.0 | 0.0 | 36.71 | false | false |
| 12 May 2023 | Repayment | 5.84 | 5.37 | 0.47 | 0.0 | 0.0 | 31.34 | true | false |
| 12 May 2023 | Accrual Activity | 0.47 | 0.0 | 0.47 | 0.0 | 0.0 | 0.0 | false | false |
| 22 May 2023 | Repayment | 5.84 | 5.27 | 0.57 | 0.0 | 0.0 | 31.44 | false | false |
| 12 June 2023 | Repayment | 5.84 | 5.67 | 0.17 | 0.0 | 0.0 | 25.77 | false | false |
| 12 June 2023 | Accrual Activity | 0.1 | 0.0 | 0.1 | 0.0 | 0.0 | 0.0 | false | false |
| 12 July 2023 | Repayment | 5.84 | 5.64 | 0.2 | 0.0 | 0.0 | 20.13 | false | false |
| 24 July 2023 | Merchant Issued Refund | 42.39 | 20.13 | 0.06 | 0.0 | 0.0 | 0.0 | false | false |
| 24 July 2023 | Interest Refund | 1.16 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
| 24 July 2023 | Accrual | 2.03 | 0.0 | 2.03 | 0.0 | 0.0 | 0.0 | false | false |
| 24 July 2023 | Accrual Activity | 0.43 | 0.0 | 0.43 | 0.0 | 0.0 | 0.0 | false | false |
Then Loan status will be "OVERPAID"
# --- Step 10: Credit Balance Refund on 25 July 2023 ---
When Admin sets the business date to "25 July 2023"
When Admin makes Credit Balance Refund transaction on "25 July 2023" with 23.36 EUR transaction amount
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 127.17 | 2.03 | 0.0 | 0.0 | 129.2 | 129.2 | 122.16 | 1.2 | 0.0 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
| 12 April 2023 | Accrual Activity | 1.03 | 0.0 | 1.03 | 0.0 | 0.0 | 0.0 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 79.97 | false | false |
| 20 April 2023 | Interest Refund | 0.44 | 0.44 | 0.0 | 0.0 | 0.0 | 79.53 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 37.14 | false | false |
| 20 April 2023 | Interest Refund | 0.43 | 0.43 | 0.0 | 0.0 | 0.0 | 36.71 | false | false |
| 12 May 2023 | Repayment | 5.84 | 5.37 | 0.47 | 0.0 | 0.0 | 31.34 | true | false |
| 12 May 2023 | Accrual Activity | 0.47 | 0.0 | 0.47 | 0.0 | 0.0 | 0.0 | false | false |
| 22 May 2023 | Repayment | 5.84 | 5.27 | 0.57 | 0.0 | 0.0 | 31.44 | false | false |
| 12 June 2023 | Repayment | 5.84 | 5.67 | 0.17 | 0.0 | 0.0 | 25.77 | false | false |
| 12 June 2023 | Accrual Activity | 0.1 | 0.0 | 0.1 | 0.0 | 0.0 | 0.0 | false | false |
| 12 July 2023 | Repayment | 5.84 | 5.64 | 0.2 | 0.0 | 0.0 | 20.13 | false | false |
| 24 July 2023 | Merchant Issued Refund | 42.39 | 20.13 | 0.06 | 0.0 | 0.0 | 0.0 | false | false |
| 24 July 2023 | Interest Refund | 1.16 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
| 24 July 2023 | Accrual | 2.03 | 0.0 | 2.03 | 0.0 | 0.0 | 0.0 | false | false |
| 24 July 2023 | Accrual Activity | 0.43 | 0.0 | 0.43 | 0.0 | 0.0 | 0.0 | false | false |
| 25 July 2023 | Credit Balance Refund | 23.36 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
# --- Step 11: Undo Repayment from 12 July 2023 ---
When Customer undo "1"th "Repayment" transaction made on "12 July 2023"
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 150.53 | 2.36 | 0.0 | 0.0 | 152.89 | 146.74 | 139.7 | 1.2 | 6.15 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
| 12 April 2023 | Accrual Activity | 1.03 | 0.0 | 1.03 | 0.0 | 0.0 | 0.0 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 79.97 | false | false |
| 20 April 2023 | Interest Refund | 0.44 | 0.44 | 0.0 | 0.0 | 0.0 | 79.53 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 37.14 | false | false |
| 20 April 2023 | Interest Refund | 0.43 | 0.43 | 0.0 | 0.0 | 0.0 | 36.71 | false | false |
| 12 May 2023 | Repayment | 5.84 | 5.37 | 0.47 | 0.0 | 0.0 | 31.34 | true | false |
| 12 May 2023 | Accrual Activity | 0.47 | 0.0 | 0.47 | 0.0 | 0.0 | 0.0 | false | false |
| 22 May 2023 | Repayment | 5.84 | 5.27 | 0.57 | 0.0 | 0.0 | 31.44 | false | false |
| 12 June 2023 | Repayment | 5.84 | 5.67 | 0.17 | 0.0 | 0.0 | 25.77 | false | false |
| 12 June 2023 | Accrual Activity | 0.1 | 0.0 | 0.1 | 0.0 | 0.0 | 0.0 | false | false |
| 12 July 2023 | Repayment | 5.84 | 5.64 | 0.2 | 0.0 | 0.0 | 20.13 | true | false |
| 24 July 2023 | Accrual | 2.03 | 0.0 | 2.03 | 0.0 | 0.0 | 0.0 | false | false |
| 24 July 2023 | Merchant Issued Refund | 42.39 | 25.77 | 0.28 | 0.0 | 0.0 | 0.0 | false | true |
| 24 July 2023 | Interest Refund | 1.18 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | true |
| 25 July 2023 | Credit Balance Refund | 23.36 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | false | true |
Then Loan status will be "ACTIVE"
# --- Step 12: Charge-off on 26 July 2023
When Admin sets the business date to "26 July 2023"
And Admin does charge-off the loan on "26 July 2023"
Then Loan Repayment schedule has 24 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 |
| | | 12 March 2023 | | 127.17 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 12 April 2023 | 12 April 2023 | 122.36 | 4.81 | 1.03 | 0.0 | 0.0 | 5.84 | 5.84 | 0.0 | 0.0 | 0.0 |
| 2 | 30 | 12 May 2023 | 22 May 2023 | 116.99 | 5.37 | 0.47 | 0.0 | 0.0 | 5.84 | 5.84 | 4.64 | 1.2 | 0.0 |
| 3 | 31 | 12 June 2023 | 22 May 2023 | 111.25 | 5.74 | 0.1 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 4 | 30 | 12 July 2023 | 22 May 2023 | 105.41 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 5 | 31 | 12 August 2023 | | 99.74 | 29.03 | 0.45 | 0.0 | 0.0 | 29.48 | 23.36 | 23.36 | 0.0 | 6.12 |
| 6 | 31 | 12 September 2023 | 12 June 2023 | 93.9 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 7 | 30 | 12 October 2023 | 12 June 2023 | 88.06 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 8 | 31 | 12 November 2023 | 24 July 2023 | 82.5 | 5.56 | 0.28 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 9 | 30 | 12 December 2023 | 24 July 2023 | 76.66 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 10 | 31 | 12 January 2024 | 24 July 2023 | 70.82 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 11 | 31 | 12 February 2024 | 24 July 2023 | 64.98 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 12 | 29 | 12 March 2024 | 24 July 2023 | 59.14 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 13 | 31 | 12 April 2024 | 24 July 2023 | 53.3 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 14 | 30 | 12 May 2024 | 24 July 2023 | 47.46 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 15 | 31 | 12 June 2024 | 24 July 2023 | 41.62 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 16 | 30 | 12 July 2024 | 24 July 2023 | 35.78 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 17 | 31 | 12 August 2024 | 24 July 2023 | 29.94 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 18 | 31 | 12 September 2024 | 24 July 2023 | 24.1 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 19 | 30 | 12 October 2024 | 24 July 2023 | 18.26 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | 5.84 | 5.84 | 0.0 | 0.0 |
| 20 | 31 | 12 November 2024 | 24 July 2023 | 13.15 | 5.11 | 0.0 | 0.0 | 0.0 | 5.11 | 5.11 | 5.11 | 0.0 | 0.0 |
| 21 | 30 | 12 December 2024 | 24 July 2023 | 9.38 | 3.77 | 0.0 | 0.0 | 0.0 | 3.77 | 3.77 | 3.77 | 0.0 | 0.0 |
| 22 | 31 | 12 January 2025 | 20 April 2023 | 5.61 | 3.77 | 0.0 | 0.0 | 0.0 | 3.77 | 3.77 | 3.77 | 0.0 | 0.0 |
| 23 | 31 | 12 February 2025 | 20 April 2023 | 1.91 | 3.7 | 0.0 | 0.0 | 0.0 | 3.7 | 3.7 | 3.7 | 0.0 | 0.0 |
| 24 | 28 | 12 March 2025 | 20 April 2023 | 0.0 | 1.91 | 0.0 | 0.0 | 0.0 | 1.91 | 1.91 | 1.91 | 0.0 | 0.0 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 150.53 | 2.33 | 0.0 | 0.0 | 152.86 | 146.74 | 139.7 | 1.2 | 6.12 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 12 March 2023 | Disbursement | 127.17 | 0.0 | 0.0 | 0.0 | 0.0 | 127.17 | false | false |
| 12 April 2023 | Repayment | 5.84 | 4.81 | 1.03 | 0.0 | 0.0 | 122.36 | false | false |
| 12 April 2023 | Accrual Activity | 1.03 | 0.0 | 1.03 | 0.0 | 0.0 | 0.0 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 79.97 | false | false |
| 20 April 2023 | Interest Refund | 0.44 | 0.44 | 0.0 | 0.0 | 0.0 | 79.53 | false | false |
| 20 April 2023 | Merchant Issued Refund | 42.39 | 42.39 | 0.0 | 0.0 | 0.0 | 37.14 | false | false |
| 20 April 2023 | Interest Refund | 0.43 | 0.43 | 0.0 | 0.0 | 0.0 | 36.71 | false | false |
| 12 May 2023 | Repayment | 5.84 | 5.37 | 0.47 | 0.0 | 0.0 | 31.34 | true | false |
| 12 May 2023 | Accrual Activity | 0.47 | 0.0 | 0.47 | 0.0 | 0.0 | 0.0 | false | false |
| 22 May 2023 | Repayment | 5.84 | 5.27 | 0.57 | 0.0 | 0.0 | 31.44 | false | false |
| 12 June 2023 | Repayment | 5.84 | 5.67 | 0.17 | 0.0 | 0.0 | 25.77 | false | false |
| 12 June 2023 | Accrual Activity | 0.1 | 0.0 | 0.1 | 0.0 | 0.0 | 0.0 | false | false |
| 12 July 2023 | Repayment | 5.84 | 5.64 | 0.2 | 0.0 | 0.0 | 20.13 | true | false |
| 24 July 2023 | Accrual | 2.03 | 0.0 | 2.03 | 0.0 | 0.0 | 0.0 | false | false |
| 24 July 2023 | Merchant Issued Refund | 42.39 | 25.77 | 0.28 | 0.0 | 0.0 | 0.0 | false | true |
| 24 July 2023 | Interest Refund | 1.18 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | true |
| 25 July 2023 | Credit Balance Refund | 23.36 | 5.84 | 0.0 | 0.0 | 0.0 | 5.84 | false | true |
| 26 July 2023 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
| 26 July 2023 | Charge-off | 6.12 | 5.84 | 0.28 | 0.0 | 0.0 | 0.0 | false | false |
Then Loan status will be "ACTIVE"