FINERACT-2307: added e2e tests for disbursement with Capitalized Income amount calculation while approved over applied setting enabled

This commit is contained in:
mdmytriv
2025-06-05 14:57:00 +02:00
committed by Adam Saghy
parent 6e5c6c4913
commit 57ef4a2771
8 changed files with 232 additions and 1 deletions
@@ -357,6 +357,139 @@ Feature: Capitalized Income
Then Admin fails to disburse the loan on "04 January 2024" with "200" EUR transaction amount due to exceed approved amount
Then Capitalized income with payment type "AUTOPAY" on "04 January 2024" is forbidden with amount "200" while exceed approved amount
@TestRailId:C3723
Scenario: Verify capitalized income amount with disbursement amount calculation within approved over applied amount for multidisbursal loan - UC10
When Admin sets the business date to "1 January 2024"
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 | charge calculation type | charge amount % |
| LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_MULTIDISB_APPROVED_OVER_APPLIED_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 |
And Admin successfully approves the loan on "1 January 2024" with "1500" amount and expected disbursement date on "1 January 2024"
And Admin successfully disburse the loan on "1 January 2024" with "1000" EUR transaction amount
Then Loan status will be "ACTIVE"
When Admin sets the business date to "2 January 2024"
And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "2 January 2024" with "200" EUR transaction amount
And Admin successfully disburse the loan on "2 January 2024" with "200" EUR transaction amount
Then Loan Repayment schedule has 6 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 |
| | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 02 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 02 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 1169.98 | 230.02 | 8.09 | 0.0 | 0.0 | 238.11 | 0.0 | 0.0 | 0.0 | 238.11 |
| 2 | 29 | 01 March 2024 | | 938.69 | 231.29 | 6.82 | 0.0 | 0.0 | 238.11 | 0.0 | 0.0 | 0.0 | 238.11 |
| 3 | 31 | 01 April 2024 | | 706.06 | 232.63 | 5.48 | 0.0 | 0.0 | 238.11 | 0.0 | 0.0 | 0.0 | 238.11 |
| 4 | 30 | 01 May 2024 | | 472.07 | 233.99 | 4.12 | 0.0 | 0.0 | 238.11 | 0.0 | 0.0 | 0.0 | 238.11 |
| 5 | 31 | 01 June 2024 | | 236.71 | 235.36 | 2.75 | 0.0 | 0.0 | 238.11 | 0.0 | 0.0 | 0.0 | 238.11 |
| 6 | 30 | 01 July 2024 | | 0.0 | 236.71 | 1.38 | 0.0 | 0.0 | 238.09 | 0.0 | 0.0 | 0.0 | 238.09 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 1400.0 | 28.64 | 0.0 | 0.0 | 1428.64 | 0.0 | 0.0 | 0.0 | 1428.64 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false |
| 02 January 2024 | Capitalized Income | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 1200.0 | false |
| 02 January 2024 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1400.0 | false |
And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries:
| Type | Account code | Account name | Debit | Credit |
| ASSET | 112601 | Loans Receivable | 200.0 | |
| LIABILITY | 145024 | Deferred Capitalized Income | | 200.0 |
Then Admin fails to disburse the loan on "02 January 2024" with "200" EUR trn amount with total disb amount "1400" and max disb amount "1500" due to exceed max applied amount
Then Capitalized income with payment type "AUTOPAY" on "02 January 2024" is forbidden with amount "200" while exceed approved amount
When Admin successfully undo disbursal
Then Loan status will be "APPROVED"
When Admin sets the business date to "3 January 2024"
And Admin successfully disburse the loan on "3 January 2024" with "1000" EUR transaction amount
And Admin sets the business date to "4 January 2024"
And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "4 January 2024" with "500" EUR transaction amount
Then Loan Repayment schedule has 6 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 |
| | | 03 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 04 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 03 February 2024 | | 1253.55 | 246.45 | 8.66 | 0.0 | 0.0 | 255.11 | 0.0 | 0.0 | 0.0 | 255.11 |
| 2 | 29 | 03 March 2024 | | 1005.75 | 247.8 | 7.31 | 0.0 | 0.0 | 255.11 | 0.0 | 0.0 | 0.0 | 255.11 |
| 3 | 31 | 03 April 2024 | | 756.51 | 249.24 | 5.87 | 0.0 | 0.0 | 255.11 | 0.0 | 0.0 | 0.0 | 255.11 |
| 4 | 30 | 03 May 2024 | | 505.81 | 250.7 | 4.41 | 0.0 | 0.0 | 255.11 | 0.0 | 0.0 | 0.0 | 255.11 |
| 5 | 31 | 03 June 2024 | | 253.65 | 252.16 | 2.95 | 0.0 | 0.0 | 255.11 | 0.0 | 0.0 | 0.0 | 255.11 |
| 6 | 30 | 03 July 2024 | | 0.0 | 253.65 | 1.48 | 0.0 | 0.0 | 255.13 | 0.0 | 0.0 | 0.0 | 255.13 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 1500.0 | 30.68 | 0.0 | 0.0 | 1530.68 | 0.0 | 0.0 | 0.0 | 1530.68 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 03 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false |
| 04 January 2024 | Capitalized Income | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 1500.0 | false |
Then Admin fails to disburse the loan on "04 January 2024" with "100" EUR trn amount with total disb amount "1100" and max disb amount "1500" due to exceed max applied amount
Then Capitalized income with payment type "AUTOPAY" on "04 January 2024" is forbidden with amount "100" while exceed approved amount
@TestRailId:C3730
Scenario: Verify capitalized income with disbursement amount calculation within approved amount for multidisbursal loan with undo capitalized income - UC11
When Admin sets the business date to "1 January 2024"
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 | charge calculation type | charge amount % |
| LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 |
And Admin successfully approves the loan on "1 January 2024" with "1000" amount and expected disbursement date on "1 January 2024"
And Admin successfully disburse the loan on "1 January 2024" with "500" EUR transaction amount
Then Loan status will be "ACTIVE"
When Admin sets the business date to "2 January 2024"
And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "2 January 2024" with "150" EUR transaction amount
When Admin sets the business date to "3 January 2024"
And Admin successfully disburse the loan on "3 January 2024" with "250" EUR transaction amount
Then Loan Repayment schedule has 6 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 |
| | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 02 January 2024 | | 150.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 03 January 2024 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 752.07 | 147.93 | 5.13 | 0.0 | 0.0 | 153.06 | 0.0 | 0.0 | 0.0 | 153.06 |
| 2 | 29 | 01 March 2024 | | 603.4 | 148.67 | 4.39 | 0.0 | 0.0 | 153.06 | 0.0 | 0.0 | 0.0 | 153.06 |
| 3 | 31 | 01 April 2024 | | 453.86 | 149.54 | 3.52 | 0.0 | 0.0 | 153.06 | 0.0 | 0.0 | 0.0 | 153.06 |
| 4 | 30 | 01 May 2024 | | 303.45 | 150.41 | 2.65 | 0.0 | 0.0 | 153.06 | 0.0 | 0.0 | 0.0 | 153.06 |
| 5 | 31 | 01 June 2024 | | 152.16 | 151.29 | 1.77 | 0.0 | 0.0 | 153.06 | 0.0 | 0.0 | 0.0 | 153.06 |
| 6 | 30 | 01 July 2024 | | 0.0 | 152.16 | 0.89 | 0.0 | 0.0 | 153.05 | 0.0 | 0.0 | 0.0 | 153.05 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 900.0 | 18.35 | 0.0 | 0.0 | 918.35 | 0.0 | 0.0 | 0.0 | 918.35 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false |
| 02 January 2024 | Capitalized Income | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 650.0 | false |
| 03 January 2024 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false |
And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries:
| Type | Account code | Account name | Debit | Credit |
| ASSET | 112601 | Loans Receivable | 150.0 | |
| LIABILITY | 145024 | Deferred Capitalized Income | | 150.0 |
Then Admin fails to disburse the loan on "02 January 2024" with "200" EUR transaction amount due to exceed approved amount
Then Capitalized income with payment type "AUTOPAY" on "02 January 2024" is forbidden with amount "200" while exceed approved amount
And Admin sets the business date to "4 January 2024"
# -- undo last disbursal -- #
When Admin successfully undo last disbursal
# -- undo capitalized income -- #
When Customer undo "1"th "Capitalized Income" transaction made on "02 January 2024"
And Admin successfully disburse the loan on "4 January 2024" with "200" EUR transaction amount
And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "4 January 2024" with "200" EUR transaction amount
Then Loan Repayment schedule has 6 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 |
| | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 04 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 04 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 751.98 | 148.02 | 5.02 | 0.0 | 0.0 | 153.04 | 0.0 | 0.0 | 0.0 | 153.04 |
| 2 | 29 | 01 March 2024 | | 603.33 | 148.65 | 4.39 | 0.0 | 0.0 | 153.04 | 0.0 | 0.0 | 0.0 | 153.04 |
| 3 | 31 | 01 April 2024 | | 453.81 | 149.52 | 3.52 | 0.0 | 0.0 | 153.04 | 0.0 | 0.0 | 0.0 | 153.04 |
| 4 | 30 | 01 May 2024 | | 303.42 | 150.39 | 2.65 | 0.0 | 0.0 | 153.04 | 0.0 | 0.0 | 0.0 | 153.04 |
| 5 | 31 | 01 June 2024 | | 152.15 | 151.27 | 1.77 | 0.0 | 0.0 | 153.04 | 0.0 | 0.0 | 0.0 | 153.04 |
| 6 | 30 | 01 July 2024 | | 0.0 | 152.15 | 0.89 | 0.0 | 0.0 | 153.04 | 0.0 | 0.0 | 0.0 | 153.04 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 900.0 | 18.24 | 0.0 | 0.0 | 918.24 | 0.0 | 0.0 | 0.0 | 918.24 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Reverted |
| 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | false |
| 02 January 2024 | Capitalized Income | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 650.0 | true | true |
| 04 January 2024 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 04 January 2024 | Capitalized Income | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | false |
Then Admin fails to disburse the loan on "04 January 2024" with "300" EUR transaction amount due to exceed approved amount
Then Capitalized income with payment type "AUTOPAY" on "04 January 2024" is forbidden with amount "300" while exceed approved amount
@TestRailId:C3646
Scenario: As a user I want to add capitalized income to a progressive loan after disbursement and then make a full repayment - amortization in case of loan close event
When Admin sets the business date to "1 January 2024"