FINERACT-1891 - Overdue calculation fix

- [x] Arrears event not called fix
- [x] Integration test
This commit is contained in:
Janos Haber
2023-02-20 10:15:18 +01:00
committed by Arnold Gálovics
parent 5a1c3babcc
commit 89deb6d3b8
2 changed files with 65 additions and 0 deletions
@@ -42,7 +42,9 @@ import org.apache.fineract.infrastructure.event.business.domain.loan.charge.Loan
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanChargePaymentPostBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanForeClosurePostBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanRefundPostBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionGoodwillCreditPostBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionMakeRepaymentPostBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionPayoutRefundPostBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanUndoWrittenOffBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanWaiveInterestBusinessEvent;
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
@@ -75,6 +77,10 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService {
new AdjustTransactionBusinessEventEventListener());
businessEventNotifierService.addPostBusinessEventListener(LoanTransactionMakeRepaymentPostBusinessEvent.class,
new MakeRepaymentEventListener());
businessEventNotifierService.addPostBusinessEventListener(LoanTransactionGoodwillCreditPostBusinessEvent.class,
new GoodwillCreditEventListener());
businessEventNotifierService.addPostBusinessEventListener(LoanTransactionPayoutRefundPostBusinessEvent.class,
new PaymentRefundEventListener());
businessEventNotifierService.addPostBusinessEventListener(LoanUndoWrittenOffBusinessEvent.class, new UndoWrittenOffEventListener());
businessEventNotifierService.addPostBusinessEventListener(LoanWaiveInterestBusinessEvent.class, new WaiveInterestEventListener());
businessEventNotifierService.addPostBusinessEventListener(LoanAddChargeBusinessEvent.class, new AddChargeEventListener());
@@ -497,4 +503,24 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService {
updateLoanArrearsAgeingDetails(loan);
}
}
private class GoodwillCreditEventListener implements BusinessEventListener<LoanTransactionGoodwillCreditPostBusinessEvent> {
@Override
public void onBusinessEvent(LoanTransactionGoodwillCreditPostBusinessEvent event) {
LoanTransaction loanTransaction = event.get();
Loan loan = loanTransaction.getLoan();
handleArrearsForLoan(loan);
}
}
private class PaymentRefundEventListener implements BusinessEventListener<LoanTransactionPayoutRefundPostBusinessEvent> {
@Override
public void onBusinessEvent(LoanTransactionPayoutRefundPostBusinessEvent event) {
LoanTransaction loanTransaction = event.get();
Loan loan = loanTransaction.getLoan();
handleArrearsForLoan(loan);
}
}
}