diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java index 3f1430c112..77f1562fef 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java @@ -255,6 +255,7 @@ public void processLatestTransaction(final LoanTransaction loanTransaction, fina case WRITEOFF -> handleWriteOff(loanTransaction, ctx.getCurrency(), ctx.getInstallments()); case REFUND_FOR_ACTIVE_LOAN -> handleRefund(loanTransaction, ctx.getCurrency(), ctx.getInstallments(), ctx.getCharges()); case CHARGEBACK -> handleChargeback(loanTransaction, ctx); + case CHARGE_OFF -> handleChargeOff(loanTransaction, ctx); default -> { Money transactionAmountUnprocessed = handleTransactionAndCharges(loanTransaction, ctx.getCurrency(), ctx.getInstallments(), ctx.getCharges(), null, false); @@ -394,7 +395,7 @@ private void recalculateChargeOffTransaction(ChangedTransactionDetail changedTra principalPortion = principalPortion.plus(currentInstallment.getPrincipalOutstanding(currency)); interestPortion = interestPortion.plus(currentInstallment.getInterestOutstanding(currency)); feeChargesPortion = feeChargesPortion.plus(currentInstallment.getFeeChargesOutstanding(currency)); - penaltychargesPortion = penaltychargesPortion.plus(currentInstallment.getPenaltyChargesCharged(currency)); + penaltychargesPortion = penaltychargesPortion.plus(currentInstallment.getPenaltyChargesOutstanding(currency)); } } @@ -786,6 +787,10 @@ protected void handleChargeback(LoanTransaction loanTransaction, TransactionCtx processCreditTransaction(loanTransaction, ctx.getOverpaymentHolder(), ctx.getCurrency(), ctx.getInstallments()); } + private void handleChargeOff(LoanTransaction loanTransaction, TransactionCtx transactionCtx) { + recalculateChargeOffTransaction(transactionCtx.getChangedTransactionDetail(), loanTransaction, transactionCtx.getCurrency(), transactionCtx.getInstallments()); + } + protected void handleCreditBalanceRefund(LoanTransaction loanTransaction, MonetaryCurrency currency, List installments, MoneyHolder overpaidAmountHolder) { processCreditTransaction(loanTransaction, overpaidAmountHolder, currency, installments);