MIFOSX-141: move accountingType out of embedded class which is for fields common to both loan product and loan and move back into loan product only.
This commit is contained in:
+1
-1
@@ -57,6 +57,6 @@ public class LoanProductRelatedDetailAssembler {
|
|||||||
|
|
||||||
return new LoanProductRelatedDetail(currency, principalAmount, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
return new LoanProductRelatedDetail(currency, principalAmount, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||||
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||||
defaultNumberOfInstallments, amortizationMethod, inArrearsTolerance, null);
|
defaultNumberOfInstallments, amortizationMethod, inArrearsTolerance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+17
-4
@@ -58,6 +58,9 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
@Embedded
|
@Embedded
|
||||||
private final LoanProductRelatedDetail loanProductRelatedDetail;
|
private final LoanProductRelatedDetail loanProductRelatedDetail;
|
||||||
|
|
||||||
|
@Column(name = "accounting_type", nullable = false)
|
||||||
|
private Integer accountingType;
|
||||||
|
|
||||||
public static LoanProduct assembleFromJson(final Fund fund, final LoanTransactionProcessingStrategy loanTransactionProcessingStrategy,
|
public static LoanProduct assembleFromJson(final Fund fund, final LoanTransactionProcessingStrategy loanTransactionProcessingStrategy,
|
||||||
final Set<Charge> productCharges, final JsonCommand command, final AprCalculator aprCalculator) {
|
final Set<Charge> productCharges, final JsonCommand command, final AprCalculator aprCalculator) {
|
||||||
|
|
||||||
@@ -83,8 +86,7 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
final Integer repaymentEvery = command.integerValueOfParameterNamed("repaymentEvery");
|
final Integer repaymentEvery = command.integerValueOfParameterNamed("repaymentEvery");
|
||||||
final Integer numberOfRepayments = command.integerValueOfParameterNamed("numberOfRepayments");
|
final Integer numberOfRepayments = command.integerValueOfParameterNamed("numberOfRepayments");
|
||||||
final BigDecimal inArrearsTolerance = command.bigDecimalValueOfParameterNamed("inArrearsTolerance");
|
final BigDecimal inArrearsTolerance = command.bigDecimalValueOfParameterNamed("inArrearsTolerance");
|
||||||
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(command
|
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(command.integerValueOfParameterNamed("accountingType"));
|
||||||
.integerValueOfParameterNamed("accountingType"));
|
|
||||||
|
|
||||||
return new LoanProduct(fund, loanTransactionProcessingStrategy, name, description, currency, principal, interestRatePerPeriod,
|
return new LoanProduct(fund, loanTransactionProcessingStrategy, name, description, currency, principal, interestRatePerPeriod,
|
||||||
interestFrequencyType, annualInterestRate, interestMethod, interestCalculationPeriodMethod, repaymentEvery,
|
interestFrequencyType, annualInterestRate, interestMethod, interestCalculationPeriodMethod, repaymentEvery,
|
||||||
@@ -118,7 +120,11 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
|
|
||||||
this.loanProductRelatedDetail = new LoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod,
|
this.loanProductRelatedDetail = new LoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod,
|
||||||
interestPeriodFrequencyType, defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery,
|
interestPeriodFrequencyType, defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery,
|
||||||
repaymentFrequencyType, defaultNumberOfInstallments, amortizationMethod, inArrearsTolerance, accountingRuleType);
|
repaymentFrequencyType, defaultNumberOfInstallments, amortizationMethod, inArrearsTolerance);
|
||||||
|
|
||||||
|
if (accountingRuleType != null) {
|
||||||
|
this.accountingType = accountingRuleType.getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MonetaryCurrency getCurrency() {
|
public MonetaryCurrency getCurrency() {
|
||||||
@@ -128,7 +134,7 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
public Set<Charge> getCharges() {
|
public Set<Charge> getCharges() {
|
||||||
return charges;
|
return charges;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(final Fund fund) {
|
public void update(final Fund fund) {
|
||||||
this.fund = fund;
|
this.fund = fund;
|
||||||
}
|
}
|
||||||
@@ -145,6 +151,13 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
|
|
||||||
final Map<String, Object> actualChanges = this.loanProductRelatedDetail.update(command, aprCalculator);
|
final Map<String, Object> actualChanges = this.loanProductRelatedDetail.update(command, aprCalculator);
|
||||||
|
|
||||||
|
final String accountingTypeParamName = "accountingType";
|
||||||
|
if (command.isChangeInIntegerParameterNamed(accountingTypeParamName, this.accountingType)) {
|
||||||
|
final Integer newValue = command.integerValueOfParameterNamed(accountingTypeParamName);
|
||||||
|
actualChanges.put(accountingTypeParamName, newValue);
|
||||||
|
this.accountingType = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
final String nameParamName = "name";
|
final String nameParamName = "name";
|
||||||
if (command.isChangeInStringParameterNamed(nameParamName, this.name)) {
|
if (command.isChangeInStringParameterNamed(nameParamName, this.name)) {
|
||||||
final String newValue = command.stringValueOfParameterNamed(nameParamName);
|
final String newValue = command.stringValueOfParameterNamed(nameParamName);
|
||||||
|
|||||||
+2
-34
@@ -73,23 +73,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
|||||||
|
|
||||||
@Column(name = "arrearstolerance_amount", scale = 6, precision = 19, nullable = true)
|
@Column(name = "arrearstolerance_amount", scale = 6, precision = 19, nullable = true)
|
||||||
private BigDecimal inArrearsTolerance;
|
private BigDecimal inArrearsTolerance;
|
||||||
|
|
||||||
@Column(name = "accounting_type", nullable = false)
|
|
||||||
private Integer accountingType;
|
|
||||||
|
|
||||||
public static LoanProductRelatedDetail createFrom(final MonetaryCurrency currency, final BigDecimal principal,
|
|
||||||
final BigDecimal nominalInterestRatePerPeriod, final PeriodFrequencyType interestRatePeriodFrequencyType,
|
|
||||||
final BigDecimal nominalAnnualInterestRate, final InterestMethod interestMethod,
|
|
||||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final Integer repaymentEvery,
|
|
||||||
final PeriodFrequencyType repaymentPeriodFrequencyType, final Integer numberOfRepayments,
|
|
||||||
final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance,
|
|
||||||
final AccountingRuleType accountingRuleType) {
|
|
||||||
|
|
||||||
return new LoanProductRelatedDetail(currency, principal, nominalInterestRatePerPeriod, interestRatePeriodFrequencyType,
|
|
||||||
nominalAnnualInterestRate, interestMethod, interestCalculationPeriodMethod, repaymentEvery, repaymentPeriodFrequencyType,
|
|
||||||
numberOfRepayments, amortizationMethod, inArrearsTolerance, accountingRuleType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LoanProductRelatedDetail createFrom(final MonetaryCurrency currency, final BigDecimal principal,
|
public static LoanProductRelatedDetail createFrom(final MonetaryCurrency currency, final BigDecimal principal,
|
||||||
final BigDecimal nominalInterestRatePerPeriod, final PeriodFrequencyType interestRatePeriodFrequencyType,
|
final BigDecimal nominalInterestRatePerPeriod, final PeriodFrequencyType interestRatePeriodFrequencyType,
|
||||||
final BigDecimal nominalAnnualInterestRate, final InterestMethod interestMethod,
|
final BigDecimal nominalAnnualInterestRate, final InterestMethod interestMethod,
|
||||||
@@ -99,7 +83,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
|||||||
|
|
||||||
return new LoanProductRelatedDetail(currency, principal, nominalInterestRatePerPeriod, interestRatePeriodFrequencyType,
|
return new LoanProductRelatedDetail(currency, principal, nominalInterestRatePerPeriod, interestRatePeriodFrequencyType,
|
||||||
nominalAnnualInterestRate, interestMethod, interestCalculationPeriodMethod, repaymentEvery, repaymentPeriodFrequencyType,
|
nominalAnnualInterestRate, interestMethod, interestCalculationPeriodMethod, repaymentEvery, repaymentPeriodFrequencyType,
|
||||||
numberOfRepayments, amortizationMethod, inArrearsTolerance, null);
|
numberOfRepayments, amortizationMethod, inArrearsTolerance);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LoanProductRelatedDetail() {
|
protected LoanProductRelatedDetail() {
|
||||||
@@ -111,8 +95,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
|||||||
final BigDecimal defaultAnnualNominalInterestRate, final InterestMethod interestMethod,
|
final BigDecimal defaultAnnualNominalInterestRate, final InterestMethod interestMethod,
|
||||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final Integer repayEvery,
|
final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final Integer repayEvery,
|
||||||
final PeriodFrequencyType repaymentFrequencyType, final Integer defaultNumberOfRepayments,
|
final PeriodFrequencyType repaymentFrequencyType, final Integer defaultNumberOfRepayments,
|
||||||
final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance,
|
final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance) {
|
||||||
final AccountingRuleType accountingRuleType) {
|
|
||||||
this.currency = currency;
|
this.currency = currency;
|
||||||
this.principal = defaultPrincipal;
|
this.principal = defaultPrincipal;
|
||||||
this.nominalInterestRatePerPeriod = defaultNominalInterestRatePerPeriod;
|
this.nominalInterestRatePerPeriod = defaultNominalInterestRatePerPeriod;
|
||||||
@@ -129,9 +112,6 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
|||||||
} else {
|
} else {
|
||||||
this.inArrearsTolerance = inArrearsTolerance;
|
this.inArrearsTolerance = inArrearsTolerance;
|
||||||
}
|
}
|
||||||
if(accountingRuleType !=null){
|
|
||||||
this.accountingType = accountingRuleType.getValue();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MonetaryCurrency getCurrency() {
|
public MonetaryCurrency getCurrency() {
|
||||||
@@ -184,11 +164,6 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
|||||||
public AmortizationMethod getAmortizationMethod() {
|
public AmortizationMethod getAmortizationMethod() {
|
||||||
return amortizationMethod;
|
return amortizationMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Integer getAccountingType() {
|
|
||||||
return this.accountingType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> update(final JsonCommand command, final AprCalculator aprCalculator) {
|
public Map<String, Object> update(final JsonCommand command, final AprCalculator aprCalculator) {
|
||||||
|
|
||||||
@@ -310,13 +285,6 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
|||||||
actualChanges.put("locale", localeAsInput);
|
actualChanges.put("locale", localeAsInput);
|
||||||
this.interestCalculationPeriodMethod = InterestCalculationPeriodMethod.fromInt(newValue);
|
this.interestCalculationPeriodMethod = InterestCalculationPeriodMethod.fromInt(newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String accountingTypeParamName = "accountingType";
|
|
||||||
if (command.isChangeInIntegerParameterNamed(accountingTypeParamName, this.accountingType)) {
|
|
||||||
final Integer newValue = command.integerValueOfParameterNamed(accountingTypeParamName);
|
|
||||||
actualChanges.put(accountingTypeParamName, newValue);
|
|
||||||
this.accountingType = newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return actualChanges;
|
return actualChanges;
|
||||||
}
|
}
|
||||||
|
|||||||
+113
-128
@@ -11,135 +11,120 @@ import org.mifosplatform.portfolio.loanproduct.domain.LoanProductRelatedDetail;
|
|||||||
import org.mifosplatform.portfolio.loanproduct.domain.PeriodFrequencyType;
|
import org.mifosplatform.portfolio.loanproduct.domain.PeriodFrequencyType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to keep in one place configurations for setting up {@link LoanProductRelatedDetail} object used in {@link LoanScheduleGenerator}'s
|
* This class is used to keep in one place configurations for setting up
|
||||||
|
* {@link LoanProductRelatedDetail} object used in {@link LoanScheduleGenerator}
|
||||||
|
* 's
|
||||||
*/
|
*/
|
||||||
public class LoanProductRelatedDetailTestHelper {
|
public class LoanProductRelatedDetailTestHelper {
|
||||||
|
|
||||||
public static LoanProductRelatedDetail createSettingsForEqualPrincipalAmortizationQuarterly() {
|
|
||||||
|
|
||||||
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
|
||||||
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
|
||||||
|
|
||||||
// 2% per month, 24% per year
|
|
||||||
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
|
||||||
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
|
||||||
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
|
||||||
|
|
||||||
InterestMethod interestMethod = InterestMethod.DECLINING_BALANCE;
|
|
||||||
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
|
||||||
Integer repayEvery = Integer.valueOf(3);
|
|
||||||
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
|
||||||
|
|
||||||
Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
|
||||||
AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_PRINCIPAL;
|
|
||||||
|
|
||||||
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
|
||||||
|
|
||||||
return createLoanProductRelatedDetail(currency, defaultPrincipal,
|
|
||||||
defaultNominalInterestRatePerPeriod,
|
|
||||||
interestPeriodFrequencyType, defaultAnnualNominalInterestRate,
|
|
||||||
interestMethod, interestCalculationPeriodMethod, repayEvery,
|
|
||||||
repaymentFrequencyType, defaultNumberOfRepayments,
|
|
||||||
amortizationMethod, inArrearsTolerance);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LoanProductRelatedDetail createSettingsForEqualInstallmentAmortizationQuarterly() {
|
public static LoanProductRelatedDetail createSettingsForEqualPrincipalAmortizationQuarterly() {
|
||||||
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
|
||||||
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||||
|
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
||||||
// 2% per month, 24% per year
|
|
||||||
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
// 2% per month, 24% per year
|
||||||
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||||
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||||
|
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||||
InterestMethod interestMethod = InterestMethod.DECLINING_BALANCE;
|
|
||||||
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
InterestMethod interestMethod = InterestMethod.DECLINING_BALANCE;
|
||||||
Integer repayEvery = Integer.valueOf(3);
|
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||||
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
Integer repayEvery = Integer.valueOf(3);
|
||||||
|
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||||
Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
|
||||||
AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_INSTALLMENTS;
|
Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
||||||
|
AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_PRINCIPAL;
|
||||||
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
|
||||||
|
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||||
return createLoanProductRelatedDetail(currency, defaultPrincipal,
|
|
||||||
defaultNominalInterestRatePerPeriod,
|
return createLoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||||
interestPeriodFrequencyType, defaultAnnualNominalInterestRate,
|
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||||
interestMethod, interestCalculationPeriodMethod, repayEvery,
|
defaultNumberOfRepayments, amortizationMethod, inArrearsTolerance);
|
||||||
repaymentFrequencyType, defaultNumberOfRepayments,
|
}
|
||||||
amortizationMethod, inArrearsTolerance);
|
|
||||||
}
|
public static LoanProductRelatedDetail createSettingsForEqualInstallmentAmortizationQuarterly() {
|
||||||
|
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||||
public static LoanProductRelatedDetail createSettingsForFlatQuarterly(final AmortizationMethod amortizationMethod) {
|
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
||||||
|
|
||||||
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
// 2% per month, 24% per year
|
||||||
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||||
|
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||||
// 2% per month, 24% per year
|
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||||
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
|
||||||
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
InterestMethod interestMethod = InterestMethod.DECLINING_BALANCE;
|
||||||
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||||
|
Integer repayEvery = Integer.valueOf(3);
|
||||||
InterestMethod interestMethod = InterestMethod.FLAT;
|
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||||
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
|
||||||
Integer repayEvery = Integer.valueOf(3);
|
Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
||||||
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_INSTALLMENTS;
|
||||||
|
|
||||||
Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||||
|
|
||||||
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
return createLoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||||
|
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||||
return createLoanProductRelatedDetail(currency, defaultPrincipal,
|
defaultNumberOfRepayments, amortizationMethod, inArrearsTolerance);
|
||||||
defaultNominalInterestRatePerPeriod,
|
}
|
||||||
interestPeriodFrequencyType, defaultAnnualNominalInterestRate,
|
|
||||||
interestMethod, interestCalculationPeriodMethod, repayEvery,
|
public static LoanProductRelatedDetail createSettingsForFlatQuarterly(final AmortizationMethod amortizationMethod) {
|
||||||
repaymentFrequencyType, defaultNumberOfRepayments,
|
|
||||||
amortizationMethod, inArrearsTolerance);
|
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build();
|
||||||
}
|
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("200000"));
|
||||||
|
|
||||||
public static LoanProductRelatedDetail createSettingsForIrregularFlatEveryFourMonths() {
|
// 2% per month, 24% per year
|
||||||
|
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||||
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("KSH").withDigitsAfterDecimal(0).build();
|
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||||
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("15000"));
|
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||||
|
|
||||||
// 2% per month, 24% per year
|
InterestMethod interestMethod = InterestMethod.FLAT;
|
||||||
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||||
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
Integer repayEvery = Integer.valueOf(3);
|
||||||
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||||
|
|
||||||
InterestMethod interestMethod = InterestMethod.FLAT;
|
Integer defaultNumberOfRepayments = Integer.valueOf(4);
|
||||||
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
|
||||||
Integer repayEvery = Integer.valueOf(3);
|
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||||
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
|
||||||
|
return createLoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||||
Integer defaultNumberOfRepayments = Integer.valueOf(2);
|
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||||
|
defaultNumberOfRepayments, amortizationMethod, inArrearsTolerance);
|
||||||
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
}
|
||||||
|
|
||||||
AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_PRINCIPAL;
|
public static LoanProductRelatedDetail createSettingsForIrregularFlatEveryFourMonths() {
|
||||||
|
|
||||||
return createLoanProductRelatedDetail(currency, defaultPrincipal,
|
MonetaryCurrency currency = new MonetaryCurrencyBuilder().withCode("KSH").withDigitsAfterDecimal(0).build();
|
||||||
defaultNominalInterestRatePerPeriod,
|
BigDecimal defaultPrincipal = BigDecimal.valueOf(Double.valueOf("15000"));
|
||||||
interestPeriodFrequencyType, defaultAnnualNominalInterestRate,
|
|
||||||
interestMethod, interestCalculationPeriodMethod, repayEvery,
|
// 2% per month, 24% per year
|
||||||
repaymentFrequencyType, defaultNumberOfRepayments,
|
BigDecimal defaultNominalInterestRatePerPeriod = BigDecimal.valueOf(Double.valueOf("2"));
|
||||||
amortizationMethod, inArrearsTolerance);
|
PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.MONTHS;
|
||||||
}
|
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.valueOf(Double.valueOf("24"));
|
||||||
|
|
||||||
|
InterestMethod interestMethod = InterestMethod.FLAT;
|
||||||
private static LoanProductRelatedDetail createLoanProductRelatedDetail(
|
InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||||
MonetaryCurrency currency, BigDecimal defaultPrincipal,
|
Integer repayEvery = Integer.valueOf(3);
|
||||||
BigDecimal defaultNominalInterestRatePerPeriod,
|
PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.MONTHS;
|
||||||
PeriodFrequencyType interestPeriodFrequencyType,
|
|
||||||
BigDecimal defaultAnnualNominalInterestRate,
|
Integer defaultNumberOfRepayments = Integer.valueOf(2);
|
||||||
InterestMethod interestMethod,
|
|
||||||
InterestCalculationPeriodMethod interestCalculationPeriodMethod,
|
BigDecimal inArrearsTolerance = BigDecimal.ZERO;
|
||||||
Integer repayEvery, PeriodFrequencyType repaymentFrequencyType,
|
|
||||||
Integer defaultNumberOfRepayments,
|
AmortizationMethod amortizationMethod = AmortizationMethod.EQUAL_PRINCIPAL;
|
||||||
AmortizationMethod amortizationMethod, BigDecimal inArrearsTolerance) {
|
|
||||||
|
return createLoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||||
return new LoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod,
|
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||||
interestPeriodFrequencyType, defaultAnnualNominalInterestRate, interestMethod,
|
defaultNumberOfRepayments, amortizationMethod, inArrearsTolerance);
|
||||||
interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType, defaultNumberOfRepayments, amortizationMethod, inArrearsTolerance, null);
|
}
|
||||||
}
|
|
||||||
|
private static LoanProductRelatedDetail createLoanProductRelatedDetail(MonetaryCurrency currency, BigDecimal defaultPrincipal,
|
||||||
|
BigDecimal defaultNominalInterestRatePerPeriod, PeriodFrequencyType interestPeriodFrequencyType,
|
||||||
|
BigDecimal defaultAnnualNominalInterestRate, InterestMethod interestMethod,
|
||||||
|
InterestCalculationPeriodMethod interestCalculationPeriodMethod, Integer repayEvery,
|
||||||
|
PeriodFrequencyType repaymentFrequencyType, Integer defaultNumberOfRepayments, AmortizationMethod amortizationMethod,
|
||||||
|
BigDecimal inArrearsTolerance) {
|
||||||
|
|
||||||
|
return new LoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||||
|
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||||
|
defaultNumberOfRepayments, amortizationMethod, inArrearsTolerance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user