Merge remote-tracking branch 'madhukar/MIFOSX-222'
This commit is contained in:
+23
-9
@@ -6985,35 +6985,49 @@ Content-Type: application/json
|
|||||||
<table class=matrixHeading>
|
<table class=matrixHeading>
|
||||||
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Field Descriptions</div></td></tr>
|
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Field Descriptions</div></td></tr>
|
||||||
|
|
||||||
|
<tr class=alt><td>name</td></tr>
|
||||||
|
<tr><td class=fielddesc>Used as product name</td></tr>
|
||||||
|
|
||||||
|
<tr class=alt><td>description</td></tr>
|
||||||
|
<tr><td class=fielddesc>Used to describe about the product.</td></tr>
|
||||||
|
|
||||||
<tr class=alt><td>digitsAfterDecimal</td></tr>
|
<tr class=alt><td>digitsAfterDecimal</td></tr>
|
||||||
<tr><td class=fielddesc>Override the currency default value for digitsAfterDecimal.</td></tr>
|
<tr><td class=fielddesc>Override the currency default value for digitsAfterDecimal.</td></tr>
|
||||||
|
|
||||||
<tr class=alt><td>minimumBalance :</td></tr>
|
<tr class=alt><td>minDeposit :</td></tr>
|
||||||
<tr><td class=fielddesc>Minimum deposit amount that is required to create a deposit account.</td></tr>
|
<tr><td class=fielddesc>Minimum deposit amount that is required to create a deposit account.</td></tr>
|
||||||
|
|
||||||
<tr class=alt><td>maximumBalance :</td></tr>
|
<tr class=alt><td>defaultDeposit :</td></tr>
|
||||||
|
<tr><td class=fielddesc>Default deposit amount that is required to create a deposit account.</td></tr>
|
||||||
|
|
||||||
|
<tr class=alt><td>maxDeposit :</td></tr>
|
||||||
<tr><td class=fielddesc>The max deposit amount that can be limited to create a deposit account.</td></tr>
|
<tr><td class=fielddesc>The max deposit amount that can be limited to create a deposit account.</td></tr>
|
||||||
<tr class=alt><td></td></tr>
|
<tr class=alt><td></td></tr>
|
||||||
|
|
||||||
<tr class=alt><td>interestCompoundedEvery</td></tr>
|
|
||||||
<tr><td class=fielddesc>Interest amount which is accrued or earned during the tenure of the deposit account will be posted to customer as interest as per the selected period in "interestCompoundedEvery" and combination of "interestCompoundedEveryPeriodType" <br>
|
|
||||||
e.g.Every <b>1</b>-Month</td></tr>
|
|
||||||
|
|
||||||
<tr class=alt><td>tenureInMonths</td></tr>
|
<tr class=alt><td>tenureInMonths</td></tr>
|
||||||
<tr><td class=fielddesc>The duration for fixed deposit (in months). <br>
|
<tr><td class=fielddesc>The duration for fixed deposit (in months). <br>
|
||||||
e.g. 12
|
e.g. 12
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr class=alt><td>maturityDefaultInterestRate</td></tr>
|
|
||||||
|
<tr class=alt><td>defaultInterestRate</td></tr>
|
||||||
<tr><td class=fielddesc>Default interest rate for Fixed Deposit product <br>
|
<tr><td class=fielddesc>Default interest rate for Fixed Deposit product <br>
|
||||||
e.g. 12</td></tr>
|
e.g. 12</td></tr>
|
||||||
<tr class=alt><td>maturityMinInterestRate</td></tr>
|
<tr class=alt><td>minInterestRate</td></tr>
|
||||||
<tr><td class=fielddesc>Minimum supported interest rate for Fixed Deposit product<br>
|
<tr><td class=fielddesc>Minimum supported interest rate for Fixed Deposit product<br>
|
||||||
e.g. 8</td></tr>
|
e.g. 8</td></tr>
|
||||||
|
|
||||||
<tr class=alt><td>maturityMaxInterestRate</td></tr>
|
<tr class=alt><td>maxInterestRate</td></tr>
|
||||||
<tr><td class=fielddesc>Maximum supported interest rate for Fixed Deposit product<br>
|
<tr><td class=fielddesc>Maximum supported interest rate for Fixed Deposit product<br>
|
||||||
e.g. 14 </td></tr>
|
e.g. 14 </td></tr>
|
||||||
|
|
||||||
|
<tr class=alt><td>interestCompoundedEvery</td></tr>
|
||||||
|
<tr><td class=fielddesc>Interest amount which is accrued or earned during the tenure of the deposit account will be posted to customer as interest as per the selected period in "interestCompoundedEvery" and combination of "interestCompoundedEveryPeriodType" <br>
|
||||||
|
e.g.Every <b>1</b>-Month</td></tr>
|
||||||
|
|
||||||
|
<tr class=alt><td>interestCompoundedEveryPeriodType</td></tr>
|
||||||
|
<tr><td class=fielddesc>Denotes the interest compounding period type, used with combination of interestCompoundedEvery <br>
|
||||||
|
e.g. Months, Weeks etc</td></tr>
|
||||||
|
|
||||||
<tr class=alt><td>renewalAllowed</td></tr>
|
<tr class=alt><td>renewalAllowed</td></tr>
|
||||||
<tr><td class=fielddesc> Allows to renew the deposit account on maturity<br>
|
<tr><td class=fielddesc> Allows to renew the deposit account on maturity<br>
|
||||||
Used like: renewalAllowed:true </td></tr>
|
Used like: renewalAllowed:true </td></tr>
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE m_product_deposit
|
||||||
|
CHANGE `minimum_balance` `min_balance` decimal(19,6) NOT NULL,
|
||||||
|
CHANGE `maximum_balance` `max_balance` decimal(19,6) NOT NULL,
|
||||||
|
CHANGE `maturity_default_interest_rate` `default_interest_rate` decimal(19,6) NOT NULL,
|
||||||
|
CHANGE `maturity_min_interest_rate` `min_interest_rate` decimal(19,6) NOT NULL,
|
||||||
|
CHANGE `maturity_max_interest_rate` `max_interest_rate` decimal(19,6) NOT NULL,
|
||||||
|
CHANGE `min_balance` `min_deposit` decimal(19,6) NOT NULL,
|
||||||
|
CHANGE `max_balance` `max_deposit` decimal(19,6) NOT NULL,
|
||||||
|
ADD COLUMN `default_deposit` decimal(19,6) NOT NULL AFTER `min_deposit`;
|
||||||
+7
-7
@@ -97,7 +97,7 @@ public class DepositAccountAssembler {
|
|||||||
tenureInMonths = tenureInMonthsCommandValue;
|
tenureInMonths = tenureInMonthsCommandValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal maturityInterestRate = product.getMaturityDefaultInterestRate();
|
BigDecimal maturityInterestRate = product.getDefaultInterestRate();
|
||||||
if (maturityInterestRateCommandValue != null) {
|
if (maturityInterestRateCommandValue != null) {
|
||||||
maturityInterestRate = maturityInterestRateCommandValue;
|
maturityInterestRate = maturityInterestRateCommandValue;
|
||||||
}
|
}
|
||||||
@@ -107,8 +107,8 @@ public class DepositAccountAssembler {
|
|||||||
preClosureInterestRate = preClosureInterestRateCommandValue;
|
preClosureInterestRate = preClosureInterestRateCommandValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (product.getMaturityMinInterestRate().compareTo(preClosureInterestRate) == -1) { throw new DepositAccounDataValidationtException(
|
if (product.getMinInterestRate().compareTo(preClosureInterestRate) == -1) { throw new DepositAccounDataValidationtException(
|
||||||
preClosureInterestRate, product.getMaturityMinInterestRate()); }
|
preClosureInterestRate, product.getMinInterestRate()); }
|
||||||
|
|
||||||
Integer compoundingInterestEvery = product.getInterestCompoundedEvery();
|
Integer compoundingInterestEvery = product.getInterestCompoundedEvery();
|
||||||
if (interestCompoundedEveryCommandValue != null) {
|
if (interestCompoundedEveryCommandValue != null) {
|
||||||
@@ -219,8 +219,8 @@ public class DepositAccountAssembler {
|
|||||||
preClosureInterestRate = newValue;
|
preClosureInterestRate = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (product.getMaturityMinInterestRate().compareTo(preClosureInterestRate) == -1) { throw new DepositAccounDataValidationtException(
|
if (product.getMinInterestRate().compareTo(preClosureInterestRate) == -1) { throw new DepositAccounDataValidationtException(
|
||||||
preClosureInterestRate, product.getMaturityMinInterestRate()); }
|
preClosureInterestRate, product.getMinInterestRate()); }
|
||||||
|
|
||||||
Integer interestCompoundedEvery = account.getInterestCompoundedEvery();
|
Integer interestCompoundedEvery = account.getInterestCompoundedEvery();
|
||||||
final String interestCompoundedEveryParamName = "interestCompoundedEvery";
|
final String interestCompoundedEveryParamName = "interestCompoundedEvery";
|
||||||
@@ -384,8 +384,8 @@ public class DepositAccountAssembler {
|
|||||||
preClosureInterestRate = newValue;
|
preClosureInterestRate = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (product.getMaturityMinInterestRate().compareTo(preClosureInterestRate) == -1) { throw new DepositAccounDataValidationtException(
|
if (product.getMinInterestRate().compareTo(preClosureInterestRate) == -1) { throw new DepositAccounDataValidationtException(
|
||||||
preClosureInterestRate, product.getMaturityMinInterestRate()); }
|
preClosureInterestRate, product.getMinInterestRate()); }
|
||||||
|
|
||||||
Integer interestCompoundedEvery = account.getInterestCompoundedEvery();
|
Integer interestCompoundedEvery = account.getInterestCompoundedEvery();
|
||||||
final String interestCompoundedEveryParamName = "interestCompoundedEvery";
|
final String interestCompoundedEveryParamName = "interestCompoundedEvery";
|
||||||
|
|||||||
+2
-2
@@ -48,8 +48,8 @@ import org.springframework.stereotype.Component;
|
|||||||
public class DepositProductsApiResource {
|
public class DepositProductsApiResource {
|
||||||
|
|
||||||
private final Set<String> DEPOSIT_PRODUCT_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "externalId", "name",
|
private final Set<String> DEPOSIT_PRODUCT_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "externalId", "name",
|
||||||
"description", "currencyCode", "digitsAfterDecimal", "minimumBalance", "maximumBalance", "tenureInMonths",
|
"description", "currencyCode", "digitsAfterDecimal", "minDeposit", "defaultDeposit", "maxDeposit", "tenureInMonths",
|
||||||
"maturityDefaultInterestRate", "maturityMinInterestRate", "maturityMaxInterestRate", "interestCompoundedEvery",
|
"defaultInterestRate", "minInterestRate", "maxInterestRate", "interestCompoundedEvery",
|
||||||
"interestCompoundedEveryPeriodType", "renewalAllowed", "preClosureAllowed", "preClosureInterestRate",
|
"interestCompoundedEveryPeriodType", "renewalAllowed", "preClosureAllowed", "preClosureInterestRate",
|
||||||
"interestCompoundingAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "currency", "currencyOptions",
|
"interestCompoundingAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "currency", "currencyOptions",
|
||||||
"interestCompoundedEveryPeriodTypeOptions"));
|
"interestCompoundedEveryPeriodTypeOptions"));
|
||||||
|
|||||||
+48
-44
@@ -24,12 +24,13 @@ public class DepositProductData {
|
|||||||
private final String description;
|
private final String description;
|
||||||
private final String currencyCode;
|
private final String currencyCode;
|
||||||
private final Integer digitsAfterDecimal;
|
private final Integer digitsAfterDecimal;
|
||||||
private final BigDecimal minimumBalance;
|
private final BigDecimal minDeposit;
|
||||||
private final BigDecimal maximumBalance;
|
private final BigDecimal defaultDeposit;
|
||||||
|
private final BigDecimal maxDeposit;
|
||||||
private final Integer tenureInMonths;
|
private final Integer tenureInMonths;
|
||||||
private final BigDecimal maturityDefaultInterestRate;
|
private final BigDecimal defaultInterestRate;
|
||||||
private final BigDecimal maturityMinInterestRate;
|
private final BigDecimal minInterestRate;
|
||||||
private final BigDecimal maturityMaxInterestRate;
|
private final BigDecimal maxInterestRate;
|
||||||
private final Integer interestCompoundedEvery;
|
private final Integer interestCompoundedEvery;
|
||||||
private final EnumOptionData interestCompoundedEveryPeriodType;
|
private final EnumOptionData interestCompoundedEveryPeriodType;
|
||||||
private final CurrencyData currency;
|
private final CurrencyData currency;
|
||||||
@@ -48,9 +49,9 @@ public class DepositProductData {
|
|||||||
|
|
||||||
public DepositProductData(final Long id, final String externalId,
|
public DepositProductData(final Long id, final String externalId,
|
||||||
final String name, final String description, final String currencyCode, final Integer digitsAfterDecimal,
|
final String name, final String description, final String currencyCode, final Integer digitsAfterDecimal,
|
||||||
final BigDecimal minimumBalance, final BigDecimal maximumBalance, final Integer tenureMonths,
|
final BigDecimal minDeposit, final BigDecimal defaultDeposit, final BigDecimal maxDeposit, final Integer tenureMonths,
|
||||||
final BigDecimal maturityDefaultInterestRate, final BigDecimal maturityMinInterestRate,
|
final BigDecimal defaultInterestRate, final BigDecimal minInterestRate,
|
||||||
final BigDecimal maturityMaxInterestRate, final Integer interestCompoundedEvery,
|
final BigDecimal maxInterestRate, final Integer interestCompoundedEvery,
|
||||||
final EnumOptionData interestCompoundedEveryPeriodType, final boolean renewalAllowed, final boolean preClosureAllowed,
|
final EnumOptionData interestCompoundedEveryPeriodType, final boolean renewalAllowed, final boolean preClosureAllowed,
|
||||||
final BigDecimal preClosureInterestRate, final boolean interestCompoundingAllowed, final boolean isLockinPeriodAllowed,
|
final BigDecimal preClosureInterestRate, final boolean interestCompoundingAllowed, final boolean isLockinPeriodAllowed,
|
||||||
final Integer lockinPeriod, final EnumOptionData lockinPeriodType,final CurrencyData currencyData) {
|
final Integer lockinPeriod, final EnumOptionData lockinPeriodType,final CurrencyData currencyData) {
|
||||||
@@ -61,13 +62,14 @@ public class DepositProductData {
|
|||||||
this.description = description;
|
this.description = description;
|
||||||
this.currencyCode = currencyCode;
|
this.currencyCode = currencyCode;
|
||||||
this.digitsAfterDecimal = digitsAfterDecimal;
|
this.digitsAfterDecimal = digitsAfterDecimal;
|
||||||
this.minimumBalance = minimumBalance;
|
this.minDeposit = minDeposit;
|
||||||
this.maximumBalance = maximumBalance;
|
this.defaultDeposit = defaultDeposit;
|
||||||
|
this.maxDeposit = maxDeposit;
|
||||||
|
|
||||||
this.tenureInMonths = tenureMonths;
|
this.tenureInMonths = tenureMonths;
|
||||||
this.maturityDefaultInterestRate = maturityDefaultInterestRate;
|
this.defaultInterestRate = defaultInterestRate;
|
||||||
this.maturityMinInterestRate = maturityMinInterestRate;
|
this.minInterestRate = minInterestRate;
|
||||||
this.maturityMaxInterestRate = maturityMaxInterestRate;
|
this.maxInterestRate = maxInterestRate;
|
||||||
this.interestCompoundedEvery = interestCompoundedEvery;
|
this.interestCompoundedEvery = interestCompoundedEvery;
|
||||||
this.interestCompoundedEveryPeriodType = interestCompoundedEveryPeriodType;
|
this.interestCompoundedEveryPeriodType = interestCompoundedEveryPeriodType;
|
||||||
this.renewalAllowed = renewalAllowed;
|
this.renewalAllowed = renewalAllowed;
|
||||||
@@ -92,13 +94,14 @@ public class DepositProductData {
|
|||||||
this.description = null;
|
this.description = null;
|
||||||
this.currencyCode = null;
|
this.currencyCode = null;
|
||||||
this.digitsAfterDecimal = null;
|
this.digitsAfterDecimal = null;
|
||||||
this.minimumBalance = null;
|
this.minDeposit = null;
|
||||||
this.maximumBalance = null;
|
this.defaultDeposit = null;
|
||||||
|
this.maxDeposit = null;
|
||||||
|
|
||||||
this.tenureInMonths = null;
|
this.tenureInMonths = null;
|
||||||
this.maturityDefaultInterestRate = null;
|
this.defaultInterestRate = null;
|
||||||
this.maturityMinInterestRate = null;
|
this.minInterestRate = null;
|
||||||
this.maturityMaxInterestRate = null;
|
this.maxInterestRate = null;
|
||||||
this.interestCompoundedEvery = null;
|
this.interestCompoundedEvery = null;
|
||||||
this.interestCompoundedEveryPeriodType = defaultInterestCompoundedEveryPeriodType;
|
this.interestCompoundedEveryPeriodType = defaultInterestCompoundedEveryPeriodType;
|
||||||
|
|
||||||
@@ -119,30 +122,31 @@ public class DepositProductData {
|
|||||||
|
|
||||||
public DepositProductData(final DepositProductData product, final Collection<CurrencyData> currencyOptions,
|
public DepositProductData(final DepositProductData product, final Collection<CurrencyData> currencyOptions,
|
||||||
final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) {
|
final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) {
|
||||||
this.id = product.getId();
|
this.id = product.id;
|
||||||
this.externalId = product.getExternalId();
|
this.externalId = product.externalId;
|
||||||
this.name = product.getName();
|
this.name = product.name;
|
||||||
this.description = product.getDescription();
|
this.description = product.description;
|
||||||
this.currencyCode = product.getCurrencyCode();
|
this.currencyCode = product.currencyCode;
|
||||||
this.digitsAfterDecimal = product.getDigitsAfterDecimal();
|
this.digitsAfterDecimal = product.digitsAfterDecimal;
|
||||||
this.minimumBalance = product.getMinimumBalance();
|
this.minDeposit = product.minDeposit;
|
||||||
this.maximumBalance = product.getMaximumBalance();
|
this.defaultDeposit = product.defaultDeposit;
|
||||||
|
this.maxDeposit = product.maxDeposit;
|
||||||
|
|
||||||
this.tenureInMonths = product.getTenureInMonths();
|
this.tenureInMonths = product.tenureInMonths;
|
||||||
this.maturityDefaultInterestRate = product.getMaturityDefaultInterestRate();
|
this.defaultInterestRate = product.defaultInterestRate;
|
||||||
this.maturityMinInterestRate = product.getMaturityMinInterestRate();
|
this.minInterestRate = product.minInterestRate;
|
||||||
this.maturityMaxInterestRate = product.getMaturityMaxInterestRate();
|
this.maxInterestRate = product.maxInterestRate;
|
||||||
this.interestCompoundedEvery = product.getInterestCompoundedEvery();
|
this.interestCompoundedEvery = product.interestCompoundedEvery;
|
||||||
this.interestCompoundedEveryPeriodType = product.getInterestCompoundedEveryPeriodType();
|
this.interestCompoundedEveryPeriodType = product.interestCompoundedEveryPeriodType;
|
||||||
|
|
||||||
this.renewalAllowed = product.isRenewalAllowed();
|
this.renewalAllowed = product.renewalAllowed;
|
||||||
this.preClosureAllowed = product.isPreClosureAllowed();
|
this.preClosureAllowed = product.preClosureAllowed;
|
||||||
this.preClosureInterestRate = product.getPreClosureInterestRate();
|
this.preClosureInterestRate = product.preClosureInterestRate;
|
||||||
this.interestCompoundingAllowed = product.isInterestCompoundingAllowed();
|
this.interestCompoundingAllowed = product.interestCompoundingAllowed;
|
||||||
|
|
||||||
this.lockinPeriod = product.getLockinPeriod();
|
this.lockinPeriod = product.lockinPeriod;
|
||||||
this.lockinPeriodType = product.getLockinPeriodType();
|
this.lockinPeriodType = product.lockinPeriodType;
|
||||||
this.isLockinPeriodAllowed = product.isLockinPeriodAllowed();
|
this.isLockinPeriodAllowed = product.isLockinPeriodAllowed;
|
||||||
|
|
||||||
this.currencyOptions = currencyOptions;
|
this.currencyOptions = currencyOptions;
|
||||||
this.interestCompoundedEveryPeriodTypeOptions = interestCompoundedEveryPeriodTypeOptions;
|
this.interestCompoundedEveryPeriodTypeOptions = interestCompoundedEveryPeriodTypeOptions;
|
||||||
@@ -180,11 +184,11 @@ public class DepositProductData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getMinimumBalance() {
|
public BigDecimal getMinimumBalance() {
|
||||||
return minimumBalance;
|
return minDeposit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getMaximumBalance() {
|
public BigDecimal getMaximumBalance() {
|
||||||
return maximumBalance;
|
return maxDeposit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getTenureInMonths() {
|
public Integer getTenureInMonths() {
|
||||||
@@ -192,15 +196,15 @@ public class DepositProductData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getMaturityDefaultInterestRate() {
|
public BigDecimal getMaturityDefaultInterestRate() {
|
||||||
return maturityDefaultInterestRate;
|
return defaultInterestRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getMaturityMinInterestRate() {
|
public BigDecimal getMaturityMinInterestRate() {
|
||||||
return maturityMinInterestRate;
|
return minInterestRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getMaturityMaxInterestRate() {
|
public BigDecimal getMaturityMaxInterestRate() {
|
||||||
return maturityMaxInterestRate;
|
return maxInterestRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getInterestCompoundedEvery() {
|
public Integer getInterestCompoundedEvery() {
|
||||||
|
|||||||
+69
-56
@@ -42,11 +42,14 @@ public class DepositProduct extends AbstractPersistable<Long> {
|
|||||||
@Embedded
|
@Embedded
|
||||||
private MonetaryCurrency currency;
|
private MonetaryCurrency currency;
|
||||||
|
|
||||||
@Column(name = "minimum_balance", scale = 6, precision = 19, nullable = false)
|
@Column(name = "min_deposit", scale = 6, precision = 19, nullable = false)
|
||||||
private BigDecimal minimumBalance;
|
private BigDecimal minDeposit;
|
||||||
|
|
||||||
|
@Column(name = "default_deposit", scale = 6, precision = 19, nullable = false)
|
||||||
|
private BigDecimal defaultDeposit;
|
||||||
|
|
||||||
@Column(name = "maximum_balance", scale = 6, precision = 19, nullable = false)
|
@Column(name = "max_deposit", scale = 6, precision = 19, nullable = false)
|
||||||
private BigDecimal maximumBalance;
|
private BigDecimal maxDeposit;
|
||||||
|
|
||||||
@Column(name = "interest_compounded_every", nullable = false)
|
@Column(name = "interest_compounded_every", nullable = false)
|
||||||
private Integer interestCompoundedEvery;
|
private Integer interestCompoundedEvery;
|
||||||
@@ -54,14 +57,14 @@ public class DepositProduct extends AbstractPersistable<Long> {
|
|||||||
@Column(name = "interest_compounded_every_period_enum", nullable = false)
|
@Column(name = "interest_compounded_every_period_enum", nullable = false)
|
||||||
private PeriodFrequencyType interestCompoundedEveryPeriodType;
|
private PeriodFrequencyType interestCompoundedEveryPeriodType;
|
||||||
|
|
||||||
@Column(name = "maturity_default_interest_rate", scale = 6, precision = 19, nullable = false)
|
@Column(name = "default_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||||
private BigDecimal maturityDefaultInterestRate;
|
private BigDecimal defaultInterestRate;
|
||||||
|
|
||||||
@Column(name = "maturity_min_interest_rate", scale = 6, precision = 19, nullable = false)
|
@Column(name = "min_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||||
private BigDecimal maturityMinInterestRate;
|
private BigDecimal minInterestRate;
|
||||||
|
|
||||||
@Column(name = "maturity_max_interest_rate", scale = 6, precision = 19, nullable = false)
|
@Column(name = "max_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||||
private BigDecimal maturityMaxInterestRate;
|
private BigDecimal maxInterestRate;
|
||||||
|
|
||||||
@Column(name = "tenure_months", nullable = false)
|
@Column(name = "tenure_months", nullable = false)
|
||||||
private Integer tenureInMonths;
|
private Integer tenureInMonths;
|
||||||
@@ -97,13 +100,14 @@ public class DepositProduct extends AbstractPersistable<Long> {
|
|||||||
final Integer digitsAfterDecimal = command.integerValueOfParameterNamed("digitsAfterDecimal");
|
final Integer digitsAfterDecimal = command.integerValueOfParameterNamed("digitsAfterDecimal");
|
||||||
|
|
||||||
final MonetaryCurrency currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal);
|
final MonetaryCurrency currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal);
|
||||||
final BigDecimal minimumBalance = command.bigDecimalValueOfParameterNamed("minimumBalance");
|
final BigDecimal minDeposit = command.bigDecimalValueOfParameterNamed("minDeposit");
|
||||||
final BigDecimal maximumBalance = command.bigDecimalValueOfParameterNamed("maximumBalance");
|
final BigDecimal defaultDeposit = command.bigDecimalValueOfParameterNamed("defaultDeposit");
|
||||||
|
final BigDecimal maxDeposit = command.bigDecimalValueOfParameterNamed("maxDeposit");
|
||||||
|
|
||||||
final Integer tenureMonths = command.integerValueOfParameterNamed("tenureInMonths");
|
final Integer tenureMonths = command.integerValueOfParameterNamed("tenureInMonths");
|
||||||
final BigDecimal maturityDefaultInterestRate = command.bigDecimalValueOfParameterNamed("maturityDefaultInterestRate");
|
final BigDecimal defaultInterestRate = command.bigDecimalValueOfParameterNamed("defaultInterestRate");
|
||||||
final BigDecimal maturityMinInterestRate = command.bigDecimalValueOfParameterNamed("maturityMinInterestRate");
|
final BigDecimal minInterestRate = command.bigDecimalValueOfParameterNamed("minInterestRate");
|
||||||
final BigDecimal maturityMaxInterestRate = command.bigDecimalValueOfParameterNamed("maturityMaxInterestRate");
|
final BigDecimal maxInterestRate = command.bigDecimalValueOfParameterNamed("maxInterestRate");
|
||||||
final Integer interestCompoundedEvery = command.integerValueOfParameterNamed("interestCompoundedEvery");
|
final Integer interestCompoundedEvery = command.integerValueOfParameterNamed("interestCompoundedEvery");
|
||||||
|
|
||||||
final boolean canRenew = command.booleanPrimitiveValueOfParameterNamed("canRenew");
|
final boolean canRenew = command.booleanPrimitiveValueOfParameterNamed("canRenew");
|
||||||
@@ -113,8 +117,8 @@ public class DepositProduct extends AbstractPersistable<Long> {
|
|||||||
final boolean isLockinPeriodAllowed = command.booleanPrimitiveValueOfParameterNamed("isLockinPeriodAllowed");
|
final boolean isLockinPeriodAllowed = command.booleanPrimitiveValueOfParameterNamed("isLockinPeriodAllowed");
|
||||||
final Integer lockinPeriod = command.integerValueOfParameterNamed("lockinPeriod");
|
final Integer lockinPeriod = command.integerValueOfParameterNamed("lockinPeriod");
|
||||||
|
|
||||||
return new DepositProduct(name, externalId, description, currency, minimumBalance, maximumBalance, tenureMonths,
|
return new DepositProduct(name, externalId, description, currency, minDeposit, defaultDeposit, maxDeposit, tenureMonths,
|
||||||
maturityDefaultInterestRate, maturityMinInterestRate, maturityMaxInterestRate, interestCompoundedEvery,
|
defaultInterestRate, minInterestRate, maxInterestRate, interestCompoundedEvery,
|
||||||
interestCompoundingPeriodType, canRenew, canPreClose, preClosureInterestRate, isInterestCompoundingAllowed,
|
interestCompoundingPeriodType, canRenew, canPreClose, preClosureInterestRate, isInterestCompoundingAllowed,
|
||||||
isLockinPeriodAllowed, lockinPeriod, lockinPeriodType);
|
isLockinPeriodAllowed, lockinPeriod, lockinPeriodType);
|
||||||
}
|
}
|
||||||
@@ -124,9 +128,9 @@ public class DepositProduct extends AbstractPersistable<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DepositProduct(final String name, final String externalId, final String description, final MonetaryCurrency currency,
|
private DepositProduct(final String name, final String externalId, final String description, final MonetaryCurrency currency,
|
||||||
final BigDecimal minimumBalance, final BigDecimal maximumBalance, final Integer tenureMonths,
|
final BigDecimal minDeposit, final BigDecimal defaultDeposit, final BigDecimal maxDeposit, final Integer tenureMonths,
|
||||||
final BigDecimal maturityDefaultInterestRate, final BigDecimal maturityMinInterestRate,
|
final BigDecimal defaultInterestRate, final BigDecimal minInterestRate,
|
||||||
final BigDecimal maturityMaxInterestRate, final Integer interestCompoundedEvery,
|
final BigDecimal maxInterestRate, final Integer interestCompoundedEvery,
|
||||||
final PeriodFrequencyType interestCompoundedEveryPeriodType, final boolean canRenew, final boolean canPreClose,
|
final PeriodFrequencyType interestCompoundedEveryPeriodType, final boolean canRenew, final boolean canPreClose,
|
||||||
final BigDecimal preClosureInterestRate, final boolean isInterestCompoundingAllowed, final boolean isLockinPeriodAllowed,
|
final BigDecimal preClosureInterestRate, final boolean isInterestCompoundingAllowed, final boolean isLockinPeriodAllowed,
|
||||||
final Integer lockinPeriod, final PeriodFrequencyType lockinPeriodType) {
|
final Integer lockinPeriod, final PeriodFrequencyType lockinPeriodType) {
|
||||||
@@ -143,12 +147,13 @@ public class DepositProduct extends AbstractPersistable<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.currency = currency;
|
this.currency = currency;
|
||||||
this.minimumBalance = minimumBalance;
|
this.minDeposit = minDeposit;
|
||||||
this.maximumBalance = maximumBalance;
|
this.defaultDeposit = defaultDeposit;
|
||||||
|
this.maxDeposit = maxDeposit;
|
||||||
this.tenureInMonths = tenureMonths;
|
this.tenureInMonths = tenureMonths;
|
||||||
this.maturityDefaultInterestRate = maturityDefaultInterestRate;
|
this.defaultInterestRate = defaultInterestRate;
|
||||||
this.maturityMinInterestRate = maturityMinInterestRate;
|
this.minInterestRate = minInterestRate;
|
||||||
this.maturityMaxInterestRate = maturityMaxInterestRate;
|
this.maxInterestRate = maxInterestRate;
|
||||||
this.interestCompoundedEvery = interestCompoundedEvery;
|
this.interestCompoundedEvery = interestCompoundedEvery;
|
||||||
this.interestCompoundedEveryPeriodType = interestCompoundedEveryPeriodType;
|
this.interestCompoundedEveryPeriodType = interestCompoundedEveryPeriodType;
|
||||||
this.renewalAllowed = canRenew;
|
this.renewalAllowed = canRenew;
|
||||||
@@ -176,12 +181,12 @@ public class DepositProduct extends AbstractPersistable<Long> {
|
|||||||
return tenureInMonths;
|
return tenureInMonths;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getMaturityDefaultInterestRate() {
|
public BigDecimal getDefaultInterestRate() {
|
||||||
return maturityDefaultInterestRate;
|
return defaultInterestRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getMaturityMinInterestRate() {
|
public BigDecimal getMinInterestRate() {
|
||||||
return maturityMinInterestRate;
|
return minInterestRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getPreClosureInterestRate() {
|
public BigDecimal getPreClosureInterestRate() {
|
||||||
@@ -275,20 +280,28 @@ public class DepositProduct extends AbstractPersistable<Long> {
|
|||||||
this.currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal);
|
this.currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String minimumBalanceParamName = "minimumBalance";
|
final String minDepositParamName = "minDeposit";
|
||||||
if (command.isChangeInBigDecimalParameterNamed(minimumBalanceParamName, this.minimumBalance)) {
|
if (command.isChangeInBigDecimalParameterNamed(minDepositParamName, this.minDeposit)) {
|
||||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(minimumBalanceParamName);
|
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(minDepositParamName);
|
||||||
actualChanges.put(minimumBalanceParamName, newValue);
|
actualChanges.put(minDepositParamName, newValue);
|
||||||
actualChanges.put("locale", localeAsInput);
|
actualChanges.put("locale", localeAsInput);
|
||||||
this.minimumBalance = newValue;
|
this.minDeposit = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String defaultDepositParamName = "defaultDeposit";
|
||||||
|
if (command.isChangeInBigDecimalParameterNamed(defaultDepositParamName, this.defaultDeposit)) {
|
||||||
|
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(defaultDepositParamName);
|
||||||
|
actualChanges.put(defaultDepositParamName, newValue);
|
||||||
|
actualChanges.put("locale", localeAsInput);
|
||||||
|
this.defaultDeposit = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String maximumBalanceParamName = "maximumBalance";
|
final String maxDepositParamName = "maxDeposit";
|
||||||
if (command.isChangeInBigDecimalParameterNamed(maximumBalanceParamName, this.maximumBalance)) {
|
if (command.isChangeInBigDecimalParameterNamed(maxDepositParamName, this.maxDeposit)) {
|
||||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(maximumBalanceParamName);
|
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(maxDepositParamName);
|
||||||
actualChanges.put(maximumBalanceParamName, newValue);
|
actualChanges.put(maxDepositParamName, newValue);
|
||||||
actualChanges.put("locale", localeAsInput);
|
actualChanges.put("locale", localeAsInput);
|
||||||
this.maximumBalance = newValue;
|
this.maxDeposit = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String tenureInMonthsParamName = "tenureInMonths";
|
final String tenureInMonthsParamName = "tenureInMonths";
|
||||||
@@ -299,28 +312,28 @@ public class DepositProduct extends AbstractPersistable<Long> {
|
|||||||
this.tenureInMonths = newValue;
|
this.tenureInMonths = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String defaultInterestRateParamName = "maturityDefaultInterestRate";
|
final String defaultInterestRateParamName = "defaultInterestRate";
|
||||||
if (command.isChangeInBigDecimalParameterNamed(defaultInterestRateParamName, this.maturityDefaultInterestRate)) {
|
if (command.isChangeInBigDecimalParameterNamed(defaultInterestRateParamName, this.defaultInterestRate)) {
|
||||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(defaultInterestRateParamName);
|
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(defaultInterestRateParamName);
|
||||||
actualChanges.put(defaultInterestRateParamName, newValue);
|
actualChanges.put(defaultInterestRateParamName, newValue);
|
||||||
actualChanges.put("locale", localeAsInput);
|
actualChanges.put("locale", localeAsInput);
|
||||||
this.maturityDefaultInterestRate = newValue;
|
this.defaultInterestRate = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String minInterestRateParamName = "maturityMinInterestRate";
|
final String minInterestRateParamName = "minInterestRate";
|
||||||
if (command.isChangeInBigDecimalParameterNamed(minInterestRateParamName, this.maturityMinInterestRate)) {
|
if (command.isChangeInBigDecimalParameterNamed(minInterestRateParamName, this.minInterestRate)) {
|
||||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(minInterestRateParamName);
|
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(minInterestRateParamName);
|
||||||
actualChanges.put(minInterestRateParamName, newValue);
|
actualChanges.put(minInterestRateParamName, newValue);
|
||||||
actualChanges.put("locale", localeAsInput);
|
actualChanges.put("locale", localeAsInput);
|
||||||
this.maturityMinInterestRate = newValue;
|
this.minInterestRate = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String maxInterestRateParamName = "maturityMaxInterestRate";
|
final String maxInterestRateParamName = "maxInterestRate";
|
||||||
if (command.isChangeInBigDecimalParameterNamed(maxInterestRateParamName, this.maturityMaxInterestRate)) {
|
if (command.isChangeInBigDecimalParameterNamed(maxInterestRateParamName, this.maxInterestRate)) {
|
||||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(maxInterestRateParamName);
|
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(maxInterestRateParamName);
|
||||||
actualChanges.put(maxInterestRateParamName, newValue);
|
actualChanges.put(maxInterestRateParamName, newValue);
|
||||||
actualChanges.put("locale", localeAsInput);
|
actualChanges.put("locale", localeAsInput);
|
||||||
this.maturityMaxInterestRate = newValue;
|
this.maxInterestRate = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String interestCompoundedEveryParamName = "interestCompoundedEvery";
|
final String interestCompoundedEveryParamName = "interestCompoundedEvery";
|
||||||
@@ -401,36 +414,36 @@ public class DepositProduct extends AbstractPersistable<Long> {
|
|||||||
|
|
||||||
public void validateInterestRateInRange(final BigDecimal interestRate) {
|
public void validateInterestRateInRange(final BigDecimal interestRate) {
|
||||||
boolean inRange = true;
|
boolean inRange = true;
|
||||||
if (interestRate.compareTo(this.maturityMinInterestRate) < 0) {
|
if (interestRate.compareTo(this.minInterestRate) < 0) {
|
||||||
inRange = false;
|
inRange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.maturityMaxInterestRate.compareTo(interestRate) < 0) {
|
if (this.maxInterestRate.compareTo(interestRate) < 0) {
|
||||||
inRange = false;
|
inRange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inRange) {
|
if (!inRange) {
|
||||||
final String actualValue = interestRate.toPlainString();
|
final String actualValue = interestRate.toPlainString();
|
||||||
final String minValue = (this.maturityMinInterestRate == null) ? "" : this.maturityMinInterestRate.toPlainString();
|
final String minValue = (this.minInterestRate == null) ? "" : this.minInterestRate.toPlainString();
|
||||||
final String maxValue = (this.maturityMaxInterestRate == null) ? "" : this.maturityMaxInterestRate.toPlainString();
|
final String maxValue = (this.maxInterestRate == null) ? "" : this.maxInterestRate.toPlainString();
|
||||||
throw new DepositProductValueOutsideRangeException(actualValue, minValue, maxValue, "deposit.account.maturityInterestRate");
|
throw new DepositProductValueOutsideRangeException(actualValue, minValue, maxValue, "deposit.account.maturityInterestRate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateDepositInRange(final BigDecimal depositAmount) {
|
public void validateDepositInRange(final BigDecimal depositAmount) {
|
||||||
boolean inRange = true;
|
boolean inRange = true;
|
||||||
if (depositAmount.compareTo(this.minimumBalance) < 0) {
|
if (depositAmount.compareTo(this.minDeposit) < 0) {
|
||||||
inRange = false;
|
inRange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.maximumBalance != null && this.maximumBalance.compareTo(depositAmount) < 0) {
|
if (this.maxDeposit != null && this.maxDeposit.compareTo(depositAmount) < 0) {
|
||||||
inRange = false;
|
inRange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inRange) {
|
if (!inRange) {
|
||||||
final String actualValue = depositAmount.toPlainString();
|
final String actualValue = depositAmount.toPlainString();
|
||||||
final String minValue = (this.minimumBalance == null) ? "" : this.minimumBalance.toPlainString();
|
final String minValue = (this.minDeposit == null) ? "" : this.minDeposit.toPlainString();
|
||||||
final String maxValue = (this.maximumBalance == null) ? "" : this.maximumBalance.toPlainString();
|
final String maxValue = (this.maxDeposit == null) ? "" : this.maxDeposit.toPlainString();
|
||||||
throw new DepositProductValueOutsideRangeException(actualValue, minValue, maxValue, "deposit.account.deposit.amount");
|
throw new DepositProductValueOutsideRangeException(actualValue, minValue, maxValue, "deposit.account.deposit.amount");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+51
-41
@@ -29,8 +29,8 @@ public final class DepositProductCommandFromApiJsonDeserializer {
|
|||||||
* The parameters supported for this command.
|
* The parameters supported for this command.
|
||||||
*/
|
*/
|
||||||
private final Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale", "name", "externalId", "description",
|
private final Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale", "name", "externalId", "description",
|
||||||
"currencyCode", "digitsAfterDecimal", "minimumBalance", "maximumBalance", "tenureInMonths", "maturityDefaultInterestRate",
|
"currencyCode", "digitsAfterDecimal", "minDeposit", "defaultDeposit", "maxDeposit", "tenureInMonths", "defaultInterestRate",
|
||||||
"maturityMinInterestRate", "maturityMaxInterestRate", "interestCompoundedEvery", "interestCompoundedEveryPeriodType",
|
"minInterestRate", "maxInterestRate", "interestCompoundedEvery", "interestCompoundedEveryPeriodType",
|
||||||
"renewalAllowed", "preClosureAllowed", "preClosureInterestRate", "interestCompoundingAllowed", "isLockinPeriodAllowed",
|
"renewalAllowed", "preClosureAllowed", "preClosureInterestRate", "interestCompoundingAllowed", "isLockinPeriodAllowed",
|
||||||
"lockinPeriod", "lockinPeriodType"));
|
"lockinPeriod", "lockinPeriodType"));
|
||||||
|
|
||||||
@@ -71,34 +71,39 @@ public final class DepositProductCommandFromApiJsonDeserializer {
|
|||||||
final Integer digitsAfterDecimal = fromApiJsonHelper.extractIntegerNamed("digitsAfterDecimal", element, Locale.getDefault());
|
final Integer digitsAfterDecimal = fromApiJsonHelper.extractIntegerNamed("digitsAfterDecimal", element, Locale.getDefault());
|
||||||
baseDataValidator.reset().parameter("digitsAfterDecimal").value(digitsAfterDecimal).notNull().inMinMaxRange(0, 6);
|
baseDataValidator.reset().parameter("digitsAfterDecimal").value(digitsAfterDecimal).notNull().inMinMaxRange(0, 6);
|
||||||
|
|
||||||
final BigDecimal minimumBalance = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("minimumBalance", element);
|
final BigDecimal minDeposit = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("minDeposit", element);
|
||||||
baseDataValidator.reset().parameter("minimumBalance").value(minimumBalance).notNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("minDeposit").value(minDeposit).notNull().zeroOrPositiveAmount();
|
||||||
|
|
||||||
|
final BigDecimal defaultDeposit = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("defaultDeposit", element);
|
||||||
|
baseDataValidator.reset().parameter("defaultDeposit").value(defaultDeposit).notNull().zeroOrPositiveAmount();
|
||||||
|
|
||||||
if (fromApiJsonHelper.parameterExists("maximumBalance", element)) {
|
if (fromApiJsonHelper.parameterExists("maxDeposit", element)) {
|
||||||
final BigDecimal maximumBalance = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maximumBalance", element);
|
final BigDecimal maxDeposit = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maxDeposit", element);
|
||||||
baseDataValidator.reset().parameter("maximumBalance").value(maximumBalance).zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("maxDeposit").value(maxDeposit).notNull().zeroOrPositiveAmount();
|
||||||
baseDataValidator.reset().parameter("minimumBalance").comapareMinimumAndMaximumAmounts(minimumBalance, maximumBalance);
|
baseDataValidator.reset().parameter("minDeposit").comapareMinimumAndMaximumAmounts(minDeposit, maxDeposit);
|
||||||
|
baseDataValidator.reset().parameter("defaultDeposit").comapareMinimumAndMaximumAmounts(defaultDeposit, maxDeposit);
|
||||||
|
baseDataValidator.reset().parameter("minDeposit").comapareMinimumAndMaximumAmounts(minDeposit, defaultDeposit);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Integer tenureInMonths = fromApiJsonHelper.extractIntegerNamed("tenureInMonths", element, Locale.getDefault());
|
final Integer tenureInMonths = fromApiJsonHelper.extractIntegerNamed("tenureInMonths", element, Locale.getDefault());
|
||||||
baseDataValidator.reset().parameter("tenureInMonths").value(tenureInMonths).notNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("tenureInMonths").value(tenureInMonths).notNull().zeroOrPositiveAmount();
|
||||||
|
|
||||||
final BigDecimal maturityDefaultInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maturityDefaultInterestRate",
|
final BigDecimal defaultInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("defaultInterestRate",
|
||||||
element);
|
element);
|
||||||
baseDataValidator.reset().parameter("maturityDefaultInterestRate").value(maturityDefaultInterestRate).notNull()
|
baseDataValidator.reset().parameter("defaultInterestRate").value(defaultInterestRate).notNull()
|
||||||
.zeroOrPositiveAmount();
|
.zeroOrPositiveAmount();
|
||||||
|
|
||||||
final BigDecimal maturityMinInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maturityMinInterestRate", element);
|
final BigDecimal minInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("minInterestRate", element);
|
||||||
baseDataValidator.reset().parameter("maturityMinInterestRate").value(maturityMinInterestRate).notNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("minInterestRate").value(minInterestRate).notNull().zeroOrPositiveAmount();
|
||||||
|
|
||||||
final BigDecimal maturityMaxInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maturityMaxInterestRate", element);
|
final BigDecimal maxInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maxInterestRate", element);
|
||||||
baseDataValidator.reset().parameter("maturityMaxInterestRate").value(maturityMaxInterestRate).notNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("maxInterestRate").value(maxInterestRate).notNull().zeroOrPositiveAmount();
|
||||||
baseDataValidator.reset().parameter("maturityMinInterestRate")
|
baseDataValidator.reset().parameter("minInterestRate")
|
||||||
.comapareMinAndMaxOfTwoBigDecmimalNos(maturityMinInterestRate, maturityMaxInterestRate);
|
.comapareMinAndMaxOfTwoBigDecmimalNos(minInterestRate, maxInterestRate);
|
||||||
baseDataValidator.reset().parameter("maturityDefaultInterestRate")
|
baseDataValidator.reset().parameter("defaultInterestRate")
|
||||||
.comapareMinAndMaxOfTwoBigDecmimalNos(maturityDefaultInterestRate, maturityMaxInterestRate);
|
.comapareMinAndMaxOfTwoBigDecmimalNos(defaultInterestRate, maxInterestRate);
|
||||||
baseDataValidator.reset().parameter("maturityMinInterestRate")
|
baseDataValidator.reset().parameter("minInterestRate")
|
||||||
.comapareMinAndMaxOfTwoBigDecmimalNos(maturityMinInterestRate, maturityDefaultInterestRate);
|
.comapareMinAndMaxOfTwoBigDecmimalNos(minInterestRate, defaultInterestRate);
|
||||||
|
|
||||||
final Integer interestCompoundedEvery = fromApiJsonHelper.extractIntegerNamed("interestCompoundedEvery", element,
|
final Integer interestCompoundedEvery = fromApiJsonHelper.extractIntegerNamed("interestCompoundedEvery", element,
|
||||||
Locale.getDefault());
|
Locale.getDefault());
|
||||||
@@ -124,17 +129,17 @@ public final class DepositProductCommandFromApiJsonDeserializer {
|
|||||||
final BigDecimal preClosureInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("preClosureInterestRate", element);
|
final BigDecimal preClosureInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("preClosureInterestRate", element);
|
||||||
baseDataValidator.reset().parameter("preClosureInterestRate").value(preClosureInterestRate).notNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("preClosureInterestRate").value(preClosureInterestRate).notNull().zeroOrPositiveAmount();
|
||||||
baseDataValidator.reset().parameter("preClosureInterestRate")
|
baseDataValidator.reset().parameter("preClosureInterestRate")
|
||||||
.comapareMinAndMaxOfTwoBigDecmimalNos(preClosureInterestRate, maturityMinInterestRate);
|
.comapareMinAndMaxOfTwoBigDecmimalNos(preClosureInterestRate, minInterestRate);
|
||||||
|
|
||||||
final Boolean isLockinPeriodAllowed = fromApiJsonHelper.extractBooleanNamed("isLockinPeriodAllowed", element);
|
final Boolean isLockinPeriodAllowed = fromApiJsonHelper.extractBooleanNamed("isLockinPeriodAllowed", element);
|
||||||
baseDataValidator.reset().parameter("isLockinPeriodAllowed").value(isLockinPeriodAllowed)
|
baseDataValidator.reset().parameter("isLockinPeriodAllowed").value(isLockinPeriodAllowed)
|
||||||
.trueOrFalseRequired(isBooleanValueUpdated(isLockinPeriodAllowed));
|
.trueOrFalseRequired(isBooleanValueUpdated(isLockinPeriodAllowed));
|
||||||
|
|
||||||
final Integer lockinPeriod = fromApiJsonHelper.extractIntegerNamed("lockinPeriod", element, Locale.getDefault());
|
final Integer lockinPeriod = fromApiJsonHelper.extractIntegerNamed("lockinPeriod", element, Locale.getDefault());
|
||||||
baseDataValidator.reset().parameter("lockinPeriod").value(lockinPeriod).notNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("lockinPeriod").value(lockinPeriod).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
|
|
||||||
final Integer lockinPeriodType = fromApiJsonHelper.extractIntegerNamed("lockinPeriodType", element, Locale.getDefault());
|
final Integer lockinPeriodType = fromApiJsonHelper.extractIntegerNamed("lockinPeriodType", element, Locale.getDefault());
|
||||||
baseDataValidator.reset().parameter("lockinPeriodType").value(lockinPeriodType).notNull().inMinMaxRange(1, 3);
|
baseDataValidator.reset().parameter("lockinPeriodType").value(lockinPeriodType).ignoreIfNull().inMinMaxRange(1, 3);
|
||||||
|
|
||||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||||
}
|
}
|
||||||
@@ -165,32 +170,37 @@ public final class DepositProductCommandFromApiJsonDeserializer {
|
|||||||
final Integer digitsAfterDecimal = fromApiJsonHelper.extractIntegerNamed("digitsAfterDecimal", element, Locale.getDefault());
|
final Integer digitsAfterDecimal = fromApiJsonHelper.extractIntegerNamed("digitsAfterDecimal", element, Locale.getDefault());
|
||||||
baseDataValidator.reset().parameter("digitsAfterDecimal").value(digitsAfterDecimal).ignoreIfNull().inMinMaxRange(0, 6);
|
baseDataValidator.reset().parameter("digitsAfterDecimal").value(digitsAfterDecimal).ignoreIfNull().inMinMaxRange(0, 6);
|
||||||
|
|
||||||
final BigDecimal minimumBalance = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("minimumBalance", element);
|
final BigDecimal minDeposit = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("minDeposit", element);
|
||||||
baseDataValidator.reset().parameter("minimumBalance").value(minimumBalance).ignoreIfNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("minDeposit").value(minDeposit).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
|
|
||||||
|
final BigDecimal defaultDeposit = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("defaultDeposit", element);
|
||||||
|
baseDataValidator.reset().parameter("defaultDeposit").value(defaultDeposit).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
|
|
||||||
final BigDecimal maximumBalance = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maximumBalance", element);
|
final BigDecimal maxDeposit = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maxDeposit", element);
|
||||||
baseDataValidator.reset().parameter("maximumBalance").value(maximumBalance).ignoreIfNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("maxDeposit").value(maxDeposit).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
baseDataValidator.reset().parameter("minimumBalance").comapareMinimumAndMaximumAmounts(minimumBalance, maximumBalance);
|
baseDataValidator.reset().parameter("minDeposit").comapareMinimumAndMaximumAmounts(minDeposit, maxDeposit);
|
||||||
|
baseDataValidator.reset().parameter("defaultDeposit").comapareMinimumAndMaximumAmounts(defaultDeposit, maxDeposit);
|
||||||
|
baseDataValidator.reset().parameter("minDeposit").comapareMinimumAndMaximumAmounts(minDeposit, defaultDeposit);
|
||||||
|
|
||||||
final Integer tenureInMonths = fromApiJsonHelper.extractIntegerNamed("tenureInMonths", element, Locale.getDefault());
|
final Integer tenureInMonths = fromApiJsonHelper.extractIntegerNamed("tenureInMonths", element, Locale.getDefault());
|
||||||
baseDataValidator.reset().parameter("tenureInMonths").value(tenureInMonths).ignoreIfNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("tenureInMonths").value(tenureInMonths).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
|
|
||||||
final BigDecimal maturityDefaultInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maturityDefaultInterestRate",
|
final BigDecimal defaultInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("defaultInterestRate",
|
||||||
element);
|
element);
|
||||||
baseDataValidator.reset().parameter("maturityDefaultInterestRate").value(maturityDefaultInterestRate).ignoreIfNull()
|
baseDataValidator.reset().parameter("defaultInterestRate").value(defaultInterestRate).ignoreIfNull()
|
||||||
.zeroOrPositiveAmount();
|
.zeroOrPositiveAmount();
|
||||||
|
|
||||||
final BigDecimal maturityMinInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maturityMinInterestRate", element);
|
final BigDecimal minInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("minInterestRate", element);
|
||||||
baseDataValidator.reset().parameter("maturityMinInterestRate").value(maturityMinInterestRate).ignoreIfNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("minInterestRate").value(minInterestRate).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
|
|
||||||
final BigDecimal maturityMaxInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maturityMaxInterestRate", element);
|
final BigDecimal maxInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("maxInterestRate", element);
|
||||||
baseDataValidator.reset().parameter("maturityMaxInterestRate").value(maturityMaxInterestRate).ignoreIfNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("maxInterestRate").value(maxInterestRate).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
baseDataValidator.reset().parameter("maturityMinInterestRate")
|
baseDataValidator.reset().parameter("minInterestRate")
|
||||||
.comapareMinAndMaxOfTwoBigDecmimalNos(maturityMinInterestRate, maturityMaxInterestRate);
|
.comapareMinAndMaxOfTwoBigDecmimalNos(minInterestRate, maxInterestRate);
|
||||||
baseDataValidator.reset().parameter("maturityDefaultInterestRate")
|
baseDataValidator.reset().parameter("defaultInterestRate")
|
||||||
.comapareMinAndMaxOfTwoBigDecmimalNos(maturityDefaultInterestRate, maturityMaxInterestRate);
|
.comapareMinAndMaxOfTwoBigDecmimalNos(defaultInterestRate, maxInterestRate);
|
||||||
baseDataValidator.reset().parameter("maturityMinInterestRate")
|
baseDataValidator.reset().parameter("minInterestRate")
|
||||||
.comapareMinAndMaxOfTwoBigDecmimalNos(maturityMinInterestRate, maturityDefaultInterestRate);
|
.comapareMinAndMaxOfTwoBigDecmimalNos(minInterestRate, defaultInterestRate);
|
||||||
|
|
||||||
final Integer interestCompoundedEvery = fromApiJsonHelper.extractIntegerNamed("interestCompoundedEvery", element,
|
final Integer interestCompoundedEvery = fromApiJsonHelper.extractIntegerNamed("interestCompoundedEvery", element,
|
||||||
Locale.getDefault());
|
Locale.getDefault());
|
||||||
@@ -216,7 +226,7 @@ public final class DepositProductCommandFromApiJsonDeserializer {
|
|||||||
final BigDecimal preClosureInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("preClosureInterestRate", element);
|
final BigDecimal preClosureInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("preClosureInterestRate", element);
|
||||||
baseDataValidator.reset().parameter("preClosureInterestRate").value(preClosureInterestRate).ignoreIfNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter("preClosureInterestRate").value(preClosureInterestRate).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
baseDataValidator.reset().parameter("preClosureInterestRate")
|
baseDataValidator.reset().parameter("preClosureInterestRate")
|
||||||
.comapareMinAndMaxOfTwoBigDecmimalNos(preClosureInterestRate, maturityMinInterestRate);
|
.comapareMinAndMaxOfTwoBigDecmimalNos(preClosureInterestRate, minInterestRate);
|
||||||
|
|
||||||
final Boolean lockinPeriodAllowed = fromApiJsonHelper.extractBooleanNamed("isLockinPeriodAllowed", element);
|
final Boolean lockinPeriodAllowed = fromApiJsonHelper.extractBooleanNamed("isLockinPeriodAllowed", element);
|
||||||
baseDataValidator.reset().parameter("isLockinPeriodAllowed").value(lockinPeriodAllowed).ignoreIfNull()
|
baseDataValidator.reset().parameter("isLockinPeriodAllowed").value(lockinPeriodAllowed).ignoreIfNull()
|
||||||
|
|||||||
+11
-10
@@ -84,10 +84,10 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead
|
|||||||
|
|
||||||
public String depositProductSchema() {
|
public String depositProductSchema() {
|
||||||
return " dp.id as id, dp.external_id as exernalId, dp.name as name, dp.description as description,dp.currency_code as currencyCode, dp.currency_digits as currencyDigits, "
|
return " dp.id as id, dp.external_id as exernalId, dp.name as name, dp.description as description,dp.currency_code as currencyCode, dp.currency_digits as currencyDigits, "
|
||||||
+ "dp.minimum_balance as minimumBalance,dp.maximum_balance as maximumBalance, dp.tenure_months as tenureMonths, "
|
+ "dp.min_deposit as minDeposit, dp.default_deposit as defaultDeposit, dp.max_deposit as maxDeposit, dp.tenure_months as tenureMonths, "
|
||||||
+ "dp.interest_compounded_every as interestCompoundedEvery, dp.interest_compounded_every_period_enum as interestCompoundedEveryPeriodType, "
|
+ "dp.interest_compounded_every as interestCompoundedEvery, dp.interest_compounded_every_period_enum as interestCompoundedEveryPeriodType, "
|
||||||
+ "dp.maturity_default_interest_rate as maturityDefaultInterestRate, dp.is_compounding_interest_allowed as interestCompoundingAllowed, "
|
+ "dp.default_interest_rate as defaultInterestRate, dp.is_compounding_interest_allowed as interestCompoundingAllowed, "
|
||||||
+ "dp.maturity_min_interest_rate as maturityMinInterestRate, dp.maturity_max_interest_rate as maturityMaxInterestRate, "
|
+ "dp.min_interest_rate as minInterestRate, dp.max_interest_rate as maxInterestRate, "
|
||||||
+ "dp.is_renewal_allowed as canRenew, dp.is_preclosure_allowed as canPreClose, dp.pre_closure_interest_rate as preClosureInterestRate, "
|
+ "dp.is_renewal_allowed as canRenew, dp.is_preclosure_allowed as canPreClose, dp.pre_closure_interest_rate as preClosureInterestRate, "
|
||||||
+ "dp.is_lock_in_period_allowed as isLockinPeriodAllowed, dp.lock_in_period as lockinPeriod, dp.lock_in_period_type as lockinPeriodType, "
|
+ "dp.is_lock_in_period_allowed as isLockinPeriodAllowed, dp.lock_in_period as lockinPeriod, dp.lock_in_period_type as lockinPeriodType, "
|
||||||
+ "curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, curr.display_symbol as currencyDisplaySymbol "
|
+ "curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, curr.display_symbol as currencyDisplaySymbol "
|
||||||
@@ -109,8 +109,9 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead
|
|||||||
String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||||
CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol, currencyNameCode);
|
CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol, currencyNameCode);
|
||||||
|
|
||||||
BigDecimal minimumBalance = rs.getBigDecimal("minimumBalance");
|
BigDecimal minDeposit = rs.getBigDecimal("minDeposit");
|
||||||
BigDecimal maximumBalance = rs.getBigDecimal("maximumBalance");
|
BigDecimal defaultDeposit = rs.getBigDecimal("defaultDeposit");
|
||||||
|
BigDecimal maxDeposit = rs.getBigDecimal("maxDeposit");
|
||||||
|
|
||||||
Integer tenureMonths = JdbcSupport.getInteger(rs, "tenureMonths");
|
Integer tenureMonths = JdbcSupport.getInteger(rs, "tenureMonths");
|
||||||
Integer interestCompoundedEvery = JdbcSupport.getInteger(rs, "interestCompoundedEvery");
|
Integer interestCompoundedEvery = JdbcSupport.getInteger(rs, "interestCompoundedEvery");
|
||||||
@@ -118,9 +119,9 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead
|
|||||||
EnumOptionData interestCompoundedEveryPeriodType = SavingsDepositEnumerations
|
EnumOptionData interestCompoundedEveryPeriodType = SavingsDepositEnumerations
|
||||||
.interestCompoundingPeriodType(interestCompoundedEveryPeriodTypeValue);
|
.interestCompoundingPeriodType(interestCompoundedEveryPeriodTypeValue);
|
||||||
|
|
||||||
BigDecimal maturityDefaultInterestRate = rs.getBigDecimal("maturityDefaultInterestRate");
|
BigDecimal defaultInterestRate = rs.getBigDecimal("defaultInterestRate");
|
||||||
BigDecimal maturityMinInterestRate = rs.getBigDecimal("maturityMinInterestRate");
|
BigDecimal minInterestRate = rs.getBigDecimal("minInterestRate");
|
||||||
BigDecimal maturityMaxInterestRate = rs.getBigDecimal("maturityMaxInterestRate");
|
BigDecimal maxInterestRate = rs.getBigDecimal("maxInterestRate");
|
||||||
|
|
||||||
Boolean canRenew = rs.getBoolean("canRenew");
|
Boolean canRenew = rs.getBoolean("canRenew");
|
||||||
Boolean canPreClose = rs.getBoolean("canPreClose");
|
Boolean canPreClose = rs.getBoolean("canPreClose");
|
||||||
@@ -134,8 +135,8 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead
|
|||||||
EnumOptionData lockinPeriodType = SavingsDepositEnumerations.interestCompoundingPeriodType(lockinPeriodTypeValue);
|
EnumOptionData lockinPeriodType = SavingsDepositEnumerations.interestCompoundingPeriodType(lockinPeriodTypeValue);
|
||||||
|
|
||||||
return new DepositProductData(id, exernalId, name, description, currencyCode, currencyDigits,
|
return new DepositProductData(id, exernalId, name, description, currencyCode, currencyDigits,
|
||||||
minimumBalance, maximumBalance, tenureMonths, maturityDefaultInterestRate, maturityMinInterestRate,
|
minDeposit, defaultDeposit, maxDeposit, tenureMonths, defaultInterestRate, minInterestRate,
|
||||||
maturityMaxInterestRate, interestCompoundedEvery, interestCompoundedEveryPeriodType, canRenew, canPreClose,
|
maxInterestRate, interestCompoundedEvery, interestCompoundedEveryPeriodType, canRenew, canPreClose,
|
||||||
preClosureInterestRate, interestCompoundingAllowed, isLockinPeriodAllowed, lockinPeriod, lockinPeriodType, currencyData);
|
preClosureInterestRate, interestCompoundingAllowed, isLockinPeriodAllowed, lockinPeriod, lockinPeriodType, currencyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -72,11 +72,14 @@ public class DepositProductWritePlatformServiceJpaRepositoryImpl implements Depo
|
|||||||
this.context.authenticatedUser();
|
this.context.authenticatedUser();
|
||||||
this.fromApiJsonDeserializer.validateForCreate(command.json());
|
this.fromApiJsonDeserializer.validateForCreate(command.json());
|
||||||
|
|
||||||
|
PeriodFrequencyType lockinPeriodType = null;
|
||||||
final Integer interestCompoundingPeriodTypeIntValue = command.integerValueOfParameterNamed("interestCompoundedEveryPeriodType");
|
final Integer interestCompoundingPeriodTypeIntValue = command.integerValueOfParameterNamed("interestCompoundedEveryPeriodType");
|
||||||
PeriodFrequencyType interestCompoundingPeriodType = PeriodFrequencyType.fromInt(interestCompoundingPeriodTypeIntValue);
|
PeriodFrequencyType interestCompoundingPeriodType = PeriodFrequencyType.fromInt(interestCompoundingPeriodTypeIntValue);
|
||||||
|
|
||||||
final Integer lockinPeriodTypeIntValue = command.integerValueOfParameterNamed("lockinPeriodType");
|
final Integer lockinPeriodTypeIntValue = command.integerValueOfParameterNamed("lockinPeriodType");
|
||||||
PeriodFrequencyType lockinPeriodType = PeriodFrequencyType.fromInt(lockinPeriodTypeIntValue);
|
if (lockinPeriodTypeIntValue != null) {
|
||||||
|
lockinPeriodType = PeriodFrequencyType.fromInt(lockinPeriodTypeIntValue);
|
||||||
|
}
|
||||||
|
|
||||||
DepositProduct product = DepositProduct.assembleFromJson(command, interestCompoundingPeriodType, lockinPeriodType);
|
DepositProduct product = DepositProduct.assembleFromJson(command, interestCompoundingPeriodType, lockinPeriodType);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user