From 37fcc7d199d3c56549e2f1d01d329ecaea077b9b Mon Sep 17 00:00:00 2001 From: Farooq Date: Sun, 22 Dec 2024 22:32:58 +0100 Subject: [PATCH] =?UTF-8?q?[SU-535]=20Generate=20"CANCELACI=C3=93N=20DEFIN?= =?UTF-8?q?ITIVA=20POR=20REESTRUCTURACI=C3=93N"=20Event=20on=20Top-Up=20Lo?= =?UTF-8?q?an=20Closure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/LoanWritePlatformServiceJpaRepositoryImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java index 332f6aa702..8eb8659908 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -1397,6 +1397,10 @@ private void handleDefinitiveRestructuringCancellation(Loan loan, InsuranceIncid if (!doesIncidentExist) { LoanCharge loanCharge = loan.getLoanCharges().stream() .filter(charge -> isChargeEligibleForNoveltyNews(charge, loan.getCurrency(), incident)).findFirst().orElse(null); + if (loanCharge == null) { + log.warn("No loan charge found for loan with id: {} and incident type: {}", loan.getId(), incident.getIncidentType()); + return; + } InsuranceIncidentNoveltyNews noveltyNews = InsuranceIncidentNoveltyNews.instance(loan, loanCharge, null, incident, transactionDate, BigDecimal.ZERO); this.insuranceIncidentNoveltyNewsRepository.saveAndFlush(noveltyNews);