From d5200b5ff366ee7153c790405f14c4febf8c7882 Mon Sep 17 00:00:00 2001 From: Faheem Ahmad Date: Sun, 22 Dec 2024 02:42:15 +0500 Subject: [PATCH] SU-530 (#1421) * SU-530 repayment schedule missalignement on rollback of transactions with grace period installments fixed --- ...stractCumulativeLoanScheduleGenerator.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java index 1d6bb5ee91..70213e3a94 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java @@ -331,10 +331,16 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe Money outstandingBalance = scheduleParams.getOutstandingBalanceAsPerRest(); final int periodNumber = scheduleParams.getPeriodNumber(); Integer ignoreInstallment = loanApplicationTerms.getNumberOfInstallmentsToIgnore(); - if (ignoreInstallment != null && ignoreInstallment < periodNumber) { - outstandingBalance = outstandingBalance.plus(cumulatingInterestPaymentDueToGrace); - cumulatingInterestPaymentDueToGrace = Money.zero(currency); - } + // SU-530 commenting below code for now because the implementation is not correct. + // 1. Grace interest should not be added to outstanding balance. + // 2. Implementation of checkbox on product level to calculate interest from disbursement date or from grace + // period end date is violated here + // because this check has never been implemented. For now cumulatingInterestPaymentDueToGrace should be 0 + // if (ignoreInstallment != null && ignoreInstallment < periodNumber) { + // outstandingBalance = outstandingBalance.plus(cumulatingInterestPaymentDueToGrace); + // cumulatingInterestPaymentDueToGrace = Money.zero(currency); + // } + cumulatingInterestPaymentDueToGrace = Money.zero(currency); final TreeMap principalVariation = mergeVariationsToMap(loanApplicationTerms, scheduleParams); final Map compoundingMap = scheduleParams.getCompoundingMap(); final LocalDate periodEndDate = scheduledDueDate; @@ -3128,8 +3134,9 @@ private LoanScheduleDTO rescheduleNextInstallmentsForProgressiveLoans(final Math if (installment.isFullyGraced()) { periods.add(createLoanScheduleModelDownPaymentPeriod(installment, outstandingBalance)); newRepaymentScheduleInstallments.add(installment); - actualRepaymentDate = getScheduledDateGenerator().generateNextRepaymentDate(actualRepaymentDate, loanApplicationTerms, - isFirstRepayment); + actualRepaymentDate = installment.getDueDate(); + periodStartDate = installment.getDueDate(); + periodNumber++; continue; } if (installment.isDownPayment()) {