FINERACT-1971: Delinquency evaluation should be happen only for Active loans in COB

This commit is contained in:
Jose Alberto Hernandez
2024-02-29 17:36:20 +01:00
committed by Adam Saghy
parent 84afccc1f7
commit fc0fee1e6a
2 changed files with 66 additions and 2 deletions
@@ -160,7 +160,13 @@ public class DelinquencyWritePlatformServiceImpl implements DelinquencyWritePlat
if (loan == null) {
loan = this.loanRepository.findOneWithNotFoundDetection(loanScheduleDelinquencyData.getLoanId());
}
final CollectionData collectionData = loanDelinquencyDomainService.getOverdueCollectionData(loan, effectiveDelinquencyList);
CollectionData collectionData = null;
// If the Loan is not Active yet, return template data
if (loan.isSubmittedAndPendingApproval() || loan.isApproved()) {
collectionData = CollectionData.template();
} else {
collectionData = loanDelinquencyDomainService.getOverdueCollectionData(loan, effectiveDelinquencyList);
}
log.debug("Delinquency {}", collectionData);
return new LoanScheduleDelinquencyData(loan.getId(), collectionData.getDelinquentDate(), collectionData.getDelinquentDays(), loan);
}