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 27bb50d75a..0d47a4f6c0 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 @@ -3572,4 +3572,10 @@ public LoanRepaymentScheduleTransactionProcessor getTransactionProcessor() { public boolean isProgressiveSchedule() { return getLoanProductRelatedDetail().getLoanScheduleType() == PROGRESSIVE; } + + public boolean isTransactionBeforeZeroInterestChargeOff(final LoanTransaction transaction) { + return !this.isChargedOff() + || !LoanChargeOffBehaviour.ZERO_INTEREST.equals(this.getLoanProductRelatedDetail().getChargeOffBehaviour()) + || !transaction.getTransactionDate().isAfter(this.getChargedOffOnDate()); + } } 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 d08bb6288f..016c75d759 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 @@ -1583,7 +1583,8 @@ private Money processAllocationsHorizontally(LoanTransaction loanTransaction, Tr transactionMappings, loanTransaction, oldestPastDueInstallment, currency); Loan loan = loanTransaction.getLoan(); if (transactionCtx instanceof ProgressiveTransactionCtx ctx && loan.isInterestBearing() - && loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled()) { + && loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled() + && loanTransaction.getLoan().isTransactionBeforeZeroInterestChargeOff(loanTransaction)) { paidPortion = handlingPaymentAllocationForInterestBearingProgressiveLoan(loanTransaction, transactionAmountUnprocessed, balances, paymentAllocationType, oldestPastDueInstallment, ctx, loanTransactionToRepaymentScheduleMapping, oldestPastDueInstallmentCharges); @@ -1605,7 +1606,8 @@ private Money processAllocationsHorizontally(LoanTransaction loanTransaction, Tr transactionMappings, loanTransaction, dueInstallment, currency); Loan loan = loanTransaction.getLoan(); if (transactionCtx instanceof ProgressiveTransactionCtx ctx && loan.isInterestBearing() - && loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled()) { + && loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled() + && loanTransaction.getLoan().isTransactionBeforeZeroInterestChargeOff(loanTransaction)) { paidPortion = handlingPaymentAllocationForInterestBearingProgressiveLoan(loanTransaction, transactionAmountUnprocessed, balances, paymentAllocationType, dueInstallment, ctx, loanTransactionToRepaymentScheduleMapping, dueInstallmentCharges); @@ -1636,7 +1638,8 @@ private Money processAllocationsHorizontally(LoanTransaction loanTransaction, Tr Loan loan = loanTransaction.getLoan(); if (transactionCtx instanceof ProgressiveTransactionCtx ctx && loan.isInterestBearing() - && loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled()) { + && loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled() + && loanTransaction.getLoan().isTransactionBeforeZeroInterestChargeOff(loanTransaction)) { paidPortion = handlingPaymentAllocationForInterestBearingProgressiveLoan(loanTransaction, evenPortion, balances, paymentAllocationType, inAdvanceInstallment, ctx, loanTransactionToRepaymentScheduleMapping, inAdvanceInstallmentCharges);