FINERACT-2201: [Bug] - Negative numbers in case of progressive interest bearing loans - Reamortization

This commit is contained in:
Soma Sörös
2025-03-12 12:33:42 +00:00
committed by Adam Saghy
parent 1fb5e3da43
commit a28b9332b9
3 changed files with 584 additions and 4 deletions
@@ -994,3 +994,576 @@ Feature: LoanAccrualTransaction
| 09 December 2024 | Repayment | 153.12 | 150.0 | 3.12 | 0.0 | 0.0 | 0.0 | false | false |
| 09 December 2024 | Accrual | 3.12 | 0.0 | 3.12 | 0.0 | 0.0 | 0.0 | false | false |
| 09 December 2024 | Accrual Activity | 0.31 | 0.0 | 0.31 | 0.0 | 0.0 | 0.0 | false | false |
@TestRailId:C3531
Scenario: Verify the accrual activity creation in case of full repayment on maturity date - absence of negative numbers with mid range interest rate and small principal
When Admin sets the business date to "19 February 2025"
And Admin creates a client with random data
And 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_PYMNT_INTEREST_DAILY_AUTO_DOWNPAYMENT_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY | 19 February 2025 | 50 | 19.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
And Admin successfully approves the loan on "19 February 2025" with "50" amount and expected disbursement date on "19 February 2025"
And Admin successfully disburse the loan on "19 February 2025" with "50" EUR transaction amount
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 37.5 | 12.5 | 0.0 | 0.0 | 0.0 | 12.5 | 12.5 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | | 34.61 | 2.89 | 0.58 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 3 | 31 | 19 April 2025 | | 31.73 | 2.88 | 0.59 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 4 | 30 | 19 May 2025 | | 28.78 | 2.95 | 0.52 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 5 | 31 | 19 June 2025 | | 25.8 | 2.98 | 0.49 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 6 | 30 | 19 July 2025 | | 22.75 | 3.05 | 0.42 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 7 | 31 | 19 August 2025 | | 19.67 | 3.08 | 0.39 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 8 | 31 | 19 September 2025 | | 16.53 | 3.14 | 0.33 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 9 | 30 | 19 October 2025 | | 13.33 | 3.2 | 0.27 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 10 | 31 | 19 November 2025 | | 10.09 | 3.24 | 0.23 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 11 | 30 | 19 December 2025 | | 6.79 | 3.3 | 0.17 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 12 | 31 | 19 January 2026 | | 3.44 | 3.35 | 0.12 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 13 | 31 | 19 February 2026 | | 0.0 | 3.44 | 0.06 | 0.0 | 0.0 | 3.5 | 0.0 | 0.0 | 0.0 | 3.5 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 50.0 | 4.17 | 0.0 | 0.0 | 54.17 | 12.5 | 0.0 | 0.0 | 41.67 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 50.0 | false | false |
| 19 February 2025 | Down Payment | 12.5 | 12.5 | 0.0 | 0.0 | 0.0 | 37.5 | false | false |
And Customer makes "AUTOPAY" repayment on "19 February 2025" with 3.47 EUR transaction amount
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 37.5 | 12.5 | 0.0 | 0.0 | 0.0 | 12.5 | 12.5 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 34.61 | 2.89 | 0.58 | 0.0 | 0.0 | 3.47 | 3.47 | 3.47 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 31.73 | 2.88 | 0.59 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 4 | 30 | 19 May 2025 | | 28.78 | 2.95 | 0.52 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 5 | 31 | 19 June 2025 | | 25.8 | 2.98 | 0.49 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 6 | 30 | 19 July 2025 | | 22.75 | 3.05 | 0.42 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 7 | 31 | 19 August 2025 | | 19.67 | 3.08 | 0.39 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 8 | 31 | 19 September 2025 | | 16.53 | 3.14 | 0.33 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 9 | 30 | 19 October 2025 | | 13.33 | 3.2 | 0.27 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 10 | 31 | 19 November 2025 | | 10.09 | 3.24 | 0.23 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 11 | 30 | 19 December 2025 | | 6.79 | 3.3 | 0.17 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 12 | 31 | 19 January 2026 | | 3.44 | 3.35 | 0.12 | 0.0 | 0.0 | 3.47 | 0.0 | 0.0 | 0.0 | 3.47 |
| 13 | 31 | 19 February 2026 | | 0.0 | 3.44 | 0.06 | 0.0 | 0.0 | 3.5 | 0.0 | 0.0 | 0.0 | 3.5 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 50.0 | 4.17 | 0.0 | 0.0 | 54.17 | 15.97 | 3.47 | 0.0 | 38.2 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 50.0 | false | false |
| 19 February 2025 | Down Payment | 12.5 | 12.5 | 0.0 | 0.0 | 0.0 | 37.5 | false | false |
| 19 February 2025 | Repayment | 3.47 | 2.89 | 0.58 | 0.0 | 0.0 | 34.61 | false | false |
When Admin sets the business date to "20 February 2025"
When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "20 February 2025" with 17.35 EUR transaction amount
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 37.5 | 12.5 | 0.0 | 0.0 | 0.0 | 12.5 | 12.5 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 34.61 | 2.89 | 0.58 | 0.0 | 0.0 | 3.47 | 3.47 | 3.47 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 31.73 | 2.88 | 0.59 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 4 | 30 | 19 May 2025 | | 28.78 | 2.95 | 0.52 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 5 | 31 | 19 June 2025 | | 25.8 | 2.98 | 0.49 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 6 | 30 | 19 July 2025 | | 22.75 | 3.05 | 0.42 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 7 | 31 | 19 August 2025 | | 19.67 | 3.08 | 0.39 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 8 | 31 | 19 September 2025 | | 16.53 | 3.14 | 0.33 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 9 | 30 | 19 October 2025 | | 13.33 | 3.2 | 0.27 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 10 | 31 | 19 November 2025 | | 10.09 | 3.24 | 0.23 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 11 | 30 | 19 December 2025 | | 6.79 | 3.3 | 0.17 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 12 | 31 | 19 January 2026 | | 3.44 | 3.35 | 0.12 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 13 | 31 | 19 February 2026 | | 0.0 | 3.44 | 0.06 | 0.0 | 0.0 | 3.5 | 1.55 | 1.55 | 0.0 | 1.95 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 50.00 | 4.17 | 0.0 | 0.0 | 54.17 | 33.32 | 20.82 | 0.0 | 20.85 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 50.0 | false | false |
| 19 February 2025 | Down Payment | 12.5 | 12.5 | 0.0 | 0.0 | 0.0 | 37.5 | false | false |
| 19 February 2025 | Repayment | 3.47 | 2.89 | 0.58 | 0.0 | 0.0 | 34.61 | false | false |
| 20 February 2025 | Merchant Issued Refund | 17.35 | 17.35 | 0.0 | 0.0 | 0.0 | 17.26 | false | false |
When Admin sets the business date to "21 February 2025"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 37.5 | 12.5 | 0.0 | 0.0 | 0.0 | 12.5 | 12.5 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 34.61 | 2.89 | 0.58 | 0.0 | 0.0 | 3.47 | 3.47 | 3.47 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 31.73 | 2.88 | 0.59 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 4 | 30 | 19 May 2025 | | 28.78 | 2.95 | 0.52 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 5 | 31 | 19 June 2025 | | 25.8 | 2.98 | 0.49 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 6 | 30 | 19 July 2025 | | 22.75 | 3.05 | 0.42 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 7 | 31 | 19 August 2025 | | 19.67 | 3.08 | 0.39 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 8 | 31 | 19 September 2025 | | 16.53 | 3.14 | 0.33 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 9 | 30 | 19 October 2025 | | 13.33 | 3.2 | 0.27 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 10 | 31 | 19 November 2025 | | 10.09 | 3.24 | 0.23 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 11 | 30 | 19 December 2025 | | 6.79 | 3.3 | 0.17 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 12 | 31 | 19 January 2026 | | 3.44 | 3.35 | 0.12 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 13 | 31 | 19 February 2026 | | 0.0 | 3.44 | 0.06 | 0.0 | 0.0 | 3.5 | 1.55 | 1.55 | 0.0 | 1.95 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 50.00 | 4.17 | 0.0 | 0.0 | 54.17 | 33.32 | 20.82 | 0.0 | 20.85 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 50.0 | false | false |
| 19 February 2025 | Down Payment | 12.5 | 12.5 | 0.0 | 0.0 | 0.0 | 37.5 | false | false |
| 19 February 2025 | Repayment | 3.47 | 2.89 | 0.58 | 0.0 | 0.0 | 34.61 | false | false |
| 20 February 2025 | Merchant Issued Refund | 17.35 | 17.35 | 0.0 | 0.0 | 0.0 | 17.26 | false | false |
| 20 February 2025 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
When Admin sets the business date to "22 February 2025"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 37.5 | 12.5 | 0.0 | 0.0 | 0.0 | 12.5 | 12.5 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 34.61 | 2.89 | 0.58 | 0.0 | 0.0 | 3.47 | 3.47 | 3.47 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 31.73 | 2.88 | 0.59 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 4 | 30 | 19 May 2025 | | 28.78 | 2.95 | 0.52 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 5 | 31 | 19 June 2025 | | 25.8 | 2.98 | 0.49 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 6 | 30 | 19 July 2025 | | 22.75 | 3.05 | 0.42 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 7 | 31 | 19 August 2025 | | 19.67 | 3.08 | 0.39 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 8 | 31 | 19 September 2025 | | 16.53 | 3.14 | 0.33 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 9 | 30 | 19 October 2025 | | 13.33 | 3.2 | 0.27 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 10 | 31 | 19 November 2025 | | 10.09 | 3.24 | 0.23 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 11 | 30 | 19 December 2025 | | 6.79 | 3.3 | 0.17 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 12 | 31 | 19 January 2026 | | 3.44 | 3.35 | 0.12 | 0.0 | 0.0 | 3.47 | 1.58 | 1.58 | 0.0 | 1.89 |
| 13 | 31 | 19 February 2026 | | 0.0 | 3.44 | 0.06 | 0.0 | 0.0 | 3.5 | 1.55 | 1.55 | 0.0 | 1.95 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 50.00 | 4.17 | 0.0 | 0.0 | 54.17 | 33.32 | 20.82 | 0.0 | 20.85 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 50.0 | false | false |
| 19 February 2025 | Down Payment | 12.5 | 12.5 | 0.0 | 0.0 | 0.0 | 37.5 | false | false |
| 19 February 2025 | Repayment | 3.47 | 2.89 | 0.58 | 0.0 | 0.0 | 34.61 | false | false |
| 20 February 2025 | Merchant Issued Refund | 17.35 | 17.35 | 0.0 | 0.0 | 0.0 | 17.26 | false | false |
| 20 February 2025 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
| 21 February 2025 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
@TestRailId:C3532
Scenario: Verify the accrual activity creation in case of full repayment on maturity date - absence of negative numbers with low interest rate and small principal
When Admin sets the business date to "19 February 2025"
And Admin creates a client with random data
And 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_PYMNT_INTEREST_DAILY_AUTO_DOWNPAYMENT_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY | 19 February 2025 | 10.01 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
And Admin successfully approves the loan on "19 February 2025" with "10.01" amount and expected disbursement date on "19 February 2025"
And Admin successfully disburse the loan on "19 February 2025" with "10.01" EUR transaction amount
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 10.01 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 7.51 | 2.5 | 0.0 | 0.0 | 0.0 | 2.5 | 2.5 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | | 6.91 | 0.6 | 0.07 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 3 | 31 | 19 April 2025 | | 6.31 | 0.6 | 0.07 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 4 | 30 | 19 May 2025 | | 5.7 | 0.61 | 0.06 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 5 | 31 | 19 June 2025 | | 5.09 | 0.61 | 0.06 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 6 | 30 | 19 July 2025 | | 4.47 | 0.62 | 0.05 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 7 | 31 | 19 August 2025 | | 3.85 | 0.62 | 0.05 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 8 | 31 | 19 September 2025 | | 3.22 | 0.63 | 0.04 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 9 | 30 | 19 October 2025 | | 2.58 | 0.64 | 0.03 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 10 | 31 | 19 November 2025 | | 1.94 | 0.64 | 0.03 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 11 | 30 | 19 December 2025 | | 1.29 | 0.65 | 0.02 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 12 | 31 | 19 January 2026 | | 0.63 | 0.66 | 0.01 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 13 | 31 | 19 February 2026 | | 0.0 | 0.63 | 0.01 | 0.0 | 0.0 | 0.64 | 0.0 | 0.0 | 0.0 | 0.64 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 10.01 | 0.5 | 0.0 | 0.0 | 10.51 | 2.5 | 0.0 | 0.0 | 8.01 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 10.01 | 0.0 | 0.0 | 0.0 | 0.0 | 10.01 | false | false |
| 19 February 2025 | Down Payment | 2.5 | 2.5 | 0.0 | 0.0 | 0.0 | 7.51 | false | false |
And Customer makes "AUTOPAY" repayment on "19 February 2025" with 0.67 EUR transaction amount
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 10.01 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 7.51 | 2.5 | 0.0 | 0.0 | 0.0 | 2.5 | 2.5 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 6.91 | 0.6 | 0.07 | 0.0 | 0.0 | 0.67 | 0.67 | 0.67 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 6.31 | 0.6 | 0.07 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 4 | 30 | 19 May 2025 | | 5.7 | 0.61 | 0.06 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 5 | 31 | 19 June 2025 | | 5.09 | 0.61 | 0.06 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 6 | 30 | 19 July 2025 | | 4.47 | 0.62 | 0.05 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 7 | 31 | 19 August 2025 | | 3.85 | 0.62 | 0.05 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 8 | 31 | 19 September 2025 | | 3.22 | 0.63 | 0.04 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 9 | 30 | 19 October 2025 | | 2.58 | 0.64 | 0.03 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 10 | 31 | 19 November 2025 | | 1.94 | 0.64 | 0.03 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 11 | 30 | 19 December 2025 | | 1.29 | 0.65 | 0.02 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 12 | 31 | 19 January 2026 | | 0.63 | 0.66 | 0.01 | 0.0 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | 0.67 |
| 13 | 31 | 19 February 2026 | | 0.0 | 0.63 | 0.01 | 0.0 | 0.0 | 0.64 | 0.0 | 0.0 | 0.0 | 0.64 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 10.01 | 0.5 | 0.0 | 0.0 | 10.51 | 3.17 | 0.67 | 0.0 | 7.34 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 10.01 | 0.0 | 0.0 | 0.0 | 0.0 | 10.01 | false | false |
| 19 February 2025 | Down Payment | 2.5 | 2.5 | 0.0 | 0.0 | 0.0 | 7.51 | false | false |
| 19 February 2025 | Repayment | 0.67 | 0.6 | 0.07 | 0.0 | 0.0 | 6.91 | false | false |
When Admin sets the business date to "20 February 2025"
When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "20 February 2025" with 3.35 EUR transaction amount
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 10.01 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 7.51 | 2.5 | 0.0 | 0.0 | 0.0 | 2.5 | 2.5 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 6.91 | 0.6 | 0.07 | 0.0 | 0.0 | 0.67 | 0.67 | 0.67 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 6.31 | 0.6 | 0.07 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 4 | 30 | 19 May 2025 | | 5.7 | 0.61 | 0.06 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 5 | 31 | 19 June 2025 | | 5.09 | 0.61 | 0.06 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 6 | 30 | 19 July 2025 | | 4.47 | 0.62 | 0.05 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 7 | 31 | 19 August 2025 | | 3.85 | 0.62 | 0.05 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 8 | 31 | 19 September 2025 | | 3.22 | 0.63 | 0.04 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 9 | 30 | 19 October 2025 | | 2.58 | 0.64 | 0.03 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 10 | 31 | 19 November 2025 | | 1.94 | 0.64 | 0.03 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 11 | 30 | 19 December 2025 | | 1.29 | 0.65 | 0.02 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 12 | 31 | 19 January 2026 | | 0.63 | 0.66 | 0.01 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 13 | 31 | 19 February 2026 | | 0.0 | 0.63 | 0.01 | 0.0 | 0.0 | 0.64 | 0.35 | 0.35 | 0.0 | 0.29 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 10.01 | 0.5 | 0.0 | 0.0 | 10.51 | 6.52 | 4.02 | 0.0 | 3.99 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 10.01 | 0.0 | 0.0 | 0.0 | 0.0 | 10.01 | false | false |
| 19 February 2025 | Down Payment | 2.5 | 2.5 | 0.0 | 0.0 | 0.0 | 7.51 | false | false |
| 19 February 2025 | Repayment | 0.67 | 0.6 | 0.07 | 0.0 | 0.0 | 6.91 | false | false |
| 20 February 2025 | Merchant Issued Refund | 3.35 | 3.35 | 0.0 | 0.0 | 0.0 | 3.56 | false | false |
When Admin sets the business date to "21 February 2025"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 10.01 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 7.51 | 2.5 | 0.0 | 0.0 | 0.0 | 2.5 | 2.5 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 6.91 | 0.6 | 0.07 | 0.0 | 0.0 | 0.67 | 0.67 | 0.67 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 6.31 | 0.6 | 0.07 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 4 | 30 | 19 May 2025 | | 5.7 | 0.61 | 0.06 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 5 | 31 | 19 June 2025 | | 5.09 | 0.61 | 0.06 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 6 | 30 | 19 July 2025 | | 4.47 | 0.62 | 0.05 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 7 | 31 | 19 August 2025 | | 3.85 | 0.62 | 0.05 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 8 | 31 | 19 September 2025 | | 3.22 | 0.63 | 0.04 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 9 | 30 | 19 October 2025 | | 2.58 | 0.64 | 0.03 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 10 | 31 | 19 November 2025 | | 1.94 | 0.64 | 0.03 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 11 | 30 | 19 December 2025 | | 1.29 | 0.65 | 0.02 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 12 | 31 | 19 January 2026 | | 0.63 | 0.66 | 0.01 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 13 | 31 | 19 February 2026 | | 0.0 | 0.63 | 0.01 | 0.0 | 0.0 | 0.64 | 0.35 | 0.35 | 0.0 | 0.29 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 10.01 | 0.5 | 0.0 | 0.0 | 10.51 | 6.52 | 4.02 | 0.0 | 3.99 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 10.01 | 0.0 | 0.0 | 0.0 | 0.0 | 10.01 | false | false |
| 19 February 2025 | Down Payment | 2.5 | 2.5 | 0.0 | 0.0 | 0.0 | 7.51 | false | false |
| 19 February 2025 | Repayment | 0.67 | 0.6 | 0.07 | 0.0 | 0.0 | 6.91 | false | false |
| 20 February 2025 | Merchant Issued Refund | 3.35 | 3.35 | 0.0 | 0.0 | 0.0 | 3.56 | false | false |
When Admin sets the business date to "22 February 2025"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 10.01 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 7.51 | 2.5 | 0.0 | 0.0 | 0.0 | 2.5 | 2.5 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 6.91 | 0.6 | 0.07 | 0.0 | 0.0 | 0.67 | 0.67 | 0.67 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 6.31 | 0.6 | 0.07 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 4 | 30 | 19 May 2025 | | 5.7 | 0.61 | 0.06 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 5 | 31 | 19 June 2025 | | 5.09 | 0.61 | 0.06 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 6 | 30 | 19 July 2025 | | 4.47 | 0.62 | 0.05 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 7 | 31 | 19 August 2025 | | 3.85 | 0.62 | 0.05 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 8 | 31 | 19 September 2025 | | 3.22 | 0.63 | 0.04 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 9 | 30 | 19 October 2025 | | 2.58 | 0.64 | 0.03 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 10 | 31 | 19 November 2025 | | 1.94 | 0.64 | 0.03 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 11 | 30 | 19 December 2025 | | 1.29 | 0.65 | 0.02 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 12 | 31 | 19 January 2026 | | 0.63 | 0.66 | 0.01 | 0.0 | 0.0 | 0.67 | 0.3 | 0.3 | 0.0 | 0.37 |
| 13 | 31 | 19 February 2026 | | 0.0 | 0.63 | 0.01 | 0.0 | 0.0 | 0.64 | 0.35 | 0.35 | 0.0 | 0.29 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 10.01 | 0.5 | 0.0 | 0.0 | 10.51 | 6.52 | 4.02 | 0.0 | 3.99 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 10.01 | 0.0 | 0.0 | 0.0 | 0.0 | 10.01 | false | false |
| 19 February 2025 | Down Payment | 2.5 | 2.5 | 0.0 | 0.0 | 0.0 | 7.51 | false | false |
| 19 February 2025 | Repayment | 0.67 | 0.6 | 0.07 | 0.0 | 0.0 | 6.91 | false | false |
| 20 February 2025 | Merchant Issued Refund | 3.35 | 3.35 | 0.0 | 0.0 | 0.0 | 3.56 | false | false |
@TestRailId:C3533
Scenario: Verify the accrual activity creation in case of full repayment on maturity date - absence of negative numbers with high interest rate and large principal
When Admin sets the business date to "19 February 2025"
And Admin creates a client with random data
And 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_PYMNT_INTEREST_DAILY_AUTO_DOWNPAYMENT_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY | 19 February 2025 | 9999.99 | 60 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
And Admin successfully approves the loan on "19 February 2025" with "9999.99" amount and expected disbursement date on "19 February 2025"
And Admin successfully disburse the loan on "19 February 2025" with "9999.99" EUR transaction amount
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 9999.99 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 7499.99 | 2500.0 | 0.0 | 0.0 | 0.0 | 2500.0 | 2500.0 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | | 7000.98 | 499.01 | 345.21 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 3 | 31 | 19 April 2025 | | 6513.52 | 487.46 | 356.76 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 4 | 30 | 19 May 2025 | | 5990.51 | 523.01 | 321.21 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 5 | 31 | 19 June 2025 | | 5451.56 | 538.95 | 305.27 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 6 | 30 | 19 July 2025 | | 4876.18 | 575.38 | 268.84 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 7 | 31 | 19 August 2025 | | 4280.44 | 595.74 | 248.48 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 8 | 31 | 19 September 2025 | | 3654.35 | 626.09 | 218.13 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 9 | 30 | 19 October 2025 | | 2990.34 | 664.01 | 180.21 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 10 | 31 | 19 November 2025 | | 2298.5 | 691.84 | 152.38 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 11 | 30 | 19 December 2025 | | 1567.63 | 730.87 | 113.35 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 12 | 31 | 19 January 2026 | | 803.29 | 764.34 | 79.88 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 13 | 31 | 19 February 2026 | | 0.0 | 803.29 | 40.93 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 9999.99 | 2630.65 | 0.0 | 0.0 | 12630.64 | 2500.00 | 0.0 | 0.0 | 10130.64 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 9999.99 | 0.0 | 0.0 | 0.0 | 0.0 | 9999.99 | false | false |
| 19 February 2025 | Down Payment | 2500.0 | 2500.0 | 0.0 | 0.0 | 0.0 | 7499.99 | false | false |
And Customer makes "AUTOPAY" repayment on "19 February 2025" with 844.22 EUR transaction amount
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 9999.99 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 7499.99 | 2500.0 | 0.0 | 0.0 | 0.0 | 2500.0 | 2500.0 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 7000.98 | 499.01 | 345.21 | 0.0 | 0.0 | 844.22 | 844.22 | 844.22 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 6513.52 | 487.46 | 356.76 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 4 | 30 | 19 May 2025 | | 5990.51 | 523.01 | 321.21 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 5 | 31 | 19 June 2025 | | 5451.56 | 538.95 | 305.27 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 6 | 30 | 19 July 2025 | | 4876.18 | 575.38 | 268.84 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 7 | 31 | 19 August 2025 | | 4280.44 | 595.74 | 248.48 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 8 | 31 | 19 September 2025 | | 3654.35 | 626.09 | 218.13 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 9 | 30 | 19 October 2025 | | 2990.34 | 664.01 | 180.21 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 10 | 31 | 19 November 2025 | | 2298.5 | 691.84 | 152.38 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 11 | 30 | 19 December 2025 | | 1567.63 | 730.87 | 113.35 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 12 | 31 | 19 January 2026 | | 803.29 | 764.34 | 79.88 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
| 13 | 31 | 19 February 2026 | | 0.0 | 803.29 | 40.93 | 0.0 | 0.0 | 844.22 | 0.0 | 0.0 | 0.0 | 844.22 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 9999.99 | 2630.65 | 0.0 | 0.0 | 12630.64 | 3344.22 | 844.22 | 0.0 | 9286.42 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 9999.99 | 0.0 | 0.0 | 0.0 | 0.0 | 9999.99 | false | false |
| 19 February 2025 | Down Payment | 2500.0 | 2500.0 | 0.0 | 0.0 | 0.0 | 7499.99 | false | false |
| 19 February 2025 | Repayment | 844.22 | 499.01 | 345.21 | 0.0 | 0.0 | 7000.98 | false | false |
When Admin sets the business date to "20 February 2025"
When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "20 February 2025" with 4221.1 EUR transaction amount
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 9999.99 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 7499.99 | 2500.0 | 0.0 | 0.0 | 0.0 | 2500.0 | 2500.0 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 7000.98 | 499.01 | 345.21 | 0.0 | 0.0 | 844.22 | 844.22 | 844.22 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 6513.52 | 487.46 | 356.76 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 4 | 30 | 19 May 2025 | | 5990.51 | 523.01 | 321.21 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 5 | 31 | 19 June 2025 | | 5451.56 | 538.95 | 305.27 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 6 | 30 | 19 July 2025 | | 4876.18 | 575.38 | 268.84 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 7 | 31 | 19 August 2025 | | 4280.44 | 595.74 | 248.48 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 8 | 31 | 19 September 2025 | | 3654.35 | 626.09 | 218.13 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 9 | 30 | 19 October 2025 | | 2990.34 | 664.01 | 180.21 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 10 | 31 | 19 November 2025 | | 2298.5 | 691.84 | 152.38 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 11 | 30 | 19 December 2025 | | 1567.63 | 730.87 | 113.35 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 12 | 31 | 19 January 2026 | | 803.29 | 764.34 | 79.88 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 13 | 31 | 19 February 2026 | | 0.0 | 803.29 | 40.93 | 0.0 | 0.0 | 844.22 | 383.7 | 383.7 | 0.0 | 460.52 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 9999.99 | 2630.65 | 0.0 | 0.0 | 12630.64 | 7565.32 | 5065.32 | 0.0 | 5065.32 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 9999.99 | 0.0 | 0.0 | 0.0 | 0.0 | 9999.99 | false | false |
| 19 February 2025 | Down Payment | 2500.0 | 2500.0 | 0.0 | 0.0 | 0.0 | 7499.99 | false | false |
| 19 February 2025 | Repayment | 844.22 | 499.01 | 345.21 | 0.0 | 0.0 | 7000.98 | false | false |
| 20 February 2025 | Merchant Issued Refund | 4221.1 | 4221.1 | 0.0 | 0.0 | 0.0 | 2779.88 | false | false |
When Admin sets the business date to "21 February 2025"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 9999.99 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 7499.99 | 2500.0 | 0.0 | 0.0 | 0.0 | 2500.0 | 2500.0 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 7000.98 | 499.01 | 345.21 | 0.0 | 0.0 | 844.22 | 844.22 | 844.22 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 6513.52 | 487.46 | 356.76 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 4 | 30 | 19 May 2025 | | 5990.51 | 523.01 | 321.21 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 5 | 31 | 19 June 2025 | | 5451.56 | 538.95 | 305.27 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 6 | 30 | 19 July 2025 | | 4876.18 | 575.38 | 268.84 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 7 | 31 | 19 August 2025 | | 4280.44 | 595.74 | 248.48 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 8 | 31 | 19 September 2025 | | 3654.35 | 626.09 | 218.13 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 9 | 30 | 19 October 2025 | | 2990.34 | 664.01 | 180.21 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 10 | 31 | 19 November 2025 | | 2298.5 | 691.84 | 152.38 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 11 | 30 | 19 December 2025 | | 1567.63 | 730.87 | 113.35 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 12 | 31 | 19 January 2026 | | 803.29 | 764.34 | 79.88 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 13 | 31 | 19 February 2026 | | 0.0 | 803.29 | 40.93 | 0.0 | 0.0 | 844.22 | 383.7 | 383.7 | 0.0 | 460.52 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 9999.99 | 2630.65 | 0.0 | 0.0 | 12630.64 | 7565.32 | 5065.32 | 0.0 | 5065.32 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 9999.99 | 0.0 | 0.0 | 0.0 | 0.0 | 9999.99 | false | false |
| 19 February 2025 | Down Payment | 2500.0 | 2500.0 | 0.0 | 0.0 | 0.0 | 7499.99 | false | false |
| 19 February 2025 | Repayment | 844.22 | 499.01 | 345.21 | 0.0 | 0.0 | 7000.98 | false | false |
| 20 February 2025 | Merchant Issued Refund | 4221.1 | 4221.1 | 0.0 | 0.0 | 0.0 | 2779.88 | false | false |
| 20 February 2025 | Accrual | 12.33 | 0.0 | 12.33 | 0.0 | 0.0 | 0.0 | false | false |
When Admin sets the business date to "22 February 2025"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 9999.99 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 7499.99 | 2500.0 | 0.0 | 0.0 | 0.0 | 2500.0 | 2500.0 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 7000.98 | 499.01 | 345.21 | 0.0 | 0.0 | 844.22 | 844.22 | 844.22 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 6513.52 | 487.46 | 356.76 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 4 | 30 | 19 May 2025 | | 5990.51 | 523.01 | 321.21 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 5 | 31 | 19 June 2025 | | 5451.56 | 538.95 | 305.27 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 6 | 30 | 19 July 2025 | | 4876.18 | 575.38 | 268.84 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 7 | 31 | 19 August 2025 | | 4280.44 | 595.74 | 248.48 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 8 | 31 | 19 September 2025 | | 3654.35 | 626.09 | 218.13 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 9 | 30 | 19 October 2025 | | 2990.34 | 664.01 | 180.21 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 10 | 31 | 19 November 2025 | | 2298.5 | 691.84 | 152.38 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 11 | 30 | 19 December 2025 | | 1567.63 | 730.87 | 113.35 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 12 | 31 | 19 January 2026 | | 803.29 | 764.34 | 79.88 | 0.0 | 0.0 | 844.22 | 383.74 | 383.74 | 0.0 | 460.48 |
| 13 | 31 | 19 February 2026 | | 0.0 | 803.29 | 40.93 | 0.0 | 0.0 | 844.22 | 383.7 | 383.7 | 0.0 | 460.52 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 9999.99 | 2630.65 | 0.0 | 0.0 | 12630.64 | 7565.32 | 5065.32 | 0.0 | 5065.32 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 9999.99 | 0.0 | 0.0 | 0.0 | 0.0 | 9999.99 | false | false |
| 19 February 2025 | Down Payment | 2500.0 | 2500.0 | 0.0 | 0.0 | 0.0 | 7499.99 | false | false |
| 19 February 2025 | Repayment | 844.22 | 499.01 | 345.21 | 0.0 | 0.0 | 7000.98 | false | false |
| 20 February 2025 | Merchant Issued Refund | 4221.1 | 4221.1 | 0.0 | 0.0 | 0.0 | 2779.88 | false | false |
| 20 February 2025 | Accrual | 12.33 | 0.0 | 12.33 | 0.0 | 0.0 | 0.0 | false | false |
| 20 February 2025 | Accrual | 12.33 | 0.0 | 12.33 | 0.0 | 0.0 | 0.0 | false | false |
@TestRailId:C3534
Scenario: Verify the accrual activity creation in case of full repayment on maturity date - absence of negative numbers with mid-range interest rate and mid-range principal
When Admin sets the business date to "19 February 2025"
And Admin creates a client with random data
And 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_PYMNT_INTEREST_DAILY_AUTO_DOWNPAYMENT_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY | 19 February 2025 | 5000 | 36 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
And Admin successfully approves the loan on "19 February 2025" with "5000" amount and expected disbursement date on "19 February 2025"
And Admin successfully disburse the loan on "19 February 2025" with "5000" EUR transaction amount
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 3750.0 | 1250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | 1250.0 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | | 3477.35 | 272.65 | 103.56 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 3 | 31 | 19 April 2025 | | 3207.46 | 269.89 | 106.32 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 4 | 30 | 19 May 2025 | | 2926.16 | 281.3 | 94.91 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 5 | 31 | 19 June 2025 | | 2639.42 | 286.74 | 89.47 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 6 | 30 | 19 July 2025 | | 2341.31 | 298.11 | 78.1 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 7 | 31 | 19 August 2025 | | 2036.69 | 304.62 | 71.59 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 8 | 31 | 19 September 2025 | | 1722.75 | 313.94 | 62.27 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 9 | 30 | 19 October 2025 | | 1397.51 | 325.24 | 50.97 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 10 | 31 | 19 November 2025 | | 1064.03 | 333.48 | 42.73 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 11 | 30 | 19 December 2025 | | 719.3 | 344.73 | 31.48 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 12 | 31 | 19 January 2026 | | 365.08 | 354.22 | 21.99 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 13 | 31 | 19 February 2026 | | 0.0 | 365.08 | 11.16 | 0.0 | 0.0 | 376.24 | 0.0 | 0.0 | 0.0 | 376.24 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 5000.0 | 764.55 | 0.0 | 0.0 | 5764.55 | 1250.0 | 0.0 | 0.0 | 4514.55 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | false | false |
| 19 February 2025 | Down Payment | 1250.0 | 1250.0 | 0.0 | 0.0 | 0.0 | 3750.0 | false | false |
And Customer makes "AUTOPAY" repayment on "19 February 2025" with 376.21 EUR transaction amount
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 3750.0 | 1250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | 1250.0 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 3477.35 | 272.65 | 103.56 | 0.0 | 0.0 | 376.21 | 376.21 | 376.21 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 3207.46 | 269.89 | 106.32 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 4 | 30 | 19 May 2025 | | 2926.16 | 281.3 | 94.91 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 5 | 31 | 19 June 2025 | | 2639.42 | 286.74 | 89.47 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 6 | 30 | 19 July 2025 | | 2341.31 | 298.11 | 78.1 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 7 | 31 | 19 August 2025 | | 2036.69 | 304.62 | 71.59 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 8 | 31 | 19 September 2025 | | 1722.75 | 313.94 | 62.27 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 9 | 30 | 19 October 2025 | | 1397.51 | 325.24 | 50.97 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 10 | 31 | 19 November 2025 | | 1064.03 | 333.48 | 42.73 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 11 | 30 | 19 December 2025 | | 719.3 | 344.73 | 31.48 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 12 | 31 | 19 January 2026 | | 365.08 | 354.22 | 21.99 | 0.0 | 0.0 | 376.21 | 0.0 | 0.0 | 0.0 | 376.21 |
| 13 | 31 | 19 February 2026 | | 0.0 | 365.08 | 11.16 | 0.0 | 0.0 | 376.24 | 0.0 | 0.0 | 0.0 | 376.24 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 5000.0 | 764.55 | 0.0 | 0.0 | 5764.55 | 1626.21 | 376.21 | 0.0 | 4138.34 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | false | false |
| 19 February 2025 | Down Payment | 1250.0 | 1250.0 | 0.0 | 0.0 | 0.0 | 3750.0 | false | false |
| 19 February 2025 | Repayment | 376.21 | 272.65 | 103.56 | 0.0 | 0.0 | 3477.35 | false | false |
When Admin sets the business date to "20 February 2025"
When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "20 February 2025" with 1881.05 EUR transaction amount
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 3750.0 | 1250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | 1250.0 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 3477.35 | 272.65 | 103.56 | 0.0 | 0.0 | 376.21 | 376.21 | 376.21 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 3207.46 | 269.89 | 106.32 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 4 | 30 | 19 May 2025 | | 2926.16 | 281.3 | 94.91 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 5 | 31 | 19 June 2025 | | 2639.42 | 286.74 | 89.47 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 6 | 30 | 19 July 2025 | | 2341.31 | 298.11 | 78.1 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 7 | 31 | 19 August 2025 | | 2036.69 | 304.62 | 71.59 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 8 | 31 | 19 September 2025 | | 1722.75 | 313.94 | 62.27 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 9 | 30 | 19 October 2025 | | 1397.51 | 325.24 | 50.97 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 10 | 31 | 19 November 2025 | | 1064.03 | 333.48 | 42.73 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 11 | 30 | 19 December 2025 | | 719.3 | 344.73 | 31.48 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 12 | 31 | 19 January 2026 | | 365.08 | 354.22 | 21.99 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 13 | 31 | 19 February 2026 | | 0.0 | 365.08 | 11.16 | 0.0 | 0.0 | 376.24 | 171.05 | 171.05 | 0.0 | 205.19 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 5000.0 | 764.55 | 0.0 | 0.0 | 5764.55 | 3507.26 | 2257.26 | 0.0 | 2257.29 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | false | false |
| 19 February 2025 | Down Payment | 1250.0 | 1250.0 | 0.0 | 0.0 | 0.0 | 3750.0 | false | false |
| 19 February 2025 | Repayment | 376.21 | 272.65 | 103.56 | 0.0 | 0.0 | 3477.35 | false | false |
| 20 February 2025 | Merchant Issued Refund | 1881.05 | 1881.05 | 0.0 | 0.0 | 0.0 | 1596.3 | false | false |
When Admin sets the business date to "21 February 2025"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 3750.0 | 1250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | 1250.0 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 3477.35 | 272.65 | 103.56 | 0.0 | 0.0 | 376.21 | 376.21 | 376.21 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 3207.46 | 269.89 | 106.32 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 4 | 30 | 19 May 2025 | | 2926.16 | 281.3 | 94.91 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 5 | 31 | 19 June 2025 | | 2639.42 | 286.74 | 89.47 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 6 | 30 | 19 July 2025 | | 2341.31 | 298.11 | 78.1 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 7 | 31 | 19 August 2025 | | 2036.69 | 304.62 | 71.59 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 8 | 31 | 19 September 2025 | | 1722.75 | 313.94 | 62.27 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 9 | 30 | 19 October 2025 | | 1397.51 | 325.24 | 50.97 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 10 | 31 | 19 November 2025 | | 1064.03 | 333.48 | 42.73 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 11 | 30 | 19 December 2025 | | 719.3 | 344.73 | 31.48 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 12 | 31 | 19 January 2026 | | 365.08 | 354.22 | 21.99 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 13 | 31 | 19 February 2026 | | 0.0 | 365.08 | 11.16 | 0.0 | 0.0 | 376.24 | 171.05 | 171.05 | 0.0 | 205.19 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 5000.0 | 764.55 | 0.0 | 0.0 | 5764.55 | 3507.26 | 2257.26 | 0.0 | 2257.29 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | false | false |
| 19 February 2025 | Down Payment | 1250.0 | 1250.0 | 0.0 | 0.0 | 0.0 | 3750.0 | false | false |
| 19 February 2025 | Repayment | 376.21 | 272.65 | 103.56 | 0.0 | 0.0 | 3477.35 | false | false |
| 20 February 2025 | Merchant Issued Refund | 1881.05 | 1881.05 | 0.0 | 0.0 | 0.0 | 1596.3 | false | false |
| 20 February 2025 | Accrual | 3.7 | 0.0 | 3.7 | 0.0 | 0.0 | 0.0 | false | false |
When Admin sets the business date to "22 February 2025"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 13 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 |
| | | 19 February 2025 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 0 | 19 February 2025 | 19 February 2025 | 3750.0 | 1250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | 1250.0 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 19 March 2025 | 19 February 2025 | 3477.35 | 272.65 | 103.56 | 0.0 | 0.0 | 376.21 | 376.21 | 376.21 | 0.0 | 0.0 |
| 3 | 31 | 19 April 2025 | | 3207.46 | 269.89 | 106.32 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 4 | 30 | 19 May 2025 | | 2926.16 | 281.3 | 94.91 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 5 | 31 | 19 June 2025 | | 2639.42 | 286.74 | 89.47 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 6 | 30 | 19 July 2025 | | 2341.31 | 298.11 | 78.1 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 7 | 31 | 19 August 2025 | | 2036.69 | 304.62 | 71.59 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 8 | 31 | 19 September 2025 | | 1722.75 | 313.94 | 62.27 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 9 | 30 | 19 October 2025 | | 1397.51 | 325.24 | 50.97 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 10 | 31 | 19 November 2025 | | 1064.03 | 333.48 | 42.73 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 11 | 30 | 19 December 2025 | | 719.3 | 344.73 | 31.48 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 12 | 31 | 19 January 2026 | | 365.08 | 354.22 | 21.99 | 0.0 | 0.0 | 376.21 | 171.0 | 171.0 | 0.0 | 205.21 |
| 13 | 31 | 19 February 2026 | | 0.0 | 365.08 | 11.16 | 0.0 | 0.0 | 376.24 | 171.05 | 171.05 | 0.0 | 205.19 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 5000.0 | 764.55 | 0.0 | 0.0 | 5764.55 | 3507.26 | 2257.26 | 0.0 | 2257.29 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 19 February 2025 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | false | false |
| 19 February 2025 | Down Payment | 1250.0 | 1250.0 | 0.0 | 0.0 | 0.0 | 3750.0 | false | false |
| 19 February 2025 | Repayment | 376.21 | 272.65 | 103.56 | 0.0 | 0.0 | 3477.35 | false | false |
| 20 February 2025 | Merchant Issued Refund | 1881.05 | 1881.05 | 0.0 | 0.0 | 0.0 | 1596.3 | false | false |
| 20 February 2025 | Accrual | 3.7 | 0.0 | 3.7 | 0.0 | 0.0 | 0.0 | false | false |
| 21 February 2025 | Accrual | 3.7 | 0.0 | 3.7 | 0.0 | 0.0 | 0.0 | false | false |
@@ -33,6 +33,7 @@ import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
@@ -1940,6 +1941,14 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep
Money evenPortion = transactionAmountUnprocessed.dividedBy(numberOfInstallments, MoneyHelper.getMathContext());
// Adjustment might be needed due to the divide operation and the rounding mode
Money balanceAdjustment = transactionAmountUnprocessed.minus(evenPortion.multipliedBy(numberOfInstallments));
if (evenPortion.add(balanceAdjustment).isLessThanZero()) {
// Note: Rounding mode DOWN grants that evenPortion cant pay more than unprocessed
// transaction amount.
evenPortion = transactionAmountUnprocessed.dividedBy(numberOfInstallments,
new MathContext(MoneyHelper.getMathContext().getPrecision(), RoundingMode.DOWN));
balanceAdjustment = transactionAmountUnprocessed.minus(evenPortion.multipliedBy(numberOfInstallments));
}
for (LoanRepaymentScheduleInstallment inAdvanceInstallment : inAdvanceInstallments) {
Set<LoanCharge> inAdvanceInstallmentCharges = getLoanChargesOfInstallment(charges, inAdvanceInstallment,
firstNormalInstallmentNumber);
@@ -26,6 +26,7 @@ import java.util.List;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.fineract.infrastructure.core.service.MathUtil;
import org.apache.fineract.organisation.monetary.data.CurrencyData;
import org.apache.fineract.portfolio.loanaccount.data.LoanSummaryData;
import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionBalance;
@@ -118,10 +119,7 @@ public class ProgressiveLoanSummaryDataProvider extends CommonLoanSummaryDataPro
if (dueAmounts != null) {
BigDecimal interestPaid = nextUnpaidInAdvanceInstallment.getInterestPaid();
BigDecimal dueInterest = dueAmounts.getDueInterest().getAmount();
if (interestPaid == null) {
return dueInterest;
}
return dueInterest.subtract(interestPaid);
return MathUtil.subtractToZero(dueInterest, interestPaid);
}
}
}