diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanTransactionValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanTransactionValidator.java index 2b3d81e889b..6ee3a812eeb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanTransactionValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanTransactionValidator.java @@ -84,6 +84,7 @@ import org.apache.fineract.portfolio.loanaccount.exception.LoanDisbursalException; import org.apache.fineract.portfolio.loanaccount.exception.LoanNotFoundException; import org.apache.fineract.portfolio.loanaccount.exception.LoanRepaymentScheduleNotFoundException; +import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType; import org.apache.fineract.portfolio.loanaccount.service.LoanUtilService; import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct; import org.jetbrains.annotations.NotNull; @@ -778,7 +779,8 @@ public void validateClientOfficeJoiningDateIsBeforeTransactionDate(Loan loan, Lo } public void validateActivityNotBeforeLastTransactionDate(final Loan loan, final LocalDate activityDate, final LoanEvent event) { - if (!(loan.repaymentScheduleDetail().isInterestRecalculationEnabled() || loan.loanProduct().isHoldGuaranteeFunds())) { + if (!(loan.repaymentScheduleDetail().isInterestRecalculationEnabled() || loan.loanProduct().isHoldGuaranteeFunds()) + || !loan.getLoanRepaymentScheduleDetail().getLoanScheduleType().equals(LoanScheduleType.CUMULATIVE)) { return; } LocalDate lastTransactionDate = loan.getLastUserTransactionDate(); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionBackdatedProgressiveTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionBackdatedProgressiveTest.java index e5f520d123c..52598308719 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionBackdatedProgressiveTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionBackdatedProgressiveTest.java @@ -105,4 +105,14 @@ public void testProgressiveBackdatedGoodwillCredit() { }); } + @Test + public void testProgressiveBackdatedInterestPaymentWaiver() { + runAt("01 July 2024", () -> { + loanTransactionHelper.makeInterestPaymentWaiver(loanId, new PostLoansLoanIdTransactionsRequest().dateFormat(DATETIME_PATTERN) + .transactionDate("5 June 2024").locale("en").transactionAmount(100.0)); + + GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanId); + Assertions.assertTrue(loanDetails.getTransactions().size() >= 2); + }); + } }