drop audit columns on organisation currency, update api docs on configuration api.
This commit is contained in:
+4
-1
@@ -72,7 +72,10 @@ public class CurrenciesApiResource {
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateCurrencies(final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCurrencies().withJson(apiRequestBodyAsJson).build();
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateCurrencies() //
|
||||
.withJson(apiRequestBodyAsJson) //
|
||||
.build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
package org.mifosplatform.organisation.monetary.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||
|
||||
public interface CurrencyReadPlatformService {
|
||||
|
||||
List<CurrencyData> retrieveAllowedCurrencies();
|
||||
Collection<CurrencyData> retrieveAllowedCurrencies();
|
||||
|
||||
List<CurrencyData> retrieveAllPlatformCurrencies();
|
||||
Collection<CurrencyData> retrieveAllPlatformCurrencies();
|
||||
}
|
||||
+18
-16
@@ -2,7 +2,7 @@ package org.mifosplatform.organisation.monetary.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
||||
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
|
||||
@@ -18,33 +18,31 @@ public class CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformServ
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final PlatformSecurityContext context;
|
||||
private final CurrencyMapper currencyRowMapper;
|
||||
|
||||
@Autowired
|
||||
public CurrencyReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) {
|
||||
this.context = context;
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.currencyRowMapper = new CurrencyMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CurrencyData> retrieveAllowedCurrencies() {
|
||||
public Collection<CurrencyData> retrieveAllowedCurrencies() {
|
||||
|
||||
context.authenticatedUser();
|
||||
|
||||
String sql = "select c.code as code, c.name as name, c.decimal_places as decimalPlaces, c.display_symbol as displaySymbol, c.internationalized_name_code as nameCode from m_organisation_currency c order by c.name";
|
||||
final String sql = "select " + currencyRowMapper.schema() + " from m_organisation_currency c order by c.name";
|
||||
|
||||
RowMapper<CurrencyData> rm = new CurrencyMapper();
|
||||
|
||||
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
||||
return this.jdbcTemplate.query(sql, currencyRowMapper, new Object[] {});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CurrencyData> retrieveAllPlatformCurrencies() {
|
||||
public Collection<CurrencyData> retrieveAllPlatformCurrencies() {
|
||||
|
||||
String sql = "select c.code as code, c.name as name, c.decimal_places as decimalPlaces, c.display_symbol as displaySymbol, c.internationalized_name_code as nameCode from m_currency c order by c.name";
|
||||
final String sql = "select " + currencyRowMapper.schema() + " from m_currency c order by c.name";
|
||||
|
||||
RowMapper<CurrencyData> rm = new CurrencyMapper();
|
||||
|
||||
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
||||
return this.jdbcTemplate.query(sql, currencyRowMapper, new Object[] {});
|
||||
}
|
||||
|
||||
private static final class CurrencyMapper implements RowMapper<CurrencyData> {
|
||||
@@ -52,13 +50,17 @@ public class CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformServ
|
||||
@Override
|
||||
public CurrencyData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
|
||||
String code = rs.getString("code");
|
||||
String name = rs.getString("name");
|
||||
int decimalPlaces = JdbcSupport.getInteger(rs, "decimalPlaces");
|
||||
String displaySymbol = rs.getString("displaySymbol");
|
||||
String nameCode = rs.getString("nameCode");
|
||||
final String code = rs.getString("code");
|
||||
final String name = rs.getString("name");
|
||||
final int decimalPlaces = JdbcSupport.getInteger(rs, "decimalPlaces");
|
||||
final String displaySymbol = rs.getString("displaySymbol");
|
||||
final String nameCode = rs.getString("nameCode");
|
||||
|
||||
return new CurrencyData(code, name, decimalPlaces, displaySymbol, nameCode);
|
||||
}
|
||||
|
||||
public String schema() {
|
||||
return " c.code as code, c.name as name, c.decimal_places as decimalPlaces, c.display_symbol as displaySymbol, c.internationalized_name_code as nameCode ";
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -70,6 +70,9 @@ public class CurrencyWritePlatformServiceJpaRepositoryImpl implements CurrencyWr
|
||||
this.organisationCurrencyRepository.deleteAll();
|
||||
this.organisationCurrencyRepository.save(allowedCurrencies);
|
||||
|
||||
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).with(changes).build();
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.with(changes) //
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package org.mifosplatform.organisation.monetary.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.mifosplatform.organisation.monetary.data.ApplicationCurrencyConfigurationData;
|
||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||
@@ -20,8 +20,8 @@ public class OrganisationCurrencyReadPlatformServiceImpl implements Organisation
|
||||
@Override
|
||||
public ApplicationCurrencyConfigurationData retrieveCurrencyConfiguration() {
|
||||
|
||||
final List<CurrencyData> selectedCurrencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
final List<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllPlatformCurrencies();
|
||||
final Collection<CurrencyData> selectedCurrencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
final Collection<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllPlatformCurrencies();
|
||||
|
||||
// remove selected currency options
|
||||
currencyOptions.removeAll(selectedCurrencyOptions);
|
||||
|
||||
+5
-6
@@ -1,7 +1,7 @@
|
||||
package org.mifosplatform.organisation.office.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||
@@ -30,12 +30,12 @@ public class OfficeTransactionData {
|
||||
@SuppressWarnings("unused")
|
||||
private final String description;
|
||||
@SuppressWarnings("unused")
|
||||
private final List<CurrencyData> currencyOptions;
|
||||
private final Collection<CurrencyData> currencyOptions;
|
||||
@SuppressWarnings("unused")
|
||||
private final List<OfficeLookup> allowedOffices;
|
||||
private final Collection<OfficeData> allowedOffices;
|
||||
|
||||
public OfficeTransactionData(final LocalDate transactionDate, final List<OfficeLookup> allowedOffices,
|
||||
final List<CurrencyData> currencyOptions) {
|
||||
public OfficeTransactionData(final LocalDate transactionDate, final Collection<OfficeData> allowedOffices,
|
||||
final Collection<CurrencyData> currencyOptions) {
|
||||
this.transactionDate = transactionDate;
|
||||
this.allowedOffices = allowedOffices;
|
||||
this.currencyOptions = currencyOptions;
|
||||
@@ -63,6 +63,5 @@ public class OfficeTransactionData {
|
||||
this.transactionDate = transactionDate;
|
||||
this.currencyOptions = null;
|
||||
this.allowedOffices = null;
|
||||
|
||||
}
|
||||
}
|
||||
+20
-17
@@ -4,32 +4,34 @@ import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.mifosplatform.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
import org.mifosplatform.useradministration.domain.AppUser;
|
||||
import org.springframework.data.jpa.domain.AbstractPersistable;
|
||||
|
||||
/**
|
||||
* Represents currencies allowed for this MFI/organisation.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "m_organisation_currency")
|
||||
public class OrganisationCurrency extends AbstractAuditableCustom<AppUser, Long> {
|
||||
public class OrganisationCurrency extends AbstractPersistable<Long> {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "code", nullable = false, length=3)
|
||||
private final String code;
|
||||
@Column(name = "code", nullable = false, length = 3)
|
||||
private final String code;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "decimal_places", nullable = false)
|
||||
private final Integer decimalPlaces;
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "name", nullable = false, length=50)
|
||||
private final String name;
|
||||
|
||||
@Column(name = "name", nullable = false, length = 50)
|
||||
private final String name;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "internationalized_name_code", nullable = false, length=50)
|
||||
private final String nameCode;
|
||||
|
||||
@Column(name = "internationalized_name_code", nullable = false, length = 50)
|
||||
private final String nameCode;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "display_symbol", nullable = true, length=10)
|
||||
private final String displaySymbol;
|
||||
@Column(name = "display_symbol", nullable = true, length = 10)
|
||||
private final String displaySymbol;
|
||||
|
||||
protected OrganisationCurrency() {
|
||||
this.code = null;
|
||||
@@ -39,11 +41,12 @@ public class OrganisationCurrency extends AbstractAuditableCustom<AppUser, Long>
|
||||
this.displaySymbol = null;
|
||||
}
|
||||
|
||||
public OrganisationCurrency(final String code, final String name, final int decimalPlaces, final String nameCode, final String displaySymbol) {
|
||||
public OrganisationCurrency(final String code, final String name, final int decimalPlaces, final String nameCode,
|
||||
final String displaySymbol) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.decimalPlaces = decimalPlaces;
|
||||
this.nameCode = nameCode;
|
||||
this.displaySymbol = displaySymbol;
|
||||
this.nameCode = nameCode;
|
||||
this.displaySymbol = displaySymbol;
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -5,7 +5,6 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
||||
@@ -246,8 +245,8 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
public OfficeTransactionData retrieveNewOfficeTransactionDetails() {
|
||||
context.authenticatedUser();
|
||||
|
||||
List<OfficeLookup> parentLookups = new ArrayList<OfficeLookup>(retrieveAllOfficesForLookup());
|
||||
List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
final Collection<OfficeData> parentLookups = retrieveAllOfficesForDropdown();
|
||||
final Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
|
||||
return new OfficeTransactionData(new LocalDate(), parentLookups, currencyOptions);
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,6 +1,7 @@
|
||||
package org.mifosplatform.portfolio.charge.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||
@@ -21,12 +22,12 @@ public class ChargeData {
|
||||
private final EnumOptionData chargeAppliesTo;
|
||||
private final EnumOptionData chargeCalculationType;
|
||||
|
||||
private final List<CurrencyData> currencyOptions;
|
||||
private final Collection<CurrencyData> currencyOptions;
|
||||
private final List<EnumOptionData> chargeCalculationTypeOptions;
|
||||
private final List<EnumOptionData> chargeAppliesToOptions;
|
||||
private final List<EnumOptionData> chargeTimeTypeOptions;
|
||||
|
||||
public static ChargeData template(final List<CurrencyData> currencyOptions, final List<EnumOptionData> chargeCalculationTypeOptions,
|
||||
public static ChargeData template(final Collection<CurrencyData> currencyOptions, final List<EnumOptionData> chargeCalculationTypeOptions,
|
||||
final List<EnumOptionData> chargeAppliesToOptions, final List<EnumOptionData> chargeTimeTypeOptions) {
|
||||
|
||||
return new ChargeData(null, null, null, null, null, null, null, false, false, currencyOptions, chargeCalculationTypeOptions,
|
||||
@@ -59,7 +60,7 @@ public class ChargeData {
|
||||
|
||||
public ChargeData(final Long id, final String name, final BigDecimal amount, final CurrencyData currency,
|
||||
final EnumOptionData chargeTimeType, final EnumOptionData chargeAppliesTo, final EnumOptionData chargeCalculationType,
|
||||
final boolean penalty, final boolean active, final List<CurrencyData> currencyOptions,
|
||||
final boolean penalty, final boolean active, final Collection<CurrencyData> currencyOptions,
|
||||
final List<EnumOptionData> chargeCalculationTypeOptions, final List<EnumOptionData> chargeAppliesToOptions,
|
||||
final List<EnumOptionData> chargeTimeTypeOptions) {
|
||||
this.id = id;
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
|
||||
this.context.authenticatedUser();
|
||||
|
||||
final List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
final Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
final List<EnumOptionData> allowedChargeCalculationTypeOptions = this.chargeDropdownReadPlatformService.retrieveCalculationTypes();
|
||||
final List<EnumOptionData> allowedChargeAppliesToOptions = this.chargeDropdownReadPlatformService.retrieveApplicableToTypes();
|
||||
final List<EnumOptionData> allowedChargeTimeOptions = this.chargeDropdownReadPlatformService.retrieveCollectionTimeTypes();
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ public class LoanProductsApiResource {
|
||||
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly);
|
||||
chargeOptions.removeAll(productData.charges());
|
||||
|
||||
final List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
final Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
final List<EnumOptionData> amortizationTypeOptions = dropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
|
||||
final List<EnumOptionData> interestTypeOptions = dropdownReadPlatformService.retrieveLoanInterestTypeOptions();
|
||||
final List<EnumOptionData> interestCalculationPeriodTypeOptions = dropdownReadPlatformService
|
||||
|
||||
+7
-29
@@ -55,7 +55,7 @@ public class LoanProductData {
|
||||
private final DateTime createdOn;
|
||||
private final DateTime lastModifedOn;
|
||||
|
||||
private final List<CurrencyData> currencyOptions;
|
||||
private final Collection<CurrencyData> currencyOptions;
|
||||
private final Collection<FundData> fundOptions;
|
||||
private final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions;
|
||||
private final List<EnumOptionData> amortizationTypeOptions;
|
||||
@@ -70,8 +70,8 @@ public class LoanProductData {
|
||||
private final List<GLAccountData> assetAccountOptions;
|
||||
private final List<GLAccountData> incomeAccountOptions;
|
||||
private final List<GLAccountData> expenseAccountOptions;
|
||||
|
||||
//accounting related mapping feilds
|
||||
|
||||
// accounting related mapping feilds
|
||||
private Long loanPortfolioAccountId;
|
||||
private Long fundSourceAccountId;
|
||||
private Long interestOnLoanAccountId;
|
||||
@@ -196,14 +196,14 @@ public class LoanProductData {
|
||||
this.loanTermFrequencyTypeOptions = null;
|
||||
this.repaymentFrequencyTypeOptions = null;
|
||||
this.interestRateFrequencyTypeOptions = null;
|
||||
|
||||
|
||||
this.assetAccountOptions = null;
|
||||
this.incomeAccountOptions = null;
|
||||
this.expenseAccountOptions = null;
|
||||
}
|
||||
|
||||
public LoanProductData(final LoanProductData productData, final Collection<ChargeData> chargeOptions,
|
||||
final List<CurrencyData> currencyOptions, final List<EnumOptionData> amortizationTypeOptions,
|
||||
final Collection<CurrencyData> currencyOptions, final List<EnumOptionData> amortizationTypeOptions,
|
||||
final List<EnumOptionData> interestTypeOptions, final List<EnumOptionData> interestCalculationPeriodTypeOptions,
|
||||
final List<EnumOptionData> loanTermFrequencyTypeOptions, final List<EnumOptionData> repaymentFrequencyTypeOptions,
|
||||
final List<EnumOptionData> interestRateFrequencyTypeOptions, final Collection<FundData> fundOptions,
|
||||
@@ -238,7 +238,7 @@ public class LoanProductData {
|
||||
this.chargeOptions = chargeOptions;
|
||||
this.currencyOptions = currencyOptions;
|
||||
if (this.currencyOptions.size() == 1) {
|
||||
this.currency = this.currencyOptions.get(0);
|
||||
this.currency = new ArrayList<CurrencyData>(this.currencyOptions).get(0);
|
||||
} else {
|
||||
this.currency = productData.currency;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ public class LoanProductData {
|
||||
this.loanTermFrequencyTypeOptions = loanTermFrequencyTypeOptions;
|
||||
this.repaymentFrequencyTypeOptions = repaymentFrequencyTypeOptions;
|
||||
this.interestRateFrequencyTypeOptions = interestRateFrequencyTypeOptions;
|
||||
|
||||
|
||||
this.assetAccountOptions = assetAccountOptions;
|
||||
this.incomeAccountOptions = incomeAccountOptions;
|
||||
this.expenseAccountOptions = expenseAccountOptions;
|
||||
@@ -356,10 +356,6 @@ public class LoanProductData {
|
||||
return lastModifedOn;
|
||||
}
|
||||
|
||||
public List<CurrencyData> getCurrencyOptions() {
|
||||
return currencyOptions;
|
||||
}
|
||||
|
||||
public Collection<FundData> getFundOptions() {
|
||||
return fundOptions;
|
||||
}
|
||||
@@ -408,22 +404,18 @@ public class LoanProductData {
|
||||
return this.expenseAccountOptions;
|
||||
}
|
||||
|
||||
|
||||
public Long getLoanPortfolioAccountId() {
|
||||
return this.loanPortfolioAccountId;
|
||||
}
|
||||
|
||||
|
||||
public void setLoanPortfolioAccountId(Long loanPortfolioAccountId) {
|
||||
this.loanPortfolioAccountId = loanPortfolioAccountId;
|
||||
}
|
||||
|
||||
|
||||
public Long getFundSourceAccountId() {
|
||||
return this.fundSourceAccountId;
|
||||
}
|
||||
|
||||
|
||||
public void setFundSourceAccountId(Long fundSourceAccountId) {
|
||||
this.fundSourceAccountId = fundSourceAccountId;
|
||||
}
|
||||
@@ -432,27 +424,22 @@ public class LoanProductData {
|
||||
return this.interestOnLoanAccountId;
|
||||
}
|
||||
|
||||
|
||||
public void setInterestOnLoanAccountId(Long interestOnLoanAccountId) {
|
||||
this.interestOnLoanAccountId = interestOnLoanAccountId;
|
||||
}
|
||||
|
||||
|
||||
public Long getIncomeFromFeeAccountId() {
|
||||
return this.incomeFromFeeAccountId;
|
||||
}
|
||||
|
||||
|
||||
public void setIncomeFromFeeAccountId(Long incomeFromFeeAccountId) {
|
||||
this.incomeFromFeeAccountId = incomeFromFeeAccountId;
|
||||
}
|
||||
|
||||
|
||||
public Long getIncomeFromPenaltyAccountId() {
|
||||
return this.incomeFromPenaltyAccountId;
|
||||
}
|
||||
|
||||
|
||||
public void setIncomeFromPenaltyAccountId(Long incomeFromPenaltyAccountId) {
|
||||
this.incomeFromPenaltyAccountId = incomeFromPenaltyAccountId;
|
||||
}
|
||||
@@ -461,45 +448,36 @@ public class LoanProductData {
|
||||
return this.writeOffAccountId;
|
||||
}
|
||||
|
||||
|
||||
public void setWriteOffAccountId(Long writeOffAccountId) {
|
||||
this.writeOffAccountId = writeOffAccountId;
|
||||
}
|
||||
|
||||
|
||||
public Long getReceivableInterestAccountId() {
|
||||
return this.receivableInterestAccountId;
|
||||
}
|
||||
|
||||
|
||||
public void setReceivableInterestAccountId(Long receivableInterestAccountId) {
|
||||
this.receivableInterestAccountId = receivableInterestAccountId;
|
||||
}
|
||||
|
||||
|
||||
public Long getReceivableFeeAccountId() {
|
||||
return this.receivableFeeAccountId;
|
||||
}
|
||||
|
||||
|
||||
public void setReceivableFeeAccountId(Long receivableFeeAccountId) {
|
||||
this.receivableFeeAccountId = receivableFeeAccountId;
|
||||
}
|
||||
|
||||
|
||||
public Long getReceivablePenaltyAccountId() {
|
||||
return this.receivablePenaltyAccountId;
|
||||
}
|
||||
|
||||
|
||||
public void setReceivablePenaltyAccountId(Long receivablePenaltyAccountId) {
|
||||
this.receivablePenaltyAccountId = receivablePenaltyAccountId;
|
||||
}
|
||||
|
||||
|
||||
public Integer getAccountingType() {
|
||||
return this.accountingType;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -239,7 +239,7 @@ public class SavingsAccountApiResource {
|
||||
"dueAmount"));
|
||||
|
||||
Collection<SavingProductLookup> productOptions = savingProductReadPlatformService.retrieveAllSavingProductsForLookup();
|
||||
List<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
Collection<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
|
||||
EnumOptionData recurring = SavingProductEnumerations.savingProductType(SavingProductType.RECURRING);
|
||||
EnumOptionData regular = SavingProductEnumerations.savingProductType(SavingProductType.REGULAR);
|
||||
|
||||
+6
-5
@@ -51,7 +51,7 @@ public class SavingAccountData {
|
||||
private final Integer depositEvery;
|
||||
|
||||
private final List<SavingProductLookup> productOptions;
|
||||
private final List<CurrencyData> currencyOptions;
|
||||
private final Collection<CurrencyData> currencyOptions;
|
||||
private final List<EnumOptionData> savingsProductTypeOptions;
|
||||
private final List<EnumOptionData> tenureTypeOptions;
|
||||
private final List<EnumOptionData> savingFrequencyOptions;
|
||||
@@ -188,10 +188,11 @@ public class SavingAccountData {
|
||||
this.interestPostFrequency = 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, BigDecimal dueAmount) {
|
||||
public SavingAccountData(SavingAccountData account, Collection<SavingProductLookup> productOptions,
|
||||
Collection<CurrencyData> currencyOptions, List<EnumOptionData> savingsProductTypeOptions,
|
||||
List<EnumOptionData> tenureTypeOptions, List<EnumOptionData> savingFrequencyOptions,
|
||||
List<EnumOptionData> savingsInterestTypeOptions, List<EnumOptionData> lockinPeriodTypeOptions,
|
||||
List<EnumOptionData> interestCalculationOptions, BigDecimal dueAmount) {
|
||||
this.id = account.id;
|
||||
this.status = account.status;
|
||||
this.externalId = account.externalId;
|
||||
|
||||
+6
-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","depositEvery"));
|
||||
"lockinPeriod", "lockinPeriodType", "depositEvery"));
|
||||
|
||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
if (responseParameters.isEmpty()) {
|
||||
@@ -125,15 +125,15 @@ public class SavingProductsApiResource {
|
||||
"description", "currencyCode", "digitsAfterDecimal", "interstRate", "minInterestRate", "maxInterestRate",
|
||||
"savingsDepositAmount", "savingProductType", "tenureType", "tenure", "frequency", "interestType",
|
||||
"interestCalculationMethod", "minimumBalanceForWithdrawal", "isPartialDepositAllowed", "isLockinPeriodAllowed",
|
||||
"lockinPeriod", "lockinPeriodType","depositEvery"));
|
||||
"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) {
|
||||
@@ -154,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","depositEvery"));
|
||||
"isPartialDepositAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "currencyOptions", "depositEvery"));
|
||||
|
||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
if (responseParameters.isEmpty()) {
|
||||
@@ -171,7 +171,7 @@ public class SavingProductsApiResource {
|
||||
|
||||
responseParameters.addAll(Arrays.asList("currencyOptions", "savingsProductTypeOptions", "tenureTypeOptions",
|
||||
"savingFrequencyOptions", "savingsInterestTypeOptions", "lockinPeriodTypeOptions", "interestCalculationOptions"));
|
||||
List<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
Collection<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
|
||||
EnumOptionData reccuring = SavingProductEnumerations.savingProductType(SavingProductType.RECURRING);
|
||||
EnumOptionData regular = SavingProductEnumerations.savingProductType(SavingProductType.REGULAR);
|
||||
|
||||
+21
-22
@@ -3,6 +3,7 @@ package org.mifosplatform.portfolio.savingsaccountproduct.data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
@@ -44,16 +45,17 @@ public class SavingProductData implements Serializable {
|
||||
private DateTime lastModifedOn;
|
||||
private final Integer depositEvery;
|
||||
|
||||
private List<CurrencyData> currencyOptions = new ArrayList<CurrencyData>();
|
||||
List<EnumOptionData> savingsProductTypeOptions = new ArrayList<EnumOptionData>();
|
||||
List<EnumOptionData> tenureTypeOptions = new ArrayList<EnumOptionData>();
|
||||
List<EnumOptionData> savingFrequencyOptions = new ArrayList<EnumOptionData>();
|
||||
List<EnumOptionData> savingsInterestTypeOptions = new ArrayList<EnumOptionData>();
|
||||
List<EnumOptionData> lockinPeriodTypeOptions = new ArrayList<EnumOptionData>();
|
||||
List<EnumOptionData> interestCalculationOptions = new ArrayList<EnumOptionData>();
|
||||
@SuppressWarnings("unused")
|
||||
private Collection<CurrencyData> currencyOptions = new ArrayList<CurrencyData>();
|
||||
private List<EnumOptionData> savingsProductTypeOptions = new ArrayList<EnumOptionData>();
|
||||
private List<EnumOptionData> tenureTypeOptions = new ArrayList<EnumOptionData>();
|
||||
private List<EnumOptionData> savingFrequencyOptions = new ArrayList<EnumOptionData>();
|
||||
private List<EnumOptionData> savingsInterestTypeOptions = new ArrayList<EnumOptionData>();
|
||||
private List<EnumOptionData> lockinPeriodTypeOptions = new ArrayList<EnumOptionData>();
|
||||
private 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;
|
||||
@@ -69,13 +71,14 @@ public class SavingProductData implements Serializable {
|
||||
this.tenure = Integer.valueOf(12);
|
||||
this.savingFrequencyType = SavingProductEnumerations.interestFrequencyType(SavingFrequencyType.MONTHLY);
|
||||
this.interestType = SavingProductEnumerations.savingInterestType(SavingsInterestType.COMPOUNDING);
|
||||
this.interestCalculationMethod = SavingProductEnumerations.savingInterestCalculationMethod(SavingInterestCalculationMethod.AVERAGEBAL);
|
||||
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);
|
||||
this.depositEvery = Integer.valueOf(3);
|
||||
}
|
||||
|
||||
public SavingProductData(DateTime createdOn, DateTime lastModifedOn, Long id, String name, String description, BigDecimal interestRate,
|
||||
@@ -109,10 +112,10 @@ public class SavingProductData implements Serializable {
|
||||
this.depositEvery = depositEvery;
|
||||
}
|
||||
|
||||
public SavingProductData(SavingProductData product, List<CurrencyData> currencyOptions, List<EnumOptionData> savingsProductTypeOptions,
|
||||
List<EnumOptionData> tenureTypeOptions, List<EnumOptionData> savingFrequencyOptions,
|
||||
List<EnumOptionData> savingsInterestTypeOptions, List<EnumOptionData> lockinPeriodTypeOptions,
|
||||
List<EnumOptionData> interestCalculationOptions) {
|
||||
public SavingProductData(SavingProductData product, Collection<CurrencyData> currencyOptions,
|
||||
List<EnumOptionData> savingsProductTypeOptions, List<EnumOptionData> tenureTypeOptions,
|
||||
List<EnumOptionData> savingFrequencyOptions, List<EnumOptionData> savingsInterestTypeOptions,
|
||||
List<EnumOptionData> lockinPeriodTypeOptions, List<EnumOptionData> interestCalculationOptions) {
|
||||
|
||||
this.createdOn = product.getCreatedOn();
|
||||
this.lastModifedOn = product.getLastModifedOn();
|
||||
@@ -232,11 +235,7 @@ public class SavingProductData implements Serializable {
|
||||
return lastModifedOn;
|
||||
}
|
||||
|
||||
public List<CurrencyData> getCurrencyOptions() {
|
||||
return currencyOptions;
|
||||
}
|
||||
|
||||
public void setCurrencyOptions(List<CurrencyData> currencyOptions) {
|
||||
public void setCurrencyOptions(Collection<CurrencyData> currencyOptions) {
|
||||
this.currencyOptions = currencyOptions;
|
||||
}
|
||||
|
||||
@@ -268,8 +267,8 @@ public class SavingProductData implements Serializable {
|
||||
return interestCalculationOptions;
|
||||
}
|
||||
|
||||
public Integer getDepositEvery() {
|
||||
return this.depositEvery;
|
||||
}
|
||||
public Integer getDepositEvery() {
|
||||
return this.depositEvery;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-4
@@ -4,7 +4,6 @@ import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||
@@ -60,7 +59,7 @@ public class SavingProductReadPlatformServiceImpl implements SavingProductReadPl
|
||||
|
||||
SavingProductLookupMapper savingProductLookupMapper = new SavingProductLookupMapper();
|
||||
|
||||
String sql = "select " + savingProductLookupMapper.savingProductLookupSchema() + " where sp.is_deleted=0";
|
||||
String sql = "select " + savingProductLookupMapper.savingProductLookupSchema() + " where sp.is_deleted=0";
|
||||
|
||||
return this.jdbcTemplate.query(sql, savingProductLookupMapper, new Object[] {});
|
||||
}
|
||||
@@ -146,7 +145,7 @@ 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,depositEvery);
|
||||
isLockinPeriodAllowed, lockinPeriod, lockinPeriodType, depositEvery);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +168,7 @@ public class SavingProductReadPlatformServiceImpl implements SavingProductReadPl
|
||||
|
||||
private void populateProductDataWithDropdownOptions(final SavingProductData productData) {
|
||||
|
||||
List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
productData.setCurrencyOptions(currencyOptions);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ public class DepositProductsApiResource {
|
||||
private DepositProductData handleTemplateRelatedData(final Set<String> responseParameters, final DepositProductData productData) {
|
||||
|
||||
responseParameters.addAll(Arrays.asList("currencyOptions", "interestCompoundedEveryPeriodTypeOptions"));
|
||||
List<CurrencyData> allowedCurrencies = this.currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
Collection<CurrencyData> allowedCurrencies = this.currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
|
||||
EnumOptionData monthly = SavingsDepositEnumerations.interestCompoundingPeriodType(PeriodFrequencyType.MONTHS);
|
||||
List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions = Arrays.asList(monthly);
|
||||
|
||||
+6
-4
@@ -2,6 +2,7 @@ package org.mifosplatform.portfolio.savingsdepositproduct.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
@@ -40,7 +41,7 @@ public class DepositProductData {
|
||||
private final DateTime createdOn;
|
||||
private final DateTime lastModifedOn;
|
||||
|
||||
private final List<CurrencyData> currencyOptions;
|
||||
private final Collection<CurrencyData> currencyOptions;
|
||||
private final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions;
|
||||
|
||||
public DepositProductData(final DateTime createdOn, final DateTime lastModifedOn, final Long id, final String externalId,
|
||||
@@ -82,7 +83,8 @@ public class DepositProductData {
|
||||
this.interestCompoundedEveryPeriodTypeOptions = new ArrayList<EnumOptionData>();
|
||||
}
|
||||
|
||||
public DepositProductData(final List<CurrencyData> currencyOptions, final EnumOptionData defaultInterestCompoundedEveryPeriodType,
|
||||
public DepositProductData(final Collection<CurrencyData> currencyOptions,
|
||||
final EnumOptionData defaultInterestCompoundedEveryPeriodType,
|
||||
final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) {
|
||||
this.createdOn = null;
|
||||
this.lastModifedOn = null;
|
||||
@@ -115,7 +117,7 @@ public class DepositProductData {
|
||||
this.interestCompoundedEveryPeriodTypeOptions = interestCompoundedEveryPeriodTypeOptions;
|
||||
}
|
||||
|
||||
public DepositProductData(final DepositProductData product, final List<CurrencyData> currencyOptions,
|
||||
public DepositProductData(final DepositProductData product, final Collection<CurrencyData> currencyOptions,
|
||||
final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) {
|
||||
this.createdOn = product.getCreatedOn();
|
||||
this.lastModifedOn = product.getLastModifedOn();
|
||||
@@ -224,7 +226,7 @@ public class DepositProductData {
|
||||
return lastModifedOn;
|
||||
}
|
||||
|
||||
public List<CurrencyData> getCurrencyOptions() {
|
||||
public Collection<CurrencyData> getCurrencyOptions() {
|
||||
return currencyOptions;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user