janez89 commented on code in PR #4244:
URL: https://github.com/apache/fineract/pull/4244#discussion_r1923464173


##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/ProgressiveLoanScheduleGenerator.java:
##########
@@ -209,16 +209,23 @@ private List<DisbursementData> 
getSortedDisbursementList(LoanApplicationTerms lo
 
     private void applyInterestRateChangesOnPeriod(final LoanApplicationTerms 
loanApplicationTerms,
             final LoanScheduleModelRepaymentPeriod repaymentPeriod, final 
ProgressiveLoanInterestScheduleModel interestScheduleModel) {
-        if (loanApplicationTerms.getLoanTermVariations() != null) {
-            for (var interestRateChange : 
loanApplicationTerms.getLoanTermVariations().getInterestRateFromInstallment()) {
-                final LocalDate interestRateSubmittedOnDate = 
interestRateChange.getTermVariationApplicableFrom();
-                final BigDecimal newInterestRate = 
interestRateChange.getDecimalValue();
-                if 
(interestRateSubmittedOnDate.isAfter(repaymentPeriod.getFromDate())
-                        && 
!interestRateSubmittedOnDate.isAfter(repaymentPeriod.getDueDate())) {
-                    emiCalculator.changeInterestRate(interestScheduleModel, 
interestRateSubmittedOnDate, newInterestRate);
-                }
-            }
+        if (loanApplicationTerms.getLoanTermVariations() == null) {
+            return;
         }
+
+        
loanApplicationTerms.getLoanTermVariations().getInterestRateFromInstallment().stream()
+                .filter(change -> 
isDateWithinPeriod(change.getTermVariationApplicableFrom(), repaymentPeriod))
+                .forEach(change -> 
emiCalculator.changeInterestRate(interestScheduleModel, 
change.getTermVariationApplicableFrom(),
+                        change.getDecimalValue()));
+
+        
loanApplicationTerms.getLoanTermVariations().getInterestPauseVariations().stream()
+                .filter(pause -> 
isDateWithinPeriod(pause.getTermVariationApplicableFrom(), repaymentPeriod))
+                .forEach(pause -> 
emiCalculator.applyInterestPause(interestScheduleModel, 
pause.getTermVariationApplicableFrom(),
+                        pause.getDateValue(), pause.getDecimalValue()));

Review Comment:
   what represents the `pause.getDecimalValue()` ?



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