You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/11/17 08:38:42 UTC

[GitHub] [fineract] galovics commented on a diff in pull request #2745: FINERACT-1734-Repayment-due-event

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


##########
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();

Review Comment:
   If it was only about the grace period, wouldn't it make sense to create a separate method over there that skips the grace period handling yet follows the same logic of the existing method?
   So we'd have a `retrieveAllOverdueInstallmentsForLoan` and a `retrieveAllOverdueInstallmentsForLoanWithoutGracePeriod` method (obviously the naming can change).
   
   I'd say this is quite a generic functionality that we might reuse at other places and it would be a shame to reimplement this logic everywhere.



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org