diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index 11e6ee558..a97e22ea3 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -12932,7 +12932,7 @@ Request Body: "daysInYearType":1, "isInterestRecalculationEnabled":"false", "holdGuaranteeFunds":"false", -"principalThresholdForLastInstalment":20 +"principalThresholdForLastInstallment":20 } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/LoanProductConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/LoanProductConstants.java index 1a4c71eab..ee44461c5 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/LoanProductConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/LoanProductConstants.java @@ -82,7 +82,7 @@ public interface LoanProductConstants { public static final String minimumGuaranteeFromOwnFundsParamName = "minimumGuaranteeFromOwnFunds"; public static final String minimumGuaranteeFromGuarantorParamName = "minimumGuaranteeFromGuarantor"; - public static final String principalThresholdForLastInstalmentParamName = "principalThresholdForLastInstalment"; + public static final String principalThresholdForLastInstallmentParamName = "principalThresholdForLastInstallment"; public static final BigDecimal DEFAULT_PRINCIPAL_THRESHOLD_FOR_MULTI_DISBURSE_LOAN = BigDecimal.valueOf(50); public static final BigDecimal DEFAULT_PRINCIPAL_THRESHOLD_FOR_SINGLE_DISBURSE_LOAN = BigDecimal.valueOf(0); // Fixed installment configuration related diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java index e1336aa2d..69e534557 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java @@ -136,7 +136,7 @@ public class LoanProductData { private final Boolean multiDisburseLoan; private final Integer maxTrancheCount; private final BigDecimal outstandingLoanBalance; - private final BigDecimal principalThresholdForLastInstalment; + private final BigDecimal principalThresholdForLastInstallment; private final Boolean holdGuaranteeFunds; private final LoanProductGuaranteeData productGuaranteeData; @@ -191,7 +191,7 @@ public class LoanProductData { final BigDecimal outstandingLoanBalance = null; final LoanProductGuaranteeData productGuaranteeData = null; final Boolean holdGuaranteeFunds = false; - final BigDecimal principalThresholdForLastInstalment = null; + final BigDecimal principalThresholdForLastInstallment = null; final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion = false; final EnumOptionData daysInMonthType = null; @@ -211,7 +211,7 @@ public class LoanProductData { interestRateVariations, numberOfRepaymentVariations, multiDisburseLoan, maxTrancheCount, outstandingLoanBalance, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType, isInterestRecalculationEnabled, interestRecalculationData, minimumDaysBetweenDisbursalAndFirstRepayment, holdGuaranteeFunds, productGuaranteeData, - principalThresholdForLastInstalment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, + principalThresholdForLastInstallment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, installmentAmountInMultiplesOf); } @@ -268,7 +268,7 @@ public class LoanProductData { final Integer minimumDaysBetweenDisbursalAndFirstRepayment = null; final Boolean holdGuaranteeFunds = false; final LoanProductGuaranteeData productGuaranteeData = null; - final BigDecimal principalThresholdForLastInstalment = null; + final BigDecimal principalThresholdForLastInstallment = null; final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion = false; final boolean canDefineInstallmentAmount = false; final Integer installmentAmountInMultiplesOf = null; @@ -282,7 +282,7 @@ public class LoanProductData { interestRateVariations, numberOfRepaymentVariations, multiDisburseLoan, maxTrancheCount, outstandingLoanBalance, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType, isInterestRecalculationEnabled, interestRecalculationData, minimumDaysBetweenDisbursalAndFirstRepayment, holdGuaranteeFunds, productGuaranteeData, - principalThresholdForLastInstalment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, + principalThresholdForLastInstallment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, installmentAmountInMultiplesOf); } @@ -346,7 +346,7 @@ public class LoanProductData { final Integer minimumDaysBetweenDisbursalAndFirstRepayment = null; final Boolean holdGuaranteeFunds = false; final LoanProductGuaranteeData productGuaranteeData = null; - final BigDecimal principalThresholdForLastInstalment = null; + final BigDecimal principalThresholdForLastInstallment = null; final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion = false; final boolean canDefineInstallmentAmount = false; final Integer installmentAmountInMultiplesOf = null; @@ -360,8 +360,8 @@ public class LoanProductData { principalVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle, numberOfRepaymentVariationsForBorrowerCycle, multiDisburseLoan, maxTrancheCount, outstandingLoanBalance, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType, isInterestRecalculationEnabled, interestRecalculationData, minimumDaysBetweenDisbursalAndFirstRepayment, - holdGuaranteeFunds, productGuaranteeData, principalThresholdForLastInstalment, accountMovesOutOfNPAOnlyOnArrearsCompletion, - canDefineInstallmentAmount, installmentAmountInMultiplesOf); + holdGuaranteeFunds, productGuaranteeData, principalThresholdForLastInstallment, + accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, installmentAmountInMultiplesOf); } public static LoanProductData withAccountingDetails(final LoanProductData productData, final Map accountingMappings, @@ -393,7 +393,7 @@ public class LoanProductData { final Integer overdueDaysForNPA, final EnumOptionData daysInMonthType, final EnumOptionData daysInYearType, final boolean isInterestRecalculationEnabled, final LoanProductInterestRecalculationData interestRecalculationData, final Integer minimumDaysBetweenDisbursalAndFirstRepayment, boolean holdGuaranteeFunds, - final LoanProductGuaranteeData loanProductGuaranteeData, final BigDecimal principalThresholdForLastInstalment, + final LoanProductGuaranteeData loanProductGuaranteeData, final BigDecimal principalThresholdForLastInstallment, final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion, boolean canDefineInstallmentAmount, Integer installmentAmountInMultiplesOf) { this.id = id; @@ -468,7 +468,7 @@ public class LoanProductData { this.interestRecalculationData = interestRecalculationData; this.holdGuaranteeFunds = holdGuaranteeFunds; this.productGuaranteeData = loanProductGuaranteeData; - this.principalThresholdForLastInstalment = principalThresholdForLastInstalment; + this.principalThresholdForLastInstallment = principalThresholdForLastInstallment; this.accountMovesOutOfNPAOnlyOnArrearsCompletion = accountMovesOutOfNPAOnlyOnArrearsCompletion; this.daysInMonthTypeOptions = null; @@ -576,7 +576,7 @@ public class LoanProductData { this.interestRecalculationData = productData.interestRecalculationData; this.holdGuaranteeFunds = productData.holdGuaranteeFunds; this.productGuaranteeData = productData.productGuaranteeData; - this.principalThresholdForLastInstalment = productData.principalThresholdForLastInstalment; + this.principalThresholdForLastInstallment = productData.principalThresholdForLastInstallment; this.accountMovesOutOfNPAOnlyOnArrearsCompletion = productData.accountMovesOutOfNPAOnlyOnArrearsCompletion; this.daysInMonthTypeOptions = daysInMonthTypeOptions; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java index 44a03395f..a1aedde2a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java @@ -137,7 +137,7 @@ public class LoanProduct extends AbstractPersistable { private LoanProductGuaranteeDetails loanProductGuaranteeDetails; @Column(name = "principal_threshold_for_last_instalment", scale = 2, precision = 5, nullable = false) - private BigDecimal principalThresholdForLastInstalment; + private BigDecimal principalThresholdForLastInstallment; @Column(name = "account_moves_out_of_npa_only_on_arrears_completion") private boolean accountMovesOutOfNPAOnlyOnArrearsCompletion; @@ -237,11 +237,11 @@ public class LoanProduct extends AbstractPersistable { loanProductGuaranteeDetails = LoanProductGuaranteeDetails.createFrom(command); } - BigDecimal principalThresholdForLastInstalment = command - .bigDecimalValueOfParameterNamed(LoanProductConstants.principalThresholdForLastInstalmentParamName); + BigDecimal principalThresholdForLastInstallment = command + .bigDecimalValueOfParameterNamed(LoanProductConstants.principalThresholdForLastInstallmentParamName); - if (principalThresholdForLastInstalment == null) { - principalThresholdForLastInstalment = multiDisburseLoan ? LoanProductConstants.DEFAULT_PRINCIPAL_THRESHOLD_FOR_MULTI_DISBURSE_LOAN + if (principalThresholdForLastInstallment == null) { + principalThresholdForLastInstallment = multiDisburseLoan ? LoanProductConstants.DEFAULT_PRINCIPAL_THRESHOLD_FOR_MULTI_DISBURSE_LOAN : LoanProductConstants.DEFAULT_PRINCIPAL_THRESHOLD_FOR_SINGLE_DISBURSE_LOAN; } final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion = command @@ -258,7 +258,7 @@ public class LoanProduct extends AbstractPersistable { startDate, closeDate, externalId, useBorrowerCycle, loanProductBorrowerCycleVariations, multiDisburseLoan, maxTrancheCount, outstandingLoanBalance, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType, isInterestRecalculationEnabled, interestRecalculationSettings, minimumDaysBetweenDisbursalAndFirstRepayment, - holdGuarantorFunds, loanProductGuaranteeDetails, principalThresholdForLastInstalment, + holdGuarantorFunds, loanProductGuaranteeDetails, principalThresholdForLastInstallment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineEmiAmount, installmentAmountInMultiplesOf); } @@ -484,7 +484,7 @@ public class LoanProduct extends AbstractPersistable { final boolean isInterestRecalculationEnabled, final LoanProductInterestRecalculationDetails productInterestRecalculationDetails, final Integer minimumDaysBetweenDisbursalAndFirstRepayment, final boolean holdGuarantorFunds, - final LoanProductGuaranteeDetails loanProductGuaranteeDetails, final BigDecimal principalThresholdForLastInstalment, + final LoanProductGuaranteeDetails loanProductGuaranteeDetails, final BigDecimal principalThresholdForLastInstallment, final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion, final boolean canDefineEmiAmount, final Integer installmentAmountInMultiplesOf) { this.fund = fund; @@ -538,7 +538,7 @@ public class LoanProduct extends AbstractPersistable { this.minimumDaysBetweenDisbursalAndFirstRepayment = minimumDaysBetweenDisbursalAndFirstRepayment; this.holdGuaranteeFunds = holdGuarantorFunds; this.loanProductGuaranteeDetails = loanProductGuaranteeDetails; - this.principalThresholdForLastInstalment = principalThresholdForLastInstalment; + this.principalThresholdForLastInstallment = principalThresholdForLastInstallment; this.accountMovesOutOfNPAOnlyOnArrearsCompletion = accountMovesOutOfNPAOnlyOnArrearsCompletion; this.canDefineInstallmentAmount = canDefineEmiAmount; this.installmentAmountInMultiplesOf = installmentAmountInMultiplesOf; @@ -769,12 +769,12 @@ public class LoanProduct extends AbstractPersistable { this.loanProductGuaranteeDetails.update(command, actualChanges); } - if (command.isChangeInBigDecimalParameterNamed(LoanProductConstants.principalThresholdForLastInstalmentParamName, - this.principalThresholdForLastInstalment)) { + if (command.isChangeInBigDecimalParameterNamed(LoanProductConstants.principalThresholdForLastInstallmentParamName, + this.principalThresholdForLastInstallment)) { BigDecimal newValue = command - .bigDecimalValueOfParameterNamed(LoanProductConstants.principalThresholdForLastInstalmentParamName); - actualChanges.put(LoanProductConstants.principalThresholdForLastInstalmentParamName, newValue); - this.principalThresholdForLastInstalment = newValue; + .bigDecimalValueOfParameterNamed(LoanProductConstants.principalThresholdForLastInstallmentParamName); + actualChanges.put(LoanProductConstants.principalThresholdForLastInstallmentParamName, newValue); + this.principalThresholdForLastInstallment = newValue; } if (command.isChangeInBooleanParameterNamed(LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName, this.accountMovesOutOfNPAOnlyOnArrearsCompletion)) { @@ -1049,8 +1049,8 @@ public class LoanProduct extends AbstractPersistable { return this.shortName; } - public BigDecimal getPrincipalThresholdForLastInstalment() { - return this.principalThresholdForLastInstalment; + public BigDecimal getPrincipalThresholdForLastInstallment() { + return this.principalThresholdForLastInstallment; } public boolean isArrearsBasedOnOriginalSchedule() { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java index 40712310e..eb43e2b6e 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java @@ -74,7 +74,7 @@ public final class LoanProductDataValidator { LoanProductConstants.isArrearsBasedOnOriginalScheduleParamName, LoanProductConstants.minimumDaysBetweenDisbursalAndFirstRepayment, LoanProductConstants.mandatoryGuaranteeParamName, LoanProductConstants.holdGuaranteeFundsParamName, LoanProductConstants.minimumGuaranteeFromGuarantorParamName, - LoanProductConstants.minimumGuaranteeFromOwnFundsParamName, LoanProductConstants.principalThresholdForLastInstalmentParamName, + LoanProductConstants.minimumGuaranteeFromOwnFundsParamName, LoanProductConstants.principalThresholdForLastInstallmentParamName, LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName, LoanProductConstants.canDefineEmiAmountParamName, LoanProductConstants.installmentAmountInMultiplesOfParamName)); @@ -335,10 +335,10 @@ public final class LoanProductDataValidator { } } - BigDecimal principalThresholdForLastInstalment = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed( - LoanProductConstants.principalThresholdForLastInstalmentParamName, element); - baseDataValidator.reset().parameter(LoanProductConstants.principalThresholdForLastInstalmentParamName) - .value(principalThresholdForLastInstalment).notLessThanMin(BigDecimal.ZERO).notGreaterThanMax(BigDecimal.valueOf(100)); + BigDecimal principalThresholdForLastInstallment = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed( + LoanProductConstants.principalThresholdForLastInstallmentParamName, element); + baseDataValidator.reset().parameter(LoanProductConstants.principalThresholdForLastInstallmentParamName) + .value(principalThresholdForLastInstallment).notLessThanMin(BigDecimal.ZERO).notGreaterThanMax(BigDecimal.valueOf(100)); if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.canDefineEmiAmountParamName, element)) { final Boolean canDefineInstallmentAmount = this.fromApiJsonHelper.extractBooleanNamed( LoanProductConstants.canDefineEmiAmountParamName, element); @@ -789,11 +789,11 @@ public final class LoanProductDataValidator { } } - if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.principalThresholdForLastInstalmentParamName, element)) { - BigDecimal principalThresholdForLastInstalment = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed( - LoanProductConstants.principalThresholdForLastInstalmentParamName, element); - baseDataValidator.reset().parameter(LoanProductConstants.principalThresholdForLastInstalmentParamName) - .value(principalThresholdForLastInstalment).notNull().notLessThanMin(BigDecimal.ZERO) + if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.principalThresholdForLastInstallmentParamName, element)) { + BigDecimal principalThresholdForLastInstallment = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed( + LoanProductConstants.principalThresholdForLastInstallmentParamName, element); + baseDataValidator.reset().parameter(LoanProductConstants.principalThresholdForLastInstallmentParamName) + .value(principalThresholdForLastInstallment).notNull().notLessThanMin(BigDecimal.ZERO) .notGreaterThanMax(BigDecimal.valueOf(100)); } if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.canDefineEmiAmountParamName, element)) {