FINERACT-2326: Repayment Reversal Failing After Full Repayment of Principal and Fee

This commit is contained in:
mariiaKraievska
2025-09-15 17:40:25 +02:00
committed by Aleksandar Vidakovic
parent 627ccf603f
commit c7f5743b12
3 changed files with 106 additions and 3 deletions
@@ -236,11 +236,16 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen
final int firstNormalInstallmentNumber = LoanRepaymentScheduleProcessingWrapper.fetchFirstNormalInstallmentNumber(installments);
final LoanRepaymentScheduleInstallment currentInstallment = installments.stream()
final Optional<LoanRepaymentScheduleInstallment> currentInstallmentOpt = installments.stream()
.filter(installment -> LoanRepaymentScheduleProcessingWrapper.isInPeriod(loanTransaction.getTransactionDate(), installment,
installment.getInstallmentNumber().equals(firstNormalInstallmentNumber)))
.findFirst().orElseThrow();
.findFirst();
if (currentInstallmentOpt.isEmpty()) {
return;
}
final LoanRepaymentScheduleInstallment currentInstallment = currentInstallmentOpt.get();
if (currentInstallment.isNotFullyPaidOff() && (currentInstallment.getDueDate().isAfter(loanTransaction.getTransactionDate())
|| (currentInstallment.getDueDate().isEqual(loanTransaction.getTransactionDate())
&& loanTransaction.getTransactionDate().equals(DateUtils.getBusinessLocalDate())))) {
@@ -62,7 +62,7 @@ public class LoanStatusChangePlatformServiceImpl implements LoanStatusChangePlat
if (loan.getLoanProductRelatedDetail().isEnableAccrualActivityPosting()) {
LoanStatus oldStatus = event.getOldStatus();
LoanStatus newStatus = loan.getStatus();
if ((oldStatus.isClosed() || oldStatus.isOverpaid()) && newStatus.isActive()) {
if ((oldStatus.isClosedObligationsMet() || oldStatus.isClosed() || oldStatus.isOverpaid()) && newStatus.isActive()) {
loanAccrualActivityProcessingService.processAccrualActivityForLoanReopen(loan);
}
}