This is an automated email from the ASF dual-hosted git repository. adamsaghy pushed a commit to branch develop-with-jdk17 in repository https://gitbox.apache.org/repos/asf/fineract.git
commit c03b4322ed4678b885220d2ec3f34edb07da80fc Author: Adam Saghy <[email protected]> AuthorDate: Sun Jan 11 14:22:00 2026 +0100 FINERACT-2433: Fix interest and accrual calculation in case of last installment payment --- .../test/data/loanproduct/DefaultLoanProduct.java | 1 + .../test/factory/LoanProductsRequestFactory.java | 106 ++++++ .../global/LoanProductGlobalInitializerStep.java | 37 +- .../fineract/test/support/TestContextKey.java | 1 + .../resources/features/LoanAccrualActivity.feature | 147 ++++++++ .../features/LoanAccrualTransaction.feature | 372 ++++++++++++++++++++- .../resources/features/LoanDelinquency.feature | 4 +- .../features/LoanInterestPaymentWaiver.feature | 8 +- .../loanproduct/calc/ProgressiveEMICalculator.java | 19 +- .../loanproduct/calc/data/RepaymentPeriod.java | 9 + .../LoanTransactionProcessingServiceImpl.java | 3 +- .../LoanWritePlatformServiceJpaRepositoryImpl.java | 12 +- .../SavingsInterestPostingTest.java | 2 +- 13 files changed, 696 insertions(+), 25 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 4e1101bedc..a33476dcb2 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 @@ -179,6 +179,7 @@ public enum DefaultLoanProduct implements LoanProduct { LP1_INTEREST_FLAT_DAILY_RECALCULATION_SAR_MULTIDISB_EXPECT_TRANCHES, // LP1_INTEREST_FLAT_DAILY_ACTUAL_ACTUAL_MULTIDISB_EXPECT_TRANCHES, // LP2_ADV_PYMNT_360_30_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY, // + LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_360_30_USD, // ; @Override diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanProductsRequestFactory.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanProductsRequestFactory.java index e976039474..3fdcbfffdf 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanProductsRequestFactory.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanProductsRequestFactory.java @@ -22,6 +22,7 @@ import static org.apache.fineract.test.data.TransactionProcessingStrategyCode.AD import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -94,6 +95,7 @@ public class LoanProductsRequestFactory { public static final String DESCRIPTION_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE = "LP1 with 12% DECLINING BALANCE interest, interest period: Daily, Interest recalculation-Daily, Compounding:none"; public static final Long FUND_ID = FundId.LENDER_A.value; public static final String CURRENCY_CODE = "EUR"; + public static final String CURRENCY_CODE_USD = "USD"; public static final Integer INTEREST_RATE_FREQUENCY_TYPE_MONTH = InterestRateFrequencyType.MONTH.value; public static final Integer INTEREST_RATE_FREQUENCY_TYPE_YEAR = InterestRateFrequencyType.YEAR.value; public static final Integer INTEREST_RATE_FREQUENCY_TYPE_WHOLE_TERM = InterestRateFrequencyType.WHOLE_TERM.value; @@ -1779,6 +1781,110 @@ public class LoanProductsRequestFactory { .chargeOffReasonToExpenseAccountMappings(chargeOffReasonToExpenseAccountMappings);// } + public PostLoanProductsRequest defaultLoanProductsRequestLP2EmiUSD() { + String name = Utils.randomNameGenerator(NAME_PREFIX_LP2_EMI, 10); + String shortName = generateShortNameSafely(); + + List<Integer> principalVariationsForBorrowerCycle = new ArrayList<>(); + List<Integer> numberOfRepaymentVariationsForBorrowerCycle = new ArrayList<>(); + List<Integer> interestRateVariationsForBorrowerCycle = new ArrayList<>(); + return new PostLoanProductsRequest()// + .name(name)// + .shortName(shortName)// + .description(DESCRIPTION_LP2_EMI)// + .includeInBorrowerCycle(false)// + .useBorrowerCycle(false)// + .currencyCode(CURRENCY_CODE_USD)// + .digitsAfterDecimal(2)// + .inMultiplesOf(0)// + .principal(1500.0)// + .minPrincipal(1.0)// + .maxPrincipal(10000.0)// + .numberOfRepayments(3)// + .minNumberOfRepayments(3)// + .maxNumberOfRepayments(48)// + .repaymentEvery(1)// + .repaymentFrequencyType(REPAYMENT_FREQUENCY_TYPE_MONTHS)// + .interestRatePerPeriod(9.99)// + .minInterestRatePerPeriod((double) 0)// + .maxInterestRatePerPeriod((double) 50)// + .interestRateFrequencyType(INTEREST_RATE_FREQUENCY_TYPE_YEAR)// + .isLinkedToFloatingInterestRates(false)// + .allowVariableInstallments(false)// + .amortizationType(AmortizationType.EQUAL_INSTALLMENTS.value)// + .interestType(INTEREST_TYPE_DECLINING_BALANCE)// + .interestCalculationPeriodType(INTEREST_CALCULATION_PERIOD_TYPE_DAILY)// + .allowPartialPeriodInterestCalcualtion(false)// + .transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION.getValue())// + .daysInMonthType(DAYS_IN_MONTH_TYPE_30)// + .daysInYearType(DAYS_IN_YEAR_TYPE_360)// + .isInterestRecalculationEnabled(true)// + .interestRecalculationCompoundingMethod(INTEREST_RECALCULATION_COMPOUND_METHOD_NONE)// + .rescheduleStrategyMethod(AdvancePaymentsAdjustmentType.ADJUST_LAST_UNPAID_PERIOD.value)// + .recalculationRestFrequencyType(FREQUENCY_FOR_RECALCULATE_OUTSTANDING_DAILY)// + .recalculationRestFrequencyInterval(1)// + .isArrearsBasedOnOriginalSchedule(false)// + .preClosureInterestCalculationStrategy(PRE_CLOSURE_INTEREST_CALCULATION_RULE_TILL_PRE_CLOSE_DATE)// + .canDefineInstallmentAmount(true)// + .repaymentStartDateType(1)// + .supportedInterestRefundTypes(Arrays.asList("MERCHANT_ISSUED_REFUND", "PAYOUT_REFUND"))// + .chargeOffBehaviour(ChargeOffBehaviour.ZERO_INTEREST.value) + .principalVariationsForBorrowerCycle(principalVariationsForBorrowerCycle)// + .interestRateVariationsForBorrowerCycle(interestRateVariationsForBorrowerCycle)// + .numberOfRepaymentVariationsForBorrowerCycle(numberOfRepaymentVariationsForBorrowerCycle)// + .accountingRule(AccountingRule.ACCRUAL_PERIODIC.value)// + .canUseForTopup(false)// + .enableAccrualActivityPosting(true)// + .multiDisburseLoan(true)// + .maxTrancheCount(500)// + .outstandingLoanBalance(10000.0)// + .disallowExpectedDisbursements(true)// + .allowApprovedDisbursedAmountsOverApplied(true)// + .overAppliedCalculationType(OverAppliedCalculationType.FIXED_SIZE.value)// + .overAppliedNumber(10000)// + .principalThresholdForLastInstallment(50)// + .holdGuaranteeFunds(false)// + .accountMovesOutOfNPAOnlyOnArrearsCompletion(false)// + .allowAttributeOverrides(new AllowAttributeOverrides()// + .amortizationType(true)// + .interestType(true)// + .transactionProcessingStrategyCode(true)// + .interestCalculationPeriodType(true)// + .inArrearsTolerance(true)// + .repaymentEvery(true)// + .graceOnPrincipalAndInterestPayment(true)// + .graceOnArrearsAgeing(true))// + .isEqualAmortization(false)// + .delinquencyBucketId(DELINQUENCY_BUCKET_ID.longValue())// + .enableDownPayment(false)// + .enableInstallmentLevelDelinquency(true)// + .loanScheduleType("PROGRESSIVE") // + .loanScheduleProcessingType("HORIZONTAL")// + .enableIncomeCapitalization(false)// + .capitalizedIncomeCalculationType(PostLoanProductsRequest.CapitalizedIncomeCalculationTypeEnum.FLAT)// + .capitalizedIncomeStrategy(PostLoanProductsRequest.CapitalizedIncomeStrategyEnum.EQUAL_AMORTIZATION)// + .capitalizedIncomeType(PostLoanProductsRequest.CapitalizedIncomeTypeEnum.INTEREST).enableBuyDownFee(true)// + .merchantBuyDownFee(true)// + .buyDownFeeCalculationType(PostLoanProductsRequest.BuyDownFeeCalculationTypeEnum.FLAT)// + .buyDownFeeStrategy(PostLoanProductsRequest.BuyDownFeeStrategyEnum.EQUAL_AMORTIZATION)// + .buyDownFeeIncomeType(PostLoanProductsRequest.BuyDownFeeIncomeTypeEnum.INTEREST)// + .fundSourceAccountId(accountTypeResolver.resolve(DefaultAccountType.SUSPENSE_CLEARING_ACCOUNT))// + .loanPortfolioAccountId(accountTypeResolver.resolve(DefaultAccountType.LOANS_RECEIVABLE))// + .transfersInSuspenseAccountId(accountTypeResolver.resolve(DefaultAccountType.TRANSFER_IN_SUSPENSE_ACCOUNT))// + .interestOnLoanAccountId(accountTypeResolver.resolve(DefaultAccountType.INTEREST_INCOME))// + .incomeFromFeeAccountId(accountTypeResolver.resolve(DefaultAccountType.FEE_INCOME))// + .incomeFromPenaltyAccountId(accountTypeResolver.resolve(DefaultAccountType.FEE_INCOME))// + .incomeFromRecoveryAccountId(accountTypeResolver.resolve(DefaultAccountType.RECOVERIES))// + .writeOffAccountId(accountTypeResolver.resolve(DefaultAccountType.WRITTEN_OFF))// + .overpaymentLiabilityAccountId(accountTypeResolver.resolve(DefaultAccountType.OVERPAYMENT_ACCOUNT))// + .receivableInterestAccountId(accountTypeResolver.resolve(DefaultAccountType.INTEREST_FEE_RECEIVABLE))// + .receivableFeeAccountId(accountTypeResolver.resolve(DefaultAccountType.INTEREST_FEE_RECEIVABLE))// + .receivablePenaltyAccountId(accountTypeResolver.resolve(DefaultAccountType.INTEREST_FEE_RECEIVABLE))// + .buyDownExpenseAccountId(accountTypeResolver.resolve(DefaultAccountType.BUY_DOWN_EXPENSE))// + .incomeFromBuyDownAccountId(accountTypeResolver.resolve(DefaultAccountType.INCOME_FROM_BUY_DOWN)).dateFormat(DATE_FORMAT)// + .locale(LOCALE_EN);// + } + public String generateShortNameSafely() { String generatedShortName; int counter = 0; 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 e8ae46d19b..448cbb567c 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 @@ -2600,7 +2600,8 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ .defaultLoanProductsRequestLP2InterestDailyRecalculation()// .name(name105)// .paymentAllocation(List.of(// - createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"))) + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "LAST_INSTALLMENT"))) .enableAccrualActivityPosting(true)// .chargeOffBehaviour("ZERO_INTEREST");// PostLoanProductsResponse responseLoanProductsRequestAdvInterestRecalculationZeroInterestChargeOffBehaviourAccrualActivity = createLoanProductIdempotent( @@ -4228,6 +4229,40 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ TestContext.INSTANCE.set( TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_CHARGEBACK, responseLoanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyMultiDisburseChargeback); + + // LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_360_30_USD + // Similar to LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL but with 360/30 days and USD + // currency + String name169 = DefaultLoanProduct.LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_360_30_USD.getName(); + + PostLoanProductsRequest loanProductsRequestAdvCustomPaymentAllocationProgressiveLoanScheduleHorizontalUSD = loanProductsRequestFactory + .defaultLoanProductsRequestLP2EmiUSD()// + .name(name169)// + .paymentAllocation(List.of(// + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT", // + LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_PENALTY, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_FEE, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_PRINCIPAL, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_INTEREST, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_PENALTY, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_FEE, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_PRINCIPAL, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_INTEREST, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_PENALTY, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_FEE, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_PRINCIPAL, // + LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_INTEREST), // + createPaymentAllocation("GOODWILL_CREDIT", "NEXT_INSTALLMENT"), // + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "LAST_INSTALLMENT"), // + createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT"))) + .creditAllocation(List.of(// + createCreditAllocation("CHARGEBACK", List.of("PENALTY", "FEE", "PRINCIPAL", "INTEREST"))// + ));// + PostLoanProductsResponse responseLoanProductsResponseAdvCustomPaymentAllocationProgressiveLoanScheduleHorizontalUSD = createLoanProductIdempotent( + loanProductsRequestAdvCustomPaymentAllocationProgressiveLoanScheduleHorizontalUSD); + TestContext.INSTANCE.set( + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_360_30_USD, + responseLoanProductsResponseAdvCustomPaymentAllocationProgressiveLoanScheduleHorizontalUSD); } public static AdvancedPaymentData createPaymentAllocation(String transactionType, String futureInstallmentAllocationRule, diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java index 3ccaa8a6a2..f94bff129e 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 @@ -290,4 +290,5 @@ public abstract class TestContextKey { public static final String LP1_INTEREST_FLAT_DAILY_RECALCULATION_SAR_MULTIDISB_EXPECT_TRANCHES = "loanProductCreateResponseLP1InterestFlatDailyRecalculationSameAsRepaymentMultiDisbursementExpectTranches"; public static final String LP1_INTEREST_FLAT_DAILY_ACTUAL_ACTUAL_MULTIDISB_EXPECT_TRANCHES = "loanProductCreateResponseLP1InterestFlatDailyActualActualMultiDisbursementExpectTranches"; public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_360_30_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY = "loanProductCreateResponseLP2AdvancedPaymentZeroInterestChargeOffBehaviourAccrualActivity"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_360_30_USD = "loanProductCreateResponseLP2AdvancedPaymentHorizontal36030Usd"; } 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 d5ae72585c..5ddd6d8e7f 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature @@ -9399,3 +9399,150 @@ Feature: LoanAccrualActivity When Admin makes Credit Balance Refund transaction on "06 October 2025" with 36.34 EUR transaction amount Then Loan is closed with zero outstanding balance and it's all installments have obligations met + @TestRailId:C4517 + Scenario: Verify that accrual and accrual activity amounts are correct in case of early paid last installment, overdue last-1 installment on each days around due date + When Admin sets the business date to "21 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_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_360_30_USD | 21 April 2025 | 218.54 | 9.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "21 April 2025" with "218.54" amount and expected disbursement date on "21 April 2025" + And Admin successfully disburse the loan on "21 April 2025" with "218.54" EUR transaction amount + When Admin sets the business date to "02 May 2025" + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "02 May 2025" with 37.49 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "21 May 2025" + And Customer makes "AUTOPAY" repayment on "21 May 2025" with 37.49 EUR transaction amount + When Admin sets the business date to "21 June 2025" + And Customer makes "AUTOPAY" repayment on "21 June 2025" with 37.49 EUR transaction amount + When Admin sets the business date to "21 July 2025" + And Customer makes "AUTOPAY" repayment on "21 July 2025" with 37.49 EUR transaction amount + When Admin sets the business date to "21 August 2025" + And Customer makes "AUTOPAY" repayment on "21 August 2025" with 37.49 EUR transaction amount + # --- Check on maturity date - 1 --- + When Admin sets the business date to "20 October 2025" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 21 April 2025 | | 218.54 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 21 May 2025 | 21 May 2025 | 182.67 | 35.87 | 1.62 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 2 | 31 | 21 June 2025 | 21 June 2025 | 146.39 | 36.28 | 1.21 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 3 | 30 | 21 July 2025 | 21 July 2025 | 109.81 | 36.58 | 0.91 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 4 | 31 | 21 August 2025 | 21 August 2025 | 72.92 | 36.89 | 0.6 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 5 | 31 | 21 September 2025 | | 37.49 | 35.43 | 0.57 | 0.0 | 0.0 | 36.0 | 0.12 | 0.12 | 0.0 | 35.88 | + | 6 | 30 | 21 October 2025 | 02 May 2025 | 0.0 | 37.49 | 0.0 | 0.0 | 0.0 | 37.49 | 37.49 | 37.49 | 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 | + | 218.54 | 4.91 | 0.0 | 0.0 | 223.45 | 187.57 | 38.09 | 0.0 | 35.88 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 April 2025 | Disbursement | 218.54 | 0.0 | 0.0 | 0.0 | 0.0 | 218.54 | false | false | + | 02 May 2025 | Merchant Issued Refund | 37.49 | 37.49 | 0.0 | 0.0 | 0.0 | 181.05 | false | false | + | 02 May 2025 | Interest Refund | 0.12 | 0.12 | 0.0 | 0.0 | 0.0 | 180.93 | false | false | + | 21 May 2025 | Repayment | 37.49 | 35.87 | 1.62 | 0.0 | 0.0 | 145.06 | false | false | + | 21 May 2025 | Accrual Activity | 1.62 | 0.0 | 1.62 | 0.0 | 0.0 | 0.0 | false | false | + | 21 June 2025 | Repayment | 37.49 | 36.28 | 1.21 | 0.0 | 0.0 | 108.78 | false | false | + | 21 June 2025 | Accrual Activity | 1.21 | 0.0 | 1.21 | 0.0 | 0.0 | 0.0 | false | false | + | 21 July 2025 | Repayment | 37.49 | 36.58 | 0.91 | 0.0 | 0.0 | 72.2 | false | false | + | 21 July 2025 | Accrual Activity | 0.91 | 0.0 | 0.91 | 0.0 | 0.0 | 0.0 | false | false | + | 21 August 2025 | Repayment | 37.49 | 36.89 | 0.6 | 0.0 | 0.0 | 35.31 | false | false | + | 21 August 2025 | Accrual Activity | 0.6 | 0.0 | 0.6 | 0.0 | 0.0 | 0.0 | false | false | + | 21 September 2025 | Accrual Activity | 0.56 | 0.0 | 0.56 | 0.0 | 0.0 | 0.0 | false | false | + | 19 October 2025 | Accrual | 4.63 | 0.0 | 4.63 | 0.0 | 0.0 | 0.0 | false | false | + # --- Check on maturity date --- + When Admin sets the business date to "21 October 2025" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 21 April 2025 | | 218.54 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 21 May 2025 | 21 May 2025 | 182.67 | 35.87 | 1.62 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 2 | 31 | 21 June 2025 | 21 June 2025 | 146.39 | 36.28 | 1.21 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 3 | 30 | 21 July 2025 | 21 July 2025 | 109.81 | 36.58 | 0.91 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 4 | 31 | 21 August 2025 | 21 August 2025 | 72.92 | 36.89 | 0.6 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 5 | 31 | 21 September 2025 | | 37.49 | 35.43 | 0.58 | 0.0 | 0.0 | 36.01 | 0.12 | 0.12 | 0.0 | 35.89 | + | 6 | 30 | 21 October 2025 | 02 May 2025 | 0.0 | 37.49 | 0.0 | 0.0 | 0.0 | 37.49 | 37.49 | 37.49 | 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 | + | 218.54 | 4.92 | 0.0 | 0.0 | 223.46 | 187.57 | 38.09 | 0.0 | 35.89 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 April 2025 | Disbursement | 218.54 | 0.0 | 0.0 | 0.0 | 0.0 | 218.54 | false | false | + | 02 May 2025 | Merchant Issued Refund | 37.49 | 37.49 | 0.0 | 0.0 | 0.0 | 181.05 | false | false | + | 02 May 2025 | Interest Refund | 0.12 | 0.12 | 0.0 | 0.0 | 0.0 | 180.93 | false | false | + | 21 May 2025 | Repayment | 37.49 | 35.87 | 1.62 | 0.0 | 0.0 | 145.06 | false | false | + | 21 May 2025 | Accrual Activity | 1.62 | 0.0 | 1.62 | 0.0 | 0.0 | 0.0 | false | false | + | 21 June 2025 | Repayment | 37.49 | 36.28 | 1.21 | 0.0 | 0.0 | 108.78 | false | false | + | 21 June 2025 | Accrual Activity | 1.21 | 0.0 | 1.21 | 0.0 | 0.0 | 0.0 | false | false | + | 21 July 2025 | Repayment | 37.49 | 36.58 | 0.91 | 0.0 | 0.0 | 72.2 | false | false | + | 21 July 2025 | Accrual Activity | 0.91 | 0.0 | 0.91 | 0.0 | 0.0 | 0.0 | false | false | + | 21 August 2025 | Repayment | 37.49 | 36.89 | 0.6 | 0.0 | 0.0 | 35.31 | false | false | + | 21 August 2025 | Accrual Activity | 0.6 | 0.0 | 0.6 | 0.0 | 0.0 | 0.0 | false | false | + | 21 September 2025 | Accrual Activity | 0.57 | 0.0 | 0.57 | 0.0 | 0.0 | 0.0 | false | true | + | 19 October 2025 | Accrual | 4.63 | 0.0 | 4.63 | 0.0 | 0.0 | 0.0 | false | false | + | 20 October 2025 | Accrual | 0.28 | 0.0 | 0.28 | 0.0 | 0.0 | 0.0 | false | false | + # --- Check on maturity date 1 --- + When Admin sets the business date to "22 October 2025" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 21 April 2025 | | 218.54 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 21 May 2025 | 21 May 2025 | 182.67 | 35.87 | 1.62 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 2 | 31 | 21 June 2025 | 21 June 2025 | 146.39 | 36.28 | 1.21 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 3 | 30 | 21 July 2025 | 21 July 2025 | 109.81 | 36.58 | 0.91 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 4 | 31 | 21 August 2025 | 21 August 2025 | 72.92 | 36.89 | 0.6 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 5 | 31 | 21 September 2025 | | 37.49 | 35.43 | 0.58 | 0.0 | 0.0 | 36.01 | 0.12 | 0.12 | 0.0 | 35.89 | + | 6 | 30 | 21 October 2025 | 02 May 2025 | 0.0 | 37.49 | 0.0 | 0.0 | 0.0 | 37.49 | 37.49 | 37.49 | 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 | + | 218.54 | 4.92 | 0.0 | 0.0 | 223.46 | 187.57 | 38.09 | 0.0 | 35.89 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 April 2025 | Disbursement | 218.54 | 0.0 | 0.0 | 0.0 | 0.0 | 218.54 | false | false | + | 02 May 2025 | Merchant Issued Refund | 37.49 | 37.49 | 0.0 | 0.0 | 0.0 | 181.05 | false | false | + | 02 May 2025 | Interest Refund | 0.12 | 0.12 | 0.0 | 0.0 | 0.0 | 180.93 | false | false | + | 21 May 2025 | Repayment | 37.49 | 35.87 | 1.62 | 0.0 | 0.0 | 145.06 | false | false | + | 21 May 2025 | Accrual Activity | 1.62 | 0.0 | 1.62 | 0.0 | 0.0 | 0.0 | false | false | + | 21 June 2025 | Repayment | 37.49 | 36.28 | 1.21 | 0.0 | 0.0 | 108.78 | false | false | + | 21 June 2025 | Accrual Activity | 1.21 | 0.0 | 1.21 | 0.0 | 0.0 | 0.0 | false | false | + | 21 July 2025 | Repayment | 37.49 | 36.58 | 0.91 | 0.0 | 0.0 | 72.2 | false | false | + | 21 July 2025 | Accrual Activity | 0.91 | 0.0 | 0.91 | 0.0 | 0.0 | 0.0 | false | false | + | 21 August 2025 | Repayment | 37.49 | 36.89 | 0.6 | 0.0 | 0.0 | 35.31 | false | false | + | 21 August 2025 | Accrual Activity | 0.6 | 0.0 | 0.6 | 0.0 | 0.0 | 0.0 | false | false | + | 21 September 2025 | Accrual Activity | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false | true | + | 19 October 2025 | Accrual | 4.63 | 0.0 | 4.63 | 0.0 | 0.0 | 0.0 | false | false | + | 20 October 2025 | Accrual | 0.28 | 0.0 | 0.28 | 0.0 | 0.0 | 0.0 | false | false | + | 21 October 2025 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + # --- Check on maturity date 2 --- + When Admin sets the business date to "23 October 2025" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 21 April 2025 | | 218.54 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 21 May 2025 | 21 May 2025 | 182.67 | 35.87 | 1.62 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 2 | 31 | 21 June 2025 | 21 June 2025 | 146.39 | 36.28 | 1.21 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 3 | 30 | 21 July 2025 | 21 July 2025 | 109.81 | 36.58 | 0.91 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 4 | 31 | 21 August 2025 | 21 August 2025 | 72.92 | 36.89 | 0.6 | 0.0 | 0.0 | 37.49 | 37.49 | 0.12 | 0.0 | 0.0 | + | 5 | 31 | 21 September 2025 | | 37.49 | 35.43 | 0.58 | 0.0 | 0.0 | 36.01 | 0.12 | 0.12 | 0.0 | 35.89 | + | 6 | 30 | 21 October 2025 | 02 May 2025 | 0.0 | 37.49 | 0.0 | 0.0 | 0.0 | 37.49 | 37.49 | 37.49 | 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 | + | 218.54 | 4.92 | 0.0 | 0.0 | 223.46 | 187.57 | 38.09 | 0.0 | 35.89 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 21 April 2025 | Disbursement | 218.54 | 0.0 | 0.0 | 0.0 | 0.0 | 218.54 | false | false | + | 02 May 2025 | Merchant Issued Refund | 37.49 | 37.49 | 0.0 | 0.0 | 0.0 | 181.05 | false | false | + | 02 May 2025 | Interest Refund | 0.12 | 0.12 | 0.0 | 0.0 | 0.0 | 180.93 | false | false | + | 21 May 2025 | Repayment | 37.49 | 35.87 | 1.62 | 0.0 | 0.0 | 145.06 | false | false | + | 21 May 2025 | Accrual Activity | 1.62 | 0.0 | 1.62 | 0.0 | 0.0 | 0.0 | false | false | + | 21 June 2025 | Repayment | 37.49 | 36.28 | 1.21 | 0.0 | 0.0 | 108.78 | false | false | + | 21 June 2025 | Accrual Activity | 1.21 | 0.0 | 1.21 | 0.0 | 0.0 | 0.0 | false | false | + | 21 July 2025 | Repayment | 37.49 | 36.58 | 0.91 | 0.0 | 0.0 | 72.2 | false | false | + | 21 July 2025 | Accrual Activity | 0.91 | 0.0 | 0.91 | 0.0 | 0.0 | 0.0 | false | false | + | 21 August 2025 | Repayment | 37.49 | 36.89 | 0.6 | 0.0 | 0.0 | 35.31 | false | false | + | 21 August 2025 | Accrual Activity | 0.6 | 0.0 | 0.6 | 0.0 | 0.0 | 0.0 | false | false | + | 21 September 2025 | Accrual Activity | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false | true | + | 19 October 2025 | Accrual | 4.63 | 0.0 | 4.63 | 0.0 | 0.0 | 0.0 | false | false | + | 20 October 2025 | Accrual | 0.28 | 0.0 | 0.28 | 0.0 | 0.0 | 0.0 | false | false | + | 21 October 2025 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + # --- Close loan --- + When Loan Pay-off is made on "23 October 2025" + Then Loan is closed with zero outstanding balance and it's all installments have obligations met diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualTransaction.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualTransaction.feature index d012e2fe4e..eeaed72f28 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualTransaction.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualTransaction.feature @@ -1590,4 +1590,374 @@ Feature: LoanAccrualTransaction Then Loan Transactions tab has a "ACCRUAL" transaction with date "12 May 2025" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112603 | Interest/Fee Receivable | 1.3 | | - | INCOME | 404007 | Fee Income | | 1.3 | \ No newline at end of file + | INCOME | 404007 | Fee Income | | 1.3 | + + @TestRailId:C4516 + Scenario: Verify Interest recalculation - EARLY repayment, adjust LAST installment - UC5: 360/30, interest and accruals are correctly calculated till and after maturity date + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_ACCRUAL_ACTIVITY_POSTING" loan product "MERCHANT_ISSUED_REFUND" transaction type to "LAST_INSTALLMENT" future installment allocation rule + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_ACCRUAL_ACTIVITY_POSTING | 01 January 2024 | 100 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "100" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2024 | | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.0 | 0.0 | 17.0 | 0.0 | 0.0 | 0.0 | 17.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.05 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + # --- Early repayment with 17.01 EUR on 15 Jan --- + When Admin sets the business date to "15 January 2024" + When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "15 January 2024" with 17.01 EUR transaction amount + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2024 | | 83.52 | 16.48 | 0.53 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 2 | 29 | 01 March 2024 | | 66.9 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 3 | 31 | 01 April 2024 | | 50.18 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 4 | 30 | 01 May 2024 | | 33.36 | 16.82 | 0.19 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 17.01 | 16.35 | 0.1 | 0.0 | 0.0 | 16.45 | 0.0 | 0.0 | 0.0 | 16.45 | + | 6 | 30 | 01 July 2024 | 15 January 2024 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | 17.01 | 17.01 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 1.5 | 0.0 | 0.0 | 101.5 | 17.01 | 17.01 | 0.0 | 84.49 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 15 January 2024 | Merchant Issued Refund | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 | 82.99 | false | false | + When Admin sets the business date to "01 June 2024" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2024 | | 83.52 | 16.48 | 0.53 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 2 | 29 | 01 March 2024 | | 66.99 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 3 | 31 | 01 April 2024 | | 50.46 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 4 | 30 | 01 May 2024 | | 33.93 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 17.01 | 16.92 | 0.48 | 0.0 | 0.0 | 17.4 | 0.0 | 0.0 | 0.0 | 17.4 | + | 6 | 30 | 01 July 2024 | 15 January 2024 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | 17.01 | 17.01 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.45 | 0.0 | 0.0 | 102.45 | 17.01 | 17.01 | 0.0 | 85.44 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 15 January 2024 | Merchant Issued Refund | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 | 82.99 | false | false | + | 01 February 2024 | Accrual Activity | 0.53 | 0.0 | 0.53 | 0.0 | 0.0 | 0.0 | false | false | + | 01 March 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 April 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 31 May 2024 | Accrual | 1.87 | 0.0 | 1.87 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "02 June 2024" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2024 | | 83.52 | 16.48 | 0.53 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 2 | 29 | 01 March 2024 | | 66.99 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 3 | 31 | 01 April 2024 | | 50.46 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 4 | 30 | 01 May 2024 | | 33.93 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 17.01 | 16.92 | 0.5 | 0.0 | 0.0 | 17.42 | 0.0 | 0.0 | 0.0 | 17.42 | + | 6 | 30 | 01 July 2024 | 15 January 2024 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | 17.01 | 17.01 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.47 | 0.0 | 0.0 | 102.47 | 17.01 | 17.01 | 0.0 | 85.46 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 15 January 2024 | Merchant Issued Refund | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 | 82.99 | false | false | + | 01 February 2024 | Accrual Activity | 0.53 | 0.0 | 0.53 | 0.0 | 0.0 | 0.0 | false | false | + | 01 March 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 April 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 31 May 2024 | Accrual | 1.87 | 0.0 | 1.87 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "01 July 2024" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2024 | | 83.52 | 16.48 | 0.53 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 2 | 29 | 01 March 2024 | | 66.99 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 3 | 31 | 01 April 2024 | | 50.46 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 4 | 30 | 01 May 2024 | | 33.93 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 17.01 | 16.92 | 0.96 | 0.0 | 0.0 | 17.88 | 0.0 | 0.0 | 0.0 | 17.88 | + | 6 | 30 | 01 July 2024 | 15 January 2024 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | 17.01 | 17.01 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.93 | 0.0 | 0.0 | 102.93 | 17.01 | 17.01 | 0.0 | 85.92 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 15 January 2024 | Merchant Issued Refund | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 | 82.99 | false | false | + | 01 February 2024 | Accrual Activity | 0.53 | 0.0 | 0.53 | 0.0 | 0.0 | 0.0 | false | false | + | 01 March 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 April 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 31 May 2024 | Accrual | 1.87 | 0.0 | 1.87 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual Activity | 0.95 | 0.0 | 0.95 | 0.0 | 0.0 | 0.0 | false | true | + | 02 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 03 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 04 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 05 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 06 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 07 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 08 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 09 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 10 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 11 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 12 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 13 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 14 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 15 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 16 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 17 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 18 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 19 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 20 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 21 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 22 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 23 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 24 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 25 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 26 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 27 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 28 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 29 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 30 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "02 July 2024" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2024 | | 83.52 | 16.48 | 0.53 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 2 | 29 | 01 March 2024 | | 66.99 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 3 | 31 | 01 April 2024 | | 50.46 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 4 | 30 | 01 May 2024 | | 33.93 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 17.01 | 16.92 | 0.96 | 0.0 | 0.0 | 17.88 | 0.0 | 0.0 | 0.0 | 17.88 | + | 6 | 30 | 01 July 2024 | 15 January 2024 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | 17.01 | 17.01 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.93 | 0.0 | 0.0 | 102.93 | 17.01 | 17.01 | 0.0 | 85.92 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 15 January 2024 | Merchant Issued Refund | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 | 82.99 | false | false | + | 01 February 2024 | Accrual Activity | 0.53 | 0.0 | 0.53 | 0.0 | 0.0 | 0.0 | false | false | + | 01 March 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 April 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 31 May 2024 | Accrual | 1.87 | 0.0 | 1.87 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual Activity | 0.96 | 0.0 | 0.96 | 0.0 | 0.0 | 0.0 | false | true | + | 02 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 03 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 04 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 05 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 06 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 07 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 08 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 09 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 10 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 11 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 12 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 13 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 14 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 15 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 16 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 17 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 18 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 19 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 20 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 21 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 22 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 23 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 24 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 25 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 26 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 27 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 28 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 29 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 30 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 01 July 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "03 July 2024" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2024 | | 83.52 | 16.48 | 0.53 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 2 | 29 | 01 March 2024 | | 66.99 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 3 | 31 | 01 April 2024 | | 50.46 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 4 | 30 | 01 May 2024 | | 33.93 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 17.01 | 16.92 | 0.96 | 0.0 | 0.0 | 17.88 | 0.0 | 0.0 | 0.0 | 17.88 | + | 6 | 30 | 01 July 2024 | 15 January 2024 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | 17.01 | 17.01 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.93 | 0.0 | 0.0 | 102.93 | 17.01 | 17.01 | 0.0 | 85.92 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 15 January 2024 | Merchant Issued Refund | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 | 82.99 | false | false | + | 01 February 2024 | Accrual Activity | 0.53 | 0.0 | 0.53 | 0.0 | 0.0 | 0.0 | false | false | + | 01 March 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 April 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 31 May 2024 | Accrual | 1.87 | 0.0 | 1.87 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual Activity | 0.96 | 0.0 | 0.96 | 0.0 | 0.0 | 0.0 | false | true | + | 02 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 03 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 04 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 05 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 06 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 07 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 08 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 09 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 10 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 11 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 12 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 13 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 14 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 15 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 16 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 17 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 18 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 19 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 20 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 21 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 22 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 23 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 24 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 25 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 26 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 27 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 28 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 29 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 30 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 01 July 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "01 August 2024" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2024 | | 83.52 | 16.48 | 0.53 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 2 | 29 | 01 March 2024 | | 66.99 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 3 | 31 | 01 April 2024 | | 50.46 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 4 | 30 | 01 May 2024 | | 33.93 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 17.01 | 16.92 | 0.96 | 0.0 | 0.0 | 17.88 | 0.0 | 0.0 | 0.0 | 17.88 | + | 6 | 30 | 01 July 2024 | 15 January 2024 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | 17.01 | 17.01 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.93 | 0.0 | 0.0 | 102.93 | 17.01 | 17.01 | 0.0 | 85.92 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 15 January 2024 | Merchant Issued Refund | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 | 82.99 | false | false | + | 01 February 2024 | Accrual Activity | 0.53 | 0.0 | 0.53 | 0.0 | 0.0 | 0.0 | false | false | + | 01 March 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 April 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 31 May 2024 | Accrual | 1.87 | 0.0 | 1.87 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual Activity | 0.96 | 0.0 | 0.96 | 0.0 | 0.0 | 0.0 | false | true | + | 02 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 03 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 04 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 05 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 06 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 07 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 08 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 09 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 10 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 11 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 12 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 13 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 14 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 15 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 16 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 17 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 18 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 19 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 20 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 21 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 22 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 23 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 24 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 25 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 26 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 27 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 28 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 29 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 30 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 01 July 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + When Admin sets the business date to "02 August 2024" + And Admin runs inline COB job for Loan + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2024 | | 83.52 | 16.48 | 0.53 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 2 | 29 | 01 March 2024 | | 66.99 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 3 | 31 | 01 April 2024 | | 50.46 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 4 | 30 | 01 May 2024 | | 33.93 | 16.53 | 0.48 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 17.01 | 16.92 | 0.96 | 0.0 | 0.0 | 17.88 | 0.0 | 0.0 | 0.0 | 17.88 | + | 6 | 30 | 01 July 2024 | 15 January 2024 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | 17.01 | 17.01 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.93 | 0.0 | 0.0 | 102.93 | 17.01 | 17.01 | 0.0 | 85.92 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 15 January 2024 | Merchant Issued Refund | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 | 82.99 | false | false | + | 01 February 2024 | Accrual Activity | 0.53 | 0.0 | 0.53 | 0.0 | 0.0 | 0.0 | false | false | + | 01 March 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 April 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 01 May 2024 | Accrual Activity | 0.48 | 0.0 | 0.48 | 0.0 | 0.0 | 0.0 | false | false | + | 31 May 2024 | Accrual | 1.87 | 0.0 | 1.87 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false | false | + | 01 June 2024 | Accrual Activity | 0.96 | 0.0 | 0.96 | 0.0 | 0.0 | 0.0 | false | true | + | 02 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 03 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 04 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 05 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 06 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 07 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 08 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 09 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 10 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 11 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 12 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 13 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 14 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 15 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 16 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 17 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 18 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 19 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 20 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 21 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 22 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 23 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 24 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 25 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 26 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 27 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 28 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 29 June 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + | 30 June 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | + | 01 July 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | + When Loan Pay-off is made on "01 July 2024" + Then Loan is closed with zero outstanding balance and it's all installments have obligations met + When Admin set "LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_ACCRUAL_ACTIVITY_POSTING" loan product "MERCHANT_ISSUED_REFUND" transaction type to "REAMORTIZATION" future installment allocation rule diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature index e94a899490..b3444a6d68 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature @@ -1496,8 +1496,8 @@ Feature: LoanDelinquency Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | | 01 June 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | - | 14 July 2024 | Accrual | 10.0 | 0.0 | 10.0 | 0.0 | 0.0 | 0.0 | - | 15 July 2024 | Repayment | 343.33 | 333.33 | 10.0 | 0.0 | 0.0 | 666.67 | + | 14 July 2024 | Accrual | 14.19 | 0.0 | 14.19 | 0.0 | 0.0 | 0.0 | + | 15 July 2024 | Repayment | 343.33 | 333.33 | 10.0 | 0.0 | 0.0 | 666.67 | Then Loan has the following LOAN level next payment due data: | classification | nextPaymentDueDate | nextPaymentAmount | | NO_DELINQUENCY | 01 August 2024 | 343.33 | diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPaymentWaiver.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPaymentWaiver.feature index bd3dae122a..6e6ebed860 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPaymentWaiver.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPaymentWaiver.feature @@ -1017,11 +1017,11 @@ Feature: LoanInterestWaiver | 20 | 31 | 18 September 2023 | | 47.25 | 19.23 | 0.7 | 0.0 | 0.0 | 19.93 | 0.0 | 0.0 | 0.0 | 19.93 | | 21 | 30 | 18 October 2023 | | 27.99 | 19.26 | 0.67 | 0.0 | 0.0 | 19.93 | 0.0 | 0.0 | 0.0 | 19.93 | | 22 | 31 | 18 November 2023 | | 8.76 | 19.23 | 0.7 | 0.0 | 0.0 | 19.93 | 0.0 | 0.0 | 0.0 | 19.93 | - | 23 | 30 | 18 December 2023 | | 0.0 | 8.76 | 0.67 | 0.0 | 0.0 | 9.43 | 0.0 | 0.0 | 0.0 | 9.43 | + | 23 | 30 | 18 December 2023 | | 0.0 | 8.76 | 1.37 | 0.0 | 0.0 | 10.13 | 0.0 | 0.0 | 0.0 | 10.13 | | 24 | 31 | 18 January 2024 | 20 January 2022 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | Then Loan Repayment schedule has the following data in Total row: | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 431.98 | 15.91 | 0.0 | 0.0 | 447.89 | 350.19 | 350.19 | 0.0 | 97.7 | + | 431.98 | 16.61 | 0.0 | 0.0 | 448.59 | 350.19 | 350.19 | 0.0 | 98.4 | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | | 18 January 2022 | Disbursement | 431.98 | 0.0 | 0.0 | 0.0 | 0.0 | 431.98 | false | false | @@ -1233,12 +1233,12 @@ Feature: LoanInterestWaiver | 7 | 31 | 18 August 2022 | | 171.12 | 37.28 | 0.69 | 0.0 | 0.0 | 37.97 | 29.17 | 29.17 | 0.0 | 8.8 | | 8 | 31 | 18 September 2022 | | 133.84 | 37.28 | 0.69 | 0.0 | 0.0 | 37.97 | 29.17 | 29.17 | 0.0 | 8.8 | | 9 | 30 | 18 October 2022 | | 96.54 | 37.3 | 0.67 | 0.0 | 0.0 | 37.97 | 29.17 | 29.17 | 0.0 | 8.8 | - | 10 | 31 | 18 November 2022 | | 58.29 | 38.25 | 0.69 | 0.0 | 0.0 | 38.94 | 29.17 | 29.17 | 0.0 | 9.77 | + | 10 | 31 | 18 November 2022 | | 58.29 | 38.25 | 2.05 | 0.0 | 0.0 | 40.3 | 29.17 | 29.17 | 0.0 |11.13 | | 11 | 30 | 18 December 2022 | 20 January 2022 | 29.12 | 29.17 | 0.0 | 0.0 | 0.0 | 29.17 | 29.17 | 29.17 | 0.0 | 0.0 | | 12 | 31 | 18 January 2023 | 20 January 2022 | 0.0 | 29.12 | 0.0 | 0.0 | 0.0 | 29.12 | 29.12 | 29.12 | 0.0 | 0.0 | Then Loan Repayment schedule has the following data in Total row: | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 431.98 | 6.98 | 0.0 | 0.0 | 438.96 | 350.19 | 350.19 | 0.0 | 88.77 | + | 431.98 | 8.34 | 0.0 | 0.0 | 440.32 | 350.19 | 350.19 | 0.0 | 90.13 | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | | 18 January 2022 | Disbursement | 431.98 | 0.0 | 0.0 | 0.0 | 0.0 | 431.98 | diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java index f34702421a..5e0191493f 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java @@ -587,17 +587,20 @@ public final class ProgressiveEMICalculator implements EMICalculator { public boolean recalculateModelOverdueAmountsTillDate(final ProgressiveLoanInterestScheduleModel scheduleModel, final LocalDate targetDate, boolean prepayAttempt) { boolean hasChange = false; - final List<RepaymentPeriod> overdueInstallmentsSortedByInstallmentNumber = findPossiblyOverdueRepaymentPeriods(targetDate, - scheduleModel); + LocalDate recalculatedTargetDate = DateUtils.isAfter(targetDate, scheduleModel.getLastRepaymentPeriod().getDueDate()) + ? scheduleModel.getLastRepaymentPeriod().getDueDate() + : targetDate; + final List<RepaymentPeriod> overdueInstallmentsSortedByInstallmentNumber = findPossiblyOverdueRepaymentPeriods( + recalculatedTargetDate, scheduleModel); if (!overdueInstallmentsSortedByInstallmentNumber.isEmpty()) { final RepaymentPeriod lastPeriod = scheduleModel.getLastRepaymentPeriod(); - final RepaymentPeriod currentPeriod = scheduleModel.findRepaymentPeriod(targetDate).orElse(lastPeriod); + final RepaymentPeriod currentPeriod = scheduleModel.findRepaymentPeriod(recalculatedTargetDate).orElse(lastPeriod); Money overDuePrincipal = scheduleModel.zero(); Money aggregatedOverDuePrincipal = scheduleModel.zero(); for (RepaymentPeriod processingPeriod : overdueInstallmentsSortedByInstallmentNumber) { // add and subtract outstanding principal if (!overDuePrincipal.isZero()) { - final boolean currentChanges = adjustOverduePrincipal(targetDate, processingPeriod, overDuePrincipal, + final boolean currentChanges = adjustOverduePrincipal(recalculatedTargetDate, processingPeriod, overDuePrincipal, aggregatedOverDuePrincipal, scheduleModel, prepayAttempt); hasChange = hasChange || currentChanges; @@ -607,15 +610,15 @@ public final class ProgressiveEMICalculator implements EMICalculator { aggregatedOverDuePrincipal = aggregatedOverDuePrincipal.add(overDuePrincipal); } - if (!currentPeriod.equals(lastPeriod) || !targetDate.isAfter(lastPeriod.getDueDate())) { - final boolean currentChanges = adjustOverduePrincipal(targetDate, currentPeriod, overDuePrincipal, + if (!currentPeriod.equals(lastPeriod) || !recalculatedTargetDate.isAfter(lastPeriod.getDueDate())) { + final boolean currentChanges = adjustOverduePrincipal(recalculatedTargetDate, currentPeriod, overDuePrincipal, aggregatedOverDuePrincipal, scheduleModel, prepayAttempt); hasChange = hasChange || currentChanges; } if (aggregatedOverDuePrincipal.isGreaterThanZero() && (scheduleModel.lastOverdueBalanceChange() == null - || scheduleModel.lastOverdueBalanceChange().isBefore(targetDate))) { - scheduleModel.lastOverdueBalanceChange(targetDate); + || scheduleModel.lastOverdueBalanceChange().isBefore(recalculatedTargetDate))) { + scheduleModel.lastOverdueBalanceChange(recalculatedTargetDate); } } diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriod.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriod.java index dff87cfdbd..267013a306 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriod.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriod.java @@ -86,6 +86,7 @@ public class RepaymentPeriod { @Getter private final ILoanConfigurationDetails loanProductRelatedDetail; @JsonExclude + @Setter private MonetaryCurrency currency; @Getter @@ -148,6 +149,10 @@ public class RepaymentPeriod { repaymentPeriod.getLoanProductRelatedDetail(), repaymentPeriod.isNoUnrecognisedInterest(), repaymentPeriod.isReAged(), repaymentPeriod.isReAgedEarlyRepaymentHolder(), repaymentPeriod.getReAgedInterest()); newRepaymentPeriod.setOutstandingMovedDueToReAging(repaymentPeriod.isOutstandingMovedDueToReAging()); + newRepaymentPeriod.setTotalDisbursedAmount(repaymentPeriod.getTotalDisbursedAmount()); + newRepaymentPeriod.setTotalCapitalizedIncomeAmount(repaymentPeriod.getTotalCapitalizedIncomeAmount()); + newRepaymentPeriod.setInterestMoved(repaymentPeriod.isInterestMoved()); + newRepaymentPeriod.setCurrency(repaymentPeriod.getCurrency()); // There is always at least 1 interest period, by default with same from-due date as repayment period for (InterestPeriod interestPeriod : repaymentPeriod.getInterestPeriods()) { newRepaymentPeriod.getInterestPeriods().add(InterestPeriod.copy(newRepaymentPeriod, interestPeriod, mc)); @@ -162,6 +167,10 @@ public class RepaymentPeriod { zero, mc, repaymentPeriod.getLoanProductRelatedDetail(), repaymentPeriod.isNoUnrecognisedInterest(), repaymentPeriod.isReAged(), repaymentPeriod.isReAgedEarlyRepaymentHolder(), repaymentPeriod.getReAgedInterest()); newRepaymentPeriod.setOutstandingMovedDueToReAging(repaymentPeriod.isOutstandingMovedDueToReAging()); + newRepaymentPeriod.setTotalDisbursedAmount(repaymentPeriod.getTotalDisbursedAmount()); + newRepaymentPeriod.setTotalCapitalizedIncomeAmount(repaymentPeriod.getTotalCapitalizedIncomeAmount()); + newRepaymentPeriod.setInterestMoved(repaymentPeriod.isInterestMoved()); + newRepaymentPeriod.setCurrency(repaymentPeriod.getCurrency()); // There is always at least 1 interest period, by default with same from-due date as repayment period for (InterestPeriod interestPeriod : repaymentPeriod.getInterestPeriods()) { var interestPeriodCopy = InterestPeriod.copy(newRepaymentPeriod, interestPeriod); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java index a23fa37ac0..7b21c4a293 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java @@ -131,7 +131,8 @@ public class LoanTransactionProcessingServiceImpl implements LoanTransactionProc @Override public LoanScheduleDTO getRecalculatedSchedule(final ScheduleGeneratorDTO generatorDTO, Loan loan) { - if (!loan.isInterestBearingAndInterestRecalculationEnabled() || loan.isNpa() || loan.isChargedOff()) { + if (!loan.isInterestBearingAndInterestRecalculationEnabled() || loan.isNpa() + || (loan.isChargedOff() && loan.isCumulativeSchedule())) { return null; } final InterestMethod interestMethod = loan.getLoanRepaymentScheduleDetail().getInterestMethod(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java index bb529f4a46..709299f500 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -2742,24 +2742,22 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(data)); }); - final LoanTransaction chargeOffTransaction = LoanTransaction.chargeOff(loan, transactionDate, txnExternalId); + final LoanTransaction chargeOffTransaction; if (loan.isInterestBearingAndInterestRecalculationEnabled()) { - if (loan.isCumulativeSchedule()) { - final ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, null, null); - loanScheduleService.regenerateRepaymentScheduleWithInterestRecalculation(loan, scheduleGeneratorDTO); - } + final ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, null, null); + loanScheduleService.regenerateRepaymentScheduleWithInterestRecalculation(loan, scheduleGeneratorDTO); + chargeOffTransaction = LoanTransaction.chargeOff(loan, transactionDate, txnExternalId); reprocessLoanTransactionsService.reprocessTransactions(loan, List.of(chargeOffTransaction)); loan.addLoanTransaction(chargeOffTransaction); } else { + chargeOffTransaction = LoanTransaction.chargeOff(loan, transactionDate, txnExternalId); reprocessLoanTransactionsService.processLatestTransaction(chargeOffTransaction, loan); loan.addLoanTransaction(chargeOffTransaction); } loanTransactionRepository.saveAndFlush(chargeOffTransaction); journalEntryPoster.postJournalEntriesForLoanTransaction(chargeOffTransaction, false, false); - saveAndFlushLoanWithDataIntegrityViolationChecks(loan); - String noteText = command.stringValueOfParameterNamed(LoanApiConstants.noteParameterName); if (StringUtils.isNotBlank(noteText)) { changes.put(LoanApiConstants.noteParameterName, noteText); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsInterestPostingTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsInterestPostingTest.java index 098b9a9624..5b026c3842 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsInterestPostingTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsInterestPostingTest.java @@ -340,7 +340,7 @@ public class SavingsInterestPostingTest { interestReceivableAccount.getAccountID().toString(), assetAccount, incomeAccount, expenseAccount, liabilityAccount); final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, "01 January 2025"); - final LocalDate startDate = LocalDate.of(LocalDate.now(Utils.getZoneIdOfTenant()).getYear(), 1, 1); + final LocalDate startDate = LocalDate.of(2025, 1, 1); final String startStr = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(startDate); final Integer accountId = savingsAccountHelper.applyForSavingsApplicationOnDate(clientId, productId,
