support loan product validation messages.
This commit is contained in:
+8
-8
@@ -239,20 +239,20 @@ form.label.loan.product.interest.rate.calcutated.in.period=Interest calculation
|
||||
|
||||
validation.msg.product.name.cannot.be.blank=Product name cannot be blank.
|
||||
validation.msg.product.description.exceeds.max.length=The content of the description has exceeded max allowed length of 500 characters.
|
||||
validation.msg.product.currency.digitsAfterDecimal.cannot.be.empty=You must enter a number to represent number of digits after decimal to be supported for product.
|
||||
validation.msg.product.digitsAfterDecimal.cannot.be.blank=You must enter a number to represent number of digits after decimal to be supported for product.
|
||||
validation.msg.product.digitsAfterDecimal.is.not.within.expected.range=Decimal places must be a number between {1} and {2} inclusive.
|
||||
|
||||
validation.msg.product.repayment.repaidEvery.cannot.be.empty=Repaid every cannot be blank.
|
||||
validation.msg.product.repaymentEvery.cannot.be.blank=Repaid every cannot be blank.
|
||||
validation.msg.product.repaymentEvery.not.greater.than.zero=Repaid every must be greater than 0.
|
||||
validation.msg.product.number.of.repayments.cannot.be.empty=# of repayments cannot be blank.
|
||||
validation.msg.product.numberOfRepayments.cannot.be.blank=# of repayments cannot be blank.
|
||||
validation.msg.product.numberOfRepayments.not.greater.than.zero=# of repayments must be greater than 0.
|
||||
|
||||
validation.msg.product.principalFormatted.cannot.be.blank=Loan amount cannot be blank.
|
||||
validation.msg.product.inArrearsToleranceAmountFormatted.cannot.be.blank=Arrears tolerance cannot be blank.
|
||||
validation.msg.product.interestRatePerPeriodFormatted.cannot.be.blank=Nominal interest rate % cannot be blank.
|
||||
validation.msg.product.principal.cannot.be.blank=Loan amount cannot be blank.
|
||||
validation.msg.product.inArrearsTolerance.cannot.be.blank=Arrears tolerance cannot be blank.
|
||||
validation.msg.product.interestRatePerPeriod.cannot.be.blank=Nominal interest rate % cannot be blank.
|
||||
|
||||
validation.msg.product.principal.amount.must.be.greater.than.zero=Loan amount must be greater than zero.
|
||||
validation.msg.product.arrears.tolerance.amount.cannot.be.negative=Arrears tolerance cannot be negative.
|
||||
validation.msg.product.principal.not.greater.than.zero=Loan amount must be greater than zero.
|
||||
validation.msg.product.inArrearsTolerance.not.zero.or.greater=Arrears tolerance must be greater than or equal to zero.
|
||||
validation.msg.product.interest.rate.per.period.amount.cannot.be.negative=Nominal interest rate % cannot be negative.
|
||||
|
||||
table.heading.office.name=Office Name
|
||||
|
||||
+10
-9
@@ -235,22 +235,23 @@ form.label.loan.product.nominal.interestrate=Nominal interest rate %:(fr)
|
||||
form.label.loan.product.interest.method=Interest method:(fr)
|
||||
form.label.loan.product.interest.rate.calcutated.in.period=Interest calculation period:(fr)
|
||||
|
||||
|
||||
validation.msg.product.name.cannot.be.blank=Product name cannot be blank.(fr)
|
||||
validation.msg.product.description.exceeds.max.length=The content of the description has exceeded max allowed length of 500 characters.(fr)
|
||||
validation.msg.product.currency.digitsAfterDecimal.cannot.be.empty=You must enter a number to represent number of digits after decimal to be supported for product.(fr)
|
||||
validation.msg.product.digitsAfterDecimal.is.not.within.expected.range=Decimal places must be a number between {1} and {2} inclusive.
|
||||
validation.msg.product.digitsAfterDecimal.cannot.be.blank=You must enter a number to represent number of digits after decimal to be supported for product.(fr)
|
||||
validation.msg.product.digitsAfterDecimal.is.not.within.expected.range=Decimal places must be a number between {1} and {2} inclusive.(fr)
|
||||
|
||||
validation.msg.product.repayment.repaidEvery.cannot.be.empty=Repaid every cannot be blank.(fr)
|
||||
validation.msg.product.repaymentEvery.cannot.be.blank=Repaid every cannot be blank.(fr)
|
||||
validation.msg.product.repaymentEvery.not.greater.than.zero=Repaid every must be greater than 0.(fr)
|
||||
validation.msg.product.number.of.repayments.cannot.be.empty=# of repayments cannot be blank.(fr)
|
||||
validation.msg.product.numberOfRepayments.cannot.be.blank=# of repayments cannot be blank.(fr)
|
||||
validation.msg.product.numberOfRepayments.not.greater.than.zero=# of repayments must be greater than 0.(fr)
|
||||
|
||||
validation.msg.product.principalFormatted.cannot.be.blank=Loan amount cannot be blank.(fr)
|
||||
validation.msg.product.inArrearsToleranceAmountFormatted.cannot.be.blank=Arrears tolerance cannot be blank.(fr)
|
||||
validation.msg.product.interestRatePerPeriodFormatted.cannot.be.blank=Nominal interest rate % cannot be blank.(fr)
|
||||
validation.msg.product.principal.cannot.be.blank=Loan amount cannot be blank.(fr)
|
||||
validation.msg.product.inArrearsTolerance.cannot.be.blank=Arrears tolerance cannot be blank.(fr)
|
||||
validation.msg.product.interestRatePerPeriod.cannot.be.blank=Nominal interest rate % cannot be blank.(fr)
|
||||
|
||||
validation.msg.product.principal.amount.must.be.greater.than.zero=Loan amount must be greater than zero.(fr)
|
||||
validation.msg.product.arrears.tolerance.amount.cannot.be.negative=Arrears tolerance cannot be negative.(fr)
|
||||
validation.msg.product.principal.not.greater.than.zero=Loan amount must be greater than zero.(fr)
|
||||
validation.msg.product.inArrearsTolerance.not.zero.or.greater=Arrears tolerance must be greater than or equal to zero.(fr)
|
||||
validation.msg.product.interest.rate.per.period.amount.cannot.be.negative=Nominal interest rate % cannot be negative.(fr)
|
||||
|
||||
table.heading.office.name=Office Name(fr)
|
||||
|
||||
@@ -144,6 +144,23 @@ public class DataValidatorBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataValidatorBuilder zeroOrPositiveAmount() {
|
||||
if (value == null && ignoreNullValue) {
|
||||
return this;
|
||||
}
|
||||
|
||||
if (value != null) {
|
||||
BigDecimal number = BigDecimal.valueOf(Double.valueOf(value.toString()));
|
||||
if (number.compareTo(BigDecimal.ZERO) < 0) {
|
||||
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".not.zero.or.greater");
|
||||
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" must be greater than or equal to 0.");
|
||||
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter, number, 0);
|
||||
dataValidationErrors.add(error);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataValidatorBuilder greaterThanZero() {
|
||||
if (value == null && ignoreNullValue) {
|
||||
return this;
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import org.mifosng.data.ConfigurationData;
|
||||
import org.mifosng.data.command.OrganisationCurrencyCommand;
|
||||
import org.mifosng.platform.api.commands.OrganisationCurrencyCommand;
|
||||
import org.mifosng.platform.api.infrastructure.ApiJSONFormattingService;
|
||||
import org.mifosng.platform.configuration.service.ConfigurationReadPlatformService;
|
||||
import org.mifosng.platform.configuration.service.ConfigurationWritePlatformService;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data.command;
|
||||
package org.mifosng.platform.api.commands;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package org.mifosng.platform.configuration.service;
|
||||
|
||||
import org.mifosng.data.command.OrganisationCurrencyCommand;
|
||||
import org.mifosng.platform.api.commands.OrganisationCurrencyCommand;
|
||||
|
||||
public interface ConfigurationWritePlatformService {
|
||||
|
||||
|
||||
+1
-1
@@ -6,8 +6,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.mifosng.data.ApiParameterError;
|
||||
import org.mifosng.data.command.OrganisationCurrencyCommand;
|
||||
import org.mifosng.platform.DataValidatorBuilder;
|
||||
import org.mifosng.platform.api.commands.OrganisationCurrencyCommand;
|
||||
import org.mifosng.platform.currency.domain.ApplicationCurrency;
|
||||
import org.mifosng.platform.currency.domain.ApplicationCurrencyRepository;
|
||||
import org.mifosng.platform.exceptions.PlatformApiDataValidationException;
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ public class LoanProductCommandValidator {
|
||||
baseDataValidator.reset().parameter("digitsAfterDecimal").value(command.getDigitsAfterDecimalValue()).ignoreIfNull().notNull().inMinMaxRange(0, 6);
|
||||
|
||||
baseDataValidator.reset().parameter("principal").value(command.getPrincipalValue()).ignoreIfNull().notNull().positiveAmount();
|
||||
baseDataValidator.reset().parameter("inArrearsTolerance").value(command.getInArrearsToleranceValue()).ignoreIfNull().positiveAmount();
|
||||
baseDataValidator.reset().parameter("inArrearsTolerance").value(command.getInArrearsToleranceValue()).ignoreIfNull().notNull().zeroOrPositiveAmount();
|
||||
|
||||
baseDataValidator.reset().parameter("repaymentFrequencyType").value(command.getRepaymentFrequencyType()).ignoreIfNull().notNull().inMinMaxRange(0, 3);
|
||||
|
||||
@@ -66,7 +66,7 @@ public class LoanProductCommandValidator {
|
||||
baseDataValidator.reset().parameter("digitsAfterDecimal").value(command.getDigitsAfterDecimalValue()).notNull().inMinMaxRange(0, 6);
|
||||
|
||||
baseDataValidator.reset().parameter("principal").value(command.getPrincipalValue()).notNull().positiveAmount();
|
||||
baseDataValidator.reset().parameter("inArrearsTolerance").value(command.getInArrearsToleranceValue()).positiveAmount();
|
||||
baseDataValidator.reset().parameter("inArrearsTolerance").value(command.getInArrearsToleranceValue()).notNull().zeroOrPositiveAmount();
|
||||
|
||||
baseDataValidator.reset().parameter("repaymentFrequencyType").value(command.getRepaymentFrequencyType()).notNull().inMinMaxRange(0, 3);
|
||||
baseDataValidator.reset().parameter("repaymentEvery").value(command.getRepaymentEveryValue()).notNull().greaterThanZero();
|
||||
|
||||
-2
@@ -25,8 +25,6 @@ public class RoleCommandValidator {
|
||||
baseDataValidator.reset().parameter("description").value(command.getDescription()).notBlank().notExceedingLengthOf(500);
|
||||
baseDataValidator.reset().parameter("permissions").value(command.getPermissions()).arrayNotEmpty();
|
||||
|
||||
baseDataValidator.reset().anyOfNotNull(command.getName(), command.getDescription(), command.getPermissions());
|
||||
|
||||
if (!dataValidationErrors.isEmpty()) {
|
||||
throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", dataValidationErrors);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user