From 072017c6016caa30a062eb333dd739024248e886 Mon Sep 17 00:00:00 2001 From: MarianaDmytrivBinariks Date: Fri, 27 Jun 2025 18:33:44 +0300 Subject: [PATCH] FINERACT-2181: added e2e auto test scenarios for loan accrual activity posing events --- .../data/loanproduct/DefaultLoanProduct.java | 1 + .../LoanProductGlobalInitializerStep.java | 25 ++- .../fineract/test/support/TestContextKey.java | 1 + .../features/LoanAccrualActivity.feature | 194 +++++++++++++++++- 4 files changed, 219 insertions(+), 2 deletions(-) diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/loanproduct/DefaultLoanProduct.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/loanproduct/DefaultLoanProduct.java index c724d2ada..624010637 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/loanproduct/DefaultLoanProduct.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/loanproduct/DefaultLoanProduct.java @@ -137,6 +137,7 @@ public enum DefaultLoanProduct implements LoanProduct { LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_PERCENTAGE_CAPITALIZED_INCOME, // LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_FLAT_CAPITALIZED_INCOME, // LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_MULTIDISB_CAPITALIZED_INCOME_ADJ_CUSTOM_ALLOC, // + LP2_ADV_PYMNT_360_30_INTEREST_RECALC_AUTO_DOWNPAYMENT_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY, // ; @Override diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/LoanProductGlobalInitializerStep.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/LoanProductGlobalInitializerStep.java index 77d966298..d1939eab9 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/LoanProductGlobalInitializerStep.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/LoanProductGlobalInitializerStep.java @@ -2585,7 +2585,8 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ .name(name104)// .enableDownPayment(true)// .disbursedAmountPercentageForDownPayment(new BigDecimal(25))// - .enableAutoRepaymentForDownPayment(true).daysInYearType(DaysInYearType.DAYS360.value)// + .enableAutoRepaymentForDownPayment(true)// + .daysInYearType(DaysInYearType.DAYS360.value)// .daysInMonthType(DaysInMonthType.DAYS30.value)// .isInterestRecalculationEnabled(true)// .preClosureInterestCalculationStrategy(1)// @@ -2936,6 +2937,7 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ TestContext.INSTANCE.set( TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_FLAT_CAPITALIZED_INCOME, responseLoanProductsRequestLP2ProgressiveAdvPymnt36030InterestRecalcApprovedOverAppliedFlatCapitalizedIncome); + // LP2 with progressive loan schedule + horizontal + interest EMI + 360/30 // + interest recalculation=false, buy down fees enabled final String name114 = DefaultLoanProduct.LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_BUYDOWN_FEES.getName(); @@ -2953,6 +2955,27 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ .createLoanProduct(loanProductsRequestLP2ProgressiveAdvPaymentBuyDownFees).execute(); TestContext.INSTANCE.set(TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_PROGRESSIVE_ADV_PYMNT_BUYDOWN_FEES, responseLoanProductsRequestLP2ProgressiveAdvPaymentBuyDownFees); + + // LP2 + interest recalculation + zero-interest chargeOff behaviour + progressive loan schedule + horizontal + // (LP2_ADV_PYMNT_360_30_INTEREST_RECALC_AUTO_DOWNPAYMENT_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY) + final String name115 = DefaultLoanProduct.LP2_ADV_PYMNT_360_30_INTEREST_RECALC_AUTO_DOWNPAYMENT_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY + .getName(); + final PostLoanProductsRequest loanProductsRequestAdvInterestRecalculationAutoDownpaymentZeroInterestChargeOffBehaviourAccrualActivity = loanProductsRequestFactory + .defaultLoanProductsRequestLP2InterestDailyRecalculation()// + .name(name115)// + .enableDownPayment(true)// + .disbursedAmountPercentageForDownPayment(new BigDecimal(25))// + .enableAutoRepaymentForDownPayment(true)// + .paymentAllocation(List.of(// + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"))) + .enableAccrualActivityPosting(true)// + .chargeOffBehaviour("ZERO_INTEREST");// + final Response responseLoanProductsRequestAdvInterestRecalculationAutoDownpaymentZeroInterestChargeOffBehaviourAccrualActivity = loanProductsApi + .createLoanProduct(loanProductsRequestAdvInterestRecalculationAutoDownpaymentZeroInterestChargeOffBehaviourAccrualActivity) + .execute(); + TestContext.INSTANCE.set( + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_360_30_INTEREST_RECALC_AUTO_DOWNPAYMENT_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY, + responseLoanProductsRequestAdvInterestRecalculationAutoDownpaymentZeroInterestChargeOffBehaviourAccrualActivity); } public static AdvancedPaymentData createPaymentAllocation(String transactionType, String futureInstallmentAllocationRule, diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java index 7cff8fc6e..3ccde040b 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java @@ -160,6 +160,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_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 DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_360_30_INTEREST_RECALC_AUTO_DOWNPAYMENT_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalculationAutoDownpaymentZeroInterestChargeOffBehaviourAccrualActivity"; 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"; diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature index 3cdb4d598..3ec5e6533 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature @@ -7558,7 +7558,7 @@ Feature: LoanAccrualActivity Then Loan has 0 outstanding amount @TestRailId:C3802 - Scenario: Correct Accrual Activity event publishing after loan reactivation + Scenario: Correct Accrual Activity event publishing for backdated loans when the loan re-opens after reversing a goodwill credit transaction - UC1 Given Admin sets the business date to "05 May 2023" And Admin creates a client with random data When Admin sets the business date to "24 June 2025" @@ -7589,3 +7589,195 @@ Feature: LoanAccrualActivity Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 September 2023" Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 October 2023" Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 November 2023" + And "Accrual Activity" transaction on "05 June 2023" got reverse-replayed on "24 June 2025" + + When Loan Pay-off is made on "24 June 2025" + Then Loan's all installments have obligations met + + @TestRailId:C3803 + Scenario: Correct Accrual Activity event publishing for backdated loans when the overpaid loan re-opens after reversing a goodwill credit transaction - UC2 + Given Admin sets the business date to "05 May 2023" + And Admin creates a client with random data + When Admin sets the business date to "24 June 2025" + 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_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_DOWNPAYMENT_ACCRUAL_ACTIVITY | 05 May 2023 | 359.79 | 9.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "05 May 2023" with "359.79" amount and expected disbursement date on "05 May 2023" + And Admin successfully disburse the loan on "05 May 2023" with "359.79" EUR transaction amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "19 May 2023" with 359.79 EUR transaction amount and system-generated Idempotency key + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "19 May 2023" + Then Loan status will be "OVERPAID" + When Customer undo "1"th transaction made on "19 May 2023" + Then Loan status will be "ACTIVE" + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 05 May 2023 | Disbursement | 359.79 | 0.0 | 0.0 | 0.0 | 0.0 | 359.79 | false | false | + | 05 May 2023 | Down Payment | 89.95 | 89.95 | 0.0 | 0.0 | 0.0 | 269.84 | false | false | + | 19 May 2023 | Goodwill Credit | 359.79 | 269.84 | 1.01 | 0.0 | 0.0 | 0.0 | true | false | + | 05 June 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | true | + | 05 July 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 August 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 September 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 October 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 November 2023 | Accrual | 1.01 | 0.0 | 1.01 | 0.0 | 0.0 | 0.0 | false | false | + | 05 November 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 July 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 August 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 September 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 October 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 November 2023" + And "Accrual Activity" transaction on "05 June 2023" got reverse-replayed on "24 June 2025" + + When Loan Pay-off is made on "24 June 2025" + Then Loan's all installments have obligations met + + @TestRailId:C3805 + Scenario: Correct Accrual Activity event publishing for backdated loans when the loan re-opens after reversing a payout refund transaction - UC3 + Given Admin sets the business date to "05 May 2023" + And Admin creates a client with random data + When Admin sets the business date to "24 June 2025" + 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_360_30_INTEREST_RECALC_AUTO_DOWNPAYMENT_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY | 05 May 2023 | 359.79 | 9.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "05 May 2023" with "359.79" amount and expected disbursement date on "05 May 2023" + And Admin successfully disburse the loan on "05 May 2023" with "359.79" EUR transaction amount + And Admin makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "19 May 2023" with 270.85 EUR transaction amount + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "19 May 2023" + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Customer undo "1"th transaction made on "19 May 2023" + Then Loan status will be "ACTIVE" + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 05 May 2023 | Disbursement | 359.79 | 0.0 | 0.0 | 0.0 | 0.0 | 359.79 | false | false | + | 05 May 2023 | Down Payment | 89.95 | 89.95 | 0.0 | 0.0 | 0.0 | 269.84 | false | false | + | 19 May 2023 | Payout Refund | 270.85 | 269.84 | 1.01 | 0.0 | 0.0 | 0.0 | true | false | + | 05 June 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | true | + | 05 July 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 August 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 September 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 October 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 November 2023 | Accrual | 1.01 | 0.0 | 1.01 | 0.0 | 0.0 | 0.0 | false | false | + | 05 November 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 July 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 August 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 September 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 October 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 November 2023" + And "Accrual Activity" transaction on "05 June 2023" got reverse-replayed on "24 June 2025" + + When Loan Pay-off is made on "24 June 2025" + Then Loan's all installments have obligations met + + @TestRailId:C3806 + Scenario: Correct Accrual Activity event publishing for backdated loans when the loan re-opens after reversing a merchant issue refund transaction - UC4 + Given Admin sets the business date to "05 May 2023" + And Admin creates a client with random data + When Admin sets the business date to "24 June 2025" + 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_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_DOWNPAYMENT_ACCRUAL_ACTIVITY | 05 May 2023 | 359.79 | 9.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "05 May 2023" with "359.79" amount and expected disbursement date on "05 May 2023" + And Admin successfully disburse the loan on "05 May 2023" with "359.79" EUR transaction amount + When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "19 May 2023" with 359.79 EUR transaction amount + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "19 May 2023" + Then Loan status will be "OVERPAID" + When Customer undo "1"th transaction made on "19 May 2023" + Then Loan status will be "ACTIVE" + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 05 May 2023 | Disbursement | 359.79 | 0.0 | 0.0 | 0.0 | 0.0 | 359.79 | false | false | + | 05 May 2023 | Down Payment | 89.95 | 89.95 | 0.0 | 0.0 | 0.0 | 269.84 | false | false | + | 19 May 2023 | Merchant Issued Refund | 359.79 | 269.84 | 1.01 | 0.0 | 0.0 | 0.0 | true | false | + | 19 May 2023 | Interest Refund | 1.01 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | true | false | + | 05 June 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | true | + | 05 July 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 August 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 September 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 October 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 November 2023 | Accrual | 1.01 | 0.0 | 1.01 | 0.0 | 0.0 | 0.0 | false | false | + | 05 November 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 July 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 August 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 September 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 October 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 November 2023" + And "Accrual Activity" transaction on "05 June 2023" got reverse-replayed on "24 June 2025" + + When Loan Pay-off is made on "24 June 2025" + Then Loan's all installments have obligations met + + @TestRailId:C3807 + Scenario: Correct Accrual Activity event publishing for backdated loans when the loan re-opens after reversing a interest payment waiver transaction - UC5 + Given Admin sets the business date to "05 May 2023" + And Admin creates a client with random data + When Admin sets the business date to "24 June 2025" + 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_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_DOWNPAYMENT_ACCRUAL_ACTIVITY | 05 May 2023 | 359.79 | 9.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "05 May 2023" with "359.79" amount and expected disbursement date on "05 May 2023" + And Admin successfully disburse the loan on "05 May 2023" with "359.79" EUR transaction amount + When Admin makes "INTEREST_PAYMENT_WAIVER" transaction with "AUTOPAY" payment type on "19 May 2023" with 270.85 EUR transaction amount + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "19 May 2023" + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Customer undo "1"th transaction made on "19 May 2023" + Then Loan status will be "ACTIVE" + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 05 May 2023 | Disbursement | 359.79 | 0.0 | 0.0 | 0.0 | 0.0 | 359.79 | false | false | + | 05 May 2023 | Down Payment | 89.95 | 89.95 | 0.0 | 0.0 | 0.0 | 269.84 | false | false | + | 19 May 2023 | Interest Payment Waiver | 270.85 | 269.84 | 1.01 | 0.0 | 0.0 | 0.0 | true | false | + | 05 June 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | true | + | 05 July 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 August 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 September 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 October 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 November 2023 | Accrual | 1.01 | 0.0 | 1.01 | 0.0 | 0.0 | 0.0 | false | false | + | 05 November 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 July 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 August 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 September 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 October 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 November 2023" + And "Accrual Activity" transaction on "05 June 2023" got reverse-replayed on "24 June 2025" + + When Loan Pay-off is made on "24 June 2025" + Then Loan's all installments have obligations met + + @TestRailId:C3808 + Scenario: Correct Accrual Activity event publishing for backdated loans when the loan re-opens after reversing a repayment transaction - UC6 + Given Admin sets the business date to "05 May 2023" + And Admin creates a client with random data + When Admin sets the business date to "24 June 2025" + 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_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_DOWNPAYMENT_ACCRUAL_ACTIVITY | 05 May 2023 | 359.79 | 9.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "05 May 2023" with "359.79" amount and expected disbursement date on "05 May 2023" + And Admin successfully disburse the loan on "05 May 2023" with "359.79" EUR transaction amount + When Customer makes "AUTOPAY" repayment on "19 May 2023" with 359.79 EUR transaction amount + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "19 May 2023" + Then Loan status will be "OVERPAID" + When Customer undo "1"th transaction made on "19 May 2023" + Then Loan status will be "ACTIVE" + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 05 May 2023 | Disbursement | 359.79 | 0.0 | 0.0 | 0.0 | 0.0 | 359.79 | false | false | + | 05 May 2023 | Down Payment | 89.95 | 89.95 | 0.0 | 0.0 | 0.0 | 269.84 | false | false | + | 19 May 2023 | Repayment | 359.79 | 269.84 | 1.01 | 0.0 | 0.0 | 0.0 | true | false | + | 05 June 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | true | + | 05 July 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 August 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 September 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 October 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + | 05 November 2023 | Accrual | 1.01 | 0.0 | 1.01 | 0.0 | 0.0 | 0.0 | false | false | + | 05 November 2023 | Accrual Activity | 2.25 | 0.0 | 2.25 | 0.0 | 0.0 | 0.0 | false | false | + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 July 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 August 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 September 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 October 2023" + Then LoanTransactionAccrualActivityPostBusinessEvent is raised on "05 November 2023" + And "Accrual Activity" transaction on "05 June 2023" got reverse-replayed on "24 June 2025" + + When Loan Pay-off is made on "24 June 2025" + Then Loan's all installments have obligations met + +