Adding Saving account & product creation from UI
Adding missing db patch for m_product_savings repopulating the existed values on view product
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE m_saving_account
|
||||
ADD COLUMN `deposit_every` bigint(20) DEFAULT NULL AFTER `tenure_type`;
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE m_product_savings
|
||||
ADD COLUMN `deposit_every` bigint(20) DEFAULT NULL AFTER `tenure_type`;
|
||||
+3
-2
@@ -43,7 +43,7 @@ public class GoogleGsonPortfolioApiJsonSerializerService implements PortfolioApi
|
||||
"createdOn", "lastModifedOn", "locale", "name", "description", "currencyCode", "digitsAfterDecimal", "interstRate",
|
||||
"minInterestRate", "maxInterestRate", "savingsDepositAmount", "savingProductType", "tenureType", "tenure", "frequency",
|
||||
"interestType", "interestCalculationMethod", "minimumBalanceForWithdrawal", "isPartialDepositAllowed", "isLockinPeriodAllowed",
|
||||
"lockinPeriod", "lockinPeriodType", "currencyOptions", "savingsProductTypeOptions", "tenureTypeOptions",
|
||||
"lockinPeriod", "lockinPeriodType", "currencyOptions", "savingsProductTypeOptions", "tenureTypeOptions","depositEvery",
|
||||
"savingFrequencyOptions", "savingsInterestTypeOptions", "lockinPeriodTypeOptions", "interestCalculationOptions"));
|
||||
|
||||
private static final Set<String> SAVINGS_DEPOSIT_PRODUCT_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("currencyOptions",
|
||||
@@ -96,7 +96,8 @@ public class GoogleGsonPortfolioApiJsonSerializerService implements PortfolioApi
|
||||
"interestCalculationMethod", "tenure", "tenureType", "projectedCommencementDate", "actualCommencementDate", "maturesOnDate",
|
||||
"projectedInterestAccuredOnMaturity", "actualInterestAccured", "projectedMaturityAmount", "actualMaturityAmount",
|
||||
"preClosureAllowed", "preClosureInterestRate", "withdrawnonDate", "rejectedonDate", "closedonDate", "isLockinPeriodAllowed",
|
||||
"lockinPeriod", "lockinPeriodType"));
|
||||
"lockinPeriod", "lockinPeriodType", "productOptions", "currencyOptions", "savingsProductTypeOptions", "tenureTypeOptions",
|
||||
"savingFrequencyOptions", "savingsInterestTypeOptions", "lockinPeriodTypeOptions", "interestCalculationOptions"));
|
||||
|
||||
// guarantors
|
||||
private static final Set<String> GUARANTOR_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("externalGuarantor", "existingClientId",
|
||||
|
||||
+3
-2
@@ -859,7 +859,7 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
|
||||
Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale", "name", "description", "currencyCode",
|
||||
"digitsAfterDecimal", "interestRate", "minInterestRate", "maxInterestRate", "savingsDepositAmount", "savingProductType",
|
||||
"tenureType", "tenure", "frequency", "interestType", "interestCalculationMethod", "minimumBalanceForWithdrawal",
|
||||
"isPartialDepositAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType"));
|
||||
"isPartialDepositAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType","depositEvery"));
|
||||
|
||||
checkForUnsupportedParameters(requestMap, supportedParams);
|
||||
Set<String> modifiedParameters = new HashSet<String>();
|
||||
@@ -871,6 +871,7 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
|
||||
BigDecimal minInterestRate = extractBigDecimalParameter("minInterestRate", requestMap, modifiedParameters);
|
||||
BigDecimal maxInterestRate = extractBigDecimalParameter("maxInterestRate", requestMap, modifiedParameters);
|
||||
BigDecimal savingsDepositAmount = extractBigDecimalParameter("savingsDepositAmount", requestMap, modifiedParameters);
|
||||
Integer depositEvery = extractIntegerParameter("depositEvery", requestMap, modifiedParameters);
|
||||
Integer savingProductType = extractIntegerParameter("savingProductType", requestMap, modifiedParameters);
|
||||
Integer tenureType = extractIntegerParameter("tenureType", requestMap, modifiedParameters);
|
||||
Integer tenure = extractIntegerParameter("tenure", requestMap, modifiedParameters);
|
||||
@@ -884,7 +885,7 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
|
||||
Integer lockinPeriodType = extractIntegerParameter("lockinPeriodType", requestMap, modifiedParameters);
|
||||
|
||||
return new SavingProductCommand(modifiedParameters, resourceIdentifier, name, description, currencyCode, digitsAfterDecimalValue,
|
||||
interestRate, minInterestRate, maxInterestRate, savingsDepositAmount, savingProductType, tenureType, tenure, frequency,
|
||||
interestRate, minInterestRate, maxInterestRate, savingsDepositAmount, depositEvery, savingProductType, tenureType, tenure, frequency,
|
||||
interestType, interestCalculationMethod, minimumBalanceForWithdrawal, isPartialDepositAllowed, isLockinPeriodAllowed,
|
||||
lockinPeriod, lockinPeriodType);
|
||||
}
|
||||
|
||||
+31
-2
@@ -30,6 +30,16 @@ public class ClientAccountSummaryCollectionData {
|
||||
private final List<ClientAccountSummaryData> preclosedDepositAccounts;
|
||||
private final int maturedDepositAccountsCount;
|
||||
private final List<ClientAccountSummaryData> maturedDepositAccounts;
|
||||
private final int pendingApprovalSavingAccountsCount;
|
||||
private final List<ClientAccountSummaryData> pendingApprovalSavingAccounts;
|
||||
private final int approvedSavingAccountsCount;
|
||||
private final List<ClientAccountSummaryData> approvedSavingAccounts;
|
||||
private final int withdrawnByClientSavingAccountsCount;
|
||||
private final List<ClientAccountSummaryData> withdrawnByClientSavingAccounts;
|
||||
private final int rejectedSavingAccountsCount;
|
||||
private final List<ClientAccountSummaryData> rejectedSavingAccounts;
|
||||
private final int closedSavingAccountsCount;
|
||||
private final List<ClientAccountSummaryData> closedSavingAccounts;
|
||||
|
||||
public ClientAccountSummaryCollectionData(
|
||||
final List<ClientAccountSummaryData> pendingApprovalLoans,
|
||||
@@ -42,7 +52,12 @@ public class ClientAccountSummaryCollectionData {
|
||||
final List<ClientAccountSummaryData> rejectedDepositAccounts,
|
||||
final List<ClientAccountSummaryData> closedDepositAccounts,
|
||||
final List<ClientAccountSummaryData> preclosedDepositAccounts,
|
||||
final List<ClientAccountSummaryData> maturedDepositAccounts) {
|
||||
final List<ClientAccountSummaryData> maturedDepositAccounts,
|
||||
final List<ClientAccountSummaryData> pendingApprovalSavingAccounts,
|
||||
final List<ClientAccountSummaryData> approvedSavingAccounts,
|
||||
final List<ClientAccountSummaryData> withdrawnByClientSavingAccounts,
|
||||
final List<ClientAccountSummaryData> rejectedSavingAccounts,
|
||||
final List<ClientAccountSummaryData> closedSavingAccounts) {
|
||||
this.pendingApprovalLoans = pendingApprovalLoans;
|
||||
this.awaitingDisbursalLoans = awaitingDisbursalLoans;
|
||||
this.openLoans = openLoans;
|
||||
@@ -55,6 +70,13 @@ public class ClientAccountSummaryCollectionData {
|
||||
this.preclosedDepositAccounts = preclosedDepositAccounts;
|
||||
this.maturedDepositAccounts = maturedDepositAccounts;
|
||||
|
||||
// saving accounts
|
||||
this.pendingApprovalSavingAccounts = pendingApprovalSavingAccounts;
|
||||
this.approvedSavingAccounts = approvedSavingAccounts;
|
||||
this.withdrawnByClientSavingAccounts = withdrawnByClientSavingAccounts;
|
||||
this.rejectedSavingAccounts = rejectedSavingAccounts;
|
||||
this.closedSavingAccounts = closedSavingAccounts;
|
||||
|
||||
this.pendingApprovalLoanCount = this.pendingApprovalLoans.size();
|
||||
this.awaitingDisbursalLoanCount = this.awaitingDisbursalLoans.size();
|
||||
this.activeLoanCount = this.openLoans.size();
|
||||
@@ -67,10 +89,17 @@ public class ClientAccountSummaryCollectionData {
|
||||
this.rejectedDepositAccountsCount = this.rejectedDepositAccounts.size();
|
||||
this.preclosedDepositAccountsCount = this.preclosedDepositAccounts.size();
|
||||
this.maturedDepositAccountsCount = this.maturedDepositAccounts.size();
|
||||
this.pendingApprovalSavingAccountsCount = this.pendingApprovalSavingAccounts.size();
|
||||
this.approvedSavingAccountsCount = this.approvedSavingAccounts.size();
|
||||
this.withdrawnByClientSavingAccountsCount = this.withdrawnByClientSavingAccounts.size();
|
||||
this.rejectedSavingAccountsCount = this.rejectedSavingAccounts.size();
|
||||
this.closedSavingAccountsCount = this.closedSavingAccounts.size();
|
||||
|
||||
this.anyLoanCount = this.pendingApprovalLoanCount + this.awaitingDisbursalLoanCount + this.activeLoanCount + this.closedLoanCount
|
||||
+this.pendingApprovalDespositAccountsCount+this.approvedDespositAccountsCount+this.withdrawnByClientDespositAccountsCount+this.closedDepositAccountsCount
|
||||
+this.rejectedDepositAccountsCount+this.preclosedDepositAccountsCount+this.maturedDepositAccountsCount;
|
||||
+this.rejectedDepositAccountsCount+this.preclosedDepositAccountsCount+this.maturedDepositAccountsCount
|
||||
+this.pendingApprovalSavingAccountsCount+this.approvedSavingAccountsCount+this.withdrawnByClientSavingAccountsCount
|
||||
+this.rejectedSavingAccountsCount+this.closedSavingAccountsCount;
|
||||
|
||||
}
|
||||
|
||||
|
||||
+53
-1
@@ -248,10 +248,36 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<ClientAccountSummaryData> pendingApprovalSavingAccounts = new ArrayList<ClientAccountSummaryData>();
|
||||
List<ClientAccountSummaryData> approvedSavingAccounts = new ArrayList<ClientAccountSummaryData>();
|
||||
List<ClientAccountSummaryData> withdrawnByClientSavingAccounts = new ArrayList<ClientAccountSummaryData>();
|
||||
List<ClientAccountSummaryData> rejectedSavingAccounts = new ArrayList<ClientAccountSummaryData>();
|
||||
List<ClientAccountSummaryData> closedSavingAccounts = new ArrayList<ClientAccountSummaryData>();
|
||||
|
||||
ClientSavingAccountSummaryDataMapper clientSavingAccountSummaryDataMapper = new ClientSavingAccountSummaryDataMapper();
|
||||
String savingAccountsSql = "select " + clientSavingAccountSummaryDataMapper.schema() + " where sa.client_id=? and sa.is_deleted=0";
|
||||
List<ClientAccountSummaryData> savingAccountsResults = this.jdbcTemplate.query(savingAccountsSql, clientSavingAccountSummaryDataMapper, new Object[] {clientId});
|
||||
|
||||
if (savingAccountsResults != null) {
|
||||
for (ClientAccountSummaryData account : savingAccountsResults){
|
||||
if (account.accountStatusId() == 100)
|
||||
pendingApprovalSavingAccounts.add(account);
|
||||
else if (account.accountStatusId() ==300)
|
||||
approvedSavingAccounts.add(account);
|
||||
else if (account.accountStatusId() == 400)
|
||||
withdrawnByClientSavingAccounts.add(account);
|
||||
else if (account.accountStatusId() == 500)
|
||||
rejectedSavingAccounts.add(account);
|
||||
else if (account.accountStatusId() == 600)
|
||||
closedSavingAccounts.add(account);
|
||||
}
|
||||
}
|
||||
|
||||
return new ClientAccountSummaryCollectionData(pendingApprovalLoans, awaitingDisbursalLoans, openLoans, closedLoans,
|
||||
pendingApprovalDepositAccounts, approvedDepositAccounts, withdrawnByClientDespositAccounts, rejectedDepositAccounts,
|
||||
closedDepositAccounts, preclosedDepositAccounts, maturedDepositAccounts);
|
||||
closedDepositAccounts, preclosedDepositAccounts, maturedDepositAccounts,
|
||||
pendingApprovalSavingAccounts,approvedSavingAccounts,withdrawnByClientSavingAccounts,rejectedSavingAccounts,closedSavingAccounts);
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
throw new ClientNotFoundException(clientId);
|
||||
}
|
||||
@@ -516,4 +542,30 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
||||
return ClientData.clientIdentifier(id, firstname, lastname, officeId, officeName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static final class ClientSavingAccountSummaryDataMapper implements RowMapper<ClientAccountSummaryData> {
|
||||
|
||||
public String schema() {
|
||||
|
||||
StringBuilder accountsSummary = new StringBuilder("sa.id as id, sa.external_id as externalId,");
|
||||
accountsSummary.append("sa.product_id as productId, sp.name as productName,").append("sa.status_enum as statusId ")
|
||||
.append("from m_saving_account sa ").append("LEFT JOIN m_product_savings AS sp ON sp.id = sa.product_id ");
|
||||
|
||||
return accountsSummary.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientAccountSummaryData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
|
||||
Long id = JdbcSupport.getLong(rs, "id");
|
||||
String externalId = rs.getString("externalId");
|
||||
Long productId = JdbcSupport.getLong(rs, "productId");
|
||||
String productName = rs.getString("productName");
|
||||
Integer accountStatusId = JdbcSupport.getInteger(rs, "statusId");
|
||||
|
||||
return new ClientAccountSummaryData(id, externalId, productId, productName, accountStatusId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+56
-4
@@ -3,6 +3,7 @@ package org.mifosplatform.portfolio.savingsaccount.api;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
@@ -23,8 +24,11 @@ import org.mifosplatform.infrastructure.core.api.ApiParameterHelper;
|
||||
import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService;
|
||||
import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService;
|
||||
import org.mifosplatform.infrastructure.core.data.EntityIdentifier;
|
||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||
import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||
import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformService;
|
||||
import org.mifosplatform.portfolio.savingsaccount.command.CalculateSavingScheduleCommand;
|
||||
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountCommand;
|
||||
import org.mifosplatform.portfolio.savingsaccount.data.SavingAccountData;
|
||||
@@ -32,6 +36,15 @@ import org.mifosplatform.portfolio.savingsaccount.data.SavingScheduleData;
|
||||
import org.mifosplatform.portfolio.savingsaccount.service.CalculateSavingSchedule;
|
||||
import org.mifosplatform.portfolio.savingsaccount.service.SavingAccountReadPlatformService;
|
||||
import org.mifosplatform.portfolio.savingsaccount.service.SavingAccountWritePlatformService;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.data.SavingProductLookup;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.domain.SavingFrequencyType;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.domain.SavingInterestCalculationMethod;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.domain.SavingProductType;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.domain.SavingsInterestType;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.domain.SavingsLockinPeriodEnum;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.service.SavingProductEnumerations;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.service.SavingProductReadPlatformService;
|
||||
import org.mifosplatform.portfolio.savingsdepositproduct.domain.TenureTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -52,6 +65,12 @@ public class SavingsAccountApiResource {
|
||||
|
||||
@Autowired
|
||||
private PortfolioApiJsonSerializerService apiJsonSerializerService;
|
||||
|
||||
@Autowired
|
||||
private SavingProductReadPlatformService savingProductReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
private CurrencyReadPlatformService currencyReadPlatformService;
|
||||
|
||||
private final String entityType = "SAVINGSACCOUNT";
|
||||
|
||||
@@ -152,7 +171,6 @@ public class SavingsAccountApiResource {
|
||||
return this.apiJsonSerializerService.serializeSavingAccountsDataToJson(prettyPrint, responseParameters, account);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@GET
|
||||
@Path("template")
|
||||
@Consumes({MediaType.APPLICATION_JSON})
|
||||
@@ -170,13 +188,47 @@ public class SavingsAccountApiResource {
|
||||
}
|
||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
|
||||
SavingAccountData account = null;
|
||||
// this.savingAccountReadPlatformService.retrieveNewSavingsAccountDetails(clientId, productId);
|
||||
SavingAccountData account = this.savingAccountReadPlatformService.retrieveNewSavingsAccountDetails(clientId, productId);
|
||||
account = handleTemplateRelatedData(responseParameters,account);
|
||||
|
||||
return this.apiJsonSerializerService.serializeSavingAccountsDataToJson(prettyPrint, responseParameters, account);
|
||||
}
|
||||
|
||||
private boolean is(final String commandParam, final String commandValue) {
|
||||
private SavingAccountData handleTemplateRelatedData(Set<String> responseParameters, SavingAccountData account) {
|
||||
responseParameters.addAll(Arrays.asList("productOptions", "currencyOptions", "savingsProductTypeOptions", "tenureTypeOptions",
|
||||
"savingFrequencyOptions", "savingsInterestTypeOptions", "lockinPeriodTypeOptions", "interestCalculationOptions"));
|
||||
|
||||
Collection<SavingProductLookup> productOptions = savingProductReadPlatformService.retrieveAllSavingProductsForLookup();
|
||||
List<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
|
||||
EnumOptionData reccuring = SavingProductEnumerations.savingProductType(SavingProductType.RECCURING);
|
||||
EnumOptionData regular = SavingProductEnumerations.savingProductType(SavingProductType.REGULAR);
|
||||
List<EnumOptionData> savingsProductTypeOptions = Arrays.asList(reccuring, regular);
|
||||
|
||||
EnumOptionData fixed = SavingProductEnumerations.tenureTypeEnum(TenureTypeEnum.FIXED_PERIOD);
|
||||
EnumOptionData perpetual = SavingProductEnumerations.tenureTypeEnum(TenureTypeEnum.PERPETUAL);
|
||||
List<EnumOptionData> tenureTypeOptions = Arrays.asList(fixed, perpetual);
|
||||
|
||||
EnumOptionData monthly = SavingProductEnumerations.interestFrequencyType(SavingFrequencyType.MONTHLY);
|
||||
List<EnumOptionData> savingFrequencyOptions = Arrays.asList(monthly);
|
||||
|
||||
EnumOptionData simple = SavingProductEnumerations.savingInterestType(SavingsInterestType.SIMPLE);
|
||||
EnumOptionData compounding = SavingProductEnumerations.savingInterestType(SavingsInterestType.COMPOUNDING);
|
||||
List<EnumOptionData> savingsInterestTypeOptions = Arrays.asList(simple, compounding);
|
||||
|
||||
EnumOptionData months = SavingProductEnumerations.savingsLockinPeriod(SavingsLockinPeriodEnum.MONTHS);
|
||||
List<EnumOptionData> lockinPeriodTypeOptions = Arrays.asList(months);
|
||||
|
||||
EnumOptionData averagebal = SavingProductEnumerations.savingInterestCalculationMethod(SavingInterestCalculationMethod.AVERAGEBAL);
|
||||
EnumOptionData minbal = SavingProductEnumerations.savingInterestCalculationMethod(SavingInterestCalculationMethod.MINBAL);
|
||||
EnumOptionData monthlyCollection = SavingProductEnumerations
|
||||
.savingInterestCalculationMethod(SavingInterestCalculationMethod.MONTHLYCOLLECTION);
|
||||
List<EnumOptionData> interestCalculationOptions = Arrays.asList(averagebal, minbal, monthlyCollection);
|
||||
return new SavingAccountData(account, productOptions, currencyOptions, savingsProductTypeOptions,tenureTypeOptions,savingFrequencyOptions,
|
||||
savingsInterestTypeOptions,lockinPeriodTypeOptions,interestCalculationOptions);
|
||||
}
|
||||
|
||||
private boolean is(final String commandParam, final String commandValue) {
|
||||
return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue);
|
||||
}
|
||||
|
||||
|
||||
+341
-34
@@ -1,82 +1,63 @@
|
||||
package org.mifosplatform.portfolio.savingsaccount.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.data.SavingProductLookup;
|
||||
|
||||
/**
|
||||
* Immutable data object reprsenting a savings account.
|
||||
*/
|
||||
public class SavingAccountData {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final EnumOptionData status;
|
||||
@SuppressWarnings("unused")
|
||||
private final String externalId;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long clientId;
|
||||
@SuppressWarnings("unused")
|
||||
private final String clientName;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long productId;
|
||||
@SuppressWarnings("unused")
|
||||
private final String productName;
|
||||
@SuppressWarnings("unused")
|
||||
private final EnumOptionData productType;
|
||||
@SuppressWarnings("unused")
|
||||
private final CurrencyData currencyData;
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal savingsDepostiAmountPerPeriod;
|
||||
@SuppressWarnings("unused")
|
||||
private final EnumOptionData savingsFrequencyType;
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal totalDepositAmount;
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal reccuringInterestRate;
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal savingInterestRate;
|
||||
@SuppressWarnings("unused")
|
||||
private final EnumOptionData interestType;
|
||||
@SuppressWarnings("unused")
|
||||
private final EnumOptionData interestCalculationMethod;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer tenure;
|
||||
@SuppressWarnings("unused")
|
||||
private final EnumOptionData tenureType;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate projectedCommencementDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate actualCommencementDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate maturesOnDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal projectedInterestAccuredOnMaturity;
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal actualInterestAccured;
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal projectedMaturityAmount;
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal actualMaturityAmount;
|
||||
@SuppressWarnings("unused")
|
||||
private final boolean preClosureAllowed;
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal preClosureInterestRate;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate withdrawnonDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate rejectedonDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate closedonDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final boolean isLockinPeriodAllowed;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer lockinPeriod;
|
||||
@SuppressWarnings("unused")
|
||||
private final EnumOptionData lockinPeriodType;
|
||||
private final Integer depositEvery;
|
||||
|
||||
private final List<SavingProductLookup> productOptions;
|
||||
private final List<CurrencyData> currencyOptions;
|
||||
private final List<EnumOptionData> savingsProductTypeOptions;
|
||||
private final List<EnumOptionData> tenureTypeOptions;
|
||||
private final List<EnumOptionData> savingFrequencyOptions;
|
||||
private final List<EnumOptionData> savingsInterestTypeOptions;
|
||||
private final List<EnumOptionData> lockinPeriodTypeOptions;
|
||||
private final List<EnumOptionData> interestCalculationOptions;
|
||||
|
||||
public SavingAccountData(Long id, EnumOptionData status, String externalId, Long clientId, String clientName, Long productId,
|
||||
String productName, EnumOptionData productType, CurrencyData currencyData, BigDecimal savingsDepostiAmountPerPeriod,
|
||||
@@ -86,7 +67,7 @@ public class SavingAccountData {
|
||||
BigDecimal projectedInterestAccuredOnMaturity, BigDecimal actualInterestAccured, BigDecimal projectedMaturityAmount,
|
||||
BigDecimal actualMaturityAmount, boolean preClosureAllowed, BigDecimal preClosureInterestRate, LocalDate withdrawnonDate,
|
||||
LocalDate rejectedonDate, LocalDate closedonDate, boolean isLockinPeriodAllowed, Integer lockinPeriod,
|
||||
EnumOptionData lockinPeriodType) {
|
||||
EnumOptionData lockinPeriodType,Integer depositEvery) {
|
||||
this.id = id;
|
||||
this.status = status;
|
||||
this.externalId = externalId;
|
||||
@@ -120,5 +101,331 @@ public class SavingAccountData {
|
||||
this.isLockinPeriodAllowed = isLockinPeriodAllowed;
|
||||
this.lockinPeriod = lockinPeriod;
|
||||
this.lockinPeriodType = lockinPeriodType;
|
||||
this.depositEvery = depositEvery;
|
||||
this.productOptions = new ArrayList<SavingProductLookup>();
|
||||
this.currencyOptions = null;
|
||||
this.savingsProductTypeOptions = null;
|
||||
this.tenureTypeOptions = null;
|
||||
this.savingFrequencyOptions = null;
|
||||
this.savingsInterestTypeOptions = null;
|
||||
this.lockinPeriodTypeOptions = null;
|
||||
this.interestCalculationOptions = null;
|
||||
|
||||
}
|
||||
|
||||
public SavingAccountData(Long clientId, String clientName) {
|
||||
this.id = null;
|
||||
this.status = null;
|
||||
this.externalId = null;
|
||||
this.clientId = clientId;
|
||||
this.clientName = clientName;
|
||||
this.productId = null;
|
||||
this.productName = null;
|
||||
this.productType = null;
|
||||
this.currencyData = new CurrencyData("USD", "US Dollar", 2, "$", "currency.USD");;
|
||||
this.savingsDepostiAmountPerPeriod = null;
|
||||
this.savingsFrequencyType = null;
|
||||
this.totalDepositAmount = null;
|
||||
this.reccuringInterestRate = null;
|
||||
this.savingInterestRate = null;
|
||||
this.interestType = null;
|
||||
this.interestCalculationMethod = null;
|
||||
this.tenure = null;
|
||||
this.tenureType = null;
|
||||
this.projectedCommencementDate = null;
|
||||
this.actualCommencementDate = null;
|
||||
this.maturesOnDate = null;
|
||||
this.projectedInterestAccuredOnMaturity = null;
|
||||
this.actualInterestAccured = null;
|
||||
this.projectedMaturityAmount = null;
|
||||
this.actualMaturityAmount = null;
|
||||
this.preClosureAllowed = false;
|
||||
this.preClosureInterestRate = null;
|
||||
this.withdrawnonDate = null;
|
||||
this.rejectedonDate = null;
|
||||
this.closedonDate = null;
|
||||
this.isLockinPeriodAllowed = false;
|
||||
this.lockinPeriod = null;
|
||||
this.lockinPeriodType = null;
|
||||
this.depositEvery=null;
|
||||
this.productOptions = new ArrayList<SavingProductLookup>();
|
||||
this.currencyOptions = null;
|
||||
this.savingsProductTypeOptions = null;
|
||||
this.tenureTypeOptions = null;
|
||||
this.savingFrequencyOptions = null;
|
||||
this.savingsInterestTypeOptions = null;
|
||||
this.lockinPeriodTypeOptions = null;
|
||||
this.interestCalculationOptions = null;
|
||||
}
|
||||
|
||||
public SavingAccountData(SavingAccountData account, Collection<SavingProductLookup> productOptions, List<CurrencyData> currencyOptions,
|
||||
List<EnumOptionData> savingsProductTypeOptions, List<EnumOptionData> tenureTypeOptions, List<EnumOptionData> savingFrequencyOptions,
|
||||
List<EnumOptionData> savingsInterestTypeOptions, List<EnumOptionData> lockinPeriodTypeOptions, List<EnumOptionData> interestCalculationOptions) {
|
||||
this.id = account.getId();
|
||||
this.status = account.getStatus();
|
||||
this.externalId = account.getExternalId();
|
||||
this.clientId = account.getClientId();
|
||||
this.clientName = account.getClientName();
|
||||
this.productId = account.getProductId();
|
||||
this.productName = account.getProductName();
|
||||
this.productType = account.getProductType();
|
||||
this.currencyData = account.getCurrencyData();
|
||||
this.savingsDepostiAmountPerPeriod = account.getSavingsDepostiAmountPerPeriod();
|
||||
this.savingsFrequencyType = account.getSavingsFrequencyType();
|
||||
this.totalDepositAmount = account.getTotalDepositAmount();
|
||||
this.reccuringInterestRate = account.getReccuringInterestRate();
|
||||
this.savingInterestRate = account.getSavingInterestRate();
|
||||
this.interestType = account.getInterestType();
|
||||
this.interestCalculationMethod = account.getInterestCalculationMethod();
|
||||
this.tenure = account.getTenure();
|
||||
this.tenureType = account.getTenureType();
|
||||
this.projectedCommencementDate = account.getProjectedCommencementDate();
|
||||
this.actualCommencementDate = account.getActualCommencementDate();
|
||||
this.maturesOnDate = account.getMaturesOnDate();
|
||||
this.projectedInterestAccuredOnMaturity = account.getProjectedInterestAccuredOnMaturity();
|
||||
this.actualInterestAccured = account.getActualInterestAccured();
|
||||
this.projectedMaturityAmount = account.getProjectedMaturityAmount();
|
||||
this.actualMaturityAmount = account.getActualMaturityAmount();
|
||||
this.preClosureAllowed = account.isPreClosureAllowed();
|
||||
this.preClosureInterestRate = account.getPreClosureInterestRate();
|
||||
this.withdrawnonDate = account.getWithdrawnonDate();
|
||||
this.rejectedonDate = account.getRejectedonDate();
|
||||
this.closedonDate = account.getClosedonDate();
|
||||
this.isLockinPeriodAllowed = account.isLockinPeriodAllowed();
|
||||
this.lockinPeriod = account.getLockinPeriod();
|
||||
this.lockinPeriodType = account.getLockinPeriodType();
|
||||
this.depositEvery = account.getDepositEvery();
|
||||
|
||||
this.productOptions = (List<SavingProductLookup>) productOptions;
|
||||
this.currencyOptions = currencyOptions;
|
||||
this.savingsProductTypeOptions = savingsProductTypeOptions;
|
||||
this.tenureTypeOptions = tenureTypeOptions;
|
||||
this.savingFrequencyOptions = savingFrequencyOptions;
|
||||
this.savingsInterestTypeOptions = savingsInterestTypeOptions;
|
||||
this.lockinPeriodTypeOptions = lockinPeriodTypeOptions;
|
||||
this.interestCalculationOptions = interestCalculationOptions;
|
||||
}
|
||||
|
||||
public SavingAccountData( Long clientId, String clientName, Long productId, String productName, CurrencyData currency, BigDecimal interestRate,
|
||||
BigDecimal savingsDepostiAmountPerPeriod, EnumOptionData productType, EnumOptionData tenureType, Integer tenure, EnumOptionData savingsFrequencyType,
|
||||
EnumOptionData interestType, EnumOptionData interestCalculationMethod, BigDecimal minimumBalanceForWithdrawal, boolean partialDepositAllowed,
|
||||
boolean lockinPeriodAllowed, Integer lockinPeriod, EnumOptionData lockinPeriodType, Integer depositEvery) {
|
||||
|
||||
this.id = null;
|
||||
this.status = null;
|
||||
this.externalId = null;
|
||||
this.clientId = clientId;
|
||||
this.clientName = clientName;
|
||||
this.productId = productId;
|
||||
this.productName = productName;
|
||||
this.productType = productType;
|
||||
this.currencyData = currency;
|
||||
this.savingsDepostiAmountPerPeriod = savingsDepostiAmountPerPeriod;
|
||||
this.savingsFrequencyType = savingsFrequencyType;
|
||||
this.totalDepositAmount = null;
|
||||
this.reccuringInterestRate = interestRate;
|
||||
this.savingInterestRate = interestRate;
|
||||
this.interestType = interestType;
|
||||
this.interestCalculationMethod = interestCalculationMethod;
|
||||
this.tenure = tenure;
|
||||
this.tenureType = tenureType;
|
||||
this.projectedCommencementDate = new LocalDate();
|
||||
this.actualCommencementDate = null;
|
||||
this.maturesOnDate = null;
|
||||
this.projectedInterestAccuredOnMaturity = null;
|
||||
this.actualInterestAccured = null;
|
||||
this.projectedMaturityAmount = null;
|
||||
this.actualMaturityAmount = null;
|
||||
this.preClosureAllowed = true;
|
||||
this.preClosureInterestRate = null;
|
||||
this.withdrawnonDate = null;
|
||||
this.rejectedonDate = null;
|
||||
this.closedonDate = null;
|
||||
this.isLockinPeriodAllowed = false;
|
||||
this.lockinPeriod = lockinPeriod;
|
||||
this.lockinPeriodType = lockinPeriodType;
|
||||
this.depositEvery=depositEvery;
|
||||
this.productOptions = null;
|
||||
this.currencyOptions = null;
|
||||
this.savingsProductTypeOptions = null;
|
||||
this.tenureTypeOptions = null;
|
||||
this.savingFrequencyOptions = null;
|
||||
this.savingsInterestTypeOptions = null;
|
||||
this.lockinPeriodTypeOptions = null;
|
||||
this.interestCalculationOptions = null;
|
||||
|
||||
}
|
||||
|
||||
public static SavingAccountData createFrom(final Long clientId, final String clientDisplayName) {
|
||||
return new SavingAccountData(clientId,clientDisplayName);
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public EnumOptionData getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public String getExternalId() {
|
||||
return this.externalId;
|
||||
}
|
||||
|
||||
public Long getClientId() {
|
||||
return this.clientId;
|
||||
}
|
||||
|
||||
public String getClientName() {
|
||||
return this.clientName;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return this.productId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return this.productName;
|
||||
}
|
||||
|
||||
public EnumOptionData getProductType() {
|
||||
return this.productType;
|
||||
}
|
||||
|
||||
public CurrencyData getCurrencyData() {
|
||||
return this.currencyData;
|
||||
}
|
||||
|
||||
public BigDecimal getSavingsDepostiAmountPerPeriod() {
|
||||
return this.savingsDepostiAmountPerPeriod;
|
||||
}
|
||||
|
||||
public EnumOptionData getSavingsFrequencyType() {
|
||||
return this.savingsFrequencyType;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalDepositAmount() {
|
||||
return this.totalDepositAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getReccuringInterestRate() {
|
||||
return this.reccuringInterestRate;
|
||||
}
|
||||
|
||||
public BigDecimal getSavingInterestRate() {
|
||||
return this.savingInterestRate;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestType() {
|
||||
return this.interestType;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestCalculationMethod() {
|
||||
return this.interestCalculationMethod;
|
||||
}
|
||||
|
||||
public Integer getTenure() {
|
||||
return this.tenure;
|
||||
}
|
||||
|
||||
public EnumOptionData getTenureType() {
|
||||
return this.tenureType;
|
||||
}
|
||||
|
||||
public LocalDate getProjectedCommencementDate() {
|
||||
return this.projectedCommencementDate;
|
||||
}
|
||||
|
||||
public LocalDate getActualCommencementDate() {
|
||||
return this.actualCommencementDate;
|
||||
}
|
||||
|
||||
public LocalDate getMaturesOnDate() {
|
||||
return this.maturesOnDate;
|
||||
}
|
||||
|
||||
public BigDecimal getProjectedInterestAccuredOnMaturity() {
|
||||
return this.projectedInterestAccuredOnMaturity;
|
||||
}
|
||||
|
||||
public BigDecimal getActualInterestAccured() {
|
||||
return this.actualInterestAccured;
|
||||
}
|
||||
|
||||
public BigDecimal getProjectedMaturityAmount() {
|
||||
return this.projectedMaturityAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getActualMaturityAmount() {
|
||||
return this.actualMaturityAmount;
|
||||
}
|
||||
|
||||
public boolean isPreClosureAllowed() {
|
||||
return this.preClosureAllowed;
|
||||
}
|
||||
|
||||
public BigDecimal getPreClosureInterestRate() {
|
||||
return this.preClosureInterestRate;
|
||||
}
|
||||
|
||||
public LocalDate getWithdrawnonDate() {
|
||||
return this.withdrawnonDate;
|
||||
}
|
||||
|
||||
public LocalDate getRejectedonDate() {
|
||||
return this.rejectedonDate;
|
||||
}
|
||||
|
||||
public LocalDate getClosedonDate() {
|
||||
return this.closedonDate;
|
||||
}
|
||||
|
||||
public boolean isLockinPeriodAllowed() {
|
||||
return this.isLockinPeriodAllowed;
|
||||
}
|
||||
|
||||
public Integer getLockinPeriod() {
|
||||
return this.lockinPeriod;
|
||||
}
|
||||
|
||||
public EnumOptionData getLockinPeriodType() {
|
||||
return this.lockinPeriodType;
|
||||
}
|
||||
|
||||
public Integer getDepositEvery() {
|
||||
return this.depositEvery;
|
||||
}
|
||||
|
||||
public List<SavingProductLookup> getProductOptions() {
|
||||
return this.productOptions;
|
||||
}
|
||||
|
||||
public List<CurrencyData> getCurrencyOptions() {
|
||||
return this.currencyOptions;
|
||||
}
|
||||
|
||||
public List<EnumOptionData> getSavingsProductTypeOptions() {
|
||||
return this.savingsProductTypeOptions;
|
||||
}
|
||||
|
||||
public List<EnumOptionData> getTenureTypeOptions() {
|
||||
return this.tenureTypeOptions;
|
||||
}
|
||||
|
||||
public List<EnumOptionData> getSavingFrequencyOptions() {
|
||||
return this.savingFrequencyOptions;
|
||||
}
|
||||
|
||||
public List<EnumOptionData> getSavingsInterestTypeOptions() {
|
||||
return this.savingsInterestTypeOptions;
|
||||
}
|
||||
|
||||
public List<EnumOptionData> getLockinPeriodTypeOptions() {
|
||||
return this.lockinPeriodTypeOptions;
|
||||
}
|
||||
|
||||
public List<EnumOptionData> getInterestCalculationOptions() {
|
||||
return this.interestCalculationOptions;
|
||||
}
|
||||
|
||||
}
|
||||
+15
-5
@@ -158,6 +158,9 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
|
||||
|
||||
@Column(name = "lock_in_period_type", nullable = false)
|
||||
private PeriodFrequencyType lockinPeriodType;
|
||||
|
||||
@Column(name = "deposit_every", nullable = false)
|
||||
private Integer payEvery;
|
||||
|
||||
// see
|
||||
// http://stackoverflow.com/questions/4334970/hibernate-cannot-simultaneously-fetch-multiple-bags
|
||||
@@ -170,7 +173,8 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
|
||||
TenureTypeEnum tenureTypeEnum, SavingProductType savingProductType, SavingFrequencyType savingFrequencyType,
|
||||
SavingsInterestType interestType, SavingInterestCalculationMethod savingInterestCalculationMethod,
|
||||
boolean isLockinPeriodAllowed, Integer lockinPeriod, PeriodFrequencyType lockinPeriodType,
|
||||
ReccuringDepositInterestCalculator reccuringDepositInterestCalculator, final DepositLifecycleStateMachine lifecycleStateMachine) {
|
||||
ReccuringDepositInterestCalculator reccuringDepositInterestCalculator, final DepositLifecycleStateMachine lifecycleStateMachine,
|
||||
Integer payEvery) {
|
||||
|
||||
Money futureValueOnMaturity = null;
|
||||
if (savingProductType.isReccuring()) {
|
||||
@@ -183,14 +187,14 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
|
||||
|
||||
return new SavingAccount(client, externalId, product, savingsDeposit, reccuringInterestRate, savingInterestRate, tenure,
|
||||
commencementDate, tenureTypeEnum, savingProductType, savingFrequencyType, interestType, savingInterestCalculationMethod,
|
||||
isLockinPeriodAllowed, lockinPeriod, lockinPeriodType, futureValueOnMaturity, lifecycleStateMachine);
|
||||
isLockinPeriodAllowed, lockinPeriod, lockinPeriodType, futureValueOnMaturity, lifecycleStateMachine,payEvery);
|
||||
}
|
||||
|
||||
public SavingAccount(Client client, String externalId, SavingProduct product, Money savingsDeposit, BigDecimal reccuringInterestRate,
|
||||
BigDecimal savingInterestRate, Integer tenure, LocalDate commencementDate, TenureTypeEnum tenureTypeEnum,
|
||||
SavingProductType savingProductType, SavingFrequencyType savingFrequencyType, SavingsInterestType interestType,
|
||||
SavingInterestCalculationMethod savingInterestCalculationMethod, boolean isLockinPeriodAllowed, Integer lockinPeriod,
|
||||
PeriodFrequencyType lockinPeriodType, Money futureValueOnMaturity, final DepositLifecycleStateMachine lifecycleStateMachine) {
|
||||
PeriodFrequencyType lockinPeriodType, Money futureValueOnMaturity, final DepositLifecycleStateMachine lifecycleStateMachine,Integer payEvery) {
|
||||
|
||||
DepositAccountStatus from = null;
|
||||
if (accountStatus != null) {
|
||||
@@ -225,13 +229,14 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
|
||||
this.projectedTotalOnMaturity = futureValueOnMaturity.getAmount();
|
||||
this.projectedInterestAccruedOnMaturity = futureValueOnMaturity.getAmount().subtract(
|
||||
BigDecimal.valueOf(savingsDeposit.getAmount().doubleValue() * tenure.doubleValue()));
|
||||
this.payEvery = payEvery;
|
||||
}
|
||||
|
||||
public void modifyAccount(SavingProduct product, String externalId, Money savingsDeposit, BigDecimal reccuringInterestRate,
|
||||
BigDecimal savingInterestRate, Integer tenure, LocalDate commencementDate, TenureTypeEnum tenureTypeEnum,
|
||||
SavingProductType savingProductType, SavingFrequencyType savingFrequencyType,
|
||||
SavingInterestCalculationMethod savingInterestCalculationMethod, boolean isLockinPeriodAllowed, Integer lockinPeriod,
|
||||
PeriodFrequencyType lockinPeriodType, ReccuringDepositInterestCalculator reccuringDepositInterestCalculator) {
|
||||
PeriodFrequencyType lockinPeriodType, ReccuringDepositInterestCalculator reccuringDepositInterestCalculator,Integer payEvery) {
|
||||
|
||||
Money futureValueOnMaturity = null;
|
||||
if (savingProductType.isReccuring()) {
|
||||
@@ -256,6 +261,7 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
|
||||
this.isLockinPeriodAllowed = isLockinPeriodAllowed;
|
||||
this.lockinPeriod = lockinPeriod;
|
||||
this.lockinPeriodType = lockinPeriodType;
|
||||
this.payEvery = payEvery;
|
||||
|
||||
// FIXME - MADHUKAR - futureValueOnMaturity is possibly null
|
||||
this.projectedTotalOnMaturity = futureValueOnMaturity.getAmount();
|
||||
@@ -347,7 +353,11 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
|
||||
return lockinPeriodType;
|
||||
}
|
||||
|
||||
public void addSavingScheduleInstallment(final SavingScheduleInstallments installment) {
|
||||
public Integer getPayEvery() {
|
||||
return this.payEvery;
|
||||
}
|
||||
|
||||
public void addSavingScheduleInstallment(final SavingScheduleInstallments installment) {
|
||||
installment.updateAccount(this);
|
||||
this.savingScheduleInstallments.add(installment);
|
||||
}
|
||||
|
||||
+9
-2
@@ -114,11 +114,13 @@ public class SavingAccountAssembler {
|
||||
if (command.getLockinPeriodType() != null) {
|
||||
lockinPeriodType = PeriodFrequencyType.fromInt(command.getLockinPeriodType());
|
||||
}
|
||||
|
||||
Integer payEvery = command.getPayEvery();
|
||||
|
||||
SavingAccount account = SavingAccount.openNew(client, product, command.getExternalId(), savingsDeposit, reccuringInterestRate,
|
||||
savingInterestRate, tenure, command.getCommencementDate(), tenureTypeEnum, savingProductType, savingFrequencyType,
|
||||
interestType, savingInterestCalculationMethod, isLockinPeriodAllowed, lockinPeriod, lockinPeriodType,
|
||||
this.reccuringDepositInterestCalculator, defaultDepositLifecycleStateMachine());
|
||||
this.reccuringDepositInterestCalculator, defaultDepositLifecycleStateMachine(),payEvery);
|
||||
|
||||
SavingScheduleData savingScheduleData = this.calculateSavingSchedule.calculateSavingSchedule(command
|
||||
.toCalculateSavingScheduleCommand());
|
||||
@@ -205,9 +207,14 @@ public class SavingAccountAssembler {
|
||||
if (command.isLockinPeriodTypeChanged()) {
|
||||
lockinPeriodType = PeriodFrequencyType.fromInt(command.getLockinPeriodType());
|
||||
}
|
||||
|
||||
Integer payEvery = account.getPayEvery();
|
||||
if(command.isPayEveryChanged()){
|
||||
payEvery = command.getPayEvery();
|
||||
}
|
||||
account.modifyAccount(product, externalId, savingsDeposit, reccuringInterestRate, savingInterestRate, tenure, commencementDate,
|
||||
tenureTypeEnum, savingProductType, savingFrequencyType, savingInterestCalculationMethod, isLockinPeriodAllowed,
|
||||
lockinPeriod, lockinPeriodType, this.reccuringDepositInterestCalculator);
|
||||
lockinPeriod, lockinPeriodType, this.reccuringDepositInterestCalculator,payEvery);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -9,4 +9,6 @@ public interface SavingAccountReadPlatformService {
|
||||
Collection<SavingAccountData> retrieveAllSavingsAccounts();
|
||||
|
||||
SavingAccountData retrieveSavingsAccount(Long accountId);
|
||||
|
||||
SavingAccountData retrieveNewSavingsAccountDetails(Long clientId, Long productId);
|
||||
}
|
||||
|
||||
+52
-3
@@ -11,8 +11,13 @@ import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
||||
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||
import org.mifosplatform.portfolio.client.data.ClientData;
|
||||
import org.mifosplatform.portfolio.client.service.ClientReadPlatformService;
|
||||
import org.mifosplatform.portfolio.savingsaccount.data.SavingAccountData;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.data.SavingProductData;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.data.SavingProductLookup;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.service.SavingProductEnumerations;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.service.SavingProductReadPlatformService;
|
||||
import org.mifosplatform.portfolio.savingsdepositaccount.service.DepositAccountEnumerations;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -24,11 +29,16 @@ public class SavingAccountReadPlatformServiceImpl implements SavingAccountReadPl
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final ClientReadPlatformService clientReadPlatformService;
|
||||
private final SavingProductReadPlatformService savingProductReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
public SavingAccountReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) {
|
||||
public SavingAccountReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource,
|
||||
ClientReadPlatformService clientReadPlatformService, SavingProductReadPlatformService savingProductReadPlatformService) {
|
||||
this.context = context;
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.clientReadPlatformService = clientReadPlatformService;
|
||||
this.savingProductReadPlatformService=savingProductReadPlatformService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,7 +76,7 @@ public class SavingAccountReadPlatformServiceImpl implements SavingAccountReadPl
|
||||
+ " sa.actual_total_amount AS actualTotalAmount, sa.is_preclosure_allowed AS isPreclosureAllowed,"
|
||||
+ " sa.pre_closure_interest_rate AS preClosureInterestRate, sa.is_lock_in_period_allowed AS isLockinPeriodAllowed,"
|
||||
+ " sa.lock_in_period AS lockinPeriod, sa.lock_in_period_type AS lockinPeriodType, sa.withdrawnon_date AS withdrawnonDate,"
|
||||
+ " sa.rejectedon_date AS rejectedonDate, sa.closedon_date AS closedonDate, ps.name AS productName,"
|
||||
+ " sa.rejectedon_date AS rejectedonDate, sa.closedon_date AS closedonDate, ps.name AS productName, sa.deposit_every as depositEvery, "
|
||||
+ " c.firstname AS firstname, c.lastname AS lastname, curr.name AS currencyName, "
|
||||
+ " curr.internationalized_name_code AS currencyNameCode, curr.display_symbol AS currencyDisplaySymbol "
|
||||
+ " FROM m_saving_account sa " + " JOIN m_client c ON c.id = sa.client_id"
|
||||
@@ -130,13 +140,52 @@ public class SavingAccountReadPlatformServiceImpl implements SavingAccountReadPl
|
||||
Integer lockinPeriod = JdbcSupport.getInteger(rs, "lockinPeriod");
|
||||
Integer lockinPeriodTypeValue = JdbcSupport.getInteger(rs, "lockinPeriodType");
|
||||
EnumOptionData lockinPeriodType = SavingProductEnumerations.savingsLockinPeriod(lockinPeriodTypeValue);
|
||||
Integer depositEvery = JdbcSupport.getInteger(rs, "depositEvery");
|
||||
|
||||
return new SavingAccountData(id, status, externalId, clientId, clientName, productId, productName, productType, currencyData,
|
||||
savingsDepostiAmountPerPeriod, savingsFrequencyType, totalDepositAmount, reccuringInterestRate, savingInterestRate,
|
||||
interestType, interestCalculationMethod, tenure, tenureType, projectedCommencementDate, actualCommencementDate,
|
||||
maturesOnDate, projectedInterestAccuredOnMaturity, actualInterestAccured, projectedMaturityAmount,
|
||||
actualMaturityAmount, preClosureAllowed, preClosureInterestRate, withdrawnonDate, rejectedonDate, closedonDate,
|
||||
isLockinPeriodAllowed, lockinPeriod, lockinPeriodType);
|
||||
isLockinPeriodAllowed, lockinPeriod, lockinPeriodType,depositEvery);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SavingAccountData retrieveNewSavingsAccountDetails(Long clientId, Long productId) {
|
||||
|
||||
context.authenticatedUser();
|
||||
ClientData clientAccount = this.clientReadPlatformService.retrieveIndividualClient(clientId);
|
||||
SavingAccountData accountData = null;
|
||||
Collection<SavingProductLookup> savingProducts = this.savingProductReadPlatformService.retrieveAllSavingProductsForLookup();
|
||||
|
||||
if (productId != null && productId != -1) {
|
||||
SavingProductData selectedProduct = findSavingProductById(savingProducts, productId);
|
||||
|
||||
CurrencyData currency = selectedProduct.getCurrency();
|
||||
|
||||
accountData = new SavingAccountData(clientAccount.id(), clientAccount.displayName(), selectedProduct.getId(),
|
||||
selectedProduct.getName(), currency, selectedProduct.getInterestRate(), selectedProduct.getSavingsDepositAmount(),
|
||||
selectedProduct.getSavingProductType(), selectedProduct.getTenureType(), selectedProduct.getTenure(), selectedProduct.getSavingFrequencyType(),
|
||||
selectedProduct.getInterestType(), selectedProduct.getInterestCalculationMethod(),selectedProduct.getMinimumBalanceForWithdrawal(),
|
||||
selectedProduct.isPartialDepositAllowed(), selectedProduct.isLockinPeriodAllowed(),selectedProduct.getLockinPeriod(),
|
||||
selectedProduct.getLockinPeriodType(),selectedProduct.getDepositEvery());
|
||||
|
||||
} else {
|
||||
accountData = SavingAccountData.createFrom(clientAccount.id(), clientAccount.displayName());
|
||||
}
|
||||
return accountData;
|
||||
}
|
||||
|
||||
private SavingProductData findSavingProductById( Collection<SavingProductLookup> savingProducts, Long productId) {
|
||||
SavingProductData match = this.savingProductReadPlatformService.retrieveNewSavingProductDetails();
|
||||
for (SavingProductLookup savingProductLookup : savingProducts) {
|
||||
if (savingProductLookup.hasId(productId)) {
|
||||
match = this.savingProductReadPlatformService.retrieveSavingProduct(savingProductLookup.getId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
}
|
||||
+7
-6
@@ -100,7 +100,7 @@ public class SavingProductsApiResource {
|
||||
"description", "currencyCode", "digitsAfterDecimal", "interstRate", "minInterestRate", "maxInterestRate",
|
||||
"savingsDepositAmount", "savingProductType", "tenureType", "tenure", "frequency", "interestType",
|
||||
"interestCalculationMethod", "minimumBalanceForWithdrawal", "isPartialDepositAllowed", "isLockinPeriodAllowed",
|
||||
"lockinPeriod", "lockinPeriodType"));
|
||||
"lockinPeriod", "lockinPeriodType","depositEvery"));
|
||||
|
||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
if (responseParameters.isEmpty()) {
|
||||
@@ -125,20 +125,21 @@ public class SavingProductsApiResource {
|
||||
"description", "currencyCode", "digitsAfterDecimal", "interstRate", "minInterestRate", "maxInterestRate",
|
||||
"savingsDepositAmount", "savingProductType", "tenureType", "tenure", "frequency", "interestType",
|
||||
"interestCalculationMethod", "minimumBalanceForWithdrawal", "isPartialDepositAllowed", "isLockinPeriodAllowed",
|
||||
"lockinPeriod", "lockinPeriodType"));
|
||||
"lockinPeriod", "lockinPeriodType","depositEvery"));
|
||||
|
||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
if (responseParameters.isEmpty()) {
|
||||
responseParameters.addAll(typicalResponseParameters);
|
||||
}
|
||||
|
||||
SavingProductData savingProduct = this.savingProductReadPlatformService.retrieveSavingProduct(productId);
|
||||
|
||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
|
||||
if (template) {
|
||||
responseParameters.addAll(Arrays.asList("currencyOptions"));
|
||||
savingProduct = handleTemplateRelatedData(responseParameters, savingProduct);
|
||||
}
|
||||
|
||||
SavingProductData savingProduct = this.savingProductReadPlatformService.retrieveSavingProduct(productId);
|
||||
|
||||
return this.apiJsonSerializerService.serializeSavingProductDataToJson(prettyPrint, responseParameters, savingProduct);
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ public class SavingProductsApiResource {
|
||||
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "createdOn", "lastModifedOn", "locale", "name",
|
||||
"description", "currencyCode", "digitsAfterDecimal", "interstRate", "savingsDepositAmount", "savingProductType",
|
||||
"tenureType", "tenure", "frequency", "interestType", "interestCalculationMethod", "minimumBalanceForWithdrawal",
|
||||
"isPartialDepositAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "currencyOptions"));
|
||||
"isPartialDepositAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "currencyOptions","depositEvery"));
|
||||
|
||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
if (responseParameters.isEmpty()) {
|
||||
|
||||
+12
-2
@@ -16,6 +16,7 @@ public class SavingProductCommand {
|
||||
private final BigDecimal maxInterestRate;
|
||||
|
||||
private final BigDecimal savingsDepositAmount;
|
||||
private final Integer depositEvery;
|
||||
private final Integer savingProductType;
|
||||
private final Integer tenureType;
|
||||
private final Integer tenure;
|
||||
@@ -32,7 +33,7 @@ public class SavingProductCommand {
|
||||
|
||||
public SavingProductCommand(Set<String> modifiedParameters, Long id, String name, String description, String currencyCode,
|
||||
Integer digitsAfterDecimal, BigDecimal interestRate, BigDecimal minInterestRate, BigDecimal maxInterestRate,
|
||||
BigDecimal savingsDepositAmount, Integer savingProductType, Integer tenureType, Integer tenure, Integer frequency,
|
||||
BigDecimal savingsDepositAmount, Integer depositEvery,Integer savingProductType, Integer tenureType, Integer tenure, Integer frequency,
|
||||
Integer interestType, Integer interestCalculationMethod, BigDecimal minimumBalanceForWithdrawal,
|
||||
boolean isPartialDepositAllowed, boolean isLockinPeriodAllowed, Integer lockinPeriod, Integer lockinPeriodType) {
|
||||
|
||||
@@ -47,6 +48,7 @@ public class SavingProductCommand {
|
||||
this.maxInterestRate = maxInterestRate;
|
||||
|
||||
this.savingsDepositAmount = savingsDepositAmount;
|
||||
this.depositEvery = depositEvery;
|
||||
this.savingProductType = savingProductType;
|
||||
this.tenureType = tenureType;
|
||||
this.tenure = tenure;
|
||||
@@ -98,7 +100,11 @@ public class SavingProductCommand {
|
||||
return savingsDepositAmount;
|
||||
}
|
||||
|
||||
public Integer getSavingProductType() {
|
||||
public Integer getDepositEvery() {
|
||||
return this.depositEvery;
|
||||
}
|
||||
|
||||
public Integer getSavingProductType() {
|
||||
return savingProductType;
|
||||
}
|
||||
|
||||
@@ -166,6 +172,10 @@ public class SavingProductCommand {
|
||||
return this.modifiedParameters.contains("savingsDepositAmount");
|
||||
}
|
||||
|
||||
public boolean isDepositEveryChanged() {
|
||||
return this.modifiedParameters.contains("depositEvery");
|
||||
}
|
||||
|
||||
public boolean isSavingProductTypeChanged() {
|
||||
return this.modifiedParameters.contains("savingProductType");
|
||||
}
|
||||
|
||||
+31
-16
@@ -8,6 +8,13 @@ import java.util.List;
|
||||
import org.joda.time.DateTime;
|
||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.domain.SavingFrequencyType;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.domain.SavingInterestCalculationMethod;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.domain.SavingProductType;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.domain.SavingsInterestType;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.domain.SavingsLockinPeriodEnum;
|
||||
import org.mifosplatform.portfolio.savingsaccountproduct.service.SavingProductEnumerations;
|
||||
import org.mifosplatform.portfolio.savingsdepositproduct.domain.TenureTypeEnum;
|
||||
|
||||
public class SavingProductData implements Serializable {
|
||||
|
||||
@@ -35,6 +42,7 @@ public class SavingProductData implements Serializable {
|
||||
|
||||
private DateTime createdOn;
|
||||
private DateTime lastModifedOn;
|
||||
private final Integer depositEvery;
|
||||
|
||||
private List<CurrencyData> currencyOptions = new ArrayList<CurrencyData>();
|
||||
List<EnumOptionData> savingsProductTypeOptions = new ArrayList<EnumOptionData>();
|
||||
@@ -45,7 +53,7 @@ public class SavingProductData implements Serializable {
|
||||
List<EnumOptionData> interestCalculationOptions = new ArrayList<EnumOptionData>();
|
||||
|
||||
public SavingProductData() {
|
||||
this.createdOn = new DateTime();
|
||||
this.createdOn = new DateTime();
|
||||
this.lastModifedOn = new DateTime();
|
||||
this.id = null;
|
||||
this.name = null;
|
||||
@@ -53,20 +61,21 @@ public class SavingProductData implements Serializable {
|
||||
this.interestRate = BigDecimal.ZERO;
|
||||
this.minInterestRate = BigDecimal.ZERO;
|
||||
this.maxInterestRate = BigDecimal.ZERO;
|
||||
this.currency = null;
|
||||
this.digitsAfterDecimal = null;
|
||||
this.savingsDepositAmount = null;
|
||||
this.savingProductType = null;
|
||||
this.tenureType = null;
|
||||
this.tenure = null;
|
||||
this.savingFrequencyType = null;
|
||||
this.interestType = null;
|
||||
this.interestCalculationMethod = null;
|
||||
this.minimumBalanceForWithdrawal = null;
|
||||
this.isPartialDepositAllowed = true;
|
||||
this.isLockinPeriodAllowed = true;
|
||||
this.lockinPeriod = null;
|
||||
this.lockinPeriodType = null;
|
||||
this.currency = new CurrencyData("USD", "US Dollar", 2, "$", "currency.USD");
|
||||
this.digitsAfterDecimal = Integer.valueOf(2);
|
||||
this.savingsDepositAmount = BigDecimal.ZERO;
|
||||
this.savingProductType = SavingProductEnumerations.savingProductType(SavingProductType.RECCURING);
|
||||
this.tenureType = SavingProductEnumerations.tenureTypeEnum(TenureTypeEnum.FIXED_PERIOD);
|
||||
this.tenure = Integer.valueOf(12);
|
||||
this.savingFrequencyType = SavingProductEnumerations.interestFrequencyType(SavingFrequencyType.MONTHLY);
|
||||
this.interestType = SavingProductEnumerations.savingInterestType(SavingsInterestType.COMPOUNDING);
|
||||
this.interestCalculationMethod = SavingProductEnumerations.savingInterestCalculationMethod(SavingInterestCalculationMethod.AVERAGEBAL);
|
||||
this.minimumBalanceForWithdrawal = BigDecimal.valueOf(100);
|
||||
this.isPartialDepositAllowed = false;
|
||||
this.isLockinPeriodAllowed = false;
|
||||
this.lockinPeriod = Integer.valueOf(0);
|
||||
this.lockinPeriodType = SavingProductEnumerations.savingsLockinPeriod(SavingsLockinPeriodEnum.MONTHS);
|
||||
this.depositEvery=Integer.valueOf(3);
|
||||
}
|
||||
|
||||
public SavingProductData(DateTime createdOn, DateTime lastModifedOn, Long id, String name, String description, BigDecimal interestRate,
|
||||
@@ -74,7 +83,7 @@ public class SavingProductData implements Serializable {
|
||||
BigDecimal savingsDepositAmount, EnumOptionData savingProductType, EnumOptionData tenureType, Integer tenure,
|
||||
EnumOptionData savingFrequencyType, EnumOptionData savingInterestType, EnumOptionData interestCalculationMethod,
|
||||
BigDecimal minimumBalanceForWithdrawal, boolean isPartialDepositAllowed, boolean isLockinPeriodAllowed, Integer lockinPeriod,
|
||||
EnumOptionData lockinPeriodType) {
|
||||
EnumOptionData lockinPeriodType, Integer depositEvery) {
|
||||
this.createdOn = createdOn;
|
||||
this.lastModifedOn = lastModifedOn;
|
||||
this.id = id;
|
||||
@@ -97,6 +106,7 @@ public class SavingProductData implements Serializable {
|
||||
this.isLockinPeriodAllowed = isLockinPeriodAllowed;
|
||||
this.lockinPeriod = lockinPeriod;
|
||||
this.lockinPeriodType = lockinPeriodType;
|
||||
this.depositEvery = depositEvery;
|
||||
}
|
||||
|
||||
public SavingProductData(SavingProductData product, List<CurrencyData> currencyOptions, List<EnumOptionData> savingsProductTypeOptions,
|
||||
@@ -126,6 +136,7 @@ public class SavingProductData implements Serializable {
|
||||
this.isLockinPeriodAllowed = product.isLockinPeriodAllowed();
|
||||
this.lockinPeriod = product.getLockinPeriod();
|
||||
this.lockinPeriodType = product.getLockinPeriodType();
|
||||
this.depositEvery = product.getDepositEvery();
|
||||
|
||||
this.currencyOptions = currencyOptions;
|
||||
this.savingsProductTypeOptions = savingsProductTypeOptions;
|
||||
@@ -257,4 +268,8 @@ public class SavingProductData implements Serializable {
|
||||
return interestCalculationOptions;
|
||||
}
|
||||
|
||||
public Integer getDepositEvery() {
|
||||
return this.depositEvery;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-9
@@ -4,11 +4,12 @@ import java.io.Serializable;
|
||||
|
||||
public class SavingProductLookup implements Serializable {
|
||||
|
||||
private Long id;
|
||||
private String name;
|
||||
private final Long id;
|
||||
private final String name;
|
||||
|
||||
public SavingProductLookup() {
|
||||
//
|
||||
this.id=null;
|
||||
this.name=null;
|
||||
}
|
||||
|
||||
public SavingProductLookup(Long id, String name) {
|
||||
@@ -20,16 +21,12 @@ public class SavingProductLookup implements Serializable {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
public boolean hasId(final Long matchingId) {
|
||||
return this.id.equals(matchingId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ public class SavingProduct extends AbstractAuditableCustom<AppUser, Long> {
|
||||
}
|
||||
|
||||
public SavingProduct(final String name, final String description, final MonetaryCurrency currency, final BigDecimal interestRate,
|
||||
final BigDecimal minInterestRate, final BigDecimal maxInterestRate, final BigDecimal savingsDepositAmount,
|
||||
final BigDecimal minInterestRate, final BigDecimal maxInterestRate, final BigDecimal savingsDepositAmount,Integer depositEvery,
|
||||
final SavingProductType savingProductType, final TenureTypeEnum tenureType, final Integer tenure,
|
||||
final SavingFrequencyType savingFrequencyType, final SavingsInterestType savingsInterestType,
|
||||
SavingInterestCalculationMethod savingInterestCalculationMethod, final BigDecimal minimumBalanceForWithdrawal,
|
||||
@@ -52,7 +52,7 @@ public class SavingProduct extends AbstractAuditableCustom<AppUser, Long> {
|
||||
this.description = null;
|
||||
}
|
||||
this.savingProductRelatedDetail = new SavingProductRelatedDetail(currency, interestRate, minInterestRate, maxInterestRate,
|
||||
savingsDepositAmount, savingProductType, tenureType, tenure, savingFrequencyType, savingsInterestType,
|
||||
savingsDepositAmount, depositEvery, savingProductType, tenureType, tenure, savingFrequencyType, savingsInterestType,
|
||||
savingInterestCalculationMethod, minimumBalanceForWithdrawal, isPartialDepositAllowed, isLockinPeriodAllowed, lockinPeriod,
|
||||
lockinPeriodType);
|
||||
}
|
||||
|
||||
+14
-2
@@ -30,6 +30,9 @@ public class SavingProductRelatedDetail {
|
||||
|
||||
@Column(name = "savings_deposit_amount", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal savingsDepositAmount;
|
||||
|
||||
@Column(name = "deposit_every")
|
||||
private Integer depositEvery;
|
||||
|
||||
@Column(name = "savings_product_type", nullable = false)
|
||||
private SavingProductType savingProductType;
|
||||
@@ -70,7 +73,7 @@ public class SavingProductRelatedDetail {
|
||||
}
|
||||
|
||||
public SavingProductRelatedDetail(final MonetaryCurrency currency, final BigDecimal interestRate, final BigDecimal minInterestRate,
|
||||
final BigDecimal maxInterestRate, final BigDecimal savingsDepositAmount, final SavingProductType savingProductType,
|
||||
final BigDecimal maxInterestRate, final BigDecimal savingsDepositAmount,final Integer depositEvery, final SavingProductType savingProductType,
|
||||
final TenureTypeEnum tenureType, final Integer tenure, final SavingFrequencyType frequency,
|
||||
final SavingsInterestType interestType, final SavingInterestCalculationMethod interestCalculationMethod,
|
||||
final BigDecimal minimumBalanceForWithdrawal, final boolean isPartialDepositAllowed, final boolean isLockinPeriodAllowed,
|
||||
@@ -80,6 +83,7 @@ public class SavingProductRelatedDetail {
|
||||
this.minInterestRate = minInterestRate;
|
||||
this.maxInterestRate = maxInterestRate;
|
||||
this.savingsDepositAmount = savingsDepositAmount;
|
||||
this.depositEvery=depositEvery;
|
||||
this.savingProductType = savingProductType;
|
||||
this.tenureType = tenureType;
|
||||
this.tenure = tenure;
|
||||
@@ -127,6 +131,10 @@ public class SavingProductRelatedDetail {
|
||||
if (command.isSavingsDepositAmountChanged()) {
|
||||
this.savingsDepositAmount = command.getSavingsDepositAmount();
|
||||
}
|
||||
|
||||
if (command.isDepositEveryChanged()) {
|
||||
this.depositEvery=command.getDepositEvery();
|
||||
}
|
||||
|
||||
if (command.isSavingProductTypeChanged()) {
|
||||
this.savingProductType = SavingProductType.fromInt(command.getSavingProductType());
|
||||
@@ -177,7 +185,11 @@ public class SavingProductRelatedDetail {
|
||||
return savingsDepositAmount;
|
||||
}
|
||||
|
||||
public SavingProductType getSavingProductType() {
|
||||
public Integer getDepositEvery() {
|
||||
return this.depositEvery;
|
||||
}
|
||||
|
||||
public SavingProductType getSavingProductType() {
|
||||
return savingProductType;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ public class SavingProductEnumerations {
|
||||
break;
|
||||
case MONTHLY:
|
||||
optionData = new EnumOptionData(SavingFrequencyType.MONTHLY.getValue().longValue(), codePrefix
|
||||
+ SavingFrequencyType.MONTHLY.getCode(), "Weeks");
|
||||
+ SavingFrequencyType.MONTHLY.getCode(), "Months");
|
||||
break;
|
||||
case QUATERLY:
|
||||
optionData = new EnumOptionData(SavingFrequencyType.QUATERLY.getValue().longValue(), codePrefix
|
||||
|
||||
+5
-4
@@ -60,7 +60,7 @@ public class SavingProductReadPlatformServiceImpl implements SavingProductReadPl
|
||||
|
||||
SavingProductLookupMapper savingProductLookupMapper = new SavingProductLookupMapper();
|
||||
|
||||
String sql = "select" + savingProductLookupMapper.savingProductLookupSchema();
|
||||
String sql = "select " + savingProductLookupMapper.savingProductLookupSchema() + " where sp.is_deleted=0";
|
||||
|
||||
return this.jdbcTemplate.query(sql, savingProductLookupMapper, new Object[] {});
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class SavingProductReadPlatformServiceImpl implements SavingProductReadPl
|
||||
|
||||
public String savingProductSchema() {
|
||||
return "sp.id as id,sp.name as name, sp.description as description,sp.currency_code as currencyCode, sp.currency_digits as currencyDigits,sp.interest_rate as interestRate, "
|
||||
+ "sp.min_interest_rate as minInterestRate, sp.max_interest_rate as maxInterstRate, "
|
||||
+ "sp.min_interest_rate as minInterestRate, sp.max_interest_rate as maxInterstRate, sp.deposit_every as depositEvery, "
|
||||
+ " sp.savings_deposit_amount as savingsDepositAmount, sp.savings_product_type as savingProductType, sp.tenure_type as tenureType, sp.tenure as tenure, sp.frequency as frequency, "
|
||||
+ " sp.interest_type as interestType, sp.interest_calculation_method as interestCalculationMethod, sp.min_bal_for_withdrawal as minimumBalanceForWithdrawal, "
|
||||
+ " sp.is_partial_deposit_allowed as isPartialDepositAllowed, sp.is_lock_in_period_allowed as isLockinPeriodAllowed, sp.lock_in_period as lockinPeriod, sp.lock_in_period_type as lockinPeriodType, "
|
||||
@@ -126,6 +126,7 @@ public class SavingProductReadPlatformServiceImpl implements SavingProductReadPl
|
||||
DateTime createdOn = JdbcSupport.getDateTime(rs, "createdon");
|
||||
DateTime lastModifedOn = JdbcSupport.getDateTime(rs, "modifiedon");
|
||||
|
||||
Integer depositEvery = JdbcSupport.getInteger(rs, "depositEvery");
|
||||
BigDecimal savingsDepositAmount = rs.getBigDecimal("savingsDepositAmount");
|
||||
EnumOptionData savingProductTypeEnum = SavingProductEnumerations.savingProductType(SavingProductType.fromInt(JdbcSupport
|
||||
.getInteger(rs, "savingProductType")));
|
||||
@@ -145,14 +146,14 @@ public class SavingProductReadPlatformServiceImpl implements SavingProductReadPl
|
||||
return new SavingProductData(createdOn, lastModifedOn, id, name, description, interestRate, minInterestRate, maxInterestRate,
|
||||
currencyData, currencyDigits, savingsDepositAmount, savingProductTypeEnum, tenureTypeEnum, tenure, savingFrequencyType,
|
||||
savingInterestType, interestCalculationMethodEnum, minimumBalanceForWithdrawal, isPartialDepositAllowed,
|
||||
isLockinPeriodAllowed, lockinPeriod, lockinPeriodType);
|
||||
isLockinPeriodAllowed, lockinPeriod, lockinPeriodType,depositEvery);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class SavingProductLookupMapper implements RowMapper<SavingProductLookup> {
|
||||
|
||||
public String savingProductLookupSchema() {
|
||||
return "sp.id as id, sp.name as name from m_product_savings sp";
|
||||
return " sp.id as id, sp.name as name from m_product_savings sp";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class SavingProductWritePlatformServiceJpaRepositoryImpl implements Savin
|
||||
MonetaryCurrency currency = new MonetaryCurrency(command.getCurrencyCode(), command.getDigitsAfterDecimal());
|
||||
|
||||
SavingProduct product = new SavingProduct(command.getName(), command.getDescription(), currency, command.getInterestRate(),
|
||||
command.getMinInterestRate(), command.getMaxInterestRate(), command.getSavingsDepositAmount(), savingProductType,
|
||||
command.getMinInterestRate(), command.getMaxInterestRate(), command.getSavingsDepositAmount(),command.getDepositEvery(), savingProductType,
|
||||
tenureType, command.getTenure(), savingFrequencyType, interestType, savingInterestCalculationMethod,
|
||||
command.getMinimumBalanceForWithdrawal(), command.isPartialDepositAllowed(), command.isLockinPeriodAllowed(),
|
||||
command.getLockinPeriod(), lockinPeriodType);
|
||||
|
||||
Reference in New Issue
Block a user