adamsaghy commented on code in PR #2745:
URL: https://github.com/apache/fineract/pull/2745#discussion_r1023788446


##########
fineract-provider/src/main/java/org/apache/fineract/cob/loan/CheckLoanRepaymentOverdueBusinessStep.java:
##########
@@ -19,33 +19,30 @@
 package org.apache.fineract.cob.loan;
 
 import java.time.LocalDate;
-import java.util.Collection;
+import java.util.List;
 import lombok.RequiredArgsConstructor;
 import 
org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
 import org.apache.fineract.infrastructure.core.service.DateUtils;
 import 
org.apache.fineract.infrastructure.event.business.domain.loan.LoanRepaymentOverdueBusinessEvent;
 import 
org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
 import org.apache.fineract.portfolio.loanaccount.domain.Loan;
-import 
org.apache.fineract.portfolio.loanaccount.loanschedule.data.OverdueLoanScheduleData;
-import 
org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
+import 
org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
 import org.springframework.stereotype.Component;
 
 @Component
 @RequiredArgsConstructor
 public class CheckLoanRepaymentOverdueBusinessStep implements 
LoanCOBBusinessStep {
 
-    private final LoanReadPlatformService loanReadPlatformService;
     private final ConfigurationDomainService configurationDomainService;
     private final BusinessEventNotifierService businessEventNotifierService;
 
     @Override
     public Loan execute(Loan loan) {
         Long numberOfDaysAfterDueDateToRaiseEvent = 
configurationDomainService.retrieveRepaymentOverdueDays();
         final LocalDate currentDate = DateUtils.getBusinessLocalDate();
-        final Collection<OverdueLoanScheduleData> overdueInstallmentsForLoan = 
loanReadPlatformService
-                .retrieveAllOverdueInstallmentsForLoan(loan);
-        for (OverdueLoanScheduleData overdueInstallment : 
overdueInstallmentsForLoan) {
-            LocalDate installmentDueDate = 
LocalDate.parse(overdueInstallment.getDueDate());
+        final List<LoanRepaymentScheduleInstallment> 
loanRepaymentScheduleInstallments = loan.getRepaymentScheduleInstallments();
+        for (LoanRepaymentScheduleInstallment repaymentSchedule : 
loanRepaymentScheduleInstallments) {
+            LocalDate installmentDueDate = repaymentSchedule.getDueDate();

Review Comment:
   This logic is not sufficient. It will trigger the overdue business event for 
already closed (obligations met) installments as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to