Skip to content

Commit

Permalink
FINERACT-2148: Fix undoChargeOff method for zero interest behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksii-novikov-onix committed Dec 13, 2024
1 parent da87272 commit cb89cf1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1588,8 +1588,11 @@ public List<LoanTransaction> retrieveListOfTransactionsForReprocessing() {
}

private static Predicate<LoanTransaction> loanTransactionForReprocessingPredicate() {
return transaction -> transaction.isNotReversed() && (transaction.isChargeOff() || transaction.isReAge()
|| transaction.isAccrualActivity() || transaction.isReAmortize() || !transaction.isNonMonetaryTransaction());
return transaction -> transaction.isNotReversed()
&& (transaction.isChargeOff() || transaction.isReAge() || transaction.isAccrualActivity() || transaction.isReAmortize()
|| !transaction.isNonMonetaryTransaction())
|| transaction.isReversed() && transaction.isChargeOff() && LoanChargeOffBehaviour.ZERO_INTEREST
.equals(transaction.getLoan().getLoanProductRelatedDetail().getChargeOffBehaviour());
}

public List<LoanTransaction> retrieveListOfTransactionsExcludeAccruals() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1172,8 +1172,8 @@ private void handleOverpayment(Money overpaymentPortion, LoanTransaction loanTra

private void handleChargeOff(final LoanTransaction loanTransaction, final TransactionCtx transactionCtx) {
if (transactionCtx instanceof ProgressiveTransactionCtx progressiveTransactionCtx) {
if (LoanChargeOffBehaviour.ZERO_INTEREST
.equals(loanTransaction.getLoan().getLoanProductRelatedDetail().getChargeOffBehaviour())) {
if (LoanChargeOffBehaviour.ZERO_INTEREST.equals(loanTransaction.getLoan().getLoanProductRelatedDetail().getChargeOffBehaviour())
&& !loanTransaction.isReversed()) {
handleZeroInterestChargeOff(loanTransaction, progressiveTransactionCtx);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3348,6 +3348,9 @@ public CommandProcessingResult undoChargeOff(JsonCommand command) {
saveLoanWithDataIntegrityViolationChecks(loan);
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
businessEventNotifierService.notifyPostBusinessEvent(new LoanUndoChargeOffBusinessEvent(chargedOffTransaction));

loan.reprocessTransactions();

return new CommandProcessingResultBuilder() //
.withOfficeId(loan.getOfficeId()) //
.withClientId(loan.getClientId()) //
Expand Down

0 comments on commit cb89cf1

Please sign in to comment.