You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by na...@apache.org on 2017/06/16 14:51:00 UTC
[2/6] fineract git commit: Completed the sonar fixes in FINERATC-436
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java
index 2d0893a..e982b92 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java
@@ -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) {
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
index e0a3f2e..8eb132c 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
@@ -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();
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/MeetingApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/MeetingApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/MeetingApiConstants.java
index 51e281c..5d2ad97 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/MeetingApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/MeetingApiConstants.java
@@ -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));
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
index b3d551d..4614dba 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
@@ -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,
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java
index abbd12e..63b04e9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java
@@ -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) {
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/PaymentDetailConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/PaymentDetailConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/PaymentDetailConstants.java
index cf8e081..e284ebf 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/PaymentDetailConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/PaymentDetailConstants.java
@@ -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));
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java
index a3e67ff..25a5261 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java
@@ -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));
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java
index a476849..dd79f9d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java
@@ -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);
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java
index 7bebd27..c886128 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java
@@ -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,
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
index 6efa899..7416831 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
@@ -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));
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
index 8f7ae4f..f84eb19 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
@@ -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);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
index 354ffae..fadf019 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
@@ -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
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
index 13ba320..24353c7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
@@ -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
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
index ae767ac..78bd349 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
@@ -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
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
index db2bfd6..5204db2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
@@ -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
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
index dadcdca..8a3ecc1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
@@ -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,
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsApiSetConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsApiSetConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsApiSetConstants.java
new file mode 100644
index 0000000..70ac7b4
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsApiSetConstants.java
@@ -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));
+}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
index 843013a..016aaae 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
@@ -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) {
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java
index 7353083..e20641a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java
@@ -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
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java
index 3c3c6dc..69d5d62 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java
@@ -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)
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountConstant.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountConstant.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountConstant.java
new file mode 100644
index 0000000..7325966
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountConstant.java
@@ -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));
+
+}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java
index 4cc6e89..a84cb29 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java
@@ -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)
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java
index ca855b6..936ba9d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java
@@ -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)
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
index 94f0252..4422fd0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
@@ -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) {
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java
index efa8ea8..29d8f10 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java
@@ -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);