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


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -1242,6 +1243,25 @@ public Set<LoanCharge> getActiveCharges() {
         return this.charges == null ? new HashSet<>() : 
this.charges.stream().filter(LoanCharge::isActive).collect(Collectors.toSet());
     }
 
+    public boolean hasChargesAffectedByBackdatedRepayment(@NonNull final 
LoanTransaction transaction) {
+        if (!transaction.isRepayment()) {
+            return false;
+        }
+
+        if (this.charges == null || this.charges.isEmpty()) {
+            return false;
+        }
+
+        final boolean isBackdatedTransaction = 
DateUtils.isBeforeBusinessDate(transaction.getTransactionDate());
+
+        if (isBackdatedTransaction) {

Review Comment:
   We only need to do this check if the loan is progressive type.
   
   You can filter and check the charges based on whether they are:
   - specific due date type
   - overdue installment charge type
   
   We should compare the charge 
   - if due date of charge is on or later than submitted on date of charge then 
compare submitted on date of charge  with transaction date
   - if due date of charge is earlier than submitted on date of charge then 
compare due date of charge with transaction date
   
   Probably we can use a BiFunction to use the earlier one...



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