FINERACT-2354: Work with DTOs instead of entities inside ProgressiveEMICalculator
This commit is contained in:
+6
-5
@@ -53,13 +53,13 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanCapitalizedIncomeCal
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanCapitalizedIncomeStrategy;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanCapitalizedIncomeType;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanChargeOffBehaviour;
|
||||
import org.apache.fineract.portfolio.loanproduct.data.LoanProductRelatedDetailMinimumData;
|
||||
import org.apache.fineract.portfolio.loanproduct.data.LoanConfigurationDetails;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.AmortizationMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.ILoanConfigurationDetails;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestCalculationPeriodMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestRecalculationCompoundingMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreCloseInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductMinimumRepaymentScheduleRelatedDetail;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRelatedDetail;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanRescheduleStrategyMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanSupportedInterestRefundTypes;
|
||||
@@ -1694,15 +1694,16 @@ public final class LoanApplicationTerms {
|
||||
this.buyDownFeeStrategy, this.buyDownFeeIncomeType, this.merchantBuyDownFee);
|
||||
}
|
||||
|
||||
public LoanProductMinimumRepaymentScheduleRelatedDetail toLoanProductRelatedDetailMinimumData() {
|
||||
public ILoanConfigurationDetails toLoanConfigurationDetails() {
|
||||
final CurrencyData currency = new CurrencyData(this.currency.getCode(), this.currency.getDecimalPlaces(),
|
||||
this.currency.getInMultiplesOf());
|
||||
return new LoanProductRelatedDetailMinimumData(currency, interestRatePerPeriod, annualNominalInterestRate, interestChargingGrace,
|
||||
return new LoanConfigurationDetails(currency, interestRatePerPeriod, annualNominalInterestRate, interestChargingGrace,
|
||||
interestPaymentGrace, principalGrace, recurringMoratoriumOnPrincipalPeriods, interestMethod,
|
||||
interestCalculationPeriodMethod, daysInYearType, daysInMonthType, amortizationMethod, repaymentPeriodFrequencyType,
|
||||
repaymentEvery, numberOfRepayments,
|
||||
isInterestChargedFromDateSameAsDisbursalDateEnabled != null && isInterestChargedFromDateSameAsDisbursalDateEnabled,
|
||||
daysInYearCustomStrategy, allowPartialPeriodInterestCalcualtion);
|
||||
daysInYearCustomStrategy, allowPartialPeriodInterestCalcualtion, interestRecalculationEnabled, recalculationFrequencyType,
|
||||
preClosureInterestCalculationStrategy);
|
||||
}
|
||||
|
||||
public Integer getLoanTermFrequency() {
|
||||
|
||||
+20
-5
@@ -19,17 +19,20 @@
|
||||
package org.apache.fineract.portfolio.loanproduct.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.apache.fineract.portfolio.common.domain.DaysInMonthType;
|
||||
import org.apache.fineract.portfolio.common.domain.DaysInYearCustomStrategyType;
|
||||
import org.apache.fineract.portfolio.common.domain.DaysInYearType;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.AmortizationMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.ILoanConfigurationDetails;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestCalculationPeriodMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductMinimumRepaymentScheduleRelatedDetail;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreCloseInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.RecalculationFrequencyType;
|
||||
|
||||
public class LoanProductRelatedDetailMinimumData implements LoanProductMinimumRepaymentScheduleRelatedDetail {
|
||||
public class LoanConfigurationDetails implements ILoanConfigurationDetails {
|
||||
|
||||
private final CurrencyData currency;
|
||||
private final BigDecimal interestRatePerPeriod;
|
||||
@@ -49,14 +52,22 @@ public class LoanProductRelatedDetailMinimumData implements LoanProductMinimumRe
|
||||
private final boolean interestRecognitionOnDisbursementDate;
|
||||
private final DaysInYearCustomStrategyType daysInYearCustomStrategy;
|
||||
private final boolean allowPartialPeriodInterestCalculation;
|
||||
@Getter
|
||||
private final boolean isInterestRecalculationEnabled;
|
||||
@Getter
|
||||
private final RecalculationFrequencyType restFrequencyType;
|
||||
@Getter
|
||||
private final LoanPreCloseInterestCalculationStrategy preCloseInterestCalculationStrategy;
|
||||
|
||||
public LoanProductRelatedDetailMinimumData(CurrencyData currency, BigDecimal interestRatePerPeriod,
|
||||
BigDecimal annualNominalInterestRate, Integer interestChargingGrace, Integer interestPaymentGrace, Integer principalGrace,
|
||||
public LoanConfigurationDetails(CurrencyData currency, BigDecimal interestRatePerPeriod, BigDecimal annualNominalInterestRate,
|
||||
Integer interestChargingGrace, Integer interestPaymentGrace, Integer principalGrace,
|
||||
Integer recurringMoratoriumOnPrincipalPeriods, InterestMethod interestMethod,
|
||||
InterestCalculationPeriodMethod interestCalculationPeriodMethod, DaysInYearType daysInYearType, DaysInMonthType daysInMonthType,
|
||||
AmortizationMethod amortizationMethod, PeriodFrequencyType repaymentPeriodFrequencyType, Integer repaymentEvery,
|
||||
Integer numberOfRepayments, boolean interestRecognitionOnDisbursementDate,
|
||||
DaysInYearCustomStrategyType daysInYearCustomStrategy, boolean allowPartialPeriodInterestCalculation) {
|
||||
DaysInYearCustomStrategyType daysInYearCustomStrategy, boolean allowPartialPeriodInterestCalculation,
|
||||
boolean isInterestRecalculationEnabled, RecalculationFrequencyType restFrequencyType,
|
||||
LoanPreCloseInterestCalculationStrategy preCloseInterestCalculationStrategy) {
|
||||
this.currency = currency;
|
||||
this.interestRatePerPeriod = interestRatePerPeriod;
|
||||
this.annualNominalInterestRate = annualNominalInterestRate;
|
||||
@@ -75,6 +86,9 @@ public class LoanProductRelatedDetailMinimumData implements LoanProductMinimumRe
|
||||
this.interestRecognitionOnDisbursementDate = interestRecognitionOnDisbursementDate;
|
||||
this.daysInYearCustomStrategy = daysInYearCustomStrategy;
|
||||
this.allowPartialPeriodInterestCalculation = allowPartialPeriodInterestCalculation;
|
||||
this.isInterestRecalculationEnabled = isInterestRecalculationEnabled;
|
||||
this.restFrequencyType = restFrequencyType;
|
||||
this.preCloseInterestCalculationStrategy = preCloseInterestCalculationStrategy;
|
||||
}
|
||||
|
||||
private Integer defaultToNullIfZero(final Integer value) {
|
||||
@@ -184,4 +198,5 @@ public class LoanProductRelatedDetailMinimumData implements LoanProductMinimumRe
|
||||
public DaysInYearCustomStrategyType getDaysInYearCustomStrategy() {
|
||||
return daysInYearCustomStrategy;
|
||||
}
|
||||
|
||||
}
|
||||
+7
-1
@@ -26,7 +26,7 @@ import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
/**
|
||||
* Represents the bare minimum repayment details needed for activities related to generating repayment schedules.
|
||||
*/
|
||||
public interface LoanProductMinimumRepaymentScheduleRelatedDetail {
|
||||
public interface ILoanConfigurationDetails {
|
||||
|
||||
CurrencyData getCurrencyData();
|
||||
|
||||
@@ -67,4 +67,10 @@ public interface LoanProductMinimumRepaymentScheduleRelatedDetail {
|
||||
boolean isInterestRecognitionOnDisbursementDate();
|
||||
|
||||
DaysInYearCustomStrategyType getDaysInYearCustomStrategy();
|
||||
|
||||
boolean isInterestRecalculationEnabled();
|
||||
|
||||
RecalculationFrequencyType getRestFrequencyType();
|
||||
|
||||
LoanPreCloseInterestCalculationStrategy getPreCloseInterestCalculationStrategy();
|
||||
}
|
||||
+1
-9
@@ -53,7 +53,7 @@ import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanSchedul
|
||||
@Embeddable
|
||||
@Getter
|
||||
@Setter
|
||||
public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentScheduleRelatedDetail {
|
||||
public class LoanProductRelatedDetail {
|
||||
|
||||
@Embedded
|
||||
private MonetaryCurrency currency;
|
||||
@@ -329,7 +329,6 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
return this.currency.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurrencyData getCurrencyData() {
|
||||
return currency.toData();
|
||||
}
|
||||
@@ -342,27 +341,20 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
return Money.of(getCurrencyData(), this.inArrearsTolerance);
|
||||
}
|
||||
|
||||
// TODO: REVIEW
|
||||
@Override
|
||||
public BigDecimal getNominalInterestRatePerPeriod() {
|
||||
return this.nominalInterestRatePerPeriod == null ? null
|
||||
: BigDecimal.valueOf(Double.parseDouble(this.nominalInterestRatePerPeriod.stripTrailingZeros().toString()));
|
||||
}
|
||||
|
||||
// TODO: REVIEW
|
||||
@Override
|
||||
public PeriodFrequencyType getInterestPeriodFrequencyType() {
|
||||
return this.interestPeriodFrequencyType == null ? PeriodFrequencyType.INVALID : this.interestPeriodFrequencyType;
|
||||
}
|
||||
|
||||
// TODO: REVIEW
|
||||
@Override
|
||||
public BigDecimal getAnnualNominalInterestRate() {
|
||||
return this.annualNominalInterestRate == null ? null
|
||||
: BigDecimal.valueOf(Double.parseDouble(this.annualNominalInterestRate.stripTrailingZeros().toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DaysInYearCustomStrategyType getDaysInYearCustomStrategy() {
|
||||
return daysInYearCustomStrategy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user