mariiaKraievska commented on code in PR #6109:
URL: https://github.com/apache/fineract/pull/6109#discussion_r3550822046


##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanBreachScheduleServiceImpl.java:
##########
@@ -148,22 +148,21 @@ public boolean evaluateBreachOnDate(final 
WorkingCapitalLoanBreachSchedule perio
 
     @Override
     public void applyRepayment(final Long loanId, final LocalDate 
transactionDate, final BigDecimal amount) {
-        if (loanId == null || transactionDate == null || amount == null) {
-            return;
-        }
         if (isBreachEvaluationDisabled(loanId, 
DateUtils.getBusinessLocalDate())) {
             log.debug("Skipping breach schedule repayment update for WC loan 
{} - breach evaluation is disabled", loanId);
             return;
         }
-        final Optional<LocalDate> lastResetDate = 
activeBreachResetResolver.findLatestActiveResetDate(loanId);
-        if (lastResetDate.isPresent() && 
transactionDate.isBefore(lastResetDate.get())) {
-            log.debug("Ignoring backdated repayment on {} for WC loan {} 
breach schedule (last reset on {})", transactionDate, loanId,
-                    lastResetDate.get());
-            return;
-        }
+
         final Optional<WorkingCapitalLoanBreachSchedule> currentPeriod = 
repository
                 
.findByLoanIdAndFromDateLessThanEqualAndToDateGreaterThanEqual(loanId, 
transactionDate, transactionDate);
-        currentPeriod.ifPresent(period -> applyRepayment(period, amount, 
loanId));
+        currentPeriod.ifPresent(period -> {
+            if (period.isReset()) {

Review Comment:
   Do we set/clear period.reset anywhere during reset/undo? Since this guard 
depends on period.isReset(), but I couldn’t find corresponding 
setReset(true/false) updates Iʼm worring if this guard is effective in practice



-- 
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