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 970d25858..afd90b0d4 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 @@ -3168,6 +3168,7 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ .daysInMonthType(DaysInMonthType.DAYS30.value)// .enableDownPayment(false)// .enableAutoRepaymentForDownPayment(null)// + .installmentAmountInMultiplesOf(null)// .disbursedAmountPercentageForDownPayment(null)// .multiDisburseLoan(true)// .disallowExpectedDisbursements(true)// @@ -3197,6 +3198,7 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ .recalculationRestFrequencyType(RecalculationRestFrequencyType.SAME_AS_REPAYMENT.value)// .enableDownPayment(false)// .enableAutoRepaymentForDownPayment(null)// + .installmentAmountInMultiplesOf(null)// .disbursedAmountPercentageForDownPayment(null)// .multiDisburseLoan(true)// .disallowExpectedDisbursements(true)// @@ -3230,6 +3232,7 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ .recalculationRestFrequencyType(RecalculationRestFrequencyType.SAME_AS_REPAYMENT.value)// .enableDownPayment(false)// .enableAutoRepaymentForDownPayment(null)// + .installmentAmountInMultiplesOf(null)// .disbursedAmountPercentageForDownPayment(null)// .multiDisburseLoan(true)// .disallowExpectedDisbursements(true)// @@ -3259,6 +3262,7 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ .loanScheduleProcessingType("HORIZONTAL")// .enableDownPayment(false)// .enableAutoRepaymentForDownPayment(null)// + .installmentAmountInMultiplesOf(null)// .disbursedAmountPercentageForDownPayment(null)// .multiDisburseLoan(true)// .disallowExpectedDisbursements(true)// diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanRepayment.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanRepayment.feature index 48a360133..1018170b5 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanRepayment.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanRepayment.feature @@ -3204,8 +3204,6 @@ Feature: LoanRepayment | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | 1000.0 | 0 | 0 | 0 | 1000.0 | 0.0 | 0 | 0 | 1000 | - # TODO fix progressive interest mode FLAT does not respect in multiples of - @Skip @TestRailId:C3129 @AdvancedPaymentAllocation Scenario: Verify installment due date logic for monthly installments - last day of the month When Admin sets the business date to "31 January 2024" @@ -3249,8 +3247,6 @@ Feature: LoanRepayment | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | - # TODO fix progressive interest mode FLAT does not respect in multiples of - @Skip @TestRailId:C3130 @AdvancedPaymentAllocation Scenario: Verify installment due date logic for monthly installments - last day of the month, expected and real disbursement dates are different When Admin sets the business date to "30 January 2024" @@ -3295,8 +3291,6 @@ Feature: LoanRepayment | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | - # TODO fix progressive interest mode FLAT does not respect in multiples of - @Skip @TestRailId:C3131 @AdvancedPaymentAllocation Scenario: Verify installment due date logic for monthly installments - last day of the month, repayment start calculated from Submitted on date - submit, approve, disburse on same date When Admin sets the business date to "31 January 2024" @@ -3340,8 +3334,6 @@ Feature: LoanRepayment | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | - # TODO fix progressive interest mode FLAT does not respect in multiples of - @Skip @TestRailId:C3132 @AdvancedPaymentAllocation Scenario: Verify installment due date logic for monthly installments - last day of the month, repayment start calculated from Submitted on date - submit and approve on same date, disburse on next day When Admin sets the business date to "31 January 2024" @@ -3386,8 +3378,6 @@ Feature: LoanRepayment | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | - # TODO fix progressive interest mode FLAT does not respect in multiples of - @Skip @TestRailId:C3133 @AdvancedPaymentAllocation Scenario: Verify installment due date logic for monthly installments - last day of the month, repayment start calculated from Submitted on date - submit and approve on same date, expected disbursement date on next day When Admin sets the business date to "31 January 2024" @@ -5595,4 +5585,4 @@ Feature: LoanRepayment | 20 October 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | | 22 October 2024 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | true | | 26 October 2024 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | true | - | 26 October 2024 | Repayment | 101.0 | 100.0 | 0.0 | 0.0 | 1.0 | 0.0 | false | \ No newline at end of file + | 26 October 2024 | Repayment | 101.0 | 100.0 | 0.0 | 0.0 | 1.0 | 0.0 | false | diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java index 66aed18cc..bdd6b7e67 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java @@ -926,10 +926,11 @@ public final class ProgressiveEMICalculator implements EMICalculator { .plus(sumOfInterest).minus(alreadyRepaidPrincipals); Money periodEmi = total.dividedBy(repaymentPeriods.size(), mc); - Money remainder = total.minus(periodEmi.multipliedBy(repaymentPeriods.size(), mc)); + Money periodEmiInMultiplesOf = applyInstallmentAmountInMultiplesOf(scheduleModel, periodEmi); + Money remainder = total.minus(periodEmiInMultiplesOf.multipliedBy(repaymentPeriods.size(), mc)); repaymentPeriods.forEach(rp -> { - Money emi = rp.equals(last) ? periodEmi.add(remainder) : periodEmi; + Money emi = rp.equals(last) ? periodEmiInMultiplesOf.add(remainder) : periodEmiInMultiplesOf; rp.setEmi(emi); rp.setOriginalEmi(emi); rp.getInterestPeriods().forEach(InterestPeriod::updateOutstandingLoanBalance);