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


##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/data/ProgressiveLoanInterestScheduleModel.java:
##########
@@ -19,45 +19,167 @@
 package org.apache.fineract.portfolio.loanaccount.loanschedule.data;
 
 import java.math.BigDecimal;
-import java.math.MathContext;
 import java.time.LocalDate;
 import java.time.temporal.ChronoUnit;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
+import java.util.Optional;
+import java.util.function.Consumer;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.fineract.organisation.monetary.domain.Money;
 import 
org.apache.fineract.portfolio.loanproduct.domain.LoanProductRelatedDetail;
 
-public record 
ProgressiveLoanInterestScheduleModel(List<ProgressiveLoanInterestRepaymentModel>
 repayments, //
-        List<ProgressiveLoanInterestRate> interestRates, //
-        LoanProductRelatedDetail loanProductRelatedDetail, //
-        Integer installmentAmountInMultiplesOf, //
-        MathContext mc) {
+@Data
+@Accessors(fluent = true)
+public class ProgressiveLoanInterestScheduleModel {
 
-    public 
ProgressiveLoanInterestScheduleModel(List<ProgressiveLoanInterestRepaymentModel>
 repayments,
-            LoanProductRelatedDetail loanProductRelatedDetail, Integer 
installmentAmountInMultiplesOf, MathContext mc) {
-        this(repayments, new ArrayList<>(1), loanProductRelatedDetail, 
installmentAmountInMultiplesOf, mc);
+    private final List<RepaymentPeriod> repaymentPeriods;
+    private final List<InterestRate> interestRates;
+    private final LoanProductRelatedDetail loanProductRelatedDetail;
+    private final Integer installmentAmountInMultiplesOf;
+
+    public ProgressiveLoanInterestScheduleModel(List<RepaymentPeriod> 
repaymentPeriods, LoanProductRelatedDetail loanProductRelatedDetail,
+            Integer installmentAmountInMultiplesOf) {
+        this.repaymentPeriods = repaymentPeriods;

Review Comment:
   The 1st constructor is just for initialization, the 2nd constructor does. 
   That constructor calls the `copyRepaymentPeriods ` and just the logic itself 
is isolated well and extracted into a method.



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