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


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanDownPaymentHandlerServiceImpl.java:
##########
@@ -127,22 +127,22 @@ public void 
handleRepaymentOrRecoveryOrWaiverTransaction(final Loan loan, final
         final LoanRepaymentScheduleInstallment currentInstallment = loan
                 
.fetchLoanRepaymentScheduleInstallmentByDueDate(loanTransaction.getTransactionDate());
 
-        boolean reprocess = loan.isForeclosure() || 
!isTransactionChronologicallyLatest || adjustedTransaction != null
-                || 
!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate()) || 
currentInstallment == null
-                || 
!currentInstallment.getTotalOutstanding(loan.getCurrency()).isEqualTo(loanTransaction.getAmount(loan.getCurrency()));
-
-        // TODO FINERACT-2220 fix processLatestTransaction to save model.
-        if (loan.isProgressiveSchedule() && loan.isInterestBearing()) {
-            reprocess = true;
-        }
+        boolean reprocess = loan.isProgressiveSchedule()
+                ? (loan.isForeclosure() || !isTransactionChronologicallyLatest 
|| adjustedTransaction != null
+                        || loanTransaction.isReversed() || 
!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate())

Review Comment:
   adjustedTransaction is not null it means the loan transaction is reversed, 
so `loanTransaction.isReversed` is duplicate here.
   
   Also the condition can simplified by moving the "common" conditions prior 
the 'loan.isProgressiveSchedule` or extract them into methods which sole 
purpose to check whether transactions shall be reprocessed



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