Skip to content

Commit

Permalink
FINERACT-2148: fix charge off handling
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksii-novikov-onix committed Dec 12, 2024
1 parent 77658c3 commit 552b658
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}
}

Expand Down Expand Up @@ -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<LoanRepaymentScheduleInstallment> installments, MoneyHolder overpaidAmountHolder) {
processCreditTransaction(loanTransaction, overpaidAmountHolder, currency, installments);
Expand Down

0 comments on commit 552b658

Please sign in to comment.