Merge branch 'FINERACT-470' into develop
This commit is contained in:
+11
-4
@@ -48,6 +48,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Path("/provisioningentries")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@@ -59,7 +63,10 @@ public class ProvisioningEntriesApiResource {
|
||||
private final DefaultToApiJsonSerializer<Object> entriesApiJsonSerializer;
|
||||
private final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
|
||||
private static final Set<String> PROVISIONING_ENTRY_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM, ProvisioningEntriesApiConstants.ENTRIES_PARAM));
|
||||
private static final Set<String> ALL_PROVISIONING_ENTRIES = new HashSet<>(Arrays.asList
|
||||
(ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM));
|
||||
@Autowired
|
||||
public ProvisioningEntriesApiResource(final PlatformSecurityContext platformSecurityContext,
|
||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
||||
@@ -115,7 +122,7 @@ public class ProvisioningEntriesApiResource {
|
||||
platformSecurityContext.authenticatedUser();
|
||||
ProvisioningEntryData data = this.provisioningEntriesReadPlatformService.retrieveProvisioningEntryData(entryId);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, data, ProvisioningEntriesApiConstants.PROVISIONING_ENTRY_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, data, PROVISIONING_ENTRY_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -129,7 +136,7 @@ public class ProvisioningEntriesApiResource {
|
||||
SearchParameters params = SearchParameters.forProvisioningEntries(entryId, officeId, productId, categoryId, offset, limit);
|
||||
Page<LoanProductProvisioningEntryData> entries = this.provisioningEntriesReadPlatformService.retrieveProvisioningEntries(params);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.entriesApiJsonSerializer.serialize(settings, entries, ProvisioningEntriesApiConstants.PROVISIONING_ENTRY_PARAMETERS);
|
||||
return this.entriesApiJsonSerializer.serialize(settings, entries, PROVISIONING_ENTRY_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -140,6 +147,6 @@ public class ProvisioningEntriesApiResource {
|
||||
platformSecurityContext.authenticatedUser();
|
||||
Page<ProvisioningEntryData> data = this.provisioningEntriesReadPlatformService.retrieveAllProvisioningEntries(offset, limit);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.entriesApiJsonSerializer.serialize(settings, data, ProvisioningEntriesApiConstants.ALL_PROVISIONING_ENTRIES);
|
||||
return this.entriesApiJsonSerializer.serialize(settings, data, ALL_PROVISIONING_ENTRIES);
|
||||
}
|
||||
}
|
||||
|
||||
-7
@@ -35,12 +35,5 @@ public interface ProvisioningEntriesApiConstants {
|
||||
public final static String PROVISIONINGENTRY_PARAM = "provisioningentry";
|
||||
|
||||
public final static String ENTRIES_PARAM = "entries";
|
||||
|
||||
Set<String> supportedParameters = new HashSet<>(
|
||||
Arrays.asList(JSON_DATE_PARAM, JSON_DATEFORMAT_PARAM, JSON_LOCALE_PARAM, JSON_CREATEJOURNALENTRIES_PARAM));
|
||||
|
||||
Set<String> PROVISIONING_ENTRY_PARAMETERS = new HashSet<>(Arrays.asList(PROVISIONINGENTRY_PARAM, ENTRIES_PARAM));
|
||||
|
||||
Set<String> ALL_PROVISIONING_ENTRIES = new HashSet<>(Arrays.asList(PROVISIONINGENTRY_PARAM));
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -20,9 +20,12 @@ package org.apache.fineract.accounting.provisioning.serialization;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.accounting.provisioning.constant.ProvisioningEntriesApiConstants;
|
||||
@@ -43,6 +46,9 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class ProvisioningEntriesDefinitionJsonDeserializer implements ProvisioningEntriesApiConstants {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> supportedParameters = new HashSet<>(
|
||||
Arrays.asList(JSON_DATE_PARAM, JSON_DATEFORMAT_PARAM, JSON_LOCALE_PARAM, JSON_CREATEJOURNALENTRIES_PARAM));
|
||||
|
||||
|
||||
@Autowired
|
||||
public ProvisioningEntriesDefinitionJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
|
||||
|
||||
+3
-7
@@ -42,11 +42,7 @@ public class HolidayApiConstants {
|
||||
public static final String processed = "processed";
|
||||
public static final String status = "status";
|
||||
|
||||
public static final Set<String> HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, nameParamName, fromDateParamName, toDateParamName, descriptionParamName, officesParamName,
|
||||
repaymentsRescheduledToParamName));
|
||||
|
||||
public static final Set<String> HOLIDAY_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName,
|
||||
fromDateParamName, descriptionParamName, toDateParamName, repaymentsRescheduledToParamName, localeParamName,
|
||||
dateFormatParamName, status));
|
||||
protected static final Set<String> HOLIDAY_RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(idParamName, nameParamName, fromDateParamName, descriptionParamName, toDateParamName,
|
||||
repaymentsRescheduledToParamName, localeParamName, dateFormatParamName, status));
|
||||
}
|
||||
|
||||
+10
-4
@@ -20,6 +20,7 @@ package org.apache.fineract.organisation.holiday.data;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -45,6 +46,11 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class HolidayDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(HolidayApiConstants.localeParamName, HolidayApiConstants.dateFormatParamName,
|
||||
HolidayApiConstants.nameParamName, HolidayApiConstants.fromDateParamName,
|
||||
HolidayApiConstants.toDateParamName, HolidayApiConstants.descriptionParamName,
|
||||
HolidayApiConstants.officesParamName, HolidayApiConstants.repaymentsRescheduledToParamName));
|
||||
|
||||
@Autowired
|
||||
public HolidayDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
@@ -56,8 +62,8 @@ public class HolidayDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
HolidayApiConstants.HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
@@ -104,8 +110,8 @@ public class HolidayDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
HolidayApiConstants.HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
+19
-3
@@ -18,7 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.organisation.provisioning.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
@@ -57,6 +60,19 @@ public class ProvisioningCriteriaApiResource {
|
||||
private final ProvisioningCriteriaReadPlatformService provisioningCriteriaReadPlatformService;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final DefaultToApiJsonSerializer<ProvisioningCriteriaData> toApiJsonSerializer;
|
||||
|
||||
private static final Set<String> PROVISIONING_CRITERIA_TEMPLATE_PARAMETER = new HashSet<>(
|
||||
Arrays.asList(ProvisioningCriteriaConstants.DEFINITIONS_PARAM,
|
||||
ProvisioningCriteriaConstants.LOANPRODUCTS_PARAM, ProvisioningCriteriaConstants.GLACCOUNTS_PARAM));
|
||||
|
||||
private static final Set<String> PROVISIONING_CRITERIA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(ProvisioningCriteriaConstants.CRITERIA_PARAM,
|
||||
ProvisioningCriteriaConstants.LOANPRODUCTS_PARAM, ProvisioningCriteriaConstants.DEFINITIONS_PARAM));
|
||||
|
||||
private static final Set<String> ALL_PROVISIONING_CRITERIA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(ProvisioningCriteriaConstants.CRITERIA_ID_PARAM,
|
||||
ProvisioningCriteriaConstants.CRITERIA_NAME_PARAM, ProvisioningCriteriaConstants.CREATED_BY_PARAM));
|
||||
|
||||
@Autowired
|
||||
public ProvisioningCriteriaApiResource(final PlatformSecurityContext platformSecurityContext,
|
||||
final ApiRequestParameterHelper apiRequestParameterHelper,
|
||||
@@ -78,7 +94,7 @@ public class ProvisioningCriteriaApiResource {
|
||||
this.platformSecurityContext.authenticatedUser();
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
ProvisioningCriteriaData data = this.provisioningCriteriaReadPlatformService.retrievePrivisiongCriteriaTemplate();
|
||||
return this.toApiJsonSerializer.serialize(settings, data, ProvisioningCriteriaConstants.PROVISIONING_CRITERIA_TEMPLATE_PARAMETER);
|
||||
return this.toApiJsonSerializer.serialize(settings, data, PROVISIONING_CRITERIA_TEMPLATE_PARAMETER);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -92,7 +108,7 @@ public class ProvisioningCriteriaApiResource {
|
||||
if(settings.isTemplate()) {
|
||||
criteria = this.provisioningCriteriaReadPlatformService.retrievePrivisiongCriteriaTemplate(criteria);
|
||||
}
|
||||
return this.toApiJsonSerializer.serialize(settings, criteria, ProvisioningCriteriaConstants.PROVISIONING_CRITERIA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, criteria, PROVISIONING_CRITERIA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -102,7 +118,7 @@ public class ProvisioningCriteriaApiResource {
|
||||
platformSecurityContext.authenticatedUser() ;
|
||||
Collection<ProvisioningCriteriaData> data = this.provisioningCriteriaReadPlatformService.retrieveAllProvisioningCriterias() ;
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, data, ProvisioningCriteriaConstants.ALL_PROVISIONING_CRITERIA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, data, ALL_PROVISIONING_CRITERIA_PARAMETERS);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
||||
+22
-53
@@ -23,57 +23,26 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ProvisioningCriteriaConstants {
|
||||
|
||||
public final static String JSON_LOCALE_PARAM = "locale" ;
|
||||
|
||||
public final static String JSON_CRITERIAID_PARAM = "criteriaId" ;
|
||||
|
||||
public final static String JSON_CRITERIANAME_PARAM = "criteriaName";
|
||||
|
||||
public final static String JSON_LOANPRODUCTS_PARAM = "loanProducts";
|
||||
|
||||
public final static String JSON_LOAN_PRODUCT_ID_PARAM = "id" ;
|
||||
|
||||
public final static String JSON_LOAN_PRODUCTNAME_PARAM = "name" ;
|
||||
|
||||
public final static String JSON_LOAN_PRODUCT_BORROWERCYCLE_PARAM = "includeInBorrowerCycle" ;
|
||||
|
||||
public final static String JSON_PROVISIONING_DEFINITIONS_PARAM = "definitions";
|
||||
|
||||
public final static String JSON_CATEOGRYID_PARAM = "categoryId";
|
||||
|
||||
public final static String JSON_CATEOGRYNAME_PARAM = "categoryName";
|
||||
|
||||
public final static String JSON_MINIMUM_AGE_PARAM = "minAge";
|
||||
|
||||
public final static String JSON_MAXIMUM_AGE_PARAM = "maxAge";
|
||||
|
||||
public final static String JSON_PROVISIONING_PERCENTAGE_PARAM = "provisioningPercentage";
|
||||
|
||||
public final static String JSON_LIABILITY_ACCOUNT_PARAM = "liabilityAccount";
|
||||
|
||||
public final static String JSON_EXPENSE_ACCOUNT_PARAM = "expenseAccount";
|
||||
|
||||
Set<String> supportedParametersForCreate = new HashSet<>(Arrays.asList(JSON_LOCALE_PARAM, JSON_CRITERIANAME_PARAM,
|
||||
JSON_LOANPRODUCTS_PARAM, JSON_PROVISIONING_DEFINITIONS_PARAM));
|
||||
|
||||
Set<String> supportedParametersForUpdate = new HashSet<>(Arrays.asList(JSON_CRITERIAID_PARAM, JSON_LOCALE_PARAM, JSON_CRITERIANAME_PARAM,
|
||||
JSON_LOANPRODUCTS_PARAM, JSON_PROVISIONING_DEFINITIONS_PARAM));
|
||||
|
||||
Set<String> loanProductSupportedParams = new HashSet<>(Arrays.asList(JSON_LOAN_PRODUCT_ID_PARAM,
|
||||
JSON_LOAN_PRODUCTNAME_PARAM, JSON_LOAN_PRODUCT_BORROWERCYCLE_PARAM)) ;
|
||||
|
||||
Set<String> provisioningcriteriaSupportedParams = new HashSet<>(Arrays.asList(JSON_CATEOGRYID_PARAM,
|
||||
JSON_CATEOGRYNAME_PARAM, JSON_MINIMUM_AGE_PARAM, JSON_MAXIMUM_AGE_PARAM, JSON_MINIMUM_AGE_PARAM, JSON_PROVISIONING_PERCENTAGE_PARAM, JSON_EXPENSE_ACCOUNT_PARAM, JSON_LIABILITY_ACCOUNT_PARAM)) ;
|
||||
|
||||
|
||||
Set<String> PROVISIONING_CRITERIA_TEMPLATE_PARAMETER = new HashSet<>(Arrays.asList("definitions", "loanProducts",
|
||||
"glAccounts"));
|
||||
|
||||
Set<String> PROVISIONING_CRITERIA_PARAMETERS = new HashSet<>(Arrays.asList("criteriaName", "loanProducts",
|
||||
"definitions"));
|
||||
|
||||
Set<String> ALL_PROVISIONING_CRITERIA_PARAMETERS = new HashSet<>(Arrays.asList("criteriaId", "criterianame",
|
||||
"createdby"));
|
||||
|
||||
public final static String JSON_LOCALE_PARAM = "locale";
|
||||
public final static String JSON_CRITERIAID_PARAM = "criteriaId";
|
||||
public final static String JSON_CRITERIANAME_PARAM = "criteriaName";
|
||||
public final static String JSON_LOANPRODUCTS_PARAM = "loanProducts";
|
||||
public final static String JSON_LOAN_PRODUCT_ID_PARAM = "id";
|
||||
public final static String JSON_LOAN_PRODUCTNAME_PARAM = "name";
|
||||
public final static String JSON_LOAN_PRODUCT_BORROWERCYCLE_PARAM = "includeInBorrowerCycle";
|
||||
public final static String JSON_PROVISIONING_DEFINITIONS_PARAM = "definitions";
|
||||
public final static String JSON_CATEOGRYID_PARAM = "categoryId";
|
||||
public final static String JSON_CATEOGRYNAME_PARAM = "categoryName";
|
||||
public final static String JSON_MINIMUM_AGE_PARAM = "minAge";
|
||||
public final static String JSON_MAXIMUM_AGE_PARAM = "maxAge";
|
||||
public final static String JSON_PROVISIONING_PERCENTAGE_PARAM = "provisioningPercentage";
|
||||
public final static String JSON_LIABILITY_ACCOUNT_PARAM = "liabilityAccount";
|
||||
public final static String JSON_EXPENSE_ACCOUNT_PARAM = "expenseAccount";
|
||||
public final static String DEFINITIONS_PARAM = "definitions";
|
||||
public final static String LOANPRODUCTS_PARAM = "loanProducts";
|
||||
public final static String GLACCOUNTS_PARAM = "glAccounts";
|
||||
public final static String CRITERIA_PARAM = "criteriaName";
|
||||
public final static String CRITERIA_ID_PARAM = "criteriaId";
|
||||
public final static String CRITERIA_NAME_PARAM = "criterianame";
|
||||
public final static String CREATED_BY_PARAM = "createdby";
|
||||
}
|
||||
|
||||
+19
-2
@@ -21,9 +21,12 @@ package org.apache.fineract.organisation.provisioning.serialization;
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -41,9 +44,23 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
@Component
|
||||
public class ProvisioningCriteriaDefinitionJsonDeserializer implements ProvisioningCriteriaConstants{
|
||||
public class ProvisioningCriteriaDefinitionJsonDeserializer implements ProvisioningCriteriaConstants {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
private final static Set<String> supportedParametersForCreate = new HashSet<>(Arrays.asList(JSON_LOCALE_PARAM,
|
||||
JSON_CRITERIANAME_PARAM, JSON_LOANPRODUCTS_PARAM, JSON_PROVISIONING_DEFINITIONS_PARAM));
|
||||
|
||||
private final static Set<String> supportedParametersForUpdate = new HashSet<>(Arrays.asList(JSON_CRITERIAID_PARAM,
|
||||
JSON_LOCALE_PARAM, JSON_CRITERIANAME_PARAM, JSON_LOANPRODUCTS_PARAM, JSON_PROVISIONING_DEFINITIONS_PARAM));
|
||||
|
||||
private final static Set<String> loanProductSupportedParams = new HashSet<>(Arrays
|
||||
.asList(JSON_LOAN_PRODUCT_ID_PARAM, JSON_LOAN_PRODUCTNAME_PARAM, JSON_LOAN_PRODUCT_BORROWERCYCLE_PARAM));
|
||||
|
||||
private final static Set<String> provisioningcriteriaSupportedParams = new HashSet<>(
|
||||
Arrays.asList(JSON_CATEOGRYID_PARAM, JSON_CATEOGRYNAME_PARAM, JSON_MINIMUM_AGE_PARAM,
|
||||
JSON_MAXIMUM_AGE_PARAM, JSON_MINIMUM_AGE_PARAM, JSON_PROVISIONING_PERCENTAGE_PARAM,
|
||||
JSON_EXPENSE_ACCOUNT_PARAM, JSON_LIABILITY_ACCOUNT_PARAM));
|
||||
|
||||
@Autowired
|
||||
public ProvisioningCriteriaDefinitionJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
|
||||
|
||||
+4
-4
@@ -25,10 +25,10 @@ public class CashierTxnType {
|
||||
private Integer id;
|
||||
private String value;
|
||||
|
||||
public static CashierTxnType ALLOCATE = new CashierTxnType (101, "Allocate Cash");
|
||||
public static CashierTxnType SETTLE = new CashierTxnType (102, "Settle Cash");
|
||||
public static CashierTxnType INWARD_CASH_TXN = new CashierTxnType (103, "Cash In");
|
||||
public static CashierTxnType OUTWARD_CASH_TXN = new CashierTxnType (104, "Cash Out");
|
||||
public static final CashierTxnType ALLOCATE = new CashierTxnType (101, "Allocate Cash");
|
||||
public static final CashierTxnType SETTLE = new CashierTxnType (102, "Settle Cash");
|
||||
public static final CashierTxnType INWARD_CASH_TXN = new CashierTxnType (103, "Cash In");
|
||||
public static final CashierTxnType OUTWARD_CASH_TXN = new CashierTxnType (104, "Cash Out");
|
||||
|
||||
private CashierTxnType () {
|
||||
}
|
||||
|
||||
+3
-6
@@ -38,13 +38,10 @@ public class WorkingDaysApiConstants {
|
||||
public static final String extendTermForDailyRepayments = "extendTermForDailyRepayments";
|
||||
public static final String extendTermForRepaymentsOnHolidays = "extendTermForRepaymentsOnHolidays";
|
||||
|
||||
|
||||
public static final Set<String> WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS =new HashSet<>(Arrays.asList(
|
||||
recurrence,repayment_rescheduling_enum,localeParamName,extendTermForDailyRepayments,extendTermForRepaymentsOnHolidays
|
||||
));
|
||||
public static final Set<String> WORKING_DAYS_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
protected static final Set<String> WORKING_DAYS_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
recurrence,repayment_rescheduling_enum,extendTermForDailyRepayments,extendTermForRepaymentsOnHolidays
|
||||
));
|
||||
|
||||
public static final Set<String> WORKING_DAYS_TEMPLATE_PARAMETERS = new HashSet<>(Arrays.asList(rescheduleRepaymentTemplate));
|
||||
protected static final Set<String> WORKING_DAYS_TEMPLATE_PARAMETERS = new HashSet<>(Arrays.asList
|
||||
(rescheduleRepaymentTemplate));
|
||||
}
|
||||
|
||||
+9
-2
@@ -20,8 +20,11 @@ package org.apache.fineract.organisation.workingdays.data;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -40,6 +43,10 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class WorkingDayValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(WorkingDaysApiConstants.recurrence, WorkingDaysApiConstants.repayment_rescheduling_enum,
|
||||
WorkingDaysApiConstants.localeParamName, WorkingDaysApiConstants.extendTermForDailyRepayments,
|
||||
WorkingDaysApiConstants.extendTermForRepaymentsOnHolidays));
|
||||
|
||||
@Autowired
|
||||
public WorkingDayValidator(FromJsonHelper fromApiJsonHelper) {
|
||||
@@ -50,8 +57,8 @@ public class WorkingDayValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
WorkingDaysApiConstants.WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
+3
-9
@@ -33,19 +33,13 @@ public class AccountTransfersApiConstants {
|
||||
public static final String transferDateParamName = "transferDate";
|
||||
public static final String transferAmountParamName = "transferAmount";
|
||||
public static final String transferDescriptionParamName = "transferDescription";
|
||||
|
||||
public static final Set<String> REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants.localeParamName,
|
||||
AccountDetailConstants.dateFormatParamName, AccountDetailConstants.fromOfficeIdParamName,
|
||||
AccountDetailConstants.fromClientIdParamName, AccountDetailConstants.fromAccountTypeParamName,
|
||||
AccountDetailConstants.fromAccountIdParamName, AccountDetailConstants.toOfficeIdParamName,
|
||||
AccountDetailConstants.toClientIdParamName, AccountDetailConstants.toAccountTypeParamName,
|
||||
AccountDetailConstants.toAccountIdParamName, transferDateParamName, transferAmountParamName, transferDescriptionParamName));
|
||||
public static final String currencyParamName = "currency";
|
||||
|
||||
/**
|
||||
* These parameters will match the class level parameters of
|
||||
* {@link AccountTransferData}. Where possible, we try to get response
|
||||
* parameters to match those of request parameters.
|
||||
*/
|
||||
public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants.idParamName,
|
||||
transferDescriptionParamName, "currency"));
|
||||
protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(AccountDetailConstants.idParamName, transferDescriptionParamName, currencyParamName));
|
||||
}
|
||||
+2
-16
@@ -41,22 +41,8 @@ public class StandingInstructionApiConstants {
|
||||
public static final String recurrenceOnMonthDayParamName = "recurrenceOnMonthDay";
|
||||
public static final String monthDayFormatParamName = "monthDayFormat";
|
||||
|
||||
public static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName,
|
||||
AccountDetailConstants.fromOfficeIdParamName, AccountDetailConstants.fromClientIdParamName,
|
||||
AccountDetailConstants.fromAccountTypeParamName, AccountDetailConstants.fromAccountIdParamName,
|
||||
AccountDetailConstants.toOfficeIdParamName, AccountDetailConstants.toClientIdParamName,
|
||||
AccountDetailConstants.toAccountTypeParamName, AccountDetailConstants.toAccountIdParamName,
|
||||
AccountDetailConstants.transferTypeParamName, priorityParamName, instructionTypeParamName, statusParamName, amountParamName,
|
||||
validFromParamName, validTillParamName, recurrenceTypeParamName, recurrenceFrequencyParamName, recurrenceIntervalParamName,
|
||||
recurrenceOnMonthDayParamName, nameParamName, monthDayFormatParamName));
|
||||
|
||||
public static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName, priorityParamName,
|
||||
instructionTypeParamName, statusParamName, amountParamName, validFromParamName, validTillParamName, recurrenceTypeParamName,
|
||||
recurrenceFrequencyParamName, recurrenceIntervalParamName, recurrenceOnMonthDayParamName, monthDayFormatParamName));
|
||||
|
||||
public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants.idParamName,
|
||||
protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants
|
||||
.idParamName,
|
||||
nameParamName, priorityParamName, instructionTypeParamName, statusParamName, AccountDetailConstants.transferTypeParamName,
|
||||
validFromParamName, validTillParamName));
|
||||
|
||||
|
||||
+27
-13
@@ -18,17 +18,14 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.account.data;
|
||||
|
||||
import static org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants.REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants.transferAmountParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants.transferDateParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants.transferDescriptionParamName;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -37,6 +34,8 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.account.AccountDetailConstants;
|
||||
import org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -49,6 +48,15 @@ public class AccountTransfersDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private final AccountTransfersDetailDataValidator accountTransfersDetailDataValidator;
|
||||
private static final Set<String> REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName,
|
||||
AccountDetailConstants.fromOfficeIdParamName, AccountDetailConstants.fromClientIdParamName,
|
||||
AccountDetailConstants.fromAccountTypeParamName, AccountDetailConstants.fromAccountIdParamName,
|
||||
AccountDetailConstants.toOfficeIdParamName, AccountDetailConstants.toClientIdParamName,
|
||||
AccountDetailConstants.toAccountTypeParamName, AccountDetailConstants.toAccountIdParamName,
|
||||
AccountTransfersApiConstants.transferDateParamName, AccountTransfersApiConstants.transferAmountParamName,
|
||||
AccountTransfersApiConstants.transferDescriptionParamName));
|
||||
|
||||
|
||||
@Autowired
|
||||
public AccountTransfersDataValidator(final FromJsonHelper fromApiJsonHelper,
|
||||
@@ -68,20 +76,26 @@ public class AccountTransfersDataValidator {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ACCOUNT_TRANSFER_RESOURCE_NAME);
|
||||
.resource(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = command.parsedJson();
|
||||
|
||||
this.accountTransfersDetailDataValidator.validate(command, baseDataValidator);
|
||||
|
||||
final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(transferDateParamName, element);
|
||||
baseDataValidator.reset().parameter(transferDateParamName).value(transactionDate).notNull();
|
||||
final LocalDate transactionDate = this.fromApiJsonHelper
|
||||
.extractLocalDateNamed(AccountTransfersApiConstants.transferDateParamName, element);
|
||||
baseDataValidator.reset().parameter(AccountTransfersApiConstants.transferDateParamName).value
|
||||
(transactionDate).notNull();
|
||||
|
||||
final BigDecimal transactionAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(transferAmountParamName, element);
|
||||
baseDataValidator.reset().parameter(transferAmountParamName).value(transactionAmount).notNull().positiveAmount();
|
||||
final BigDecimal transactionAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed
|
||||
(AccountTransfersApiConstants.transferAmountParamName, element);
|
||||
baseDataValidator.reset().parameter(AccountTransfersApiConstants.transferAmountParamName).value
|
||||
(transactionAmount).notNull().positiveAmount();
|
||||
|
||||
final String transactionDescription = this.fromApiJsonHelper.extractStringNamed(transferDescriptionParamName, element);
|
||||
baseDataValidator.reset().parameter(transferDescriptionParamName).value(transactionDescription).notBlank()
|
||||
final String transactionDescription = this.fromApiJsonHelper.extractStringNamed(AccountTransfersApiConstants
|
||||
.transferDescriptionParamName, element);
|
||||
baseDataValidator.reset().parameter(AccountTransfersApiConstants.transferDescriptionParamName).value
|
||||
(transactionDescription).notBlank()
|
||||
.notExceedingLengthOf(200);
|
||||
|
||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||
|
||||
+128
-83
@@ -21,27 +21,16 @@ package org.apache.fineract.portfolio.account.data;
|
||||
import static org.apache.fineract.portfolio.account.AccountDetailConstants.fromAccountTypeParamName;
|
||||
import static org.apache.fineract.portfolio.account.AccountDetailConstants.toAccountTypeParamName;
|
||||
import static org.apache.fineract.portfolio.account.AccountDetailConstants.transferTypeParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.CREATE_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.UPDATE_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.amountParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.instructionTypeParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.nameParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.priorityParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.recurrenceFrequencyParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.recurrenceIntervalParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.recurrenceOnMonthDayParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.recurrenceTypeParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.statusParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.validFromParamName;
|
||||
import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.validTillParamName;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -50,7 +39,9 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.account.AccountDetailConstants;
|
||||
import org.apache.fineract.portfolio.account.PortfolioAccountType;
|
||||
import org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants;
|
||||
import org.apache.fineract.portfolio.account.domain.AccountTransferRecurrenceType;
|
||||
import org.apache.fineract.portfolio.account.domain.AccountTransferType;
|
||||
import org.apache.fineract.portfolio.account.domain.StandingInstructionType;
|
||||
@@ -64,10 +55,36 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
@Component
|
||||
public class StandingInstructionDataValidator {
|
||||
public class StandingInstructionDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private final AccountTransfersDetailDataValidator accountTransfersDetailDataValidator;
|
||||
private static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName,
|
||||
AccountDetailConstants.fromOfficeIdParamName, AccountDetailConstants.fromClientIdParamName,
|
||||
AccountDetailConstants.fromAccountTypeParamName, AccountDetailConstants.fromAccountIdParamName,
|
||||
AccountDetailConstants.toOfficeIdParamName, AccountDetailConstants.toClientIdParamName,
|
||||
AccountDetailConstants.toAccountTypeParamName, AccountDetailConstants.toAccountIdParamName,
|
||||
AccountDetailConstants.transferTypeParamName, StandingInstructionApiConstants.priorityParamName,
|
||||
StandingInstructionApiConstants.instructionTypeParamName, StandingInstructionApiConstants.statusParamName,
|
||||
StandingInstructionApiConstants.amountParamName, StandingInstructionApiConstants.validFromParamName,
|
||||
StandingInstructionApiConstants.validTillParamName, StandingInstructionApiConstants.recurrenceTypeParamName,
|
||||
StandingInstructionApiConstants.recurrenceFrequencyParamName,
|
||||
StandingInstructionApiConstants.recurrenceIntervalParamName,
|
||||
StandingInstructionApiConstants.recurrenceOnMonthDayParamName,
|
||||
StandingInstructionApiConstants.nameParamName, StandingInstructionApiConstants.monthDayFormatParamName));
|
||||
|
||||
private static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName,
|
||||
StandingInstructionApiConstants.priorityParamName, StandingInstructionApiConstants.instructionTypeParamName,
|
||||
StandingInstructionApiConstants.statusParamName, StandingInstructionApiConstants.amountParamName,
|
||||
StandingInstructionApiConstants.validFromParamName, StandingInstructionApiConstants.validTillParamName,
|
||||
StandingInstructionApiConstants.recurrenceTypeParamName,
|
||||
StandingInstructionApiConstants.recurrenceFrequencyParamName,
|
||||
StandingInstructionApiConstants.recurrenceIntervalParamName,
|
||||
StandingInstructionApiConstants.recurrenceOnMonthDayParamName,
|
||||
StandingInstructionApiConstants.monthDayFormatParamName));
|
||||
|
||||
|
||||
@Autowired
|
||||
public StandingInstructionDataValidator(final FromJsonHelper fromApiJsonHelper,
|
||||
@@ -86,71 +103,82 @@ public class StandingInstructionDataValidator {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(STANDING_INSTRUCTION_RESOURCE_NAME);
|
||||
.resource(StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME);
|
||||
this.accountTransfersDetailDataValidator.validate(command, baseDataValidator);
|
||||
|
||||
final JsonElement element = command.parsedJson();
|
||||
|
||||
final Integer status = this.fromApiJsonHelper.extractIntegerNamed(statusParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(statusParamName).value(status).notNull().inMinMaxRange(1, 2);
|
||||
final Integer status = this.fromApiJsonHelper
|
||||
.extractIntegerNamed(StandingInstructionApiConstants.statusParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.statusParamName).value(status).notNull()
|
||||
.inMinMaxRange(1, 2);
|
||||
|
||||
final LocalDate validFrom = this.fromApiJsonHelper.extractLocalDateNamed(validFromParamName, element);
|
||||
baseDataValidator.reset().parameter(validFromParamName).value(validFrom).notNull();
|
||||
final LocalDate validFrom = this.fromApiJsonHelper
|
||||
.extractLocalDateNamed(StandingInstructionApiConstants.validFromParamName, element);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.validFromParamName).value(validFrom)
|
||||
.notNull();
|
||||
|
||||
final LocalDate validTill = this.fromApiJsonHelper.extractLocalDateNamed(validTillParamName, element);
|
||||
baseDataValidator.reset().parameter(validTillParamName).value(validTill).validateDateAfter(validFrom);
|
||||
final LocalDate validTill = this.fromApiJsonHelper
|
||||
.extractLocalDateNamed(StandingInstructionApiConstants.validTillParamName, element);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.validTillParamName).value(validTill)
|
||||
.validateDateAfter(validFrom);
|
||||
|
||||
final BigDecimal transferAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(amountParamName, element);
|
||||
baseDataValidator.reset().parameter(amountParamName).value(transferAmount).positiveAmount();
|
||||
final BigDecimal transferAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(StandingInstructionApiConstants.amountParamName, element);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.amountParamName).value(transferAmount).positiveAmount();
|
||||
|
||||
final Integer transferType = this.fromApiJsonHelper.extractIntegerNamed(transferTypeParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(transferTypeParamName).value(transferType).notNull().inMinMaxRange(1, 3);
|
||||
|
||||
final Integer priority = this.fromApiJsonHelper.extractIntegerNamed(priorityParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(priorityParamName).value(priority).notNull().inMinMaxRange(1, 4);
|
||||
final Integer priority = this.fromApiJsonHelper.extractIntegerNamed(StandingInstructionApiConstants.priorityParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.priorityParamName).value(priority).notNull().inMinMaxRange(1, 4);
|
||||
|
||||
final Integer standingInstructionType = this.fromApiJsonHelper.extractIntegerNamed(instructionTypeParamName, element,
|
||||
final Integer standingInstructionType = this.fromApiJsonHelper.extractIntegerNamed(StandingInstructionApiConstants.instructionTypeParamName, element,
|
||||
Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(instructionTypeParamName).value(standingInstructionType).notNull().inMinMaxRange(1, 2);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.instructionTypeParamName).value(standingInstructionType).notNull().inMinMaxRange(1, 2);
|
||||
|
||||
final Integer recurrenceType = this.fromApiJsonHelper.extractIntegerNamed(recurrenceTypeParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(recurrenceTypeParamName).value(recurrenceType).notNull().inMinMaxRange(1, 2);
|
||||
final Integer recurrenceType = this.fromApiJsonHelper.extractIntegerNamed(StandingInstructionApiConstants.recurrenceTypeParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceTypeParamName).value(recurrenceType).notNull().inMinMaxRange(1, 2);
|
||||
boolean isPeriodic = false;
|
||||
if (recurrenceType != null) {
|
||||
isPeriodic = AccountTransferRecurrenceType.fromInt(recurrenceType).isPeriodicRecurrence();
|
||||
}
|
||||
|
||||
final Integer recurrenceFrequency = this.fromApiJsonHelper.extractIntegerNamed(recurrenceFrequencyParamName, element,
|
||||
final Integer recurrenceFrequency = this.fromApiJsonHelper.extractIntegerNamed(
|
||||
StandingInstructionApiConstants.recurrenceFrequencyParamName, element,
|
||||
Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(recurrenceFrequencyParamName).value(recurrenceFrequency).inMinMaxRange(0, 3);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceFrequencyParamName)
|
||||
.value(recurrenceFrequency).inMinMaxRange(0, 3);
|
||||
|
||||
if (recurrenceFrequency != null) {
|
||||
PeriodFrequencyType frequencyType = PeriodFrequencyType.fromInt(recurrenceFrequency);
|
||||
if (frequencyType.isMonthly() || frequencyType.isYearly()) {
|
||||
final MonthDay monthDay = this.fromApiJsonHelper.extractMonthDayNamed(recurrenceOnMonthDayParamName, element);
|
||||
baseDataValidator.reset().parameter(recurrenceOnMonthDayParamName).value(monthDay).notNull();
|
||||
final MonthDay monthDay = this.fromApiJsonHelper
|
||||
.extractMonthDayNamed(StandingInstructionApiConstants.recurrenceOnMonthDayParamName, element);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceOnMonthDayParamName)
|
||||
.value(monthDay).notNull();
|
||||
}
|
||||
}
|
||||
|
||||
final Integer recurrenceInterval = this.fromApiJsonHelper.extractIntegerNamed(recurrenceIntervalParamName, element,
|
||||
final Integer recurrenceInterval = this.fromApiJsonHelper.extractIntegerNamed(
|
||||
StandingInstructionApiConstants.recurrenceIntervalParamName, element,
|
||||
Locale.getDefault());
|
||||
if (isPeriodic) {
|
||||
baseDataValidator.reset().parameter(recurrenceIntervalParamName).value(recurrenceInterval).notNull();
|
||||
baseDataValidator.reset().parameter(recurrenceFrequencyParamName).value(recurrenceFrequency).notNull();
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceIntervalParamName).value(recurrenceInterval).notNull();
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceFrequencyParamName).value(recurrenceFrequency).notNull();
|
||||
}
|
||||
baseDataValidator.reset().parameter(recurrenceIntervalParamName).value(recurrenceInterval).integerGreaterThanZero();
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceIntervalParamName).value(recurrenceInterval).integerGreaterThanZero();
|
||||
|
||||
final String name = this.fromApiJsonHelper.extractStringNamed(nameParamName, element);
|
||||
baseDataValidator.reset().parameter(nameParamName).value(name).notNull();
|
||||
final String name = this.fromApiJsonHelper.extractStringNamed(StandingInstructionApiConstants.nameParamName, element);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.nameParamName).value(name).notNull();
|
||||
|
||||
final Integer toAccountType = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(toAccountTypeParamName, element);
|
||||
if (toAccountType != null && PortfolioAccountType.fromInt(toAccountType).isSavingsAccount()) {
|
||||
baseDataValidator.reset().parameter(instructionTypeParamName).value(standingInstructionType).notNull().inMinMaxRange(1, 1);
|
||||
baseDataValidator.reset().parameter(recurrenceTypeParamName).value(recurrenceType).notNull().inMinMaxRange(1, 1);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.instructionTypeParamName).value(standingInstructionType).notNull().inMinMaxRange(1, 1);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceTypeParamName).value(recurrenceType).notNull().inMinMaxRange(1, 1);
|
||||
|
||||
}
|
||||
if (standingInstructionType != null && StandingInstructionType.fromInt(standingInstructionType).isFixedAmoutTransfer()) {
|
||||
baseDataValidator.reset().parameter(amountParamName).value(transferAmount).notNull();
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.amountParamName).value(transferAmount).notNull();
|
||||
}
|
||||
|
||||
String errorCode = null;
|
||||
@@ -184,62 +212,79 @@ public class StandingInstructionDataValidator {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(STANDING_INSTRUCTION_RESOURCE_NAME);
|
||||
.resource(StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = command.parsedJson();
|
||||
if (this.fromApiJsonHelper.parameterExists(validFromParamName, element)) {
|
||||
final LocalDate validFrom = this.fromApiJsonHelper.extractLocalDateNamed(validFromParamName, element);
|
||||
baseDataValidator.reset().parameter(validFromParamName).value(validFrom).notNull();
|
||||
if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.validFromParamName, element)) {
|
||||
final LocalDate validFrom = this.fromApiJsonHelper
|
||||
.extractLocalDateNamed(StandingInstructionApiConstants.validFromParamName, element);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.validFromParamName).value(validFrom)
|
||||
.notNull();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(validTillParamName, element)) {
|
||||
final LocalDate validTill = this.fromApiJsonHelper.extractLocalDateNamed(validTillParamName, element);
|
||||
baseDataValidator.reset().parameter(validTillParamName).value(validTill).notNull();
|
||||
if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.validTillParamName, element)) {
|
||||
final LocalDate validTill = this.fromApiJsonHelper
|
||||
.extractLocalDateNamed(StandingInstructionApiConstants.validTillParamName, element);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.validTillParamName).value(validTill)
|
||||
.notNull();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(amountParamName, element)) {
|
||||
final BigDecimal transferAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(amountParamName, element);
|
||||
baseDataValidator.reset().parameter(amountParamName).value(transferAmount).positiveAmount();
|
||||
if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.amountParamName, element)) {
|
||||
final BigDecimal transferAmount = this.fromApiJsonHelper
|
||||
.extractBigDecimalWithLocaleNamed(StandingInstructionApiConstants.amountParamName, element);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.amountParamName).value(transferAmount)
|
||||
.positiveAmount();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(statusParamName, element)) {
|
||||
final Integer status = this.fromApiJsonHelper.extractIntegerNamed(statusParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(statusParamName).value(status).notNull().inMinMaxRange(1, 2);
|
||||
if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.statusParamName, element)) {
|
||||
final Integer status = this.fromApiJsonHelper
|
||||
.extractIntegerNamed(StandingInstructionApiConstants.statusParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.statusParamName).value(status).notNull()
|
||||
.inMinMaxRange(1, 2);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(priorityParamName, element)) {
|
||||
final Integer priority = this.fromApiJsonHelper.extractIntegerNamed(priorityParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(priorityParamName).value(priority).notNull().inMinMaxRange(1, 4);
|
||||
if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.priorityParamName, element)) {
|
||||
final Integer priority = this.fromApiJsonHelper.extractIntegerNamed(
|
||||
StandingInstructionApiConstants.priorityParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.priorityParamName).value(priority)
|
||||
.notNull().inMinMaxRange(1, 4);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(instructionTypeParamName, element)) {
|
||||
final Integer standingInstructionType = this.fromApiJsonHelper.extractIntegerNamed(instructionTypeParamName, element,
|
||||
Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(instructionTypeParamName).value(standingInstructionType).notNull().inMinMaxRange(1, 2);
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.instructionTypeParamName, element)) {
|
||||
final Integer standingInstructionType = this.fromApiJsonHelper.extractIntegerNamed(
|
||||
StandingInstructionApiConstants.instructionTypeParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.instructionTypeParamName)
|
||||
.value(standingInstructionType).notNull().inMinMaxRange(1, 2);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(recurrenceTypeParamName, element)) {
|
||||
final Integer recurrenceType = this.fromApiJsonHelper
|
||||
.extractIntegerNamed(recurrenceTypeParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(recurrenceTypeParamName).value(recurrenceType).notNull().inMinMaxRange(1, 2);
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.recurrenceTypeParamName, element)) {
|
||||
final Integer recurrenceType = this.fromApiJsonHelper.extractIntegerNamed(
|
||||
StandingInstructionApiConstants.recurrenceTypeParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceTypeParamName)
|
||||
.value(recurrenceType).notNull().inMinMaxRange(1, 2);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(recurrenceFrequencyParamName, element)) {
|
||||
final Integer recurrenceFrequency = this.fromApiJsonHelper.extractIntegerNamed(recurrenceFrequencyParamName, element,
|
||||
Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(recurrenceFrequencyParamName).value(recurrenceFrequency).inMinMaxRange(0, 3);
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.recurrenceFrequencyParamName,
|
||||
element)) {
|
||||
final Integer recurrenceFrequency = this.fromApiJsonHelper.extractIntegerNamed(
|
||||
StandingInstructionApiConstants.recurrenceFrequencyParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceFrequencyParamName)
|
||||
.value(recurrenceFrequency).inMinMaxRange(0, 3);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(recurrenceIntervalParamName, element)) {
|
||||
final Integer recurrenceInterval = this.fromApiJsonHelper.extractIntegerNamed(recurrenceIntervalParamName, element,
|
||||
Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(recurrenceIntervalParamName).value(recurrenceInterval).integerGreaterThanZero();
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.recurrenceIntervalParamName,
|
||||
element)) {
|
||||
final Integer recurrenceInterval = this.fromApiJsonHelper.extractIntegerNamed(
|
||||
StandingInstructionApiConstants.recurrenceIntervalParamName, element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceIntervalParamName)
|
||||
.value(recurrenceInterval).integerGreaterThanZero();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(nameParamName, element)) {
|
||||
final String name = this.fromApiJsonHelper.extractStringNamed(nameParamName, element);
|
||||
baseDataValidator.reset().parameter(nameParamName).value(name).notNull();
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.nameParamName, element)) {
|
||||
final String name = this.fromApiJsonHelper.extractStringNamed(StandingInstructionApiConstants.nameParamName,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(StandingInstructionApiConstants.nameParamName).value(name).notNull();
|
||||
}
|
||||
|
||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||
}
|
||||
|
||||
-7
@@ -104,11 +104,4 @@ public interface ShareAccountApiConstants {
|
||||
allowdividendcalculationforinactiveclients_paramname, charges_paramname, applicationdate_param,
|
||||
purchaseddate_paramname,numberofshares_paramname,purchasedprice_paramname));
|
||||
|
||||
Set<String> approvalParameters = new HashSet<>(Arrays.asList(locale_paramname, dateformat_paramname, approveddate_paramname, note_paramname));
|
||||
|
||||
Set<String> activateParameters = new HashSet<>(Arrays.asList(locale_paramname, dateformat_paramname, activatedate_paramname));
|
||||
|
||||
Set<String> closeParameters = new HashSet<>(Arrays.asList(locale_paramname, dateformat_paramname, closeddate_paramname, note_paramname));
|
||||
|
||||
Set<String> addtionalSharesParameters = new HashSet<>(Arrays.asList(locale_paramname, requesteddate_paramname, requestedshares_paramname, purchasedprice_paramname, dateformat_paramname));
|
||||
}
|
||||
|
||||
+6
-50
@@ -180,33 +180,14 @@ public class ClientApiConstants {
|
||||
|
||||
public static final String datatables = "datatables";
|
||||
|
||||
public static final Set<String> CLIENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(address,localeParamName, dateFormatParamName, groupIdParamName, accountNoParamName, externalIdParamName,
|
||||
mobileNoParamName, firstnameParamName, middlenameParamName, lastnameParamName, fullnameParamName, officeIdParamName,
|
||||
activeParamName, activationDateParamName, staffIdParamName, submittedOnDateParamName, savingsProductIdParamName,
|
||||
dateOfBirthParamName, genderIdParamName, clientTypeIdParamName, clientClassificationIdParamName,
|
||||
clientNonPersonDetailsParamName, displaynameParamName, legalFormIdParamName, datatables, isStaffParamName));
|
||||
|
||||
public static final Set<String> CLIENT_NON_PERSON_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(address,localeParamName, dateFormatParamName, incorpNumberParamName, remarksParamName, incorpValidityTillParamName,
|
||||
constitutionIdParamName, mainBusinessLineIdParamName, datatables));
|
||||
|
||||
public static final Set<String> CLIENT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, accountNoParamName, externalIdParamName, mobileNoParamName, firstnameParamName, middlenameParamName,
|
||||
|
||||
lastnameParamName, fullnameParamName, activeParamName, activationDateParamName, staffIdParamName, savingsProductIdParamName,
|
||||
dateOfBirthParamName, genderIdParamName, clientTypeIdParamName, clientClassificationIdParamName, submittedOnDateParamName, clientNonPersonDetailsParamName, displaynameParamName, legalFormIdParamName, isStaffParamName));
|
||||
|
||||
public static final Set<String> CLIENT_NON_PERSON_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, incorpNumberParamName, remarksParamName, incorpValidityTillParamName,
|
||||
constitutionIdParamName, mainBusinessLineIdParamName));
|
||||
|
||||
/**
|
||||
* These parameters will match the class level parameters of
|
||||
* {@link ClientData}. Where possible, we try to get response parameters to
|
||||
* match those of request parameters.
|
||||
*/
|
||||
public static final Set<String> CLIENT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, accountNoParamName,
|
||||
protected static final Set<String> CLIENT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
accountNoParamName,
|
||||
externalIdParamName, statusParamName, activeParamName, activationDateParamName, firstnameParamName, middlenameParamName,
|
||||
lastnameParamName, fullnameParamName, displayNameParamName, mobileNoParamName, officeIdParamName, officeNameParamName,
|
||||
transferToOfficeIdParamName, transferToOfficeNameParamName, hierarchyParamName, imageIdParamName, imagePresentParamName,
|
||||
@@ -214,39 +195,14 @@ public class ClientApiConstants {
|
||||
dateOfBirthParamName, genderParamName, clientTypeParamName, clientClassificationParamName, legalFormParamName,
|
||||
clientNonPersonDetailsParamName, isStaffParamName));
|
||||
|
||||
public static final Set<String> ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, activationDateParamName));
|
||||
public static final Set<String> REACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, reactivationDateParamName));
|
||||
|
||||
public static final Set<String> CLIENT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, closureDateParamName, closureReasonIdParamName));
|
||||
|
||||
public static final Set<String> CLIENT_REJECT_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, rejectionDateParamName, rejectionReasonIdParamName));
|
||||
|
||||
public static final Set<String> CLIENT_WITHDRAW_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, withdrawalDateParamName, withdrawalReasonIdParamName));
|
||||
|
||||
public static final Set<String> UNDOREJECTION_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, reopenedDateParamName));
|
||||
|
||||
public static final Set<String> UNDOWITHDRAWN_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, reopenedDateParamName));
|
||||
|
||||
public static final Set<String> CLIENT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(chargeIdParamName,
|
||||
protected static final Set<String> CLIENT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList
|
||||
(chargeIdParamName,
|
||||
clientIdParamName, chargeNameParamName, penaltyParamName, chargeTimeTypeParamName, dueAsOfDateParamName,
|
||||
chargeCalculationTypeParamName, currencyParamName, amountWaivedParamName, amountWrittenOffParamName, amountOutstandingParamName,
|
||||
amountOrPercentageParamName, amountParamName, amountPaidParamName, chargeOptionsParamName, transactionsParamName));
|
||||
|
||||
public static final Set<String> CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(chargeIdParamName, amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName));
|
||||
|
||||
public static final Set<String> CLIENT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(amountParamName,
|
||||
transactionDateParamName, dateFormatParamName, localeParamName, paymentTypeIdParamName, transactionAccountNumberParamName,
|
||||
checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName));
|
||||
|
||||
public static final Set<String> CLIENT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
protected static final Set<String> CLIENT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList
|
||||
(idParamName,
|
||||
transactionAmountParamName, paymentDetailDataParamName, reversedParamName, dateParamName, officeIdParamName,
|
||||
officeNameParamName, transactionTypeParamName, transactionCurrencyParamName, externalIdParamName, submittedOnDateParamName));
|
||||
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.fineract.portfolio.client.data;
|
||||
|
||||
import org.apache.fineract.portfolio.client.api.ClientApiConstants;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class ClientApiCollectionConstants extends ClientApiConstants{
|
||||
|
||||
protected static final Set<String> CLIENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(address,localeParamName, dateFormatParamName, groupIdParamName, accountNoParamName, externalIdParamName,
|
||||
mobileNoParamName, firstnameParamName, middlenameParamName, lastnameParamName, fullnameParamName, officeIdParamName,
|
||||
activeParamName, activationDateParamName, staffIdParamName, submittedOnDateParamName, savingsProductIdParamName,
|
||||
dateOfBirthParamName, genderIdParamName, clientTypeIdParamName, clientClassificationIdParamName,
|
||||
clientNonPersonDetailsParamName, displaynameParamName, legalFormIdParamName, datatables, isStaffParamName));
|
||||
|
||||
protected static final Set<String> CLIENT_NON_PERSON_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(address,localeParamName, dateFormatParamName, incorpNumberParamName, remarksParamName, incorpValidityTillParamName,
|
||||
constitutionIdParamName, mainBusinessLineIdParamName, datatables));
|
||||
|
||||
protected static final Set<String> CLIENT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, accountNoParamName, externalIdParamName, mobileNoParamName, firstnameParamName, middlenameParamName,
|
||||
|
||||
lastnameParamName, fullnameParamName, activeParamName, activationDateParamName, staffIdParamName, savingsProductIdParamName,
|
||||
dateOfBirthParamName, genderIdParamName, clientTypeIdParamName, clientClassificationIdParamName, submittedOnDateParamName, clientNonPersonDetailsParamName, displaynameParamName, legalFormIdParamName, isStaffParamName));
|
||||
|
||||
protected static final Set<String> CLIENT_NON_PERSON_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, incorpNumberParamName, remarksParamName, incorpValidityTillParamName,
|
||||
constitutionIdParamName, mainBusinessLineIdParamName));
|
||||
|
||||
|
||||
/**
|
||||
* These parameters will match the class level parameters of
|
||||
* {@link ClientData}. Where possible, we try to get response parameters to
|
||||
* match those of request parameters.
|
||||
*/
|
||||
|
||||
protected static final Set<String> ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, activationDateParamName));
|
||||
protected static final Set<String> REACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, reactivationDateParamName));
|
||||
|
||||
protected static final Set<String> CLIENT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, closureDateParamName, closureReasonIdParamName));
|
||||
|
||||
protected static final Set<String> CLIENT_REJECT_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, rejectionDateParamName, rejectionReasonIdParamName));
|
||||
|
||||
protected static final Set<String> CLIENT_WITHDRAW_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, withdrawalDateParamName, withdrawalReasonIdParamName));
|
||||
|
||||
protected static final Set<String> UNDOREJECTION_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, reopenedDateParamName));
|
||||
|
||||
protected static final Set<String> UNDOWITHDRAWN_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, reopenedDateParamName));
|
||||
|
||||
protected static final Set<String> CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(chargeIdParamName, amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName));
|
||||
|
||||
protected static final Set<String> CLIENT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(amountParamName,
|
||||
transactionDateParamName, dateFormatParamName, localeParamName, paymentTypeIdParamName, transactionAccountNumberParamName,
|
||||
checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName));
|
||||
|
||||
|
||||
}
|
||||
+3
-3
@@ -53,7 +53,7 @@ public class ClientChargeDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
ClientApiConstants.CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
|
||||
ClientApiCollectionConstants.CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -75,7 +75,7 @@ public class ClientChargeDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
ClientApiConstants.CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
|
||||
ClientApiCollectionConstants.CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -100,7 +100,7 @@ public class ClientChargeDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
ClientApiConstants.CLIENT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS);
|
||||
ClientApiCollectionConstants.CLIENT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
|
||||
+25
-24
@@ -36,6 +36,7 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.client.data.ClientApiCollectionConstants;
|
||||
import org.apache.fineract.portfolio.client.api.ClientApiConstants;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -59,19 +60,19 @@ public final class ClientDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_CREATE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_CREATE_REQUEST_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.clientNonPersonDetailsParamName, element)) {
|
||||
final String clientNonPersonJson = this.fromApiJsonHelper.toJson(element.getAsJsonObject().get(ClientApiConstants.clientNonPersonDetailsParamName));
|
||||
if(clientNonPersonJson != null)
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson, ClientApiConstants.CLIENT_NON_PERSON_CREATE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson, ClientApiCollectionConstants.CLIENT_NON_PERSON_CREATE_REQUEST_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
final Long officeId = this.fromApiJsonHelper.extractLongNamed(ClientApiConstants.officeIdParamName, element);
|
||||
baseDataValidator.reset().parameter(ClientApiConstants.officeIdParamName).value(officeId).notNull().integerGreaterThanZero();
|
||||
@@ -228,7 +229,7 @@ public final class ClientDataValidator {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.incorpNumberParamName, element)) {
|
||||
final String incorpNumber = this.fromApiJsonHelper.extractStringNamed(ClientApiConstants.incorpNumberParamName, element);
|
||||
@@ -332,19 +333,19 @@ public final class ClientDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.clientNonPersonDetailsParamName, element)) {
|
||||
final String clientNonPersonJson = this.fromApiJsonHelper.toJson(element.getAsJsonObject().get(ClientApiConstants.clientNonPersonDetailsParamName));
|
||||
if(clientNonPersonJson != null)
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson, ClientApiConstants.CLIENT_NON_PERSON_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson, ClientApiCollectionConstants.CLIENT_NON_PERSON_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
boolean atLeastOneParameterPassedForUpdate = false;
|
||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.accountNoParamName, element)) {
|
||||
@@ -509,7 +510,7 @@ public final class ClientDataValidator {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.incorpNumberParamName, element)) {
|
||||
atLeastOneParameterPassedForUpdate = true;
|
||||
@@ -555,11 +556,11 @@ public final class ClientDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.ACTIVATION_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.ACTIVATION_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = command.parsedJson();
|
||||
|
||||
@@ -614,7 +615,7 @@ public final class ClientDataValidator {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
final String staffIdParameterName = ClientApiConstants.staffIdParamName;
|
||||
final Long staffId = this.fromApiJsonHelper.extractLongNamed(staffIdParameterName, element);
|
||||
@@ -631,11 +632,11 @@ public final class ClientDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_CLOSE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_CLOSE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = command.parsedJson();
|
||||
|
||||
@@ -663,7 +664,7 @@ public final class ClientDataValidator {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
final String savingsIdParameterName = ClientApiConstants.savingsAccountIdParamName;
|
||||
final Long savingsId = this.fromApiJsonHelper.extractLongNamed(savingsIdParameterName, element);
|
||||
@@ -680,11 +681,11 @@ public final class ClientDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_REJECT_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_REJECT_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = command.parsedJson();
|
||||
|
||||
@@ -706,11 +707,11 @@ public final class ClientDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_WITHDRAW_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_WITHDRAW_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = command.parsedJson();
|
||||
|
||||
@@ -732,11 +733,11 @@ public final class ClientDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.REACTIVATION_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.REACTIVATION_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = command.parsedJson();
|
||||
|
||||
@@ -756,11 +757,11 @@ public final class ClientDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.UNDOREJECTION_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.UNDOREJECTION_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = command.parsedJson();
|
||||
|
||||
@@ -779,11 +780,11 @@ public final class ClientDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.UNDOWITHDRAWN_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.UNDOWITHDRAWN_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
.resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = command.parsedJson();
|
||||
|
||||
|
||||
-15
@@ -51,19 +51,4 @@ public class CollectionSheetConstants {
|
||||
public static final String savingsIdParamName = "savingsId";
|
||||
public static final String transactionAmountParamName = "transactionAmount";
|
||||
public static final String depositAccountTypeParamName = "depositAccountType";
|
||||
|
||||
public static final Set<String> COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, transactionDateParamName, actualDisbursementDateParamName, bulkRepaymentTransactionsParamName,
|
||||
bulkDisbursementTransactionsParamName, noteParamName, calendarIdParamName, clientsAttendanceParamName,
|
||||
bulkSavingsDueTransactionsParamName, PaymentDetailConstants.paymentTypeParamName,
|
||||
PaymentDetailConstants.accountNumberParamName, PaymentDetailConstants.checkNumberParamName,
|
||||
PaymentDetailConstants.routingCodeParamName, PaymentDetailConstants.receiptNumberParamName,
|
||||
PaymentDetailConstants.bankNumberParamName, isTransactionDateOnNonMeetingDateParamName));
|
||||
|
||||
public static final Set<String> INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, transactionDateParamName, actualDisbursementDateParamName, bulkRepaymentTransactionsParamName,
|
||||
bulkDisbursementTransactionsParamName, noteParamName, bulkSavingsDueTransactionsParamName));
|
||||
|
||||
public static final Set<String> INDIVIDUAL_COLLECTIONSHEET_SUPPORTED_PARAMS = new HashSet<>(Arrays.asList(transactionDateParamName,
|
||||
localeParamName, dateFormatParamName, officeIdParamName, staffIdParamName));
|
||||
}
|
||||
+89
-51
@@ -18,28 +18,15 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.collectionsheet.data;
|
||||
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.COLLECTIONSHEET_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.COLLECTIONSHEET_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.attendanceTypeParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.bulkDisbursementTransactionsParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.bulkRepaymentTransactionsParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.bulkSavingsDueTransactionsParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.calendarIdParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.clientIdParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.clientsAttendanceParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.loanIdParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.noteParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.savingsIdParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.transactionAmountParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.transactionDateParamName;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -48,6 +35,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.paymentdetail.PaymentDetailConstants;
|
||||
import org.joda.time.LocalDate;
|
||||
@@ -63,6 +51,30 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class CollectionSheetTransactionDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList
|
||||
(CollectionSheetConstants.localeParamName,
|
||||
CollectionSheetConstants.dateFormatParamName, CollectionSheetConstants.transactionDateParamName,
|
||||
CollectionSheetConstants.actualDisbursementDateParamName,
|
||||
CollectionSheetConstants.bulkRepaymentTransactionsParamName,
|
||||
CollectionSheetConstants.bulkDisbursementTransactionsParamName, CollectionSheetConstants.noteParamName,
|
||||
CollectionSheetConstants.calendarIdParamName,
|
||||
CollectionSheetConstants.clientsAttendanceParamName,
|
||||
CollectionSheetConstants.bulkSavingsDueTransactionsParamName, PaymentDetailConstants.paymentTypeParamName,
|
||||
PaymentDetailConstants.accountNumberParamName, PaymentDetailConstants.checkNumberParamName,
|
||||
PaymentDetailConstants.routingCodeParamName, PaymentDetailConstants.receiptNumberParamName,
|
||||
PaymentDetailConstants.bankNumberParamName, CollectionSheetConstants.isTransactionDateOnNonMeetingDateParamName));
|
||||
|
||||
private static final Set<String> INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
CollectionSheetConstants.localeParamName, CollectionSheetConstants.dateFormatParamName,
|
||||
CollectionSheetConstants.transactionDateParamName, CollectionSheetConstants.actualDisbursementDateParamName,
|
||||
CollectionSheetConstants.bulkRepaymentTransactionsParamName,
|
||||
CollectionSheetConstants.bulkDisbursementTransactionsParamName, CollectionSheetConstants.noteParamName,
|
||||
CollectionSheetConstants.bulkSavingsDueTransactionsParamName));
|
||||
|
||||
private static final Set<String> PAYMENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(PaymentDetailConstants.accountNumberParamName, PaymentDetailConstants.checkNumberParamName,
|
||||
PaymentDetailConstants.routingCodeParamName, PaymentDetailConstants.receiptNumberParamName,
|
||||
PaymentDetailConstants.bankNumberParamName));
|
||||
|
||||
@Autowired
|
||||
public CollectionSheetTransactionDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
@@ -78,20 +90,24 @@ public class CollectionSheetTransactionDataValidator {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(COLLECTIONSHEET_RESOURCE_NAME);
|
||||
.resource(CollectionSheetConstants.COLLECTIONSHEET_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(transactionDateParamName, element);
|
||||
baseDataValidator.reset().parameter(transactionDateParamName).value(transactionDate).notNull();
|
||||
final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(CollectionSheetConstants
|
||||
.transactionDateParamName, element);
|
||||
baseDataValidator.reset().parameter(CollectionSheetConstants.transactionDateParamName).value(transactionDate)
|
||||
.notNull();
|
||||
|
||||
final String note = this.fromApiJsonHelper.extractStringNamed(noteParamName, element);
|
||||
final String note = this.fromApiJsonHelper.extractStringNamed(CollectionSheetConstants.noteParamName, element);
|
||||
if (StringUtils.isNotBlank(note)) {
|
||||
baseDataValidator.reset().parameter(noteParamName).value(note).notExceedingLengthOf(1000);
|
||||
baseDataValidator.reset().parameter(CollectionSheetConstants.noteParamName).value(note)
|
||||
.notExceedingLengthOf(1000);
|
||||
}
|
||||
|
||||
final Long calendarId = this.fromApiJsonHelper.extractLongNamed(calendarIdParamName, element);
|
||||
baseDataValidator.reset().parameter(calendarIdParamName).value(calendarId).notNull();
|
||||
final Long calendarId = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants.calendarIdParamName,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CollectionSheetConstants.calendarIdParamName).value(calendarId).notNull();
|
||||
|
||||
validateAttendanceDetails(element, baseDataValidator);
|
||||
|
||||
@@ -111,20 +127,24 @@ public class CollectionSheetTransactionDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(COLLECTIONSHEET_RESOURCE_NAME);
|
||||
.resource(CollectionSheetConstants.COLLECTIONSHEET_RESOURCE_NAME);
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(transactionDateParamName, element);
|
||||
baseDataValidator.reset().parameter(transactionDateParamName).value(transactionDate).notNull().validateDateBeforeOrEqual(DateUtils.getLocalDateOfTenant());
|
||||
final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(CollectionSheetConstants
|
||||
.transactionDateParamName, element);
|
||||
baseDataValidator.reset().parameter(CollectionSheetConstants.transactionDateParamName).value(transactionDate)
|
||||
.notNull().validateDateBeforeOrEqual(DateUtils.getLocalDateOfTenant());
|
||||
|
||||
final String note = this.fromApiJsonHelper.extractStringNamed(noteParamName, element);
|
||||
final String note = this.fromApiJsonHelper.extractStringNamed(CollectionSheetConstants.noteParamName, element);
|
||||
if (StringUtils.isNotBlank(note)) {
|
||||
baseDataValidator.reset().parameter(noteParamName).value(note).notExceedingLengthOf(1000);
|
||||
baseDataValidator.reset().parameter(CollectionSheetConstants.noteParamName).value(note)
|
||||
.notExceedingLengthOf(1000);
|
||||
}
|
||||
|
||||
validateDisbursementTransactions(element, baseDataValidator);
|
||||
@@ -139,15 +159,21 @@ public class CollectionSheetTransactionDataValidator {
|
||||
private void validateAttendanceDetails(final JsonElement element, final DataValidatorBuilder baseDataValidator) {
|
||||
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
||||
if (element.isJsonObject()) {
|
||||
if (topLevelJsonElement.has(clientsAttendanceParamName) && topLevelJsonElement.get(clientsAttendanceParamName).isJsonArray()) {
|
||||
final JsonArray array = topLevelJsonElement.get(clientsAttendanceParamName).getAsJsonArray();
|
||||
if (topLevelJsonElement.has(CollectionSheetConstants.clientsAttendanceParamName) && topLevelJsonElement
|
||||
.get(CollectionSheetConstants.clientsAttendanceParamName).isJsonArray()) {
|
||||
final JsonArray array = topLevelJsonElement.get(CollectionSheetConstants.clientsAttendanceParamName)
|
||||
.getAsJsonArray();
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
final JsonObject attendanceElement = array.get(i).getAsJsonObject();
|
||||
final Long clientId = this.fromApiJsonHelper.extractLongNamed(clientIdParamName, attendanceElement);
|
||||
final Long attendanceType = this.fromApiJsonHelper.extractLongNamed(attendanceTypeParamName, attendanceElement);
|
||||
baseDataValidator.reset().parameter(clientsAttendanceParamName + "[" + i + "]." + clientIdParamName).value(clientId)
|
||||
final Long clientId = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants
|
||||
.clientIdParamName, attendanceElement);
|
||||
final Long attendanceType = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants
|
||||
.attendanceTypeParamName, attendanceElement);
|
||||
baseDataValidator.reset().parameter(CollectionSheetConstants.clientsAttendanceParamName + "[" + i
|
||||
+ "]." + CollectionSheetConstants.clientIdParamName).value(clientId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
baseDataValidator.reset().parameter(clientsAttendanceParamName + "[" + i + "]." + attendanceTypeParamName)
|
||||
baseDataValidator.reset().parameter(CollectionSheetConstants.clientsAttendanceParamName + "[" + i
|
||||
+ "]." + CollectionSheetConstants.attendanceTypeParamName)
|
||||
.value(attendanceType).notNull().integerGreaterThanZero();
|
||||
}
|
||||
}
|
||||
@@ -158,14 +184,18 @@ public class CollectionSheetTransactionDataValidator {
|
||||
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
||||
final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
|
||||
if (element.isJsonObject()) {
|
||||
if (topLevelJsonElement.has(bulkDisbursementTransactionsParamName)
|
||||
&& topLevelJsonElement.get(bulkDisbursementTransactionsParamName).isJsonArray()) {
|
||||
final JsonArray array = topLevelJsonElement.get(bulkDisbursementTransactionsParamName).getAsJsonArray();
|
||||
if (topLevelJsonElement.has(CollectionSheetConstants.bulkDisbursementTransactionsParamName)
|
||||
&& topLevelJsonElement.get(CollectionSheetConstants.bulkDisbursementTransactionsParamName)
|
||||
.isJsonArray()) {
|
||||
final JsonArray array = topLevelJsonElement.get(CollectionSheetConstants
|
||||
.bulkDisbursementTransactionsParamName).getAsJsonArray();
|
||||
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
final JsonObject loanTransactionElement = array.get(i).getAsJsonObject();
|
||||
final Long loanId = this.fromApiJsonHelper.extractLongNamed(loanIdParamName, loanTransactionElement);
|
||||
final BigDecimal disbursementAmount = this.fromApiJsonHelper.extractBigDecimalNamed(transactionAmountParamName,
|
||||
final Long loanId = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants
|
||||
.loanIdParamName, loanTransactionElement);
|
||||
final BigDecimal disbursementAmount = this.fromApiJsonHelper.extractBigDecimalNamed
|
||||
(CollectionSheetConstants.transactionAmountParamName,
|
||||
loanTransactionElement, locale);
|
||||
|
||||
baseDataValidator.reset().parameter("bulktransaction" + "[" + i + "].loan.id").value(loanId).notNull()
|
||||
@@ -181,14 +211,18 @@ public class CollectionSheetTransactionDataValidator {
|
||||
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
||||
final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
|
||||
if (element.isJsonObject()) {
|
||||
if (topLevelJsonElement.has(bulkRepaymentTransactionsParamName)
|
||||
&& topLevelJsonElement.get(bulkRepaymentTransactionsParamName).isJsonArray()) {
|
||||
final JsonArray array = topLevelJsonElement.get(bulkRepaymentTransactionsParamName).getAsJsonArray();
|
||||
if (topLevelJsonElement.has(CollectionSheetConstants.bulkRepaymentTransactionsParamName)
|
||||
&& topLevelJsonElement.get(CollectionSheetConstants.bulkRepaymentTransactionsParamName)
|
||||
.isJsonArray()) {
|
||||
final JsonArray array = topLevelJsonElement.get(CollectionSheetConstants
|
||||
.bulkRepaymentTransactionsParamName).getAsJsonArray();
|
||||
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
final JsonObject loanTransactionElement = array.get(i).getAsJsonObject();
|
||||
final Long loanId = this.fromApiJsonHelper.extractLongNamed(loanIdParamName, loanTransactionElement);
|
||||
final BigDecimal disbursementAmount = this.fromApiJsonHelper.extractBigDecimalNamed(transactionAmountParamName,
|
||||
final Long loanId = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants
|
||||
.loanIdParamName, loanTransactionElement);
|
||||
final BigDecimal disbursementAmount = this.fromApiJsonHelper.extractBigDecimalNamed
|
||||
(CollectionSheetConstants.transactionAmountParamName,
|
||||
loanTransactionElement, locale);
|
||||
|
||||
baseDataValidator.reset().parameter("bulktransaction" + "[" + i + "].loan.id").value(loanId).notNull()
|
||||
@@ -206,14 +240,18 @@ public class CollectionSheetTransactionDataValidator {
|
||||
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
||||
final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
|
||||
if (element.isJsonObject()) {
|
||||
if (topLevelJsonElement.has(bulkSavingsDueTransactionsParamName)
|
||||
&& topLevelJsonElement.get(bulkSavingsDueTransactionsParamName).isJsonArray()) {
|
||||
final JsonArray array = topLevelJsonElement.get(bulkSavingsDueTransactionsParamName).getAsJsonArray();
|
||||
if (topLevelJsonElement.has(CollectionSheetConstants.bulkSavingsDueTransactionsParamName)
|
||||
&& topLevelJsonElement.get(CollectionSheetConstants.bulkSavingsDueTransactionsParamName)
|
||||
.isJsonArray()) {
|
||||
final JsonArray array = topLevelJsonElement.get(CollectionSheetConstants
|
||||
.bulkSavingsDueTransactionsParamName).getAsJsonArray();
|
||||
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
final JsonObject savingsTransactionElement = array.get(i).getAsJsonObject();
|
||||
final Long savingsId = this.fromApiJsonHelper.extractLongNamed(savingsIdParamName, savingsTransactionElement);
|
||||
final BigDecimal dueAmount = this.fromApiJsonHelper.extractBigDecimalNamed(transactionAmountParamName,
|
||||
final Long savingsId = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants
|
||||
.savingsIdParamName, savingsTransactionElement);
|
||||
final BigDecimal dueAmount = this.fromApiJsonHelper.extractBigDecimalNamed
|
||||
(CollectionSheetConstants.transactionAmountParamName,
|
||||
savingsTransactionElement, locale);
|
||||
|
||||
baseDataValidator.reset().parameter("bulktransaction" + "[" + i + "].savings.id").value(savingsId).notNull()
|
||||
@@ -232,7 +270,7 @@ public class CollectionSheetTransactionDataValidator {
|
||||
locale);
|
||||
baseDataValidator.reset().parameter(PaymentDetailConstants.paymentTypeParamName).value(paymentTypeId).ignoreIfNull()
|
||||
.integerGreaterThanZero();
|
||||
for (final String paymentDetailParameterName : PaymentDetailConstants.PAYMENT_CREATE_REQUEST_DATA_PARAMETERS) {
|
||||
for (final String paymentDetailParameterName : PAYMENT_CREATE_REQUEST_DATA_PARAMETERS) {
|
||||
final String paymentDetailParameterValue = this.fromApiJsonHelper.extractStringNamed(paymentDetailParameterName, element);
|
||||
baseDataValidator.reset().parameter(paymentDetailParameterName).value(paymentDetailParameterValue).ignoreIfNull()
|
||||
.notExceedingLengthOf(50);
|
||||
|
||||
+5
-3
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.collectionsheet.serialization;
|
||||
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.INDIVIDUAL_COLLECTIONSHEET_SUPPORTED_PARAMS;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.calendarIdParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.dateFormatParamName;
|
||||
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.localeParamName;
|
||||
@@ -53,8 +52,11 @@ public class CollectionSheetGenerateCommandFromApiJsonDeserializer {
|
||||
/**
|
||||
* The parameters supported for this command.
|
||||
*/
|
||||
final Set<String> supportedParameters = new HashSet<>(Arrays.asList(transactionDateParamName, localeParamName, dateFormatParamName,
|
||||
calendarIdParamName));
|
||||
final Set<String> supportedParameters = new HashSet<>(
|
||||
Arrays.asList(transactionDateParamName, localeParamName, dateFormatParamName, calendarIdParamName));
|
||||
|
||||
private static final Set<String> INDIVIDUAL_COLLECTIONSHEET_SUPPORTED_PARAMS = new HashSet<>(Arrays.asList(
|
||||
transactionDateParamName, localeParamName, dateFormatParamName, officeIdParamName, staffIdParamName));
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
|
||||
+8
-22
@@ -89,45 +89,31 @@ public class GroupingTypesApiConstants {
|
||||
|
||||
public static final String datatables = "datatables";
|
||||
|
||||
public static final Set<String> CENTER_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, idParamName, nameParamName, externalIdParamName, officeIdParamName, staffIdParamName, activeParamName,
|
||||
activationDateParamName, groupMembersParamName, submittedOnDateParamName, datatables));
|
||||
|
||||
public static final Set<String> GROUP_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
|
||||
idParamName, nameParamName, externalIdParamName, centerIdParamName, officeIdParamName, staffIdParamName, activeParamName,
|
||||
activationDateParamName, clientMembersParamName, collectionMeetingCalendar, submittedOnDateParamName, datatables));
|
||||
|
||||
public static final Set<String> GROUP_ROLES_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(roleParamName,
|
||||
clientIdParamName));
|
||||
|
||||
/**
|
||||
* These parameters will match the class level parameters of
|
||||
* {@link CenterData}. Where possible, we try to get response parameters to
|
||||
* match those of request parameters.
|
||||
*/
|
||||
public static final Set<String> CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName,
|
||||
protected static final Set<String> CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
nameParamName,
|
||||
externalIdParamName, officeIdParamName, officeNameParamName, staffIdParamName, staffNameParamName, hierarchyParamName,
|
||||
officeOptionsParamName, staffOptionsParamName, statusParamName, activeParamName, activationDateParamName, timeLine,
|
||||
groupMembersParamName, collectionMeetingCalendar, closureReasons, datatables));
|
||||
|
||||
public static final Set<String> CENTER_GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName,
|
||||
protected static final Set<String> CENTER_GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
nameParamName,
|
||||
externalIdParamName, officeIdParamName, officeNameParamName, staffIdParamName, staffNameParamName, hierarchyParamName,
|
||||
officeOptionsParamName, staffOptionsParamName, clientOptionsParamName, datatables));
|
||||
|
||||
public static final Set<String> GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName,
|
||||
protected static final Set<String> GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
nameParamName,
|
||||
externalIdParamName, officeIdParamName, officeNameParamName, "parentId", "parentName", staffIdParamName, staffNameParamName,
|
||||
hierarchyParamName, officeOptionsParamName, statusParamName, activeParamName, activationDateParamName, staffOptionsParamName,
|
||||
clientOptionsParamName, timeLine, datatables));
|
||||
|
||||
public static final Set<String> ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, activationDateParamName));
|
||||
|
||||
public static final Set<String> COLLECTIONSHEET_DATA_PARAMETERS = new HashSet<>(
|
||||
protected static final Set<String> COLLECTIONSHEET_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList("dueDate", "loanProducts", "groups"));
|
||||
|
||||
public static final Set<String> GROUP_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, closureDateParamName, closureReasonIdParamName));
|
||||
|
||||
public static final Set<String> STAFF_CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(staffIdParamName,
|
||||
protected static final Set<String> STAFF_CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(staffIdParamName,
|
||||
staffNameParamName, meetingFallCenters, totalCollected, totalOverdue, totaldue, installmentDue));
|
||||
}
|
||||
+7
-2
@@ -20,8 +20,11 @@ package org.apache.fineract.portfolio.group.serialization;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -41,6 +44,8 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class GroupRolesDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> GROUP_ROLES_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(GroupingTypesApiConstants.roleParamName, GroupingTypesApiConstants.clientIdParamName));
|
||||
|
||||
@Autowired
|
||||
public GroupRolesDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
@@ -59,7 +64,7 @@ public class GroupRolesDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper
|
||||
.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_ROLES_REQUEST_DATA_PARAMETERS);
|
||||
.checkForUnsupportedParameters(typeOfMap, json, GROUP_ROLES_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
@@ -84,7 +89,7 @@ public class GroupRolesDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper
|
||||
.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_ROLES_REQUEST_DATA_PARAMETERS);
|
||||
.checkForUnsupportedParameters(typeOfMap, json, GROUP_ROLES_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
|
||||
+34
-8
@@ -48,6 +48,32 @@ public final class GroupingTypesDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
private static final Set<String> CENTER_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(GroupingTypesApiConstants.localeParamName, GroupingTypesApiConstants.dateFormatParamName,
|
||||
GroupingTypesApiConstants.idParamName, GroupingTypesApiConstants.nameParamName,
|
||||
GroupingTypesApiConstants.externalIdParamName, GroupingTypesApiConstants.officeIdParamName,
|
||||
GroupingTypesApiConstants.staffIdParamName, GroupingTypesApiConstants.activeParamName,
|
||||
GroupingTypesApiConstants.activationDateParamName, GroupingTypesApiConstants.groupMembersParamName,
|
||||
GroupingTypesApiConstants.submittedOnDateParamName, GroupingTypesApiConstants.datatables));
|
||||
|
||||
private static final Set<String> GROUP_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
GroupingTypesApiConstants.localeParamName, GroupingTypesApiConstants.dateFormatParamName,
|
||||
GroupingTypesApiConstants.idParamName, GroupingTypesApiConstants.nameParamName,
|
||||
GroupingTypesApiConstants.externalIdParamName, GroupingTypesApiConstants.centerIdParamName,
|
||||
GroupingTypesApiConstants.officeIdParamName, GroupingTypesApiConstants.staffIdParamName,
|
||||
GroupingTypesApiConstants.activeParamName, GroupingTypesApiConstants.activationDateParamName,
|
||||
GroupingTypesApiConstants.clientMembersParamName, GroupingTypesApiConstants.collectionMeetingCalendar,
|
||||
GroupingTypesApiConstants.submittedOnDateParamName, GroupingTypesApiConstants.datatables));
|
||||
|
||||
|
||||
private static final Set<String> ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(GroupingTypesApiConstants.localeParamName, GroupingTypesApiConstants.dateFormatParamName,
|
||||
GroupingTypesApiConstants.activationDateParamName));
|
||||
|
||||
private static final Set<String> GROUP_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
GroupingTypesApiConstants.localeParamName, GroupingTypesApiConstants.dateFormatParamName,
|
||||
GroupingTypesApiConstants.closureDateParamName, GroupingTypesApiConstants.closureReasonIdParamName));
|
||||
|
||||
@Autowired
|
||||
public GroupingTypesDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
@@ -67,7 +93,7 @@ public final class GroupingTypesDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.CENTER_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CENTER_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
@@ -132,7 +158,7 @@ public final class GroupingTypesDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
@@ -200,7 +226,7 @@ public final class GroupingTypesDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
@@ -265,7 +291,7 @@ public final class GroupingTypesDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.CENTER_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CENTER_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
@@ -311,7 +337,7 @@ public final class GroupingTypesDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
@@ -357,7 +383,7 @@ public final class GroupingTypesDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.ACTIVATION_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ACTIVATION_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(resourceName);
|
||||
@@ -466,7 +492,7 @@ public final class GroupingTypesDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper
|
||||
.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_CLOSE_REQUEST_DATA_PARAMETERS);
|
||||
.checkForUnsupportedParameters(typeOfMap, json, GROUP_CLOSE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -492,7 +518,7 @@ public final class GroupingTypesDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper
|
||||
.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_CLOSE_REQUEST_DATA_PARAMETERS);
|
||||
.checkForUnsupportedParameters(typeOfMap, json, GROUP_CLOSE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
|
||||
-8
@@ -35,14 +35,6 @@ public interface InterestIncentiveApiConstants {
|
||||
|
||||
public static final String INCENTIVE_RESOURCE_NAME = "interest.rate.incentives";
|
||||
|
||||
public static final Set<String> INTERESTRATE_INCENTIVE_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
entityTypeParamName, attributeNameParamName, conditionTypeParamName, attributeValueParamName, incentiveTypeparamName,
|
||||
amountParamName));
|
||||
|
||||
public static final Set<String> INTERESTRATE_INCENTIVE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
entityTypeParamName, attributeNameParamName, conditionTypeParamName, attributeValueParamName, incentiveTypeparamName,
|
||||
amountParamName));
|
||||
|
||||
public static final Set<String> INTERESTRATE_INCENTIVE_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
entityTypeParamName, attributeNameParamName, conditionTypeParamName, attributeValueParamName, incentiveTypeparamName,
|
||||
amountParamName));
|
||||
|
||||
+2
-14
@@ -27,10 +27,10 @@ public class InterestRateChartApiConstants {
|
||||
public static final String INTERESTRATE_CHART_RESOURCE_NAME = "interestchart";
|
||||
|
||||
// actions
|
||||
public static String summitalAction = ".summital";
|
||||
public static final String summitalAction = ".summital";
|
||||
|
||||
// command
|
||||
public static String COMMAND_UNDO_TRANSACTION = "undo";
|
||||
public static final String COMMAND_UNDO_TRANSACTION = "undo";
|
||||
|
||||
// general
|
||||
public static final String localeParamName = "locale";
|
||||
@@ -62,16 +62,4 @@ public class InterestRateChartApiConstants {
|
||||
|
||||
// to delete chart Slabs from chart
|
||||
public static final String deleteParamName = "delete";
|
||||
|
||||
public static final Set<String> INTERESTRATE_CHART_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, productIdParamName, chartSlabs,
|
||||
isPrimaryGroupingByAmountParamName));
|
||||
|
||||
public static final Set<String> INTERESTRATE_CHART_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, idParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, chartSlabs,
|
||||
deleteParamName, isPrimaryGroupingByAmountParamName));
|
||||
|
||||
public static final Set<String> INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, idParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, chartSlabs,
|
||||
isPrimaryGroupingByAmountParamName));
|
||||
}
|
||||
-14
@@ -45,18 +45,4 @@ public class InterestRateChartSlabApiConstants {
|
||||
public static final String annualInterestRateParamName = "annualInterestRate";
|
||||
public static final String currencyCodeParamName = "currencyCode";
|
||||
public static final String incentivesParamName = "incentives";
|
||||
|
||||
// associations
|
||||
|
||||
public static final Set<String> INTERESTRATE_CHART_SLAB_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
localeParamName, idParamName, descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName,
|
||||
amountRangeFromParamName, amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
|
||||
|
||||
public static final Set<String> INTERESTRATE_CHART_SLAB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
localeParamName, idParamName, descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName,
|
||||
amountRangeFromParamName, amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
|
||||
|
||||
public static final Set<String> INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
idParamName, descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName, amountRangeFromParamName,
|
||||
amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
|
||||
}
|
||||
+20
-1
@@ -19,9 +19,22 @@
|
||||
package org.apache.fineract.portfolio.interestratechart.api;
|
||||
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS;
|
||||
|
||||
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.amountRangeFromParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.amountRangeToParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.annualInterestRateParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.currencyCodeParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.descriptionParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.fromPeriodParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.incentivesParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.periodTypeParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.toPeriodParamName;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
@@ -43,6 +56,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants;
|
||||
import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabData;
|
||||
import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartSlabReadPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -59,6 +73,11 @@ public class InterestRateChartSlabsApiResource {
|
||||
private final DefaultToApiJsonSerializer<InterestRateChartSlabData> toApiJsonSerializer;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private static final Set<String> INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
InterestRateChartSlabApiConstants.localeParamName, InterestRateChartSlabApiConstants.idParamName,
|
||||
descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName, amountRangeFromParamName,
|
||||
amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
|
||||
|
||||
|
||||
@Autowired
|
||||
public InterestRateChartSlabsApiResource(final InterestRateChartSlabReadPlatformService interestRateChartSlabReadPlatformService,
|
||||
|
||||
+17
-6
@@ -18,7 +18,9 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.interestratechart.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
@@ -50,6 +52,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.chartSlabs;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.descriptionParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.endDateParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.fromDateParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.idParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.isPrimaryGroupingByAmountParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.nameParamName;
|
||||
|
||||
@Path("/interestratecharts")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@@ -60,6 +70,10 @@ public class InterestRateChartsApiResource {
|
||||
private final DefaultToApiJsonSerializer<InterestRateChartData> toApiJsonSerializer;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private static final Set<String> INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(InterestRateChartApiConstants.localeParamName,
|
||||
InterestRateChartApiConstants.dateFormatParamName, idParamName, nameParamName, descriptionParamName,
|
||||
fromDateParamName, endDateParamName, chartSlabs, isPrimaryGroupingByAmountParamName));
|
||||
|
||||
@Autowired
|
||||
public InterestRateChartsApiResource(final InterestRateChartReadPlatformService chartReadPlatformService,
|
||||
@@ -84,8 +98,7 @@ public class InterestRateChartsApiResource {
|
||||
InterestRateChartData chartData = this.chartReadPlatformService.template();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, chartData,
|
||||
InterestRateChartApiConstants.INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, chartData, INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -98,8 +111,7 @@ public class InterestRateChartsApiResource {
|
||||
Collection<InterestRateChartData> chartDatas = this.chartReadPlatformService.retrieveAllWithSlabs(productId);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, chartDatas,
|
||||
InterestRateChartApiConstants.INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, chartDatas, INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -123,8 +135,7 @@ public class InterestRateChartsApiResource {
|
||||
chartData = this.chartReadPlatformService.retrieveWithTemplate(chartData);
|
||||
}
|
||||
|
||||
return this.toApiJsonSerializer.serialize(settings, chartData,
|
||||
InterestRateChartApiConstants.INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, chartData, INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
||||
+12
-2
@@ -19,8 +19,6 @@
|
||||
package org.apache.fineract.portfolio.interestratechart.data;
|
||||
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.INCENTIVE_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.INTERESTRATE_INCENTIVE_CREATE_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.INTERESTRATE_INCENTIVE_UPDATE_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.amountParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.attributeNameParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.attributeValueParamName;
|
||||
@@ -32,9 +30,12 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartA
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -43,6 +44,7 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.common.domain.ConditionType;
|
||||
import org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants;
|
||||
import org.apache.fineract.portfolio.interestratechart.incentive.InterestIncentiveAttributeName;
|
||||
import org.apache.fineract.portfolio.interestratechart.incentive.InterestIncentiveEntityType;
|
||||
import org.apache.fineract.portfolio.interestratechart.incentive.InterestIncentiveType;
|
||||
@@ -58,6 +60,14 @@ public class InterestIncentiveDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
private static final Set<String> INTERESTRATE_INCENTIVE_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(InterestIncentiveApiConstants.idParamName, entityTypeParamName, attributeNameParamName,
|
||||
conditionTypeParamName, attributeValueParamName, incentiveTypeparamName, amountParamName));
|
||||
|
||||
private static final Set<String> INTERESTRATE_INCENTIVE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(InterestIncentiveApiConstants.idParamName, entityTypeParamName, attributeNameParamName,
|
||||
conditionTypeParamName, attributeValueParamName, incentiveTypeparamName, amountParamName));
|
||||
|
||||
@Autowired
|
||||
public InterestIncentiveDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
|
||||
+13
-2
@@ -18,9 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.interestratechart.data;
|
||||
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.INTERESTRATE_CHART_CREATE_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.INTERESTRATE_CHART_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.INTERESTRATE_CHART_UPDATE_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.chartSlabs;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.descriptionParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.endDateParamName;
|
||||
@@ -32,9 +30,12 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartA
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -42,6 +43,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -56,6 +58,15 @@ public class InterestRateChartDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private final InterestRateChartSlabDataValidator chartSlabDataValidator;
|
||||
private static final Set<String> INTERESTRATE_CHART_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
InterestRateChartApiConstants.localeParamName, InterestRateChartApiConstants.dateFormatParamName,
|
||||
nameParamName, descriptionParamName, fromDateParamName, endDateParamName, productIdParamName, chartSlabs,
|
||||
isPrimaryGroupingByAmountParamName));
|
||||
|
||||
private static final Set<String> INTERESTRATE_CHART_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
InterestRateChartApiConstants.localeParamName, InterestRateChartApiConstants.dateFormatParamName,
|
||||
idParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, chartSlabs,
|
||||
InterestRateChartApiConstants.deleteParamName, isPrimaryGroupingByAmountParamName));
|
||||
|
||||
@Autowired
|
||||
public InterestRateChartDataValidator(final FromJsonHelper fromApiJsonHelper,
|
||||
|
||||
+15
-2
@@ -18,9 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.interestratechart.data;
|
||||
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_CREATE_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_UPDATE_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.amountRangeFromParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.amountRangeToParamName;
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.annualInterestRateParamName;
|
||||
@@ -34,9 +32,12 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartS
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -46,6 +47,7 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
import org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants;
|
||||
import org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -59,6 +61,17 @@ public class InterestRateChartSlabDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private final InterestIncentiveDataValidator interestIncentiveDataValidator;
|
||||
private static final Set<String> INTERESTRATE_CHART_SLAB_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(InterestRateChartSlabApiConstants.localeParamName,
|
||||
InterestRateChartSlabApiConstants.idParamName, descriptionParamName, periodTypeParamName,
|
||||
fromPeriodParamName, toPeriodParamName, amountRangeFromParamName, amountRangeToParamName,
|
||||
annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
|
||||
|
||||
private static final Set<String> INTERESTRATE_CHART_SLAB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(InterestRateChartSlabApiConstants.localeParamName,
|
||||
InterestRateChartSlabApiConstants.idParamName, descriptionParamName, periodTypeParamName,
|
||||
fromPeriodParamName, toPeriodParamName, amountRangeFromParamName, amountRangeToParamName,
|
||||
annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
|
||||
|
||||
@Autowired
|
||||
public InterestRateChartSlabDataValidator(final FromJsonHelper fromApiJsonHelper,
|
||||
|
||||
+8
-2
@@ -48,6 +48,7 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.account.AccountDetailConstants;
|
||||
import org.apache.fineract.portfolio.account.PortfolioAccountType;
|
||||
import org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants;
|
||||
import org.apache.fineract.portfolio.account.data.PortfolioAccountDTO;
|
||||
@@ -68,11 +69,16 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
public class GuarantorsApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "loanId", "clientRelationshipType",
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "loanId",
|
||||
"clientRelationshipType",
|
||||
"guarantorType", "firstname", "lastname", "entityId", "externalId", "officeName", "joinedDate", "addressLine1", "addressLine2",
|
||||
"city", "state", "zip", "country", "mobileNumber", "housePhoneNumber", "comment", "dob", "guarantorTypeOptions",
|
||||
"allowedClientRelationshipTypes"));
|
||||
|
||||
private static final Set<String> ACCOUNT_TRANSFER_API_RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(AccountDetailConstants.idParamName, AccountTransfersApiConstants.transferDescriptionParamName,
|
||||
AccountTransfersApiConstants.currencyParamName));
|
||||
|
||||
private final String resourceNameForPermission = "GUARANTOR";
|
||||
|
||||
private final GuarantorReadPlatformService guarantorReadPlatformService;
|
||||
@@ -210,6 +216,6 @@ public class GuarantorsApiResource {
|
||||
}
|
||||
final GuarantorData guarantorData = GuarantorData.template(null, null, accountLinkingOptions);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.apiJsonSerializerService.serialize(settings, guarantorData, AccountTransfersApiConstants.RESPONSE_DATA_PARAMETERS);
|
||||
return this.apiJsonSerializerService.serialize(settings, guarantorData, ACCOUNT_TRANSFER_API_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
}
|
||||
-11
@@ -47,21 +47,10 @@ public class RescheduleLoansApiConstants {
|
||||
public static final String adjustedDueDateParamName = "adjustedDueDate";
|
||||
public static final String resheduleForMultiDisbursementNotSupportedErrorCode = "loan.reschedule.multidisbursement.error.code";
|
||||
public static final String resheduleWithInterestRecalculationNotSupportedErrorCode = "loan.reschedule.interestrecalculation.error.code";
|
||||
|
||||
public static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
|
||||
graceOnPrincipalParamName, recurringMoratoriumOnPrincipalPeriodsParamName, graceOnInterestParamName, extraTermsParamName, rescheduleFromDateParamName,
|
||||
newInterestRateParamName, rescheduleReasonIdParamName, rescheduleReasonCommentParamName, submittedOnDateParamName,
|
||||
loanIdParamName, adjustedDueDateParamName, recalculateInterestParamName));
|
||||
|
||||
// reject action request parameters
|
||||
public static final String rejectedOnDateParam = "rejectedOnDate";
|
||||
|
||||
public static final Set<String> REJECT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
|
||||
rejectedOnDateParam));
|
||||
|
||||
// approve action request parameters
|
||||
public static final String approvedOnDateParam = "approvedOnDate";
|
||||
|
||||
public static final Set<String> APPROVE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
|
||||
approvedOnDateParam));
|
||||
}
|
||||
|
||||
+26
-4
@@ -20,9 +20,12 @@ package org.apache.fineract.portfolio.loanaccount.rescheduleloan.data;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -47,6 +50,26 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class LoanRescheduleRequestDataValidator {
|
||||
|
||||
private final FromJsonHelper fromJsonHelper;
|
||||
private static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
RescheduleLoansApiConstants.localeParamName, RescheduleLoansApiConstants.dateFormatParamName,
|
||||
RescheduleLoansApiConstants.graceOnPrincipalParamName,
|
||||
RescheduleLoansApiConstants.recurringMoratoriumOnPrincipalPeriodsParamName,
|
||||
RescheduleLoansApiConstants.graceOnInterestParamName, RescheduleLoansApiConstants.extraTermsParamName,
|
||||
RescheduleLoansApiConstants.rescheduleFromDateParamName,
|
||||
RescheduleLoansApiConstants.newInterestRateParamName,
|
||||
RescheduleLoansApiConstants.rescheduleReasonIdParamName,
|
||||
RescheduleLoansApiConstants.rescheduleReasonCommentParamName,
|
||||
RescheduleLoansApiConstants.submittedOnDateParamName, RescheduleLoansApiConstants.loanIdParamName,
|
||||
RescheduleLoansApiConstants.adjustedDueDateParamName,
|
||||
RescheduleLoansApiConstants.recalculateInterestParamName));
|
||||
|
||||
private static final Set<String> REJECT_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(RescheduleLoansApiConstants.localeParamName, RescheduleLoansApiConstants.dateFormatParamName,
|
||||
RescheduleLoansApiConstants.rejectedOnDateParam));
|
||||
|
||||
private static final Set<String> APPROVE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(RescheduleLoansApiConstants.localeParamName, RescheduleLoansApiConstants.dateFormatParamName,
|
||||
RescheduleLoansApiConstants.approvedOnDateParam));
|
||||
|
||||
@Autowired
|
||||
public LoanRescheduleRequestDataValidator(FromJsonHelper fromJsonHelper) {
|
||||
@@ -68,7 +91,7 @@ public class LoanRescheduleRequestDataValidator {
|
||||
|
||||
final Type typeToken = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromJsonHelper
|
||||
.checkForUnsupportedParameters(typeToken, jsonString, RescheduleLoansApiConstants.CREATE_REQUEST_DATA_PARAMETERS);
|
||||
.checkForUnsupportedParameters(typeToken, jsonString, CREATE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors).resource(StringUtils
|
||||
@@ -199,8 +222,7 @@ public class LoanRescheduleRequestDataValidator {
|
||||
if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeToken = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString,
|
||||
RescheduleLoansApiConstants.APPROVE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, APPROVE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors).resource(StringUtils
|
||||
@@ -270,7 +292,7 @@ public class LoanRescheduleRequestDataValidator {
|
||||
|
||||
final Type typeToken = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromJsonHelper
|
||||
.checkForUnsupportedParameters(typeToken, jsonString, RescheduleLoansApiConstants.REJECT_REQUEST_DATA_PARAMETERS);
|
||||
.checkForUnsupportedParameters(typeToken, jsonString, REJECT_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors).resource(StringUtils
|
||||
|
||||
+6
-3
@@ -60,9 +60,12 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
|
||||
@Column(name = "grace_on_arrears_ageing", nullable = true)
|
||||
private Boolean graceOnArrearsAgeing;
|
||||
|
||||
public static String[] supportedloanConfigurableAttributes = { "amortizationType", "interestType", "transactionProcessingStrategyId",
|
||||
"interestCalculationPeriodType", "inArrearsTolerance", "repaymentEvery", "graceOnPrincipalAndInterestPayment",
|
||||
"graceOnArrearsAgeing" };
|
||||
private static final String[] supportedloanConfigurableAttributes = {LoanProductConstants.amortizationTypeParamName,
|
||||
LoanProductConstants.interestTypeParamName, LoanProductConstants.transactionProcessingStrategyIdParamName,
|
||||
LoanProductConstants.interestCalculationPeriodTypeParamName,
|
||||
LoanProductConstants.inArrearsToleranceParamName, LoanProductConstants.repaymentEveryParamName,
|
||||
LoanProductConstants.graceOnPrincipalAndInterestPaymentParamName,
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName};
|
||||
|
||||
public static LoanProductConfigurableAttributes createFrom(JsonCommand command) {
|
||||
|
||||
|
||||
+11
-4
@@ -110,6 +110,13 @@ public final class LoanProductDataValidator {
|
||||
LoanProductConstants.isCompoundingToBePostedAsTransactionParamName, LoanProductConstants.allowCompoundingOnEodParamName,
|
||||
LoanProductConstants.canUseForTopup));
|
||||
|
||||
private static final String[] supportedloanConfigurableAttributes = {LoanProductConstants.amortizationTypeParamName,
|
||||
LoanProductConstants.interestTypeParamName, LoanProductConstants.transactionProcessingStrategyIdParamName,
|
||||
LoanProductConstants.interestCalculationPeriodTypeParamName,
|
||||
LoanProductConstants.inArrearsToleranceParamName, LoanProductConstants.repaymentEveryParamName,
|
||||
LoanProductConstants.graceOnPrincipalAndInterestPaymentParamName,
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName};
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
@@ -686,18 +693,18 @@ public final class LoanProductDataValidator {
|
||||
|
||||
// Validate that parameter names are allowed
|
||||
Set<String> supportedConfigurableAttributes = new HashSet<>();
|
||||
Collections.addAll(supportedConfigurableAttributes, LoanProductConfigurableAttributes.supportedloanConfigurableAttributes);
|
||||
Collections.addAll(supportedConfigurableAttributes, supportedloanConfigurableAttributes);
|
||||
this.fromApiJsonHelper.checkForUnsupportedNestedParameters(LoanProductConstants.allowAttributeOverridesParamName, object,
|
||||
supportedConfigurableAttributes);
|
||||
|
||||
Integer length = LoanProductConfigurableAttributes.supportedloanConfigurableAttributes.length;
|
||||
Integer length = supportedloanConfigurableAttributes.length;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
/* Validate the attribute names */
|
||||
if (this.fromApiJsonHelper
|
||||
.parameterExists(LoanProductConfigurableAttributes.supportedloanConfigurableAttributes[i], object)) {
|
||||
.parameterExists(supportedloanConfigurableAttributes[i], object)) {
|
||||
Boolean loanConfigurationAttributeValue = this.fromApiJsonHelper.extractBooleanNamed(
|
||||
LoanProductConfigurableAttributes.supportedloanConfigurableAttributes[i], object);
|
||||
supportedloanConfigurableAttributes[i], object);
|
||||
/* Validate the boolean value */
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.allowAttributeOverridesParamName)
|
||||
.value(loanConfigurationAttributeValue).notNull().validateForBooleanValue();
|
||||
|
||||
-6
@@ -48,10 +48,4 @@ public class MeetingApiConstants {
|
||||
public static final String calendarData = "calendarData";
|
||||
public static final String attendanceTypeOptions = "attendanceTypeOptions";
|
||||
|
||||
public static final Set<String> MEETING_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(meetingDateParamName,
|
||||
localeParamName, dateFormatParamName, calendarIdParamName, clientsAttendanceParamName));
|
||||
|
||||
public static final Set<String> MEETING_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, meetingDateParamName,
|
||||
clientsAttendance, clients, calendarData, attendanceTypeOptions));
|
||||
|
||||
}
|
||||
+8
-1
@@ -19,9 +19,11 @@
|
||||
package org.apache.fineract.portfolio.meeting.api;
|
||||
|
||||
import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.MEETING_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.MEETING_RESPONSE_DATA_PARAMETERS;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
@@ -53,6 +55,7 @@ import org.apache.fineract.portfolio.calendar.exception.CalendarEntityTypeNotSup
|
||||
import org.apache.fineract.portfolio.calendar.service.CalendarReadPlatformService;
|
||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||
import org.apache.fineract.portfolio.client.service.ClientReadPlatformService;
|
||||
import org.apache.fineract.portfolio.meeting.MeetingApiConstants;
|
||||
import org.apache.fineract.portfolio.meeting.attendance.data.ClientAttendanceData;
|
||||
import org.apache.fineract.portfolio.meeting.attendance.service.AttendanceDropdownReadPlatformService;
|
||||
import org.apache.fineract.portfolio.meeting.attendance.service.ClientAttendanceReadPlatformService;
|
||||
@@ -78,6 +81,10 @@ public class MeetingsApiResource {
|
||||
private final DefaultToApiJsonSerializer<MeetingData> toApiJsonSerializer;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private static final Set<String> MEETING_RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(MeetingApiConstants.idParamName, MeetingApiConstants.meetingDateParamName,
|
||||
MeetingApiConstants.clientsAttendance, MeetingApiConstants.clients,
|
||||
MeetingApiConstants.calendarData, MeetingApiConstants.attendanceTypeOptions));
|
||||
|
||||
@Autowired
|
||||
public MeetingsApiResource(final PlatformSecurityContext context, final MeetingReadPlatformService readPlatformService,
|
||||
|
||||
+9
-2
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.meeting.data;
|
||||
|
||||
import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.MEETING_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.MEETING_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.attendanceTypeParamName;
|
||||
import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.calendarIdParamName;
|
||||
@@ -28,8 +27,11 @@ import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.meetingD
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -38,6 +40,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.meeting.MeetingApiConstants;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -50,7 +53,11 @@ import com.google.gson.reflect.TypeToken;
|
||||
@Component
|
||||
public class MeetingDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> MEETING_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(MeetingApiConstants.meetingDateParamName, MeetingApiConstants.localeParamName,
|
||||
MeetingApiConstants.dateFormatParamName, MeetingApiConstants.calendarIdParamName,
|
||||
MeetingApiConstants.clientsAttendanceParamName));
|
||||
|
||||
@Autowired
|
||||
public MeetingDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
|
||||
-4
@@ -37,8 +37,4 @@ public class PaymentDetailConstants {
|
||||
|
||||
// template related part of response
|
||||
public static final String officeOptionsParamName = "paymentTypeOptions";
|
||||
|
||||
public static final Set<String> PAYMENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(accountNumberParamName,
|
||||
checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName));
|
||||
|
||||
}
|
||||
+2
-7
@@ -34,11 +34,6 @@ public class PaymentTypeApiResourceConstants {
|
||||
public static final String ISCASHPAYMENT = "isCashPayment";
|
||||
public static final String POSITION = "position";
|
||||
|
||||
public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ID, NAME, DESCRIPTION, ISCASHPAYMENT));
|
||||
|
||||
public static final Set<String> CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(NAME, DESCRIPTION,
|
||||
ISCASHPAYMENT, POSITION));
|
||||
|
||||
public static final Set<String> UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(NAME, DESCRIPTION,
|
||||
ISCASHPAYMENT, POSITION));
|
||||
protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ID, NAME, DESCRIPTION,
|
||||
ISCASHPAYMENT));
|
||||
}
|
||||
|
||||
+13
-4
@@ -20,8 +20,11 @@ package org.apache.fineract.portfolio.paymenttype.data;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -40,6 +43,13 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class PaymentTypeDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(PaymentTypeApiResourceConstants.NAME, PaymentTypeApiResourceConstants.DESCRIPTION,
|
||||
PaymentTypeApiResourceConstants.ISCASHPAYMENT, PaymentTypeApiResourceConstants.POSITION));
|
||||
|
||||
private static final Set<String> UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(PaymentTypeApiResourceConstants.NAME, PaymentTypeApiResourceConstants.DESCRIPTION,
|
||||
PaymentTypeApiResourceConstants.ISCASHPAYMENT, PaymentTypeApiResourceConstants.POSITION));
|
||||
|
||||
@Autowired
|
||||
public PaymentTypeDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
@@ -51,8 +61,7 @@ public class PaymentTypeDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
PaymentTypeApiResourceConstants.CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
@@ -96,8 +105,8 @@ public class PaymentTypeDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
PaymentTypeApiResourceConstants.UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
|
||||
+20
-35
@@ -39,28 +39,28 @@ public class DepositsApiConstants {
|
||||
public static final String SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME = "savingsaccountcharge";
|
||||
|
||||
// deposit product actions
|
||||
public static String summitalAction = ".summital";
|
||||
public static String approvalAction = ".approval";
|
||||
public static String undoApprovalAction = ".undoApproval";
|
||||
public static String rejectAction = ".reject";
|
||||
public static String withdrawnByApplicantAction = ".withdrawnByApplicant";
|
||||
public static String activateAction = ".activate";
|
||||
public static String modifyApplicationAction = ".modify";
|
||||
public static String deleteApplicationAction = ".delete";
|
||||
public static String undoTransactionAction = ".undotransaction";
|
||||
public static String applyAnnualFeeTransactionAction = ".applyannualfee";
|
||||
public static String adjustTransactionAction = ".adjusttransaction";
|
||||
public static String closeAction = ".close";
|
||||
public static String preMatureCloseAction = ".preMatureClose";
|
||||
public static String payChargeTransactionAction = ".paycharge";
|
||||
public static String waiveChargeTransactionAction = ".waivecharge";
|
||||
public static final String summitalAction = ".summital";
|
||||
public static final String approvalAction = ".approval";
|
||||
public static final String undoApprovalAction = ".undoApproval";
|
||||
public static final String rejectAction = ".reject";
|
||||
public static final String withdrawnByApplicantAction = ".withdrawnByApplicant";
|
||||
public static final String activateAction = ".activate";
|
||||
public static final String modifyApplicationAction = ".modify";
|
||||
public static final String deleteApplicationAction = ".delete";
|
||||
public static final String undoTransactionAction = ".undotransaction";
|
||||
public static final String applyAnnualFeeTransactionAction = ".applyannualfee";
|
||||
public static final String adjustTransactionAction = ".adjusttransaction";
|
||||
public static final String closeAction = ".close";
|
||||
public static final String preMatureCloseAction = ".preMatureClose";
|
||||
public static final String payChargeTransactionAction = ".paycharge";
|
||||
public static final String waiveChargeTransactionAction = ".waivecharge";
|
||||
|
||||
// command
|
||||
public static String COMMAND_UNDO_TRANSACTION = "undo";
|
||||
public static String COMMAND_ADJUST_TRANSACTION = "modify";
|
||||
public static String COMMAND_WAIVE_CHARGE = "waive";
|
||||
public static String COMMAND_PAY_CHARGE = "paycharge";
|
||||
public static String UPDATE_DEPOSIT_AMOUNT = "updateDepositAmount";
|
||||
public static final String COMMAND_UNDO_TRANSACTION = "undo";
|
||||
public static final String COMMAND_ADJUST_TRANSACTION = "modify";
|
||||
public static final String COMMAND_WAIVE_CHARGE = "waive";
|
||||
public static final String COMMAND_PAY_CHARGE = "paycharge";
|
||||
public static final String UPDATE_DEPOSIT_AMOUNT = "updateDepositAmount";
|
||||
|
||||
// general
|
||||
public static final String localeParamName = "locale";
|
||||
@@ -345,13 +345,6 @@ public class DepositsApiConstants {
|
||||
return recurringDepositResponseData;
|
||||
}
|
||||
|
||||
public static final Set<String> DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, transactionDateParamName, transactionAmountParamName, paymentTypeIdParamName,
|
||||
transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName));
|
||||
|
||||
public static final Set<String> DEPOSIT_ACCOUNT_RECOMMENDED_DEPOSIT_AMOUNT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, mandatoryRecommendedDepositAmountParamName, effectiveDateParamName));
|
||||
|
||||
public static final Set<String> FIXED_DEPOSIT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
"accountId", accountNoParamName, "currency", "amount", dateParamName, paymentDetailDataParamName, runningBalanceParamName,
|
||||
reversedParamName));
|
||||
@@ -363,14 +356,6 @@ public class DepositsApiConstants {
|
||||
public static final Set<String> SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, activatedOnDateParamName));
|
||||
|
||||
public static final Set<String> DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, closedOnDateParamName, noteParamName, onAccountClosureIdParamName, paymentTypeIdParamName,
|
||||
transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName,
|
||||
transferDescriptionParamName, toSavingsAccountIdParamName));
|
||||
|
||||
public static final Set<String> DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
localeParamName, dateFormatParamName, closedOnDateParamName));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(chargeIdParamName,
|
||||
savingsAccountChargeIdParamName, chargeNameParamName, penaltyParamName, chargeTimeTypeParamName, dueAsOfDateParamName,
|
||||
chargeCalculationTypeParamName, percentageParamName, amountPercentageAppliedToParamName, currencyParamName,
|
||||
|
||||
+20
-125
@@ -35,28 +35,28 @@ public class SavingsApiConstants {
|
||||
|
||||
// actions
|
||||
public static final String postInterestValidationOnClosure = "postInterestValidationOnClosure";
|
||||
public static String summitalAction = ".summital";
|
||||
public static String approvalAction = ".approval";
|
||||
public static String undoApprovalAction = ".undoApproval";
|
||||
public static String rejectAction = ".reject";
|
||||
public static String withdrawnByApplicantAction = ".withdrawnByApplicant";
|
||||
public static String activateAction = ".activate";
|
||||
public static String modifyApplicationAction = ".modify";
|
||||
public static String deleteApplicationAction = ".delete";
|
||||
public static String undoTransactionAction = ".undotransaction";
|
||||
public static String applyAnnualFeeTransactionAction = ".applyannualfee";
|
||||
public static String adjustTransactionAction = ".adjusttransaction";
|
||||
public static String closeAction = ".close";
|
||||
public static String payChargeTransactionAction = ".paycharge";
|
||||
public static String waiveChargeTransactionAction = ".waivecharge";
|
||||
public static String updateMaturityDetailsAction = ".updateMaturityDetails";
|
||||
public static final String summitalAction = ".summital";
|
||||
public static final String approvalAction = ".approval";
|
||||
public static final String undoApprovalAction = ".undoApproval";
|
||||
public static final String rejectAction = ".reject";
|
||||
public static final String withdrawnByApplicantAction = ".withdrawnByApplicant";
|
||||
public static final String activateAction = ".activate";
|
||||
public static final String modifyApplicationAction = ".modify";
|
||||
public static final String deleteApplicationAction = ".delete";
|
||||
public static final String undoTransactionAction = ".undotransaction";
|
||||
public static final String applyAnnualFeeTransactionAction = ".applyannualfee";
|
||||
public static final String adjustTransactionAction = ".adjusttransaction";
|
||||
public static final String closeAction = ".close";
|
||||
public static final String payChargeTransactionAction = ".paycharge";
|
||||
public static final String waiveChargeTransactionAction = ".waivecharge";
|
||||
public static final String updateMaturityDetailsAction = ".updateMaturityDetails";
|
||||
|
||||
// command
|
||||
public static String COMMAND_UNDO_TRANSACTION = "undo";
|
||||
public static String COMMAND_ADJUST_TRANSACTION = "modify";
|
||||
public static String COMMAND_WAIVE_CHARGE = "waive";
|
||||
public static String COMMAND_PAY_CHARGE = "paycharge";
|
||||
public static String COMMAND_INACTIVATE_CHARGE = "inactivate";
|
||||
public static final String COMMAND_UNDO_TRANSACTION = "undo";
|
||||
public static final String COMMAND_ADJUST_TRANSACTION = "modify";
|
||||
public static final String COMMAND_WAIVE_CHARGE = "waive";
|
||||
public static final String COMMAND_PAY_CHARGE = "paycharge";
|
||||
public static final String COMMAND_INACTIVATE_CHARGE = "inactivate";
|
||||
|
||||
// general
|
||||
public static final String localeParamName = "locale";
|
||||
@@ -169,109 +169,4 @@ public class SavingsApiConstants {
|
||||
public static final String daysToEscheatParamName = "daysToEscheat";
|
||||
|
||||
public static final String datatables = "datatables";
|
||||
|
||||
|
||||
public static final Set<String> SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
monthDayFormatParamName, nameParamName, shortNameParamName, descriptionParamName, currencyCodeParamName,
|
||||
digitsAfterDecimalParamName, inMultiplesOfParamName, nominalAnnualInterestRateParamName,
|
||||
interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName,
|
||||
interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName,
|
||||
lockinPeriodFrequencyTypeParamName, withdrawalFeeAmountParamName, withdrawalFeeTypeParamName,
|
||||
withdrawalFeeForTransfersParamName, feeAmountParamName, feeOnMonthDayParamName, accountingRuleParamName, chargesParamName,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(),
|
||||
isDormancyTrackingActiveParamName, daysToDormancyParamName, daysToInactiveParamName, daysToEscheatParamName,
|
||||
allowOverdraftParamName, overdraftLimitParamName,
|
||||
nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName, minRequiredBalanceParamName,
|
||||
enforceMinRequiredBalanceParamName, minBalanceForInterestCalculationParamName, withHoldTaxParamName, taxGroupIdParamName));
|
||||
|
||||
/**
|
||||
* These parameters will match the class level parameters of
|
||||
* {@link SavingsProductData}. Where possible, we try to get response
|
||||
* parameters to match those of request parameters.
|
||||
*/
|
||||
public static final Set<String> SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName,
|
||||
shortNameParamName, descriptionParamName, "currency", digitsAfterDecimalParamName, inMultiplesOfParamName,
|
||||
nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName,
|
||||
interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName,
|
||||
lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName, withdrawalFeeAmountParamName, withdrawalFeeTypeParamName,
|
||||
withdrawalFeeForTransfersParamName, feeAmountParamName, feeOnMonthDayParamName, "currencyOptions",
|
||||
"interestCompoundingPeriodTypeOptions", "interestPostingPeriodTypeOptions", "interestCalculationTypeOptions",
|
||||
"interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions",
|
||||
nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName, withHoldTaxParamName,
|
||||
taxGroupIdParamName, isDormancyTrackingActiveParamName, daysToInactiveParamName, daysToDormancyParamName,
|
||||
daysToInactiveParamName));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, monthDayFormatParamName, staffIdParamName, accountNoParamName, externalIdParamName, clientIdParamName,
|
||||
groupIdParamName, productIdParamName, fieldOfficerIdParamName, submittedOnDateParamName, nominalAnnualInterestRateParamName,
|
||||
interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName,
|
||||
interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName,
|
||||
lockinPeriodFrequencyParamName,
|
||||
lockinPeriodFrequencyTypeParamName,
|
||||
// withdrawalFeeAmountParamName, withdrawalFeeTypeParamName,
|
||||
withdrawalFeeForTransfersParamName, feeAmountParamName, feeOnMonthDayParamName, chargesParamName, allowOverdraftParamName,
|
||||
overdraftLimitParamName, minRequiredBalanceParamName, enforceMinRequiredBalanceParamName,
|
||||
nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName, withHoldTaxParamName,datatables));
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public static final Set<String> SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, accountNoParamName,
|
||||
externalIdParamName, statusParamName, activatedOnDateParamName, staffIdParamName, clientIdParamName, "clientName",
|
||||
groupIdParamName, "groupName", "savingsProductId", "savingsProductName", "currency", nominalAnnualInterestRateParamName,
|
||||
interestCompoundingPeriodTypeParamName, interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName,
|
||||
minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
|
||||
withdrawalFeeAmountParamName, withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName, feeAmountParamName,
|
||||
feeOnMonthDayParamName, "summary", "transactions", "productOptions", "interestCompoundingPeriodTypeOptions",
|
||||
"interestPostingPeriodTypeOptions", "interestCalculationTypeOptions", "interestCalculationDaysInYearTypeOptions",
|
||||
"lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions", "withdrawalFee", "annualFee", onHoldFundsParamName,
|
||||
nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName, datatables));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, transactionDateParamName, transactionAmountParamName, paymentTypeIdParamName,
|
||||
transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName));
|
||||
|
||||
public static final Set<String> SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(idParamName, "accountId", accountNoParamName, "currency", "amount", dateParamName, paymentDetailDataParamName,
|
||||
runningBalanceParamName, reversedParamName));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
accountNoParamName));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, activatedOnDateParamName));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, closedOnDateParamName, noteParamName, paymentTypeIdParamName, withdrawBalanceParamName,
|
||||
transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName,
|
||||
postInterestValidationOnClosure));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(chargeIdParamName,
|
||||
savingsAccountChargeIdParamName, chargeNameParamName, penaltyParamName, chargeTimeTypeParamName, dueAsOfDateParamName,
|
||||
chargeCalculationTypeParamName, percentageParamName, amountPercentageAppliedToParamName, currencyParamName,
|
||||
amountWaivedParamName, amountWrittenOffParamName, amountOutstandingParamName, amountOrPercentageParamName, amountParamName,
|
||||
amountPaidParamName, chargeOptionsParamName));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(chargeIdParamName,
|
||||
amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName, feeOnMonthDayParamName, monthDayFormatParamName,
|
||||
feeIntervalParamName));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_ON_HOLD_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
amountParamName, onHoldTransactionTypeParamName, onHoldTransactionDateParamName, onHoldReversedParamName));
|
||||
}
|
||||
+2
-2
@@ -78,8 +78,8 @@ public class DepositAccountOnHoldFundTransactionsApiResource {
|
||||
savingsId, guarantorFundingId, searchParameters);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer
|
||||
.serialize(settings, transfers, SavingsApiConstants.SAVINGS_ACCOUNT_ON_HOLD_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, transfers,
|
||||
SavingsApiSetConstants.SAVINGS_ACCOUNT_ON_HOLD_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -101,7 +101,7 @@ public class FixedDepositAccountTransactionsApiResource {
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccount,
|
||||
SavingsApiConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
|
||||
SavingsApiSetConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ public class RecurringDepositAccountTransactionsApiResource {
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccount,
|
||||
SavingsApiConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
|
||||
SavingsApiSetConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
+5
-4
@@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.savings.api;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.COMMAND_INACTIVATE_CHARGE;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.COMMAND_PAY_CHARGE;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.COMMAND_WAIVE_CHARGE;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -106,7 +105,7 @@ public class SavingsAccountChargesApiResource {
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccountCharges,
|
||||
SavingsApiConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
|
||||
SavingsApiSetConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -121,7 +120,8 @@ public class SavingsAccountChargesApiResource {
|
||||
final SavingsAccountChargeData savingsAccountChargeTemplate = SavingsAccountChargeData.template(chargeOptions);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccountChargeTemplate, SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccountChargeTemplate,
|
||||
SavingsApiSetConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -137,7 +137,8 @@ public class SavingsAccountChargesApiResource {
|
||||
.retrieveSavingsAccountChargeDetails(savingsAccountChargeId, savingsAccountId);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccountCharge, SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccountCharge,
|
||||
SavingsApiSetConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
||||
+2
-2
@@ -104,7 +104,7 @@ public class SavingsAccountTransactionsApiResource {
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccount,
|
||||
SavingsApiConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
|
||||
SavingsApiSetConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -124,7 +124,7 @@ public class SavingsAccountTransactionsApiResource {
|
||||
}
|
||||
|
||||
return this.toApiJsonSerializer.serialize(settings, transactionData,
|
||||
SavingsApiConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
|
||||
SavingsApiSetConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
||||
+5
-3
@@ -103,7 +103,8 @@ public class SavingsAccountsApiResource {
|
||||
staffInSelectedOfficeOnly);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccount, SavingsApiConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccount,
|
||||
SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -122,7 +123,8 @@ public class SavingsAccountsApiResource {
|
||||
final Page<SavingsAccountData> products = this.savingsAccountReadPlatformService.retrieveAll(searchParameters);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, products, SavingsApiConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, products,
|
||||
SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -159,7 +161,7 @@ public class SavingsAccountsApiResource {
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters(),
|
||||
mandatoryResponseParameters);
|
||||
return this.toApiJsonSerializer.serialize(settings, savingsAccountTemplate,
|
||||
SavingsApiConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
||||
SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
private SavingsAccountData populateTemplateAndAssociations(final Long accountId, final SavingsAccountData savingsAccount,
|
||||
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.fineract.portfolio.savings.api;
|
||||
|
||||
import org.apache.fineract.portfolio.savings.SavingsApiConstants;
|
||||
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
|
||||
import org.apache.fineract.portfolio.savings.data.SavingsProductData;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class SavingsApiSetConstants extends SavingsApiConstants {
|
||||
|
||||
/**
|
||||
* These parameters will match the class level parameters of
|
||||
* {@link SavingsProductData}. Where possible, we try to get response
|
||||
* parameters to match those of request parameters.
|
||||
*/
|
||||
protected static final Set<String> SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
idParamName, nameParamName, shortNameParamName, descriptionParamName, "currency",
|
||||
digitsAfterDecimalParamName, inMultiplesOfParamName, nominalAnnualInterestRateParamName,
|
||||
interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName,
|
||||
interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName,
|
||||
minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
|
||||
withdrawalFeeAmountParamName, withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName,
|
||||
feeAmountParamName, feeOnMonthDayParamName, "currencyOptions", "interestCompoundingPeriodTypeOptions",
|
||||
"interestPostingPeriodTypeOptions", "interestCalculationTypeOptions",
|
||||
"interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions",
|
||||
nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName,
|
||||
withHoldTaxParamName, taxGroupIdParamName, isDormancyTrackingActiveParamName, daysToInactiveParamName,
|
||||
daysToDormancyParamName, daysToInactiveParamName));
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
protected static final Set<String> SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
|
||||
accountNoParamName, externalIdParamName, statusParamName, activatedOnDateParamName, staffIdParamName,
|
||||
clientIdParamName, "clientName", groupIdParamName, "groupName", "savingsProductId", "savingsProductName",
|
||||
"currency", nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName,
|
||||
interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName,
|
||||
minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
|
||||
withdrawalFeeAmountParamName, withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName,
|
||||
feeAmountParamName, feeOnMonthDayParamName, "summary", "transactions", "productOptions",
|
||||
"interestCompoundingPeriodTypeOptions", "interestPostingPeriodTypeOptions",
|
||||
"interestCalculationTypeOptions", "interestCalculationDaysInYearTypeOptions",
|
||||
"lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions", "withdrawalFee", "annualFee",
|
||||
onHoldFundsParamName, nominalAnnualInterestRateOverdraftParamName,
|
||||
minOverdraftForInterestCalculationParamName, datatables));
|
||||
|
||||
protected static final Set<String> SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(idParamName, "accountId", accountNoParamName, "currency", "amount", dateParamName,
|
||||
paymentDetailDataParamName, runningBalanceParamName, reversedParamName));
|
||||
|
||||
protected static final Set<String> SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(chargeIdParamName, savingsAccountChargeIdParamName, chargeNameParamName, penaltyParamName,
|
||||
chargeTimeTypeParamName, dueAsOfDateParamName, chargeCalculationTypeParamName, percentageParamName,
|
||||
amountPercentageAppliedToParamName, currencyParamName, amountWaivedParamName,
|
||||
amountWrittenOffParamName, amountOutstandingParamName, amountOrPercentageParamName, amountParamName,
|
||||
amountPaidParamName, chargeOptionsParamName));
|
||||
|
||||
protected static final Set<String> SAVINGS_ACCOUNT_ON_HOLD_RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(idParamName, amountParamName, onHoldTransactionTypeParamName, onHoldTransactionDateParamName,
|
||||
onHoldReversedParamName));
|
||||
}
|
||||
+6
-4
@@ -153,7 +153,8 @@ public class SavingsProductsApiResource {
|
||||
final Collection<SavingsProductData> products = this.savingProductReadPlatformService.retrieveAll();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, products, SavingsApiConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, products,
|
||||
SavingsApiSetConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -189,8 +190,8 @@ public class SavingsProductsApiResource {
|
||||
savingProductData = handleTemplateRelatedData(savingProductData);
|
||||
}
|
||||
|
||||
return this.toApiJsonSerializer
|
||||
.serialize(settings, savingProductData, SavingsApiConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, savingProductData,
|
||||
SavingsApiSetConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -204,7 +205,8 @@ public class SavingsProductsApiResource {
|
||||
final SavingsProductData savingProduct = handleTemplateRelatedData(null);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, savingProduct, SavingsApiConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, savingProduct,
|
||||
SavingsApiSetConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
private SavingsProductData handleTemplateRelatedData(final SavingsProductData savingsProduct) {
|
||||
|
||||
+30
-9
@@ -63,6 +63,27 @@ public class DepositAccountTransactionDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
private static final Set<String> DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
DepositsApiConstants.localeParamName, DepositsApiConstants.dateFormatParamName, transactionDateParamName,
|
||||
transactionAmountParamName, paymentTypeIdParamName, transactionAccountNumberParamName, checkNumberParamName,
|
||||
routingCodeParamName, receiptNumberParamName, bankNumberParamName));
|
||||
|
||||
private static final Set<String> DEPOSIT_ACCOUNT_RECOMMENDED_DEPOSIT_AMOUNT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(DepositsApiConstants.localeParamName, DepositsApiConstants.dateFormatParamName,
|
||||
DepositsApiConstants.mandatoryRecommendedDepositAmountParamName,
|
||||
DepositsApiConstants.effectiveDateParamName));
|
||||
|
||||
private static final Set<String> DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
DepositsApiConstants.localeParamName, DepositsApiConstants.dateFormatParamName, closedOnDateParamName,
|
||||
DepositsApiConstants.noteParamName, onAccountClosureIdParamName, paymentTypeIdParamName,
|
||||
transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName,
|
||||
bankNumberParamName, DepositsApiConstants.transferDescriptionParamName, toSavingsAccountIdParamName));
|
||||
|
||||
private static final Set<String> DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(DepositsApiConstants.localeParamName, DepositsApiConstants.dateFormatParamName,
|
||||
closedOnDateParamName));
|
||||
|
||||
|
||||
@Autowired
|
||||
public DepositAccountTransactionDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
@@ -75,8 +96,8 @@ public class DepositAccountTransactionDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
DepositsApiConstants.DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType
|
||||
@@ -110,8 +131,8 @@ public class DepositAccountTransactionDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
DepositsApiConstants.DEPOSIT_ACCOUNT_RECOMMENDED_DEPOSIT_AMOUNT_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
DEPOSIT_ACCOUNT_RECOMMENDED_DEPOSIT_AMOUNT_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -137,7 +158,7 @@ public class DepositAccountTransactionDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
SavingsApiConstants.SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS);
|
||||
SavingsAccountConstant.SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -156,8 +177,8 @@ public class DepositAccountTransactionDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
DepositsApiConstants.DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType
|
||||
@@ -177,8 +198,8 @@ public class DepositAccountTransactionDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
DepositsApiConstants.DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType
|
||||
|
||||
+4
-5
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.savings.data;
|
||||
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.amountParamName;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.chargeIdParamName;
|
||||
@@ -62,7 +60,8 @@ public class SavingsAccountChargeDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
SavingsAccountConstant.SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -92,7 +91,7 @@ public class SavingsAccountChargeDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsAccountConstant.SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -128,7 +127,7 @@ public class SavingsAccountChargeDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsAccountConstant.SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.fineract.portfolio.savings.data;
|
||||
|
||||
import org.apache.fineract.portfolio.savings.SavingsApiConstants;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class SavingsAccountConstant extends SavingsApiConstants {
|
||||
|
||||
/**
|
||||
* These parameters will match the class level parameters of
|
||||
* {@link SavingsProductData}. Where possible, we try to get response
|
||||
* parameters to match those of request parameters.
|
||||
*/
|
||||
protected static final Set<String> SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
localeParamName, dateFormatParamName, monthDayFormatParamName, staffIdParamName, accountNoParamName,
|
||||
externalIdParamName, clientIdParamName, groupIdParamName, productIdParamName, fieldOfficerIdParamName,
|
||||
submittedOnDateParamName, nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName,
|
||||
interestPostingPeriodTypeParamName, interestCalculationTypeParamName,
|
||||
interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName,
|
||||
lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
|
||||
// withdrawalFeeAmountParamName, withdrawalFeeTypeParamName,
|
||||
withdrawalFeeForTransfersParamName, feeAmountParamName, feeOnMonthDayParamName, chargesParamName,
|
||||
allowOverdraftParamName, overdraftLimitParamName, minRequiredBalanceParamName,
|
||||
enforceMinRequiredBalanceParamName, nominalAnnualInterestRateOverdraftParamName,
|
||||
minOverdraftForInterestCalculationParamName, withHoldTaxParamName, datatables));
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
protected static final Set<String> SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, transactionDateParamName, transactionAmountParamName,
|
||||
paymentTypeIdParamName, transactionAccountNumberParamName, checkNumberParamName,
|
||||
routingCodeParamName, receiptNumberParamName, bankNumberParamName));
|
||||
|
||||
protected static final Set<String> SAVINGS_ACCOUNT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(idParamName, accountNoParamName));
|
||||
|
||||
protected static final Set<String> SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(localeParamName, dateFormatParamName, activatedOnDateParamName));
|
||||
|
||||
protected static final Set<String> SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
localeParamName, dateFormatParamName, closedOnDateParamName, noteParamName, paymentTypeIdParamName,
|
||||
withdrawBalanceParamName, transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName,
|
||||
receiptNumberParamName, bankNumberParamName, postInterestValidationOnClosure));
|
||||
|
||||
protected static final Set<String> SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(chargeIdParamName, amountParamName, dueAsOfDateParamName, dateFormatParamName,
|
||||
localeParamName, feeOnMonthDayParamName, monthDayFormatParamName, feeIntervalParamName));
|
||||
|
||||
protected static final Set<String> SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName));
|
||||
|
||||
}
|
||||
+5
-2
@@ -66,6 +66,7 @@ import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodTyp
|
||||
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationDaysInYearType;
|
||||
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationType;
|
||||
import org.apache.fineract.portfolio.savings.SavingsPostingInterestPeriodType;
|
||||
import org.apache.fineract.portfolio.savings.api.SavingsApiSetConstants;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.MonthDay;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -91,7 +92,8 @@ public class SavingsAccountDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsApiConstants.SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
SavingsAccountConstant.SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -267,7 +269,8 @@ public class SavingsAccountDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsApiConstants.SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
SavingsAccountConstant.SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
|
||||
+3
-3
@@ -72,7 +72,7 @@ public class SavingsAccountTransactionDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
SavingsApiConstants.SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS);
|
||||
SavingsAccountConstant.SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -98,7 +98,7 @@ public class SavingsAccountTransactionDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
SavingsApiConstants.SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS);
|
||||
SavingsAccountConstant.SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -119,7 +119,7 @@ public class SavingsAccountTransactionDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
SavingsApiConstants.SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS);
|
||||
SavingsAccountConstant.SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
|
||||
+32
-1
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.savings.data;
|
||||
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_PRODUCT_RESOURCE_NAME;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.allowOverdraftParamName;
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.currencyCodeParamName;
|
||||
@@ -52,9 +51,12 @@ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.daysToEs
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
@@ -64,6 +66,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.savings.SavingsApiConstants;
|
||||
import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType;
|
||||
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationDaysInYearType;
|
||||
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationType;
|
||||
@@ -82,6 +85,34 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class SavingsProductDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(SavingsApiConstants.localeParamName, SavingsApiConstants.monthDayFormatParamName,
|
||||
nameParamName, shortNameParamName, descriptionParamName, currencyCodeParamName,
|
||||
digitsAfterDecimalParamName, inMultiplesOfParamName, nominalAnnualInterestRateParamName,
|
||||
interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName,
|
||||
interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName,
|
||||
minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName,
|
||||
lockinPeriodFrequencyTypeParamName, SavingsApiConstants.withdrawalFeeAmountParamName,
|
||||
SavingsApiConstants.withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName,
|
||||
feeAmountParamName, feeOnMonthDayParamName, SavingsApiConstants.accountingRuleParamName,
|
||||
SavingsApiConstants.chargesParamName, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(), isDormancyTrackingActiveParamName,
|
||||
daysToDormancyParamName, daysToInactiveParamName, daysToEscheatParamName, allowOverdraftParamName,
|
||||
overdraftLimitParamName, nominalAnnualInterestRateOverdraftParamName,
|
||||
minOverdraftForInterestCalculationParamName, SavingsApiConstants.minRequiredBalanceParamName,
|
||||
SavingsApiConstants.enforceMinRequiredBalanceParamName, minBalanceForInterestCalculationParamName,
|
||||
withHoldTaxParamName, taxGroupIdParamName));
|
||||
|
||||
@Autowired
|
||||
public SavingsProductDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
|
||||
+35
-6
@@ -22,8 +22,10 @@ import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -42,6 +44,34 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class AdHocQueryDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(AdHocQuerySearchConstants.entitiesParamName, AdHocQuerySearchConstants.loanStatusParamName,
|
||||
AdHocQuerySearchConstants.loanProductsParamName, AdHocQuerySearchConstants.officesParamName,
|
||||
AdHocQuerySearchConstants.loanDateOptionParamName, AdHocQuerySearchConstants.loanFromDateParamName,
|
||||
AdHocQuerySearchConstants.loanToDateParamName,
|
||||
AdHocQuerySearchConstants.includeOutStandingAmountPercentageParamName,
|
||||
AdHocQuerySearchConstants.outStandingAmountPercentageConditionParamName,
|
||||
AdHocQuerySearchConstants.minOutStandingAmountPercentageParamName,
|
||||
AdHocQuerySearchConstants.maxOutStandingAmountPercentageParamName,
|
||||
AdHocQuerySearchConstants.outStandingAmountPercentageParamName,
|
||||
AdHocQuerySearchConstants.includeOutstandingAmountParamName,
|
||||
AdHocQuerySearchConstants.outstandingAmountConditionParamName,
|
||||
AdHocQuerySearchConstants.minOutstandingAmountParamName,
|
||||
AdHocQuerySearchConstants.maxOutstandingAmountParamName,
|
||||
AdHocQuerySearchConstants.outstandingAmountParamName, AdHocQuerySearchConstants.localeParamName,
|
||||
AdHocQuerySearchConstants.dateFormatParamName));
|
||||
|
||||
private static final Set<String> AD_HOC_SEARCH_QUERY_CONDITIONS = new HashSet<>(
|
||||
Arrays.asList("between", "<=", ">=", "<", ">", "="));
|
||||
|
||||
private static final Object[] loanDateOptions = { AdHocQuerySearchConstants.approvalDateOption,
|
||||
AdHocQuerySearchConstants.createDateOption,
|
||||
AdHocQuerySearchConstants.disbursalDateOption };
|
||||
|
||||
private static final Object[] loanStatusOptions = {AdHocQuerySearchConstants.allLoanStatusOption,
|
||||
AdHocQuerySearchConstants.activeLoanStatusOption, AdHocQuerySearchConstants.overpaidLoanStatusOption,
|
||||
AdHocQuerySearchConstants.arrearsLoanStatusOption, AdHocQuerySearchConstants.closedLoanStatusOption,
|
||||
AdHocQuerySearchConstants.writeoffLoanStatusOption};
|
||||
|
||||
@Autowired
|
||||
public AdHocQueryDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
@@ -53,8 +83,7 @@ public class AdHocQueryDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
AdHocQuerySearchConstants.AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
@@ -71,7 +100,7 @@ public class AdHocQueryDataValidator {
|
||||
if (loanStatus != null && loanStatus.length > 0) {
|
||||
for (String status : loanStatus) {
|
||||
baseDataValidator.reset().parameter(AdHocQuerySearchConstants.loanStatusParamName).value(status)
|
||||
.isOneOfTheseValues(AdHocQuerySearchConstants.loanStatusOptions);
|
||||
.isOneOfTheseValues(loanStatusOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,7 +120,7 @@ public class AdHocQueryDataValidator {
|
||||
final String loanDateOption = this.fromApiJsonHelper.extractStringNamed(AdHocQuerySearchConstants.loanDateOptionParamName,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(AdHocQuerySearchConstants.loanDateOptionParamName).value(loanDateOption)
|
||||
.isOneOfTheseValues(AdHocQuerySearchConstants.loanDateOptions);
|
||||
.isOneOfTheseValues(loanDateOptions);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(AdHocQuerySearchConstants.loanFromDateParamName, element)) {
|
||||
@@ -118,7 +147,7 @@ public class AdHocQueryDataValidator {
|
||||
AdHocQuerySearchConstants.outStandingAmountPercentageConditionParamName, element);
|
||||
baseDataValidator.reset().parameter(AdHocQuerySearchConstants.outStandingAmountPercentageConditionParamName)
|
||||
.value(outStandingAmountPercentageCondition)
|
||||
.isNotOneOfTheseValues(AdHocQuerySearchConstants.AD_HOC_SEARCH_QUERY_CONDITIONS);
|
||||
.isNotOneOfTheseValues(AD_HOC_SEARCH_QUERY_CONDITIONS);
|
||||
if (outStandingAmountPercentageCondition.equals("between")) {
|
||||
final BigDecimal minOutStandingAmountPercentage = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(
|
||||
AdHocQuerySearchConstants.minOutStandingAmountPercentageParamName, element);
|
||||
@@ -151,7 +180,7 @@ public class AdHocQueryDataValidator {
|
||||
final String outstandingAmountCondition = this.fromApiJsonHelper.extractStringNamed(
|
||||
AdHocQuerySearchConstants.outstandingAmountConditionParamName, element);
|
||||
baseDataValidator.reset().parameter(AdHocQuerySearchConstants.outstandingAmountConditionParamName)
|
||||
.value(outstandingAmountCondition).isNotOneOfTheseValues(AdHocQuerySearchConstants.AD_HOC_SEARCH_QUERY_CONDITIONS);
|
||||
.value(outstandingAmountCondition).isNotOneOfTheseValues(AD_HOC_SEARCH_QUERY_CONDITIONS);
|
||||
if (outstandingAmountCondition.equals("between")) {
|
||||
final BigDecimal minOutstandingAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(
|
||||
AdHocQuerySearchConstants.minOutstandingAmountParamName, element);
|
||||
|
||||
+10
-11
@@ -46,18 +46,17 @@ public interface AdHocQuerySearchConstants {
|
||||
public static final String maxOutstandingAmountParamName = "maxOutstandingAmount";
|
||||
public static final String outstandingAmountParamName = "outstandingAmount";
|
||||
|
||||
public static final Set<String> AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(entitiesParamName, loanStatusParamName,
|
||||
loanProductsParamName, officesParamName, loanDateOptionParamName, loanFromDateParamName, loanToDateParamName,
|
||||
includeOutStandingAmountPercentageParamName, outStandingAmountPercentageConditionParamName,
|
||||
minOutStandingAmountPercentageParamName, maxOutStandingAmountPercentageParamName, outStandingAmountPercentageParamName,
|
||||
includeOutstandingAmountParamName, outstandingAmountConditionParamName, minOutstandingAmountParamName,
|
||||
maxOutstandingAmountParamName, outstandingAmountParamName, localeParamName, dateFormatParamName));
|
||||
public static final String approvalDateOption = "approvalDate";
|
||||
public static final String createDateOption = "createdDate";
|
||||
public static final String disbursalDateOption = "disbursalDate";
|
||||
|
||||
public static final Set<String> AD_HOC_SEARCH_QUERY_CONDITIONS = new HashSet<>(
|
||||
Arrays.asList("between", "<=", ">=", "<", ">", "="));
|
||||
|
||||
public static final Object[] loanDateOptions = { "approvalDate", "createdDate", "disbursalDate" };
|
||||
public static final String allLoanStatusOption= "all";
|
||||
public static final String activeLoanStatusOption= "active";
|
||||
public static final String overpaidLoanStatusOption= "overpaid";
|
||||
public static final String arrearsLoanStatusOption= "arrears";
|
||||
public static final String closedLoanStatusOption= "closed";
|
||||
public static final String writeoffLoanStatusOption= "writeoff";
|
||||
|
||||
public static final Object[] entityTypeOptions = { "clients", "groups", "loans", "clientIdentifiers" };
|
||||
public static final Object[] loanStatusOptions = { "all", "active", "overpaid", "arrears", "closed", "writeoff" };
|
||||
|
||||
}
|
||||
|
||||
-14
@@ -36,18 +36,4 @@ public interface SelfBeneficiariesTPTApiConstants {
|
||||
public static final String ID_PARAM_NAME = "id";
|
||||
public static final String CLIENT_NAME_PARAM_NAME = "clientName";
|
||||
public static final String ACCOUNT_TYPE_OPTIONS_PARAM_NAME = "accountTypeOptions";
|
||||
|
||||
public static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(LOCALE, NAME_PARAM_NAME, OFFICE_NAME_PARAM_NAME,
|
||||
ACCOUNT_NUMBER_PARAM_NAME, ACCOUNT_TYPE_PARAM_NAME,
|
||||
TRANSFER_LIMIT_PARAM_NAME));
|
||||
|
||||
public static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(NAME_PARAM_NAME, TRANSFER_LIMIT_PARAM_NAME));
|
||||
|
||||
public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(NAME_PARAM_NAME, OFFICE_NAME_PARAM_NAME,
|
||||
ACCOUNT_NUMBER_PARAM_NAME, ACCOUNT_TYPE_PARAM_NAME,
|
||||
TRANSFER_LIMIT_PARAM_NAME, ID_PARAM_NAME,
|
||||
CLIENT_NAME_PARAM_NAME, ACCOUNT_TYPE_OPTIONS_PARAM_NAME));
|
||||
}
|
||||
|
||||
+11
-4
@@ -20,6 +20,8 @@ package org.apache.fineract.portfolio.self.account.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
@@ -60,6 +62,13 @@ public class SelfBeneficiariesTPTApiResource {
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private final SelfBeneficiariesTPTReadPlatformService readPlatformService;
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
SelfBeneficiariesTPTApiConstants.NAME_PARAM_NAME, SelfBeneficiariesTPTApiConstants.OFFICE_NAME_PARAM_NAME,
|
||||
SelfBeneficiariesTPTApiConstants.ACCOUNT_NUMBER_PARAM_NAME,
|
||||
SelfBeneficiariesTPTApiConstants.ACCOUNT_TYPE_PARAM_NAME,
|
||||
SelfBeneficiariesTPTApiConstants.TRANSFER_LIMIT_PARAM_NAME, SelfBeneficiariesTPTApiConstants.ID_PARAM_NAME,
|
||||
SelfBeneficiariesTPTApiConstants.CLIENT_NAME_PARAM_NAME,
|
||||
SelfBeneficiariesTPTApiConstants.ACCOUNT_TYPE_OPTIONS_PARAM_NAME));
|
||||
|
||||
@Autowired
|
||||
public SelfBeneficiariesTPTApiResource(
|
||||
@@ -94,8 +103,7 @@ public class SelfBeneficiariesTPTApiResource {
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
|
||||
.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, templateData,
|
||||
SelfBeneficiariesTPTApiConstants.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, templateData, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -154,8 +162,7 @@ public class SelfBeneficiariesTPTApiResource {
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
|
||||
.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, beneficiaries,
|
||||
SelfBeneficiariesTPTApiConstants.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, beneficiaries, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+11
-2
@@ -24,14 +24,15 @@ import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTP
|
||||
import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants.ACCOUNT_TYPE_PARAM_NAME;
|
||||
import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants.ACCOUNT_NUMBER_PARAM_NAME;
|
||||
import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants.TRANSFER_LIMIT_PARAM_NAME;
|
||||
import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants.CREATE_REQUEST_DATA_PARAMETERS;
|
||||
import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants.UPDATE_REQUEST_DATA_PARAMETERS;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -40,6 +41,7 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.account.PortfolioAccountType;
|
||||
import org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -50,6 +52,13 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class SelfBeneficiariesTPTDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(SelfBeneficiariesTPTApiConstants.LOCALE, NAME_PARAM_NAME, OFFICE_NAME_PARAM_NAME,
|
||||
ACCOUNT_NUMBER_PARAM_NAME, ACCOUNT_TYPE_PARAM_NAME, TRANSFER_LIMIT_PARAM_NAME));
|
||||
|
||||
private static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(NAME_PARAM_NAME, TRANSFER_LIMIT_PARAM_NAME));
|
||||
|
||||
|
||||
@Autowired
|
||||
public SelfBeneficiariesTPTDataValidator(
|
||||
|
||||
+29
-8
@@ -21,6 +21,7 @@ package org.apache.fineract.portfolio.shareaccounts.serialization;
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -89,6 +90,26 @@ public class ShareAccountDataSerializer {
|
||||
private final ShareProductRepositoryWrapper shareProductRepository;
|
||||
|
||||
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService ;
|
||||
|
||||
private static final Set<String> approvalParameters = new HashSet<>(Arrays.asList(ShareAccountApiConstants
|
||||
.locale_paramname,
|
||||
ShareAccountApiConstants.dateformat_paramname, ShareAccountApiConstants.approveddate_paramname,
|
||||
ShareAccountApiConstants.note_paramname));
|
||||
|
||||
private static final Set<String> activateParameters = new HashSet<>(Arrays.asList(ShareAccountApiConstants
|
||||
.locale_paramname,
|
||||
ShareAccountApiConstants.dateformat_paramname, ShareAccountApiConstants.activatedate_paramname));
|
||||
|
||||
private static final Set<String> closeParameters = new HashSet<>(Arrays.asList(ShareAccountApiConstants
|
||||
.locale_paramname,
|
||||
ShareAccountApiConstants.dateformat_paramname, ShareAccountApiConstants.closeddate_paramname,
|
||||
ShareAccountApiConstants.note_paramname));
|
||||
|
||||
private static final Set<String> addtionalSharesParameters = new HashSet<>(Arrays.asList(ShareAccountApiConstants
|
||||
.locale_paramname,
|
||||
ShareAccountApiConstants.requesteddate_paramname, ShareAccountApiConstants.requestedshares_paramname,
|
||||
ShareAccountApiConstants.purchasedprice_paramname, ShareAccountApiConstants.dateformat_paramname));
|
||||
|
||||
|
||||
@Autowired
|
||||
public ShareAccountDataSerializer(final PlatformSecurityContext platformSecurityContext, final FromJsonHelper fromApiJsonHelper,
|
||||
@@ -426,7 +447,7 @@ public class ShareAccountDataSerializer {
|
||||
Map<String, Object> actualChanges = new HashMap<>();
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), ShareAccountApiConstants.approvalParameters);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), approvalParameters);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
|
||||
JsonElement element = jsonCommand.parsedJson();
|
||||
@@ -498,7 +519,7 @@ public class ShareAccountDataSerializer {
|
||||
Map<String, Object> actualChanges = new HashMap<>();
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), ShareAccountApiConstants.activateParameters);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), activateParameters);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
|
||||
if(!account.status().equals(ShareAccountStatusType.APPROVED.getValue())) {
|
||||
@@ -552,7 +573,7 @@ public class ShareAccountDataSerializer {
|
||||
Map<String, Object> actualChanges = new HashMap<>();
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), ShareAccountApiConstants.activateParameters);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), activateParameters);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
|
||||
JsonElement element = jsonCommand.parsedJson();
|
||||
@@ -633,7 +654,7 @@ public class ShareAccountDataSerializer {
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
|
||||
ShareAccountApiConstants.addtionalSharesParameters);
|
||||
addtionalSharesParameters);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
|
||||
JsonElement element = jsonCommand.parsedJson();
|
||||
@@ -697,7 +718,7 @@ public class ShareAccountDataSerializer {
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
|
||||
ShareAccountApiConstants.addtionalSharesParameters);
|
||||
addtionalSharesParameters);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
|
||||
JsonElement element = jsonCommand.parsedJson();
|
||||
@@ -747,7 +768,7 @@ public class ShareAccountDataSerializer {
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
|
||||
ShareAccountApiConstants.addtionalSharesParameters);
|
||||
addtionalSharesParameters);
|
||||
JsonElement element = jsonCommand.parsedJson();
|
||||
final ArrayList<Long> purchasedShares = new ArrayList<>();
|
||||
if (this.fromApiJsonHelper.parameterExists(ShareAccountApiConstants.requestedshares_paramname, element)) {
|
||||
@@ -792,7 +813,7 @@ public class ShareAccountDataSerializer {
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
|
||||
ShareAccountApiConstants.addtionalSharesParameters);
|
||||
addtionalSharesParameters);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
|
||||
JsonElement element = jsonCommand.parsedJson();
|
||||
@@ -938,7 +959,7 @@ public class ShareAccountDataSerializer {
|
||||
Map<String, Object> actualChanges = new HashMap<>();
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), ShareAccountApiConstants.closeParameters);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), closeParameters);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
|
||||
JsonElement element = jsonCommand.parsedJson();
|
||||
|
||||
-15
@@ -65,19 +65,4 @@ public interface ShareProductApiConstants {
|
||||
|
||||
String accountingRuleParamName = "accountingRule";
|
||||
|
||||
Set<String> supportedParametersForCreate = new HashSet<>(Arrays.asList(locale_paramname, name_paramname, shortname_paramname,
|
||||
shortname_paramname, description_paramname, externalid_paramname, totalshares_paramname, currency_paramname,
|
||||
digitsafterdecimal_paramname, digitsafterdecimal_paramname, inmultiplesof_paramname, totalsharesissued_paramname,
|
||||
unitprice_paramname, minimumshares_paramname, nominaltshares_paramname, maximumshares_paramname, marketprice_paramname,
|
||||
charges_paramname, allowdividendcalculationforinactiveclients_paramname, lockperiod_paramname,
|
||||
lockinperiodfrequencytype_paramname, minimumactiveperiodfordividends_paramname, minimumactiveperiodfrequencytype_paramname,
|
||||
sharecapital_paramname, accountingRuleParamName,
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(),
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(),
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue()));
|
||||
|
||||
Set<String> supportedParametersForDivident = new HashSet<>(Arrays.asList(locale_paramname, dateFormatParamName,
|
||||
dividendPeriodStartDateParamName, dividendPeriodEndDateParamName, dividendAmountParamName));
|
||||
|
||||
}
|
||||
|
||||
+33
-7
@@ -21,6 +21,7 @@ package org.apache.fineract.portfolio.shareproducts.serialization;
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -29,6 +30,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -39,7 +41,6 @@ import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.portfolio.accounts.constants.ShareAccountApiConstants;
|
||||
import org.apache.fineract.portfolio.charge.domain.Charge;
|
||||
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
@@ -67,6 +68,31 @@ public class ShareProductDataSerializer {
|
||||
private final ChargeRepositoryWrapper chargeRepository;
|
||||
|
||||
private final PlatformSecurityContext platformSecurityContext;
|
||||
private static final Set<String> supportedParametersForCreate = new HashSet<>(Arrays.asList(
|
||||
ShareProductApiConstants.locale_paramname, ShareProductApiConstants.name_paramname,
|
||||
ShareProductApiConstants.shortname_paramname, ShareProductApiConstants.shortname_paramname,
|
||||
ShareProductApiConstants.description_paramname, ShareProductApiConstants.externalid_paramname,
|
||||
ShareProductApiConstants.totalshares_paramname, ShareProductApiConstants.currency_paramname,
|
||||
ShareProductApiConstants.digitsafterdecimal_paramname,
|
||||
ShareProductApiConstants.digitsafterdecimal_paramname, ShareProductApiConstants.inmultiplesof_paramname,
|
||||
ShareProductApiConstants.totalsharesissued_paramname, ShareProductApiConstants.unitprice_paramname,
|
||||
ShareProductApiConstants.minimumshares_paramname, ShareProductApiConstants.nominaltshares_paramname,
|
||||
ShareProductApiConstants.maximumshares_paramname, ShareProductApiConstants.marketprice_paramname,
|
||||
ShareProductApiConstants.charges_paramname,
|
||||
ShareProductApiConstants.allowdividendcalculationforinactiveclients_paramname,
|
||||
ShareProductApiConstants.lockperiod_paramname, ShareProductApiConstants.lockinperiodfrequencytype_paramname,
|
||||
ShareProductApiConstants.minimumactiveperiodfordividends_paramname,
|
||||
ShareProductApiConstants.minimumactiveperiodfrequencytype_paramname,
|
||||
ShareProductApiConstants.sharecapital_paramname, ShareProductApiConstants.accountingRuleParamName,
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(),
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(),
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue()));
|
||||
|
||||
private static final Set<String> supportedParametersForDivident = new HashSet<>(Arrays.asList(
|
||||
ShareProductApiConstants.locale_paramname, ShareProductApiConstants.dateFormatParamName,
|
||||
ShareProductApiConstants.dividendPeriodStartDateParamName,
|
||||
ShareProductApiConstants.dividendPeriodEndDateParamName, ShareProductApiConstants.dividendAmountParamName));
|
||||
|
||||
@Autowired
|
||||
public ShareProductDataSerializer(final FromJsonHelper fromApiJsonHelper, final ChargeRepositoryWrapper chargeRepository,
|
||||
@@ -79,8 +105,8 @@ public class ShareProductDataSerializer {
|
||||
public ShareProduct validateAndCreate(JsonCommand jsonCommand) {
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
|
||||
ShareProductApiConstants.supportedParametersForCreate);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
|
||||
supportedParametersForCreate);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesproduct");
|
||||
@@ -248,8 +274,8 @@ public class ShareProductDataSerializer {
|
||||
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
|
||||
ShareProductApiConstants.supportedParametersForCreate);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
|
||||
supportedParametersForCreate);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesproduct");
|
||||
@@ -447,8 +473,8 @@ public class ShareProductDataSerializer {
|
||||
public void validateDividendDetails(JsonCommand jsonCommand) {
|
||||
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
|
||||
ShareProductApiConstants.supportedParametersForDivident);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
|
||||
supportedParametersForDivident);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
|
||||
-17
@@ -38,21 +38,4 @@ public class TransferApiConstants {
|
||||
public static final String destinationOfficeIdParamName = "destinationOfficeId";
|
||||
public static final String note = "note";
|
||||
|
||||
public static final Set<String> TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, destinationGroupIdParamName, clients, inheritDestinationGroupLoanOfficer, newStaffIdParamName,
|
||||
transferActiveLoans));
|
||||
|
||||
public static final Set<String> PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, destinationOfficeIdParamName, transferActiveLoans, note));
|
||||
|
||||
public static final Set<String> ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(newStaffIdParamName,
|
||||
destinationGroupIdParamName, note));
|
||||
|
||||
public static final Set<String> PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, destinationOfficeIdParamName, transferActiveLoans, newStaffIdParamName, destinationGroupIdParamName, note));
|
||||
|
||||
public static final Set<String> REJECT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(note));
|
||||
|
||||
public static final Set<String> WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(note));
|
||||
|
||||
}
|
||||
+36
-8
@@ -20,8 +20,11 @@ package org.apache.fineract.portfolio.transfer.data;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -42,6 +45,32 @@ import com.google.gson.reflect.TypeToken;
|
||||
public final class TransfersDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(TransferApiConstants.localeParamName, TransferApiConstants.dateFormatParamName,
|
||||
TransferApiConstants.destinationGroupIdParamName, TransferApiConstants.clients,
|
||||
TransferApiConstants.inheritDestinationGroupLoanOfficer, TransferApiConstants.newStaffIdParamName,
|
||||
TransferApiConstants.transferActiveLoans));
|
||||
|
||||
private static final Set<String> PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(TransferApiConstants.localeParamName, TransferApiConstants.dateFormatParamName,
|
||||
TransferApiConstants.destinationOfficeIdParamName, TransferApiConstants.transferActiveLoans,
|
||||
TransferApiConstants.note));
|
||||
|
||||
private static final Set<String> ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(TransferApiConstants.newStaffIdParamName, TransferApiConstants.destinationGroupIdParamName,
|
||||
TransferApiConstants.note));
|
||||
|
||||
private static final Set<String> PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(TransferApiConstants.localeParamName, TransferApiConstants.dateFormatParamName,
|
||||
TransferApiConstants.destinationOfficeIdParamName, TransferApiConstants.transferActiveLoans,
|
||||
TransferApiConstants.newStaffIdParamName, TransferApiConstants.destinationGroupIdParamName,
|
||||
TransferApiConstants.note));
|
||||
|
||||
private static final Set<String> REJECT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(TransferApiConstants.note));
|
||||
|
||||
private static final Set<String> WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(TransferApiConstants.note));
|
||||
|
||||
@Autowired
|
||||
public TransfersDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
@@ -57,8 +86,8 @@ public final class TransfersDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
TransferApiConstants.TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
@@ -91,7 +120,7 @@ public final class TransfersDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
@@ -113,7 +142,7 @@ public final class TransfersDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -142,8 +171,7 @@ public final class TransfersDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
TransferApiConstants.PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -177,7 +205,7 @@ public final class TransfersDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.REJECT_CLIENT_TRANSFER_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REJECT_CLIENT_TRANSFER_DATA_PARAMETERS);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
@@ -194,7 +222,7 @@ public final class TransfersDataValidator {
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper
|
||||
.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS);
|
||||
.checkForUnsupportedParameters(typeOfMap, json, WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
|
||||
+2
-3
@@ -37,8 +37,7 @@ public class PasswordPreferencesApiConstants {
|
||||
// request parameters
|
||||
public static final String VALIDATION_POLICY_ID = "validationPolicyId";
|
||||
|
||||
public static final Set<String> REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(VALIDATION_POLICY_ID));
|
||||
|
||||
public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ID_PARAM_NAME, ACTIVE, DESCRIPTION));
|
||||
protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ID_PARAM_NAME, ACTIVE,
|
||||
DESCRIPTION));
|
||||
|
||||
}
|
||||
|
||||
+7
-2
@@ -20,8 +20,11 @@ package org.apache.fineract.useradministration.data;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -39,7 +42,9 @@ import com.google.gson.reflect.TypeToken;
|
||||
@Component
|
||||
public class PasswordPreferencesDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(PasswordPreferencesApiConstants.VALIDATION_POLICY_ID));
|
||||
|
||||
@Autowired
|
||||
public PasswordPreferencesDataValidator(FromJsonHelper fromApiJsonHelper) {
|
||||
@@ -50,7 +55,7 @@ public class PasswordPreferencesDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, PasswordPreferencesApiConstants.REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REQUEST_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user