FINERACT-821 Made changes to enforce ConstantName Checkstyle (1)

This commit is contained in:
Manthan Surkar
2020-06-03 22:13:19 +02:00
committed by Michael Vorburger ⛑️
parent 3521b0ed33
commit 9cda5f984a
18 changed files with 184 additions and 184 deletions
@@ -106,13 +106,13 @@ public class AccountTransferTest {
/*** Create A Financial Activity to Account Mapping **/
financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
FinancialActivityAccountsTest.liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(),
FinancialActivityAccountsTest.LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(),
responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(financialActivityAccountId);
} else {
for (HashMap financialActivity : financialActivities) {
HashMap financialActivityData = (HashMap) financialActivity.get("financialActivityData");
if (financialActivityData.get("id").equals(FinancialActivityAccountsTest.liabilityTransferFinancialActivityId)) {
if (financialActivityData.get("id").equals(FinancialActivityAccountsTest.LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID)) {
HashMap glAccountData = (HashMap) financialActivity.get("glAccountData");
liabilityTransferAccount = new Account((Integer) glAccountData.get("id"), AccountType.LIABILITY);
financialActivityAccountId = (Integer) financialActivity.get("id");
@@ -562,7 +562,7 @@ public class ClientSavingsIntegrationTest {
assertEquals("validation.msg.savingsaccountcharge.inactivation.of.charge.not.allowed.when.charge.is.due", savingsAccountErrorData
.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.dateFormat, Locale.US);
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.DATE_FORMAT, Locale.US);
Calendar cal = Calendar.getInstance();
List dates = (List) savingsChargeForPay.get("dueDate");
cal.set(Calendar.YEAR, (Integer) dates.get(0));
@@ -51,7 +51,7 @@ public class FinancialActivityAccountsTest {
private AccountHelper accountHelper;
private FinancialActivityAccountHelper financialActivityAccountHelper;
private final Integer assetTransferFinancialActivityId = FinancialActivity.ASSET_TRANSFER.getValue();
public static final Integer liabilityTransferFinancialActivityId = FinancialActivity.LIABILITY_TRANSFER.getValue();
public static final Integer LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID = FinancialActivity.LIABILITY_TRANSFER.getValue();
@Before
public void setup() {
@@ -78,7 +78,7 @@ public class FinancialActivityAccountsTest {
/*** Create A Financial Activity to Account Mapping **/
Integer financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(), responseSpec,
LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(), responseSpec,
CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(financialActivityAccountId);
@@ -86,7 +86,7 @@ public class FinancialActivityAccountsTest {
* Fetch Created Financial Activity to Account Mapping and validate
* created values
**/
assertFinancialActivityAccountCreation(financialActivityAccountId, liabilityTransferFinancialActivityId, liabilityTransferAccount);
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount);
/**
* Update Existing Financial Activity to Account Mapping and assert
@@ -96,12 +96,12 @@ public class FinancialActivityAccountsTest {
Assert.assertNotNull(newLiabilityTransferAccount);
HashMap changes = (HashMap) financialActivityAccountHelper.updateFinancialActivityAccount(financialActivityAccountId,
liabilityTransferFinancialActivityId, newLiabilityTransferAccount.getAccountID(), responseSpec,
LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, newLiabilityTransferAccount.getAccountID(), responseSpec,
CommonConstants.RESPONSE_CHANGES);
Assert.assertEquals(newLiabilityTransferAccount.getAccountID(), changes.get("glAccountId"));
/** Validate update works correctly **/
assertFinancialActivityAccountCreation(financialActivityAccountId, liabilityTransferFinancialActivityId,
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID,
newLiabilityTransferAccount);
/** Update with Invalid Financial Activity should fail **/
@@ -113,7 +113,7 @@ public class FinancialActivityAccountsTest {
/** Creating Duplicate Financial Activity should fail **/
List<HashMap> duplicateFinancialActivityAccountError = (List<HashMap>) financialActivityAccountHelper
.createFinancialActivityAccount(liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(),
.createFinancialActivityAccount(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(),
responseSpecForDomainRuleViolation, CommonConstants.RESPONSE_ERROR);
assertEquals(DuplicateFinancialActivityAccountFoundException.getErrorcode(),
duplicateFinancialActivityAccountError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
@@ -2659,7 +2659,7 @@ public class FixedDepositTest {
}
private Account getMappedLiabilityFinancialAccount() {
final Integer liabilityTransferFinancialActivityId = FinancialActivity.LIABILITY_TRANSFER.getValue();
final Integer LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID = FinancialActivity.LIABILITY_TRANSFER.getValue();
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
final Account financialAccount;
/***
@@ -2667,7 +2667,7 @@ public class FixedDepositTest {
* liability financial accounting mappings
*/
if (financialActivities.isEmpty()) {
financialAccount = createLiabilityFinancialAccountTransferType(liabilityTransferFinancialActivityId);
financialAccount = createLiabilityFinancialAccountTransferType(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID);
} else {
/***
* extract mapped liability financial account
@@ -2675,7 +2675,7 @@ public class FixedDepositTest {
Account mappedLiabilityAccount = null;
for (HashMap financialActivity : financialActivities) {
HashMap financialActivityData = (HashMap) financialActivity.get("financialActivityData");
if (financialActivityData.get("id").equals(liabilityTransferFinancialActivityId)) {
if (financialActivityData.get("id").equals(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID)) {
HashMap glAccountData = (HashMap) financialActivity.get("glAccountData");
mappedLiabilityAccount = new Account((Integer) glAccountData.get("id"), AccountType.LIABILITY);
break;
@@ -2685,23 +2685,23 @@ public class FixedDepositTest {
* If liability transfer is not defined create liability transfer
*/
if (mappedLiabilityAccount == null) {
mappedLiabilityAccount = createLiabilityFinancialAccountTransferType(liabilityTransferFinancialActivityId);
mappedLiabilityAccount = createLiabilityFinancialAccountTransferType(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID);
}
financialAccount = mappedLiabilityAccount;
}
return financialAccount;
}
private Account createLiabilityFinancialAccountTransferType(final Integer liabilityTransferFinancialActivityId) {
private Account createLiabilityFinancialAccountTransferType(final Integer LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID) {
/***
* Create and verify financial account transfer type is created
*/
final Account liabilityAccountForMapping = this.accountHelper.createLiabilityAccount();
Integer financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
liabilityTransferFinancialActivityId, liabilityAccountForMapping.getAccountID(), this.responseSpec,
LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping.getAccountID(), this.responseSpec,
CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(financialActivityAccountId);
assertFinancialActivityAccountCreation(financialActivityAccountId, liabilityTransferFinancialActivityId, liabilityAccountForMapping);
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping);
return liabilityAccountForMapping;
}
@@ -182,7 +182,7 @@ public class GroupLoanIntegrationTest {
Map<String, Object> map = new HashMap<>();
map.put("loanId", loanId);
map.put("approvedOnDate", approvedOnDate);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("locale", "en");
return map;
}
@@ -696,7 +696,7 @@ public class GroupSavingsIntegrationTest {
Assert.assertEquals(1, charges.size());
HashMap savingsChargeForPay = charges.get(0);
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.dateFormat, Locale.US);
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.DATE_FORMAT, Locale.US);
Calendar cal = Calendar.getInstance();
List dates = (List) savingsChargeForPay.get("dueDate");
cal.set(Calendar.YEAR, (Integer) dates.get(0));
@@ -783,7 +783,7 @@ public class GroupSavingsIntegrationTest {
map.put("groupId", groupId);
map.put("productId", productId);
map.put("submittedOnDate", submittedOnDate);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("locale", "en");
map.put("isParentAccount", "1");
map.put("isGSIM", "true");
@@ -793,7 +793,7 @@ public class GroupSavingsIntegrationTest {
private Map<String, Object> savingsArray(final Integer paymentId, final Integer savingsId, final Integer transactionAmount, final String transactionDate) {
Map<String, Object> map = new HashMap<>();
map.put("transactionDate", transactionDate);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("locale", "en");
map.put("transactionAmount",transactionAmount);
map.put("paymentTypeId", paymentId);
@@ -3109,7 +3109,7 @@ public class RecurringDepositTest {
}
private Account getMappedLiabilityFinancialAccount() {
final Integer liabilityTransferFinancialActivityId = FinancialActivity.LIABILITY_TRANSFER.getValue();
final Integer LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID = FinancialActivity.LIABILITY_TRANSFER.getValue();
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
final Account financialAccount;
/***
@@ -3117,7 +3117,7 @@ public class RecurringDepositTest {
* liability financial accounting mappings
*/
if (financialActivities.isEmpty()) {
financialAccount = createLiabilityFinancialAccountTransferType(liabilityTransferFinancialActivityId);
financialAccount = createLiabilityFinancialAccountTransferType(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID);
} else {
/***
* extract mapped liability financial account
@@ -3125,7 +3125,7 @@ public class RecurringDepositTest {
Account mappedLiabilityAccount = null;
for (HashMap financialActivity : financialActivities) {
HashMap financialActivityData = (HashMap) financialActivity.get("financialActivityData");
if (financialActivityData.get("id").equals(liabilityTransferFinancialActivityId)) {
if (financialActivityData.get("id").equals(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID)) {
HashMap glAccountData = (HashMap) financialActivity.get("glAccountData");
mappedLiabilityAccount = new Account((Integer) glAccountData.get("id"), AccountType.LIABILITY);
break;
@@ -3135,23 +3135,23 @@ public class RecurringDepositTest {
* If liability transfer is not defined create liability transfer
*/
if (mappedLiabilityAccount == null) {
mappedLiabilityAccount = createLiabilityFinancialAccountTransferType(liabilityTransferFinancialActivityId);
mappedLiabilityAccount = createLiabilityFinancialAccountTransferType(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID);
}
financialAccount = mappedLiabilityAccount;
}
return financialAccount;
}
private Account createLiabilityFinancialAccountTransferType(final Integer liabilityTransferFinancialActivityId) {
private Account createLiabilityFinancialAccountTransferType(final Integer LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID) {
/***
* Create and verify financial account transfer type is created
*/
final Account liabilityAccountForMapping = this.accountHelper.createLiabilityAccount();
Integer financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
liabilityTransferFinancialActivityId, liabilityAccountForMapping.getAccountID(), this.responseSpec,
LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping.getAccountID(), this.responseSpec,
CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(financialActivityAccountId);
assertFinancialActivityAccountCreation(financialActivityAccountId, liabilityTransferFinancialActivityId, liabilityAccountForMapping);
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping);
return liabilityAccountForMapping;
}
@@ -930,7 +930,7 @@ public class SchedulerJobsTestResults {
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientId);
Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE)
+ Float.valueOf(FixedDepositAccountHelper.depositAmount);
+ Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec,
String.valueOf(balance));
Assert.assertNotNull(savingsProductID);
@@ -979,12 +979,12 @@ public class SchedulerJobsTestResults {
HashMap fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId);
Float interestPosted = (Float) fixedDepositSummary.get("accountBalance")
- Float.valueOf(FixedDepositAccountHelper.depositAmount);
- Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT);
String JobName = "Transfer Interest To Savings";
this.schedulerJobHelper.executeJob(JobName);
fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId);
assertEquals("Verifying opening Balance", Float.valueOf(FixedDepositAccountHelper.depositAmount),
assertEquals("Verifying opening Balance", Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT),
fixedDepositSummary.get("accountBalance"));
summary = savingsAccountHelper.getSavingsSummary(savingsId);
@@ -33,8 +33,8 @@ public class CalendarHelper {
private static final String BASE_URL = "/fineract-provider/api/v1/";
private static final String PARENT_ENTITY_NAME = "groups/";
private static final String ENITY_NAME = "/calendars";
private static final String Center_Entity = "centers/";
private static final String Edit_Calendar = "editcalendarbasedonmeetingdates/";
private static final String CENTER__ENTITY = "centers/";
private static final String EDIT__CALENDAR = "editcalendarbasedonmeetingdates/";
public static Integer createMeetingCalendarForGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer groupId, final String startDate, final String frequency, final String interval, final String repeatsOnDay) {
@@ -95,7 +95,7 @@ public class CalendarHelper {
LOG.info("---------------------------------CREATING A MEETING CALENDAR FOR THE GROUP------------------------------");
final String CALENDAR_RESOURCE_URL = BASE_URL + Center_Entity + groupId + ENITY_NAME + "?" + Utils.TENANT_IDENTIFIER;
final String CALENDAR_RESOURCE_URL = BASE_URL + CENTER__ENTITY + groupId + ENITY_NAME + "?" + Utils.TENANT_IDENTIFIER;
LOG.info("{}",CALENDAR_RESOURCE_URL);
@@ -108,7 +108,7 @@ public class CalendarHelper {
LOG.info("---------------------------------UPADATING A MEETING CALENDAR FOR THE CENTER------------------------------");
final String CALENDAR_RESOURCE_URL = BASE_URL + Center_Entity + centerId + ENITY_NAME + "/" + calendarID + "?"
final String CALENDAR_RESOURCE_URL = BASE_URL + CENTER__ENTITY + centerId + ENITY_NAME + "/" + calendarID + "?"
+ Utils.TENANT_IDENTIFIER;
LOG.info("{}",CALENDAR_RESOURCE_URL);
@@ -348,8 +348,8 @@ public class ClientHelper {
Integer closureReasonId = (Integer) codeValue.get("id");
map.put("closureReasonId", closureReasonId.toString());
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("closureDate", CREATED_DATE_PLUS_ONE);
String clientJson = new Gson().toJson(map);
@@ -360,8 +360,8 @@ public class ClientHelper {
private String getReactivateClientAsJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("reactivationDate", CREATED_DATE_PLUS_ONE);
String clientJson = new Gson().toJson(map);
LOG.info(clientJson);
@@ -371,8 +371,8 @@ public class ClientHelper {
private String getUndoRejectClientAsJSON(final String date) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("reopenedDate", date);
String clientJson = new Gson().toJson(map);
LOG.info(clientJson);
@@ -382,8 +382,8 @@ public class ClientHelper {
private String getUndoWithdrawnClientAsJSON(final String date) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("reopenedDate", date);
String clientJson = new Gson().toJson(map);
LOG.info(clientJson);
@@ -403,8 +403,8 @@ public class ClientHelper {
this.requestSpec, this.responseSpec);
Integer rejectionReasonId = (Integer) codeValue.get("id");
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("rejectionDate", CREATED_DATE_PLUS_ONE);
map.put("rejectionReasonId", rejectionReasonId.toString());
String clientJson = new Gson().toJson(map);
@@ -415,8 +415,8 @@ public class ClientHelper {
private String getActivateClientAsJSON(String date) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("activationDate", date);
String clientJson = new Gson().toJson(map);
LOG.info(clientJson);
@@ -435,8 +435,8 @@ public class ClientHelper {
this.requestSpec, this.responseSpec);
Integer withdrawalReasonId = (Integer) codeValue.get("id");
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("withdrawalDate", CREATED_DATE_PLUS_ONE);
map.put("withdrawalReasonId", withdrawalReasonId.toString());
String clientJson = new Gson().toJson(map);
@@ -21,8 +21,8 @@ package org.apache.fineract.integrationtests.common;
public interface CommonConstants {
public final static String locale = "en";
public static final String dateFormat = "dd MMMM yyyy";
public final static String LOCALE = "en";
public static final String DATE_FORMAT = "dd MMMM yyyy";
public static final String RESPONSE_RESOURCE_ID = "resourceId";
public static final String RESPONSE_CHANGES = "changes";
public static final String RESPONSE_STATUS = "status";
@@ -72,11 +72,11 @@ public class ChargesHelper {
private static final Integer CHARGE_FEE_FREQUENCY_YEARS = 3;
private final static boolean active = true;
private final static boolean penalty = true;
private final static boolean PENALTY = true;
private final static String amount = "100";
private final static String currencyCode = "USD";
public final static String feeOnMonthDay = "04 March";
private final static String monthDayFormat = "dd MMM";
private final static String MONTH_DAY_FORMAT = "dd MMM";
public static String getSavingsSpecifiedDueDateJSON() {
final HashMap<String, Object> map = populateDefaultsForSavings();
@@ -154,8 +154,8 @@ public class ChargesHelper {
map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_SAVINGS);
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
map.put("currencyCode", currencyCode);
map.put("locale", CommonConstants.locale);
map.put("monthDayFormat", ChargesHelper.monthDayFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("monthDayFormat", ChargesHelper.MONTH_DAY_FORMAT);
map.put("name", Utils.randomNameGenerator("Charge_Savings_", 6));
return map;
}
@@ -188,7 +188,7 @@ public class ChargesHelper {
public static String getLoanSpecifiedDueDateJSON() {
return getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.amount,
ChargesHelper.penalty);
ChargesHelper.PENALTY);
}
public static String getLoanSpecifiedDueDateJSON(final Integer chargeCalculationType, final String amount,
@@ -219,7 +219,7 @@ public class ChargesHelper {
public static String getLoanSpecifiedDueDateWithAccountTransferJSON() {
return getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.amount,
ChargesHelper.penalty, ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
ChargesHelper.PENALTY, ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
}
public static String getLoanInstallmentJSON(final Integer chargeCalculationType, final String amount,
@@ -250,7 +250,7 @@ public class ChargesHelper {
public static String getLoanInstallmentFeeJSON() {
return getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.amount,
ChargesHelper.penalty);
ChargesHelper.PENALTY);
}
public static String getShareAccountActivationChargeJson() {
@@ -276,7 +276,7 @@ public class ChargesHelper {
public static String getLoanOverdueFeeJSON() {
final HashMap<String, Object> map = populateDefaultsForLoan();
map.put("penalty", ChargesHelper.penalty);
map.put("penalty", ChargesHelper.PENALTY);
map.put("chargePaymentMode", ChargesHelper.CHARGE_PAYMENT_MODE_REGULAR);
map.put("chargeTimeType", CHARGE_OVERDUE_INSTALLMENT_FEE);
map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_MONTHS);
@@ -289,7 +289,7 @@ public class ChargesHelper {
public static String getLoanOverdueFeeJSONWithCalculattionTypePercentage(String penaltyPercentageAmount) {
final HashMap<String, Object> map = populateDefaultsForLoan();
map.put("penalty", ChargesHelper.penalty);
map.put("penalty", ChargesHelper.PENALTY);
map.put("amount", penaltyPercentageAmount);
map.put("chargePaymentMode", ChargesHelper.CHARGE_PAYMENT_MODE_REGULAR);
map.put("chargeTimeType", CHARGE_OVERDUE_INSTALLMENT_FEE);
@@ -306,8 +306,8 @@ public class ChargesHelper {
map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_LOAN);
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
map.put("currencyCode", ChargesHelper.currencyCode);
map.put("locale", CommonConstants.locale);
map.put("monthDayFormat", ChargesHelper.monthDayFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("monthDayFormat", ChargesHelper.MONTH_DAY_FORMAT);
map.put("name", Utils.randomNameGenerator("Charge_Loans_", 6));
return map;
}
@@ -320,8 +320,8 @@ public class ChargesHelper {
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
map.put("chargeTimeType", ChargesHelper.CHARGE_SPECIFIED_DUE_DATE);
map.put("currencyCode", ChargesHelper.currencyCode);
map.put("locale", CommonConstants.locale);
map.put("monthDayFormat", ChargesHelper.monthDayFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("monthDayFormat", ChargesHelper.MONTH_DAY_FORMAT);
map.put("name", Utils.randomNameGenerator("Charge_client_", 8));
return map;
}
@@ -334,7 +334,7 @@ public class ChargesHelper {
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
map.put("chargeTimeType", ChargesHelper.SHAREACCOUNT_ACTIVATION);
map.put("currencyCode", ChargesHelper.currencyCode);
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("name", Utils.randomNameGenerator("Charge_Share_Activation_", 8));
return map;
}
@@ -347,7 +347,7 @@ public class ChargesHelper {
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
map.put("chargeTimeType", ChargesHelper.SHARE_PURCHASE);
map.put("currencyCode", ChargesHelper.currencyCode);
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("name", Utils.randomNameGenerator("Charge_Share_Purchase_", 8));
return map;
}
@@ -360,7 +360,7 @@ public class ChargesHelper {
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
map.put("chargeTimeType", ChargesHelper.SHARE_REDEEM);
map.put("currencyCode", ChargesHelper.currencyCode);
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("name", Utils.randomNameGenerator("Charge_Share_Redeem_", 8));
return map;
}
@@ -403,7 +403,7 @@ public class ChargesHelper {
public static String getModifyChargeJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("amount", "200.0");
String json = new Gson().toJson(map);
LOG.info("{}", json);
@@ -412,7 +412,7 @@ public class ChargesHelper {
public static String getModifyWithdrawalFeeSavingsChargeJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT);
String json = new Gson().toJson(map);
LOG.info("{}", json);
@@ -421,7 +421,7 @@ public class ChargesHelper {
public static String getModifyChargeAsPecentageAmountJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT);
map.put("chargePaymentMode", CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
String json = new Gson().toJson(map);
@@ -431,7 +431,7 @@ public class ChargesHelper {
public static String getModifyChargeAsPecentageLoanAmountWithInterestJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST);
map.put("chargePaymentMode", CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
String json = new Gson().toJson(map);
@@ -441,7 +441,7 @@ public class ChargesHelper {
public static String getModifyChargeAsPercentageInterestJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST);
map.put("chargePaymentMode", CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
String json = new Gson().toJson(map);
@@ -451,7 +451,7 @@ public class ChargesHelper {
public static String getModifyChargeFeeFrequencyAsDaysJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_DAYS);
map.put("feeInterval", 2);
String json = new Gson().toJson(map);
@@ -461,7 +461,7 @@ public class ChargesHelper {
public static String getModifyChargeFeeFrequencyAsWeeksJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_WEEKS);
map.put("feeInterval", 2);
String json = new Gson().toJson(map);
@@ -471,7 +471,7 @@ public class ChargesHelper {
public static String getModifyChargeFeeFrequencyAsMonthsJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_MONTHS);
map.put("feeInterval", 2);
String json = new Gson().toJson(map);
@@ -481,7 +481,7 @@ public class ChargesHelper {
public static String getModifyChargeFeeFrequencyAsYearsJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_YEARS);
map.put("feeInterval", 2);
String json = new Gson().toJson(map);
@@ -71,7 +71,7 @@ public class FixedDepositAccountHelper {
private static final String INTEREST_CALCULATION_USING_AVERAGE_DAILY_BALANCE = "2";
private static final String DAYS_360 = "360";
private static final String DAYS_365 = "365";
public final static String depositAmount = "100000";
public final static String DEPOSIT_AMOUNT = "100000";
private String newDepositAmount = null;
private String interestCompoundingPeriodType = MONTHLY;
@@ -324,8 +324,8 @@ public class FixedDepositAccountHelper {
private String getApproveFixedDepositAccountAsJSON(final String approvedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("approvedOnDate", approvedOnDate);
map.put("note", "Approval NOTE");
String fixedDepositAccountApproveJson = new Gson().toJson(map);
@@ -335,8 +335,8 @@ public class FixedDepositAccountHelper {
private String getRejectedFixedDepositAsJSON(final String rejectedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("rejectedOnDate", rejectedOnDate);
map.put("note", "Rejected NOTE");
String fixedDepositAccountJson = new Gson().toJson(map);
@@ -346,8 +346,8 @@ public class FixedDepositAccountHelper {
private String getWithdrawnFixedDepositAccountAsJSON(final String withdrawnApplicationOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("withdrawnOnDate", withdrawnApplicationOnDate);
map.put("note", "Withdraw NOTE");
String fixedDepositAccountJson = new Gson().toJson(map);
@@ -357,8 +357,8 @@ public class FixedDepositAccountHelper {
private String getActivatedFixedDepositAccountAsJSON(final String activationDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("activatedOnDate", activationDate);
String fixedDepositAccountActivateJson = new Gson().toJson(map);
LOG.info("{}", fixedDepositAccountActivateJson);
@@ -374,8 +374,8 @@ public class FixedDepositAccountHelper {
private String getCalculatedPrematureAmountForFixedDepositAccountAsJSON(final String closedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("closedOnDate", closedOnDate);
String fixedDepositAccountPrematureClosureJson = new Gson().toJson(map);
LOG.info(fixedDepositAccountPrematureClosureJson);
@@ -385,8 +385,8 @@ public class FixedDepositAccountHelper {
private String getPrematureCloseForFixedDepositAccountAsJSON(final String closedOnDate, final String closureType,
final Integer toSavingsId) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("closedOnDate", closedOnDate);
map.put("onAccountClosureId", closureType);
if (toSavingsId != null) {
@@ -487,7 +487,7 @@ public class FixedDepositAccountHelper {
private String getDepositAmount() {
if (this.newDepositAmount == null) {
return depositAmount;
return DEPOSIT_AMOUNT;
}
return this.newDepositAmount;
}
@@ -40,10 +40,10 @@ public class CurrencyHelper {
private static final String CURRENCY_URL = "/fineract-provider/api/v1/currencies?" + Utils.TENANT_IDENTIFIER;
private static final String CURRENCY_URL_SELECTED = CURRENCY_URL + "&fields=selectedCurrencyOptions";
private static final List<String> permittedCurrencyArray = Arrays.asList("currencyOptions",
private static final List<String> PERMITTED_CURRENCY_ARRAY = Arrays.asList("currencyOptions",
"selectedCurrencyOptions");
private static final List<String> permittedCurrencyArraySelected = Arrays.asList("selectedCurrencyOptions");
private static final List<String> PERMITTED_CURRENCY_ARRAY_SELECTED = Arrays.asList("selectedCurrencyOptions");
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
@@ -54,11 +54,11 @@ public class CurrencyHelper {
}
public ArrayList<Currency> getPermittedCurrencies() {
return getCurrencies(CURRENCY_URL, permittedCurrencyArray);
return getCurrencies(CURRENCY_URL, PERMITTED_CURRENCY_ARRAY);
}
public ArrayList<Currency> getSelectedCurrencies() {
return getCurrencies(CURRENCY_URL_SELECTED, permittedCurrencyArraySelected);
return getCurrencies(CURRENCY_URL_SELECTED, PERMITTED_CURRENCY_ARRAY_SELECTED);
}
private ArrayList<Currency> getCurrencies(final String getUrl, final List<String> permittedCurrencyArrays) {
@@ -379,8 +379,8 @@ public class RecurringDepositAccountHelper {
private String getApproveRecurringDepositAccountAsJSON(final String approvedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("approvedOnDate", approvedOnDate);
map.put("note", "Approval NOTE");
String recurringDepositAccountApproveJson = new Gson().toJson(map);
@@ -390,8 +390,8 @@ public class RecurringDepositAccountHelper {
private String getUpdateTransactionAsJSON(final String transactionDate, final Float transactionAmount) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("transactionDate", transactionDate);
map.put("transactionAmount", transactionAmount);
String updateTransactionJson = new Gson().toJson(map);
@@ -401,8 +401,8 @@ public class RecurringDepositAccountHelper {
private String getRejectedRecurringDepositAsJSON(final String rejectedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("rejectedOnDate", rejectedOnDate);
map.put("note", "Rejected NOTE");
String recurringDepositAccountJson = new Gson().toJson(map);
@@ -412,8 +412,8 @@ public class RecurringDepositAccountHelper {
private String getWithdrawnRecurringDepositAccountAsJSON(final String withdrawnApplicationOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("withdrawnOnDate", withdrawnApplicationOnDate);
map.put("note", "Withdraw NOTE");
String recurringDepositAccountJson = new Gson().toJson(map);
@@ -423,8 +423,8 @@ public class RecurringDepositAccountHelper {
private String getActivatedRecurringDepositAccountAsJSON(final String activationDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("activatedOnDate", activationDate);
String recurringDepositAccountActivateJson = new Gson().toJson(map);
LOG.info(recurringDepositAccountActivateJson);
@@ -440,8 +440,8 @@ public class RecurringDepositAccountHelper {
private String getCalculatedPrematureAmountForRecurringDepositAccountAsJSON(final String closedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("closedOnDate", closedOnDate);
String recurringDepositAccountPrematureClosureJson = new Gson().toJson(map);
LOG.info(recurringDepositAccountPrematureClosureJson);
@@ -450,8 +450,8 @@ public class RecurringDepositAccountHelper {
private String getDepositToRecurringDepositAccountAsJSON(final Float depositAmount, final String depositedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("transactionAmount", depositAmount);
map.put("transactionDate", depositedOnDate);
String recurringDepositAccountPrematureClosureJson = new Gson().toJson(map);
@@ -462,8 +462,8 @@ public class RecurringDepositAccountHelper {
private String getPrematureCloseForRecurringDepositAccountAsJSON(final String closedOnDate,
final String closureType, final Integer toSavingsId) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("closedOnDate", closedOnDate);
map.put("onAccountClosureId", closureType);
if (toSavingsId != null) {
@@ -88,7 +88,7 @@ public class SavingsAccountHelper {
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
public static final String DATE_TIME_FORMAT = "dd MMMM yyyy HH:mm";
private static final Boolean isBlock = false;
private static final Boolean IS_BLOCK = false;
public SavingsAccountHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
@@ -96,7 +96,7 @@ public class SavingsAccountHelper {
}
public static String getFutureDate() {
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.dateFormat, Locale.US);
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.DATE_FORMAT, Locale.US);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + 1);
return sdf.format(calendar.getTime());
@@ -190,21 +190,21 @@ public class SavingsAccountHelper {
LOG.info("--------------------------------- APPROVING SAVINGS APPLICATION ------------------------------------");
final String savingsOperationURL = createSavingsOperationURL(APPROVE_SAVINGS_COMMAND, savingsID);
if (approvalDate == null || approvalDate.equals("")) {
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJSON(), isBlock);
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJSON(), IS_BLOCK);
}
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJsonOnDate(approvalDate), isBlock);
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJsonOnDate(approvalDate), IS_BLOCK);
}
public HashMap undoApproval(final Integer savingsID) {
LOG.info("--------------------------------- UNDO APPROVING SAVINGS APPLICATION -------------------------------");
final String undoBodyJson = "{'note':'UNDO APPROVAL'}";
return performSavingApplicationActions(createSavingsOperationURL(UNDO_APPROVAL_SAVINGS_COMMAND, savingsID), undoBodyJson, isBlock);
return performSavingApplicationActions(createSavingsOperationURL(UNDO_APPROVAL_SAVINGS_COMMAND, savingsID), undoBodyJson, IS_BLOCK);
}
public HashMap rejectApplication(final Integer savingsID) {
LOG.info("--------------------------------- REJECT SAVINGS APPLICATION -------------------------------");
return performSavingApplicationActions(createSavingsOperationURL(REJECT_SAVINGS_COMMAND, savingsID),
getRejectedSavingsAsJSON(CREATED_DATE_PLUS_ONE), isBlock);
getRejectedSavingsAsJSON(CREATED_DATE_PLUS_ONE), IS_BLOCK);
}
public List rejectApplicationWithErrorCode(final Integer savingsId, final String date) {
@@ -216,18 +216,18 @@ public class SavingsAccountHelper {
public HashMap withdrawApplication(final Integer savingsID) {
LOG.info("--------------------------------- Withdraw SAVINGS APPLICATION -------------------------------");
return performSavingApplicationActions(createSavingsOperationURL(WITHDRAWN_BY_CLIENT_SAVINGS_COMMAND, savingsID),
getWithdrawnSavingsAsJSON(), isBlock);
getWithdrawnSavingsAsJSON(), IS_BLOCK);
}
public HashMap activateSavings(final Integer savingsID) {
LOG.info("---------------------------------- ACTIVATING SAVINGS APPLICATION ----------------------------------");
return performSavingApplicationActions(createSavingsOperationURL(ACTIVATE_SAVINGS_COMMAND, savingsID), getActivatedSavingsAsJSON(), isBlock);
return performSavingApplicationActions(createSavingsOperationURL(ACTIVATE_SAVINGS_COMMAND, savingsID), getActivatedSavingsAsJSON(), IS_BLOCK);
}
public HashMap closeSavingsAccount(final Integer savingsID, String withdrawBalance) {
LOG.info("---------------------------------- CLOSE SAVINGS APPLICATION ----------------------------------");
return performSavingApplicationActions(createSavingsOperationURL(CLOSE_SAVINGS_COMMAND, savingsID),
getCloseAccountJSON(withdrawBalance, LAST_TRANSACTION_DATE), isBlock);
getCloseAccountJSON(withdrawBalance, LAST_TRANSACTION_DATE), IS_BLOCK);
}
public Object deleteSavingsApplication(final Integer savingsId, final String jsonAttributeToGetBack) {
@@ -374,8 +374,8 @@ public class SavingsAccountHelper {
private String getApproveSavingsAsJsonOnDate(final String approvalDate) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("approvedOnDate", approvalDate);
map.put("note", "Approval NOTE");
String savingsAccountApproveJson = new Gson().toJson(map);
@@ -385,8 +385,8 @@ public class SavingsAccountHelper {
private String getRejectedSavingsAsJSON(final String rejectedOnDate) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("rejectedOnDate", rejectedOnDate);
map.put("note", "Rejected NOTE");
String savingsAccountJson = new Gson().toJson(map);
@@ -396,8 +396,8 @@ public class SavingsAccountHelper {
private String getWithdrawnSavingsAsJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("withdrawnOnDate", CREATED_DATE_PLUS_ONE);
map.put("note", "Rejected NOTE");
String savingsAccountJson = new Gson().toJson(map);
@@ -407,8 +407,8 @@ public class SavingsAccountHelper {
private String getActivatedSavingsAsJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("activatedOnDate", TRANSACTION_DATE);
String savingsAccountActivateJson = new Gson().toJson(map);
LOG.info(savingsAccountActivateJson);
@@ -417,8 +417,8 @@ public class SavingsAccountHelper {
private String getSavingsTransactionJSON(final String amount, final String transactionDate) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("transactionDate", transactionDate);
map.put("transactionAmount", amount);
String savingsAccountWithdrawalJson = new Gson().toJson(map);
@@ -435,8 +435,8 @@ public class SavingsAccountHelper {
private String getCalculatedInterestForSavingsApplicationAsJSON(final String today) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("transactionDate", today);
map.put("postInterestManualOrAutomatic", "true");
String savingsAccountCalculatedInterestJson = new Gson().toJson(map);
@@ -445,8 +445,8 @@ public class SavingsAccountHelper {
private String getSavingsPayChargeJSON(final String amount, final String dueDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("amount", amount);
map.put("dueDate", dueDate);
String josn = new Gson().toJson(map);
@@ -455,16 +455,16 @@ public class SavingsAccountHelper {
private String getSavingsWaiveChargeJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
String josn = new Gson().toJson(map);
return josn;
}
private String getModifyChargeJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("amount", "50");
String josn = new Gson().toJson(map);
return josn;
@@ -472,8 +472,8 @@ public class SavingsAccountHelper {
private String getCloseAccountJSON(String withdrawBalance, String closedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("closedOnDate", closedOnDate);
map.put("withdrawBalance", withdrawBalance);
map.put("note", "Close Test");
@@ -484,8 +484,8 @@ public class SavingsAccountHelper {
private String getCloseAccountPostInterestJSON(String withdrawBalance, String closedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("closedOnDate", closedOnDate);
map.put("withdrawBalance", withdrawBalance);
map.put("note", "Close Test");
@@ -585,13 +585,13 @@ public class SavingsAccountHelper {
return response;
}
private HashMap performSavingApplicationActions(final String postURLForSavingsTransaction, final String jsonToBeSent, final Boolean isBlock) {
private HashMap performSavingApplicationActions(final String postURLForSavingsTransaction, final String jsonToBeSent, final Boolean IS_BLOCK) {
HashMap status = null;
final HashMap response = Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForSavingsTransaction, jsonToBeSent,
CommonConstants.RESPONSE_CHANGES);
if (response != null) {
status = (HashMap) response.get("status");
if (isBlock != null && isBlock) {
if (IS_BLOCK != null && IS_BLOCK) {
status = (HashMap) response.get("subStatus");
}
}
@@ -623,7 +623,7 @@ public class SavingsAccountHelper {
map.put("chargeId", chargeId);
map.put("amount", amount);
map.put("feeOnMonthDay", "15 January");
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("monthDayFormat", "dd MMMM");
map.put("dateFormat", "dd MMMM yyy");
if(addDueDate){
@@ -637,7 +637,7 @@ public class SavingsAccountHelper {
final HashMap<String, Object> map = new HashMap<>();
map.put("chargeId", chargeId);
map.put("amount", amount);
map.put("locale", CommonConstants.locale);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", "dd MMMM yyy");
map.put("dueDate", addDueDate);
String json = new Gson().toJson(map);
@@ -646,8 +646,8 @@ public class SavingsAccountHelper {
private String getAccountActivationJSON(final String activationDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
map.put("activatedOnDate", activationDate);
String savingsAccountActivateJson = new Gson().toJson(map);
return savingsAccountActivateJson;
@@ -655,7 +655,7 @@ public class SavingsAccountHelper {
public HashMap activateSavingsAccount(Integer savingsID, String activationDate) {
return performSavingApplicationActions(createSavingsOperationURL(ACTIVATE_SAVINGS_COMMAND, savingsID),
getAccountActivationJSON(activationDate), isBlock);
getAccountActivationJSON(activationDate), IS_BLOCK);
}
public Object inactivateCharge(final Integer chargeId, final Integer savingsId, final String jsonAttributeToGetBack) {
@@ -665,8 +665,8 @@ public class SavingsAccountHelper {
private String getSavingsInactivateChargeJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("locale", CommonConstants.LOCALE);
map.put("dateFormat", CommonConstants.DATE_FORMAT);
String josn = new Gson().toJson(map);
return josn;
}
@@ -754,15 +754,15 @@ public class SavingsAccountHelper {
final String savingsOperationURL = createSavingsGsimOperationURL(APPROVE_SAVINGS_COMMAND, gsimID);
if (approvalDate == null || approvalDate.equals("")) {
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJSON(), isBlock);
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJSON(), IS_BLOCK);
}
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJsonOnDate(approvalDate), isBlock);
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJsonOnDate(approvalDate), IS_BLOCK);
}
public HashMap rejectGsimApplication(final Integer gsimID) {
LOG.info("--------------------------------- REJECT SAVINGS APPLICATION -------------------------------");
return performSavingApplicationActions(createSavingsGsimOperationURL(REJECT_SAVINGS_COMMAND, gsimID),
getRejectedSavingsAsJSON(CREATED_DATE_PLUS_ONE), isBlock);
getRejectedSavingsAsJSON(CREATED_DATE_PLUS_ONE), IS_BLOCK);
}
@@ -775,7 +775,7 @@ public class SavingsAccountHelper {
public HashMap undoApprovalGsimSavings(final Integer gsimId) {
LOG.info("--------------------------------- UNDO APPROVING GSIM SAVINGS APPLICATION -------------------------------");
final String undoBodyJson = "{'note':'UNDO APPROVAL'}";
return performSavingApplicationActions(createSavingsGsimOperationURL(UNDO_APPROVAL_SAVINGS_COMMAND, gsimId), undoBodyJson, isBlock);
return performSavingApplicationActions(createSavingsGsimOperationURL(UNDO_APPROVAL_SAVINGS_COMMAND, gsimId), undoBodyJson, IS_BLOCK);
}
public Integer depositGsimApplication(Integer savingsID, List<Map<String, Object>> savingsArray) {
@@ -798,13 +798,13 @@ public class SavingsAccountHelper {
public HashMap activateGsimSavings(final Integer gsimID) {
LOG.info("---------------------------------- ACTIVATING GSIM SAVINGS APPLICATION ----------------------------------");
return performSavingApplicationActions(createSavingsGsimOperationURL(ACTIVATE_SAVINGS_COMMAND, gsimID), getActivatedSavingsAsJSON(), isBlock);
return performSavingApplicationActions(createSavingsGsimOperationURL(ACTIVATE_SAVINGS_COMMAND, gsimID), getActivatedSavingsAsJSON(), IS_BLOCK);
}
public HashMap closeGsimSavingsAccount(final Integer gsimID, String withdrawBalance) {
LOG.info("---------------------------------- CLOSE SAVINGS APPLICATION ----------------------------------");
return performSavingApplicationActions(createSavingsGsimOperationURL(CLOSE_SAVINGS_COMMAND, gsimID),
getCloseAccountJSON(withdrawBalance, LAST_TRANSACTION_DATE), isBlock);
getCloseAccountJSON(withdrawBalance, LAST_TRANSACTION_DATE), IS_BLOCK);
}
public Object closeGsimSavingsAccountAndGetBackRequiredField(final Integer gsimId, String withdrawBalance,
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "rawtypes" })
public class InteropHelper {
private final static Logger log = LoggerFactory.getLogger(InteropHelper.class);
private final static Logger LOG = LoggerFactory.getLogger(InteropHelper.class);
private static final String BASE_URL = "/fineract-provider/api/v1/interoperation";
private static final String HEALTH_URL = BASE_URL + "/health";
@@ -135,10 +135,10 @@ public class InteropHelper {
*/
public String getHealth() {
String url = buildUrl(HEALTH_URL);
log.debug("Calling Interoperable GET Health: {}", url);
LOG.debug("Calling Interoperable GET Health: {}", url);
String response = Utils.performServerGet(requestSpec, responseSpec, url, null);
log.debug("Response Interoperable GET Health: {}", response);
LOG.debug("Response Interoperable GET Health: {}", response);
return response;
}
@@ -147,10 +147,10 @@ public class InteropHelper {
*/
public String getParty(InteropIdentifierType idType, String idValue) {
String url = buildUrl(PARTIES_URL + '/' + idType + '/' + idValue);
log.debug("Calling Interoperable GET Party: {}", url);
LOG.debug("Calling Interoperable GET Party: {}", url);
String response = Utils.performServerGet(requestSpec, responseSpec, url, null);
log.debug("Response Interoperable GET Party: {}", response);
LOG.debug("Response Interoperable GET Party: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_ACCOUNT_ID);
}
@@ -160,10 +160,10 @@ public class InteropHelper {
public String postParty(InteropIdentifierType idType, String idValue) {
String url = buildUrl(PARTIES_URL + '/' + idType + '/' + idValue);
String request = buildPartiesJson();
log.debug("Calling Interoperable POST Party: {}, body: {}", url, request);
LOG.debug("Calling Interoperable POST Party: {}, body: {}", url, request);
String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null);
log.debug("Response Interoperable POST Party: {}", response);
LOG.debug("Response Interoperable POST Party: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_ACCOUNT_ID);
}
@@ -173,10 +173,10 @@ public class InteropHelper {
public String deleteParty(InteropIdentifierType idType, String idValue) {
String url = buildUrl(PARTIES_URL + '/' + idType + '/' + idValue);
String request = buildPartiesJson();
log.debug("Calling Interoperable DELETE Party: {}, body: {}", url, request);
LOG.debug("Calling Interoperable DELETE Party: {}, body: {}", url, request);
String response = Utils.performServerDelete(requestSpec, responseSpec, url, request, null);
log.debug("Response Interoperable DELETE Party: {}", response);
LOG.debug("Response Interoperable DELETE Party: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_ACCOUNT_ID);
}
@@ -191,10 +191,10 @@ public class InteropHelper {
*/
public String getTransactionRequest(String requestCode) {
String url = buildUrl(TRANSACTIONS_URL + '/' + transactionCode + '/' + REQUESTS_URL_PARAM + '/' + requestCode);
log.debug("Calling Interoperable GET Request: {}", url);
LOG.debug("Calling Interoperable GET Request: {}", url);
String response = Utils.performServerGet(requestSpec, responseSpec, url, null);
log.debug("Response Interoperable GET Request: {}", response);
LOG.debug("Response Interoperable GET Request: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_REQUEST_CODE);
}
@@ -205,10 +205,10 @@ public class InteropHelper {
public String postTransactionRequest(String requestCode, InteropTransactionRole role) {
String url = buildUrl(REQUESTS_URL);
String request = buildTransactionRequestJson(requestCode, role);
log.debug("Calling Interoperable POST Request: {}, body: {}", url, request);
LOG.debug("Calling Interoperable POST Request: {}, body: {}", url, request);
String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null);
log.debug("Response Interoperable POST Request: {}", response);
LOG.debug("Response Interoperable POST Request: {}", response);
return response;
}
@@ -238,10 +238,10 @@ public class InteropHelper {
*/
public String getQuote(String quoteCode) {
String url = buildUrl(TRANSACTIONS_URL + '/' + transactionCode + '/' + QUOTES_URL_PARAM + '/' + quoteCode);
log.debug("Calling Interoperable GET Quote: {}", url);
LOG.debug("Calling Interoperable GET Quote: {}", url);
String response = Utils.performServerGet(requestSpec, responseSpec, url, null);
log.debug("Response Interoperable GET Quote: {}", response);
LOG.debug("Response Interoperable GET Quote: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_QUOTE_CODE);
}
@@ -251,10 +251,10 @@ public class InteropHelper {
public String postQuote(String quoteCode, InteropTransactionRole role) {
String url = buildUrl(QUOTES_URL);
String request = buildQuoteJson(quoteCode, role);
log.debug("Calling Interoperable POST Quote: {}, body: {}", url, request);
LOG.debug("Calling Interoperable POST Quote: {}, body: {}", url, request);
String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null);
log.debug("Response Interoperable POST Quote: {}", response);
LOG.debug("Response Interoperable POST Quote: {}", response);
return response;
}
@@ -286,10 +286,10 @@ public class InteropHelper {
*/
public String getTransfer(String transferCode) {
String url = buildUrl(TRANSACTIONS_URL + '/' + transactionCode + '/' + TRANSFERS_URL_PARAM + '/' + transferCode);
log.debug("Calling Interoperable GET Transfer: {}", url);
LOG.debug("Calling Interoperable GET Transfer: {}", url);
String response = Utils.performServerGet(requestSpec, responseSpec, url, null);
log.debug("Response Interoperable GET Transfer: {}", response);
LOG.debug("Response Interoperable GET Transfer: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_TRANSFER_CODE);
}
@@ -313,10 +313,10 @@ public class InteropHelper {
public String postTransfer(String transferCode, InteropTransferActionType action, InteropTransactionRole role) {
String url = buildUrl(TRANSFERS_URL) + '&' + PARAM_TRANSFER_ACTION + '=' + action;
String request = buildTransferJson(transferCode, role);
log.debug("Calling Interoperable POST Transfer: {}, body: {}", url, request);
LOG.debug("Calling Interoperable POST Transfer: {}, body: {}", url, request);
String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null);
log.debug("Response Interoperable POST Transfer: {}", response);
LOG.debug("Response Interoperable POST Transfer: {}", response);
return response;
}
@@ -57,7 +57,7 @@ import org.slf4j.LoggerFactory;
public class InteropTest {
private final static Logger log = LoggerFactory.getLogger(InteropTest.class);
private final static Logger LOG = LoggerFactory.getLogger(InteropTest.class);
private final static String MIN_INTEREST_CALCULATON_BALANCE = null;
private final static String MIN_REQUIRED_BALANCE = null;
@@ -119,7 +119,7 @@ public class InteropTest {
}
private void createSavingsProduct() {
log.debug("------------------------------ Create Interoperable Saving Product ---------------------------------------");
LOG.debug("------------------------------ Create Interoperable Saving Product ---------------------------------------");
Account[] accounts = {accountHelper.createAssetAccount(), accountHelper.createIncomeAccount(), accountHelper.createExpenseAccount(),
accountHelper.createLiabilityAccount()};
@@ -140,7 +140,7 @@ public class InteropTest {
savingsProductId = SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
Assert.assertNotNull(savingsProductId);
log.debug("Sucessfully created Interoperable Saving Product (id: {})", savingsProductId);
LOG.debug("Sucessfully created Interoperable Saving Product (id: {})", savingsProductId);
}
private void createCharge() {
@@ -150,7 +150,7 @@ public class InteropTest {
}
private void openSavingsAccount() {
log.debug("------------------------------ Create Interoperable Saving Account ---------------------------------------");
LOG.debug("------------------------------ Create Interoperable Saving Account ---------------------------------------");
savingsId = savingsAccountHelper.applyForSavingsApplicationWithExternalId(clientId, savingsProductId, ACCOUNT_TYPE_INDIVIDUAL, interopHelper.getAccountExternalId(), true);
Assert.assertNotNull(savingsId);
@@ -167,7 +167,7 @@ public class InteropTest {
savingsAccountHelper.addChargesForSavings(savingsId, chargeId, false, interopHelper.getFee());
}
log.debug("Sucessfully created Interoperable Saving Account (id: {})", savingsId);
LOG.debug("Sucessfully created Interoperable Saving Account (id: {})", savingsId);
}
private void testParties() {
@@ -245,7 +245,7 @@ public class InteropTest {
// prepare
savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null);
log.debug("Response Interoperable GET Saving: {}", savings);
LOG.debug("Response Interoperable GET Saving: {}", savings);
savingsJson = JsonPath.from(savings);
BigDecimal onHold2 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class);
BigDecimal balance2 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class);
@@ -263,7 +263,7 @@ public class InteropTest {
Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE));
savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null);
log.debug("Response Interoperable GET Saving: {}", savings);
LOG.debug("Response Interoperable GET Saving: {}", savings);
savingsJson = JsonPath.from(savings);
BigDecimal onHold3 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class);
BigDecimal balance3 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class);
@@ -277,7 +277,7 @@ public class InteropTest {
Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE));
savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null);
log.debug("Response Interoperable GET Saving: {}", savings);
LOG.debug("Response Interoperable GET Saving: {}", savings);
savingsJson = JsonPath.from(savings);
BigDecimal onHold4 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class);
BigDecimal balance4 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class);