Revert "FINERACT-1410 :Allow Payment types to map to all types of Ledgers (#1894)"

This reverts commit 32fae2b127.
This commit is contained in:
Petri Tuomola
2021-10-20 11:22:21 +08:00
parent 9ba63ef7f7
commit 50367f36d8
14 changed files with 34 additions and 147 deletions
@@ -362,7 +362,8 @@ public class ProductToGLAccountMappingHelper {
private void savePaymentChannelToFundSourceMapping(final Long productId, final Long paymentTypeId, private void savePaymentChannelToFundSourceMapping(final Long productId, final Long paymentTypeId,
final Long paymentTypeSpecificFundAccountId, final PortfolioProductType portfolioProductType) { final Long paymentTypeSpecificFundAccountId, final PortfolioProductType portfolioProductType) {
final PaymentType paymentType = this.paymentTypeRepositoryWrapper.findOneWithNotFoundDetection(paymentTypeId); final PaymentType paymentType = this.paymentTypeRepositoryWrapper.findOneWithNotFoundDetection(paymentTypeId);
final GLAccount glAccount = getAccountById(LoanProductAccountingParams.FUND_SOURCE.getValue(), paymentTypeSpecificFundAccountId); final GLAccount glAccount = getAccountByIdAndType(LoanProductAccountingParams.FUND_SOURCE.getValue(), GLAccountType.ASSET,
paymentTypeSpecificFundAccountId);
final ProductToGLAccountMapping accountMapping = new ProductToGLAccountMapping(glAccount, productId, final ProductToGLAccountMapping accountMapping = new ProductToGLAccountMapping(glAccount, productId,
portfolioProductType.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(), paymentType); portfolioProductType.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(), paymentType);
this.accountMappingRepository.save(accountMapping); this.accountMappingRepository.save(accountMapping);
@@ -426,11 +427,6 @@ public class ProductToGLAccountMappingHelper {
return glAccount; return glAccount;
} }
public GLAccount getAccountById(final String paramName, final Long accountId) {
final GLAccount glAccount = this.accountRepositoryWrapper.findOneWithNotFoundDetection(accountId);
return glAccount;
}
public GLAccount getAccountByIdAndType(final String paramName, final List<GLAccountType> expectedAccountTypes, final Long accountId) { public GLAccount getAccountByIdAndType(final String paramName, final List<GLAccountType> expectedAccountTypes, final Long accountId) {
final GLAccount glAccount = this.accountRepositoryWrapper.findOneWithNotFoundDetection(accountId); final GLAccount glAccount = this.accountRepositoryWrapper.findOneWithNotFoundDetection(accountId);
// validate account is of the expected Type // validate account is of the expected Type
@@ -31,6 +31,5 @@ public final class GlobalConfigurationApiConstant {
public static final String CONFIGURATION_RESOURCE_NAME = "globalConfiguration"; public static final String CONFIGURATION_RESOURCE_NAME = "globalConfiguration";
public static final String localeParamName = "locale"; public static final String localeParamName = "locale";
public static final String dateFormatParamName = "dateFormat"; public static final String dateFormatParamName = "dateFormat";
public static final String STRING_VALUE = "stringValue";
} }
@@ -43,10 +43,9 @@ import org.springframework.stereotype.Component;
public class GlobalConfigurationDataValidator { public class GlobalConfigurationDataValidator {
private final FromJsonHelper fromApiJsonHelper; private final FromJsonHelper fromApiJsonHelper;
private static final Set<String> UPDATE_CONFIGURATION_DATA_PARAMETERS = new HashSet<>( private static final Set<String> UPDATE_CONFIGURATION_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
Arrays.asList(GlobalConfigurationApiConstant.localeParamName, GlobalConfigurationApiConstant.dateFormatParamName, GlobalConfigurationApiConstant.localeParamName, GlobalConfigurationApiConstant.dateFormatParamName,
GlobalConfigurationApiConstant.ENABLED, GlobalConfigurationApiConstant.VALUE, GlobalConfigurationApiConstant.DATE_VALUE, GlobalConfigurationApiConstant.ENABLED, GlobalConfigurationApiConstant.VALUE, GlobalConfigurationApiConstant.DATE_VALUE));
GlobalConfigurationApiConstant.STRING_VALUE));
@Autowired @Autowired
public GlobalConfigurationDataValidator(final FromJsonHelper fromApiJsonHelper) { public GlobalConfigurationDataValidator(final FromJsonHelper fromApiJsonHelper) {
@@ -82,11 +81,6 @@ public class GlobalConfigurationDataValidator {
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.DATE_VALUE).value(dateValue).notNull(); baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.DATE_VALUE).value(dateValue).notNull();
} }
if (this.fromApiJsonHelper.parameterExists(GlobalConfigurationApiConstant.STRING_VALUE, element)) {
final String stringValue = this.fromApiJsonHelper.extractStringNamed(GlobalConfigurationApiConstant.STRING_VALUE, element);
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.STRING_VALUE).value(stringValue).notNull();
}
if (!dataValidationErrors.isEmpty()) { if (!dataValidationErrors.isEmpty()) {
throw new PlatformApiDataValidationException(dataValidationErrors); throw new PlatformApiDataValidationException(dataValidationErrors);
} }
@@ -33,7 +33,6 @@ public class GlobalConfigurationPropertyData {
private final Long value; private final Long value;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final Date dateValue; private final Date dateValue;
private String stringValue;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final Long id; private final Long id;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@@ -42,24 +41,22 @@ public class GlobalConfigurationPropertyData {
private final boolean trapDoor; private final boolean trapDoor;
public GlobalConfigurationPropertyData(final String name, final boolean enabled, final Long value, final Date dateValue, public GlobalConfigurationPropertyData(final String name, final boolean enabled, final Long value, final Date dateValue,
final String stringValue, final String description, final boolean trapDoor) { final String description, final boolean trapDoor) {
this.name = name; this.name = name;
this.enabled = enabled; this.enabled = enabled;
this.value = value; this.value = value;
this.dateValue = dateValue; this.dateValue = dateValue;
this.stringValue = stringValue;
this.id = null; this.id = null;
this.description = description; this.description = description;
this.trapDoor = trapDoor; this.trapDoor = trapDoor;
} }
public GlobalConfigurationPropertyData(final String name, final boolean enabled, final Long value, Date dateValue, public GlobalConfigurationPropertyData(final String name, final boolean enabled, final Long value, Date dateValue, final Long id,
final String stringValue, final Long id, final String description, final boolean isTrapDoor) { final String description, final boolean isTrapDoor) {
this.name = name; this.name = name;
this.enabled = enabled; this.enabled = enabled;
this.value = value; this.value = value;
this.dateValue = dateValue; this.dateValue = dateValue;
this.stringValue = stringValue;
this.id = id; this.id = id;
this.description = description; this.description = description;
this.trapDoor = isTrapDoor; this.trapDoor = isTrapDoor;
@@ -77,10 +74,6 @@ public class GlobalConfigurationPropertyData {
return this.value; return this.value;
} }
public String getStringValue() {
return this.stringValue;
}
public Date getDateValue() { public Date getDateValue() {
return this.dateValue; return this.dateValue;
} }
@@ -98,8 +98,4 @@ public interface ConfigurationDomainService {
boolean isFirstRepaymentDateAfterRescheduleAllowedOnHoliday(); boolean isFirstRepaymentDateAfterRescheduleAllowedOnHoliday();
boolean isInterestToBeAppropriatedEquallyWhenGreaterThanEMI(); boolean isInterestToBeAppropriatedEquallyWhenGreaterThanEMI();
String getAccountMappingForPaymentType();
String getAccountMappingForCharge();
} }
@@ -363,34 +363,4 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
} }
} }
@Override
public String getAccountMappingForPaymentType() {
final String propertyName = "account-mapping-for-payment-type";
String defaultValue = "Asset"; // 1 Stands for Account mapped from asset only
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName);
if (property.isEnabled()) {
String value = property.getStringValue();
if (value == null) {
return defaultValue;
}
return value;
}
return defaultValue;
}
@Override
public String getAccountMappingForCharge() {
final String propertyName = "account-mapping-for-charge";
String defaultValue = "Income"; // 1 Stands for Account mapped from income only
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName);
if (property.isEnabled()) {
String value = property.getValue().toString();
if (value == null) {
return defaultValue;
}
return value;
}
return defaultValue;
}
} }
@@ -46,9 +46,6 @@ public class GlobalConfigurationProperty extends AbstractPersistableCustom {
@Column(name = "date_value", nullable = true) @Column(name = "date_value", nullable = true)
private Date dateValue; private Date dateValue;
@Column(name = "string_value", nullable = true)
private String stringValue;
@Column(name = "description", nullable = true) @Column(name = "description", nullable = true)
private String description; private String description;
@@ -60,18 +57,16 @@ public class GlobalConfigurationProperty extends AbstractPersistableCustom {
this.enabled = false; this.enabled = false;
this.value = null; this.value = null;
this.dateValue = null; this.dateValue = null;
this.stringValue = null;
this.description = null; this.description = null;
this.isTrapDoor = false; this.isTrapDoor = false;
} }
public GlobalConfigurationProperty(final String name, final boolean enabled, final Long value, final Date dateValue, public GlobalConfigurationProperty(final String name, final boolean enabled, final Long value, final Date dateValue,
final String stringValue, final String description, final boolean isTrapDoor) { final String description, final boolean isTrapDoor) {
this.name = name; this.name = name;
this.enabled = enabled; this.enabled = enabled;
this.value = value; this.value = value;
this.dateValue = dateValue; this.dateValue = dateValue;
this.stringValue = stringValue;
this.description = description; this.description = description;
this.isTrapDoor = isTrapDoor; this.isTrapDoor = isTrapDoor;
} }
@@ -88,10 +83,6 @@ public class GlobalConfigurationProperty extends AbstractPersistableCustom {
return this.dateValue; return this.dateValue;
} }
public String getStringValue() {
return this.stringValue;
}
public Map<String, Object> update(final JsonCommand command) { public Map<String, Object> update(final JsonCommand command) {
final Map<String, Object> actualChanges = new LinkedHashMap<>(7); final Map<String, Object> actualChanges = new LinkedHashMap<>(7);
@@ -122,13 +113,6 @@ public class GlobalConfigurationProperty extends AbstractPersistableCustom {
this.dateValue = newDateValue; this.dateValue = newDateValue;
} }
final String stringValueParamName = "stringValue";
if (command.isChangeInStringParameterNamed(stringValueParamName, this.stringValue)) {
final String newStringValue = command.stringValueOfParameterNamed(stringValueParamName);
actualChanges.put(stringValueParamName, newStringValue);
this.stringValue = newStringValue;
}
final String passwordPropertyName = "force-password-reset-days"; final String passwordPropertyName = "force-password-reset-days";
if (this.name.equalsIgnoreCase(passwordPropertyName)) { if (this.name.equalsIgnoreCase(passwordPropertyName)) {
if ((this.enabled == true && command.hasParameter(valueParamName) && (this.value == 0)) if ((this.enabled == true && command.hasParameter(valueParamName) && (this.value == 0))
@@ -142,12 +126,12 @@ public class GlobalConfigurationProperty extends AbstractPersistableCustom {
} }
public static GlobalConfigurationProperty newSurveyConfiguration(final String name) { public static GlobalConfigurationProperty newSurveyConfiguration(final String name) {
return new GlobalConfigurationProperty(name, false, null, null, null, null, false); return new GlobalConfigurationProperty(name, false, null, null, null, false);
} }
public GlobalConfigurationPropertyData toData() { public GlobalConfigurationPropertyData toData() {
return new GlobalConfigurationPropertyData(getName(), isEnabled(), getValue(), getDateValue(), getStringValue(), this.getId(), return new GlobalConfigurationPropertyData(getName(), isEnabled(), getValue(), getDateValue(), this.getId(), this.description,
this.description, this.isTrapDoor); this.isTrapDoor);
} }
public String getName() { public String getName() {
@@ -52,7 +52,7 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl
this.context.authenticatedUser(); this.context.authenticatedUser();
String sql = "SELECT c.id, c.name, c.enabled, c.value, c.date_value, c.description,c.string_value, c.is_trap_door FROM c_configuration c "; String sql = "SELECT c.id, c.name, c.enabled, c.value, c.date_value, c.description, c.is_trap_door FROM c_configuration c ";
if (survey) { if (survey) {
sql += " JOIN x_registered_table on x_registered_table.registered_table_name = c.name "; sql += " JOIN x_registered_table on x_registered_table.registered_table_name = c.name ";
@@ -68,11 +68,11 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl
} }
@Override @Override
public GlobalConfigurationPropertyData retrieveGlobalConfiguration(final String name) { public GlobalConfigurationPropertyData retrieveGlobalConfiguration(String name) {
this.context.authenticatedUser(); this.context.authenticatedUser();
final String sql = "SELECT c.id, c.name, c.enabled, c.value, c.date_value, c.string_value, c.description, c.is_trap_door FROM " final String sql = "SELECT c.id, c.name, c.enabled, c.value, c.date_value, c.description, c.is_trap_door FROM "
+ "c_configuration c where c.name=? order by c.id"; + "c_configuration c where c.name=? order by c.id";
final GlobalConfigurationPropertyData globalConfiguration = this.jdbcTemplate.queryForObject(sql, this.rm, new Object[] { name }); final GlobalConfigurationPropertyData globalConfiguration = this.jdbcTemplate.queryForObject(sql, this.rm, new Object[] { name });
@@ -84,7 +84,7 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl
this.context.authenticatedUser(); this.context.authenticatedUser();
final String sql = "SELECT c.id, c.name, c.enabled, c.value, c.date_value, c.string_value ,c.description, c.is_trap_door FROM " final String sql = "SELECT c.id, c.name, c.enabled, c.value, c.date_value, c.description, c.is_trap_door FROM "
+ "c_configuration c where c.id=? order by c.id"; + "c_configuration c where c.id=? order by c.id";
final GlobalConfigurationPropertyData globalConfiguration = this.jdbcTemplate.queryForObject(sql, this.rm, final GlobalConfigurationPropertyData globalConfiguration = this.jdbcTemplate.queryForObject(sql, this.rm,
new Object[] { configId }); new Object[] { configId });
@@ -102,11 +102,10 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl
final boolean enabled = rs.getBoolean("enabled"); final boolean enabled = rs.getBoolean("enabled");
final Long value = rs.getLong("value"); final Long value = rs.getLong("value");
final Date dateValue = rs.getDate("date_value"); final Date dateValue = rs.getDate("date_value");
final String stringValue = rs.getString("string_value");
final String description = rs.getString("description"); final String description = rs.getString("description");
final Long id = rs.getLong("id"); final Long id = rs.getLong("id");
final boolean isTrapDoor = rs.getBoolean("is_trap_door"); final boolean isTrapDoor = rs.getBoolean("is_trap_door");
return new GlobalConfigurationPropertyData(name, enabled, value, dateValue, stringValue, id, description, isTrapDoor); return new GlobalConfigurationPropertyData(name, enabled, value, dateValue, id, description, isTrapDoor);
} }
} }
@@ -191,6 +191,4 @@ public class SavingsApiConstants {
public static final String gsimApplicationId = "applicationId"; public static final String gsimApplicationId = "applicationId";
public static final String gsimLastApplication = "lastApplication"; public static final String gsimLastApplication = "lastApplication";
public static final String ERROR_MSG_SAVINGS_ACCOUNT_NOT_ACTIVE = "not.in.active.state"; public static final String ERROR_MSG_SAVINGS_ACCOUNT_NOT_ACTIVE = "not.in.active.state";
public static final String accountMappingForPaymentParamName = "accountMappingForPayment";
} }
@@ -41,12 +41,13 @@ public class SavingsApiSetConstants extends SavingsApiConstants {
"interestCalculationTypeOptions", "interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "interestCalculationTypeOptions", "interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions",
"withdrawalFeeTypeOptions", nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName, "withdrawalFeeTypeOptions", nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName,
withHoldTaxParamName, taxGroupIdParamName, isDormancyTrackingActiveParamName, daysToInactiveParamName, withHoldTaxParamName, taxGroupIdParamName, isDormancyTrackingActiveParamName, daysToInactiveParamName,
daysToDormancyParamName, daysToInactiveParamName, accountMappingForPaymentParamName)); daysToDormancyParamName, daysToInactiveParamName));
/** /**
* These parameters will match the class level parameters of {@link SavingsAccountData}. Where possible, we try to * These parameters will match the class level parameters of {@link SavingsAccountData}. Where possible, we try to
* get response parameters to match those of request parameters. * get response parameters to match those of request parameters.
*/ */
protected static final Set<String> SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, protected static final Set<String> SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
accountNoParamName, externalIdParamName, statusParamName, activatedOnDateParamName, staffIdParamName, clientIdParamName, accountNoParamName, externalIdParamName, statusParamName, activatedOnDateParamName, staffIdParamName, clientIdParamName,
"clientName", groupIdParamName, "groupName", "savingsProductId", "savingsProductName", "currency", "clientName", groupIdParamName, "groupName", "savingsProductId", "savingsProductName", "currency",
@@ -57,7 +58,7 @@ public class SavingsApiSetConstants extends SavingsApiConstants {
"interestCompoundingPeriodTypeOptions", "interestPostingPeriodTypeOptions", "interestCalculationTypeOptions", "interestCompoundingPeriodTypeOptions", "interestPostingPeriodTypeOptions", "interestCalculationTypeOptions",
"interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions", "withdrawalFee", "interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions", "withdrawalFee",
"annualFee", onHoldFundsParamName, nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName, "annualFee", onHoldFundsParamName, nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName,
datatables, savingsAmountOnHold, accountMappingForPaymentParamName)); datatables, savingsAmountOnHold));
protected static final Set<String> SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>( protected static final Set<String> SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList(idParamName, "accountId", accountNoParamName, "currency", "amount", dateParamName, paymentDetailDataParamName, Arrays.asList(idParamName, "accountId", accountNoParamName, "currency", "amount", dateParamName, paymentDetailDataParamName,
@@ -52,7 +52,6 @@ import org.apache.fineract.accounting.producttoaccountmapping.service.ProductToG
import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder; import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
@@ -101,7 +100,6 @@ public class SavingsProductsApiResource {
private final ChargeReadPlatformService chargeReadPlatformService; private final ChargeReadPlatformService chargeReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; private final PaymentTypeReadPlatformService paymentTypeReadPlatformService;
private final TaxReadPlatformService taxReadPlatformService; private final TaxReadPlatformService taxReadPlatformService;
private final ConfigurationDomainService configurationDomainService;
@Autowired @Autowired
public SavingsProductsApiResource(final SavingsProductReadPlatformService savingProductReadPlatformService, public SavingsProductsApiResource(final SavingsProductReadPlatformService savingProductReadPlatformService,
@@ -113,7 +111,7 @@ public class SavingsProductsApiResource {
final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService, final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService,
final ProductToGLAccountMappingReadPlatformService accountMappingReadPlatformService, final ProductToGLAccountMappingReadPlatformService accountMappingReadPlatformService,
final ChargeReadPlatformService chargeReadPlatformService, PaymentTypeReadPlatformService paymentTypeReadPlatformService, final ChargeReadPlatformService chargeReadPlatformService, PaymentTypeReadPlatformService paymentTypeReadPlatformService,
final TaxReadPlatformService taxReadPlatformService, final ConfigurationDomainService configurationDomainService) { final TaxReadPlatformService taxReadPlatformService) {
this.savingProductReadPlatformService = savingProductReadPlatformService; this.savingProductReadPlatformService = savingProductReadPlatformService;
this.dropdownReadPlatformService = dropdownReadPlatformService; this.dropdownReadPlatformService = dropdownReadPlatformService;
this.currencyReadPlatformService = currencyReadPlatformService; this.currencyReadPlatformService = currencyReadPlatformService;
@@ -126,7 +124,6 @@ public class SavingsProductsApiResource {
this.chargeReadPlatformService = chargeReadPlatformService; this.chargeReadPlatformService = chargeReadPlatformService;
this.paymentTypeReadPlatformService = paymentTypeReadPlatformService; this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
this.taxReadPlatformService = taxReadPlatformService; this.taxReadPlatformService = taxReadPlatformService;
this.configurationDomainService = configurationDomainService;
} }
@POST @POST
@@ -135,7 +132,7 @@ public class SavingsProductsApiResource {
@Operation(summary = "Create a Savings Product", description = "Creates a Savings Product\n\n" @Operation(summary = "Create a Savings Product", description = "Creates a Savings Product\n\n"
+ "Mandatory Fields: name, shortName, description, currencyCode, digitsAfterDecimal,inMultiplesOf, nominalAnnualInterestRate, interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType,accountingRule\n\n" + "Mandatory Fields: name, shortName, description, currencyCode, digitsAfterDecimal,inMultiplesOf, nominalAnnualInterestRate, interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType,accountingRule\n\n"
+ "Mandatory Fields for Cash based accounting (accountingRule = 2): savingsReferenceAccountId, savingsControlAccountId, interestOnSavingsAccountId, incomeFromFeeAccountId, transfersInSuspenseAccountId, incomeFromPenaltyAccountId\n\n" + "Mandatory Fields for Cash based accounting (accountingRule = 2): savingsReferenceAccountId, savingsControlAccountId, interestOnSavingsAccountId, incomeFromFeeAccountId, transfersInSuspenseAccountId, incomeFromPenaltyAccountId\n\n"
+ "Optional Fields: minRequiredOpeningBalance, lockinPeriodFrequency, lockinPeriodFrequencyType, withdrawalFeeForTransfers, paymentChannelToFundSourceMappings, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, charges, allowOverdraft, overdraftLimit, minBalanceForInterestCalculation,withHoldTax,taxGroupId,accountMapping") + "Optional Fields: minRequiredOpeningBalance, lockinPeriodFrequency, lockinPeriodFrequencyType, withdrawalFeeForTransfers, paymentChannelToFundSourceMappings, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, charges, allowOverdraft, overdraftLimit, minBalanceForInterestCalculation,withHoldTax,taxGroupId")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.PostSavingsProductsRequest.class))) @RequestBody(required = true, content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.PostSavingsProductsRequest.class)))
@ApiResponses({ @ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.PostSavingsProductsResponse.class))) }) @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.PostSavingsProductsResponse.class))) })
@@ -232,8 +229,7 @@ public class SavingsProductsApiResource {
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Retrieve Savings Product Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" @Operation(summary = "Retrieve Savings Product Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n"
+ "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "Account Mapping:\n" + "\n" + "\n" + "Field Defaults\n" + "Allowed description Lists\n" + "Example Request:\n" + "\n" + "savingsproducts/template")
+ "savingsproducts/template")
@ApiResponses({ @ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.GetSavingsProductsTemplateResponse.class))) }) @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SavingsProductsApiResourceSwagger.GetSavingsProductsTemplateResponse.class))) })
public String retrieveTemplate(@Context final UriInfo uriInfo) { public String retrieveTemplate(@Context final UriInfo uriInfo) {
@@ -292,8 +288,6 @@ public class SavingsProductsApiResource {
final Map<String, List<GLAccountData>> accountingMappingOptions = this.accountingDropdownReadPlatformService final Map<String, List<GLAccountData>> accountingMappingOptions = this.accountingDropdownReadPlatformService
.retrieveAccountMappingOptionsForSavingsProducts(); .retrieveAccountMappingOptionsForSavingsProducts();
final String accountMappingForPayment = configurationDomainService.getAccountMappingForPaymentType();
// charges // charges
final boolean feeChargesOnly = false; final boolean feeChargesOnly = false;
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsProductApplicableCharges(feeChargesOnly); Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsProductApplicableCharges(feeChargesOnly);
@@ -307,14 +301,13 @@ public class SavingsProductsApiResource {
savingsProductToReturn = SavingsProductData.withTemplate(savingsProduct, currencyOptions, interestCompoundingPeriodTypeOptions, savingsProductToReturn = SavingsProductData.withTemplate(savingsProduct, currencyOptions, interestCompoundingPeriodTypeOptions,
interestPostingPeriodTypeOptions, interestCalculationTypeOptions, interestCalculationDaysInYearTypeOptions, interestPostingPeriodTypeOptions, interestCalculationTypeOptions, interestCalculationDaysInYearTypeOptions,
lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, paymentTypeOptions, accountingRuleOptions, lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, paymentTypeOptions, accountingRuleOptions,
accountingMappingOptions, chargeOptions, penaltyOptions, taxGroupOptions, accountMappingForPayment); accountingMappingOptions, chargeOptions, penaltyOptions, taxGroupOptions);
} else { } else {
savingsProductToReturn = SavingsProductData.template(currency, interestCompoundingPeriodType, interestPostingPeriodType, savingsProductToReturn = SavingsProductData.template(currency, interestCompoundingPeriodType, interestPostingPeriodType,
interestCalculationType, interestCalculationDaysInYearType, accountingRule, currencyOptions, interestCalculationType, interestCalculationDaysInYearType, accountingRule, currencyOptions,
interestCompoundingPeriodTypeOptions, interestPostingPeriodTypeOptions, interestCalculationTypeOptions, interestCompoundingPeriodTypeOptions, interestPostingPeriodTypeOptions, interestCalculationTypeOptions,
interestCalculationDaysInYearTypeOptions, lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, interestCalculationDaysInYearTypeOptions, lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions,
paymentTypeOptions, accountingRuleOptions, accountingMappingOptions, chargeOptions, penaltyOptions, taxGroupOptions, paymentTypeOptions, accountingRuleOptions, accountingMappingOptions, chargeOptions, penaltyOptions, taxGroupOptions);
accountMappingForPayment);
} }
return savingsProductToReturn; return savingsProductToReturn;
@@ -70,8 +70,6 @@ final class SavingsProductsApiResourceSwagger {
@Schema(example = "1") @Schema(example = "1")
public Integer accountingRule; public Integer accountingRule;
public Set<PostSavingsCharges> charges; public Set<PostSavingsCharges> charges;
@Schema(example = "accountMappingForPayment")
public String accountMappingForPayment;
} }
@Schema(description = "PostSavingsProductsResponse") @Schema(description = "PostSavingsProductsResponse")
@@ -727,8 +725,6 @@ final class SavingsProductsApiResourceSwagger {
public Set<GetSavingsProductsTemplateAccountingRule> accountingRuleOptions; public Set<GetSavingsProductsTemplateAccountingRule> accountingRuleOptions;
public GetSavingsProductsAccountingMappingOptions accountingMappingOptions; public GetSavingsProductsAccountingMappingOptions accountingMappingOptions;
public Set<GetSavingsProductsChargeOptions> chargeOptions; public Set<GetSavingsProductsChargeOptions> chargeOptions;
public GetSavingsProductsResponse.GetSavingsCurrency accountMapping;
} }
@Schema(description = "DeleteSavingsProductsProductIdResponse") @Schema(description = "DeleteSavingsProductsProductIdResponse")
@@ -62,7 +62,6 @@ public final class SavingsProductData implements Serializable {
private final boolean withHoldTax; private final boolean withHoldTax;
private final TaxGroupData taxGroup; private final TaxGroupData taxGroup;
private String depositAccountType = null; private String depositAccountType = null;
private final String accountMappingForPayment;
// accounting // accounting
private final EnumOptionData accountingRule; private final EnumOptionData accountingRule;
@@ -103,8 +102,7 @@ public final class SavingsProductData implements Serializable {
final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions, final Collection<EnumOptionData> withdrawalFeeTypeOptions, final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions, final Collection<EnumOptionData> withdrawalFeeTypeOptions,
final Collection<PaymentTypeData> paymentTypeOptions, final Collection<EnumOptionData> accountingRuleOptions, final Collection<PaymentTypeData> paymentTypeOptions, final Collection<EnumOptionData> accountingRuleOptions,
final Map<String, List<GLAccountData>> accountingMappingOptions, final Collection<ChargeData> chargeOptions, final Map<String, List<GLAccountData>> accountingMappingOptions, final Collection<ChargeData> chargeOptions,
final Collection<ChargeData> penaltyOptions, final Collection<TaxGroupData> taxGroupOptions, final Collection<ChargeData> penaltyOptions, final Collection<TaxGroupData> taxGroupOptions) {
final String accountMappingForPayment) {
final Long id = null; final Long id = null;
final String name = null; final String name = null;
@@ -143,7 +141,7 @@ public final class SavingsProductData implements Serializable {
penaltyOptions, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, allowOverdraft, overdraftLimit, penaltyOptions, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, allowOverdraft, overdraftLimit,
minRequiredBalance, enforceMinRequiredBalance, minBalanceForInterestCalculation, nominalAnnualInterestRateOverdraft, minRequiredBalance, enforceMinRequiredBalance, minBalanceForInterestCalculation, nominalAnnualInterestRateOverdraft,
minOverdraftForInterestCalculation, withHoldTax, taxGroup, taxGroupOptions, isDormancyTrackingActive, daysToInactive, minOverdraftForInterestCalculation, withHoldTax, taxGroup, taxGroupOptions, isDormancyTrackingActive, daysToInactive,
daysToDormancy, daysToEscheat, accountMappingForPayment); daysToDormancy, daysToEscheat);
} }
public static SavingsProductData withCharges(final SavingsProductData product, final Collection<ChargeData> charges) { public static SavingsProductData withCharges(final SavingsProductData product, final Collection<ChargeData> charges) {
@@ -160,7 +158,7 @@ public final class SavingsProductData implements Serializable {
product.minRequiredBalance, product.enforceMinRequiredBalance, product.minBalanceForInterestCalculation, product.minRequiredBalance, product.enforceMinRequiredBalance, product.minBalanceForInterestCalculation,
product.nominalAnnualInterestRateOverdraft, product.minOverdraftForInterestCalculation, product.withHoldTax, product.nominalAnnualInterestRateOverdraft, product.minOverdraftForInterestCalculation, product.withHoldTax,
product.taxGroup, product.taxGroupOptions, product.isDormancyTrackingActive, product.daysToInactive, product.daysToDormancy, product.taxGroup, product.taxGroupOptions, product.isDormancyTrackingActive, product.daysToInactive, product.daysToDormancy,
product.daysToEscheat, product.accountMappingForPayment); product.daysToEscheat);
} }
/** /**
@@ -169,7 +167,6 @@ public final class SavingsProductData implements Serializable {
* *
* @param taxGroupOptions * @param taxGroupOptions
* TODO * TODO
* @param accountMapping
*/ */
public static SavingsProductData withTemplate(final SavingsProductData existingProduct, final Collection<CurrencyData> currencyOptions, public static SavingsProductData withTemplate(final SavingsProductData existingProduct, final Collection<CurrencyData> currencyOptions,
final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions, final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions,
@@ -179,7 +176,7 @@ public final class SavingsProductData implements Serializable {
final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions, final Collection<EnumOptionData> withdrawalFeeTypeOptions, final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions, final Collection<EnumOptionData> withdrawalFeeTypeOptions,
final Collection<PaymentTypeData> paymentTypeOptions, final Collection<EnumOptionData> accountingRuleOptions, final Collection<PaymentTypeData> paymentTypeOptions, final Collection<EnumOptionData> accountingRuleOptions,
final Map<String, List<GLAccountData>> accountingMappingOptions, final Collection<ChargeData> chargeOptions, final Map<String, List<GLAccountData>> accountingMappingOptions, final Collection<ChargeData> chargeOptions,
final Collection<ChargeData> penaltyOptions, Collection<TaxGroupData> taxGroupOptions, final String accountMappingForPayment) { final Collection<ChargeData> penaltyOptions, Collection<TaxGroupData> taxGroupOptions) {
return new SavingsProductData(existingProduct.id, existingProduct.name, existingProduct.shortName, existingProduct.description, return new SavingsProductData(existingProduct.id, existingProduct.name, existingProduct.shortName, existingProduct.description,
existingProduct.currency, existingProduct.nominalAnnualInterestRate, existingProduct.interestCompoundingPeriodType, existingProduct.currency, existingProduct.nominalAnnualInterestRate, existingProduct.interestCompoundingPeriodType,
@@ -195,7 +192,7 @@ public final class SavingsProductData implements Serializable {
existingProduct.minBalanceForInterestCalculation, existingProduct.nominalAnnualInterestRateOverdraft, existingProduct.minBalanceForInterestCalculation, existingProduct.nominalAnnualInterestRateOverdraft,
existingProduct.minOverdraftForInterestCalculation, existingProduct.withHoldTax, existingProduct.taxGroup, taxGroupOptions, existingProduct.minOverdraftForInterestCalculation, existingProduct.withHoldTax, existingProduct.taxGroup, taxGroupOptions,
existingProduct.isDormancyTrackingActive, existingProduct.daysToInactive, existingProduct.daysToDormancy, existingProduct.isDormancyTrackingActive, existingProduct.daysToInactive, existingProduct.daysToDormancy,
existingProduct.daysToEscheat, existingProduct.accountMappingForPayment); existingProduct.daysToEscheat);
} }
public static SavingsProductData withAccountingDetails(final SavingsProductData existingProduct, public static SavingsProductData withAccountingDetails(final SavingsProductData existingProduct,
@@ -215,7 +212,6 @@ public final class SavingsProductData implements Serializable {
final Map<String, List<GLAccountData>> accountingMappingOptions = null; final Map<String, List<GLAccountData>> accountingMappingOptions = null;
final Collection<ChargeData> chargeOptions = null; final Collection<ChargeData> chargeOptions = null;
final Collection<ChargeData> penaltyOptions = null; final Collection<ChargeData> penaltyOptions = null;
final String accountMappingForPayment = null;
return new SavingsProductData(existingProduct.id, existingProduct.name, existingProduct.shortName, existingProduct.description, return new SavingsProductData(existingProduct.id, existingProduct.name, existingProduct.shortName, existingProduct.description,
existingProduct.currency, existingProduct.nominalAnnualInterestRate, existingProduct.interestCompoundingPeriodType, existingProduct.currency, existingProduct.nominalAnnualInterestRate, existingProduct.interestCompoundingPeriodType,
@@ -231,7 +227,7 @@ public final class SavingsProductData implements Serializable {
existingProduct.minBalanceForInterestCalculation, existingProduct.nominalAnnualInterestRateOverdraft, existingProduct.minBalanceForInterestCalculation, existingProduct.nominalAnnualInterestRateOverdraft,
existingProduct.minOverdraftForInterestCalculation, existingProduct.withHoldTax, existingProduct.taxGroup, existingProduct.minOverdraftForInterestCalculation, existingProduct.withHoldTax, existingProduct.taxGroup,
existingProduct.taxGroupOptions, existingProduct.isDormancyTrackingActive, existingProduct.daysToInactive, existingProduct.taxGroupOptions, existingProduct.isDormancyTrackingActive, existingProduct.daysToInactive,
existingProduct.daysToDormancy, existingProduct.daysToEscheat, existingProduct.accountMappingForPayment); existingProduct.daysToDormancy, existingProduct.daysToEscheat);
} }
public static SavingsProductData instance(final Long id, final String name, final String shortName, final String description, public static SavingsProductData instance(final Long id, final String name, final String shortName, final String description,
@@ -264,7 +260,6 @@ public final class SavingsProductData implements Serializable {
final Collection<ChargeToGLAccountMapper> feeToIncomeAccountMappings = null; final Collection<ChargeToGLAccountMapper> feeToIncomeAccountMappings = null;
final Collection<ChargeToGLAccountMapper> penaltyToIncomeAccountMappings = null; final Collection<ChargeToGLAccountMapper> penaltyToIncomeAccountMappings = null;
final Collection<TaxGroupData> taxGroupOptions = null; final Collection<TaxGroupData> taxGroupOptions = null;
final String accountMappingForPayment = null;
return new SavingsProductData(id, name, shortName, description, currency, nominalAnnualInterestRate, interestCompoundingPeriodType, return new SavingsProductData(id, name, shortName, description, currency, nominalAnnualInterestRate, interestCompoundingPeriodType,
interestPostingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minRequiredOpeningBalance, interestPostingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minRequiredOpeningBalance,
@@ -275,7 +270,7 @@ public final class SavingsProductData implements Serializable {
penaltyOptions, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, allowOverdraft, overdraftLimit, penaltyOptions, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, allowOverdraft, overdraftLimit,
minRequiredBalance, enforceMinRequiredBalance, minBalanceForInterestCalculation, nominalAnnualInterestRateOverdraft, minRequiredBalance, enforceMinRequiredBalance, minBalanceForInterestCalculation, nominalAnnualInterestRateOverdraft,
minOverdraftForInterestCalculation, withHoldTax, taxGroup, taxGroupOptions, isDormancyTrackingActive, daysToInactive, minOverdraftForInterestCalculation, withHoldTax, taxGroup, taxGroupOptions, isDormancyTrackingActive, daysToInactive,
daysToDormancy, daysToEscheat, accountMappingForPayment); daysToDormancy, daysToEscheat);
} }
public static SavingsProductData lookup(final Long id, final String name) { public static SavingsProductData lookup(final Long id, final String name) {
@@ -325,7 +320,6 @@ public final class SavingsProductData implements Serializable {
final Long daysToInactive = null; final Long daysToInactive = null;
final Long daysToDormancy = null; final Long daysToDormancy = null;
final Long daysToEscheat = null; final Long daysToEscheat = null;
final String accountMappingForPayment = null;
return new SavingsProductData(id, name, shortName, description, currency, nominalAnnualInterestRate, interestCompoundingPeriodType, return new SavingsProductData(id, name, shortName, description, currency, nominalAnnualInterestRate, interestCompoundingPeriodType,
interestPostingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minRequiredOpeningBalance, interestPostingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minRequiredOpeningBalance,
@@ -336,7 +330,7 @@ public final class SavingsProductData implements Serializable {
penaltyOptions, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, allowOverdraft, overdraftLimit, penaltyOptions, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, allowOverdraft, overdraftLimit,
minRequiredBalance, enforceMinRequiredBalance, minBalanceForInterestCalculation, nominalAnnualInterestRateOverdraft, minRequiredBalance, enforceMinRequiredBalance, minBalanceForInterestCalculation, nominalAnnualInterestRateOverdraft,
minOverdraftForInterestCalculation, withHoldTax, taxGroup, taxGroupOptions, isDormancyTrackingActive, daysToInactive, minOverdraftForInterestCalculation, withHoldTax, taxGroup, taxGroupOptions, isDormancyTrackingActive, daysToInactive,
daysToDormancy, daysToEscheat, accountMappingForPayment); daysToDormancy, daysToEscheat);
} }
private SavingsProductData(final Long id, final String name, final String shortName, final String description, private SavingsProductData(final Long id, final String name, final String shortName, final String description,
@@ -360,7 +354,7 @@ public final class SavingsProductData implements Serializable {
final BigDecimal minBalanceForInterestCalculation, final BigDecimal nominalAnnualInterestRateOverdraft, final BigDecimal minBalanceForInterestCalculation, final BigDecimal nominalAnnualInterestRateOverdraft,
final BigDecimal minOverdraftForInterestCalculation, final boolean withHoldTax, final TaxGroupData taxGroup, final BigDecimal minOverdraftForInterestCalculation, final boolean withHoldTax, final TaxGroupData taxGroup,
final Collection<TaxGroupData> taxGroupOptions, final Boolean isDormancyTrackingActive, final Long daysToInactive, final Collection<TaxGroupData> taxGroupOptions, final Boolean isDormancyTrackingActive, final Long daysToInactive,
final Long daysToDormancy, final Long daysToEscheat, final String accountMappingForPayment) { final Long daysToDormancy, final Long daysToEscheat) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.shortName = shortName; this.shortName = shortName;
@@ -417,7 +411,6 @@ public final class SavingsProductData implements Serializable {
this.daysToInactive = daysToInactive; this.daysToInactive = daysToInactive;
this.daysToDormancy = daysToDormancy; this.daysToDormancy = daysToDormancy;
this.daysToEscheat = daysToEscheat; this.daysToEscheat = daysToEscheat;
this.accountMappingForPayment = accountMappingForPayment;
} }
public boolean hasAccountingEnabled() { public boolean hasAccountingEnabled() {
@@ -1,25 +0,0 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.'=.
--
ALTER TABLE `c_configuration`
ADD COLUMN `string_value` VARCHAR(100) NULL DEFAULT NULL AFTER `date_value`;
insert into c_configuration(name, string_value, enabled, description) values('account-mapping-for-payment-type', 'Asset', '1', 'Asset: default for asset, Use comma seperated values for Liability, Asset and Expense accounts');
insert into c_configuration(name, string_value, enabled, description) values('account-mapping-for-charge', 'Income', '1', 'Income: default for Income, Use comma seperated values for Income, Liability and Expense accounts');