From d963c340ee64e79bfdecd673bef998e7866795a6 Mon Sep 17 00:00:00 2001 From: mdmytriv Date: Fri, 23 May 2025 15:38:34 +0300 Subject: [PATCH] FINERACT-2281: added e2e automation tests for cases with no interest activities are recognized for reversal repayment scenarios --- .../data/loanproduct/DefaultLoanProduct.java | 2 + .../LoanProductGlobalInitializerStep.java | 69 +- .../test/stepdef/loan/LoanStepDef.java | 37 +- .../fineract/test/support/TestContextKey.java | 5 +- .../features/LoanAccrualActivity.feature | 1404 +++++++++++++++++ 5 files changed, 1505 insertions(+), 12 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 bdd78fb3f..a131fbd53 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 @@ -84,6 +84,8 @@ public enum DefaultLoanProduct implements LoanProduct { LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE_WHOLE_TERM, // LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_IR_DAILY_TILL_PRECLOSE_LAST_INSTALLMENT_STRATEGY, // LP2_ADV_PYMNT_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_REFUND_INTEREST_RECALCULATION, // + LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_ACCRUAL_ACTIVITY, // + LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_DOWNPAYMENT_ACCRUAL_ACTIVITY, // LP2_ADV_PYMNT_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_REFUND_INTEREST_RECALCULATION_MULTIDISB, // LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF_BEHAVIOUR, // LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF, // 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 56dfec061..faa84408f 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 @@ -2375,7 +2375,7 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyTillRestFrequencyDateLastInstallment) .execute(); TestContext.INSTANCE.set( - TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_IR_DAILY_TILL_REST_FREQUENCY_DATELAST_INSTALLMENT, + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_IR_DAILY_TILL_REST_FREQUENCY_DATE_LAST_INSTALLMENT, responseLoanProductsRequestLP2AdvancedpaymentInterest36030InterestRecalcDailyTillRestFrequencyDateLastInstallment); final String name97 = DefaultLoanProduct.LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_CAPITALIZED_INCOME.getName(); @@ -2539,6 +2539,73 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ TestContext.INSTANCE.set( TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_ZERO_INT_CHARGE_OFF_DELINQUENT_REASON_INT_RECALC_CAPITALIZED_INCOME, responseLoanProductsRequestPrgAdvZeroIntChargeOffDelinquentReasonIntRecalcCapitalizedIncome); + + // Merchant issued with Interest refund + interest recalculation, 360/30 + // accrual activity enabled + // (LP2_ADV_PYMNT_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_REFUND_INTEREST_RECALCULATION) + String name103 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_ACCRUAL_ACTIVITY + .getName(); + PostLoanProductsRequest loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRefundRecalculationAccrualActivity = loanProductsRequestFactory + .defaultLoanProductsRequestLP2Emi()// + .name(name103)// + .daysInYearType(DaysInYearType.DAYS360.value)// + .daysInMonthType(DaysInMonthType.DAYS30.value)// + .isInterestRecalculationEnabled(true)// + .preClosureInterestCalculationStrategy(1)// + .rescheduleStrategyMethod(4)// + .interestRecalculationCompoundingMethod(0)// + .recalculationRestFrequencyType(2)// + .recalculationRestFrequencyInterval(1)// + .supportedInterestRefundTypes(Arrays.asList("MERCHANT_ISSUED_REFUND", "PAYOUT_REFUND"))// + .enableAccrualActivityPosting(true)// + .paymentAllocation(List.of(// + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), // + createPaymentAllocation("GOODWILL_CREDIT", "NEXT_INSTALLMENT"), // + createPaymentAllocation("INTEREST_REFUND", "NEXT_INSTALLMENT"), // + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "NEXT_INSTALLMENT"), // + createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")));// + Response responseLoanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRefundRecalculationAccrualActivity = loanProductsApi + .createLoanProduct(loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRefundRecalculationAccrualActivity) + .execute(); + TestContext.INSTANCE.set( + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_ACCRUAL_ACTIVITY, + responseLoanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRefundRecalculationAccrualActivity); + + // Merchant issued with Interest refund + interest recalculation, 360/30 + // accrual activity enabled + // (LP2_ADV_PYMNT_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_REFUND_INTEREST_RECALCULATION) + String name104 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_DOWNPAYMENT_ACCRUAL_ACTIVITY + .getName(); + PostLoanProductsRequest loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRefundRecalculation = loanProductsRequestFactory + .defaultLoanProductsRequestLP2Emi()// + .name(name104)// + .enableDownPayment(true)// + .disbursedAmountPercentageForDownPayment(new BigDecimal(25))// + .enableAutoRepaymentForDownPayment(true).daysInYearType(DaysInYearType.DAYS360.value)// + .daysInMonthType(DaysInMonthType.DAYS30.value)// + .isInterestRecalculationEnabled(true)// + .preClosureInterestCalculationStrategy(1)// + .rescheduleStrategyMethod(4)// + .interestRecalculationCompoundingMethod(0)// + .recalculationRestFrequencyType(2)// + .recalculationRestFrequencyInterval(1)// + .supportedInterestRefundTypes(Arrays.asList("MERCHANT_ISSUED_REFUND", "PAYOUT_REFUND"))// + .enableAccrualActivityPosting(true)// + .paymentAllocation(List.of(// + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), // + createPaymentAllocation("GOODWILL_CREDIT", "NEXT_INSTALLMENT"), // + createPaymentAllocation("INTEREST_REFUND", "NEXT_INSTALLMENT"), // + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "NEXT_INSTALLMENT"), // + createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")))// + .multiDisburseLoan(true)// + .disallowExpectedDisbursements(true)// + .maxTrancheCount(10)// + .outstandingLoanBalance(10000.0);// + Response responseLoanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRefundInterestRecalculation = loanProductsApi + .createLoanProduct(loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRefundRecalculation).execute(); + 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); } public static AdvancedPaymentData createPaymentAllocation(String transactionType, String futureInstallmentAllocationRule, diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java index fbf42686d..8659a7b64 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java @@ -408,20 +408,12 @@ public class LoanStepDef extends AbstractStepDef { eventCheckHelper.loanBalanceChangedEventCheck(loanId); } - @Then("Credit Balance Refund transaction on future date {string} with {double} EUR transaction amount will result an error") - public void futureDateCBRError(String transactionDate, double transactionAmount) throws IOException { + public void checkCBRerror(PostLoansLoanIdTransactionsRequest paymentTransactionRequest, int errorCodeExpected, + String errorMessageExpected) throws IOException { Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); long loanId = loanResponse.body().getLoanId(); - int errorCodeExpected = 403; - String errorMessageExpected = String.format("Loan: %s, Credit Balance Refund transaction cannot be created for the future.", - loanId); - String transactionTypeValue = "creditBalanceRefund"; - - PostLoansLoanIdTransactionsRequest paymentTransactionRequest = LoanRequestFactory.defaultPaymentTransactionRequest() - .transactionDate(transactionDate).transactionAmount(transactionAmount); - Response paymentTransactionResponse = loanTransactionsApi .executeLoanTransaction(loanId, paymentTransactionRequest, transactionTypeValue).execute(); testContext().set(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE, paymentTransactionResponse); @@ -439,6 +431,31 @@ public class LoanStepDef extends AbstractStepDef { log.debug("ERROR MESSAGE: {}", errorMessageActual); } + @Then("Credit Balance Refund transaction on future date {string} with {double} EUR transaction amount will result an error") + public void futureDateCBRError(String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + int errorCodeExpected = 403; + String errorMessageExpected = String.format("Loan: %s, Credit Balance Refund transaction cannot be created for the future.", + loanId); + + PostLoansLoanIdTransactionsRequest paymentTransactionRequest = LoanRequestFactory.defaultPaymentTransactionRequest() + .transactionDate(transactionDate).transactionAmount(transactionAmount); + + checkCBRerror(paymentTransactionRequest, errorCodeExpected, errorMessageExpected); + } + + @Then("Credit Balance Refund transaction on active loan {string} with {double} EUR transaction amount will result an error") + public void notOverpaidLoanCBRError(String transactionDate, double transactionAmount) throws IOException { + int errorCodeExpected = 400; + String errorMessageExpected = "Loan Credit Balance Refund is not allowed. Loan Account is not Overpaid."; + + PostLoansLoanIdTransactionsRequest paymentTransactionRequest = LoanRequestFactory.defaultPaymentTransactionRequest() + .transactionDate(transactionDate).transactionAmount(transactionAmount); + checkCBRerror(paymentTransactionRequest, errorCodeExpected, errorMessageExpected); + } + @When("Admin creates a fully customized loan with the following data:") public void createFullyCustomizedLoan(final DataTable table) throws IOException { final List> data = table.asLists(); 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 845ed6f7c..8162b7df1 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 @@ -117,6 +117,7 @@ public abstract class TestContextKey { public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_ADVANCED_PAYMENT_ALLOCATION_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL = "loanProductCreateResponseLP1ProgressiveLoanScheduleHorizontal"; public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE_WHOLE_TERM = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationSameAsRepTillPreCloseWholeTerm"; public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_REFUND_INTEREST_RECALCULATION = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmiActualActualInterestRefundFInterestRecalculation"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_REFUND_INTEREST_RECALCULATION = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRefundFInterestRecalculation"; public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_REFUND_INTEREST_RECALCULATION_MULTIDISB = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmiActualActualInterestRefundFInterestRecalculationMultiDisb"; public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF_BEHAVIOUR = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalculationZeroInterestChargeOffBehaviour"; public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalculationZeroInterestChargeOff"; @@ -154,7 +155,9 @@ public abstract class TestContextKey { 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"; public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_ACCELERATE_MATURITY_CHARGE_OFF_BEHAVIOUR_LAST_INSTALLMENT_STRATEGY = "loanProductCreateResponseLP2AdvancedPaymentAccelerateMaturityChargeOffBehaviourLastInstallmentStrategy"; - public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_IR_DAILY_TILL_REST_FREQUENCY_DATELAST_INSTALLMENT = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationDailyTillRestFrequencyDateLastInstallment"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_IR_DAILY_TILL_REST_FREQUENCY_DATE_LAST_INSTALLMENT = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationDailyTillRestFrequencyDateLastInstallment"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_ACCRUAL_ACTIVITY = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRefundInterestRecalculationAccrualActivity"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_DOWNPAYMENT_ACCRUAL_ACTIVITY = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRefundInterestRecalculatioDownpaymentnAccrualActivity"; public static final String CHARGE_FOR_LOAN_PERCENT_LATE_CREATE_RESPONSE = "ChargeForLoanPercentLateCreateResponse"; public static final String CHARGE_FOR_LOAN_PERCENT_LATE_AMOUNT_PLUS_INTEREST_CREATE_RESPONSE = "ChargeForLoanPercentLateAmountPlusInterestCreateResponse"; public static final String CHARGE_FOR_LOAN_PERCENT_PROCESSING_CREATE_RESPONSE = "ChargeForLoanPercentProcessingCreateResponse"; 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 335c9e308..1ab6ee655 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature @@ -5583,3 +5583,1407 @@ Feature: LoanAccrualActivity | 04 January 2025 | accrual | 0.38 | | 0.38 | | | | | 05 January 2025 | repayment | 200.0 | 200.0 | | | | 1800.0 | Then Filtered out transactions list has 4 pages in case of size set to 1 and transactions are filtered out for transaction types: "disbursement, repayment" + + @TestRailId:C3692 + Scenario: Verify that accruals are added in case of reversed repayment made before MIR and CBR for progressive loan with downpayment - UC1 + When Admin sets the business date to "21 March 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_RECALCULATION_DAILY_EMI_360_30_MULTIDISBURSE_DOWNPAYMENT | 21 March 2025 | 242.46 | 29.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "21 March 2025" with "242.46" amount and expected disbursement date on "21 March 2025" + And Admin successfully disburse the loan on "21 March 2025" with "242.46" 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 21 March 2025 | | 181.84 | 60.62 | 0.0 | 0.0 | 0.0 | 60.62 | 0.0 | 0.0 | 0.0 | 60.62 | + | 2 | 31 | 21 April 2025 | | 168.65 | 13.19 | 4.54 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 3 | 30 | 21 May 2025 | | 155.13 | 13.52 | 4.21 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 4 | 31 | 21 June 2025 | | 141.28 | 13.85 | 3.88 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 5 | 30 | 21 July 2025 | | 127.08 | 14.2 | 3.53 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 6 | 31 | 21 August 2025 | | 112.53 | 14.55 | 3.18 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 7 | 31 | 21 September 2025 | | 97.61 | 14.92 | 2.81 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 8 | 30 | 21 October 2025 | | 82.32 | 15.29 | 2.44 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 9 | 31 | 21 November 2025 | | 66.65 | 15.67 | 2.06 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 10 | 30 | 21 December 2025 | | 50.59 | 16.06 | 1.67 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 11 | 31 | 21 January 2026 | | 34.12 | 16.47 | 1.26 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 12 | 31 | 21 February 2026 | | 17.24 | 16.88 | 0.85 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 13 | 28 | 21 March 2026 | | 0.0 | 17.24 | 0.43 | 0.0 | 0.0 | 17.67 | 0.0 | 0.0 | 0.0 | 17.67 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 242.46 | 30.86 | 0.0 | 0.0 | 273.32 | 0.0 | 0.0 | 0.0 | 273.32 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + And Customer makes "AUTOPAY" repayment on "21 March 2025" with 100 EUR transaction amount + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "21 March 2025" with 242.46 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 21 March 2025 | 21 March 2025 | 181.84 | 60.62 | 0.0 | 0.0 | 0.0 | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 21 April 2025 | 21 March 2025 | 164.11 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 3 | 30 | 21 May 2025 | 21 March 2025 | 146.38 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 4 | 31 | 21 June 2025 | 21 March 2025 | 128.65 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 5 | 30 | 21 July 2025 | 21 March 2025 | 110.92 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 6 | 31 | 21 August 2025 | 21 March 2025 | 93.19 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 7 | 31 | 21 September 2025 | 21 March 2025 | 75.46 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 8 | 30 | 21 October 2025 | 21 March 2025 | 57.73 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 9 | 31 | 21 November 2025 | 21 March 2025 | 40.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 10 | 30 | 21 December 2025 | 21 March 2025 | 22.27 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 11 | 31 | 21 January 2026 | 21 March 2025 | 4.54 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 12 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 4.54 | 0.0 | 0.0 | 0.0 | 4.54 | 4.54 | 4.54 | 0.0 | 0.0 | + | 13 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 242.46 | 0.0 | 0.0 | 0.0 | 242.46 | 242.46 | 181.84 | 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 | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "28 March 2025" + And Admin runs inline COB job for Loan + When Admin makes Credit Balance Refund transaction on "28 March 2025" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 21 March 2025 | 21 March 2025 | 181.84 | 60.62 | 0.0 | 0.0 | 0.0 | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 21 April 2025 | 21 March 2025 | 164.11 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 3 | 30 | 21 May 2025 | 21 March 2025 | 146.38 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 4 | 31 | 21 June 2025 | 21 March 2025 | 128.65 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 5 | 30 | 21 July 2025 | 21 March 2025 | 110.92 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 6 | 31 | 21 August 2025 | 21 March 2025 | 93.19 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 7 | 31 | 21 September 2025 | 21 March 2025 | 75.46 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 8 | 30 | 21 October 2025 | 21 March 2025 | 57.73 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 9 | 31 | 21 November 2025 | 21 March 2025 | 40.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 10 | 30 | 21 December 2025 | 21 March 2025 | 22.27 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 11 | 31 | 21 January 2026 | 21 March 2025 | 4.54 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 12 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 4.54 | 0.0 | 0.0 | 0.0 | 4.54 | 4.54 | 4.54 | 0.0 | 0.0 | + | 13 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 242.46 | 0.0 | 0.0 | 0.0 | 242.46 | 242.46 | 181.84 | 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 | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + | 28 March 2025 | Credit Balance Refund | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "02 April 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Repayment" transaction made on "21 March 2025" + When Admin sets the business date to "15 April 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 21 March 2025 | 21 March 2025 | 181.84 | 60.62 | 0.0 | 0.0 | 0.0 | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 21 April 2025 | | 166.69 | 115.15 | 1.93 | 0.0 | 0.0 | 117.08 | 15.15 | 15.15 | 0.0 | 101.93 | + | 3 | 30 | 21 May 2025 | 21 March 2025 | 151.54 | 15.15 | 0.0 | 0.0 | 0.0 | 15.15 | 15.15 | 15.15 | 0.0 | 0.0 | + | 4 | 31 | 21 June 2025 | 21 March 2025 | 136.39 | 15.15 | 0.0 | 0.0 | 0.0 | 15.15 | 15.15 | 15.15 | 0.0 | 0.0 | + | 5 | 30 | 21 July 2025 | 21 March 2025 | 121.24 | 15.15 | 0.0 | 0.0 | 0.0 | 15.15 | 15.15 | 15.15 | 0.0 | 0.0 | + | 6 | 31 | 21 August 2025 | 21 March 2025 | 106.09 | 15.15 | 0.0 | 0.0 | 0.0 | 15.15 | 15.15 | 15.15 | 0.0 | 0.0 | + | 7 | 31 | 21 September 2025 | 21 March 2025 | 90.94 | 15.15 | 0.0 | 0.0 | 0.0 | 15.15 | 15.15 | 15.15 | 0.0 | 0.0 | + | 8 | 30 | 21 October 2025 | 21 March 2025 | 75.79 | 15.15 | 0.0 | 0.0 | 0.0 | 15.15 | 15.15 | 15.15 | 0.0 | 0.0 | + | 9 | 31 | 21 November 2025 | 21 March 2025 | 60.64 | 15.15 | 0.0 | 0.0 | 0.0 | 15.15 | 15.15 | 15.15 | 0.0 | 0.0 | + | 10 | 30 | 21 December 2025 | 21 March 2025 | 45.49 | 15.15 | 0.0 | 0.0 | 0.0 | 15.15 | 15.15 | 15.15 | 0.0 | 0.0 | + | 11 | 31 | 21 January 2026 | 21 March 2025 | 30.34 | 15.15 | 0.0 | 0.0 | 0.0 | 15.15 | 15.15 | 15.15 | 0.0 | 0.0 | + | 12 | 31 | 21 February 2026 | 21 March 2025 | 15.19 | 15.15 | 0.0 | 0.0 | 0.0 | 15.15 | 15.15 | 15.15 | 0.0 | 0.0 | + | 13 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 15.19 | 0.0 | 0.0 | 0.0 | 15.19 | 15.19 | 15.19 | 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 | + | 342.46 | 1.93 | 0.0 | 0.0 | 344.39 | 242.46 | 181.84 | 0.0 | 101.93 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | true | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + | 14 April 2025 | Accrual | 1.37 | 0.0 | 1.37 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "21 April 2025" + And Admin runs inline COB job for Loan + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | true | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + | 14 April 2025 | Accrual | 1.37 | 0.0 | 1.37 | 0.0 | 0.0 | 0.0 | false | false | + | 15 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 16 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 17 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 18 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 19 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 20 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + + @TestRailId:C3693 + Scenario: Verify that accruals are added in case of reversed repayment made before MIR and CBR for progressive loan with auto downpayment - UC2 + When Admin sets the business date to "21 March 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_RECALCULATION_DAILY_EMI_360_30_MULTIDISBURSE_AUTO_DOWNPAYMENT | 21 March 2025 | 242.46 | 29.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "21 March 2025" with "242.46" amount and expected disbursement date on "21 March 2025" + And Admin successfully disburse the loan on "21 March 2025" with "242.46" 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 21 March 2025 | 21 March 2025 | 181.84 | 60.62 | 0.0 | 0.0 | 0.0 | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 21 April 2025 | | 168.65 | 13.19 | 4.54 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 3 | 30 | 21 May 2025 | | 155.13 | 13.52 | 4.21 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 4 | 31 | 21 June 2025 | | 141.28 | 13.85 | 3.88 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 5 | 30 | 21 July 2025 | | 127.08 | 14.2 | 3.53 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 6 | 31 | 21 August 2025 | | 112.53 | 14.55 | 3.18 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 7 | 31 | 21 September 2025 | | 97.61 | 14.92 | 2.81 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 8 | 30 | 21 October 2025 | | 82.32 | 15.29 | 2.44 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 9 | 31 | 21 November 2025 | | 66.65 | 15.67 | 2.06 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 10 | 30 | 21 December 2025 | | 50.59 | 16.06 | 1.67 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 11 | 31 | 21 January 2026 | | 34.12 | 16.47 | 1.26 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 12 | 31 | 21 February 2026 | | 17.24 | 16.88 | 0.85 | 0.0 | 0.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | + | 13 | 28 | 21 March 2026 | | 0.0 | 17.24 | 0.43 | 0.0 | 0.0 | 17.67 | 0.0 | 0.0 | 0.0 | 17.67 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 242.46 | 30.86 | 0.0 | 0.0 | 273.32 | 60.62 | 0.0 | 0.0 | 212.7 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Down Payment | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | 181.84 | false | false | + And Customer makes "AUTOPAY" repayment on "21 March 2025" with 100 EUR transaction amount + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "21 March 2025" with 242.46 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 160.62 overpaid 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 21 March 2025 | 21 March 2025 | 181.84 | 60.62 | 0.0 | 0.0 | 0.0 | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 21 April 2025 | 21 March 2025 | 164.11 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 3 | 30 | 21 May 2025 | 21 March 2025 | 146.38 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 4 | 31 | 21 June 2025 | 21 March 2025 | 128.65 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 5 | 30 | 21 July 2025 | 21 March 2025 | 110.92 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 6 | 31 | 21 August 2025 | 21 March 2025 | 93.19 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 7 | 31 | 21 September 2025 | 21 March 2025 | 75.46 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 8 | 30 | 21 October 2025 | 21 March 2025 | 57.73 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 9 | 31 | 21 November 2025 | 21 March 2025 | 40.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 10 | 30 | 21 December 2025 | 21 March 2025 | 22.27 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 11 | 31 | 21 January 2026 | 21 March 2025 | 4.54 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 12 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 4.54 | 0.0 | 0.0 | 0.0 | 4.54 | 4.54 | 4.54 | 0.0 | 0.0 | + | 13 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 242.46 | 0.0 | 0.0 | 0.0 | 242.46 | 242.46 | 181.84 | 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 | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Down Payment | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | 181.84 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 81.84 | false | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 81.84 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "28 March 2025" + And Admin runs inline COB job for Loan + When Admin makes Credit Balance Refund transaction on "28 March 2025" with 160.62 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 21 March 2025 | 21 March 2025 | 181.84 | 60.62 | 0.0 | 0.0 | 0.0 | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 21 April 2025 | 21 March 2025 | 164.11 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 3 | 30 | 21 May 2025 | 21 March 2025 | 146.38 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 4 | 31 | 21 June 2025 | 21 March 2025 | 128.65 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 5 | 30 | 21 July 2025 | 21 March 2025 | 110.92 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 6 | 31 | 21 August 2025 | 21 March 2025 | 93.19 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 7 | 31 | 21 September 2025 | 21 March 2025 | 75.46 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 8 | 30 | 21 October 2025 | 21 March 2025 | 57.73 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 9 | 31 | 21 November 2025 | 21 March 2025 | 40.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 10 | 30 | 21 December 2025 | 21 March 2025 | 22.27 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 11 | 31 | 21 January 2026 | 21 March 2025 | 4.54 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 12 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 4.54 | 0.0 | 0.0 | 0.0 | 4.54 | 4.54 | 4.54 | 0.0 | 0.0 | + | 13 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 242.46 | 0.0 | 0.0 | 0.0 | 242.46 | 242.46 | 181.84 | 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 | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Down Payment | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | 181.84 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 81.84 | false | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 81.84 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + | 28 March 2025 | Credit Balance Refund | 160.62 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "02 April 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Repayment" transaction made on "21 March 2025" + When Admin sets the business date to "15 April 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 21 March 2025 | 21 March 2025 | 181.84 | 60.62 | 0.0 | 0.0 | 0.0 | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 21 April 2025 | | 164.11 | 178.35 | 1.93 | 0.0 | 0.0 | 180.28 | 78.35 | 78.35 | 0.0 | 101.93 | + | 3 | 30 | 21 May 2025 | 21 March 2025 | 146.38 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 4 | 31 | 21 June 2025 | 21 March 2025 | 128.65 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 5 | 30 | 21 July 2025 | 21 March 2025 | 110.92 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 6 | 31 | 21 August 2025 | 21 March 2025 | 93.19 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 7 | 31 | 21 September 2025 | 21 March 2025 | 75.46 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 8 | 30 | 21 October 2025 | 21 March 2025 | 57.73 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 9 | 31 | 21 November 2025 | 21 March 2025 | 40.0 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 10 | 30 | 21 December 2025 | 21 March 2025 | 22.27 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 11 | 31 | 21 January 2026 | 21 March 2025 | 4.54 | 17.73 | 0.0 | 0.0 | 0.0 | 17.73 | 17.73 | 17.73 | 0.0 | 0.0 | + | 12 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 4.54 | 0.0 | 0.0 | 0.0 | 4.54 | 4.54 | 4.54 | 0.0 | 0.0 | + | 13 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 403.08 | 1.93 | 0.0 | 0.0 | 405.01 | 303.08 | 242.46 | 0.0 | 101.93 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Down Payment | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | 181.84 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 81.84 | true | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 181.84 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 160.62 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + | 14 April 2025 | Accrual | 1.37 | 0.0 | 1.37 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "21 April 2025" + And Admin runs inline COB job for Loan + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Down Payment | 60.62 | 60.62 | 0.0 | 0.0 | 0.0 | 181.84 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 81.84 | true | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 181.84 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 160.62 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + | 14 April 2025 | Accrual | 1.37 | 0.0 | 1.37 | 0.0 | 0.0 | 0.0 | false | false | + | 15 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 16 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 17 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 18 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 19 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 20 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + + @TestRailId:C3694 + Scenario: Verify repayment and accruals are added after reversed repayment made before MIR and CBR for progressive loan - UC3 + When Admin sets the business date to "21 March 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_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE | 21 March 2025 | 242.46 | 29.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "21 March 2025" with "242.46" amount and expected disbursement date on "21 March 2025" + And Admin successfully disburse the loan on "21 March 2025" with "242.46" EUR transaction amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | | 224.88 | 17.58 | 6.06 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 2 | 30 | 21 May 2025 | | 206.86 | 18.02 | 5.62 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 3 | 31 | 21 June 2025 | | 188.39 | 18.47 | 5.17 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 4 | 30 | 21 July 2025 | | 169.46 | 18.93 | 4.71 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 5 | 31 | 21 August 2025 | | 150.06 | 19.4 | 4.24 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 6 | 31 | 21 September 2025 | | 130.17 | 19.89 | 3.75 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 7 | 30 | 21 October 2025 | | 109.78 | 20.39 | 3.25 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 8 | 31 | 21 November 2025 | | 88.88 | 20.9 | 2.74 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 9 | 30 | 21 December 2025 | | 67.46 | 21.42 | 2.22 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 10 | 31 | 21 January 2026 | | 45.51 | 21.95 | 1.69 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 11 | 31 | 21 February 2026 | | 23.01 | 22.5 | 1.14 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 12 | 28 | 21 March 2026 | | 0.0 | 23.01 | 0.58 | 0.0 | 0.0 | 23.59 | 0.0 | 0.0 | 0.0 | 23.59 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 242.46 | 41.17 | 0.0 | 0.0 | 283.63 | 0.0 | 0.0 | 0.0 | 283.63 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + And Customer makes "AUTOPAY" repayment on "21 March 2025" with 40 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "21 March 2025" with 60 EUR transaction amount + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "21 March 2025" with 242.46 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 March 2025 | 218.82 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 195.18 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 171.54 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 147.9 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 124.26 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 100.62 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 76.98 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 53.34 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 29.7 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 6.06 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 6.06 | 0.0 | 0.0 | 0.0 | 6.06 | 6.06 | 6.06 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 242.46 | 0.0 | 0.0 | 0.0 | 242.46 | 242.46 | 242.46 | 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 | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 40.0 | 40.0 | 0.0 | 0.0 | 0.0 | 202.46 | false | false | + | 21 March 2025 | Repayment | 60.0 | 60.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "28 March 2025" + And Admin runs inline COB job for Loan + When Admin makes Credit Balance Refund transaction on "28 March 2025" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 March 2025 | 218.82 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 195.18 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 171.54 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 147.9 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 124.26 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 100.62 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 76.98 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 53.34 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 29.7 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 6.06 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 6.06 | 0.0 | 0.0 | 0.0 | 6.06 | 6.06 | 6.06 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 242.46 | 0.0 | 0.0 | 0.0 | 242.46 | 242.46 | 242.46 | 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 | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 40.0 | 40.0 | 0.0 | 0.0 | 0.0 | 202.46 | false | false | + | 21 March 2025 | Repayment | 60.0 | 60.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + | 28 March 2025 | Credit Balance Refund | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "02 April 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Repayment" transaction made on "21 March 2025" + When Admin sets the business date to "15 April 2025" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | | 218.82 | 123.64 | 0.77 | 0.0 | 0.0 | 124.41 | 83.64 | 83.64 | 0.0 | 40.77 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 195.18 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 171.54 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 147.9 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 124.26 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 100.62 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 76.98 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 53.34 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 29.7 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 6.06 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 6.06 | 0.0 | 0.0 | 0.0 | 6.06 | 6.06 | 6.06 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 342.46 | 0.77 | 0.0 | 0.0 | 343.23 | 302.46 | 302.46 | 0.0 | 40.77 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 40.0 | 40.0 | 0.0 | 0.0 | 0.0 | 202.46 | true | false | + | 21 March 2025 | Repayment | 60.0 | 60.0 | 0.0 | 0.0 | 0.0 | 182.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 182.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 40.0 | 0.0 | 0.0 | 0.0 | 40.0 | false | true | + | 14 April 2025 | Accrual | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "21 April 2025" + And Admin runs inline COB job for Loan + And Customer makes "AUTOPAY" repayment on "21 April 2025" with 80 EUR transaction amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 April 2025 | 218.82 | 123.64 | 0.77 | 0.0 | 0.0 | 124.41 | 124.41 | 83.64 | 0.0 | 0.0 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 195.18 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 171.54 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 147.9 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 124.26 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 100.62 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 76.98 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 53.34 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 29.7 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 6.06 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 6.06 | 0.0 | 0.0 | 0.0 | 6.06 | 6.06 | 6.06 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 342.46 | 0.77 | 0.0 | 0.0 | 343.23 | 343.23 | 302.46 | 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 | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 40.0 | 40.0 | 0.0 | 0.0 | 0.0 | 202.46 | true | false | + | 21 March 2025 | Repayment | 60.0 | 60.0 | 0.0 | 0.0 | 0.0 | 182.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 182.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 40.0 | 0.0 | 0.0 | 0.0 | 40.0 | false | true | + | 14 April 2025 | Accrual | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | + | 15 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + | 16 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + | 17 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + | 18 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 19 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + | 20 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Repayment | 80.0 | 40.0 | 0.77 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "23 April 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Repayment" transaction made on "21 April 2025" + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | | 218.82 | 123.64 | 0.77 | 0.0 | 0.0 | 124.41 | 83.64 | 83.64 | 0.0 | 40.77 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 195.18 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 171.54 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 147.9 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 124.26 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 100.62 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 76.98 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 53.34 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 29.7 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 6.06 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | 23.64 | 23.64 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 6.06 | 0.0 | 0.0 | 0.0 | 6.06 | 6.06 | 6.06 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 342.46 | 0.77 | 0.0 | 0.0 | 343.23 | 302.46 | 302.46 | 0.0 | 40.77 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 40.0 | 40.0 | 0.0 | 0.0 | 0.0 | 202.46 | true | false | + | 21 March 2025 | Repayment | 60.0 | 60.0 | 0.0 | 0.0 | 0.0 | 182.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 182.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 40.0 | 0.0 | 0.0 | 0.0 | 40.0 | false | true | + | 14 April 2025 | Accrual | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | + | 15 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + | 16 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + | 17 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + | 18 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 19 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + | 20 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Repayment | 80.0 | 40.0 | 0.77 | 0.0 | 0.0 | 0.0 | true | false | + | 21 April 2025 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | + + @TestRailId:C3695 + Scenario: Verify accrual activity of overpaid loan in case of reversed repayment made before MIR and CBR for loan with interest refund - UC4 + When Admin sets the business date to "21 March 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_EMI_ACTUAL_ACTUAL_INTEREST_REFUND_FULL | 21 March 2025 | 242.46 | 29.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "21 March 2025" with "242.46" amount and expected disbursement date on "21 March 2025" + And Admin successfully disburse the loan on "21 March 2025" with "242.46" EUR transaction amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | | 224.98 | 17.48 | 6.18 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 2 | 30 | 21 May 2025 | | 206.87 | 18.11 | 5.55 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 3 | 31 | 21 June 2025 | | 188.48 | 18.39 | 5.27 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 4 | 30 | 21 July 2025 | | 169.47 | 19.01 | 4.65 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 5 | 31 | 21 August 2025 | | 150.13 | 19.34 | 4.32 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 6 | 31 | 21 September 2025 | | 130.29 | 19.84 | 3.82 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 7 | 30 | 21 October 2025 | | 109.84 | 20.45 | 3.21 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 8 | 31 | 21 November 2025 | | 88.98 | 20.86 | 2.8 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 9 | 30 | 21 December 2025 | | 67.51 | 21.47 | 2.19 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 10 | 31 | 21 January 2026 | | 45.57 | 21.94 | 1.72 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 11 | 31 | 21 February 2026 | | 23.07 | 22.5 | 1.16 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 12 | 28 | 21 March 2026 | | 0.0 | 23.07 | 0.53 | 0.0 | 0.0 | 23.6 | 0.0 | 0.0 | 0.0 | 23.6 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 242.46 | 41.4 | 0.0 | 0.0 | 283.86 | 0.0 | 0.0 | 0.0 | 283.86 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "21 March 2025" with 142.46 EUR transaction amount and system-generated Idempotency key + And Customer makes "AUTOPAY" repayment on "21 March 2025" with 200 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 March 2025 | 218.8 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 195.14 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 171.48 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 147.82 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 124.16 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 100.5 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 76.84 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 53.18 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 29.52 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 5.86 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 5.86 | 0.0 | 0.0 | 0.0 | 5.86 | 5.86 | 5.86 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 242.46 | 0.0 | 0.0 | 0.0 | 242.46 | 242.46 | 242.46 | 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 | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 142.46 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 21 March 2025 | Repayment | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "28 March 2025" + And Admin runs inline COB job for Loan + When Admin makes Credit Balance Refund transaction on "28 March 2025" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "02 April 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Merchant Issued Refund" transaction made on "21 March 2025" + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | | 221.85 | 120.61 | 3.05 | 0.0 | 0.0 | 123.66 | 23.66 | 23.66 | 0.0 | 100.0 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 198.19 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 174.53 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 150.87 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 127.21 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 103.55 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 79.89 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 56.23 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | | 41.69 | 14.54 | 9.12 | 0.0 | 0.0 | 23.66 | 10.72 | 10.72 | 0.0 | 12.94 | + | 10 | 31 | 21 January 2026 | | 19.09 | 22.6 | 1.06 | 0.0 | 0.0 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | + | 11 | 31 | 21 February 2026 | | 0.0 | 19.09 | 0.49 | 0.0 | 0.0 | 19.58 | 0.0 | 0.0 | 0.0 | 19.58 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 342.46 | 13.72 | 0.0 | 0.0 | 356.18 | 200.0 | 200.0 | 0.0 | 156.18 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 142.46 | 0.0 | 0.0 | 0.0 | 100.0 | true | false | + | 21 March 2025 | Repayment | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 42.46 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | true | + When Admin sets the business date to "21 April 2025" + And Admin runs inline COB job for Loan + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "21 April 2025" with 100 EUR transaction amount and system-generated Idempotency key + And Customer makes "AUTOPAY" repayment on "21 April 2025" with 200 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 156.7 overpaid amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 April 2025 | 221.85 | 120.61 | 3.05 | 0.0 | 0.0 | 123.66 | 123.66| 23.66 | 0.0 | 0.0 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 198.19 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 174.53 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 150.87 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 127.21 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 103.55 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 79.89 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 56.23 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 April 2025 | 32.57 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 April 2025 | 8.91 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 April 2025 | 0.0 | 8.91 | 0.0 | 0.0 | 0.0 | 8.91 | 8.91 | 8.91 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 342.46 | 3.05 | 0.0 | 0.0 | 345.51 | 345.51 | 245.51 | 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 | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 142.46 | 0.0 | 0.0 | 0.0 | 100.0 | true | false | + | 21 March 2025 | Repayment | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 42.46 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | true | + | 20 April 2025 | Accrual | 2.94 | 0.0 | 2.94 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Merchant Issued Refund | 100.0 | 96.95 | 3.05 | 0.0 | 0.0 | 45.51 | false | false | + | 21 April 2025 | Interest Refund | 2.21 | 2.21 | 0.0 | 0.0 | 0.0 | 43.3 | false | false | + | 21 April 2025 | Repayment | 200.0 | 43.3 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "23 April 2025" + And Admin runs inline COB job for Loan + When Admin makes Credit Balance Refund transaction on "23 April 2025" with 156.7 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 April 2025 | 221.85 | 120.61 | 3.05 | 0.0 | 0.0 | 123.66 | 123.66 | 23.66 | 0.0 | 0.0 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 198.19 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 174.53 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 150.87 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 127.21 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 103.55 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 79.89 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 56.23 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 April 2025 | 32.57 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 April 2025 | 8.91 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 April 2025 | 0.0 | 8.91 | 0.0 | 0.0 | 0.0 | 8.91 | 8.91 | 8.91 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 342.46 | 3.05 | 0.0 | 0.0 | 345.51 | 345.51 | 245.51 | 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 | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 142.46 | 0.0 | 0.0 | 0.0 | 100.0 | true | false | + | 21 March 2025 | Repayment | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 42.46 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | true | + | 20 April 2025 | Accrual | 2.94 | 0.0 | 2.94 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Merchant Issued Refund | 100.0 | 96.95 | 3.05 | 0.0 | 0.0 | 45.51 | false | false | + | 21 April 2025 | Interest Refund | 2.21 | 2.21 | 0.0 | 0.0 | 0.0 | 43.3 | false | false | + | 21 April 2025 | Repayment | 200.0 | 43.3 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false | + | 23 April 2025 | Credit Balance Refund | 156.7 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "25 April 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Merchant Issued Refund" transaction made on "21 April 2025" + Then Loan has 104.56 outstanding amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 April 2025 | 221.85 | 120.61 | 3.05 | 0.0 | 0.0 | 123.66 | 123.66| 23.66 | 0.0 | 0.0 | + | 2 | 30 | 21 May 2025 | | 198.19 | 180.36 | 2.35 | 0.0 | 0.0 | 182.71 | 78.15 | 78.15 | 0.0 | 104.56 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 174.53 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 150.87 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 127.21 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 103.55 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 79.89 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 56.23 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 April 2025 | 32.57 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 April 2025 | 8.91 | 23.66 | 0.0 | 0.0 | 0.0 | 23.66 | 23.66 | 23.66 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 April 2025 | 0.0 | 8.91 | 0.0 | 0.0 | 0.0 | 8.91 | 8.91 | 8.91 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 499.16 | 5.4 | 0.0 | 0.0 | 504.56 | 400.0 | 300.0 | 0.0 | 104.56 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 142.46 | 0.0 | 0.0 | 0.0 | 100.0 | true | false | + | 21 March 2025 | Repayment | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 42.46 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | true | + | 20 April 2025 | Accrual | 2.94 | 0.0 | 2.94 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Merchant Issued Refund | 100.0 | 96.95 | 3.05 | 0.0 | 0.0 | 45.51 | true | false | + | 21 April 2025 | Interest Refund | 2.21 | 2.21 | 0.0 | 0.0 | 0.0 | 43.3 | true | false | + | 21 April 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Repayment | 200.0 | 142.46 | 3.05 | 0.0 | 0.0 | 0.0 | false | true | + | 23 April 2025 | Credit Balance Refund | 156.7 | 102.21 | 0.0 | 0.0 | 0.0 | 102.21 | false | true | +# - CBR on active loan - with outstanding amount is forbidden -# + Then Credit Balance Refund transaction on active loan "25 April 2025" with 100 EUR transaction amount will result an error + + @TestRailId:C3696 + Scenario: Verify accrual activity of overpaid loan in case of reversed repayment made before MIR and CBR for progressive multidisbursal loan - UC5 + When Admin sets the business date to "21 March 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_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE | 21 March 2025 | 242.46 | 29.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "21 March 2025" with "242.46" amount and expected disbursement date on "21 March 2025" + And Admin successfully disburse the loan on "21 March 2025" with "142.46" EUR transaction amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 142.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | | 132.13 | 10.33 | 3.56 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 2 | 30 | 21 May 2025 | | 121.54 | 10.59 | 3.3 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 3 | 31 | 21 June 2025 | | 110.69 | 10.85 | 3.04 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 4 | 30 | 21 July 2025 | | 99.57 | 11.12 | 2.77 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 5 | 31 | 21 August 2025 | | 88.17 | 11.4 | 2.49 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 6 | 31 | 21 September 2025 | | 76.48 | 11.69 | 2.2 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 7 | 30 | 21 October 2025 | | 64.5 | 11.98 | 1.91 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 8 | 31 | 21 November 2025 | | 52.22 | 12.28 | 1.61 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 9 | 30 | 21 December 2025 | | 39.64 | 12.58 | 1.31 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 10 | 31 | 21 January 2026 | | 26.74 | 12.9 | 0.99 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 11 | 31 | 21 February 2026 | | 13.52 | 13.22 | 0.67 | 0.0 | 0.0 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | + | 12 | 28 | 21 March 2026 | | 0.0 | 13.52 | 0.34 | 0.0 | 0.0 | 13.86 | 0.0 | 0.0 | 0.0 | 13.86 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 142.46 | 24.19 | 0.0 | 0.0 | 166.65 | 0.0 | 0.0 | 0.0 | 166.65 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + And Customer makes "AUTOPAY" repayment on "21 March 2025" with 100 EUR transaction amount + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "21 March 2025" with 142.46 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 142.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 March 2025 | 128.57 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | 13.89 | 13.89 | 0.0 | 0.0 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 114.68 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | 13.89 | 13.89 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 100.79 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | 13.89 | 13.89 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 86.9 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | 13.89 | 13.89 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 73.01 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | 13.89 | 13.89 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 59.12 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | 13.89 | 13.89 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 45.23 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | 13.89 | 13.89 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 31.34 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | 13.89 | 13.89 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 17.45 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | 13.89 | 13.89 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 3.56 | 13.89 | 0.0 | 0.0 | 0.0 | 13.89 | 13.89 | 13.89 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 0.0 | 3.56 | 0.0 | 0.0 | 0.0 | 3.56 | 3.56 | 3.56 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 142.46 | 0.0 | 0.0 | 0.0 | 142.46 | 142.46 | 142.46 | 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 | + | 21 March 2025 | Disbursement | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 42.46 | false | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 42.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "28 March 2025" + And Admin runs inline COB job for Loan + When Admin makes Credit Balance Refund transaction on "28 March 2025" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "02 April 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Repayment" transaction made on "21 March 2025" + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 142.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | | 130.59 | 111.87 | 1.93 | 0.0 | 0.0 | 113.8 | 11.87 | 11.87 | 0.0 | 101.93 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 118.72 | 11.87 | 0.0 | 0.0 | 0.0 | 11.87 | 11.87 | 11.87 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 106.85 | 11.87 | 0.0 | 0.0 | 0.0 | 11.87 | 11.87 | 11.87 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 94.98 | 11.87 | 0.0 | 0.0 | 0.0 | 11.87 | 11.87 | 11.87 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 83.11 | 11.87 | 0.0 | 0.0 | 0.0 | 11.87 | 11.87 | 11.87 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 71.24 | 11.87 | 0.0 | 0.0 | 0.0 | 11.87 | 11.87 | 11.87 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 59.37 | 11.87 | 0.0 | 0.0 | 0.0 | 11.87 | 11.87 | 11.87 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 47.5 | 11.87 | 0.0 | 0.0 | 0.0 | 11.87 | 11.87 | 11.87 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 35.63 | 11.87 | 0.0 | 0.0 | 0.0 | 11.87 | 11.87 | 11.87 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 23.76 | 11.87 | 0.0 | 0.0 | 0.0 | 11.87 | 11.87 | 11.87 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 11.89 | 11.87 | 0.0 | 0.0 | 0.0 | 11.87 | 11.87 | 11.87 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 11.89 | 0.0 | 0.0 | 0.0 | 11.89 | 11.89 | 11.89 | 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 | + | 242.46 | 1.93 | 0.0 | 0.0 | 244.39 | 142.46 | 142.46 | 0.0 | 101.93 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 42.46 | true | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + When Admin sets the business date to "21 April 2025" + And Admin runs inline COB job for Loan + And Admin successfully disburse the loan on "21 April 2025" with "100" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "21 April 2025" with 100 EUR transaction amount + And Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "21 April 2025" with 150 EUR transaction amount and system-generated Idempotency key + Then Loan has 48.07 overpaid amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 142.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 April 2025 | 130.59 | 111.87 | 1.93 | 0.0 | 0.0 | 113.8 | 113.8 | 11.87 | 0.0 | 0.0 | + | | | 21 April 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 30 | 21 May 2025 | 21 April 2025 | 208.32 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 April 2025 | 186.05 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 April 2025 | 163.78 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 April 2025 | 141.51 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 April 2025 | 119.24 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 April 2025 | 96.97 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 April 2025 | 74.7 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 April 2025 | 52.43 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 April 2025 | 30.16 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 April 2025 | 11.89 | 18.27 | 0.0 | 0.0 | 0.0 | 18.27 | 18.27 | 18.27 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 April 2025 | 0.0 | 11.89 | 0.0 | 0.0 | 0.0 | 11.89 | 11.89 | 11.89 | 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 | + | 342.46 | 1.93 | 0.0 | 0.0 | 344.39 | 344.39 | 242.46 | 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 | + | 21 March 2025 | Disbursement | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 42.46 | true | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + | 20 April 2025 | Accrual | 1.85 | 0.0 | 1.85 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 200.0 | false | false | + | 21 April 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 21 April 2025 | Payout Refund | 150.0 | 100.0 | 1.93 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "28 April 2025" + And Admin runs inline COB job for Loan + When Admin makes Credit Balance Refund transaction on "28 April 2025" with 48.07 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount +# - CBR on closed loan is forbidden - # + Then Credit Balance Refund transaction on active loan "28 April 2025" with 100 EUR transaction amount will result an error + When Admin sets the business date to "06 May 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Repayment" transaction made on "21 April 2025" + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 142.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 April 2025 | 130.59 | 111.87 | 1.93 | 0.0 | 0.0 | 113.8 | 113.8 | 11.87 | 0.0 | 0.0 | + | | | 21 April 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 30 | 21 May 2025 | | 210.54 | 68.12 | 2.22 | 0.0 | 0.0 | 70.34 | 22.27 | 22.27 | 0.0 | 48.07 | + | 3 | 31 | 21 June 2025 | 21 April 2025 | 188.27 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 April 2025 | 166.0 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 April 2025 | 143.73 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 22.27 | 22.27 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | | 121.46 | 22.27 | 0.0 | 0.0 | 0.0 | 22.27 | 18.34 | 18.34 | 0.0 | 3.93 | + | 7 | 30 | 21 October 2025 | | 105.85 | 15.61 | 6.66 | 0.0 | 0.0 | 22.27 | 11.87 | 11.87 | 0.0 | 10.4 | + | 8 | 31 | 21 November 2025 | | 84.74 | 21.11 | 1.16 | 0.0 | 0.0 | 22.27 | 11.87 | 11.87 | 0.0 | 10.4 | + | 9 | 30 | 21 December 2025 | | 63.4 | 21.34 | 0.93 | 0.0 | 0.0 | 22.27 | 11.87 | 11.87 | 0.0 | 10.4 | + | 10 | 31 | 21 January 2026 | | 41.82 | 21.58 | 0.69 | 0.0 | 0.0 | 22.27 | 11.87 | 11.87 | 0.0 | 10.4 | + | 11 | 31 | 21 February 2026 | | 20.0 | 21.82 | 0.45 | 0.0 | 0.0 | 22.27 | 11.87 | 11.87 | 0.0 | 10.4 | + | 12 | 28 | 21 March 2026 | | 0.0 | 20.0 | 0.2 | 0.0 | 0.0 | 20.2 | 11.89 | 11.89 | 0.0 | 8.31 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 390.53 | 14.24 | 0.0 | 0.0 | 404.77 | 292.46 | 190.53 | 0.0 | 112.31 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 42.46 | true | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + | 20 April 2025 | Accrual | 1.85 | 0.0 | 1.85 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 200.0 | false | false | + | 21 April 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | true | false | + | 21 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Payout Refund | 150.0 | 148.07 | 1.93 | 0.0 | 0.0 | 51.93 | false | true | + | 28 April 2025 | Credit Balance Refund | 48.07 | 48.07 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + When Admin sets the business date to "01 May 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Merchant Issued Refund" transaction made on "21 March 2025" + Then Loan has 285.65 outstanding amount + # - CBR on active loan is forbidden - # + Then Credit Balance Refund transaction on active loan "01 May 2025" with 100 EUR transaction amount will result an error + And Customer makes "AUTOPAY" repayment on "01 May 2025" with 330 EUR transaction amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 142.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 April 2025 | 134.07 | 108.39 | 5.5 | 0.0 | 0.0 | 113.89 | 113.89| 0.0 | 0.0 | 0.0 | + | | | 21 April 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 30 | 21 May 2025 | 01 May 2025 | 213.58 | 68.56 | 1.77 | 0.0 | 0.0 | 70.33 | 70.33 | 70.33 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 01 May 2025 | 191.32 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | 22.26 | 22.26 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 01 May 2025 | 169.06 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | 22.26 | 22.26 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 01 May 2025 | 146.8 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | 22.26 | 22.26 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 01 May 2025 | 124.54 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | 22.26 | 22.26 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 01 May 2025 | 102.28 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | 22.26 | 22.26 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 01 May 2025 | 80.02 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | 22.26 | 22.26 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 01 May 2025 | 57.76 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | 22.26 | 22.26 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 01 May 2025 | 35.5 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | 22.26 | 22.26 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 01 May 2025 | 13.24 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | 22.26 | 22.26 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 01 May 2025 | 0.0 | 13.24 | 0.0 | 0.0 | 0.0 | 13.24 | 13.24 | 13.24 | 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 | + | 390.53 | 7.27 | 0.0 | 0.0 | 397.8 | 397.8 | 283.91 | 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 | + | 21 March 2025 | Disbursement | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 42.46 | true | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | true | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | true | + | 20 April 2025 | Accrual | 1.85 | 0.0 | 1.85 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 342.46 | false | false | + | 21 April 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | true | false | + | 21 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Payout Refund | 150.0 | 144.5 | 5.5 | 0.0 | 0.0 | 197.96 | false | true | + | 22 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 23 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 24 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 25 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 26 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 27 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 28 April 2025 | Credit Balance Refund | 48.07 | 48.07 | 0.0 | 0.0 | 0.0 | 246.03 | false | true | + | 28 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 29 April 2025 | Accrual | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false | + | 30 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2025 | Repayment | 330.0 | 246.03 | 1.77 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2025 | Accrual | 4.87 | 0.0 | 4.87 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "03 May 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Repayment" transaction made on "01 May 2025" + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 142.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 21 April 2025 | 134.07 | 108.39 | 5.5 | 0.0 | 0.0 | 113.89 | 113.89| 0.0 | 0.0 | 0.0 | + | | | 21 April 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 30 | 21 May 2025 | | 217.68 | 64.46 | 5.87 | 0.0 | 0.0 | 70.33 | 22.26 | 22.26 | 0.0 | 48.07 | + | 3 | 31 | 21 June 2025 | | 200.51 | 17.17 | 5.09 | 0.0 | 0.0 | 22.26 | 13.85 | 13.85 | 0.0 | 8.41 | + | 4 | 30 | 21 July 2025 | | 183.26 | 17.25 | 5.01 | 0.0 | 0.0 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | + | 5 | 31 | 21 August 2025 | | 165.58 | 17.68 | 4.58 | 0.0 | 0.0 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | + | 6 | 31 | 21 September 2025 | | 147.46 | 18.12 | 4.14 | 0.0 | 0.0 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | + | 7 | 30 | 21 October 2025 | | 128.89 | 18.57 | 3.69 | 0.0 | 0.0 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | + | 8 | 31 | 21 November 2025 | | 109.85 | 19.04 | 3.22 | 0.0 | 0.0 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | + | 9 | 30 | 21 December 2025 | | 90.34 | 19.51 | 2.75 | 0.0 | 0.0 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | + | 10 | 31 | 21 January 2026 | | 70.34 | 20.0 | 2.26 | 0.0 | 0.0 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | + | 11 | 31 | 21 February 2026 | | 49.84 | 20.5 | 1.76 | 0.0 | 0.0 | 22.26 | 0.0 | 0.0 | 0.0 | 22.26 | + | 12 | 28 | 21 March 2026 | | 0.0 | 49.84 | 1.25 | 0.0 | 0.0 | 51.09 | 0.0 | 0.0 | 0.0 | 51.09 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 390.53 | 45.12 | 0.0 | 0.0 | 435.65 | 150.0 | 36.11 | 0.0 | 285.65 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | 142.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 42.46 | true | false | + | 21 March 2025 | Merchant Issued Refund | 142.46 | 142.46 | 0.0 | 0.0 | 0.0 | 0.0 | true | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | true | + | 20 April 2025 | Accrual | 1.85 | 0.0 | 1.85 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 342.46 | false | false | + | 21 April 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | true | false | + | 21 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Payout Refund | 150.0 | 144.5 | 5.5 | 0.0 | 0.0 | 197.96 | false | true | + | 22 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 23 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 24 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 25 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 26 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 27 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 28 April 2025 | Credit Balance Refund | 48.07 | 48.07 | 0.0 | 0.0 | 0.0 | 246.03 | false | true | + | 28 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 29 April 2025 | Accrual | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false | + | 30 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2025 | Repayment | 330.0 | 246.03 | 1.77 | 0.0 | 0.0 | 0.0 | true | false | + | 01 May 2025 | Accrual | 4.87 | 0.0 | 4.87 | 0.0 | 0.0 | 0.0 | false | false | +# - CBR on closed loan is forbidden - # + Then Credit Balance Refund transaction on active loan "03 May 2025" with 100 EUR transaction amount will result an error + + @TestRailId:C3697 + Scenario: Verify accrual activity of overpaid loan in case of reversed MIR made before MIR and CBR for progressive loan - UC6 + When Admin sets the business date to "21 March 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_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE | 21 March 2025 | 242.46 | 29.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "21 March 2025" with "242.46" amount and expected disbursement date on "21 March 2025" + And Admin successfully disburse the loan on "21 March 2025" with "242.46" EUR transaction amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | | 224.88 | 17.58 | 6.06 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 2 | 30 | 21 May 2025 | | 206.86 | 18.02 | 5.62 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 3 | 31 | 21 June 2025 | | 188.39 | 18.47 | 5.17 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 4 | 30 | 21 July 2025 | | 169.46 | 18.93 | 4.71 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 5 | 31 | 21 August 2025 | | 150.06 | 19.4 | 4.24 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 6 | 31 | 21 September 2025 | | 130.17 | 19.89 | 3.75 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 7 | 30 | 21 October 2025 | | 109.78 | 20.39 | 3.25 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 8 | 31 | 21 November 2025 | | 88.88 | 20.9 | 2.74 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 9 | 30 | 21 December 2025 | | 67.46 | 21.42 | 2.22 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 10 | 31 | 21 January 2026 | | 45.51 | 21.95 | 1.69 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 11 | 31 | 21 February 2026 | | 23.01 | 22.5 | 1.14 | 0.0 | 0.0 | 23.64 | 0.0 | 0.0 | 0.0 | 23.64 | + | 12 | 28 | 21 March 2026 | | 0.0 | 23.01 | 0.58 | 0.0 | 0.0 | 23.59 | 0.0 | 0.0 | 0.0 | 23.59 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 242.46 | 41.17 | 0.0 | 0.0 | 283.63 | 0.0 | 0.0 | 0.0 | 283.63 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + And Customer makes "AUTOPAY" repayment on "21 March 2025" with 100 EUR transaction amount + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "21 March 2025" with 242.46 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + When Admin sets the business date to "28 March 2025" + And Admin runs inline COB job for Loan + When Admin makes Credit Balance Refund transaction on "28 March 2025" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "02 April 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Repayment" transaction made on "21 March 2025" + When Admin sets the business date to "21 April 2025" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | | 222.26 | 120.2 | 1.93 | 0.0 | 0.0 | 122.13 | 20.2 | 20.2 | 0.0 | 101.93 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 202.06 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 181.86 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 161.66 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 141.46 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 121.26 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 101.06 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 80.86 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 60.66 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 40.46 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 20.26 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 20.26 | 0.0 | 0.0 | 0.0 | 20.26 | 20.26 | 20.26 | 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 | + | 342.46 | 1.93 | 0.0 | 0.0 | 344.39 | 242.46 | 242.46 | 0.0 | 101.93 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | true | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + | 20 April 2025 | Accrual | 1.85 | 0.0 | 1.85 | 0.0 | 0.0 | 0.0 | false | false | + Then Credit Balance Refund transaction on active loan "21 April 2025" with 100 EUR transaction amount will result an error + When Admin sets the business date to "29 April 2025" + And Admin runs inline COB job for Loan + And Customer makes "AUTOPAY" repayment on "29 April 2025" with 100 EUR transaction amount + Then Loan has 1.93 outstanding amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | | 222.26 | 120.2 | 1.93 | 0.0 | 0.0 | 122.13 |120.2 | 20.2 | 100.0| 1.93 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 202.06 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 181.86 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 161.66 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 141.46 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 121.26 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 101.06 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 80.86 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 60.66 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 40.46 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 20.26 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 20.26 | 0.0 | 0.0 | 0.0 | 20.26 | 20.26 | 20.26 | 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 | + | 342.46 | 1.93 | 0.0 | 0.0 | 344.39 | 342.46 | 242.46 | 100.0 | 1.93 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | true | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + | 20 April 2025 | Accrual | 1.85 | 0.0 | 1.85 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 22 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 23 April 2025 | Accrual | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false | + | 24 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 25 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 26 April 2025 | Accrual | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false | + | 27 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 28 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 29 April 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | +# - CBR on active loan is forbidden - # + Then Credit Balance Refund transaction on active loan "29 April 2025" with 100 EUR transaction amount will result an error + When Admin sets the business date to "06 May 2025" + And Admin runs inline COB job for Loan + And Customer makes "AUTOPAY" repayment on "06 May 2025" with 1.93 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has 12 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 | + | | | 21 March 2025 | | 242.46 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 21 April 2025 | 06 May 2025 | 222.26 | 120.2 | 1.93 | 0.0 | 0.0 | 122.13 |122.13 | 20.2 | 101.93 | 0.0 | + | 2 | 30 | 21 May 2025 | 21 March 2025 | 202.06 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 3 | 31 | 21 June 2025 | 21 March 2025 | 181.86 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 4 | 30 | 21 July 2025 | 21 March 2025 | 161.66 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 5 | 31 | 21 August 2025 | 21 March 2025 | 141.46 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 6 | 31 | 21 September 2025 | 21 March 2025 | 121.26 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 7 | 30 | 21 October 2025 | 21 March 2025 | 101.06 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 8 | 31 | 21 November 2025 | 21 March 2025 | 80.86 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 9 | 30 | 21 December 2025 | 21 March 2025 | 60.66 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 10 | 31 | 21 January 2026 | 21 March 2025 | 40.46 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 11 | 31 | 21 February 2026 | 21 March 2025 | 20.26 | 20.2 | 0.0 | 0.0 | 0.0 | 20.2 | 20.2 | 20.2 | 0.0 | 0.0 | + | 12 | 28 | 21 March 2026 | 21 March 2025 | 0.0 | 20.26 | 0.0 | 0.0 | 0.0 | 20.26 | 20.26 | 20.26 | 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 | + | 342.46 | 1.93 | 0.0 | 0.0 | 344.39 | 344.39 | 242.46 | 101.93 | 0.0 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 March 2025 | Disbursement | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | 242.46 | false | false | + | 21 March 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 142.46 | true | false | + | 21 March 2025 | Merchant Issued Refund | 242.46 | 242.46 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 28 March 2025 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | true | + | 20 April 2025 | Accrual | 1.85 | 0.0 | 1.85 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 22 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 23 April 2025 | Accrual | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false | + | 24 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 25 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 26 April 2025 | Accrual | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false | + | 27 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 28 April 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false | + | 29 April 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + | 29 April 2025 | Accrual | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false | + | 06 May 2025 | Repayment | 1.93 | 0.0 | 1.93 | 0.0 | 0.0 | 0.0 | false | false | + | 06 May 2025 | Accrual Adjustment | 0.67 | 0.0 | 0.67 | 0.0 | 0.0 | 0.0 | false | false | +# - CBR on closed loan is forbidden - # + Then Credit Balance Refund transaction on active loan "06 May 2025" with 100 EUR transaction amount will result an error + + @TestRailId:C3698 + Scenario: Verify that interest activities are added in case of reversed repayment made before MIR and CBR for loan with accrual activity - UC7 + When Admin sets the business date to "07 April 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_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_ACCRUAL_ACTIVITY | 07 April 2025 | 72.3 | 29.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "07 April 2025" with "72.3" amount and expected disbursement date on "07 April 2025" + And Admin successfully disburse the loan on "07 April 2025" with "72.3" EUR transaction amount + Then Loan Repayment schedule has 12 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 | + | | | 07 April 2025 | | 72.3 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 07 May 2025 | | 67.06 | 5.24 | 1.81 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 2 | 31 | 07 June 2025 | | 61.69 | 5.37 | 1.68 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 3 | 30 | 07 July 2025 | | 56.18 | 5.51 | 1.54 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 4 | 31 | 07 August 2025 | | 50.53 | 5.65 | 1.4 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 5 | 31 | 07 September 2025 | | 44.74 | 5.79 | 1.26 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 6 | 30 | 07 October 2025 | | 38.81 | 5.93 | 1.12 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 7 | 31 | 07 November 2025 | | 32.73 | 6.08 | 0.97 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 8 | 30 | 07 December 2025 | | 26.5 | 6.23 | 0.82 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 9 | 31 | 07 January 2026 | | 20.11 | 6.39 | 0.66 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 10 | 31 | 07 February 2026 | | 13.56 | 6.55 | 0.5 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 11 | 28 | 07 March 2026 | | 6.85 | 6.71 | 0.34 | 0.0 | 0.0 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | + | 12 | 31 | 07 April 2026 | | 0.0 | 6.85 | 0.17 | 0.0 | 0.0 | 7.02 | 0.0 | 0.0 | 0.0 | 7.02 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 72.3 | 12.27 | 0.0 | 0.0 | 84.57 | 0.0 | 0.0 | 0.0 | 84.57 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 07 April 2025 | Disbursement | 72.3 | 0.0 | 0.0 | 0.0 | 0.0 | 72.3 | false | false | + When Admin sets the business date to "08 April 2025" + And Admin runs inline COB job for Loan + And Customer makes "AUTOPAY" repayment on "08 April 2025" with 72.35 EUR transaction amount + When Admin sets the business date to "11 April 2025" + And Admin runs inline COB job for Loan + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "11 April 2025" with 72.3 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 72.35 overpaid amount + Then Loan Repayment schedule has 12 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 | + | | | 07 April 2025 | | 72.3 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 07 May 2025 | 08 April 2025 | 65.31 | 6.99 | 0.06 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 2 | 31 | 07 June 2025 | 08 April 2025 | 58.26 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 3 | 30 | 07 July 2025 | 08 April 2025 | 51.21 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 4 | 31 | 07 August 2025 | 08 April 2025 | 44.16 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 5 | 31 | 07 September 2025 | 08 April 2025 | 37.11 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 6 | 30 | 07 October 2025 | 08 April 2025 | 30.06 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 7 | 31 | 07 November 2025 | 08 April 2025 | 23.01 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 8 | 30 | 07 December 2025 | 08 April 2025 | 15.96 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 9 | 31 | 07 January 2026 | 08 April 2025 | 8.91 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 10 | 31 | 07 February 2026 | 08 April 2025 | 1.86 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 11 | 28 | 07 March 2026 | 11 April 2025 | 0.0 | 1.86 | 0.0 | 0.0 | 0.0 | 1.86 | 1.86 | 1.86 | 0.0 | 0.0 | + | 12 | 31 | 07 April 2026 | 08 April 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 72.3 | 0.06 | 0.0 | 0.0 | 72.36 | 72.36 | 72.36 | 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 | + | 07 April 2025 | Disbursement | 72.3 | 0.0 | 0.0 | 0.0 | 0.0 | 72.3 | false | false | + | 08 April 2025 | Repayment | 72.35 | 72.29 | 0.06 | 0.0 | 0.0 | 0.01 | false | false | + | 08 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 11 April 2025 | Merchant Issued Refund | 72.3 | 0.01 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + | 11 April 2025 | Interest Refund | 0.06 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + | 11 April 2025 | Accrual Activity | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "15 April 2025" + And Admin runs inline COB job for Loan + When Admin makes Credit Balance Refund transaction on "15 April 2025" with 72.35 EUR transaction amount + When Admin sets the business date to "18 April 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Repayment" transaction made on "08 April 2025" + Then Loan Repayment schedule has 12 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 | + | | | 07 April 2025 | | 72.3 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 07 May 2025 | | 65.49 | 79.16 | 1.57 | 0.0 | 0.0 | 80.73 | 7.05 | 7.05 | 0.0 | 73.68 | + | 2 | 31 | 07 June 2025 | 11 April 2025 | 58.44 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 3 | 30 | 07 July 2025 | 11 April 2025 | 51.39 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 4 | 31 | 07 August 2025 | 11 April 2025 | 44.34 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 5 | 31 | 07 September 2025 | 11 April 2025 | 37.29 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 6 | 30 | 07 October 2025 | 11 April 2025 | 30.24 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 7 | 31 | 07 November 2025 | 11 April 2025 | 23.19 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 8 | 30 | 07 December 2025 | 11 April 2025 | 16.14 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 9 | 31 | 07 January 2026 | 11 April 2025 | 9.09 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 10 | 31 | 07 February 2026 | 11 April 2025 | 2.04 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 11 | 28 | 07 March 2026 | 11 April 2025 | 0.0 | 2.04 | 0.0 | 0.0 | 0.0 | 2.04 | 2.04 | 2.04 | 0.0 | 0.0 | + | 12 | 31 | 07 April 2026 | 11 April 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 144.65 | 1.57 | 0.0 | 0.0 | 146.22 | 72.54 | 72.54 | 0.0 | 73.68 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 07 April 2025 | Disbursement | 72.3 | 0.0 | 0.0 | 0.0 | 0.0 | 72.3 | false | false | + | 08 April 2025 | Repayment | 72.35 | 72.29 | 0.06 | 0.0 | 0.0 | 0.01 | true | false | + | 08 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 11 April 2025 | Merchant Issued Refund | 72.3 | 72.06 | 0.24 | 0.0 | 0.0 | 0.24 | false | true | + | 11 April 2025 | Interest Refund | 0.24 | 0.24 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 15 April 2025 | Credit Balance Refund | 72.35 | 72.35 | 0.0 | 0.0 | 0.0 | 72.35 | false | true | + When Admin sets the business date to "07 May 2025" + And Admin runs inline COB job for Loan + And Customer makes "AUTOPAY" repayment on "07 May 2025" with 73.68 EUR transaction amount + When Admin sets the business date to "08 May 2025" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 12 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 | + | | | 07 April 2025 | | 72.3 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 07 May 2025 | 07 May 2025 | 65.49 | 79.16 | 1.57 | 0.0 | 0.0 | 80.73 | 80.73 | 7.05 | 0.0 | 0.0 | + | 2 | 31 | 07 June 2025 | 11 April 2025 | 58.44 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 3 | 30 | 07 July 2025 | 11 April 2025 | 51.39 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 4 | 31 | 07 August 2025 | 11 April 2025 | 44.34 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 5 | 31 | 07 September 2025 | 11 April 2025 | 37.29 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 6 | 30 | 07 October 2025 | 11 April 2025 | 30.24 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 7 | 31 | 07 November 2025 | 11 April 2025 | 23.19 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 8 | 30 | 07 December 2025 | 11 April 2025 | 16.14 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 9 | 31 | 07 January 2026 | 11 April 2025 | 9.09 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 10 | 31 | 07 February 2026 | 11 April 2025 | 2.04 | 7.05 | 0.0 | 0.0 | 0.0 | 7.05 | 7.05 | 7.05 | 0.0 | 0.0 | + | 11 | 28 | 07 March 2026 | 11 April 2025 | 0.0 | 2.04 | 0.0 | 0.0 | 0.0 | 2.04 | 2.04 | 2.04 | 0.0 | 0.0 | + | 12 | 31 | 07 April 2026 | 11 April 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 144.65 | 1.57 | 0.0 | 0.0 | 146.22 | 146.22 | 72.54 | 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 | + | 07 April 2025 | Disbursement | 72.3 | 0.0 | 0.0 | 0.0 | 0.0 | 72.3 | false | false | + | 08 April 2025 | Repayment | 72.35 | 72.29 | 0.06 | 0.0 | 0.0 | 0.01 | true | false | + | 08 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 11 April 2025 | Merchant Issued Refund | 72.3 | 72.06 | 0.24 | 0.0 | 0.0 | 0.24 | false | true | + | 11 April 2025 | Interest Refund | 0.24 | 0.24 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 11 April 2025 | Accrual | 0.18 | 0.0 | 0.18 | 0.0 | 0.0 | 0.0 | false | false | + | 15 April 2025 | Credit Balance Refund | 72.35 | 72.35 | 0.0 | 0.0 | 0.0 | 72.35 | false | true | + | 16 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 17 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 18 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 19 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 20 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 22 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 23 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 24 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 25 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 26 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 27 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 28 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 29 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 30 April 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2025 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | + | 02 May 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 03 May 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 04 May 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 05 May 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 06 May 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 07 May 2025 | Repayment | 73.68 | 72.35 | 1.33 | 0.0 | 0.0 | 0.0 | false | false | + | 07 May 2025 | Accrual | 0.06 | 0.0 | 0.06 | 0.0 | 0.0 | 0.0 | false | false | + | 07 May 2025 | Accrual Activity | 1.57 | 0.0 | 1.57 | 0.0 | 0.0 | 0.0 | false | false | +# - CBR on closed loan is forbidden - # + Then Credit Balance Refund transaction on active loan "07 May 2025" with 72.35 EUR transaction amount will result an error + + @TestRailId:C3699 + Scenario: Verify that interest activities are added in case of reversed repayment made before MIR and CBR for progressive loan with auto downpayment and accrual activity - UC8 + When Admin sets the business date to "07 April 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_EMI_360_30_INTEREST_REFUND_INTEREST_RECALC_DOWNPAYMENT_ACCRUAL_ACTIVITY | 07 April 2025 | 72.3 | 29.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 12 | MONTHS | 1 | MONTHS | 12 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "07 April 2025" with "72.3" amount and expected disbursement date on "07 April 2025" + And Admin successfully disburse the loan on "07 April 2025" with "72.3" 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 | + | | | 07 April 2025 | | 72.3 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 07 April 2025 | 07 April 2025 | 54.22 | 18.08 | 0.0 | 0.0 | 0.0 | 18.08 | 18.08| 0.0 | 0.0 | 0.0 | + | 2 | 30 | 07 May 2025 | | 50.29 | 3.93 | 1.36 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 3 | 31 | 07 June 2025 | | 46.26 | 4.03 | 1.26 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 4 | 30 | 07 July 2025 | | 42.13 | 4.13 | 1.16 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 5 | 31 | 07 August 2025 | | 37.89 | 4.24 | 1.05 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 6 | 31 | 07 September 2025 | | 33.55 | 4.34 | 0.95 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 7 | 30 | 07 October 2025 | | 29.1 | 4.45 | 0.84 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 8 | 31 | 07 November 2025 | | 24.54 | 4.56 | 0.73 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 9 | 30 | 07 December 2025 | | 19.86 | 4.68 | 0.61 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 10 | 31 | 07 January 2026 | | 15.07 | 4.79 | 0.5 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 11 | 31 | 07 February 2026 | | 10.16 | 4.91 | 0.38 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 12 | 28 | 07 March 2026 | | 5.12 | 5.04 | 0.25 | 0.0 | 0.0 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | + | 13 | 31 | 07 April 2026 | | 0.0 | 5.12 | 0.13 | 0.0 | 0.0 | 5.25 | 0.0 | 0.0 | 0.0 | 5.25 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 72.3 | 9.22 | 0.0 | 0.0 | 81.52 | 18.08 | 0.0 | 0.0 | 63.44 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 07 April 2025 | Disbursement | 72.3 | 0.0 | 0.0 | 0.0 | 0.0 | 72.3 | false | false | + | 07 April 2025 | Down Payment | 18.08 | 18.08 | 0.0 | 0.0 | 0.0 | 54.22 | false | false | + When Admin sets the business date to "08 April 2025" + And Admin runs inline COB job for Loan + And Customer makes "AUTOPAY" repayment on "08 April 2025" with 54.27 EUR transaction amount + When Admin sets the business date to "11 April 2025" + And Admin runs inline COB job for Loan + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "11 April 2025" with 72.3 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 72.35 overpaid 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 | + | | | 07 April 2025 | | 72.3 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 07 April 2025 | 07 April 2025 | 54.22 | 18.08 | 0.0 | 0.0 | 0.0 | 18.08 | 18.08| 0.0 | 0.0 | 0.0 | + | 2 | 30 | 07 May 2025 | 08 April 2025 | 48.98 | 5.24 | 0.05 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 3 | 31 | 07 June 2025 | 08 April 2025 | 43.69 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 4 | 30 | 07 July 2025 | 08 April 2025 | 38.4 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 5 | 31 | 07 August 2025 | 08 April 2025 | 33.11 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 6 | 31 | 07 September 2025 | 08 April 2025 | 27.82 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 7 | 30 | 07 October 2025 | 08 April 2025 | 22.53 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 8 | 31 | 07 November 2025 | 08 April 2025 | 17.24 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 9 | 30 | 07 December 2025 | 08 April 2025 | 11.95 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 10 | 31 | 07 January 2026 | 08 April 2025 | 6.66 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 11 | 31 | 07 February 2026 | 08 April 2025 | 1.37 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 12 | 28 | 07 March 2026 | 08 April 2025 | 0.0 | 1.37 | 0.0 | 0.0 | 0.0 | 1.37 | 1.37 | 1.37 | 0.0 | 0.0 | + | 13 | 31 | 07 April 2026 | 08 April 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 72.3 | 0.05 | 0.0 | 0.0 | 72.35 | 72.35 | 54.27 | 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 | + | 07 April 2025 | Disbursement | 72.3 | 0.0 | 0.0 | 0.0 | 0.0 | 72.3 | false | false | + | 07 April 2025 | Down Payment | 18.08 | 18.08 | 0.0 | 0.0 | 0.0 | 54.22 | false | false | + | 08 April 2025 | Repayment | 54.27 | 54.22 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 08 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 08 April 2025 | Accrual Activity | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 11 April 2025 | Merchant Issued Refund | 72.3 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + | 11 April 2025 | Interest Refund | 0.05 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "15 April 2025" + And Admin runs inline COB job for Loan + When Admin makes Credit Balance Refund transaction on "15 April 2025" with 72.35 EUR transaction amount + When Admin sets the business date to "18 April 2025" + And Admin runs inline COB job for Loan + When Customer undo "1"th "Repayment" transaction made on "08 April 2025" + 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 | + | | | 07 April 2025 | | 72.3 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 07 April 2025 | 07 April 2025 | 54.22 | 18.08 | 0.0 | 0.0 | 0.0 | 18.08 | 18.08 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 07 May 2025 | | 49.11 | 77.46 | 1.18 | 0.0 | 0.0 | 78.64 | 23.37 | 23.37 | 0.0 | 55.27 | + | 3 | 31 | 07 June 2025 | 11 April 2025 | 43.82 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 4 | 30 | 07 July 2025 | 11 April 2025 | 38.53 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 5 | 31 | 07 August 2025 | 11 April 2025 | 33.24 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 6 | 31 | 07 September 2025 | 11 April 2025 | 27.95 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 7 | 30 | 07 October 2025 | 11 April 2025 | 22.66 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 8 | 31 | 07 November 2025 | 11 April 2025 | 17.37 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 9 | 30 | 07 December 2025 | 11 April 2025 | 12.08 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 10 | 31 | 07 January 2026 | 11 April 2025 | 6.79 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 11 | 31 | 07 February 2026 | 11 April 2025 | 1.5 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 12 | 28 | 07 March 2026 | 11 April 2025 | 0.0 | 1.5 | 0.0 | 0.0 | 0.0 | 1.5 | 1.5 | 1.5 | 0.0 | 0.0 | + | 13 | 31 | 07 April 2026 | 11 April 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 144.65 | 1.18 | 0.0 | 0.0 | 145.83 | 90.56 | 72.48 | 0.0 | 55.27 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 07 April 2025 | Disbursement | 72.3 | 0.0 | 0.0 | 0.0 | 0.0 | 72.3 | false | false | + | 07 April 2025 | Down Payment | 18.08 | 18.08 | 0.0 | 0.0 | 0.0 | 54.22 | false | false | + | 08 April 2025 | Repayment | 54.27 | 54.22 | 0.05 | 0.0 | 0.0 | 0.0 | true | false | + | 08 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 11 April 2025 | Merchant Issued Refund | 72.3 | 54.22 | 0.18 | 0.0 | 0.0 | 0.0 | false | true | + | 11 April 2025 | Interest Refund | 0.18 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 15 April 2025 | Credit Balance Refund | 72.35 | 54.27 | 0.0 | 0.0 | 0.0 | 54.27 | false | true | + When Admin sets the business date to "07 May 2025" + And Admin runs inline COB job for Loan + And Customer makes "AUTOPAY" repayment on "07 May 2025" with 55.27 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 | + | | | 07 April 2025 | | 72.3 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 07 April 2025 | 07 April 2025 | 54.22 | 18.08 | 0.0 | 0.0 | 0.0 | 18.08 | 18.08 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 07 May 2025 | 07 May 2025 | 49.11 | 77.46 | 1.18 | 0.0 | 0.0 | 78.64 | 78.64 | 23.37 | 0.0 | 0.0 | + | 3 | 31 | 07 June 2025 | 11 April 2025 | 43.82 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 4 | 30 | 07 July 2025 | 11 April 2025 | 38.53 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 5 | 31 | 07 August 2025 | 11 April 2025 | 33.24 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 6 | 31 | 07 September 2025 | 11 April 2025 | 27.95 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 7 | 30 | 07 October 2025 | 11 April 2025 | 22.66 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 8 | 31 | 07 November 2025 | 11 April 2025 | 17.37 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 9 | 30 | 07 December 2025 | 11 April 2025 | 12.08 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 10 | 31 | 07 January 2026 | 11 April 2025 | 6.79 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 11 | 31 | 07 February 2026 | 11 April 2025 | 1.5 | 5.29 | 0.0 | 0.0 | 0.0 | 5.29 | 5.29 | 5.29 | 0.0 | 0.0 | + | 12 | 28 | 07 March 2026 | 11 April 2025 | 0.0 | 1.5 | 0.0 | 0.0 | 0.0 | 1.5 | 1.5 | 1.5 | 0.0 | 0.0 | + | 13 | 31 | 07 April 2026 | 11 April 2025 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 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 | + | 144.65 | 1.18 | 0.0 | 0.0 | 145.83 | 145.83 | 72.48 | 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 | + | 07 April 2025 | Disbursement | 72.3 | 0.0 | 0.0 | 0.0 | 0.0 | 72.3 | false | false | + | 07 April 2025 | Down Payment | 18.08 | 18.08 | 0.0 | 0.0 | 0.0 | 54.22 | false | false | + | 08 April 2025 | Repayment | 54.27 | 54.22 | 0.05 | 0.0 | 0.0 | 0.0 | true | false | + | 08 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 09 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 10 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 11 April 2025 | Merchant Issued Refund | 72.3 | 54.22 | 0.18 | 0.0 | 0.0 | 0.0 | false | true | + | 11 April 2025 | Interest Refund | 0.18 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | true | + | 11 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 15 April 2025 | Credit Balance Refund | 72.35 | 54.27 | 0.0 | 0.0 | 0.0 | 54.27 | false | true | + | 16 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 17 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 18 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 19 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 20 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 21 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 22 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 23 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 24 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 25 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 26 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 27 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 28 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 29 April 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 30 April 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 02 May 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 03 May 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 04 May 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 05 May 2025 | Accrual | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false | + | 06 May 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 07 May 2025 | Repayment | 55.27 | 54.27 | 1.0 | 0.0 | 0.0 | 0.0 | false | false | + | 07 May 2025 | Accrual | 0.05 | 0.0 | 0.05 | 0.0 | 0.0 | 0.0 | false | false | + | 07 May 2025 | Accrual Activity | 1.18 | 0.0 | 1.18 | 0.0 | 0.0 | 0.0 | false | false | +# - CBR on closed loan is forbidden - # + Then Credit Balance Refund transaction on active loan "07 May 2025" with 72.35 EUR transaction amount will result an error \ No newline at end of file