diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/ChargeProductType.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/ChargeProductType.java index 47b8e52c9..b84f47ccc 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/ChargeProductType.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/ChargeProductType.java @@ -28,12 +28,15 @@ public enum ChargeProductType { LOAN_NSF_FEE(6L), // LOAN_DISBURSEMENT_PERCENTAGE_FEE(7L), // LOAN_TRANCHE_DISBURSEMENT_PERCENTAGE_FEE(8L), // - LOAN_INSTALLMENT_PERCENTAGE_FEE(9L), // + LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST(9L), // LOAN_PERCENTAGE_LATE_FEE_AMOUNT_PLUS_INTEREST(10L), // CLIENT_TEST_CHARGE_FEE(11L), // LOAN_DISBURSEMENT_CHARGE(12L), // CHARGE_LOAN_TRANCHE_DISBURSEMENT_CHARGE_AMOUNT(13L), // - CHARGE_LOAN_TRANCHE_DISBURSEMENT_CHARGE_PERCENT(14L); // + CHARGE_LOAN_TRANCHE_DISBURSEMENT_CHARGE_PERCENT(14L), // + LOAN_INSTALLMENT_FEE_FLAT(15L), // + LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT(16L), // + LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST(17L); // public final Long value; 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 624010637..0dace5711 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 @@ -138,6 +138,12 @@ public enum DefaultLoanProduct implements LoanProduct { LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_FLAT_CAPITALIZED_INCOME, // LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_MULTIDISB_CAPITALIZED_INCOME_ADJ_CUSTOM_ALLOC, // LP2_ADV_PYMNT_360_30_INTEREST_RECALC_AUTO_DOWNPAYMENT_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY, // + LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALC_DAILY_INSTALLMENT_FEE_FLAT_CHARGES, // + LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_AMOUNT_CHARGES, // + LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_INTEREST_CHARGES, // + LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_AMOUNT_INTEREST_CHARGES, // + LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_ALL_CHARGES, // + LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_FLAT_INTEREST_CHARGES_TRANCHE, // ; @Override diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanRequestFactory.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanRequestFactory.java index c3836a19b..571c792ee 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanRequestFactory.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanRequestFactory.java @@ -60,6 +60,8 @@ public class LoanRequestFactory { public static final String DATE_FORMAT = "dd MMMM yyyy"; public static final String DEFAULT_LOCALE = "en"; public static final DefaultLoanProduct DEFAULT_LOAN_PRODUCT = DefaultLoanProduct.valueOf("LP1"); + public static final DefaultLoanProduct DEFAULT_PROGRESSIVE_LOAN_PRODUCT = DefaultLoanProduct + .valueOf("LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL"); public static final Double DEFAULT_PAYMENT_TRANSACTION_AMOUNT = 200.00; public static final Double DEFAULT_UNDO_TRANSACTION_AMOUNT = 0.0; public static final Double DEFAULT_REPAYMENT_TRANSACTION_AMOUNT = 200.00; @@ -78,13 +80,16 @@ public class LoanRequestFactory { public static final String DEFAULT_REAGING_FREQUENCY_TYPE = "MONTHS"; public static final BigDecimal DEFAULT_INTEREST_RATE_PER_PERIOD = new BigDecimal(0); public static final Integer DEFAULT_INTEREST_TYPE = InterestType.FLAT.value; + public static final Integer DEFAULT_PROGRESSIVE_INTEREST_TYPE = InterestType.DECLINING_BALANCE.value; public static final Integer DEFAULT_INTEREST_CALCULATION_PERIOD_TYPE_SAME_AS_REPAYMENT_PERIOD = InterestCalculationPeriodTime.SAME_AS_REPAYMENT_PERIOD.value; + public static final Integer DEFAULT_PROGRESSIVE_INTEREST_CALCULATION_PERIOD_TYPE_SAME_AS_REPAYMENT_PERIOD = InterestCalculationPeriodTime.DAILY.value; public static final Integer DEFAULT_AMORTIZATION_TYPE = 1; public static final String DEFAULT_LOAN_TYPE = "individual"; public static final Integer DEFAULT_NUMBER_OF_REPAYMENTS = 1; public static final Integer DEFAULT_NUMBER_OF_INSTALLMENTS = 5; public static final Integer DEFAULT_REPAYMENT_FREQUENCY = 30; public static final String DEFAULT_TRANSACTION_PROCESSING_STRATEGY_CODE = TransactionProcessingStrategyCode.PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER.value; + public static final String DEFAULT_PROGRESSIVE_TRANSACTION_PROCESSING_STRATEGY_CODE = TransactionProcessingStrategyCode.ADVANCED_PAYMENT_ALLOCATION.value; public static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT); public static final String DATE_SUBMIT_STRING = FORMATTER.format(Utils.now().minusMonths(1L)); @@ -118,6 +123,30 @@ public class LoanRequestFactory { .maxOutstandingLoanBalance(new BigDecimal(10000)); } + public PostLoansRequest defaultProgressiveLoansRequest(final Long clientId) { + return new PostLoansRequest()// + .clientId(clientId)// + .productId(loanProductResolver.resolve(DEFAULT_PROGRESSIVE_LOAN_PRODUCT))// + .submittedOnDate(DATE_SUBMIT_STRING)// + .expectedDisbursementDate(DATE_SUBMIT_STRING)// + .principal(DEFAULT_PRINCIPAL)// + .locale(DEFAULT_LOCALE)// + .loanTermFrequency(DEFAULT_LOAN_TERM_FREQUENCY)// + .loanTermFrequencyType(DEFAULT_LOAN_TERM_FREQUENCY_TYPE)// + .loanType(DEFAULT_LOAN_TYPE)// + .numberOfRepayments(DEFAULT_NUMBER_OF_REPAYMENTS)// + .repaymentEvery(DEFAULT_REPAYMENT_FREQUENCY)// + .repaymentFrequencyType(DEFAULT_REPAYMENT_FREQUENCY_TYPE)// + .interestRatePerPeriod(DEFAULT_INTEREST_RATE_PER_PERIOD)// + .interestType(DEFAULT_PROGRESSIVE_INTEREST_TYPE)// + .interestCalculationPeriodType(DEFAULT_PROGRESSIVE_INTEREST_CALCULATION_PERIOD_TYPE_SAME_AS_REPAYMENT_PERIOD)// + .amortizationType(DEFAULT_AMORTIZATION_TYPE)// + .transactionProcessingStrategyCode(DEFAULT_PROGRESSIVE_TRANSACTION_PROCESSING_STRATEGY_CODE)// + .dateFormat(DATE_FORMAT)// + .graceOnArrearsAgeing(3)// + .maxOutstandingLoanBalance(new BigDecimal(10000)); + } + public PutLoansLoanIdRequest modifySubmittedOnDateOnLoan(Long clientId, String newSubmittedOnDate) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); String dateDisburseStr = formatter.format(Utils.now()); diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java index 8bd31de06..931495f4a 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java @@ -972,4 +972,12 @@ public final class ErrorMessageHelper { public static String addInterestPauseForNotInactiveLoanFailure() { return "Operations on interest pauses are restricted to active loans."; } + + public static String addInstallmentFeeInterestPercentageChargeFailure() { + return "Failed data validation due to: installment.loancharge.with.calculation.type.interest.not.allowed."; + } + + public static String addInstallmentFeePrincipalPercentageChargeFailure() { + return "Failed data validation due to: installment.loancharge.with.calculation.type.principal.not.allowed."; + } } diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/ChargeGlobalInitializerStep.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/ChargeGlobalInitializerStep.java index 3a9a399af..20e831807 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/ChargeGlobalInitializerStep.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/ChargeGlobalInitializerStep.java @@ -52,12 +52,17 @@ public class ChargeGlobalInitializerStep implements FineractGlobalInitializerSte public static final String CHARGE_LOAN_NSF_FEE = "NSF fee"; public static final String CHARGE_LOAN_DISBURSEMENT_PERCENT_FEE = "Disbursement percentage fee"; public static final String CHARGE_LOAN_TRANCHE_DISBURSEMENT_PERCENT_FEE = "Tranche Disbursement percentage fee"; - public static final String CHARGE_LOAN_INSTALLMENT_PERCENT_FEE = "Installment percentage fee"; + public static final String CHARGE_LOAN_INSTALLMENT_FEE_FLAT = "Installment flat fee"; + public static final String CHARGE_LOAN_INSTALLMENT_FEE_PERCENT_AMOUNT = "Installment percentage amount fee"; + public static final String CHARGE_LOAN_INSTALLMENT_FEE_PERCENT_INTEREST = "Installment percentage interest fee"; + public static final String CHARGE_LOAN_INSTALLMENT_FEE_PERCENT_AMOUNT_PLUS_INTEREST = "Installment percentage amount + interest fee"; public static final String CHARGE_CLIENT_FIXED_FEE = "Fixed fee for Client"; public static final String CHARGE_DISBURSEMENT_CHARGE = "Disbursement Charge"; public static final String CHARGE_LOAN_TRANCHE_DISBURSEMENT_CHARGE_AMOUNT = "Tranche Disbursement Charge Amount"; public static final String CHARGE_LOAN_TRANCHE_DISBURSEMENT_CHARGE_PERCENT = "Tranche Disbursement Charge Percent"; public static final Double CHARGE_AMOUNT_FLAT = 25D; + public static final Double CHARGE_INSTALLMENT_FEE_AMOUNT_FLAT = 10D; + public static final Double CHARGE_INSTALLMENT_FEE_AMOUNT_PERCENTAGE = 1D; public static final Double CHARGE_AMOUNT_PERCENTAGE = 5D; public static final Double CHARGE_AMOUNT_DISBURSEMENT_PERCENTAGE = 1.5D; public static final Double CHARGE_AMOUNT_INSTALLMENT_PERCENTAGE = 1.5D; @@ -69,6 +74,7 @@ public class ChargeGlobalInitializerStep implements FineractGlobalInitializerSte public static final Integer CHARGE_TIME_TYPE_INSTALLMENT = ChargeTimeType.INSTALLMENT_FEE.value; public static final Integer CHARGE_CALCULATION_TYPE_FLAT = ChargeCalculationType.FLAT.value; public static final Integer CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT = ChargeCalculationType.PERCENTAGE_AMOUNT.value; + public static final Integer CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST = ChargeCalculationType.PERCENTAGE_INTEREST.value; public static final Integer CHARGE_CALCULATION_TYPE_PERCENTAGE_DISBURSEMENT_AMOUNT = ChargeCalculationType.PERCENTAGE_DISBURSEMENT_AMOUNT.value; public static final Integer CHARGE_CALCULATION_TYPE_PERCENTAGE_LOAN_AMOUNT_PLUS_INTEREST = ChargeCalculationType.PERCENTAGE_LOAN_AMOUNT_PLUS_INTEREST.value; @@ -130,12 +136,14 @@ public class ChargeGlobalInitializerStep implements FineractGlobalInitializerSte TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_TRANCHE_DISBURSEMENT_PERCENT_CREATE_RESPONSE, responseLoanTrancheDisbursePercent); - // Loan - Installment % fee - ChargeRequest requestLoanInstallmentPercent = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_INSTALLMENT_PERCENT_FEE, - CHARGE_TIME_TYPE_INSTALLMENT, CHARGE_CALCULATION_TYPE_PERCENTAGE_LOAN_AMOUNT_PLUS_INTEREST, - CHARGE_AMOUNT_INSTALLMENT_PERCENTAGE, true, false); - Response responseLoanInstallmentPercent = chargesApi.createCharge(requestLoanInstallmentPercent).execute(); - TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_INSTALLMENT_FEE_CREATE_RESPONSE, responseLoanInstallmentPercent); + // Loan - Installment % fee Amount + Interest + final ChargeRequest requestLoanInstallmentPercentAmountPlusInterest = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, + CHARGE_LOAN_INSTALLMENT_FEE_PERCENT_AMOUNT_PLUS_INTEREST, CHARGE_TIME_TYPE_INSTALLMENT, + CHARGE_CALCULATION_TYPE_PERCENTAGE_LOAN_AMOUNT_PLUS_INTEREST, CHARGE_INSTALLMENT_FEE_AMOUNT_PERCENTAGE, true, false); + final Response responseLoanInstallmentPercentAmountPlusInterest = chargesApi + .createCharge(requestLoanInstallmentPercentAmountPlusInterest).execute(); + TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST_CREATE_RESPONSE, + responseLoanInstallmentPercentAmountPlusInterest); // Loan - % late (overdue) fee amount+interest ChargeRequest requestLoanPercentAmountPlusInterestLate = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, @@ -175,6 +183,30 @@ public class ChargeGlobalInitializerStep implements FineractGlobalInitializerSte .createCharge(requestTrancheDisbursementChargePercent).execute(); TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_TRANCHE_DISBURSEMENT_CHARGE_PERCENT_CREATE_RESPONSE, responseTrancheDisbursementChargePercent); + + // Loan - Installment flat fee + final ChargeRequest requestLoanInstallmentFlat = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, CHARGE_LOAN_INSTALLMENT_FEE_FLAT, + CHARGE_TIME_TYPE_INSTALLMENT, CHARGE_CALCULATION_TYPE_FLAT, CHARGE_INSTALLMENT_FEE_AMOUNT_FLAT, true, false); + final Response responseLoanInstallmentFlat = chargesApi.createCharge(requestLoanInstallmentFlat).execute(); + TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_INSTALLMENT_FEE_FLAT_CREATE_RESPONSE, responseLoanInstallmentFlat); + + // Loan - Installment % fee Amount + final ChargeRequest requestLoanInstallmentPercentAmount = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, + CHARGE_LOAN_INSTALLMENT_FEE_PERCENT_AMOUNT, CHARGE_TIME_TYPE_INSTALLMENT, CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, + CHARGE_INSTALLMENT_FEE_AMOUNT_PERCENTAGE, true, false); + final Response responseLoanInstallmentPercentAmount = chargesApi + .createCharge(requestLoanInstallmentPercentAmount).execute(); + TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_CREATE_RESPONSE, + responseLoanInstallmentPercentAmount); + + // Loan - Installment % fee Interest + final ChargeRequest requestLoanInstallmentPercentInterest = defaultChargesRequest(CHARGE_APPLIES_TO_LOAN, + CHARGE_LOAN_INSTALLMENT_FEE_PERCENT_INTEREST, CHARGE_TIME_TYPE_INSTALLMENT, CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST, + CHARGE_AMOUNT_PERCENTAGE, true, false); + final Response responseLoanInstallmentPercentInterest = chargesApi + .createCharge(requestLoanInstallmentPercentInterest).execute(); + TestContext.INSTANCE.set(TestContextKey.CHARGE_FOR_LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST_CREATE_RESPONSE, + responseLoanInstallmentPercentInterest); } public static ChargeRequest defaultChargesRequest(Enum appliesTo, String name, Integer chargeTimeType, 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 16ad9c75d..2683d4747 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 @@ -2982,6 +2982,171 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ TestContext.INSTANCE.set( TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_360_30_INTEREST_RECALC_AUTO_DOWNPAYMENT_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY, responseLoanProductsRequestAdvInterestRecalculationAutoDownpaymentZeroInterestChargeOffBehaviourAccrualActivity); + + // LP2 with progressive loan schedule + horizontal + interest recalculation + // charges - Installment Fee Flat + // (LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALC_DAILY_INSTALLMENT_FEE_FLAT_CHARGES) + final String name116 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALC_DAILY_INSTALLMENT_FEE_FLAT_CHARGES.getName(); + final List chargesInstallmentFeeFlat = new ArrayList<>(); + chargesInstallmentFeeFlat.add(new LoanProductChargeData().id(ChargeProductType.LOAN_INSTALLMENT_FEE_FLAT.value)); + final PostLoanProductsRequest loanProductsRequestLP2AdvPaymentInterestRecalcDailyInstallmentFeeFlatCharges = loanProductsRequestFactory + .defaultLoanProductsRequestLP2InterestDailyRecalculation()// + .name(name116)// + .charges(chargesInstallmentFeeFlat)// + .paymentAllocation(List.of(// + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), // + createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), // + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), // + createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")));// + final Response responseLoanProductsRequestLP2AdvPaymentInterestRecalcDailyInstallmentFeeFlatCharges = loanProductsApi + .createLoanProduct(loanProductsRequestLP2AdvPaymentInterestRecalcDailyInstallmentFeeFlatCharges).execute(); + TestContext.INSTANCE.set( + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALC_DAILY_INSTALLMENT_FEE_FLAT_CHARGES, + responseLoanProductsRequestLP2AdvPaymentInterestRecalcDailyInstallmentFeeFlatCharges); + + // LP2 with progressive loan schedule + horizontal + // charges - Installment Fee Percentage Amount + // (LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_AMOUNT_CHARGES) + final String name117 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_AMOUNT_CHARGES.getName(); + final List chargesInstallmentFeePercentAmount = new ArrayList<>(); + chargesInstallmentFeePercentAmount + .add(new LoanProductChargeData().id(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT.value)); + final PostLoanProductsRequest loanProductsRequestLP2AdvPaymentInstallmentFeePercentAmountCharges = loanProductsRequestFactory + .defaultLoanProductsRequestLP2()// + .name(name117)// + .charges(chargesInstallmentFeePercentAmount)// + .enableDownPayment(false)// + .enableAutoRepaymentForDownPayment(null)// + .disbursedAmountPercentageForDownPayment(null)// + .transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION.getValue())// + .loanScheduleType("PROGRESSIVE") // + .loanScheduleProcessingType("HORIZONTAL")// + .interestRateFrequencyType(3)// + .maxInterestRatePerPeriod(10.0)// + .paymentAllocation(List.of(// + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), // + createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), // + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), // + createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")));// + final Response responseLoanProductsRequestLP2AdvPaymentInstallmentFeePercentAmountCharges = loanProductsApi + .createLoanProduct(loanProductsRequestLP2AdvPaymentInstallmentFeePercentAmountCharges).execute(); + TestContext.INSTANCE.set( + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_AMOUNT_CHARGES, + responseLoanProductsRequestLP2AdvPaymentInstallmentFeePercentAmountCharges); + + // LP2 with progressive loan schedule + horizontal + // charges - Installment Fee Percentage Interest + // (LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_INTEREST_CHARGES) + final String name118 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_INTEREST_CHARGES.getName(); + final List chargesInstallmentFeePercentInterest = new ArrayList<>(); + chargesInstallmentFeePercentInterest + .add(new LoanProductChargeData().id(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST.value)); + final PostLoanProductsRequest loanProductsRequestLP2AdvPaymentInstallmentFeePercentInterestCharges = loanProductsRequestFactory + .defaultLoanProductsRequestLP2()// + .name(name118)// + .charges(chargesInstallmentFeePercentInterest)// + .enableDownPayment(false)// + .enableAutoRepaymentForDownPayment(null)// + .disbursedAmountPercentageForDownPayment(null)// + .transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION.getValue())// + .loanScheduleType("PROGRESSIVE") // + .loanScheduleProcessingType("HORIZONTAL")// + .interestRateFrequencyType(3)// + .maxInterestRatePerPeriod(10.0)// + .paymentAllocation(List.of(// + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), // + createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), // + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), // + createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")));// + final Response responseLoanProductsRequestLP2AdvPaymentInstallmentFeePercentInterestCharges = loanProductsApi + .createLoanProduct(loanProductsRequestLP2AdvPaymentInstallmentFeePercentInterestCharges).execute(); + TestContext.INSTANCE.set( + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_INTEREST_CHARGES, + responseLoanProductsRequestLP2AdvPaymentInstallmentFeePercentInterestCharges); + + // LP2 with progressive loan schedule + horizontal + // charges - Installment Fee Percentage Amount + Interest + // (LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_AMOUNT_INTEREST_CHARGES) + final String name119 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_AMOUNT_INTEREST_CHARGES.getName(); + final List chargesInstallmentFeePercentAmountPlusInterest = new ArrayList<>(); + chargesInstallmentFeePercentAmountPlusInterest + .add(new LoanProductChargeData().id(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST.value)); + final PostLoanProductsRequest loanProductsRequestLP2AdvPaymentInstallmentFeePercentAmountPlusInterestCharges = loanProductsRequestFactory + .defaultLoanProductsRequestLP2()// + .name(name119)// + .charges(chargesInstallmentFeePercentAmountPlusInterest)// + .enableDownPayment(false)// + .enableAutoRepaymentForDownPayment(null)// + .disbursedAmountPercentageForDownPayment(null)// + .transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION.getValue())// + .loanScheduleType("PROGRESSIVE") // + .loanScheduleProcessingType("HORIZONTAL")// + .interestRateFrequencyType(3)// + .maxInterestRatePerPeriod(10.0)// + .paymentAllocation(List.of(// + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), // + createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), // + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), // + createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")));// + final Response responseLoanProductsRequestLP2AdvPaymentInstallmentFeePercentAmountPlusInterestCharges = loanProductsApi + .createLoanProduct(loanProductsRequestLP2AdvPaymentInstallmentFeePercentAmountPlusInterestCharges).execute(); + TestContext.INSTANCE.set( + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_AMOUNT_INTEREST_CHARGES, + responseLoanProductsRequestLP2AdvPaymentInstallmentFeePercentAmountPlusInterestCharges); + + // LP2 with progressive loan schedule + horizontal + // charges - Installment Fee All + // (LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_ALL_CHARGES) + final String name120 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_ALL_CHARGES.getName(); + final List chargesInstallmentFeeAll = new ArrayList<>(); + chargesInstallmentFeeAll.add(new LoanProductChargeData().id(ChargeProductType.LOAN_INSTALLMENT_FEE_FLAT.value)); + chargesInstallmentFeeAll.add(new LoanProductChargeData().id(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT.value)); + chargesInstallmentFeeAll.add(new LoanProductChargeData().id(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST.value)); + chargesInstallmentFeeAll + .add(new LoanProductChargeData().id(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST.value)); + final PostLoanProductsRequest loanProductsRequestLP2AdvPaymentInstallmentFeeAllCharges = loanProductsRequestFactory + .defaultLoanProductsRequestLP2()// + .name(name120)// + .charges(chargesInstallmentFeeAll)// + .enableDownPayment(false)// + .enableAutoRepaymentForDownPayment(null)// + .disbursedAmountPercentageForDownPayment(null)// + .transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION.getValue())// + .loanScheduleType("PROGRESSIVE") // + .loanScheduleProcessingType("HORIZONTAL")// + .interestRateFrequencyType(3)// + .maxInterestRatePerPeriod(10.0)// + .paymentAllocation(List.of(// + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), // + createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), // + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), // + createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")));// + final Response responseLoanProductsRequestLP2AdvPaymentInstallmentFeeAllCharges = loanProductsApi + .createLoanProduct(loanProductsRequestLP2AdvPaymentInstallmentFeeAllCharges).execute(); + TestContext.INSTANCE.set( + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_ALL_CHARGES, + responseLoanProductsRequestLP2AdvPaymentInstallmentFeeAllCharges); + + // LP2 with progressive loan schedule + horizontal + multidisbursal + // charges - Installment Fee Flat + Interest % + // (LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_FLAT_INTEREST_CHARGES_TRANCHE) + final String name121 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_FLAT_INTEREST_CHARGES_TRANCHE.getName(); + final List chargesInstallmentFeeFlatPlusInterest = new ArrayList<>(); + chargesInstallmentFeeFlatPlusInterest.add(new LoanProductChargeData().id(ChargeProductType.LOAN_INSTALLMENT_FEE_FLAT.value)); + chargesInstallmentFeeFlatPlusInterest + .add(new LoanProductChargeData().id(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST.value)); + final PostLoanProductsRequest loanProductsRequestLP2AdvPaymentInstallmentFeeFlatPlusInterestChargesMultiDisburse = loanProductsRequestLP2AdvPaymentInstallmentFeePercentInterestCharges// + .name(name121)// + .charges(chargesInstallmentFeeFlatPlusInterest)// + .shortName(Utils.randomNameGenerator(SHORT_NAME_PREFIX_EMI, 3))// + .disallowExpectedDisbursements(true)// + .maxTrancheCount(10)// + .outstandingLoanBalance(10000.0);// + final Response responseLoanProductsRequestLP2AdvPaymentInstallmentFeeFlatPlusInterestChargesMultiDisburse = loanProductsApi + .createLoanProduct(loanProductsRequestLP2AdvPaymentInstallmentFeeFlatPlusInterestChargesMultiDisburse).execute(); + TestContext.INSTANCE.set( + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_FLAT_INTEREST_CHARGES_TRANCHE, + responseLoanProductsRequestLP2AdvPaymentInstallmentFeeFlatPlusInterestChargesMultiDisburse); } public static AdvancedPaymentData createPaymentAllocation(String transactionType, String futureInstallmentAllocationRule, diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeStepDef.java index 35c254762..5442cc449 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeStepDef.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeStepDef.java @@ -90,7 +90,7 @@ public class LoanChargeStepDef extends AbstractStepDef { Long chargeTypeId = chargeProductType.getValue(); if (chargeTypeId.equals(ChargeProductType.LOAN_DISBURSEMENT_PERCENTAGE_FEE.getValue()) || chargeTypeId.equals(ChargeProductType.LOAN_TRANCHE_DISBURSEMENT_PERCENTAGE_FEE.getValue()) - || chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_PERCENTAGE_FEE.getValue())) { + || chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST.getValue())) { throw new IllegalStateException(String.format("The requested %s charge is NOT due date type, cannot be used here", chargeType)); } @@ -115,7 +115,8 @@ public class LoanChargeStepDef extends AbstractStepDef { Long chargeTypeId = chargeProductType.getValue(); if (!chargeTypeId.equals(ChargeProductType.LOAN_DISBURSEMENT_PERCENTAGE_FEE.getValue()) && !chargeTypeId.equals(ChargeProductType.LOAN_TRANCHE_DISBURSEMENT_PERCENTAGE_FEE.getValue()) - && !chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_PERCENTAGE_FEE.getValue())) { + && !chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT.getValue()) + && !chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST.getValue())) { throw new IllegalStateException(String.format("The requested %s charge is due date type, cannot be used here", chargeType)); } @@ -128,6 +129,54 @@ public class LoanChargeStepDef extends AbstractStepDef { testContext().set(TestContextKey.ADD_DUE_DATE_CHARGE_RESPONSE, loanChargeResponse); } + @When("Admin adds {string} installment charge with {double} amount") + public void addInstallmentFeeCharge(final String chargeType, final double amount) throws IOException { + final Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + assert loanResponse.body() != null; + final long loanId = loanResponse.body().getLoanId(); + + final ChargeProductType chargeProductType = ChargeProductType.valueOf(chargeType); + final Long chargeTypeId = chargeProductType.getValue(); + if (!chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_FEE_FLAT.getValue()) + && !chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT.getValue()) + && !chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST.getValue()) + && !chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST.getValue())) { + throw new IllegalStateException( + String.format("The requested %s charge is not installment fee type, cannot be used here", chargeType)); + } + + final PostLoansLoanIdChargesRequest loanIdChargesRequest = LoanChargeRequestFactory.defaultLoanChargeRequest() + .chargeId(chargeTypeId).amount(amount); + + final Response loanChargeResponse = loanChargesApi + .executeLoanCharge(loanId, loanIdChargesRequest, "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanChargeResponse); + testContext().set(TestContextKey.ADD_INSTALLMENT_FEE_CHARGE_RESPONSE, loanChargeResponse); + } + + @Then("Admin fails to add {string} installment charge with {double} amount because of wrong charge calculation type") + public void addInstallmentFeeChargeFails(final String chargeType, final double amount) throws IOException { + final Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + assert loanResponse.body() != null; + + final long loanId = loanResponse.body().getLoanId(); + final ChargeProductType chargeProductType = ChargeProductType.valueOf(chargeType); + final Long chargeTypeId = chargeProductType.getValue(); + + final PostLoansLoanIdChargesRequest loanIdChargesRequest = LoanChargeRequestFactory.defaultLoanChargeRequest() + .chargeId(chargeTypeId).amount(amount); + + final Response loanChargeResponse = loanChargesApi + .executeLoanCharge(loanId, loanIdChargesRequest, "").execute(); + testContext().set(TestContextKey.ADD_INSTALLMENT_FEE_CHARGE_RESPONSE, loanChargeResponse); + final ErrorResponse errorDetails = ErrorResponse.from(loanChargeResponse); + assertThat(errorDetails.getHttpStatusCode()).isEqualTo(400); + assertThat(errorDetails.getSingleError().getDeveloperMessage()) + .isEqualTo(chargeProductType.equals(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST) + ? ErrorMessageHelper.addInstallmentFeeInterestPercentageChargeFailure() + : ErrorMessageHelper.addInstallmentFeePrincipalPercentageChargeFailure()); + } + @Then("Admin is not able to add {string} due date charge with {string} due date and {double} EUR transaction amount because the of charged-off account") public void addChargeDueDateOnChargedOff(String chargeType, String transactionDate, double transactionAmount) throws IOException { Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); @@ -284,7 +333,7 @@ public class LoanChargeStepDef extends AbstractStepDef { Long chargeTypeId = chargeProductType.getValue(); if (chargeTypeId.equals(ChargeProductType.LOAN_DISBURSEMENT_PERCENTAGE_FEE.getValue()) || chargeTypeId.equals(ChargeProductType.LOAN_TRANCHE_DISBURSEMENT_PERCENTAGE_FEE.getValue()) - || chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_PERCENTAGE_FEE.getValue())) { + || chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST.getValue())) { throw new IllegalStateException(String.format("The requested %s charge is NOT due date type, cannot be used here", chargeType)); } 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 f486acea1..24fb9f425 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 @@ -82,6 +82,7 @@ import org.apache.fineract.client.models.GetLoansLoanIdTransactions; import org.apache.fineract.client.models.GetLoansLoanIdTransactionsResponse; import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse; import org.apache.fineract.client.models.IsCatchUpRunningDTO; +import org.apache.fineract.client.models.LoanProductChargeData; import org.apache.fineract.client.models.OldestCOBProcessedLoanDTO; import org.apache.fineract.client.models.PaymentAllocationOrder; import org.apache.fineract.client.models.PostAddAndDeleteDisbursementDetailRequest; @@ -258,6 +259,20 @@ public class LoanStepDef extends AbstractStepDef { eventCheckHelper.createLoanEventCheck(response); } + @When("Admin creates a new default Progressive Loan with date: {string}") + public void createProgressiveLoanWithDate(final String date) throws IOException { + final Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + final Long clientId = clientResponse.body().getClientId(); + final PostLoansRequest loansRequest = loanRequestFactory.defaultProgressiveLoansRequest(clientId).submittedOnDate(date) + .expectedDisbursementDate(date); + + final Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.createLoanEventCheck(response); + } + @When("Admin crates a second default loan with date: {string}") public void createSecondLoanWithDate(String date) throws IOException { Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); @@ -483,6 +498,12 @@ public class LoanStepDef extends AbstractStepDef { createCustomizedLoan(data.get(1), false); } + @When("Admin creates a fully customized loan with loan product`s charges and following data:") + public void createFullyCustomizedLoanWithProductCharges(final DataTable table) throws IOException { + final List> data = table.asLists(); + createCustomizedLoanWithProductCharges(data.get(1)); + } + @When("Admin creates a fully customized loan with emi and the following data:") public void createFullyCustomizedLoanWithEmi(final DataTable table) throws IOException { final List> data = table.asLists(); @@ -3279,6 +3300,77 @@ public class LoanStepDef extends AbstractStepDef { eventCheckHelper.createLoanEventCheck(response); } + private void createCustomizedLoanWithProductCharges(final List loanData) throws IOException { + final String loanProduct = loanData.get(0); + final String submitDate = loanData.get(1); + final String principal = loanData.get(2); + final BigDecimal interestRate = new BigDecimal(loanData.get(3)); + final String interestTypeStr = loanData.get(4); + final String interestCalculationPeriodStr = loanData.get(5); + final String amortizationTypeStr = loanData.get(6); + final Integer loanTermFrequency = Integer.valueOf(loanData.get(7)); + final String loanTermFrequencyType = loanData.get(8); + final Integer repaymentFrequency = Integer.valueOf(loanData.get(9)); + final String repaymentFrequencyTypeStr = loanData.get(10); + final Integer numberOfRepayments = Integer.valueOf(loanData.get(11)); + final Integer graceOnPrincipalPayment = Integer.valueOf(loanData.get(12)); + final Integer graceOnInterestPayment = Integer.valueOf(loanData.get(13)); + final Integer graceOnInterestCharged = Integer.valueOf(loanData.get(14)); + final String transactionProcessingStrategyCode = loanData.get(15); + + final Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + final Long clientId = clientResponse.body().getClientId(); + + final DefaultLoanProduct product = DefaultLoanProduct.valueOf(loanProduct); + final Long loanProductId = loanProductResolver.resolve(product); + final Response loanProductDetails = loanProductsApi.retrieveLoanProductDetails(loanProductId) + .execute(); + + final List loanCharges = new ArrayList<>(); + + assert loanProductDetails.body() != null; + if (loanProductDetails.body().getCharges() != null) { + for (final LoanProductChargeData chargeData : loanProductDetails.body().getCharges()) { + loanCharges.add(new PostLoansRequestChargeData().chargeId(chargeData.getId()).amount(chargeData.getAmount())); + } + } + + final LoanTermFrequencyType termFrequencyType = LoanTermFrequencyType.valueOf(loanTermFrequencyType); + final Integer loanTermFrequencyTypeValue = termFrequencyType.getValue(); + + final RepaymentFrequencyType repaymentFrequencyType = RepaymentFrequencyType.valueOf(repaymentFrequencyTypeStr); + final Integer repaymentFrequencyTypeValue = repaymentFrequencyType.getValue(); + + final InterestType interestType = InterestType.valueOf(interestTypeStr); + final Integer interestTypeValue = interestType.getValue(); + + final InterestCalculationPeriodTime interestCalculationPeriod = InterestCalculationPeriodTime.valueOf(interestCalculationPeriodStr); + final Integer interestCalculationPeriodValue = interestCalculationPeriod.getValue(); + + final AmortizationType amortizationType = AmortizationType.valueOf(amortizationTypeStr); + final Integer amortizationTypeValue = amortizationType.getValue(); + + final TransactionProcessingStrategyCode processingStrategyCode = TransactionProcessingStrategyCode + .valueOf(transactionProcessingStrategyCode); + final String transactionProcessingStrategyCodeValue = processingStrategyCode.getValue(); + + final PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId).productId(loanProductId) + .principal(new BigDecimal(principal)).interestRatePerPeriod(interestRate).interestType(interestTypeValue) + .interestCalculationPeriodType(interestCalculationPeriodValue).amortizationType(amortizationTypeValue) + .loanTermFrequency(loanTermFrequency).loanTermFrequencyType(loanTermFrequencyTypeValue) + .numberOfRepayments(numberOfRepayments).repaymentEvery(repaymentFrequency) + .repaymentFrequencyType(repaymentFrequencyTypeValue).submittedOnDate(submitDate).expectedDisbursementDate(submitDate) + .graceOnPrincipalPayment(graceOnPrincipalPayment).graceOnInterestPayment(graceOnInterestPayment) + .graceOnInterestPayment(graceOnInterestCharged).transactionProcessingStrategyCode(transactionProcessingStrategyCodeValue) + .charges(loanCharges); + + final Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.createLoanEventCheck(response); + } + public void createFullyCustomizedLoanWithInterestRateFrequency(final List loanData) throws IOException { final String loanProduct = loanData.get(0); final String submitDate = loanData.get(1); 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 8fe41178c..16e34ca45 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 @@ -30,6 +30,7 @@ public abstract class TestContextKey { public static final String LOAN_CREATE_SECOND_LOAN_RESPONSE = "loanCreateSecondLoanResponse"; public static final String LOAN_MODIFY_RESPONSE = "loanModifyResponse"; public static final String ADD_DUE_DATE_CHARGE_RESPONSE = "addDueDateChargeResponse"; + public static final String ADD_INSTALLMENT_FEE_CHARGE_RESPONSE = "addInstallmentFeeChargeResponse"; public static final String ADD_PROCESSING_FEE_RESPONSE = "addProcessingFeeResponse"; public static final String ADD_NSF_FEE_RESPONSE = "addNsfFeeResponse"; public static final String WAIVE_CHARGE_RESPONSE = "waiveChargeResponse"; @@ -178,7 +179,10 @@ public abstract class TestContextKey { public static final String CHARGE_FOR_LOAN_DISBURSEMENET_FEE_CREATE_RESPONSE = "ChargeForLoanDisbursementCreateResponse"; public static final String CHARGE_FOR_LOAN_TRANCHE_DISBURSEMENT_PERCENT_CREATE_RESPONSE = "ChargeForLoanTrancheDisbursementPercentCreateResponse"; public static final String CHARGE_FOR_LOAN_TRANCHE_DISBURSEMENT_CHARGE_PERCENT_CREATE_RESPONSE = "ChargeForLoanTrancheDisbursementChargePercentCreateResponse"; - public static final String CHARGE_FOR_LOAN_INSTALLMENT_FEE_CREATE_RESPONSE = "ChargeForLoanInstallmentCreateResponse"; + public static final String CHARGE_FOR_LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST_CREATE_RESPONSE = "ChargeForLoanInstallmentFeePercentageAmountPlusInterestCreateResponse"; + public static final String CHARGE_FOR_LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_CREATE_RESPONSE = "ChargeForLoanInstallmentFeePercentageAmountCreateResponse"; + public static final String CHARGE_FOR_LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST_CREATE_RESPONSE = "ChargeForLoanInstallmentFeePercentageInterestCreateResponse"; + public static final String CHARGE_FOR_LOAN_INSTALLMENT_FEE_FLAT_CREATE_RESPONSE = "ChargeForLoanInstallmentFeeFlatCreateResponse"; public static final String CHARGE_FOR_CLIENT_FIXED_FEE_CREATE_RESPONSE = "ChargeForClientFixedFeeCreateResponse"; public static final String CHARGE_FOR_LOAN_DISBURSEMENT_CHARGE_CREATE_RESPONSE = "ChargeForLoanDisbursementChargeCreateResponse"; public static final String LOAN_RESPONSE = "loanResponse"; @@ -235,4 +239,10 @@ public abstract class TestContextKey { public static final String LOAN_BUY_DOWN_FEE_ADJUSTMENT_RESPONSE = "loanBuyDownFeeAdjustmentResponse"; public static final String MANUAL_JOURNAL_ENTRIES_REQUEST = "manualJournalEntriesRequest"; public static final String MANUAL_JOURNAL_ENTRIES_RESPONSE = "manualJournalEntriesResponse"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALC_DAILY_INSTALLMENT_FEE_FLAT_CHARGES = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalculationInstallmentFeeFlatCharges"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_AMOUNT_CHARGES = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInstallmentFeePercentageAmountCharges"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_INTEREST_CHARGES = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInstallmentFeePercentageInterestCharges"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_PERCENT_AMOUNT_INTEREST_CHARGES = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInstallmentFeeAmountPlusPercentageInterestCharges"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_ALL_CHARGES = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInstallmentFeeAllCharges"; + public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INSTALLMENT_FEE_FLAT_INTEREST_CHARGES_TRANCHE = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInstallmentFeeFlatPlusPercentageInterestChargesMultidisbursal"; } diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanCharge.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanCharge.feature index 911a0a9d6..fd95b45ff 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanCharge.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanCharge.feature @@ -1145,13 +1145,13 @@ Feature: LoanCharge | LP1_INTEREST_FLAT | 1 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "10 January 2023" When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount - When Admin adds "LOAN_INSTALLMENT_PERCENTAGE_FEE" charge with 1.5 % of transaction amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST" charge with 1.5 % of transaction amount Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | Then Loan Charges tab has the following data: - | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | - | Installment percentage fee | false | Installment Fee | | % Loan Amount + Interest | 46.35 | 0.0 | 0.0 | 46.35 | + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 46.35 | 0.0 | 0.0 | 46.35 | Then Loan Repayment schedule has 3 periods, with the following data for periods: | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | | | 01 January 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | @@ -1234,7 +1234,7 @@ Feature: LoanCharge And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount Then Loan status will be "ACTIVE" - When Admin adds "LOAN_INSTALLMENT_PERCENTAGE_FEE" charge with 10 % of transaction amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST" charge with 10 % of transaction amount When Admin sets the business date to "15 January 2023" And Customer makes "AUTOPAY" repayment on "15 January 2023" with 5 EUR transaction amount When Admin sets the business date to "20 January 2023" @@ -1254,8 +1254,8 @@ Feature: LoanCharge | 18 January 2023 | Repayment | 15.0 | 15.0 | 0.0 | 0.0 | 0.0 | 985.0 | | 20 January 2023 | Waive loan charges | 95.0 | 0.0 | 0.0 | 0.0 | 0.0 | 985.0 | Then Loan Charges tab has the following data: - | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | - | Installment percentage fee | false | Installment Fee | | % Loan Amount + Interest | 100.0 | 5.0 | 95.0 | 0.0 | + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 100.0 | 5.0 | 95.0 | 0.0 | @TestRailId:C2909 Scenario: Verify that adding charge on a closed loan after maturity date is creating an N+1 installment - LP1 product @@ -5498,7 +5498,7 @@ Feature: LoanCharge | 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 | 10.0 | 0.0 | 112.05 | 44.02 | 0.0 | 0.0 | 68.03 | + | 100.0 | 2.05 | 10.0 | 0.0 | 112.05 | 44.02 | 0.0 | 0.0 | 68.03 | 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 | @@ -5517,3 +5517,1799 @@ Feature: LoanCharge | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | | 5.0 | | LIABILITY | 145023 | Suspense/Clearing account | 5.0 | | + + @TestRailId:C3784 + Scenario: Progressive loan - Verify the loan creation with installment fee charge: flat charge type, interestRecalculation = true + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_INTEREST_RECALC_DAILY_INSTALLMENT_FEE_FLAT_CHARGES | 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 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 0.0 | 0.0 | 0.0 | 162.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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.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 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 10.0 | 0.0 | 27.01 | 27.01 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 27.01 | 0.0 | 0.0 | 135.04 | + 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 | + | 01 February 2024 | Repayment | 27.01 | 16.43 | 0.58 | 10.0 | 0.0 | 83.57 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 10.0 | 0.0 | 50.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.58 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.01 | | + When Customer makes a repayment undo on "01 February 2024" + 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 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 0.0 | 0.0 | 0.0 | 162.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 | + | 01 February 2024 | Repayment | 27.01 | 16.43 | 0.58 | 10.0 | 0.0 | 83.57 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.58 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.01 | | + | ASSET | 112601 | Loans Receivable | 16.43 | | + | ASSET | 112603 | Interest/Fee Receivable | 10.58 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 27.01 | + + @TestRailId:C3811 + Scenario: Progressive loan - Verify the loan creation with installment fee charge: flat charge type, interestRecalculation = true, early repayment + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_INTEREST_RECALC_DAILY_INSTALLMENT_FEE_FLAT_CHARGES | 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 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 0.0 | 0.0 | 0.0 | 162.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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + When Admin sets the business date to "15 January 2024" + And Customer makes "AUTOPAY" repayment on "15 January 2024" with 54.02 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 | 15 January 2024 | 83.25 | 16.75 | 0.26 | 10.0 | 0.0 | 27.01 | 27.01 | 27.01 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 15 January 2024 | 66.24 | 17.01 | 0.0 | 10.0 | 0.0 | 27.01 | 27.01 | 27.01 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2024 | | 50.23 | 16.01 | 1.0 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.51 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.7 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.7 | 0.1 | 10.0 | 0.0 | 26.8 | 0.0 | 0.0 | 0.0 | 26.8 | + 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.85 | 60.0 | 0.0 | 161.85 | 54.02 | 54.02 | 0.0 | 107.83 | + 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 | Repayment | 54.02 | 33.76 | 0.26 | 20.0 | 0.0 | 66.24 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "15 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 33.76 | + | ASSET | 112603 | Interest/Fee Receivable | | 20.26 | + | LIABILITY | 145023 | Suspense/Clearing account | 54.02 | | + When Customer makes a repayment undo on "15 January 2024" + 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 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 0.0 | 0.0 | 0.0 | 162.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 | + | 15 January 2024 | Repayment | 54.02 | 33.76 | 0.26 | 20.0 | 0.0 | 66.24 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "15 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 33.76 | + | ASSET | 112603 | Interest/Fee Receivable | | 20.26 | + | LIABILITY | 145023 | Suspense/Clearing account | 54.02 | | + | ASSET | 112601 | Loans Receivable | 33.76 | | + | ASSET | 112603 | Interest/Fee Receivable | 20.26 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 54.02 | + + @TestRailId:C3785 + Scenario: Progressive loan - Verify the loan creation with installment fee charge: percentage amount charge type, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_INSTALLMENT_FEE_PERCENT_AMOUNT_CHARGES | 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.59 | 16.41 | 0.59 | 0.16 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.17 | 0.0 | 17.21 | 0.0 | 0.0 | 0.0 | 17.21 | + 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.04 | 1.01 | 0.0 | 103.05 | 0.0 | 0.0 | 0.0 | 103.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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.0 | 0.0 | 1.01 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.16 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 0.16 | 0.0 | 17.16 | 17.16 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.17 | 0.0 | 17.21 | 0.0 | 0.0 | 0.0 | 17.21 | + 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.04 | 1.01 | 0.0 | 103.05 | 17.16 | 0.0 | 0.0 | 85.89 | + 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 | + | 01 February 2024 | Repayment | 17.16 | 16.41 | 0.59 | 0.16 | 0.0 | 83.59 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.16 | 0.0 | 0.85 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.75 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.16 | | + When Customer makes a repayment undo on "01 February 2024" + 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.59 | 16.41 | 0.59 | 0.16 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.17 | 0.0 | 17.21 | 0.0 | 0.0 | 0.0 | 17.21 | + 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.04 | 1.01 | 0.0 | 103.05 | 0.0 | 0.0 | 0.0 | 103.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 | + | 01 February 2024 | Repayment | 17.16 | 16.41 | 0.59 | 0.16 | 0.0 | 83.59 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.0 | 0.0 | 1.01 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.75 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.16 | | + | ASSET | 112601 | Loans Receivable | 16.41 | | + | ASSET | 112603 | Interest/Fee Receivable | 0.75 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 17.16 | + + @TestRailId:C3786 + Scenario: Progressive loan - Verify the loan creation with installment fee charge: percentage interest charge type, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_INSTALLMENT_FEE_PERCENT_INTEREST_CHARGES | 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.59 | 16.41 | 0.59 | 0.03 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | 17.03 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.0 | 0.0 | 17.04 | 0.0 | 0.0 | 0.0 | 17.04 | + 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.04 | 0.09 | 0.0 | 102.13 | 0.0 | 0.0 | 0.0 | 102.13 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.03 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 0.03 | 0.0 | 17.03 | 17.03 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.0 | 0.0 | 17.04 | 0.0 | 0.0 | 0.0 | 17.04 | + 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.04 | 0.09 | 0.0 | 102.13 | 17.03 | 0.0 | 0.0 | 85.1 | + 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 | + | 01 February 2024 | Repayment | 17.03 | 16.41 | 0.59 | 0.03 | 0.0 | 83.59 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.03 | 0.0 | 0.06 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.62 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.03 | | + When Customer makes a repayment undo on "01 February 2024" + 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.59 | 16.41 | 0.59 | 0.03 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | 17.03 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.0 | 0.0 | 17.04 | 0.0 | 0.0 | 0.0 | 17.04 | + 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.04 | 0.09 | 0.0 | 102.13 | 0.0 | 0.0 | 0.0 | 102.13 | + 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 | + | 01 February 2024 | Repayment | 17.03 | 16.41 | 0.59 | 0.03 | 0.0 | 83.59 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.62 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.03 | | + | ASSET | 112601 | Loans Receivable | 16.41 | | + | ASSET | 112603 | Interest/Fee Receivable | 0.62 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 17.03 | + + @TestRailId:C3812 + Scenario: Progressive loan - Verify the loan creation with installment fee charge: percentage interest charge type, interestRecalculation = false, early repayment + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_INSTALLMENT_FEE_PERCENT_INTEREST_CHARGES | 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.59 | 16.41 | 0.59 | 0.03 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | 17.03 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.0 | 0.0 | 17.04 | 0.0 | 0.0 | 0.0 | 17.04 | + 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.04 | 0.09 | 0.0 | 102.13 | 0.0 | 0.0 | 0.0 | 102.13 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + When Admin sets the business date to "15 January 2024" + And Customer makes "AUTOPAY" repayment on "15 January 2024" with 34.05 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 | 15 January 2024 | 83.59 | 16.41 | 0.59 | 0.03 | 0.0 | 17.03 | 17.03 | 17.03 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 15 January 2024 | 67.05 | 16.54 | 0.46 | 0.02 | 0.0 | 17.02 | 17.02 | 17.02 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.0 | 0.0 | 17.04 | 0.0 | 0.0 | 0.0 | 17.04 | + 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.04 | 0.09 | 0.0 | 102.13 | 34.05 | 34.05 | 0.0 | 68.08 | + 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 | Repayment | 34.05 | 32.95 | 1.05 | 0.05 | 0.0 | 67.05 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.05 | 0.0 | 0.04 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "15 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 32.95 | + | ASSET | 112603 | Interest/Fee Receivable | | 1.1 | + | LIABILITY | 145023 | Suspense/Clearing account | 34.05 | | + When Customer makes a repayment undo on "15 January 2024" + 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.59 | 16.41 | 0.59 | 0.03 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | 17.03 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.02 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.01 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.0 | 0.0 | 17.04 | 0.0 | 0.0 | 0.0 | 17.04 | + 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.04 | 0.09 | 0.0 | 102.13 | 0.0 | 0.0 | 0.0 | 102.13 | + 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 | Repayment | 34.05 | 32.95 | 1.05 | 0.05 | 0.0 | 67.05 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "15 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 32.95 | + | ASSET | 112603 | Interest/Fee Receivable | | 1.1 | + | LIABILITY | 145023 | Suspense/Clearing account | 34.05 | | + | ASSET | 112601 | Loans Receivable | 32.95 | | + | ASSET | 112603 | Interest/Fee Receivable | 1.1 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 34.05 | + + @TestRailId:C3787 + Scenario: Progressive loan - Verify the loan creation with installment fee charge: percentage amount + interest charge type, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_INSTALLMENT_FEE_PERCENT_AMOUNT_INTEREST_CHARGES | 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.59 | 16.41 | 0.59 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.17 | 0.0 | 17.21 | 0.0 | 0.0 | 0.0 | 17.21 | + 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.04 | 1.02 | 0.0 | 103.06 | 0.0 | 0.0 | 0.0 | 103.06 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.0 | 0.0 | 1.02 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.17 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 0.17 | 0.0 | 17.17 | 17.17 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.17 | 0.0 | 17.21 | 0.0 | 0.0 | 0.0 | 17.21 | + 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.04 | 1.02 | 0.0 | 103.06 | 17.17 | 0.0 | 0.0 | 85.89 | + 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 | + | 01 February 2024 | Repayment | 17.17 | 16.41 | 0.59 | 0.17 | 0.0 | 83.59 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.17 | 0.0 | 0.85 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.76 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.17 | | + When Customer makes a repayment undo on "01 February 2024" + 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.59 | 16.41 | 0.59 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 0.17 | 0.0 | 17.21 | 0.0 | 0.0 | 0.0 | 17.21 | + 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.04 | 1.02 | 0.0 | 103.06 | 0.0 | 0.0 | 0.0 | 103.06 | + 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 | + | 01 February 2024 | Repayment | 17.17 | 16.41 | 0.59 | 0.17 | 0.0 | 83.59 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.0 | 0.0 | 1.02 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.76 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.17 | | + | ASSET | 112601 | Loans Receivable | 16.41 | | + | ASSET | 112603 | Interest/Fee Receivable | 0.76 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 17.17 | + + @TestRailId:C3788 + Scenario: Progressive loan - Verify the loan creation with installment fee charge: all charge types, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_INSTALLMENT_FEE_ALL_CHARGES | 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.59 | 16.41 | 0.59 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.34 | 0.0 | 27.38 | 0.0 | 0.0 | 0.0 | 27.38 | + 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.04 | 62.12 | 0.0 | 164.16 | 0.0 | 0.0 | 0.0 | 164.16 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.0 | 0.0 | 1.01 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.0 | 0.0 | 1.02 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.36 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.36 | 0.0 | 27.36 | 27.36 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.34 | 0.0 | 27.38 | 0.0 | 0.0 | 0.0 | 27.38 | + 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.04 | 62.12 | 0.0 | 164.16 | 27.36 | 0.0 | 0.0 | 136.8 | + 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 | + | 01 February 2024 | Repayment | 27.36 | 16.41 | 0.59 | 10.36 | 0.0 | 83.59 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 10.0 | 0.0 | 50.0 | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.16 | 0.0 | 0.85 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.03 | 0.0 | 0.06 | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.17 | 0.0 | 0.85 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.95 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.36 | | + When Customer makes a repayment undo on "01 February 2024" + 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.59 | 16.41 | 0.59 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.34 | 0.0 | 27.38 | 0.0 | 0.0 | 0.0 | 27.38 | + 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.04 | 62.12 | 0.0 | 164.16 | 0.0 | 0.0 | 0.0 | 164.16 | + 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 | + | 01 February 2024 | Repayment | 27.36 | 16.41 | 0.59 | 10.36 | 0.0 | 83.59 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.0 | 0.0 | 1.01 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.0 | 0.0 | 1.02 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.95 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.36 | | + | ASSET | 112601 | Loans Receivable | 16.41 | | + | ASSET | 112603 | Interest/Fee Receivable | 10.95 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 27.36 | + + @TestRailId:C3789 + Scenario: Progressive loan - Verify the loan creation with installment fee charge: flat + % interest charge types, tranche loan, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_INSTALLMENT_FEE_FLAT_INTEREST_CHARGES_TRANCHE | 01 January 2024 | 1000 | 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 "1000" 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.59 | 16.41 | 0.59 | 10.03 | 0.0 | 27.03 | 0.0 | 0.0 | 0.0 | 27.03 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 10.02 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.02 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.01 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.01 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.0 | 0.0 | 27.04 | 0.0 | 0.0 | 0.0 | 27.04 | + 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.04 | 60.09 | 0.0 | 162.13 | 0.0 | 0.0 | 0.0 | 162.13 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.03 EUR transaction amount + When Admin sets the business date to "01 March 2024" + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 27.02 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.03 | 0.0 | 27.03 | 27.03 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.05 | 16.54 | 0.46 | 10.02 | 0.0 | 27.02 | 27.02 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.02 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.01 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.01 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.0 | 0.0 | 27.04 | 0.0 | 0.0 | 0.0 | 27.04 | + 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.04 | 60.09 | 0.0 | 162.13 | 54.05 | 0.0 | 0.0 | 108.08 | + 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 | + | 01 February 2024 | Repayment | 27.03 | 16.41 | 0.59 | 10.03 | 0.0 | 83.59 | false | false | + | 01 March 2024 | Repayment | 27.02 | 16.54 | 0.46 | 10.02 | 0.0 | 67.05 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.05 | 0.0 | 0.04 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.62 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.03 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.54 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.48 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.02 | | + When Admin sets the business date to "03 March 2024" + When Admin successfully disburse the loan on "03 March 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.03 | 0.0 | 27.03 | 27.03 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.05 | 16.54 | 0.46 | 10.02 | 0.0 | 27.02 | 27.02 | 0.0 | 0.0 | 0.0 | + | | | 03 March 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 31 | 01 April 2024 | | 126.0 | 41.05 | 0.95 | 10.05 | 0.0 | 52.05 | 0.0 | 0.0 | 0.0 | 52.05 | + | 4 | 30 | 01 May 2024 | | 84.72 | 41.28 | 0.72 | 10.04 | 0.0 | 52.04 | 0.0 | 0.0 | 0.0 | 52.04 | + | 5 | 31 | 01 June 2024 | | 43.22 | 41.5 | 0.5 | 10.02 | 0.0 | 52.02 | 0.0 | 0.0 | 0.0 | 52.02 | + | 6 | 30 | 01 July 2024 | | 0.0 | 43.22 | 0.25 | 10.01 | 0.0 | 53.48 | 0.0 | 0.0 | 0.0 | 53.48 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 200.0 | 3.47 | 60.17 | 0.0 | 263.64 | 54.05 | 0.0 | 0.0 | 209.59 | + 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 | + | 01 February 2024 | Repayment | 27.03 | 16.41 | 0.59 | 10.03 | 0.0 | 83.59 | false | false | + | 01 March 2024 | Repayment | 27.02 | 16.54 | 0.46 | 10.02 | 0.0 | 67.05 | false | false | + | 03 March 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 167.05 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.17 | 0.05 | 0.0 | 0.12 | + When Admin successfully undo last disbursal + 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.03 | 0.0 | 27.03 | 27.03 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.05 | 16.54 | 0.46 | 10.02 | 0.0 | 27.02 | 27.02 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.02 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.01 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.01 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.0 | 0.0 | 27.04 | 0.0 | 0.0 | 0.0 | 27.04 | + 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.04 | 60.09 | 0.0 | 162.13 | 54.05 | 0.0 | 0.0 | 108.08 | + 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 | + | 01 February 2024 | Repayment | 27.03 | 16.41 | 0.59 | 10.03 | 0.0 | 83.59 | false | false | + | 01 March 2024 | Repayment | 27.02 | 16.54 | 0.46 | 10.02 | 0.0 | 67.05 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.05 | 0.0 | 0.04 | + Then Admin can successfully undone the loan disbursal + + @TestRailId:C3813 + Scenario: Progressive loan - Verify the loan creation with installment fee charge: flat + % interest charge types, tranche loan, interestRecalculation = false, early repayment + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_INSTALLMENT_FEE_FLAT_INTEREST_CHARGES_TRANCHE | 01 January 2024 | 1000 | 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 "1000" 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.59 | 16.41 | 0.59 | 10.03 | 0.0 | 27.03 | 0.0 | 0.0 | 0.0 | 27.03 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 10.02 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.02 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.01 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.01 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.0 | 0.0 | 27.04 | 0.0 | 0.0 | 0.0 | 27.04 | + 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.04 | 60.09 | 0.0 | 162.13 | 0.0 | 0.0 | 0.0 | 162.13 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.03 EUR transaction amount + When Admin sets the business date to "01 March 2024" + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 27.02 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.03 | 0.0 | 27.03 | 27.03 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.05 | 16.54 | 0.46 | 10.02 | 0.0 | 27.02 | 27.02 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.02 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.01 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.01 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.0 | 0.0 | 27.04 | 0.0 | 0.0 | 0.0 | 27.04 | + 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.04 | 60.09 | 0.0 | 162.13 | 54.05 | 0.0 | 0.0 | 108.08 | + 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 | + | 01 February 2024 | Repayment | 27.03 | 16.41 | 0.59 | 10.03 | 0.0 | 83.59 | false | false | + | 01 March 2024 | Repayment | 27.02 | 16.54 | 0.46 | 10.02 | 0.0 | 67.05 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.05 | 0.0 | 0.04 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.62 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.03 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.54 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.48 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.02 | | + When Admin sets the business date to "03 March 2024" + When Admin successfully disburse the loan on "03 March 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.03 | 0.0 | 27.03 | 27.03 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.05 | 16.54 | 0.46 | 10.02 | 0.0 | 27.02 | 27.02 | 0.0 | 0.0 | 0.0 | + | | | 03 March 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 31 | 01 April 2024 | | 126.0 | 41.05 | 0.95 | 10.05 | 0.0 | 52.05 | 0.0 | 0.0 | 0.0 | 52.05 | + | 4 | 30 | 01 May 2024 | | 84.72 | 41.28 | 0.72 | 10.04 | 0.0 | 52.04 | 0.0 | 0.0 | 0.0 | 52.04 | + | 5 | 31 | 01 June 2024 | | 43.22 | 41.5 | 0.5 | 10.02 | 0.0 | 52.02 | 0.0 | 0.0 | 0.0 | 52.02 | + | 6 | 30 | 01 July 2024 | | 0.0 | 43.22 | 0.25 | 10.01 | 0.0 | 53.48 | 0.0 | 0.0 | 0.0 | 53.48 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 200.0 | 3.47 | 60.17 | 0.0 | 263.64 | 54.05 | 0.0 | 0.0 | 209.59 | + 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 | + | 01 February 2024 | Repayment | 27.03 | 16.41 | 0.59 | 10.03 | 0.0 | 83.59 | false | false | + | 01 March 2024 | Repayment | 27.02 | 16.54 | 0.46 | 10.02 | 0.0 | 67.05 | false | false | + | 03 March 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 167.05 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.17 | 0.05 | 0.0 | 0.12 | + And Customer makes "AUTOPAY" repayment on "03 March 2024" with 104.09 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.03 | 0.0 | 27.03 | 27.03 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.05 | 16.54 | 0.46 | 10.02 | 0.0 | 27.02 | 27.02 | 0.0 | 0.0 | 0.0 | + | | | 03 March 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 31 | 01 April 2024 | 03 March 2024 | 126.0 | 41.05 | 0.95 | 10.05 | 0.0 | 52.05 | 52.05 | 52.05 | 0.0 | 0.0 | + | 4 | 30 | 01 May 2024 | 03 March 2024 | 84.72 | 41.28 | 0.72 | 10.04 | 0.0 | 52.04 | 52.04 | 52.04 | 0.0 | 0.0 | + | 5 | 31 | 01 June 2024 | | 43.22 | 41.5 | 0.5 | 10.02 | 0.0 | 52.02 | 0.0 | 0.0 | 0.0 | 52.02 | + | 6 | 30 | 01 July 2024 | | 0.0 | 43.22 | 0.25 | 10.01 | 0.0 | 53.48 | 0.0 | 0.0 | 0.0 | 53.48 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 200.0 | 3.47 | 60.17 | 0.0 | 263.64 | 158.14 | 104.09 | 0.0 | 105.5 | + 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 | + | 01 February 2024 | Repayment | 27.03 | 16.41 | 0.59 | 10.03 | 0.0 | 83.59 | false | false | + | 01 March 2024 | Repayment | 27.02 | 16.54 | 0.46 | 10.02 | 0.0 | 67.05 | false | false | + | 03 March 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 167.05 | false | false | + | 03 March 2024 | Repayment | 104.09 | 82.33 | 1.67 | 20.09 | 0.0 | 84.72 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 40.0 | 0.0 | 20.0 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.17 | 0.14 | 0.0 | 0.03 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 82.33 | + | ASSET | 112603 | Interest/Fee Receivable | | 21.76 | + | LIABILITY | 145023 | Suspense/Clearing account | 104.09 | | + + @TestRailId:C3814 + Scenario: Progressive loan - Verify add installment fee charge: flat + % interest charge types, tranche loan, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_MULTIDISBURSE | 01 January 2024 | 1000 | 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 "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount + When Admin adds "LOAN_INSTALLMENT_FEE_FLAT" installment charge with 10 amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST" installment charge with 5 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 | 10.03 | 0.0 | 27.04 | 0.0 | 0.0 | 0.0 | 27.04 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.02 | 0.0 | 27.03 | 0.0 | 0.0 | 0.0 | 27.03 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.02 | 0.0 | 27.03 | 0.0 | 0.0 | 0.0 | 27.03 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.01 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.01 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.09 | 0.0 | 162.14 | 0.0 | 0.0 | 0.0 | 162.14 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.04 EUR transaction amount + When Admin sets the business date to "01 March 2024" + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 27.03 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 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 10.03 | 0.0 | 27.04 | 27.04 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.05 | 16.52 | 0.49 | 10.02 | 0.0 | 27.03 | 27.03 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.02 | 0.0 | 27.03 | 0.0 | 0.0 | 0.0 | 27.03 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.01 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.01 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.09 | 0.0 | 162.14 | 54.07 | 0.0 | 0.0 | 108.07 | + 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 | + | 01 February 2024 | Repayment | 27.04 | 16.43 | 0.58 | 10.03 | 0.0 | 83.57 | false | false | + | 01 March 2024 | Repayment | 27.03 | 16.52 | 0.49 | 10.02 | 0.0 | 67.05 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.05 | 0.0 | 0.04 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.61 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.04 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.52 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.51 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.03 | | + When Admin sets the business date to "03 March 2024" + When Admin successfully disburse the loan on "03 March 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 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 10.03 | 0.0 | 27.04 | 27.04 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.05 | 16.52 | 0.49 | 10.02 | 0.0 | 27.03 | 27.03 | 0.0 | 0.0 | 0.0 | + | | | 03 March 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 31 | 01 April 2024 | | 125.62 | 41.43 | 0.94 | 10.05 | 0.0 | 52.42 | 0.0 | 0.0 | 0.0 | 52.42 | + | 4 | 30 | 01 May 2024 | | 83.98 | 41.64 | 0.73 | 10.04 | 0.0 | 52.41 | 0.0 | 0.0 | 0.0 | 52.41 | + | 5 | 31 | 01 June 2024 | | 42.1 | 41.88 | 0.49 | 10.02 | 0.0 | 52.39 | 0.0 | 0.0 | 0.0 | 52.39 | + | 6 | 30 | 01 July 2024 | | 0.0 | 42.1 | 0.25 | 10.01 | 0.0 | 52.36 | 0.0 | 0.0 | 0.0 | 52.36 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 200.0 | 3.48 | 60.17 | 0.0 | 263.65 | 54.07 | 0.0 | 0.0 | 209.58 | + 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 | + | 01 February 2024 | Repayment | 27.04 | 16.43 | 0.58 | 10.03 | 0.0 | 83.57 | false | false | + | 01 March 2024 | Repayment | 27.03 | 16.52 | 0.49 | 10.02 | 0.0 | 67.05 | false | false | + | 03 March 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 167.05 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.17 | 0.05 | 0.0 | 0.12 | + When Admin successfully undo last disbursal + 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 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 10.03 | 0.0 | 27.04 | 27.04 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.05 | 16.52 | 0.49 | 10.02 | 0.0 | 27.03 | 27.03 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.02 | 0.0 | 27.03 | 0.0 | 0.0 | 0.0 | 27.03 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.01 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.01 | 0.0 | 27.02 | 0.0 | 0.0 | 0.0 | 27.02 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.09 | 0.0 | 162.14 | 54.07 | 0.0 | 0.0 | 108.07 | + 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 | + | 01 February 2024 | Repayment | 27.04 | 16.43 | 0.58 | 10.03 | 0.0 | 83.57 | false | false | + | 01 March 2024 | Repayment | 27.03 | 16.52 | 0.49 | 10.02 | 0.0 | 67.05 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.05 | 0.0 | 0.04 | + + @TestRailId:C3820 + Scenario: Progressive loan - Verify add installment fee charge: flat charge type, tranche loan, interestRecalculation = true, early repayment + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with loan product`s charges and 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_INTEREST_RECALCULATION_MULTIDISB | 01 January 2024 | 200 | 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 "200" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount + When Admin adds "LOAN_INSTALLMENT_FEE_FLAT" installment charge with 10 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.58 | 16.42 | 0.59 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 2 | 29 | 01 March 2024 | | 67.03 | 16.55 | 0.46 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.42 | 16.61 | 0.4 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.7 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.89 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.89 | 0.1 | 10.0 | 0.0 | 26.99 | 0.0 | 0.0 | 0.0 | 26.99 | + 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.04 | 60.0 | 0.0 | 162.04 | 0.0 | 0.0 | 0.0 | 162.04 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.01 EUR transaction amount + When Admin sets the business date to "01 March 2024" + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 27.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 | 01 February 2024 | 83.58 | 16.42 | 0.59 | 10.0 | 0.0 | 27.01 | 27.01 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.03 | 16.55 | 0.46 | 10.0 | 0.0 | 27.01 | 27.01 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2024 | | 50.42 | 16.61 | 0.4 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.7 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.89 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.89 | 0.1 | 10.0 | 0.0 | 26.99 | 0.0 | 0.0 | 0.0 | 26.99 | + 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.04 | 60.0 | 0.0 | 162.04 | 54.02 | 0.0 | 0.0 | 108.02 | + 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 | + | 01 February 2024 | Repayment | 27.01 | 16.42 | 0.59 | 10.0 | 0.0 | 83.58 | false | false | + | 01 March 2024 | Repayment | 27.01 | 16.55 | 0.46 | 10.0 | 0.0 | 67.03 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.42 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.59 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.01 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.55 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.46 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.01 | | + When Admin sets the business date to "03 March 2024" + When Admin successfully disburse the loan on "03 March 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 | 01 February 2024 | 83.58 | 16.42 | 0.59 | 10.0 | 0.0 | 27.01 | 27.01 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.03 | 16.55 | 0.46 | 10.0 | 0.0 | 27.01 | 27.01 | 0.0 | 0.0 | 0.0 | + | | | 03 March 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 31 | 01 April 2024 | | 125.62 | 41.41 | 0.95 | 10.0 | 0.0 | 52.36 | 0.0 | 0.0 | 0.0 | 52.36 | + | 4 | 30 | 01 May 2024 | | 83.98 | 41.64 | 0.72 | 10.0 | 0.0 | 52.36 | 0.0 | 0.0 | 0.0 | 52.36 | + | 5 | 31 | 01 June 2024 | | 42.12 | 41.86 | 0.5 | 10.0 | 0.0 | 52.36 | 0.0 | 0.0 | 0.0 | 52.36 | + | 6 | 30 | 01 July 2024 | | 0.0 | 42.12 | 0.24 | 10.0 | 0.0 | 52.36 | 0.0 | 0.0 | 0.0 | 52.36 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 200.0 | 3.46 | 60.0 | 0.0 | 263.46 | 54.02 | 0.0 | 0.0 | 209.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 | + | 01 February 2024 | Repayment | 27.01 | 16.42 | 0.59 | 10.0 | 0.0 | 83.58 | false | false | + | 01 March 2024 | Repayment | 27.01 | 16.55 | 0.46 | 10.0 | 0.0 | 67.03 | false | false | + | 03 March 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 167.03 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 20.0 | 0.0 | 40.0 | + And Customer makes "AUTOPAY" repayment on "03 March 2024" with 104.72 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 | | | | + | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2024 | 01 February 2024 | 83.58 | 16.42 | 0.59 | 10.0 | 0.0 | 27.01 | 27.01 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | 01 March 2024 | 67.03 | 16.55 | 0.46 | 10.0 | 0.0 | 27.01 | 27.01 | 0.0 | 0.0 | 0.0 | + | | | 03 March 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 31 | 01 April 2024 | 03 March 2024 | 124.7 | 42.33 | 0.03 | 10.0 | 0.0 | 52.36 | 52.36 | 52.36 | 0.0 | 0.0 | + | 4 | 30 | 01 May 2024 | 03 March 2024 | 82.34 | 42.36 | 0.0 | 10.0 | 0.0 | 52.36 | 52.36 | 52.36 | 0.0 | 0.0 | + | 5 | 31 | 01 June 2024 | | 41.39 | 40.95 | 1.41 | 10.0 | 0.0 | 52.36 | 0.0 | 0.0 | 0.0 | 52.36 | + | 6 | 30 | 01 July 2024 | | 0.0 | 41.39 | 0.24 | 10.0 | 0.0 | 51.63 | 0.0 | 0.0 | 0.0 | 51.63 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 200.0 | 2.73 | 60.0 | 0.0 | 262.73 | 158.74 | 104.72 | 0.0 | 103.99 | + 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 | + | 01 February 2024 | Repayment | 27.01 | 16.42 | 0.59 | 10.0 | 0.0 | 83.58 | false | false | + | 01 March 2024 | Repayment | 27.01 | 16.55 | 0.46 | 10.0 | 0.0 | 67.03 | false | false | + | 03 March 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 167.03 | false | false | + | 03 March 2024 | Repayment | 104.72 | 84.69 | 0.03 | 20.0 | 0.0 | 82.34 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 40.0 | 0.0 | 20.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 84.69 | + | ASSET | 112603 | Interest/Fee Receivable | | 20.03 | + | LIABILITY | 145023 | Suspense/Clearing account | 104.72 | | + + @TestRailId:C3790 + Scenario: Progressive loan - Verify add installment fee charge: flat charge type, interestRecalculation = true + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE | 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 + When Admin adds "LOAN_INSTALLMENT_FEE_FLAT" installment charge with 10 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 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 0.0 | 0.0 | 0.0 | 162.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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.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 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 10.0 | 0.0 | 27.01 | 27.01 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 27.01 | 0.0 | 0.0 | 135.04 | + 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 | + | 01 February 2024 | Repayment | 27.01 | 16.43 | 0.58 | 10.0 | 0.0 | 83.57 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 10.0 | 0.0 | 50.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.58 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.01 | | + When Customer makes a repayment undo on "01 February 2024" + 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 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 0.0 | 0.0 | 0.0 | 162.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 | + | 01 February 2024 | Repayment | 27.01 | 16.43 | 0.58 | 10.0 | 0.0 | 83.57 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.58 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.01 | | + | ASSET | 112601 | Loans Receivable | 16.43 | | + | ASSET | 112603 | Interest/Fee Receivable | 10.58 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 27.01 | + + @TestRailId:C3815 + Scenario: Progressive loan - Verify add installment fee charge: flat charge type, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30 | 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 + When Admin adds "LOAN_INSTALLMENT_FEE_FLAT" installment charge with 10 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 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 0.0 | 0.0 | 0.0 | 162.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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.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 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 10.0 | 0.0 | 27.01 | 27.01 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 27.01 | 0.0 | 0.0 | 135.04 | + 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 | + | 01 February 2024 | Repayment | 27.01 | 16.43 | 0.58 | 10.0 | 0.0 | 83.57 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 10.0 | 0.0 | 50.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.58 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.01 | | + When Customer makes a repayment undo on "01 February 2024" + 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 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.0 | 0.0 | 27.01 | 0.0 | 0.0 | 0.0 | 27.01 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 27.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 | 60.0 | 0.0 | 162.05 | 0.0 | 0.0 | 0.0 | 162.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 | + | 01 February 2024 | Repayment | 27.01 | 16.43 | 0.58 | 10.0 | 0.0 | 83.57 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.58 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.01 | | + | ASSET | 112601 | Loans Receivable | 16.43 | | + | ASSET | 112603 | Interest/Fee Receivable | 10.58 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 27.01 | + + @TestRailId:C3816 + Scenario: Progressive loan - Verify add installment fee charge: percentage amount charge type is NOT allowed when interestRecalculation = true + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE | 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 + When Admin fails to add "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT" installment charge with 1 amount because of wrong charge calculation type + + @TestRailId:C3791 + Scenario: Progressive loan - Verify add installment fee charge: percentage amount charge type, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30 | 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 + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT" installment charge with 1 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.16 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + 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 | 1.01 | 0.0 | 103.06 | 0.0 | 0.0 | 0.0 | 103.06 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.0 | 0.0 | 1.01 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.17 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 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 0.16 | 0.0 | 17.17 | 17.17 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + 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 | 1.01 | 0.0 | 103.06 | 17.17 | 0.0 | 0.0 | 85.89 | + 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 | + | 01 February 2024 | Repayment | 17.17 | 16.43 | 0.58 | 0.16 | 0.0 | 83.57 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.16 | 0.0 | 0.85 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.74 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.17 | | + When Customer makes a repayment undo on "01 February 2024" + 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.16 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + 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 | 1.01 | 0.0 | 103.06 | 0.0 | 0.0 | 0.0 | 103.06 | + 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 | + | 01 February 2024 | Repayment | 17.17 | 16.43 | 0.58 | 0.16 | 0.0 | 83.57 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.0 | 0.0 | 1.01 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.74 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.17 | | + | ASSET | 112601 | Loans Receivable | 16.43 | | + | ASSET | 112603 | Interest/Fee Receivable | 0.74 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 17.17 | + + @TestRailId:C3792 + Scenario: Progressive loan - Verify add installment fee charge: percentage interest charge type is NOT allowed when interestRecalculation = true + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE | 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 + When Admin fails to add "LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST" installment charge with 5 amount because of wrong charge calculation type + + @TestRailId:C3817 + Scenario: Progressive loan - Verify add installment fee charge: percentage interest charge type, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30 | 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 + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST" installment charge with 5 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.03 | 0.0 | 17.04 | 0.0 | 0.0 | 0.0 | 17.04 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.02 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | 17.03 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.02 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | 17.03 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.01 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.01 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 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.09 | 0.0 | 102.14 | 0.0 | 0.0 | 0.0 | 102.14 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.04 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 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 0.03 | 0.0 | 17.04 | 17.04 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.02 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | 17.03 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.02 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | 17.03 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.01 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.01 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 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.09 | 0.0 | 102.14 | 17.04 | 0.0 | 0.0 | 85.1 | + 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 | + | 01 February 2024 | Repayment | 17.04 | 16.43 | 0.58 | 0.03 | 0.0 | 83.57 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.03 | 0.0 | 0.06 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.61 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.04 | | + When Customer makes a repayment undo on "01 February 2024" + 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.03 | 0.0 | 17.04 | 0.0 | 0.0 | 0.0 | 17.04 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.02 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | 17.03 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.02 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | 17.03 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.01 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.01 | 0.0 | 17.02 | 0.0 | 0.0 | 0.0 | 17.02 | + | 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.09 | 0.0 | 102.14 | 0.0 | 0.0 | 0.0 | 102.14 | + 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 | + | 01 February 2024 | Repayment | 17.04 | 16.43 | 0.58 | 0.03 | 0.0 | 83.57 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.61 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.04 | | + | ASSET | 112601 | Loans Receivable | 16.43 | | + | ASSET | 112603 | Interest/Fee Receivable | 0.61 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 17.04 | + + @TestRailId:C3818 + Scenario: Progressive loan - Verify add installment fee charge: percentage amount + interest charge type is NOT allowed when interestRecalculation = true + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE | 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 + When Admin fails to add "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST" installment charge with 1 amount because of wrong charge calculation type + + @TestRailId:C3793 + Scenario: Progressive loan - Verify add installment fee charge: percentage amount + interest charge type, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30 | 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 + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST" installment charge with 1 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.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + 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 | 1.02 | 0.0 | 103.07 | 0.0 | 0.0 | 0.0 | 103.07 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.0 | 0.0 | 1.02 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.18 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 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 0.17 | 0.0 | 17.18 | 17.18 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + 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 | 1.02 | 0.0 | 103.07 | 17.18 | 0.0 | 0.0 | 85.89 | + 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 | + | 01 February 2024 | Repayment | 17.18 | 16.43 | 0.58 | 0.17 | 0.0 | 83.57 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.17 | 0.0 | 0.85 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.75 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.18 | | + When Customer makes a repayment undo on "01 February 2024" + 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.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.17 | 0.0 | 17.18 | 0.0 | 0.0 | 0.0 | 17.18 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.17 | 0.0 | 17.17 | 0.0 | 0.0 | 0.0 | 17.17 | + 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 | 1.02 | 0.0 | 103.07 | 0.0 | 0.0 | 0.0 | 103.07 | + 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 | + | 01 February 2024 | Repayment | 17.18 | 16.43 | 0.58 | 0.17 | 0.0 | 83.57 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.0 | 0.0 | 1.02 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 0.75 | + | LIABILITY | 145023 | Suspense/Clearing account | 17.18 | | + | ASSET | 112601 | Loans Receivable | 16.43 | | + | ASSET | 112603 | Interest/Fee Receivable | 0.75 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 17.18 | + + @TestRailId:C3794 + Scenario: Progressive loan - Verify add installment fee charge: all charge types, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30 | 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 + When Admin adds "LOAN_INSTALLMENT_FEE_FLAT" installment charge with 10 amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT" installment charge with 1 amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST" installment charge with 5 amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST" installment charge with 1 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 | 10.36 | 0.0 | 27.37 | 0.0 | 0.0 | 0.0 | 27.37 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.36 | 0.0 | 27.37 | 0.0 | 0.0 | 0.0 | 27.37 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.36 | 0.0 | 27.37 | 0.0 | 0.0 | 0.0 | 27.37 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.35 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.35 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.34 | 0.0 | 27.34 | 0.0 | 0.0 | 0.0 | 27.34 | + 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 | 62.12 | 0.0 | 164.17 | 0.0 | 0.0 | 0.0 | 164.17 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.0 | 0.0 | 1.01 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.0 | 0.0 | 1.02 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.37 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 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 10.36 | 0.0 | 27.37 | 27.37 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.36 | 0.0 | 27.37 | 0.0 | 0.0 | 0.0 | 27.37 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.36 | 0.0 | 27.37 | 0.0 | 0.0 | 0.0 | 27.37 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.35 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.35 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.34 | 0.0 | 27.34 | 0.0 | 0.0 | 0.0 | 27.34 | + 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 | 62.12 | 0.0 | 164.17 | 27.37 | 0.0 | 0.0 | 136.8 | + 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 | + | 01 February 2024 | Repayment | 27.37 | 16.43 | 0.58 | 10.36 | 0.0 | 83.57 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 10.0 | 0.0 | 50.0 | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.16 | 0.0 | 0.85 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.03 | 0.0 | 0.06 | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.17 | 0.0 | 0.85 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.94 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.37 | | + When Customer makes a repayment undo on "01 February 2024" + 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 | 10.36 | 0.0 | 27.37 | 0.0 | 0.0 | 0.0 | 27.37 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 10.36 | 0.0 | 27.37 | 0.0 | 0.0 | 0.0 | 27.37 | + | 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 10.36 | 0.0 | 27.37 | 0.0 | 0.0 | 0.0 | 27.37 | + | 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 10.35 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 10.35 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 10.34 | 0.0 | 27.34 | 0.0 | 0.0 | 0.0 | 27.34 | + 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 | 62.12 | 0.0 | 164.17 | 0.0 | 0.0 | 0.0 | 164.17 | + 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 | + | 01 February 2024 | Repayment | 27.37 | 16.43 | 0.58 | 10.36 | 0.0 | 83.57 | true | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.0 | 0.0 | 1.01 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.0 | 0.0 | 1.02 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.43 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.94 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.37 | | + | ASSET | 112601 | Loans Receivable | 16.43 | | + | ASSET | 112603 | Interest/Fee Receivable | 10.94 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 27.37 | + + @TestRailId:C3795 + Scenario: Progressive loan - Verify add installment fee charge, then make zero-interest charge-off: all charge types, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_ZERO_INTEREST_CHARGE_OFF_BEHAVIOUR | 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 + When Admin adds "LOAN_INSTALLMENT_FEE_FLAT" installment charge with 10 amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT" installment charge with 1 amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST" installment charge with 5 amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST" installment charge with 1 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.59 | 16.41 | 0.59 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.34 | 0.0 | 27.38 | 0.0 | 0.0 | 0.0 | 27.38 | + 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.04 | 62.12 | 0.0 | 164.16 | 0.0 | 0.0 | 0.0 | 164.16 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.0 | 0.0 | 1.01 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.0 | 0.0 | 1.02 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.36 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.36 | 0.0 | 27.36 | 27.36 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.34 | 0.0 | 27.38 | 0.0 | 0.0 | 0.0 | 27.38 | + 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.04 | 62.12 | 0.0 | 164.16 | 27.36 | 0.0 | 0.0 | 136.8 | + 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 | + | 01 February 2024 | Repayment | 27.36 | 16.41 | 0.59 | 10.36 | 0.0 | 83.59 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 10.0 | 0.0 | 50.0 | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.16 | 0.0 | 0.85 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.03 | 0.0 | 0.06 | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.17 | 0.0 | 0.85 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.95 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.36 | | + When Admin sets the business date to "1 March 2024" + And Admin does charge-off the loan on "1 March 2024" + 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.36 | 0.0 | 27.36 | 27.36 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 3 | 31 | 01 April 2024 | | 50.05 | 17.0 | 0.0 | 10.34 | 0.0 | 27.34 | 0.0 | 0.0 | 0.0 | 27.34 | + | 4 | 30 | 01 May 2024 | | 33.05 | 17.0 | 0.0 | 10.34 | 0.0 | 27.34 | 0.0 | 0.0 | 0.0 | 27.34 | + | 5 | 31 | 01 June 2024 | | 16.05 | 17.0 | 0.0 | 10.34 | 0.0 | 27.34 | 0.0 | 0.0 | 0.0 | 27.34 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.05 | 0.0 | 10.32 | 0.0 | 26.37 | 0.0 | 0.0 | 0.0 | 26.37 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100 | 1.05 | 62.06 | 0 | 163.11 | 27.36 | 0 | 0 | 135.75 | + 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 | + | 01 February 2024 | Repayment | 27.36 | 16.41 | 0.59 | 10.36 | 0.0 | 83.59 | false | false | + | 01 March 2024 | Accrual | 1.05 | 0.0 | 1.05 | 0.0 | 0.0 | 0.0 | false | false | + | 01 March 2024 | Charge-off | 135.75 | 83.59 | 0.46 | 51.7 | 0.0 | 0.0 | false | false | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 83.59 | + | ASSET | 112603 | Interest/Fee Receivable | | 52.16 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 83.59 | | + | INCOME | 404001 | Interest Income Charge Off | 0.46 | | + | INCOME | 404008 | Fee Charge Off | 51.7 | | + + @TestRailId:C3796 + Scenario: Progressive loan - Verify add installment fee charge, then make accelerate maturity date charge-off: all charge types, interestRecalculation = false + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_ACCELERATE_MATURITY_CHARGE_OFF_BEHAVIOUR | 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 + When Admin adds "LOAN_INSTALLMENT_FEE_FLAT" installment charge with 10 amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT" installment charge with 1 amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_INTEREST" installment charge with 5 amount + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST" installment charge with 1 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.59 | 16.41 | 0.59 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.34 | 0.0 | 27.38 | 0.0 | 0.0 | 0.0 | 27.38 | + 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.04 | 62.12 | 0.0 | 164.16 | 0.0 | 0.0 | 0.0 | 164.16 | + 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 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 0.0 | 0.0 | 60.0 | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.0 | 0.0 | 1.01 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.0 | 0.0 | 0.09 | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.0 | 0.0 | 1.02 | + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 27.36 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.36 | 0.0 | 27.36 | 27.36 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 67.05 | 16.54 | 0.46 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 3 | 31 | 01 April 2024 | | 50.45 | 16.6 | 0.4 | 10.36 | 0.0 | 27.36 | 0.0 | 0.0 | 0.0 | 27.36 | + | 4 | 30 | 01 May 2024 | | 33.74 | 16.71 | 0.29 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 5 | 31 | 01 June 2024 | | 16.94 | 16.8 | 0.2 | 10.35 | 0.0 | 27.35 | 0.0 | 0.0 | 0.0 | 27.35 | + | 6 | 30 | 01 July 2024 | | 0.0 | 16.94 | 0.1 | 10.34 | 0.0 | 27.38 | 0.0 | 0.0 | 0.0 | 27.38 | + 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.04 | 62.12 | 0.0 | 164.16 | 27.36 | 0.0 | 0.0 | 136.8 | + 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 | + | 01 February 2024 | Repayment | 27.36 | 16.41 | 0.59 | 10.36 | 0.0 | 83.59 | false | false | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment flat fee | false | Installment Fee | | Flat | 60.0 | 10.0 | 0.0 | 50.0 | + | Installment percentage amount fee | false | Installment Fee | | % Amount | 1.01 | 0.16 | 0.0 | 0.85 | + | Installment percentage interest fee | false | Installment Fee | | % Interest | 0.09 | 0.03 | 0.0 | 0.06 | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 1.02 | 0.17 | 0.0 | 0.85 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 16.41 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.95 | + | LIABILITY | 145023 | Suspense/Clearing account | 27.36 | | + When Admin sets the business date to "1 March 2024" + And Admin does charge-off the loan on "1 March 2024" + Then Loan Repayment schedule has 2 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 | 01 February 2024 | 83.59 | 16.41 | 0.59 | 10.36 | 0.0 | 27.36 | 27.36 | 0.0 | 0.0 | 0.0 | + | 2 | 29 | 01 March 2024 | | 0.0 | 83.59 | 0.46 | 11.7 | 0.0 | 95.75 | 0.0 | 0.0 | 0.0 | 95.75 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100 | 1.05 | 22.06 | 0 | 123.11 | 27.36 | 0 | 0 | 95.75 | + 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 | + | 01 February 2024 | Repayment | 27.36 | 16.41 | 0.59 | 10.36 | 0.0 | 83.59 | false | false | + | 01 March 2024 | Accrual | 1.05 | 0.0 | 1.05 | 0.0 | 0.0 | 0.0 | false | false | + | 01 March 2024 | Charge-off | 95.75 | 83.59 | 0.46 | 11.7 | 0.0 | 0.0 | false | false | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 83.59 | + | ASSET | 112603 | Interest/Fee Receivable | | 12.16 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 83.59 | | + | INCOME | 404001 | Interest Income Charge Off | 0.46 | | + | INCOME | 404008 | Fee Charge Off | 11.7 | | + + @TestRailId:C3797 + Scenario: Verify that partially waived installment fee applied correctly in reverse-replay logic, Progressive loan + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Progressive Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin adds "LOAN_INSTALLMENT_FEE_PERCENTAGE_AMOUNT_PLUS_INTEREST" charge with 10 % of transaction amount + When Admin sets the business date to "15 January 2023" + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 5 EUR transaction amount + When Admin sets the business date to "20 January 2023" + And Admin waives due date charge + And Customer makes "AUTOPAY" repayment on "18 January 2023" with 15 EUR transaction amount + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 100.0 | 0.0 | 1100.0 | 20.0 | 20.0 | 0.0 | 980.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 100.0 | 0 | 1100.0 | 20 | 20 | 0 | 980.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 15 January 2023 | Repayment | 5.0 | 5.0 | 0.0 | 0.0 | 0.0 | 995.0 | + | 18 January 2023 | Repayment | 15.0 | 15.0 | 0.0 | 0.0 | 0.0 | 980.0 | + | 20 January 2023 | Waive loan charges | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 980.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage amount + interest fee | false | Installment Fee | | % Loan Amount + Interest | 100.0 | 0.0 | 100.0 | 0.0 | diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java index 8951bdd50..64458b864 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java @@ -1517,7 +1517,7 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom { return repaymetsForAdjust; } - public int fetchNumberOfInstallmensAfterExceptions() { + public int fetchNumberOfInstallmentsAfterExceptions() { if (!this.repaymentScheduleInstallments.isEmpty()) { List installments = getRepaymentScheduleInstallments(); int numberOfInstallments = 0; diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCharge.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCharge.java index b5c21a78a..9f4680fab 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCharge.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCharge.java @@ -721,4 +721,8 @@ public class LoanCharge extends AbstractAuditableWithUTCDateTimeCustom { .chargePaymentMode(chargePaymentModeData).paid(paid).waived(waived).loanId(loan.getId()).minCap(minCap).maxCap(maxCap) .installmentChargeData(loanInstallmentChargeDataList).externalId(externalId).build(); } + + public boolean hasInstallmentFor(final LoanRepaymentScheduleInstallment installment) { + return this.getInstallmentLoanCharge(installment.getInstallmentNumber()) != null; + } } diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanChargeApiJsonValidator.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanChargeApiJsonValidator.java index 1d0e0703e..05e26d689 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanChargeApiJsonValidator.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanChargeApiJsonValidator.java @@ -51,6 +51,7 @@ import org.apache.fineract.portfolio.charge.exception.LoanChargeNotFoundExceptio import org.apache.fineract.portfolio.loanaccount.api.LoanApiConstants; import org.apache.fineract.portfolio.loanaccount.domain.LoanCharge; import org.apache.fineract.portfolio.loanaccount.domain.LoanChargeRepository; +import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType; import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct; import org.apache.fineract.portfolio.loanproduct.exception.LinkedAccountRequiredException; import org.springframework.stereotype.Component; @@ -280,6 +281,8 @@ public final class LoanChargeApiJsonValidator { case PERCENT_OF_INTEREST: if (loanCharge.isSpecifiedDueDate()) { errorcode = "specific." + LoanApiConstants.LOAN_CHARGE_CAN_NOT_BE_ADDED_WITH_INTEREST_CALCULATION_TYPE; + } else if (loanCharge.isInstalmentFee() && loanCharge.getLoan().isProgressiveSchedule()) { + errorcode = "installment." + LoanApiConstants.LOAN_CHARGE_CAN_NOT_BE_ADDED_WITH_INTEREST_CALCULATION_TYPE; } break; @@ -438,6 +441,9 @@ public final class LoanChargeApiJsonValidator { case PERCENT_OF_INTEREST: if (chargeTime.isSpecifiedDueDate()) { errorcode = "specific." + LoanApiConstants.LOAN_CHARGE_CAN_NOT_BE_ADDED_WITH_INTEREST_CALCULATION_TYPE; + } else if (chargeTime.isInstalmentFee() + && loanProduct.getLoanProductRelatedDetail().getLoanScheduleType().equals(LoanScheduleType.PROGRESSIVE)) { + errorcode = "installment." + LoanApiConstants.LOAN_CHARGE_CAN_NOT_BE_ADDED_WITH_INTEREST_CALCULATION_TYPE; } break; diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeService.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeService.java index 6005fe3c2..5462781fc 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeService.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeService.java @@ -22,7 +22,7 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; @@ -75,6 +75,14 @@ public class LoanChargeService { loan.updateSummaryWithTotalFeeChargesDueAtDisbursement(loan.deriveSumTotalOfChargesDueAtDisbursement()); } + public void recalculateParticularChargesAfterTransactionOccurs(final Loan loan, final List loanCharges, + final LocalDate transactionDate) { + for (final LoanCharge loanCharge : loanCharges) { + recalculateLoanCharge(loan, loanCharge, 0, transactionDate); + } + loan.updateSummaryWithTotalFeeChargesDueAtDisbursement(loan.deriveSumTotalOfChargesDueAtDisbursement()); + } + public void recalculateLoanCharge(final Loan loan, final LoanCharge loanCharge, final int penaltyWaitPeriod) { BigDecimal amount = BigDecimal.ZERO; BigDecimal chargeAmt; @@ -94,12 +102,38 @@ public class LoanChargeService { } if (loanCharge.isActive()) { clearLoanInstallmentChargesBeforeRegeneration(loanCharge); - update(loanCharge, chargeAmt, loanCharge.getDueLocalDate(), amount, loan.fetchNumberOfInstallmensAfterExceptions(), + update(loanCharge, chargeAmt, loanCharge.getDueLocalDate(), amount, loan.fetchNumberOfInstallmentsAfterExceptions(), totalChargeAmt); loanChargeValidator.validateChargeHasValidSpecifiedDateIfApplicable(loan, loanCharge, loan.getDisbursementDate()); } } + public void recalculateLoanCharge(final Loan loan, final LoanCharge loanCharge, final int penaltyWaitPeriod, + final LocalDate transactionDate) { + BigDecimal amount = BigDecimal.ZERO; + BigDecimal chargeAmt; + BigDecimal totalChargeAmt = BigDecimal.ZERO; + if (loanCharge.getChargeCalculation().isPercentageBased()) { + if (loanCharge.isOverdueInstallmentCharge()) { + amount = calculateOverdueAmountPercentageAppliedTo(loan, loanCharge, penaltyWaitPeriod); + } else { + amount = calculateAmountPercentageAppliedTo(loan, loanCharge); + } + chargeAmt = loanCharge.getPercentage(); + if (loanCharge.isInstalmentFee()) { + totalChargeAmt = calculatePerInstallmentChargeAmount(loan, loanCharge); + } + } else { + chargeAmt = loanCharge.amountOrPercentage(); + } + if (loanCharge.isActive()) { + clearLoanInstallmentChargesBeforeRegeneration(loanCharge); + update(loanCharge, chargeAmt, loanCharge.getDueLocalDate(), amount, loan.fetchNumberOfInstallmentsAfterExceptions(), + totalChargeAmt, transactionDate); + loanChargeValidator.validateChargeHasValidSpecifiedDateIfApplicable(loan, loanCharge, loan.getDisbursementDate()); + } + } + public void makeChargePayment(final Loan loan, final Long chargeId, final List existingTransactionIds, final List existingReversedTransactionIds, final LoanTransaction paymentTransaction, final Integer installmentNumber) { loanChargeValidator.validateChargePaymentNotInFuture(paymentTransaction); @@ -191,7 +225,8 @@ public class LoanChargeService { } else { chargeAmt = loanCharge.amountOrPercentage(); } - update(loanCharge, chargeAmt, loanCharge.getDueLocalDate(), amount, loan.fetchNumberOfInstallmensAfterExceptions(), totalChargeAmt); + update(loanCharge, chargeAmt, loanCharge.getDueLocalDate(), amount, loan.fetchNumberOfInstallmentsAfterExceptions(), + totalChargeAmt); // NOTE: must add new loan charge to set of loan charges before // reprocessing the repayment schedule. @@ -275,7 +310,7 @@ public class LoanChargeService { chargeAmt = loanCharge.amountOrPercentage(); } if (charge != null) { - update(charge, chargeAmt, loanCharge.getDueLocalDate(), amount, loan.fetchNumberOfInstallmensAfterExceptions(), + update(charge, chargeAmt, loanCharge.getDueLocalDate(), amount, loan.fetchNumberOfInstallmentsAfterExceptions(), totalChargeAmt); } } @@ -325,7 +360,7 @@ public class LoanChargeService { case FLAT: if (loanCharge.isInstalmentFee()) { loanCharge.setAmount( - newValue.multiply(BigDecimal.valueOf(loanCharge.getLoan().fetchNumberOfInstallmensAfterExceptions()))); + newValue.multiply(BigDecimal.valueOf(loanCharge.getLoan().fetchNumberOfInstallmentsAfterExceptions()))); } else { loanCharge.setAmount(newValue); } @@ -375,7 +410,7 @@ public class LoanChargeService { loanCharge.setAmountPaid(null); if (loanCharge.isInstalmentFee()) { if (numberOfRepayments == null) { - numberOfRepayments = loanCharge.getLoan().fetchNumberOfInstallmensAfterExceptions(); + numberOfRepayments = loanCharge.getLoan().fetchNumberOfInstallmentsAfterExceptions(); } loanCharge.setAmount(chargeAmount.multiply(BigDecimal.valueOf(numberOfRepayments))); } else { @@ -574,40 +609,47 @@ public class LoanChargeService { return calculatePerInstallmentChargeAmount(loan, loanCharge.getChargeCalculation(), loanCharge.getPercentage()); } - private void updateInstallmentCharges(final LoanCharge loanCharge) { - final Collection remove = new HashSet<>(); + public void updateInstallmentCharges(final LoanCharge loanCharge) { final List newChargeInstallments = generateInstallmentLoanCharges(loanCharge.getLoan(), loanCharge); + if (loanCharge.getLoanInstallmentCharge().isEmpty()) { loanCharge.getLoanInstallmentCharge().addAll(newChargeInstallments); } else { - int index = 0; - final List oldChargeInstallments = new ArrayList<>(); - if (loanCharge.getLoanInstallmentCharge() != null && !loanCharge.getLoanInstallmentCharge().isEmpty()) { - oldChargeInstallments.addAll(loanCharge.getLoanInstallmentCharge()); - } - Collections.sort(oldChargeInstallments); - final LoanInstallmentCharge[] loanChargePerInstallmentArray = newChargeInstallments - .toArray(new LoanInstallmentCharge[newChargeInstallments.size()]); - for (final LoanInstallmentCharge chargePerInstallment : oldChargeInstallments) { - if (index == loanChargePerInstallmentArray.length) { - remove.add(chargePerInstallment); - chargePerInstallment.getInstallment().getInstallmentCharges().remove(chargePerInstallment); - } else { - LoanInstallmentCharge newLoanInstallmentCharge = loanChargePerInstallmentArray[index++]; - newLoanInstallmentCharge.getInstallment().getInstallmentCharges().remove(newLoanInstallmentCharge); - chargePerInstallment.copyFrom(newLoanInstallmentCharge); + final Map newChargeMap = new HashMap<>(); + for (final LoanInstallmentCharge newCharge : newChargeInstallments) { + if (newCharge.getInstallment() != null && newCharge.getInstallment().getInstallmentNumber() != null) { + newChargeMap.put(newCharge.getInstallment().getInstallmentNumber(), newCharge); } } - loanCharge.getLoanInstallmentCharge().removeAll(remove); - while (index < loanChargePerInstallmentArray.length) { - loanCharge.getLoanInstallmentCharge().add(loanChargePerInstallmentArray[index++]); + + final Collection chargesToRemoveFromLoanCharge = new HashSet<>(); + final Collection chargesToAddIntoLoanCharge = new HashSet<>(); + + for (final LoanInstallmentCharge oldCharge : loanCharge.getLoanInstallmentCharge()) { + final Integer oldInstallmentNumber = oldCharge.getInstallment().getInstallmentNumber(); + + if (newChargeMap.containsKey(oldInstallmentNumber)) { + chargesToRemoveFromLoanCharge.add(oldCharge); + oldCharge.getInstallment().getInstallmentCharges().remove(oldCharge); + chargesToAddIntoLoanCharge.add(newChargeMap.get(oldInstallmentNumber)); + newChargeMap.remove(oldInstallmentNumber); + } else { + chargesToRemoveFromLoanCharge.add(oldCharge); + oldCharge.getInstallment().getInstallmentCharges().remove(oldCharge); + } } + + chargesToAddIntoLoanCharge.addAll(newChargeMap.values()); + + loanCharge.getLoanInstallmentCharge().removeAll(chargesToRemoveFromLoanCharge); + loanCharge.getLoanInstallmentCharge().addAll(chargesToAddIntoLoanCharge); } - Money amount = Money.zero(loanCharge.getLoan().getCurrency()); + + Money totalAmount = Money.zero(loanCharge.getLoan().getCurrency()); for (LoanInstallmentCharge charge : loanCharge.getLoanInstallmentCharge()) { - amount = amount.plus(charge.getAmount()); + totalAmount = totalAmount.plus(charge.getAmount()); } - loanCharge.setAmount(amount.getAmount()); + loanCharge.setAmount(totalAmount.getAmount()); } private List generateInstallmentLoanCharges(final Loan loan, final LoanCharge loanCharge) { @@ -615,9 +657,6 @@ public class LoanChargeService { if (loanCharge.isInstalmentFee()) { List installments = loan.getRepaymentScheduleInstallments(); for (final LoanRepaymentScheduleInstallment installment : installments) { - if (installment.isRecalculatedInterestComponent()) { - continue; - } BigDecimal amount; if (loanCharge.getChargeCalculation().isFlat()) { amount = loanCharge.amountOrPercentage(); @@ -633,6 +672,78 @@ public class LoanChargeService { return loanChargePerInstallments; } + private List generateInstallmentLoanCharges(final Loan loan, final LoanCharge loanCharge, + final LocalDate transactionDate) { + final List loanChargePerInstallments = new ArrayList<>(); + if (loanCharge.isInstalmentFee()) { + final List installments = loan.getRepaymentScheduleInstallments().stream() + .filter(i -> i != null && i.isNotFullyPaidOff() && i.getDueDate() != null && !i.getDueDate().isBefore(transactionDate)) + .toList(); + for (final LoanRepaymentScheduleInstallment installment : installments) { + BigDecimal amount; + if (loanCharge.getChargeCalculation().isFlat()) { + amount = loanCharge.amountOrPercentage(); + } else { + amount = calculateInstallmentChargeAmount(loan, loanCharge.getChargeCalculation(), loanCharge.getPercentage(), + installment).getAmount(); + } + final LoanInstallmentCharge loanInstallmentCharge = new LoanInstallmentCharge(amount, loanCharge, installment); + installment.getInstallmentCharges().add(loanInstallmentCharge); + loanChargePerInstallments.add(loanInstallmentCharge); + } + } + return loanChargePerInstallments; + } + + public void updateInstallmentCharges(final LoanCharge loanCharge, final LocalDate transactionDate) { + final List newChargeInstallments = generateInstallmentLoanCharges(loanCharge.getLoan(), loanCharge, + transactionDate); + + if (loanCharge.getLoanInstallmentCharge().isEmpty()) { + loanCharge.getLoanInstallmentCharge().addAll(newChargeInstallments); + } else { + final List oldLoanInstallmentCharges = loanCharge + .getLoanInstallmentCharge().stream().filter(i -> i != null && !i.isPaid() && i.getInstallment() != null + && i.getInstallment().getDueDate() != null && !i.getInstallment().getDueDate().isBefore(transactionDate)) + .toList(); + + final Map newChargeMap = new HashMap<>(); + for (final LoanInstallmentCharge newCharge : newChargeInstallments) { + if (newCharge.getInstallment() != null && newCharge.getInstallment().getInstallmentNumber() != null) { + newChargeMap.put(newCharge.getInstallment().getInstallmentNumber(), newCharge); + } + } + + final Collection chargesToRemoveFromLoanCharge = new HashSet<>(); + final Collection chargesToAddIntoLoanCharge = new HashSet<>(); + + for (final LoanInstallmentCharge oldCharge : oldLoanInstallmentCharges) { + final Integer oldInstallmentNumber = oldCharge.getInstallment().getInstallmentNumber(); + + if (newChargeMap.containsKey(oldInstallmentNumber)) { + chargesToRemoveFromLoanCharge.add(oldCharge); + oldCharge.getInstallment().getInstallmentCharges().remove(oldCharge); + chargesToAddIntoLoanCharge.add(newChargeMap.get(oldInstallmentNumber)); + newChargeMap.remove(oldInstallmentNumber); + } else { + chargesToRemoveFromLoanCharge.add(oldCharge); + oldCharge.getInstallment().getInstallmentCharges().remove(oldCharge); + } + } + + chargesToAddIntoLoanCharge.addAll(newChargeMap.values()); + + loanCharge.getLoanInstallmentCharge().removeAll(chargesToRemoveFromLoanCharge); + loanCharge.getLoanInstallmentCharge().addAll(chargesToAddIntoLoanCharge); + } + + Money totalAmount = Money.zero(loanCharge.getLoan().getCurrency()); + for (LoanInstallmentCharge charge : loanCharge.getLoanInstallmentCharge()) { + totalAmount = totalAmount.plus(charge.getAmount()); + } + loanCharge.setAmount(totalAmount.getAmount()); + } + private BigDecimal calculateOverdueAmountPercentageAppliedTo(final Loan loan, final LoanCharge loanCharge, final int penaltyWaitPeriod) { LoanRepaymentScheduleInstallment installment = loanCharge.getOverdueInstallmentCharge().getInstallment(); @@ -674,7 +785,7 @@ public class LoanChargeService { case FLAT: if (loanCharge.isInstalmentFee()) { if (numberOfRepayments == null) { - numberOfRepayments = loanCharge.getLoan().fetchNumberOfInstallmensAfterExceptions(); + numberOfRepayments = loanCharge.getLoan().fetchNumberOfInstallmentsAfterExceptions(); } loanCharge.setAmount(amount.multiply(BigDecimal.valueOf(numberOfRepayments))); } else { @@ -701,6 +812,46 @@ public class LoanChargeService { } } + private void update(final LoanCharge loanCharge, final BigDecimal amount, final LocalDate dueDate, final BigDecimal loanPrincipal, + Integer numberOfRepayments, BigDecimal loanChargeAmount, final LocalDate transactionDate) { + if (dueDate != null) { + loanCharge.setDueDate(dueDate); + } + + if (amount != null) { + switch (loanCharge.getChargeCalculation()) { + case INVALID: + break; + case FLAT: + if (loanCharge.isInstalmentFee()) { + if (numberOfRepayments == null) { + numberOfRepayments = loanCharge.getLoan().fetchNumberOfInstallmentsAfterExceptions(); + } + loanCharge.setAmount(amount.multiply(BigDecimal.valueOf(numberOfRepayments))); + } else { + loanCharge.setAmount(amount); + } + break; + case PERCENT_OF_AMOUNT: + case PERCENT_OF_AMOUNT_AND_INTEREST: + case PERCENT_OF_INTEREST: + case PERCENT_OF_DISBURSEMENT_AMOUNT: + loanCharge.setPercentage(amount); + loanCharge.setAmountPercentageAppliedTo(loanPrincipal); + if (loanChargeAmount.compareTo(BigDecimal.ZERO) == 0) { + loanChargeAmount = loanCharge.percentageOf(loanCharge.getAmountPercentageAppliedTo()); + } + loanCharge.setAmount(loanCharge.minimumAndMaximumCap(loanChargeAmount)); + break; + } + loanCharge.setAmountOrPercentage(amount); + loanCharge.setAmountOutstanding(loanCharge.calculateOutstanding()); + if (loanCharge.getLoan() != null && loanCharge.isInstalmentFee()) { + updateInstallmentCharges(loanCharge, transactionDate); + } + } + } + private Money getTotalAllTrancheDisbursementAmount(final Loan loan) { Money amount = Money.zero(loan.getCurrency()); if (loan.isMultiDisburmentLoan()) { diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java index a88860143..87a673292 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java @@ -42,6 +42,8 @@ public final class LoanProductsApiResourceSwagger { @Schema(example = "1") public Long id; + @Schema(example = "60.0") + public BigDecimal amount; } @Schema(description = "LoanProductChargeToGLAccountMapper") @@ -1421,7 +1423,7 @@ public final class LoanProductsApiResourceSwagger { @Schema(example = "false") public Boolean canDefineInstallmentAmount; @Schema(example = "[]") - public List charges; + public List charges; public Set productsPrincipalVariationsForBorrowerCycle; @Schema(example = "[]") public List interestRateVariationsForBorrowerCycle; diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java index 8cb40c491..1802981c1 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java @@ -76,6 +76,7 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanCharge; import org.apache.fineract.portfolio.loanaccount.domain.LoanChargeOffBehaviour; import org.apache.fineract.portfolio.loanaccount.domain.LoanChargePaidBy; import org.apache.fineract.portfolio.loanaccount.domain.LoanCreditAllocationRule; +import org.apache.fineract.portfolio.loanaccount.domain.LoanInstallmentCharge; import org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalculationDetails; import org.apache.fineract.portfolio.loanaccount.domain.LoanPaymentAllocationRule; import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment; @@ -97,6 +98,7 @@ import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanSchedul import org.apache.fineract.portfolio.loanaccount.serialization.LoanChargeValidator; import org.apache.fineract.portfolio.loanaccount.service.InterestRefundService; import org.apache.fineract.portfolio.loanaccount.service.LoanBalanceService; +import org.apache.fineract.portfolio.loanaccount.service.LoanChargeService; import org.apache.fineract.portfolio.loanaccount.service.schedule.LoanScheduleComponent; import org.apache.fineract.portfolio.loanproduct.calc.EMICalculator; import org.apache.fineract.portfolio.loanproduct.calc.data.OutstandingDetails; @@ -125,17 +127,20 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep private final InterestRefundService interestRefundService; private final LoanScheduleComponent loanSchedule; private final LoanTransactionRepository loanTransactionRepository; + private final LoanChargeService loanChargeService; public AdvancedPaymentScheduleTransactionProcessor(final EMICalculator emiCalculator, final LoanRepositoryWrapper loanRepositoryWrapper, final InterestRefundService interestRefundService, final ExternalIdFactory externalIdFactory, final LoanScheduleComponent loanSchedule, final LoanTransactionRepository loanTransactionRepository, - final LoanChargeValidator loanChargeValidator, final LoanBalanceService loanBalanceService) { + final LoanChargeValidator loanChargeValidator, final LoanBalanceService loanBalanceService, + final LoanChargeService loanChargeService) { super(externalIdFactory, loanChargeValidator, loanBalanceService); this.emiCalculator = emiCalculator; this.loanRepositoryWrapper = loanRepositoryWrapper; this.interestRefundService = interestRefundService; this.loanTransactionRepository = loanTransactionRepository; this.loanSchedule = loanSchedule; + this.loanChargeService = loanChargeService; } @Override @@ -372,6 +377,10 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep createMissingAccrualTransactionDuringChargeOffIfNeeded(newInterest, loanTransaction, loanTransaction.getTransactionDate(), transactionCtx); + if (!loanTransaction.getLoan().isInterestBearingAndInterestRecalculationEnabled()) { + recalculateInstallmentFeeCharges(loanTransaction); + } + loanTransaction.resetDerivedComponents(); // determine how much is outstanding total and breakdown for principal, interest and charges for (final LoanRepaymentScheduleInstallment currentInstallment : transactionCtx.getInstallments()) { @@ -1215,11 +1224,37 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep private void handleDisbursement(LoanTransaction disbursementTransaction, TransactionCtx transactionCtx) { // TODO: Fix this and enhance EMICalculator to support reamortization and reaging - if (disbursementTransaction.getLoan().isInterestBearing()) { + final Loan loan = disbursementTransaction.getLoan(); + if (loan.isInterestBearing()) { handleDisbursementWithEMICalculator(disbursementTransaction, transactionCtx); } else { handleDisbursementWithoutEMICalculator(disbursementTransaction, transactionCtx); } + if (!disbursementTransaction.getLoan().isInterestBearingAndInterestRecalculationEnabled()) { + recalculateInstallmentFeeCharges(disbursementTransaction); + } + } + + private void recalculateInstallmentFeeCharges(final LoanTransaction loanTransaction) { + final Loan loan = loanTransaction.getLoan(); + final List loanInstallmentFeeCharges = loan.getActiveCharges().stream() + .filter(c -> c.isInstalmentFee() && c.getSubmittedOnDate().isBefore(loanTransaction.getTransactionDate())).toList(); + loanChargeService.recalculateParticularChargesAfterTransactionOccurs(loan, loanInstallmentFeeCharges, + loanTransaction.getTransactionDate()); + if (!loanInstallmentFeeCharges.isEmpty()) { + final List installmentsToUpdate = loan.getRepaymentScheduleInstallments().stream() + .filter(i -> i.isNotFullyPaidOff() && !i.isAdditional()).toList(); + for (LoanRepaymentScheduleInstallment installment : installmentsToUpdate) { + if (installment.isDownPayment()) { + continue; + } + final BigDecimal newFee = installment.getInstallmentCharges().stream().map(LoanInstallmentCharge::getAmount) + .reduce(BigDecimal.ZERO, BigDecimal::add); + if (newFee.compareTo(BigDecimal.ZERO) != 0) { + installment.setFeeChargesCharged(newFee); + } + } + } } private void handleDisbursementWithEMICalculator(LoanTransaction disbursementTransaction, TransactionCtx transactionCtx) { @@ -1670,6 +1705,10 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep createMissingAccrualTransactionDuringChargeOffIfNeeded(newInterest, loanTransaction, loanTransaction.getTransactionDate(), transactionCtx); + if (!loanTransaction.getLoan().isInterestBearingAndInterestRecalculationEnabled()) { + recalculateInstallmentFeeCharges(loanTransaction); + } + loanTransaction.resetDerivedComponents(); // determine how much is outstanding total and breakdown for principal, interest and charges for (final LoanRepaymentScheduleInstallment currentInstallment : transactionCtx.getInstallments()) { @@ -1765,8 +1804,8 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep if (futureFee.compareTo(BigDecimal.ZERO) > 0 || futurePenalty.compareTo(BigDecimal.ZERO) > 0) { final Optional latestDueDate = loan.getCharges().stream() - .filter(loanCharge -> loanCharge.isActive() && loanCharge.isNotFullyPaid()).map(LoanCharge::getDueDate) - .max(LocalDate::compareTo); + .filter(loanCharge -> loanCharge.isActive() && loanCharge.isNotFullyPaid() && loanCharge.getDueDate() != null) + .map(LoanCharge::getDueDate).max(LocalDate::compareTo); if (latestDueDate.isPresent()) { final LoanRepaymentScheduleInstallment lastInstallment = installmentsUpToTransactionDate.getLast(); @@ -2526,11 +2565,12 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep } @NotNull - private Set getLoanChargesOfInstallment(Set charges, LoanRepaymentScheduleInstallment installment, - int firstInstallmentNumber) { - boolean isFirstInstallment = installment.getInstallmentNumber().equals(firstInstallmentNumber); + private Set getLoanChargesOfInstallment(final Set charges, final LoanRepaymentScheduleInstallment installment, + final int firstInstallmentNumber) { + final boolean isFirstInstallment = installment.getInstallmentNumber().equals(firstInstallmentNumber); return charges.stream() - .filter(loanCharge -> loanCharge.isDueInPeriod(installment.getFromDate(), installment.getDueDate(), isFirstInstallment)) + .filter(loanCharge -> (loanCharge.isInstalmentFee() && loanCharge.hasInstallmentFor(installment)) + || loanCharge.isDueInPeriod(installment.getFromDate(), installment.getDueDate(), isFirstInstallment)) .collect(Collectors.toSet()); } diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ChangeOperation.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ChangeOperation.java index 836e9c018..61cd6d7c9 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ChangeOperation.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ChangeOperation.java @@ -66,12 +66,17 @@ public class ChangeOperation implements Comparable { return loanCharge.isPresent(); } + public boolean isInstallmentFee() { + return loanCharge.map(LoanCharge::isInstalmentFee).orElse(false); + } + private boolean isAccrualActivity() { return isTransaction() && loanTransaction.get().isAccrualActivity(); } private boolean isBackdatedCharge() { - return isCharge() && DateUtils.isBefore(loanCharge.get().getDueDate(), loanCharge.get().getSubmittedOnDate()); + return isCharge() && loanCharge.isPresent() && loanCharge.get().getDueDate() != null + && DateUtils.isBefore(loanCharge.get().getDueDate(), loanCharge.get().getSubmittedOnDate()); } private LocalDate getEffectiveDate() { @@ -80,6 +85,8 @@ public class ChangeOperation implements Comparable { } else if (loanCharge.isPresent()) { if (isBackdatedCharge()) { return loanCharge.get().getDueDate(); + } else if (isInstallmentFee()) { + return loanCharge.get().getLoan().isDisbursed() ? loanCharge.get().getSubmittedOnDate() : loanCharge.get().getDueDate(); } else { return loanCharge.get().getSubmittedOnDate(); } @@ -119,6 +126,17 @@ public class ChangeOperation implements Comparable { public int compareTo(@NonNull ChangeOperation o) { int datePortion = DateUtils.compareWithNullsLast(this.getEffectiveDate(), o.getEffectiveDate()); if (datePortion == 0) { + boolean thisIsDisb = this.isTransaction() && this.getLoanTransaction().isPresent() + && this.getLoanTransaction().get().isDisbursement(); + boolean otherIsDisb = o.isTransaction() && o.getLoanTransaction().isPresent() && o.getLoanTransaction().get().isDisbursement(); + + if (thisIsDisb && o.isCharge() && o.isInstallmentFee()) { + return -1; + } + if (this.isCharge() && this.isInstallmentFee() && otherIsDisb) { + return 1; + } + final boolean isAccrual = isAccrualActivity(); if (isAccrual != o.isAccrualActivity()) { return isAccrual ? 1 : -1; diff --git a/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessorTest.java b/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessorTest.java index af7516f3b..744298b9d 100644 --- a/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessorTest.java +++ b/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessorTest.java @@ -75,6 +75,7 @@ import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanSchedul import org.apache.fineract.portfolio.loanaccount.serialization.LoanChargeValidator; import org.apache.fineract.portfolio.loanaccount.service.InterestRefundService; import org.apache.fineract.portfolio.loanaccount.service.LoanBalanceService; +import org.apache.fineract.portfolio.loanaccount.service.LoanChargeService; import org.apache.fineract.portfolio.loanaccount.service.schedule.LoanScheduleComponent; import org.apache.fineract.portfolio.loanproduct.calc.EMICalculator; import org.apache.fineract.portfolio.loanproduct.calc.data.ProgressiveLoanInterestScheduleModel; @@ -121,7 +122,7 @@ class AdvancedPaymentScheduleTransactionProcessorTest { underTest = new AdvancedPaymentScheduleTransactionProcessor(emiCalculator, Mockito.mock(LoanRepositoryWrapper.class), Mockito.mock(InterestRefundService.class), Mockito.mock(ExternalIdFactory.class), Mockito.mock(LoanScheduleComponent.class), Mockito.mock(LoanTransactionRepository.class), Mockito.mock(LoanChargeValidator.class), - Mockito.mock(LoanBalanceService.class)); + Mockito.mock(LoanBalanceService.class), Mockito.mock(LoanChargeService.class)); ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null)); ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeWritePlatformServiceImpl.java index db4058b69..9595ba1d9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeWritePlatformServiceImpl.java @@ -202,18 +202,6 @@ public class LoanChargeWritePlatformServiceImpl implements LoanChargeWritePlatfo final Long chargeDefinitionId = command.longValueOfParameterNamed("chargeId"); final Charge chargeDefinition = this.chargeRepository.findOneWithNotFoundDetection(chargeDefinitionId); - /* - * TODO: remove this check once handling for Installment fee charges is implemented for Advanced Payment - * strategy - */ - if (ChargeTimeType.fromInt(chargeDefinition.getChargeTimeType()).isInstalmentFee() - && AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY - .equals(loan.transactionProcessingStrategy())) { - final String errorMessageInstallmentChargeNotSupported = "Charge with identifier " + chargeDefinition.getId() - + " cannot be applied: Installment fee charges are not supported for Advanced payment allocation strategy"; - throw new ChargeCannotBeAppliedToException("loan", errorMessageInstallmentChargeNotSupported, chargeDefinition.getId()); - } - if (loan.isDisbursed() && chargeDefinition.isDisbursementCharge()) { // validates whether any pending disbursements are available to // apply this charge @@ -1079,11 +1067,6 @@ public class LoanChargeWritePlatformServiceImpl implements LoanChargeWritePlatfo chargeDefinition.getName()); } } else if (loan.isInterestBearingAndInterestRecalculationEnabled()) { - if (loanCharge.isInstalmentFee() && loan.getStatus().isActive()) { - final String defaultUserMessage = "installment charge addition not allowed after disbursement"; - throw new LoanChargeCannotBeAddedException("loanCharge", "installment.charge", defaultUserMessage, null, - chargeDefinition.getName()); - } final List dataValidationErrors = new ArrayList<>(); final Set loanCharges = new HashSet<>(1); loanCharges.add(loanCharge); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/LoanAccountAutoStarter.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/LoanAccountAutoStarter.java index e3f52a4d7..0b7453bca 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/LoanAccountAutoStarter.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/LoanAccountAutoStarter.java @@ -36,6 +36,7 @@ import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.imp import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.RBILoanRepaymentScheduleTransactionProcessor; import org.apache.fineract.portfolio.loanaccount.serialization.LoanChargeValidator; import org.apache.fineract.portfolio.loanaccount.service.LoanBalanceService; +import org.apache.fineract.portfolio.loanaccount.service.LoanChargeService; import org.apache.fineract.portfolio.loanaccount.service.ProgressiveLoanInterestRefundServiceImpl; import org.apache.fineract.portfolio.loanaccount.service.schedule.LoanScheduleComponent; import org.apache.fineract.portfolio.loanproduct.calc.EMICalculator; @@ -139,8 +140,8 @@ public class LoanAccountAutoStarter { final @Lazy ProgressiveLoanInterestRefundServiceImpl progressiveLoanInterestRefundService, final ExternalIdFactory externalIdFactory, final LoanScheduleComponent loanSchedule, final LoanTransactionRepository loanTransactionRepository, final LoanChargeValidator loanChargeValidator, - final LoanBalanceService loanBalanceService) { + final LoanBalanceService loanBalanceService, @Lazy final LoanChargeService loanChargeService) { return new AdvancedPaymentScheduleTransactionProcessor(emiCalculator, loanRepositoryWrapper, progressiveLoanInterestRefundService, - externalIdFactory, loanSchedule, loanTransactionRepository, loanChargeValidator, loanBalanceService); + externalIdFactory, loanSchedule, loanTransactionRepository, loanChargeValidator, loanBalanceService, loanChargeService); } } diff --git a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeWritePlatformServiceImplTest.java b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeWritePlatformServiceImplTest.java index f482a412b..cb090499c 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeWritePlatformServiceImplTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeWritePlatformServiceImplTest.java @@ -199,7 +199,7 @@ class LoanChargeWritePlatformServiceImplTest { when(loan.getDisbursementDate()).thenReturn(LocalDate.now(ZoneId.systemDefault())); when(loan.getRepaymentScheduleInstallments()).thenReturn(new ArrayList<>()); when(loanChargeService.calculateAmountPercentageAppliedTo(any(Loan.class), any(LoanCharge.class))).thenReturn(BigDecimal.TEN); - when(loan.fetchNumberOfInstallmensAfterExceptions()).thenReturn(5); + when(loan.fetchNumberOfInstallmentsAfterExceptions()).thenReturn(5); when(loan.updateSummaryWithTotalFeeChargesDueAtDisbursement(any(BigDecimal.class))).thenReturn(null); when(loan.deriveSumTotalOfChargesDueAtDisbursement()).thenReturn(BigDecimal.ZERO); when(loanCharge.getDueLocalDate()).thenReturn(LocalDate.now(ZoneId.systemDefault())); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargeTypeInstallmentFeeErrorHandlingWithAdvancedPaymentAllocationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargeTypeInstallmentFeeErrorHandlingWithAdvancedPaymentAllocationTest.java index ab004105c..d43e34f04 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargeTypeInstallmentFeeErrorHandlingWithAdvancedPaymentAllocationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargeTypeInstallmentFeeErrorHandlingWithAdvancedPaymentAllocationTest.java @@ -46,6 +46,7 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; public class LoanChargeTypeInstallmentFeeErrorHandlingWithAdvancedPaymentAllocationTest extends BaseLoanIntegrationTest { @@ -67,9 +68,7 @@ public class LoanChargeTypeInstallmentFeeErrorHandlingWithAdvancedPaymentAllocat ACCOUNT_HELPER = new AccountHelper(REQUEST_SPEC, RESPONSE_SPEC); } - /* - * TODO: To be disabled when Installment Fee Charges are handled for Advanced Payment Allocation - */ + @Disabled @Test public void addingLoanChargeTypeInstallmentFeeForAdvancedPaymentAllocationGivesErrorTest() { try {