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


##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:
##########
@@ -1877,6 +1886,37 @@ private void 
calculateRateFactorForScheduleTillDateInclusive(ProgressiveLoanInte
                 }));
     }
 
+    /**
+     * Fixed interest (e.g. equal-amortization re-aged periods) bypasses rate 
factors entirely, so unlike
+     * rate-factor-based interest it counts as fully due from day one of its 
period regardless of the target date. An
+     * "as of target date" view of accrued interest has to scale it the same 
way rate factors are truncated: nothing for
+     * periods that have not started yet, and the day-prorated amount for the 
period the target date falls in, so it
+     * grows day by day instead of jumping to the period's full amount 
immediately. Periods already past their due date
+     * keep their full fixed interest, since that is genuinely due.
+     * <p>
+     * This is only valid for a "how much has accrued so far" view. Figures 
that must reflect everything ultimately
+     * payable - payoff and closure amounts, re-aging amounts - need the 
untruncated fixed interest, which is why this
+     * is applied selectively by the callers that want the accrued-to-date 
view rather than inside the shared rate
+     * factor calculation.
+     */
+    private void 
scaleFixedInterestTillDate(ProgressiveLoanInterestScheduleModel 
scheduleModelCopy, LocalDate targetDate) {
+        scheduleModelCopy.repaymentPeriods().forEach(rp -> {
+            if (rp.getFixedInterest().isGreaterThanZero()) {

Review Comment:
   Maybe it`s worth to gate with && rp.isReAged()? 
updateModelForReageEqualAmortization sets reAged=true on exactly the periods 
that later receive fixedInterest, so this does not weaken the fix. It does keep 
scaling off non-re-age uses of fixedInterest (e.g. copyWithoutPaidAmounts / 
accelerate-maturity aggregation).



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