adamsaghy commented on code in PR #5053:
URL: https://github.com/apache/fineract/pull/5053#discussion_r2464861444
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:
##########
@@ -559,6 +566,92 @@ private void
calculateEMIValueAndRateFactorsForDecliningBalanceInterestMethod(fi
}
}
+ @Override
+ public void updateModelRepaymentPeriodsDuringReAge(final
ProgressiveLoanInterestScheduleModel scheduleModel,
+ final LoanTransaction loanTransaction, final LoanApplicationTerms
loanApplicationTerms, final MathContext mc) {
+ final LoanReAgeParameter loanReAgeParameter =
loanTransaction.getLoanReAgeParameter();
+ final LocalDate reAgingStartDate = loanReAgeParameter.getStartDate();
+ final LocalDate transactionDate = loanTransaction.getTransactionDate();
+ final List<RepaymentPeriod> existingRepaymentPeriods =
scheduleModel.repaymentPeriods();
+
+ final List<RepaymentPeriod> periodsBeforeReAging =
existingRepaymentPeriods.stream()
+ .filter(rp -> rp.getFromDate().isBefore(reAgingStartDate) &&
!rp.isFullyPaid()).toList();
+
+ periodsBeforeReAging.forEach(rp -> {
+ final InterestPeriod lastInterestPeriod =
rp.getInterestPeriods().getLast();
+
lastInterestPeriod.addBalanceCorrectionAmount(rp.getOutstandingPrincipal().negated());
+ rp.setEmi(rp.getTotalPaidAmount());
+ });
Review Comment:
Please extract into a method and leave a short description what it does.
--
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]