fix up deposit account fields to be consistent with product.
This commit is contained in:
+4
-2
@@ -81,8 +81,10 @@ public class DepositAccountsApiResource {
|
|||||||
|
|
||||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
Set<String> typicalResponseParameters = new HashSet<String>(
|
||||||
Arrays.asList("createdOn", "lastModifedOn",
|
Arrays.asList("createdOn", "lastModifedOn",
|
||||||
"id", "clientId", "clientName", "productId", "productName",
|
"id", "externalId", "clientId", "clientName", "productId", "productName",
|
||||||
"currency", "deposit", "maturityInterestRate")
|
"currency", "deposit", "maturityInterestRate", "tenureInMonths", "interestCompoundedEvery", "interestCompoundedEveryPeriodType",
|
||||||
|
"renewalAllowed","preClosureAllowed","preClosureInterestRate"
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
|
|||||||
+37
-2
@@ -13,7 +13,7 @@ import org.joda.time.LocalDate;
|
|||||||
public class DepositAccountData {
|
public class DepositAccountData {
|
||||||
|
|
||||||
private final Long id;
|
private final Long id;
|
||||||
|
private final String externalId;
|
||||||
private final Long clientId;
|
private final Long clientId;
|
||||||
private final String clientName;
|
private final String clientName;
|
||||||
|
|
||||||
@@ -33,6 +33,9 @@ public class DepositAccountData {
|
|||||||
private final BigDecimal actualInterestAccrued;
|
private final BigDecimal actualInterestAccrued;
|
||||||
private final BigDecimal projectedMaturityAmount;
|
private final BigDecimal projectedMaturityAmount;
|
||||||
private final BigDecimal actualMaturityAmount;
|
private final BigDecimal actualMaturityAmount;
|
||||||
|
|
||||||
|
private final Integer interestCompoundedEvery;
|
||||||
|
private final EnumOptionData interestCompoundedEveryPeriodType;
|
||||||
private final boolean renewalAllowed;
|
private final boolean renewalAllowed;
|
||||||
private final boolean preClosureAllowed;
|
private final boolean preClosureAllowed;
|
||||||
private final BigDecimal preClosureInterestRate;
|
private final BigDecimal preClosureInterestRate;
|
||||||
@@ -41,11 +44,13 @@ public class DepositAccountData {
|
|||||||
private final DateTime lastModifedOn;
|
private final DateTime lastModifedOn;
|
||||||
|
|
||||||
private final List<CurrencyData> currencyOptions;
|
private final List<CurrencyData> currencyOptions;
|
||||||
|
private final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions;
|
||||||
|
|
||||||
public DepositAccountData() {
|
public DepositAccountData() {
|
||||||
this.createdOn = null;
|
this.createdOn = null;
|
||||||
this.lastModifedOn = null;
|
this.lastModifedOn = null;
|
||||||
this.id = null;
|
this.id = null;
|
||||||
|
this.externalId = null;
|
||||||
this.clientId = null;
|
this.clientId = null;
|
||||||
this.clientName = null;
|
this.clientName = null;
|
||||||
this.productId = null;
|
this.productId = null;
|
||||||
@@ -62,17 +67,21 @@ public class DepositAccountData {
|
|||||||
this.actualInterestAccrued = null;
|
this.actualInterestAccrued = null;
|
||||||
this.projectedMaturityAmount = null;
|
this.projectedMaturityAmount = null;
|
||||||
this.actualMaturityAmount = null;
|
this.actualMaturityAmount = null;
|
||||||
|
this.interestCompoundedEvery = null;
|
||||||
|
this.interestCompoundedEveryPeriodType = null;
|
||||||
this.renewalAllowed = false;
|
this.renewalAllowed = false;
|
||||||
this.preClosureAllowed = false;
|
this.preClosureAllowed = false;
|
||||||
this.preClosureInterestRate = null;
|
this.preClosureInterestRate = null;
|
||||||
|
|
||||||
this.currencyOptions = new ArrayList<CurrencyData>();
|
this.currencyOptions = new ArrayList<CurrencyData>();
|
||||||
|
this.interestCompoundedEveryPeriodTypeOptions = new ArrayList<EnumOptionData>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DepositAccountData(final DepositAccountData account, final List<CurrencyData> currencies) {
|
public DepositAccountData(final DepositAccountData account, final List<CurrencyData> currencies) {
|
||||||
this.createdOn = account.getCreatedOn();
|
this.createdOn = account.getCreatedOn();
|
||||||
this.lastModifedOn = account.getLastModifedOn();
|
this.lastModifedOn = account.getLastModifedOn();
|
||||||
this.id = account.getId();
|
this.id = account.getId();
|
||||||
|
this.externalId = account.getExternalId();
|
||||||
this.clientId = account.getClientId();
|
this.clientId = account.getClientId();
|
||||||
this.clientName = account.getClientName();
|
this.clientName = account.getClientName();
|
||||||
this.productId = account.getProductId();
|
this.productId = account.getProductId();
|
||||||
@@ -89,17 +98,21 @@ public class DepositAccountData {
|
|||||||
this.actualInterestAccrued = account.getActualInterestAccrued();
|
this.actualInterestAccrued = account.getActualInterestAccrued();
|
||||||
this.projectedMaturityAmount = account.getProjectedMaturityAmount();
|
this.projectedMaturityAmount = account.getProjectedMaturityAmount();
|
||||||
this.actualMaturityAmount = account.getActualMaturityAmount();
|
this.actualMaturityAmount = account.getActualMaturityAmount();
|
||||||
|
this.interestCompoundedEvery = account.getInterestCompoundedEvery();
|
||||||
|
this.interestCompoundedEveryPeriodType = account.getInterestCompoundedEveryPeriodType();
|
||||||
this.renewalAllowed = account.isRenewalAllowed();
|
this.renewalAllowed = account.isRenewalAllowed();
|
||||||
this.preClosureAllowed = account.isPreClosureAllowed();
|
this.preClosureAllowed = account.isPreClosureAllowed();
|
||||||
this.preClosureInterestRate = account.getPreClosureInterestRate();
|
this.preClosureInterestRate = account.getPreClosureInterestRate();
|
||||||
|
|
||||||
this.currencyOptions = currencies;
|
this.currencyOptions = currencies;
|
||||||
|
this.interestCompoundedEveryPeriodTypeOptions = new ArrayList<EnumOptionData>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DepositAccountData(
|
public DepositAccountData(
|
||||||
final DateTime createdOn,
|
final DateTime createdOn,
|
||||||
final DateTime lastModifedOn,
|
final DateTime lastModifedOn,
|
||||||
final Long id,
|
final Long id,
|
||||||
|
final String externalId,
|
||||||
final Long clientId,
|
final Long clientId,
|
||||||
final String clientName,
|
final String clientName,
|
||||||
final Long productId,
|
final Long productId,
|
||||||
@@ -114,13 +127,16 @@ public class DepositAccountData {
|
|||||||
final BigDecimal projectedInterestAccrued,
|
final BigDecimal projectedInterestAccrued,
|
||||||
final BigDecimal actualInterestAccrued,
|
final BigDecimal actualInterestAccrued,
|
||||||
final BigDecimal projectedMaturityAmount,
|
final BigDecimal projectedMaturityAmount,
|
||||||
final BigDecimal actualMaturityAmount,
|
final BigDecimal actualMaturityAmount,
|
||||||
|
final Integer interestCompoundedEvery,
|
||||||
|
final EnumOptionData interestCompoundedEveryPeriodType,
|
||||||
final boolean renewalAllowed,
|
final boolean renewalAllowed,
|
||||||
final boolean preClosureAllowed,
|
final boolean preClosureAllowed,
|
||||||
final BigDecimal preClosureInterestRate) {
|
final BigDecimal preClosureInterestRate) {
|
||||||
this.createdOn=createdOn;
|
this.createdOn=createdOn;
|
||||||
this.lastModifedOn=lastModifedOn;
|
this.lastModifedOn=lastModifedOn;
|
||||||
this.id=id;
|
this.id=id;
|
||||||
|
this.externalId = externalId;
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
this.clientName = clientName;
|
this.clientName = clientName;
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
@@ -137,17 +153,24 @@ public class DepositAccountData {
|
|||||||
this.actualInterestAccrued = actualInterestAccrued;
|
this.actualInterestAccrued = actualInterestAccrued;
|
||||||
this.projectedMaturityAmount = projectedMaturityAmount;
|
this.projectedMaturityAmount = projectedMaturityAmount;
|
||||||
this.actualMaturityAmount = actualMaturityAmount;
|
this.actualMaturityAmount = actualMaturityAmount;
|
||||||
|
this.interestCompoundedEvery = interestCompoundedEvery;
|
||||||
|
this.interestCompoundedEveryPeriodType = interestCompoundedEveryPeriodType;
|
||||||
this.renewalAllowed = renewalAllowed;
|
this.renewalAllowed = renewalAllowed;
|
||||||
this.preClosureAllowed = preClosureAllowed;
|
this.preClosureAllowed = preClosureAllowed;
|
||||||
this.preClosureInterestRate = preClosureInterestRate;
|
this.preClosureInterestRate = preClosureInterestRate;
|
||||||
|
|
||||||
this.currencyOptions = new ArrayList<CurrencyData>();
|
this.currencyOptions = new ArrayList<CurrencyData>();
|
||||||
|
this.interestCompoundedEveryPeriodTypeOptions = new ArrayList<EnumOptionData>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getExternalId() {
|
||||||
|
return externalId;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getClientId() {
|
public Long getClientId() {
|
||||||
return clientId;
|
return clientId;
|
||||||
}
|
}
|
||||||
@@ -211,6 +234,14 @@ public class DepositAccountData {
|
|||||||
public BigDecimal getActualMaturityAmount() {
|
public BigDecimal getActualMaturityAmount() {
|
||||||
return actualMaturityAmount;
|
return actualMaturityAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getInterestCompoundedEvery() {
|
||||||
|
return interestCompoundedEvery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnumOptionData getInterestCompoundedEveryPeriodType() {
|
||||||
|
return interestCompoundedEveryPeriodType;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isRenewalAllowed() {
|
public boolean isRenewalAllowed() {
|
||||||
return renewalAllowed;
|
return renewalAllowed;
|
||||||
@@ -235,4 +266,8 @@ public class DepositAccountData {
|
|||||||
public List<CurrencyData> getCurrencyOptions() {
|
public List<CurrencyData> getCurrencyOptions() {
|
||||||
return currencyOptions;
|
return currencyOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<EnumOptionData> getInterestCompoundedEveryPeriodTypeOptions() {
|
||||||
|
return interestCompoundedEveryPeriodTypeOptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+10
-6
@@ -1658,13 +1658,17 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
|
|||||||
final boolean prettyPrint,
|
final boolean prettyPrint,
|
||||||
final Set<String> responseParameters,
|
final Set<String> responseParameters,
|
||||||
final DepositAccountData... accounts) {
|
final DepositAccountData... accounts) {
|
||||||
|
|
||||||
Set<String> supportedParameters = new HashSet<String>(
|
|
||||||
Arrays.asList("createdOn", "lastModifedOn",
|
|
||||||
"id", "clientId", "clientName", "productId", "productName",
|
|
||||||
"currency", "deposit", "maturityInterestRate", "currencyOptions")
|
|
||||||
);
|
|
||||||
|
|
||||||
|
Set<String> supportedParameters = new HashSet<String>(
|
||||||
|
Arrays.asList("currencyOptions", "interestCompoundedEveryPeriodTypeOptions",
|
||||||
|
"createdOn", "lastModifedOn",
|
||||||
|
"id", "externalId", "clientId", "clientName", "productId", "productName",
|
||||||
|
"currency", "deposit", "maturityInterestRate", "tenureInMonths",
|
||||||
|
"interestCompoundedEvery", "interestCompoundedEveryPeriodType",
|
||||||
|
"renewalAllowed","preClosureAllowed","preClosureInterestRate"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
final Set<String> parameterNamesToSkip = new HashSet<String>();
|
final Set<String> parameterNamesToSkip = new HashSet<String>();
|
||||||
|
|
||||||
if (!responseParameters.isEmpty()) {
|
if (!responseParameters.isEmpty()) {
|
||||||
|
|||||||
+4
-4
@@ -57,12 +57,12 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
private Integer tenureInMonths;
|
private Integer tenureInMonths;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Column(name = "interest_compounding_frequency", nullable = false)
|
@Column(name = "interest_compounded_every", nullable = false)
|
||||||
private Integer interestCompoundedEvery;
|
private Integer interestCompoundedEvery;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Enumerated(EnumType.ORDINAL)
|
@Enumerated(EnumType.ORDINAL)
|
||||||
@Column(name = "interest_compounding_frequency_enum", nullable = false)
|
@Column(name = "interest_compounded_every_period_enum", nullable = false)
|
||||||
private PeriodFrequencyType interestCompoundedFrequencyType;
|
private PeriodFrequencyType interestCompoundedFrequencyType;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@@ -106,11 +106,11 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
private BigDecimal preClosureInterestRate;
|
private BigDecimal preClosureInterestRate;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Column(name = "can_renew", nullable = false)
|
@Column(name = "is_renewal_allowed", nullable = false)
|
||||||
private boolean renewalAllowed = false;
|
private boolean renewalAllowed = false;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Column(name = "can_pre_close", nullable = false)
|
@Column(name = "is_preclosure_allowed", nullable = false)
|
||||||
private boolean preClosureAllowed = false;
|
private boolean preClosureAllowed = false;
|
||||||
|
|
||||||
@Column(name = "is_deleted", nullable=false)
|
@Column(name = "is_deleted", nullable=false)
|
||||||
|
|||||||
+14
-4
@@ -9,6 +9,8 @@ import org.joda.time.DateTime;
|
|||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.mifosng.platform.api.data.CurrencyData;
|
import org.mifosng.platform.api.data.CurrencyData;
|
||||||
import org.mifosng.platform.api.data.DepositAccountData;
|
import org.mifosng.platform.api.data.DepositAccountData;
|
||||||
|
import org.mifosng.platform.api.data.EnumOptionData;
|
||||||
|
import org.mifosng.platform.deposit.domain.SavingsDepositEnumerations;
|
||||||
import org.mifosng.platform.exceptions.LoanProductNotFoundException;
|
import org.mifosng.platform.exceptions.LoanProductNotFoundException;
|
||||||
import org.mifosng.platform.infrastructure.JdbcSupport;
|
import org.mifosng.platform.infrastructure.JdbcSupport;
|
||||||
import org.mifosng.platform.infrastructure.TenantAwareRoutingDataSource;
|
import org.mifosng.platform.infrastructure.TenantAwareRoutingDataSource;
|
||||||
@@ -71,14 +73,15 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
|
|||||||
private static final class DepositAccountMapper implements RowMapper<DepositAccountData> {
|
private static final class DepositAccountMapper implements RowMapper<DepositAccountData> {
|
||||||
|
|
||||||
public String schema() {
|
public String schema() {
|
||||||
return "da.id as id, da.client_id as clientId, da.product_id as productId,"
|
return "da.id as id, da.external_id as externalId, da.client_id as clientId, da.product_id as productId,"
|
||||||
+ " da.currency_code as currencyCode, da.currency_digits as currencyDigits, "
|
+ " da.currency_code as currencyCode, da.currency_digits as currencyDigits, "
|
||||||
+ " da.deposit_amount as depositAmount, "
|
+ " da.deposit_amount as depositAmount, "
|
||||||
+ " da.maturity_nominal_interest_rate as interestRate, da.tenure_months as termInMonths, da.projected_commencement_date as projectedCommencementDate,"
|
+ " da.maturity_nominal_interest_rate as interestRate, da.tenure_months as termInMonths, da.projected_commencement_date as projectedCommencementDate,"
|
||||||
+ " da.actual_commencement_date as actualCommencementDate, da.projected_maturity_date as projectedMaturityDate, da.actual_maturity_date as actualMaturityDate,"
|
+ " da.actual_commencement_date as actualCommencementDate, da.projected_maturity_date as projectedMaturityDate, da.actual_maturity_date as actualMaturityDate,"
|
||||||
+ " da.projected_interest_accrued_on_maturity as projectedInterestAccrued, da.actual_interest_accrued as actualInterestAccrued, "
|
+ " da.projected_interest_accrued_on_maturity as projectedInterestAccrued, da.actual_interest_accrued as actualInterestAccrued, "
|
||||||
+ " da.projected_total_maturity_amount as projectedMaturityAmount, da.actual_total_amount as actualMaturityAmount, "
|
+ " da.projected_total_maturity_amount as projectedMaturityAmount, da.actual_total_amount as actualMaturityAmount, "
|
||||||
+ " da.can_renew as renewalAllowed, da.can_pre_close as preClosureAllowed, da.pre_closure_interest_rate as preClosureInterestRate, "
|
+ " da.interest_compounded_every as interestCompoundedEvery, da.interest_compounded_every_period_enum as interestCompoundedEveryPeriodType, "
|
||||||
|
+ " da.is_renewal_allowed as renewalAllowed, da.is_preclosure_allowed as preClosureAllowed, da.pre_closure_interest_rate as preClosureInterestRate, "
|
||||||
+ " da.created_date as createdon, da.lastmodified_date as modifiedon, "
|
+ " da.created_date as createdon, da.lastmodified_date as modifiedon, "
|
||||||
+ " c.firstname as firstname, c.lastname as lastname, pd.name as productName,"
|
+ " c.firstname as firstname, c.lastname as lastname, pd.name as productName,"
|
||||||
+ " 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"
|
||||||
@@ -93,6 +96,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
|
|||||||
throws SQLException {
|
throws SQLException {
|
||||||
|
|
||||||
Long id = rs.getLong("id");
|
Long id = rs.getLong("id");
|
||||||
|
String externalId = rs.getString("externalId");
|
||||||
Long clientId = rs.getLong("clientId");
|
Long clientId = rs.getLong("clientId");
|
||||||
String clientName = rs.getString("firstname") + " " + rs.getString("lastname");
|
String clientName = rs.getString("firstname") + " " + rs.getString("lastname");
|
||||||
Long productId = rs.getLong("productId");
|
Long productId = rs.getLong("productId");
|
||||||
@@ -120,6 +124,10 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
|
|||||||
BigDecimal projectedMaturityAmount = rs.getBigDecimal("projectedMaturityAmount");
|
BigDecimal projectedMaturityAmount = rs.getBigDecimal("projectedMaturityAmount");
|
||||||
BigDecimal actualMaturityAmount = rs.getBigDecimal("actualMaturityAmount");
|
BigDecimal actualMaturityAmount = rs.getBigDecimal("actualMaturityAmount");
|
||||||
|
|
||||||
|
Integer interestCompoundedEvery = JdbcSupport.getInteger(rs, "interestCompoundedEvery");
|
||||||
|
Integer interestCompoundedEveryPeriodTypeValue = JdbcSupport.getInteger(rs, "interestCompoundedEveryPeriodType");
|
||||||
|
EnumOptionData interestCompoundedEveryPeriodType = SavingsDepositEnumerations.interestCompoundingPeriodType(interestCompoundedEveryPeriodTypeValue);
|
||||||
|
|
||||||
boolean renewalAllowed = rs.getBoolean("renewalAllowed");
|
boolean renewalAllowed = rs.getBoolean("renewalAllowed");
|
||||||
boolean preClosureAllowed = rs.getBoolean("preClosureAllowed");
|
boolean preClosureAllowed = rs.getBoolean("preClosureAllowed");
|
||||||
|
|
||||||
@@ -128,9 +136,11 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
|
|||||||
DateTime createdOn = JdbcSupport.getDateTime(rs, "createdon");
|
DateTime createdOn = JdbcSupport.getDateTime(rs, "createdon");
|
||||||
DateTime lastModifedOn = JdbcSupport.getDateTime(rs, "modifiedon");
|
DateTime lastModifedOn = JdbcSupport.getDateTime(rs, "modifiedon");
|
||||||
|
|
||||||
return new DepositAccountData(createdOn, lastModifedOn, id, clientId, clientName, productId, productName, currencyData, depositAmount,
|
return new DepositAccountData(createdOn, lastModifedOn, id, externalId, clientId, clientName, productId, productName, currencyData, depositAmount,
|
||||||
interestRate, termInMonths, projectedCommencementDate, actualCommencementDate, projectedMaturityDate, actualMaturityDate,
|
interestRate, termInMonths, projectedCommencementDate, actualCommencementDate, projectedMaturityDate, actualMaturityDate,
|
||||||
projectedInterestAccrued, actualInterestAccrued, projectedMaturityAmount, actualMaturityAmount, renewalAllowed, preClosureAllowed, preClosureInterestRate);
|
projectedInterestAccrued, actualInterestAccrued, projectedMaturityAmount, actualMaturityAmount,
|
||||||
|
interestCompoundedEvery, interestCompoundedEveryPeriodType,
|
||||||
|
renewalAllowed, preClosureAllowed, preClosureInterestRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user