Skip to content

Commit

Permalink
FINERACT-2148: Add 'Accelerate maturity' charge-off behaviour option.…
Browse files Browse the repository at this point in the history
… Cut installments to charge-off date
  • Loading branch information
leksinomi committed Dec 13, 2024
1 parent 146c07a commit c14d5a9
Showing 1 changed file with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1171,10 +1171,12 @@ 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())
&& !loanTransaction.isReversed()) {
if (transactionCtx instanceof ProgressiveTransactionCtx progressiveTransactionCtx&& !loanTransaction.isReversed()) {
if (LoanChargeOffBehaviour.ZERO_INTEREST
.equals(loanTransaction.getLoan().getLoanProductRelatedDetail().getChargeOffBehaviour())) {
handleZeroInterestChargeOff(loanTransaction, progressiveTransactionCtx);
} else if (LoanChargeOffBehaviour.ACCELERATE_MATURITY.equals(loanTransaction.getLoan().getLoanProductRelatedDetail().getChargeOffBehaviour())) {
handleAccelerateMaturityChargeOff(loanTransaction, progressiveTransactionCtx);
}
}

Expand All @@ -1197,6 +1199,25 @@ private void handleChargeOff(final LoanTransaction loanTransaction, final Transa
loanTransaction.updateComponentsAndTotal(principalPortion, interestPortion, feeChargesPortion, penaltychargesPortion);
}

private void handleAccelerateMaturityChargeOff(LoanTransaction loanTransaction, ProgressiveTransactionCtx progressiveTransactionCtx) {
final LocalDate transactionDate = loanTransaction.getTransactionDate();
final List<LoanRepaymentScheduleInstallment> installments = progressiveTransactionCtx.getInstallments();
Loan loan = loanTransaction.getLoan();

if (!installments.isEmpty()) {
if (loan.isInterestRecalculationEnabled()) {

} else {

}
List<LoanRepaymentScheduleInstallment> installmentsUpToTransactionDate = installments.stream()
.filter(installment -> transactionDate.isAfter(installment.getFromDate()))
.toList();
loan.updateLoanSchedule(installmentsUpToTransactionDate);

}
}

private void handleZeroInterestChargeOff(final LoanTransaction loanTransaction,
final ProgressiveTransactionCtx progressiveTransactionCtx) {
final LocalDate transactionDate = loanTransaction.getTransactionDate();
Expand Down

0 comments on commit c14d5a9

Please sign in to comment.