FINERACT-2148: Accrual handling in case of backdated Charged-off transaction

This commit is contained in:
Oleksii Novikov
2025-02-27 15:11:08 +01:00
committed by Adam Saghy
parent 53c2cabf01
commit 02c66b180e
2 changed files with 102 additions and 1 deletions
@@ -3119,6 +3119,16 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
this.noteRepository.save(note);
}
loan.getLoanTransactions().stream().filter(LoanTransaction::isAccrual)
.filter(transaction -> loan.getLoanProductRelatedDetail().isInterestRecognitionOnDisbursementDate()
? !DateUtils.isBefore(transaction.getTransactionDate(), transactionDate)
: DateUtils.isAfter(transaction.getTransactionDate(), transactionDate))
.forEach(transaction -> {
transaction.reverse();
final LoanAdjustTransactionBusinessEvent.Data data = new LoanAdjustTransactionBusinessEvent.Data(transaction);
businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(data));
});
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
businessEventNotifierService.notifyPostBusinessEvent(new LoanChargeOffPostBusinessEvent(chargeOffTransaction));
return new CommandProcessingResultBuilder() //