FINERACT-2281: added e2e automation tests for cases with accrual calculation on maturity date scenarios

This commit is contained in:
mdmytriv
2025-05-24 12:13:45 +02:00
committed by Arnold Gálovics
parent d963c340ee
commit 1aa8395458
4 changed files with 163 additions and 2 deletions
@@ -127,6 +127,7 @@ public enum DefaultLoanProduct implements LoanProduct {
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CAPITALIZED_INCOME_FEE, //
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME, //
LP2_ADV_PYMNT_ZERO_INTEREST_CHARGE_OFF_DELINQUENT_REASON_INTEREST_RECALC_CAPITALIZED_INCOME, //
LP2_ADV_PYMNT_360_30_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY, //
;
@Override
@@ -2606,6 +2606,23 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ
TestContext.INSTANCE.set(
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_DOWNPAYMENT_ACCRUAL_ACTIVITY,
responseLoanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRefundInterestRecalculation);
// LP2 + interest recalculation + zero-interest chargeOff behaviour + progressive loan schedule + horizontal
// (LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF_BEHAVIOUR)
final String name105 = DefaultLoanProduct.LP2_ADV_PYMNT_360_30_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY
.getName();
final PostLoanProductsRequest loanProductsRequestAdvInterestRecalculationZeroInterestChargeOffBehaviourAccrualActivity = loanProductsRequestFactory
.defaultLoanProductsRequestLP2InterestDailyRecalculation()//
.name(name105)//
.paymentAllocation(List.of(//
createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT")))
.enableAccrualActivityPosting(true)//
.chargeOffBehaviour("ZERO_INTEREST");//
final Response<PostLoanProductsResponse> responseLoanProductsRequestAdvInterestRecalculationZeroInterestChargeOffBehaviourAccrualActivity = loanProductsApi
.createLoanProduct(loanProductsRequestAdvInterestRecalculationZeroInterestChargeOffBehaviourAccrualActivity).execute();
TestContext.INSTANCE.set(
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_360_30_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY,
responseLoanProductsRequestAdvInterestRecalculationZeroInterestChargeOffBehaviourAccrualActivity);
}
public static AdvancedPaymentData createPaymentAllocation(String transactionType, String futureInstallmentAllocationRule,
@@ -151,6 +151,7 @@ public abstract class TestContextKey {
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CAPITALIZED_INCOME_FEE = "loanProductCreateResponseLP2ProgressiveAdvPayment36030InterestRecalcCapitalizedIncomeFee";
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME = "loanProductCreateResponseLP2ProgressiveAdvPayment36030InterestRecalcMultidisbursalCapitalizedIncome";
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_ZERO_INT_CHARGE_OFF_DELINQUENT_REASON_INT_RECALC_CAPITALIZED_INCOME = "loanProductCreateResponseLP2AdvancedPaymentZeroInterestChargeOffDelinquentReasonInterestRecalculationCapitalizedIncome";
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_360_30_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalculationZeroInterestChargeOffBehaviourAccrualActivity";
public static final String LP2_NO_INTEREST_RECALCULATION_CHARGEBACK_ALLOCATION_INTEREST_FIRST_RESPONSE = "loanProductCreateResponseLP2NoInterestRecalculationChargebackAllocationInterestFirst";
public static final String LP2_NO_INTEREST_RECALCULATION_CHARGEBACK_ALLOCATION_PRINCIPAL_FIRST_RESPONSE = "loanProductCreateResponseLP2NoInterestRecalculationChargebackAllocationPrincipalFirst";
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_ACCELERATE_MATURITY_CHARGE_OFF_BEHAVIOUR_LAST_INSTALLMENT_STRATEGY = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalculationAccelerateMaturityChargeOffBehaviourLastInstallmentStrategy";
@@ -6934,8 +6934,8 @@ Feature: Loan
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
Then Loan has 0 outstanding amount
# @TestRailId:C_1
Scenario: Verify repayment schedule and accrual transactions created after penalty is added for paid off loan on maturity date
@TestRailId:C3700
Scenario: Verify repayment schedule and accrual transactions created after penalty is added for paid off loan on maturity date - UC1
When Admin sets the business date to "08 May 2024"
And Admin creates a client with random data
When Admin creates a fully customized loan with the following data:
@@ -7075,3 +7075,145 @@ Feature: Loan
| 08 August 2024 | Accrual | 2.8 | 0.0 | 0.0 | 0.0 | 2.8 | 0.0 | false | false |
| 08 August 2024 | Accrual Activity | 6.22 | 0.0 | 3.42 | 0.0 | 2.8 | 0.0 | false | false |
| 15 August 2024 | Repayment | 2.8 | 0.0 | 0.0 | 0.0 | 2.8 | 0.0 | false | false |
@TestRailId:C3701
Scenario: Verify repayment schedule and accrual transactions created after penalty is added for paid off loan with accrual activity on maturity date - UC2
When Admin sets the business date to "08 May 2025"
And 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_PYMNT_360_30_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY | 08 May 2025 | 1000 | 12.19 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
And Admin successfully approves the loan on "08 May 2025" with "1000" amount and expected disbursement date on "08 May 2025"
When Admin successfully disburse the loan on "08 May 2025" with "1000" EUR transaction amount
Then Loan Repayment schedule has 3 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 |
| | | 08 May 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 08 June 2025 | | 670.03 | 329.97 | 10.16 | 0.0 | 0.0 | 340.13 | 0.0 | 0.0 | 0.0 | 340.13 |
| 2 | 30 | 08 July 2025 | | 336.71 | 333.32 | 6.81 | 0.0 | 0.0 | 340.13 | 0.0 | 0.0 | 0.0 | 340.13 |
| 3 | 31 | 08 August 2025 | | 0.0 | 336.71 | 3.42 | 0.0 | 0.0 | 340.13 | 0.0 | 0.0 | 0.0 | 340.13 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 1000.0 | 20.39 | 0.0 | 0.0 | 1020.39 | 0.0 | 0.0 | 0.0 | 1020.39 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 08 May 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
When Admin sets the business date to "08 June 2025"
And Customer makes "AUTOPAY" repayment on "08 June 2025" with 340.13 EUR transaction amount
When Admin sets the business date to "08 July 2025"
And Customer makes "AUTOPAY" repayment on "08 July 2025" with 340.13 EUR transaction amount
When Admin sets the business date to "08 August 2025"
And Admin runs inline COB job for Loan
And Customer makes "AUTOPAY" repayment on "08 August 2025" with 340.13 EUR transaction amount
Then Loan Repayment schedule has 3 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 |
| | | 08 May 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 08 June 2025 | 08 June 2025 | 670.03 | 329.97 | 10.16 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
| 2 | 30 | 08 July 2025 | 08 July 2025 | 336.71 | 333.32 | 6.81 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
| 3 | 31 | 08 August 2025 | 08 August 2025 | 0.0 | 336.71 | 3.42 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 1000.0 | 20.39 | 0.0 | 0.0 | 1020.39 | 1020.39 | 0.0 | 0.0 | 0.0 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 08 May 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
| 08 June 2025 | Repayment | 340.13 | 329.97 | 10.16 | 0.0 | 0.0 | 670.03 | false | false |
| 08 June 2025 | Accrual Activity | 10.16 | 0.0 | 10.16 | 0.0 | 0.0 | 0.0 | false | false |
| 08 July 2025 | Repayment | 340.13 | 333.32 | 6.81 | 0.0 | 0.0 | 336.71 | false | false |
| 08 July 2025 | Accrual Activity | 6.81 | 0.0 | 6.81 | 0.0 | 0.0 | 0.0 | false | false |
| 07 August 2025 | Accrual | 20.28 | 0.0 | 20.28 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Repayment | 340.13 | 336.71 | 3.42 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Accrual Activity | 3.42 | 0.0 | 3.42 | 0.0 | 0.0 | 0.0 | false | false |
# --- add penalty for paid off loan on maturity date ---#
When Admin adds "LOAN_NSF_FEE" due date charge with "08 August 2025" due date and 2.8 EUR transaction amount
Then Loan Repayment schedule has 3 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 |
| | | 08 May 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 08 June 2025 | 08 June 2025 | 670.03 | 329.97 | 10.16 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
| 2 | 30 | 08 July 2025 | 08 July 2025 | 336.71 | 333.32 | 6.81 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
| 3 | 31 | 08 August 2025 | | 0.0 | 336.71 | 3.42 | 0.0 | 2.8 | 342.93 | 340.13 | 0.0 | 0.0 | 2.8 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 1000.0 | 20.39 | 0.0 | 2.8 | 1023.19 | 1020.39 | 0.0 | 0.0 | 2.8 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 08 May 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
| 08 June 2025 | Repayment | 340.13 | 329.97 | 10.16 | 0.0 | 0.0 | 670.03 | false | false |
| 08 June 2025 | Accrual Activity | 10.16 | 0.0 | 10.16 | 0.0 | 0.0 | 0.0 | false | false |
| 08 July 2025 | Repayment | 340.13 | 333.32 | 6.81 | 0.0 | 0.0 | 336.71 | false | false |
| 08 July 2025 | Accrual Activity | 6.81 | 0.0 | 6.81 | 0.0 | 0.0 | 0.0 | false | false |
| 07 August 2025 | Accrual | 20.28 | 0.0 | 20.28 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Repayment | 340.13 | 336.71 | 3.42 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
When Admin sets the business date to "09 August 2025"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 3 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 |
| | | 08 May 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 08 June 2025 | 08 June 2025 | 670.03 | 329.97 | 10.16 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
| 2 | 30 | 08 July 2025 | 08 July 2025 | 336.71 | 333.32 | 6.81 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
| 3 | 31 | 08 August 2025 | | 0.0 | 336.71 | 3.42 | 0.0 | 2.8 | 342.93 | 340.13 | 0.0 | 0.0 | 2.8 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 1000.0 | 20.39 | 0.0 | 2.8 | 1023.19 | 1020.39 | 0.0 | 0.0 | 2.8 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 08 May 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
| 08 June 2025 | Repayment | 340.13 | 329.97 | 10.16 | 0.0 | 0.0 | 670.03 | false | false |
| 08 June 2025 | Accrual Activity | 10.16 | 0.0 | 10.16 | 0.0 | 0.0 | 0.0 | false | false |
| 08 July 2025 | Repayment | 340.13 | 333.32 | 6.81 | 0.0 | 0.0 | 336.71 | false | false |
| 08 July 2025 | Accrual Activity | 6.81 | 0.0 | 6.81 | 0.0 | 0.0 | 0.0 | false | false |
| 07 August 2025 | Accrual | 20.28 | 0.0 | 20.28 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Repayment | 340.13 | 336.71 | 3.42 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Accrual | 2.8 | 0.0 | 0.0 | 0.0 | 2.8 | 0.0 | false | false |
| 08 August 2025 | Accrual Activity | 6.22 | 0.0 | 3.42 | 0.0 | 2.8 | 0.0 | false | false |
When Admin sets the business date to "15 August 2025"
And Admin runs inline COB job for Loan
And Customer makes "AUTOPAY" repayment on "15 August 2025" with 2.8 EUR transaction amount
Then Loan Repayment schedule has 3 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 |
| | | 08 May 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 08 June 2025 | 08 June 2025 | 670.03 | 329.97 | 10.16 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
| 2 | 30 | 08 July 2025 | 08 July 2025 | 336.71 | 333.32 | 6.81 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
| 3 | 31 | 08 August 2025 | 15 August 2025 | 0.0 | 336.71 | 3.42 | 0.0 | 2.8 | 342.93 | 342.93 | 0.0 | 2.8 | 0.0 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 1000.0 | 20.39 | 0.0 | 2.8 | 1023.19 | 1023.19 | 0.0 | 2.8 | 0.0 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 08 May 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
| 08 June 2025 | Repayment | 340.13 | 329.97 | 10.16 | 0.0 | 0.0 | 670.03 | false | false |
| 08 June 2025 | Accrual Activity | 10.16 | 0.0 | 10.16 | 0.0 | 0.0 | 0.0 | false | false |
| 08 July 2025 | Repayment | 340.13 | 333.32 | 6.81 | 0.0 | 0.0 | 336.71 | false | false |
| 08 July 2025 | Accrual Activity | 6.81 | 0.0 | 6.81 | 0.0 | 0.0 | 0.0 | false | false |
| 07 August 2025 | Accrual | 20.28 | 0.0 | 20.28 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Repayment | 340.13 | 336.71 | 3.42 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Accrual | 2.8 | 0.0 | 0.0 | 0.0 | 2.8 | 0.0 | false | false |
| 08 August 2025 | Accrual Activity | 6.22 | 0.0 | 3.42 | 0.0 | 2.8 | 0.0 | false | false |
| 08 August 2025 | Accrual | 2.8 | 0.0 | 0.0 | 0.0 | 2.8 | 0.0 | false | false |
When Admin sets the business date to "16 August 2025"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 3 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 |
| | | 08 May 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 08 June 2025 | 08 June 2025 | 670.03 | 329.97 | 10.16 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
| 2 | 30 | 08 July 2025 | 08 July 2025 | 336.71 | 333.32 | 6.81 | 0.0 | 0.0 | 340.13 | 340.13 | 0.0 | 0.0 | 0.0 |
| 3 | 31 | 08 August 2025 | 15 August 2025 | 0.0 | 336.71 | 3.42 | 0.0 | 2.8 | 342.93 | 342.93 | 0.0 | 2.8 | 0.0 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 1000.0 | 20.39 | 0.0 | 2.8 | 1023.19 | 1023.19 | 0.0 | 2.8 | 0.0 |
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 08 May 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
| 08 June 2025 | Repayment | 340.13 | 329.97 | 10.16 | 0.0 | 0.0 | 670.03 | false | false |
| 08 June 2025 | Accrual Activity | 10.16 | 0.0 | 10.16 | 0.0 | 0.0 | 0.0 | false | false |
| 08 July 2025 | Repayment | 340.13 | 333.32 | 6.81 | 0.0 | 0.0 | 336.71 | false | false |
| 08 July 2025 | Accrual Activity | 6.81 | 0.0 | 6.81 | 0.0 | 0.0 | 0.0 | false | false |
| 07 August 2025 | Accrual | 20.28 | 0.0 | 20.28 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Repayment | 340.13 | 336.71 | 3.42 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 08 August 2025 | Accrual | 2.8 | 0.0 | 0.0 | 0.0 | 2.8 | 0.0 | false | false |
| 08 August 2025 | Accrual Activity | 6.22 | 0.0 | 3.42 | 0.0 | 2.8 | 0.0 | false | false |
| 15 August 2025 | Repayment | 2.8 | 0.0 | 0.0 | 0.0 | 2.8 | 0.0 | false | false |