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


##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:
##########
@@ -188,13 +191,60 @@ public void 
payPrincipal(ProgressiveLoanInterestScheduleModel scheduleModel, Loc
         repaymentPeriod.ifPresent(rp -> {
             // If any period total paid > calculated EMI, then set EMI to 
total paid -> effectively it is marked as
             // fully paid
-            if (rp.getTotalPaidAmount().compareTo(rp.getEmi()) > 0) {
-                rp.setEmi(rp.getTotalPaidAmount());
+            if (rp.getTotalPaidAmount().isGreaterThan(rp.getCalculatedEmi())) {
+                rp.setEmi(rp.getTotalCountablePaidAmount());
                 calculateLastUnpaidRepaymentPeriodEMI(scheduleModel);
             }
         });
     }
 
+    private void 
addChargebackAmountsToInterestPeriod(ProgressiveLoanInterestScheduleModel 
scheduleModel, LocalDate transactionDate,
+            Money chargebackPrincipalAmount, Money chargeBackInterestAmount) {
+        
scheduleModel.repaymentPeriods().stream().filter(checkRepaymentPeriodIsInChargebackRange(scheduleModel,
 transactionDate))
+                .findFirst()
+                .flatMap(repaymentPeriod -> 
repaymentPeriod.getInterestPeriods().stream()
+                        .filter(interestPeriod -> 
interestPeriod.getFromDate().equals(transactionDate)).reduce((v1, v2) -> v2))

Review Comment:
   Can multiple interest period has the same from date?



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