bulk auto reformat ca. 2900 files using ./gradlew :spotlessApply [FINERACT-1006]

This commit is contained in:
Michael Vorburger
2020-06-14 18:31:47 +02:00
committed by Michael Vorburger ⛑️
parent 89e321acaf
commit 9da5932307
2899 changed files with 44572 additions and 46101 deletions
@@ -155,7 +155,8 @@ public class AccountNumberPreferencesTest {
LOG.info("Successfully deleted account number preference (ID: {} )", delResponse.get("resourceId"));
}
/* Deletion of invalid account preference ID should fail */
LOG.info("---------------------------------DELETING ACCOUNT NUMBER PREFERENCE WITH INVALID ID------------------------------------------");
LOG.info(
"---------------------------------DELETING ACCOUNT NUMBER PREFERENCE WITH INVALID ID------------------------------------------");
HashMap<String, Object> deletionError = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(10,
this.responseNotFoundError, "");
@@ -180,24 +181,24 @@ public class AccountNumberPreferencesTest {
}
private void createAccountNumberPreference() {
this.clientAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createClientAccountNumberPreference(
this.responseSpec, "resourceId");
this.clientAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
.createClientAccountNumberPreference(this.responseSpec, "resourceId");
LOG.info("Successfully created account number preferences for Client (ID: {})", this.clientAccountNumberPreferenceId);
this.loanAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createLoanAccountNumberPreference(
this.responseSpec, "resourceId");
this.loanAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
.createLoanAccountNumberPreference(this.responseSpec, "resourceId");
LOG.info("Successfully created account number preferences for Loan (ID: {} )", this.loanAccountNumberPreferenceId);
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createSavingsAccountNumberPreference(
this.responseSpec, "resourceId");
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
.createSavingsAccountNumberPreference(this.responseSpec, "resourceId");
LOG.info("Successfully created account number preferences for Savings (ID: {})", this.savingsAccountNumberPreferenceId);
this.groupsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createGroupsAccountNumberPreference(
this.responseSpec, "resourceId");
this.groupsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
.createGroupsAccountNumberPreference(this.responseSpec, "resourceId");
LOG.info("Successfully created account number preferences for Groups (ID: {})", this.groupsAccountNumberPreferenceId);
this.centerAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createCenterAccountNumberPreference(
this.responseSpec, "resourceId");
this.centerAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper
.createCenterAccountNumberPreference(this.responseSpec, "resourceId");
LOG.info("Successfully created account number preferences for Center (ID: {})", this.centerAccountNumberPreferenceId);
this.accountNumberPreferencesHelper.verifyCreationOfAccountNumberPreferences(this.clientAccountNumberPreferenceId,
@@ -211,10 +212,11 @@ public class AccountNumberPreferencesTest {
private void createAccountNumberPreferenceDuplicateData(final String accountType, final String prefixType) {
/* Creating account Preference with duplicate data should fail */
LOG.info("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH DUPLICATE DATA------------------------------------------");
LOG.info(
"---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH DUPLICATE DATA------------------------------------------");
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData(
this.responseForbiddenError, accountType, prefixType, "");
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper
.createAccountNumberPreferenceWithInvalidData(this.responseForbiddenError, accountType, prefixType, "");
Assertions.assertEquals("error.msg.account.number.format.duplicate.account.type",
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
@@ -224,34 +226,36 @@ public class AccountNumberPreferencesTest {
private void createAccountNumberPreferenceInvalidData(final String accountType, final String prefixType) {
/* Creating account Preference with invalid data should fail */
LOG.info("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
LOG.info(
"---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData(
this.responseValidationError, accountType, prefixType, "");
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper
.createAccountNumberPreferenceWithInvalidData(this.responseValidationError, accountType, prefixType, "");
if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals(
"validation.msg.accountNumberFormat.accountType.is.not.within.expected.range")) {
if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)
.equals("validation.msg.accountNumberFormat.accountType.is.not.within.expected.range")) {
Assertions.assertEquals("validation.msg.accountNumberFormat.accountType.is.not.within.expected.range",
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
} else if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals(
"validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations")) {
} else if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)
.equals("validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations")) {
Assertions.assertEquals("validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations",
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
}
private void updateAccountNumberPreference() {
HashMap<String, Object> accountNumberPreferences = this.accountNumberPreferencesHelper.updateAccountNumberPreference(
this.clientAccountNumberPreferenceId, "101", this.responseSpec, "");
HashMap<String, Object> accountNumberPreferences = this.accountNumberPreferencesHelper
.updateAccountNumberPreference(this.clientAccountNumberPreferenceId, "101", this.responseSpec, "");
LOG.info("--------------------------UPDATION SUCCESSFUL FOR ACCOUNT NUMBER PREFERENCE ID {}"
, accountNumberPreferences.get("resourceId"));
LOG.info("--------------------------UPDATION SUCCESSFUL FOR ACCOUNT NUMBER PREFERENCE ID {}",
accountNumberPreferences.get("resourceId"));
this.accountNumberPreferencesHelper.verifyUpdationOfAccountNumberPreferences((Integer) accountNumberPreferences.get("resourceId"),
this.responseSpec, this.requestSpec);
/* Update invalid account preference id should fail */
LOG.info("---------------------------------UPDATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
LOG.info(
"---------------------------------UPDATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
/* Invalid Account Type */
HashMap<String, Object> updationError = this.accountNumberPreferencesHelper.updateAccountNumberPreference(9999, "101",
@@ -260,8 +264,8 @@ public class AccountNumberPreferencesTest {
Assertions.assertEquals("error.msg.resource.not.found", updationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
/* Invalid Prefix Type */
HashMap<String, Object> updationError1 = this.accountNumberPreferencesHelper.updateAccountNumberPreference(
this.clientAccountNumberPreferenceId, "103", this.responseValidationError, "");
HashMap<String, Object> updationError1 = this.accountNumberPreferencesHelper
.updateAccountNumberPreference(this.clientAccountNumberPreferenceId, "103", this.responseValidationError, "");
Assertions.assertEquals("validation.msg.validation.errors.exist", updationError1.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
@@ -288,8 +292,8 @@ public class AccountNumberPreferencesTest {
this.groupAccountNo = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "accountNo");
if (isAccountPreferenceSetUp) {
String groupsPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.groupsAccountNumberPreferenceId, "prefixType.value");
String groupsPrefixName = (String) this.accountNumberPreferencesHelper
.getAccountNumberPreference(this.groupsAccountNumberPreferenceId, "prefixType.value");
if (groupsPrefixName.equals(this.officeName)) {
@@ -313,8 +317,8 @@ public class AccountNumberPreferencesTest {
Assertions.assertTrue(center.getName().equals(name));
if (isAccountPreferenceSetUp) {
String centerPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.centerAccountNumberPreferenceId, "prefixType.value");
String centerPrefixName = (String) this.accountNumberPreferencesHelper
.getAccountNumberPreference(this.centerAccountNumberPreferenceId, "prefixType.value");
final String CENTER_URL = "/fineract-provider/api/v1/centers/" + this.centerId + "?" + Utils.TENANT_IDENTIFIER;
if (centerPrefixName.equals(this.officeName)) {
@@ -326,7 +330,6 @@ public class AccountNumberPreferencesTest {
}
}
private void createAndValidateClientWithoutAccountPreference() {
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(this.clientId);
@@ -337,8 +340,8 @@ public class AccountNumberPreferencesTest {
private void createAndValidateClientBasedOnAccountPreference() {
final String codeName = "ClientType";
String clientAccountNo = null;
String clientPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.clientAccountNumberPreferenceId, "prefixType.value");
String clientPrefixName = (String) this.accountNumberPreferencesHelper
.getAccountNumberPreference(this.clientAccountNumberPreferenceId, "prefixType.value");
if (clientPrefixName.equals(this.clientTypeName)) {
/* Retrieve Code id for the Code "ClientType" */
@@ -412,8 +415,8 @@ public class AccountNumberPreferencesTest {
"accountNo");
if (isAccountPreferenceSetUp) {
String loanPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.loanAccountNumberPreferenceId, "prefixType.value");
String loanPrefixName = (String) this.accountNumberPreferencesHelper
.getAccountNumberPreference(this.loanAccountNumberPreferenceId, "prefixType.value");
if (loanPrefixName.equals(this.officeName)) {
String loanOfficeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "officeName");
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, loanOfficeName);
@@ -458,14 +461,14 @@ public class AccountNumberPreferencesTest {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.savingsId = this.savingsAccountHelper
.applyForSavingsApplication(this.clientId, this.savingsProductId, ACCOUNT_TYPE_INDIVIDUAL);
this.savingsId = this.savingsAccountHelper.applyForSavingsApplication(this.clientId, this.savingsProductId,
ACCOUNT_TYPE_INDIVIDUAL);
String savingsAccountNo = (String) this.savingsAccountHelper.getSavingsAccountDetail(this.savingsId, "accountNo");
if (isAccountPreferenceSetUp) {
String savingsPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.savingsAccountNumberPreferenceId, "prefixType.value");
String savingsPrefixName = (String) this.accountNumberPreferencesHelper
.getAccountNumberPreference(this.savingsAccountNumberPreferenceId, "prefixType.value");
if (savingsPrefixName.equals(this.officeName)) {
String savingsOfficeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(),
@@ -127,8 +127,8 @@ public class AccountTransferTest {
*/
@AfterEach
public void tearDown() {
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper.deleteFinancialActivityAccount(
financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper
.deleteFinancialActivityAccount(financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Assertions.assertNotNull(deletedFinancialActivityAccountId);
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
}
@@ -214,10 +214,10 @@ public class AccountTransferTest {
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
assertEquals(toSavingsBalance, toSavingsSummaryAfter.get("accountBalance"),
"Verifying To Savings Account Balance after Account Transfer");
final JournalEntry[] office1LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT),
JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT),
JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] office1LiabilityEntries = {
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT), JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] office2LiabilityEntries = {
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT), JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
@@ -311,10 +311,10 @@ public class AccountTransferTest {
assertEquals(TRANSFER_AMOUNT_ADJUST, toLoanSummaryAfter.get("totalRepayment"),
"Verifying To Loan Repayment Amount after Account Transfer");
final JournalEntry[] office1LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] office1LiabilityEntries = {
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] office2LiabilityEntries = {
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
@@ -432,10 +432,10 @@ public class AccountTransferTest {
assertEquals(toSavingsBalance, toSavingsSummaryAfter.get("accountBalance"),
"Verifying From Savings Account Balance after Account Transfer");
final JournalEntry[] office1LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] office1LiabilityEntries = {
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] office2LiabilityEntries = {
new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
@@ -68,6 +68,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "unused", "rawtypes", "unchecked", "static-access" })
public class AccountingScenarioIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(AccountingScenarioIntegrationTest.class);
private static RequestSpecification requestSpec;
private static ResponseSpecification responseSpec;
@@ -94,7 +95,8 @@ public class AccountingScenarioIntegrationTest {
Float SP_WITHDRAWAL_AMOUNT = Float.valueOf(WITHDRAWAL_AMOUNT);
Float SP_WITHDRAWAL_AMOUNT_ADJUSTED = Float.valueOf(WITHDRAWAL_AMOUNT_ADJUSTED);
private final String[] REPAYMENT_DATE = { "", "04 May 2011", "04 July 2011", "04 September 2011", "04 November 2011", "04 January 2012" };
private final String[] REPAYMENT_DATE = { "", "04 May 2011", "04 July 2011", "04 September 2011", "04 November 2011",
"04 January 2012" };
private final Float[] REPAYMENT_AMOUNT = { .0f, 2200.0f, 3000.0f, 900.0f, 2000.0f, 2500.0f };
private final Float AMOUNT_TO_BE_WAIVE = 400.0f;
@@ -274,8 +276,8 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountInitialEntry);
this.journalEntryHelper
.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE, liablilityAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
liablilityAccountInitialEntry);
// First Transaction-Deposit
this.savingsAccountHelper.depositToSavingsAccount(savingsID, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE,
@@ -285,10 +287,10 @@ public class AccountingScenarioIntegrationTest {
assertEquals(balance, summary.get("accountBalance"), "Verifying Balance after Deposit");
LOG.info("----------------------Verifying Journal Entry after the Transaction Deposit----------------------------");
final JournalEntry[] assetAccountFirstTransactionEntry = { new JournalEntry(this.SP_DEPOSIT_AMOUNT,
JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liabililityAccountFirstTransactionEntry = { new JournalEntry(this.SP_DEPOSIT_AMOUNT,
JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] assetAccountFirstTransactionEntry = {
new JournalEntry(this.SP_DEPOSIT_AMOUNT, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liabililityAccountFirstTransactionEntry = {
new JournalEntry(this.SP_DEPOSIT_AMOUNT, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountFirstTransactionEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
liabililityAccountFirstTransactionEntry);
@@ -301,10 +303,10 @@ public class AccountingScenarioIntegrationTest {
assertEquals(balance, summary.get("accountBalance"), "Verifying Balance after Withdrawal");
LOG.info("-------------------Verifying Journal Entry after the Transaction Withdrawal----------------------");
final JournalEntry[] assetAccountSecondTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT,
JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] liabililityAccountSecondTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT,
JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] assetAccountSecondTransactionEntry = {
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT, JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] liabililityAccountSecondTransactionEntry = {
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT, JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountSecondTransactionEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
liabililityAccountSecondTransactionEntry);
@@ -322,16 +324,15 @@ public class AccountingScenarioIntegrationTest {
Float chargeAmount = (Float) paidCharge.get("amount");
// Withdrawal after adding Charge of type Withdrawal Fee
this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsID, WITHDRAWAL_AMOUNT_ADJUSTED,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsID, WITHDRAWAL_AMOUNT_ADJUSTED, SavingsAccountHelper.TRANSACTION_DATE,
CommonConstants.RESPONSE_RESOURCE_ID);
summary = this.savingsAccountHelper.getSavingsSummary(savingsID);
balance = balance - SP_WITHDRAWAL_AMOUNT_ADJUSTED - chargeAmount;
final JournalEntry[] liabililityAccountThirdTransactionEntry = {
new JournalEntry(chargeAmount, JournalEntry.TransactionType.DEBIT),
final JournalEntry[] liabililityAccountThirdTransactionEntry = { new JournalEntry(chargeAmount, JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] assetAccountThirdTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED,
JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] assetAccountThirdTransactionEntry = {
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] incomeAccountThirdTransactionEntry = { new JournalEntry(chargeAmount, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountThirdTransactionEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
@@ -464,8 +465,8 @@ public class AccountingScenarioIntegrationTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, RecurringDepositTest.WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -529,13 +530,14 @@ public class AccountingScenarioIntegrationTest {
LOG.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) //
.withSubmittedOnDate(submittedOnDate).build(clientID, productID, penalInterestType);
return this.fixedDepositAccountHelper
.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec);
return this.fixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec,
this.responseSpec);
}
private Integer createRecurringDepositProduct(final String validFrom, final String validTo, Account... accounts) {
LOG.info("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec,
this.responseSpec);
final String recurringDepositProductJSON = recurringDepositProductHelper //
.withPeriodRangeChart()//
.withAccountingRuleAsCashBased(accounts).build(validFrom, validTo);
@@ -715,8 +717,8 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry[] assetAccountEntry = { new JournalEntry(15000f, JournalEntry.TransactionType.DEBIT),
new JournalEntry(11000f, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, this.REPAYMENT_DATE[1], new JournalEntry(4000f,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, this.REPAYMENT_DATE[1],
new JournalEntry(4000f, JournalEntry.TransactionType.CREDIT));
LOG.info("Repayment Done......");
}
@@ -738,8 +740,8 @@ public class AccountingScenarioIntegrationTest {
final float PENALTY_PORTION = 100.0f;
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
@@ -766,10 +768,8 @@ public class AccountingScenarioIntegrationTest {
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
this.loanTransactionHelper.addChargesForLoan(
loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(flatSpecifiedDueDate), dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
todayDate.add(Calendar.DATE, 1);
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(flat), dateFormat.format(todayDate.getTime()), String.valueOf(FEE_PORTION)));
@@ -833,11 +833,11 @@ public class AccountingScenarioIntegrationTest {
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
Integer flatNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_FEE_PORTION), false));
Integer flatNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_FEE_PORTION), false));
Integer flatSpecifiedDueDateNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_PENALTY_PORTION), true));
@@ -866,29 +866,20 @@ public class AccountingScenarioIntegrationTest {
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
this.loanTransactionHelper.addChargesForLoan(
loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(flatSpecifiedDueDate), dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
todayDate.add(Calendar.DATE, 1);
String runOndate = dateFormat.format(todayDate.getTime());
this.loanTransactionHelper
.addChargesForLoan(
loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), runOndate,
String.valueOf(FEE_PORTION)));
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper
.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), runOndate, String.valueOf(FEE_PORTION)));
todayDate.add(Calendar.DATE, 1);
this.loanTransactionHelper.addChargesForLoan(
loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDateNext),
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_PENALTY_PORTION)));
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(flatSpecifiedDueDateNext), dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_PENALTY_PORTION)));
this.loanTransactionHelper.addChargesForLoan(
loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatNext),
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_FEE_PORTION)));
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(flatNext), dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_FEE_PORTION)));
// CHECK ACCOUNT ENTRIES
LOG.info("Entries ......");
@@ -986,8 +977,8 @@ public class AccountingScenarioIntegrationTest {
new JournalEntry(FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
LOG.info("CHECKING INCOME: ******************************************");
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[1], new JournalEntry(FIRST_INTEREST,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[1],
new JournalEntry(FIRST_INTEREST, JournalEntry.TransactionType.CREDIT));
LOG.info("Repayment 1 Done......");
// REPAYMENT 2
@@ -1001,8 +992,8 @@ public class AccountingScenarioIntegrationTest {
new JournalEntry(SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT), };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
LOG.info("CHECKING INCOME: ******************************************");
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[2], new JournalEntry(
SECOND_AND_THIRD_INTEREST, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[2],
new JournalEntry(SECOND_AND_THIRD_INTEREST, JournalEntry.TransactionType.CREDIT));
LOG.info("Repayment 2 Done ......");
// WAIVE INTEREST
@@ -33,9 +33,8 @@ public class ActuatorIntegrationTest {
@Test
public void testActuatorGitBuildInfo() {
Response response = RestAssured.given()
.headers("Content-Type", ContentType.JSON, "Accept", ContentType.JSON).when()
.get(INFO_URL).then().contentType(ContentType.JSON).extract().response();
Response response = RestAssured.given().headers("Content-Type", ContentType.JSON, "Accept", ContentType.JSON).when().get(INFO_URL)
.then().contentType(ContentType.JSON).extract().response();
Map<String, String> gitBuildInfo = response.jsonPath().getMap("git");
@@ -58,7 +58,8 @@ public class BatchApiTest {
/**
* Sets up the essential settings for the TEST like contentType,
* expectedStatusCode. It uses the '@BeforeEach' annotation provided by jUnit.
* expectedStatusCode. It uses the '@BeforeEach' annotation provided by
* jUnit.
*/
@BeforeEach
public void setup() {
@@ -333,10 +334,10 @@ public class BatchApiTest {
}
/**
* Tests that batch repayment for loans is happening properly.
* Collected properly 200(OK) status was returned for successful responses.
* It first creates a new loan and then makes two repayments for it
* and then verifies that 200(OK) is returned for the repayment requests.
* Tests that batch repayment for loans is happening properly. Collected
* properly 200(OK) status was returned for successful responses. It first
* creates a new loan and then makes two repayments for it and then verifies
* that 200(OK) is returned for the repayment requests.
*
* @see org.apache.fineract.batch.command.internal.RepayLoanCommandStrategy
*/
@@ -482,8 +483,9 @@ public class BatchApiTest {
}
/**
* Test for the successful create client, apply loan,approval and disbursal of a loan using
* Batch API with enclosingTransaction. A '200' status code is expected on successful activation.
* Test for the successful create client, apply loan,approval and disbursal
* of a loan using Batch API with enclosingTransaction. A '200' status code
* is expected on successful activation.
*
* @see org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy
* @see org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy
@@ -58,7 +58,8 @@ public class BatchRequestsIntegrationTest {
/**
* Sets up the essential settings for the TEST like contentType,
* expectedStatusCode. It uses the '@BeforeEach' annotation provided by jUnit.
* expectedStatusCode. It uses the '@BeforeEach' annotation provided by
* jUnit.
*/
@BeforeEach
public void setup() {
@@ -42,6 +42,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CenterIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(CenterIntegrationTest.class);
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
@@ -106,8 +107,8 @@ public class CenterIntegrationTest {
Assertions.assertNotNull(paginatedList);
Assertions.assertNotNull(list);
Assertions.assertTrue(Arrays.equals(paginatedList.toArray(new CenterDomain[paginatedList.size()]),
list.toArray(new CenterDomain[list.size()])));
Assertions.assertTrue(
Arrays.equals(paginatedList.toArray(new CenterDomain[paginatedList.size()]), list.toArray(new CenterDomain[list.size()])));
}
@Test
@@ -190,8 +191,8 @@ public class CenterIntegrationTest {
map.put("active", "true");
map.put("activationDate", "04 March 2011");
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec, "/fineract-provider/api/v1/groups?"
+ Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec,
"/fineract-provider/api/v1/groups?" + Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
}
return groupMembers;
}
@@ -220,9 +221,8 @@ public class CenterIntegrationTest {
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec,
this.responseSpec, groupID.toString(),
staffId.longValue());
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec, this.responseSpec,
groupID.toString(), staffId.longValue());
assertEquals(assignStaffToCenterResponseMap.get("staffId"), staffId, "Verify assigned staff id is the same as id sent");
final CenterDomain center = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
@@ -241,18 +241,16 @@ public class CenterIntegrationTest {
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec,
this.responseSpec, groupID.toString(),
staffId.longValue());
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec, this.responseSpec,
groupID.toString(), staffId.longValue());
assertEquals(assignStaffToCenterResponseMap.get("staffId"), staffId, "Verify assigned staff id is the same as id sent");
final CenterDomain centerWithStaffAssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
Assertions.assertNotNull(centerWithStaffAssigned);
Assertions.assertTrue(centerWithStaffAssigned.getId().intValue() == groupID);
Assertions.assertTrue(centerWithStaffAssigned.getStaffId().intValue() == staffId);
final HashMap unassignStaffToCenterResponseMap = (HashMap) CenterHelper.unassignStaff(this.requestSpec,
this.responseSpec, groupID.toString(),
staffId.longValue());
final HashMap unassignStaffToCenterResponseMap = (HashMap) CenterHelper.unassignStaff(this.requestSpec, this.responseSpec,
groupID.toString(), staffId.longValue());
assertEquals(unassignStaffToCenterResponseMap.get("staffId"), null, "Verify staffId is null after unassigning ");
final CenterDomain centerWithStaffUnssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
Assertions.assertNotNull(centerWithStaffUnssigned);
@@ -63,6 +63,7 @@ import org.slf4j.LoggerFactory;
*/
@SuppressWarnings({ "rawtypes" })
public class ClientSavingsIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(ClientSavingsIntegrationTest.class);
public static final String DEPOSIT_AMOUNT = "2000";
public static final String WITHDRAW_AMOUNT = "1000";
@@ -203,8 +204,8 @@ public class ClientSavingsIntegrationTest {
Calendar todaysDate = Calendar.getInstance();
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
String withdrawBalance = "false";
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.closeSavingsAccountAndGetBackRequiredField(
savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper
.closeSavingsAccountAndGetBackRequiredField(savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
@@ -559,8 +560,8 @@ public class ClientSavingsIntegrationTest {
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.inactivateCharge(annualSavingsChargeId,
savingsId, CommonConstants.RESPONSE_ERROR);
assertEquals("validation.msg.savingsaccountcharge.inactivation.of.charge.not.allowed.when.charge.is.due", savingsAccountErrorData
.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
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.DATE_FORMAT, Locale.US);
Calendar cal = Calendar.getInstance();
@@ -604,8 +605,8 @@ public class ClientSavingsIntegrationTest {
savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.inactivateCharge(monthlySavingsCharge, savingsId,
CommonConstants.RESPONSE_ERROR);
assertEquals("validation.msg.savingsaccountcharge.inactivation.of.charge.not.allowed.when.charge.is.due", savingsAccountErrorData
.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
assertEquals("validation.msg.savingsaccountcharge.inactivation.of.charge.not.allowed.when.charge.is.due",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
this.savingsAccountHelper.waiveCharge((Integer) savingsChargeForWaive.get("id"), savingsId);
HashMap waiveCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForWaive.get("id"));
@@ -630,8 +631,8 @@ public class ClientSavingsIntegrationTest {
savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.inactivateCharge(weeklySavingsFeeId, savingsId,
CommonConstants.RESPONSE_ERROR);
assertEquals("validation.msg.savingsaccountcharge.inactivation.of.charge.not.allowed.when.charge.is.due", savingsAccountErrorData
.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
assertEquals("validation.msg.savingsaccountcharge.inactivation.of.charge.not.allowed.when.charge.is.due",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
cal = Calendar.getInstance();
dates = (List) savingsChargeForPay.get("dueDate");
@@ -793,8 +794,8 @@ public class ClientSavingsIntegrationTest {
todaysDate = Calendar.getInstance();
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
String withdrawBalance = "false";
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.closeSavingsAccountAndGetBackRequiredField(
savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper
.closeSavingsAccountAndGetBackRequiredField(savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
@@ -802,14 +803,12 @@ public class ClientSavingsIntegrationTest {
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccountPostInterestOnLastDayWithOverdraft() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec,
this.responseSpec);
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
/***
* Create a client to apply for savings account (overdraft account).
*/
final Integer clientID = ClientHelper.createClient(this.requestSpec,
this.responseSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(clientID);
final String minBalanceForInterestCalculation = null;
@@ -821,33 +820,27 @@ public class ClientSavingsIntegrationTest {
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final boolean allowOverdraft = true;
final Integer savingsProductID = createSavingsProduct(this.requestSpec,
this.responseSpec, zeroOpeningBalance,
minBalanceForInterestCalculation, minRequiredBalance,
enforceMinRequiredBalance, allowOverdraft);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, zeroOpeningBalance,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assertions.assertNotNull(savingsProductID);
/***
* Apply for Savings account
*/
final Integer savingsId = this.savingsAccountHelper
.applyForSavingsApplication(clientID, savingsProductID,
ACCOUNT_TYPE_INDIVIDUAL);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsProductID);
HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(
clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL);
HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId,
ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertTrue(modifications.containsKey("submittedOnDate"));
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(
this.requestSpec, this.responseSpec, savingsId);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
/***
* Approve the savings account
*/
savingsStatusHashMap = this.savingsAccountHelper
.approveSavings(savingsId);
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
@@ -862,26 +855,23 @@ public class ClientSavingsIntegrationTest {
* @param activationDate
* this value is every time first day of previous month
*/
savingsStatusHashMap = activateSavingsAccount(savingsId,
ACTIVATION_DATE);
savingsStatusHashMap = activateSavingsAccount(savingsId, ACTIVATION_DATE);
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
/***
* Verify the account summary
*/
final HashMap summaryBefore = this.savingsAccountHelper
.getSavingsSummary(savingsId);
final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
this.savingsAccountHelper.calculateInterestForSavings(savingsId);
HashMap summary = this.savingsAccountHelper
.getSavingsSummary(savingsId);
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
assertEquals(summaryBefore, summary);
final Integer lastDayOfMonth = todaysDate
.getActualMaximum(Calendar.DAY_OF_MONTH);
final Integer lastDayOfMonth = todaysDate.getActualMaximum(Calendar.DAY_OF_MONTH);
todaysDate.set(Calendar.DAY_OF_MONTH, lastDayOfMonth);
final String WITHDRAWAL_DATE = dateFormat.format(todaysDate.getTime());
Float balance = Float.valueOf(zeroOpeningBalance);
//DateFormat transactionDateFormat = new SimpleDateFormat("dd MMMM yyyy",Locale.US);
// DateFormat transactionDateFormat = new SimpleDateFormat("dd MMMM
// yyyy",Locale.US);
Calendar transactionDate = Calendar.getInstance();
transactionDate.set(Calendar.DAY_OF_MONTH, 2);
String TRANSACTION_DATE = dateFormat.format(transactionDate.getTime());
@@ -893,16 +883,12 @@ public class ClientSavingsIntegrationTest {
* @param transactionDate
* this value is every time last day of previous month
*/
Integer depositTransactionId = (Integer) this.savingsAccountHelper
.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
WITHDRAWAL_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper
.getSavingsTransaction(savingsId, depositTransactionId);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"),
"Verifying Deposit Amount");
assertEquals(balance, depositTransaction.get("runningBalance"),
"Verifying Balance after Deposit");
assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount");
assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit");
/***
* Calculate expected interest to be posted, interest should be posted
@@ -910,18 +896,13 @@ public class ClientSavingsIntegrationTest {
* month before this account balance is negative.
*/
this.savingsAccountHelper.postInterestForSavings(savingsId);
HashMap accountDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountDetails.get("summary");
Float accountDetailsPostInterestPosted = Float.valueOf(summary.get(
"totalInterestPosted").toString());
Float accountDetailsPostInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString());
Float nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
HashMap interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString());
Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
double interestRateInFraction = nominalAnnualInterest / 100;
double perDay = (double) 1 / daysInYear;
double interestPerDay = interestRateInFraction * perDay;
@@ -931,29 +912,20 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
DecimalFormat decimalFormat = new DecimalFormat("",
new DecimalFormatSymbols(Locale.US));
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
this.savingsAccountHelper.postInterestAsOnSavings(savingsId,
TRANSACTION_DATE);
HashMap accountTransactionDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE);
HashMap accountTransactionDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountDetails.get("summary");
Float accountDetailsPostInterest = Float.valueOf(summary.get(
"totalInterestPosted").toString());
Float accountDetailsPostInterest = Float.valueOf(summary.get("totalInterestPosted").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay;
@@ -963,33 +935,24 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US));
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("-----Post Interest As on Successfully Worked----------");
transactionDate.set(Calendar.DAY_OF_MONTH, 3);
TRANSACTION_DATE = dateFormat.format(transactionDate.getTime());
this.savingsAccountHelper.postInterestAsOnSavings(savingsId,
TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountDetails.get("summary");
accountDetailsPostInterest = Float.valueOf(summary.get(
"totalInterestPosted").toString());
accountDetailsPostInterest = Float.valueOf(summary.get("totalInterestPosted").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay;
@@ -999,36 +962,28 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US));
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("-----Post Interest As on Successfully Worked-------");
//DateFormat transactionFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
// DateFormat transactionFormat = new SimpleDateFormat("dd MMMM yyyy",
// Locale.US);
Calendar transactionCalendarDateFormat = Calendar.getInstance();
transactionCalendarDateFormat.add(Calendar.DAY_OF_MONTH, 0);
transactionDate.set(Calendar.DAY_OF_MONTH, 22);
TRANSACTION_DATE = dateFormat.format(transactionDate.getTime());
if (Calendar.DAY_OF_MONTH >= 22) {
this.savingsAccountHelper.postInterestAsOnSavings(savingsId,
TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountTransactionDetails.get("summary");
accountDetailsPostInterest = Float.valueOf(summary.get(
"totalInterestPosted").toString());
accountDetailsPostInterest = Float.valueOf(summary.get("totalInterestPosted").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get(
"id").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay;
@@ -1038,40 +993,28 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US));
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("-----Post Interest As on Successfully Worked----------");
}
DateFormat lastTransactionDateFormat = new SimpleDateFormat(
"dd MMMM yyyy", Locale.US);
DateFormat lastTransactionDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar postedLastDate = Calendar.getInstance();
int numberOfDateOfMonth = postedLastDate
.getActualMaximum(Calendar.DAY_OF_MONTH);
TRANSACTION_DATE = lastTransactionDateFormat.format(transactionDate
.getTime());
int numberOfDateOfMonth = postedLastDate.getActualMaximum(Calendar.DAY_OF_MONTH);
TRANSACTION_DATE = lastTransactionDateFormat.format(transactionDate.getTime());
if (Calendar.DAY_OF_MONTH == numberOfDateOfMonth) {
this.savingsAccountHelper.postInterestAsOnSavings(savingsId,
TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountTransactionDetails.get("summary");
accountDetailsPostInterest = Float.valueOf(summary.get(
"totalInterestPosted").toString());
accountDetailsPostInterest = Float.valueOf(summary.get("totalInterestPosted").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get(
"id").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay;
@@ -1081,33 +1024,24 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US));
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("-----Post Interest As on Successfully Worked----------");
}
transactionDate.set(Calendar.DAY_OF_MONTH, 1);
TRANSACTION_DATE = dateFormat.format(transactionDate.getTime());
this.savingsAccountHelper.postInterestAsOnSavings(savingsId,
TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountTransactionDetails.get("summary");
accountDetailsPostInterest = Float.valueOf(summary.get(
"totalInterestPosted").toString());
accountDetailsPostInterest = Float.valueOf(summary.get("totalInterestPosted").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay;
@@ -1117,14 +1051,11 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US));
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("-----Post Interest As on Successfully Worked----------");
}
@@ -1132,14 +1063,12 @@ public class ClientSavingsIntegrationTest {
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccountPostInterestOnLastDayWithdrawalWithOverdraft() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec,
this.responseSpec);
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
/***
* Create a client to apply for savings account (overdraft account).
*/
final Integer clientID = ClientHelper.createClient(this.requestSpec,
this.responseSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(clientID);
final String minBalanceForInterestCalculation = null;
@@ -1151,33 +1080,27 @@ public class ClientSavingsIntegrationTest {
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final boolean allowOverdraft = true;
final Integer savingsProductID = createSavingsProduct(this.requestSpec,
this.responseSpec, zeroOpeningBalance,
minBalanceForInterestCalculation, minRequiredBalance,
enforceMinRequiredBalance, allowOverdraft);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, zeroOpeningBalance,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assertions.assertNotNull(savingsProductID);
/***
* Apply for Savings account
*/
final Integer savingsId = this.savingsAccountHelper
.applyForSavingsApplication(clientID, savingsProductID,
ACCOUNT_TYPE_INDIVIDUAL);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsProductID);
HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(
clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL);
HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId,
ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertTrue(modifications.containsKey("submittedOnDate"));
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(
this.requestSpec, this.responseSpec, savingsId);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
/***
* Approve the savings account
*/
savingsStatusHashMap = this.savingsAccountHelper
.approveSavings(savingsId);
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
@@ -1192,26 +1115,23 @@ public class ClientSavingsIntegrationTest {
* @param activationDate
* this value is every time first day of previous month
*/
savingsStatusHashMap = activateSavingsAccount(savingsId,
ACTIVATION_DATE);
savingsStatusHashMap = activateSavingsAccount(savingsId, ACTIVATION_DATE);
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
/***
* Verify the account summary
*/
final HashMap summaryBefore = this.savingsAccountHelper
.getSavingsSummary(savingsId);
final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
this.savingsAccountHelper.calculateInterestForSavings(savingsId);
HashMap summary = this.savingsAccountHelper
.getSavingsSummary(savingsId);
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
assertEquals(summaryBefore, summary);
final Integer lastDayOfMonth = todaysDate
.getActualMaximum(Calendar.DAY_OF_MONTH);
final Integer lastDayOfMonth = todaysDate.getActualMaximum(Calendar.DAY_OF_MONTH);
todaysDate.set(Calendar.DAY_OF_MONTH, lastDayOfMonth);
final String WITHDRAWAL_DATE = dateFormat.format(todaysDate.getTime());
Float balance = Float.valueOf(zeroOpeningBalance);
//DateFormat transactionDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
// DateFormat transactionDateFormat = new SimpleDateFormat("dd MMMM
// yyyy", Locale.US);
Calendar transactionDate = Calendar.getInstance();
transactionDate.set(Calendar.DAY_OF_MONTH, 2);
String TRANSACTION_DATE = dateFormat.format(transactionDate.getTime());
@@ -1248,18 +1168,13 @@ public class ClientSavingsIntegrationTest {
* month before this account balance is negative.
*/
this.savingsAccountHelper.postInterestForSavings(savingsId);
HashMap accountDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountDetails.get("summary");
Float accountDetailsPostInterestPosted = Float.valueOf(summary.get(
"totalInterestPosted").toString());
Float accountDetailsPostInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString());
Float nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
HashMap interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString());
Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
double interestRateInFraction = nominalAnnualInterest / 100;
double perDay = (double) 1 / daysInYear;
double interestPerDay = interestRateInFraction * perDay;
@@ -1269,29 +1184,20 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
DecimalFormat decimalFormat = new DecimalFormat("",
new DecimalFormatSymbols(Locale.US));
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
this.savingsAccountHelper.postInterestAsOnSavings(savingsId,
TRANSACTION_DATE);
HashMap accountTransactionDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE);
HashMap accountTransactionDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountDetails.get("summary");
Float accountDetailsPostInterest = Float.valueOf(summary.get(
"totalInterestPosted").toString());
Float accountDetailsPostInterest = Float.valueOf(summary.get("totalInterestPosted").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay;
@@ -1301,33 +1207,24 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US));
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("-----Post Interest As on Successfully Worked----------");
transactionDate.set(Calendar.DAY_OF_MONTH, 3);
TRANSACTION_DATE = dateFormat.format(transactionDate.getTime());
this.savingsAccountHelper.postInterestAsOnSavings(savingsId,
TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountDetails.get("summary");
accountDetailsPostInterest = Float.valueOf(summary.get(
"totalInterestPosted").toString());
accountDetailsPostInterest = Float.valueOf(summary.get("totalInterestPosted").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay;
@@ -1337,36 +1234,28 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US));
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("-----Post Interest As on Successfully Worked-------");
//DateFormat transactionFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
// DateFormat transactionFormat = new SimpleDateFormat("dd MMMM yyyy",
// Locale.US);
Calendar transactionCalendarDateFormat = Calendar.getInstance();
transactionCalendarDateFormat.add(Calendar.DAY_OF_MONTH, 0);
transactionDate.set(Calendar.DAY_OF_MONTH, 22);
TRANSACTION_DATE = dateFormat.format(transactionDate.getTime());
if (Calendar.DAY_OF_MONTH >= 22) {
this.savingsAccountHelper.postInterestAsOnSavings(savingsId,
TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountTransactionDetails.get("summary");
accountDetailsPostInterest = Float.valueOf(summary.get(
"totalInterestPosted").toString());
accountDetailsPostInterest = Float.valueOf(summary.get("totalInterestPosted").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get(
"id").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay;
@@ -1376,40 +1265,28 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US));
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("-----Post Interest As on Successfully Worked----------");
}
DateFormat lastTransactionDateFormat = new SimpleDateFormat(
"dd MMMM yyyy", Locale.US);
DateFormat lastTransactionDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar postedLastDate = Calendar.getInstance();
int numberOfDateOfMonth = postedLastDate
.getActualMaximum(Calendar.DAY_OF_MONTH);
TRANSACTION_DATE = lastTransactionDateFormat.format(transactionDate
.getTime());
int numberOfDateOfMonth = postedLastDate.getActualMaximum(Calendar.DAY_OF_MONTH);
TRANSACTION_DATE = lastTransactionDateFormat.format(transactionDate.getTime());
if (Calendar.DAY_OF_MONTH == numberOfDateOfMonth) {
this.savingsAccountHelper.postInterestAsOnSavings(savingsId,
TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountTransactionDetails.get("summary");
accountDetailsPostInterest = Float.valueOf(summary.get(
"totalInterestPosted").toString());
accountDetailsPostInterest = Float.valueOf(summary.get("totalInterestPosted").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get(
"id").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay;
@@ -1419,33 +1296,24 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US));
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("-----Post Interest As on Successfully Worked----------");
}
transactionDate.set(Calendar.DAY_OF_MONTH, 1);
TRANSACTION_DATE = dateFormat.format(transactionDate.getTime());
this.savingsAccountHelper.postInterestAsOnSavings(savingsId,
TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper
.getSavingsDetails(savingsId);
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE);
accountTransactionDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountTransactionDetails.get("summary");
accountDetailsPostInterest = Float.valueOf(summary.get(
"totalInterestPosted").toString());
accountDetailsPostInterest = Float.valueOf(summary.get("totalInterestPosted").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get(
"nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails
.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString());
nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay;
@@ -1455,14 +1323,11 @@ public class ClientSavingsIntegrationTest {
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US));
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted,accountDetailsPostInterestPosted,
"Verifying interest posted");
accountDetailsPostInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("-----Post Interest As on Successfully Worked----------");
}
@@ -1608,7 +1473,8 @@ public class ClientSavingsIntegrationTest {
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
//actualInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
// actualInterestPosted =
// Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted");
LOG.info("------Post Interest As On After doing a post interest Successfully worked--------");
@@ -1623,7 +1489,6 @@ public class ClientSavingsIntegrationTest {
final String TODYS_POSTING_DATE = dateFormat.format(todysDate.getTime());
String withdrawBalance = "true";
if (TODYS_POSTING_DATE.equalsIgnoreCase(INTEREST_POSTING_DATE)) {
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, responseSpec);
validationErrorHelper.closeSavingsAccountPostInterestAndGetBackRequiredField(savingsId, withdrawBalance,
@@ -1641,8 +1506,10 @@ public class ClientSavingsIntegrationTest {
@Test
public void testPostInterestAsOnSavingsAccountWithOverdraft() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
//final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
//final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
// final ResponseSpecification errorResponse = new
// ResponseSpecBuilder().expectStatusCode(400).build();
// final SavingsAccountHelper validationErrorHelper = new
// SavingsAccountHelper(this.requestSpec, errorResponse);
/***
* Create a client to apply for savings account (overdraft account).
@@ -1754,7 +1621,6 @@ public class ClientSavingsIntegrationTest {
summary = (HashMap) accountDetails.get("summary");
Float actualInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString());
/***
* Calculate expected interest to be posted, interest should be posted
* for one day only because deposit transaction happened on last day of
@@ -1801,8 +1667,6 @@ public class ClientSavingsIntegrationTest {
}
@Test
public void testSavingsAccount_WITH_WITHHOLD_TAX() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
@@ -1816,7 +1680,8 @@ public class ClientSavingsIntegrationTest {
final String percentage = "10";
final Integer taxGroupId = createTaxGroup(percentage);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId), false);
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId),
false);
Assertions.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
@@ -1864,7 +1729,8 @@ public class ClientSavingsIntegrationTest {
final String percentage = "10";
final Integer taxGroupId = createTaxGroup(percentage);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId), false);
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId),
false);
Assertions.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
@@ -1914,7 +1780,8 @@ public class ClientSavingsIntegrationTest {
final String percentage = "10";
final Integer taxGroupId = createTaxGroup(percentage);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId), true);
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId),
true);
Assertions.assertNotNull(savingsProductID);
final Integer savingsChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
@@ -1924,7 +1791,8 @@ public class ClientSavingsIntegrationTest {
ArrayList<Integer> savingsList = new ArrayList<>();
for (int i = 0; i < 5; i++) {
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID,
ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsProductID);
HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId,
@@ -1979,7 +1847,6 @@ public class ClientSavingsIntegrationTest {
balance -= chargeAmt;
assertEquals(balance, summary.get("accountBalance"), "Verifying account Balance");
// VERIFY INACTIVE
savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(1));
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
@@ -2040,10 +1907,8 @@ public class ClientSavingsIntegrationTest {
savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(5));
SavingsStatusChecker.verifySavingsSubStatusNone(savingsStatusHashMap);
}
private HashMap activateSavingsAccount(final Integer savingsId, final String activationDate) {
final HashMap status = this.savingsAccountHelper.activateSavingsAccount(savingsId, activationDate);
return status;
@@ -2087,11 +1952,11 @@ public class ClientSavingsIntegrationTest {
private Integer createTaxGroup(final String percentage) {
final Integer liabilityAccountId = null;
final Integer taxComponentId = TaxComponentHelper.createTaxComponent(this.requestSpec, this.responseSpec, percentage, liabilityAccountId);
final Integer taxComponentId = TaxComponentHelper.createTaxComponent(this.requestSpec, this.responseSpec, percentage,
liabilityAccountId);
return TaxGroupHelper.createTaxGroup(this.requestSpec, this.responseSpec, Arrays.asList(taxComponentId));
}
/*
* private void verifySavingsInterest(final Object savingsInterest) {
* LOG.info(
@@ -2218,14 +2083,16 @@ public class ClientSavingsIntegrationTest {
}
/**
* incorrect savings account balance when charge transaction is
* reversed during an overdraft recalculate Daily Balances
* incorrect savings account balance when charge transaction is reversed
* during an overdraft recalculate Daily Balances
*/
@Test
public void testAccountBalanceAfterTransactionReversal() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
//SavingsAccountHelper savingsAccountHelperValidationError = new SavingsAccountHelper(this.requestSpec,new ResponseSpecBuilder().build());
// SavingsAccountHelper savingsAccountHelperValidationError = new
// SavingsAccountHelper(this.requestSpec,new
// ResponseSpecBuilder().build());
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(clientID);
@@ -2239,22 +2106,18 @@ public class ClientSavingsIntegrationTest {
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assertions.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsId);
HashMap savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "500",
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
String chargeAmount = "300";
String chargeCurrency = "USD";
@@ -2265,14 +2128,13 @@ public class ClientSavingsIntegrationTest {
Integer amount = 300;
final Integer chargeId = this.savingsAccountHelper.addChargesForSavingsWithDueDate(savingsId, savingsChargeId, SavingsAccountHelper.TRANSACTION_DATE,
amount);
final Integer chargeId = this.savingsAccountHelper.addChargesForSavingsWithDueDate(savingsId, savingsChargeId,
SavingsAccountHelper.TRANSACTION_DATE, amount);
Assertions.assertNotNull(chargeId);
final Integer payChargeId = this.savingsAccountHelper.payCharge(chargeId, savingsId, chargeAmount, SavingsAccountHelper.TRANSACTION_DATE);
final Integer payChargeId = this.savingsAccountHelper.payCharge(chargeId, savingsId, chargeAmount,
SavingsAccountHelper.TRANSACTION_DATE);
final Integer undoSavingsTransaction = this.savingsAccountHelper.undoSavingsAccountTransaction(savingsId, depositTransactionId);
HashMap reversedDepositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
@@ -25,6 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClientStatusChecker {
private final static Logger LOG = LoggerFactory.getLogger(ClientStatusChecker.class);
public static void verifyClientIsActive(final HashMap<String, Object> clientStatusHashMap) {
@@ -32,36 +33,31 @@ public class ClientStatusChecker {
}
public static void verifyClientClosed(final HashMap<String, Object> clientStatusHashMap) {
LOG.info(
"\n-------------------------------------- VERIFYING CLIENT IS CLOSED ------------------------------------");
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS CLOSED ------------------------------------");
assertEquals(600, (int) clientStatusHashMap.get("id"));
LOG.info("Client Status: {} \n", clientStatusHashMap);
}
public static void verifyClientPending(final HashMap<String, Object> clientStatusHashMap) {
LOG.info(
"\n-------------------------------------- VERIFYING CLIENT IS PENDING ------------------------------------");
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS PENDING ------------------------------------");
assertEquals(100, (int) clientStatusHashMap.get("id"));
LOG.info("Client Status: {} \n", clientStatusHashMap);
}
public static void verifyClientRejected(final HashMap<String, Object> clientStatusHashMap) {
LOG.info(
"\n-------------------------------------- VERIFYING CLIENT IS REJECTED ------------------------------------");
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS REJECTED ------------------------------------");
assertEquals(700, (int) clientStatusHashMap.get("id"));
LOG.info("Client Status: {} \n", clientStatusHashMap);
}
public static void verifyClientActiavted(final HashMap<String, Object> clientStatusHashMap) {
LOG.info(
"\n-------------------------------------- VERIFYING CLIENT IS ACTIVATED ------------------------------------");
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS ACTIVATED ------------------------------------");
assertEquals(300, (int) clientStatusHashMap.get("id"));
LOG.info("Client Status: {} \n", clientStatusHashMap);
}
public static void verifyClientWithdrawn(final HashMap<String, Object> clientStatusHashMap) {
LOG.info(
"\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------");
LOG.info("\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------");
assertEquals(800, (int) clientStatusHashMap.get("id"));
LOG.info("Client Status: {} \n", clientStatusHashMap);
}
@@ -53,8 +53,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization",
"Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
@@ -69,8 +68,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Assertions.assertNotNull(clientId);
// GET CLIENT STATUS
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status);
@@ -93,8 +91,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Assertions.assertNotNull(clientId);
// GET CLIENT STATUS
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status);
@@ -122,8 +119,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Assertions.assertNotNull(clientId);
// GET CLIENT STATUS
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
@@ -152,8 +148,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Assertions.assertNotNull(clientId);
// GET CLIENT STATUS
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status);
@@ -182,8 +177,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Assertions.assertNotNull(clientId);
// GET CLIENT STATUS
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status);
@@ -207,8 +201,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Assertions.assertNotNull(clientId);
// GET CLIENT STATUS
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status);
@@ -236,8 +229,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Assertions.assertNotNull(clientId);
// GET CLIENT STATUS
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
@@ -265,8 +257,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Assertions.assertNotNull(clientId);
// GET CLIENT STATUS
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status);
@@ -297,16 +288,14 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(clientId);
// GET CLIENT STATUS
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status);
status = this.clientHelper.withdrawClient(clientId);
ClientStatusChecker.verifyClientWithdrawn(status);
status = this.clientHelper.undoWithdrawn(clientId);
ClientStatusChecker.verifyClientPending(status);
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.activateClient(clientId,
CommonConstants.RESPONSE_ERROR);
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.activateClient(clientId, CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.clients.submittedOnDate.after.reopened.date",
clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
@@ -315,15 +304,15 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
@Test
public void testReopenedDate() {
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
//final ClientHelper validationErrorHelper = new ClientHelper(this.requestSpec, errorResponse);
// final ClientHelper validationErrorHelper = new
// ClientHelper(this.requestSpec, errorResponse);
// CREATE CLIENT
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(clientId);
// GET CLIENT STATUS
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status);
status = this.clientHelper.withdrawClient(clientId);
@@ -41,6 +41,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ConcurrencyIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(ConcurrencyIntegrationTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -153,11 +154,12 @@ public class ConcurrencyIntegrationTest {
this.loanTransactionHelper.makeRepayment(repaymentDate, repaymentAmount, loanId);
} catch (Exception e) {
LOG.info("Found an exception {}", e.getMessage());
LOG.info("Details of failed concurrent transaction (date, amount, loanId) are {},{},{}" , repaymentDate, repaymentAmount , loanId);
LOG.info("Details of failed concurrent transaction (date, amount, loanId) are {},{},{}", repaymentDate, repaymentAmount,
loanId);
throw (e);
}
LOG.info("Details of passed concurrent transaction, details (date, amount, loanId) are {},{},{}" , repaymentDate
, repaymentAmount , loanId);
LOG.info("Details of passed concurrent transaction, details (date, amount, loanId) are {},{},{}", repaymentDate,
repaymentAmount, loanId);
}
}
@@ -73,7 +73,6 @@ public class CurrenciesTest {
currenciestoUpdate.add("USD");
currenciestoUpdate.add("INR");
ArrayList<String> currenciesOutput = CurrenciesHelper.updateSelectedCurrencies(this.requestSpec, this.responseSpec,
currenciestoUpdate);
Assertions.assertNotNull(currenciesOutput);
@@ -33,7 +33,6 @@ public class CurrencyIntegrationTest {
private RequestSpecification requestSpec;
private SavingsAccountHelper savingsAccountHelper;
@BeforeEach
public void setup() {
Utils.initializeRESTAssured();
@@ -78,7 +78,8 @@ public class DisbursalAndRepaymentScheduleTest {
@Test
public void testRescheduleJLGLoanSynk() {
// system.out.println("---------------------------------STARTING RESCHEDULE JLG
// system.out.println("---------------------------------STARTING
// RESCHEDULE JLG
// LOAN TEST ------------------------------------------");
Calendar meetingCalendar = Calendar.getInstance();
@@ -107,8 +108,7 @@ public class DisbursalAndRepaymentScheduleTest {
final String loanType = "jlg";
final String rescheduleInterestRate = "28.0";
groupMeetingChangeCalendar.add(Calendar.DAY_OF_YEAR, 1);
final String groupMeetingNewStartDate = this.dateFormatterStandard
.format(groupMeetingChangeCalendar.getTime());
final String groupMeetingNewStartDate = this.dateFormatterStandard.format(groupMeetingChangeCalendar.getTime());
// The date
// from
// which we
@@ -122,35 +122,32 @@ public class DisbursalAndRepaymentScheduleTest {
final String rescheduleDate = this.dateFormatterStandard.format(groupMeetingChangeCalendar.getTime());
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization",
"Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("Fineract-Platform-TenantId", "default");
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.generalResponseSpec = new ResponseSpecBuilder().build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
// system.out.println("---------------------------------CREATING ENTITIES AND
// system.out.println("---------------------------------CREATING
// ENTITIES AND
// JLG LOAN ------------------------------------------");
// create all required entities
this.createRequiredEntitiesForJLGLoanSync(groupMeetingDate);
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
.withLoanTermFrequency("24").withLoanTermFrequencyAsWeeks().withNumberOfRepayments("12")
.withRepaymentEveryAfter("2").withRepaymentFrequencyTypeAsMonths()
.withAmortizationTypeAsEqualInstallments().withInterestCalculationPeriodTypeAsDays()
.withInterestRatePerPeriod(interestRatePerPeriod).withRepaymentFrequencyTypeAsWeeks()
.withSubmittedOnDate(disbursalDate).withExpectedDisbursementDate(disbursalDate)
.withLoanType(loanType).withSyncDisbursementWithMeetin()
.withCalendarID(this.groupCalendarId.toString()).build(this.clientId.toString(),
this.groupId.toString(), this.loanProductId.toString(), null);
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount).withLoanTermFrequency("24")
.withLoanTermFrequencyAsWeeks().withNumberOfRepayments("12").withRepaymentEveryAfter("2")
.withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestCalculationPeriodTypeAsDays()
.withInterestRatePerPeriod(interestRatePerPeriod).withRepaymentFrequencyTypeAsWeeks().withSubmittedOnDate(disbursalDate)
.withExpectedDisbursementDate(disbursalDate).withLoanType(loanType).withSyncDisbursementWithMeetin()
.withCalendarID(this.groupCalendarId.toString())
.build(this.clientId.toString(), this.groupId.toString(), this.loanProductId.toString(), null);
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
// Test for loan account is created
Assertions.assertNotNull(this.loanId);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec,
this.loanId);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
@@ -164,10 +161,11 @@ public class DisbursalAndRepaymentScheduleTest {
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// system.out.println("---------------------------------CHANGING GROUP MEETING
// system.out.println("---------------------------------CHANGING GROUP
// MEETING
// DATE ------------------------------------------");
CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId,
this.groupCalendarId.toString(), groupMeetingNewStartDate, "2", "2", "2"); // New
CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, this.groupCalendarId.toString(),
groupMeetingNewStartDate, "2", "2", "2"); // New
// meeting
// dates
// will be
@@ -177,74 +175,73 @@ public class DisbursalAndRepaymentScheduleTest {
// coming
// monday
ArrayList loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec,
generalResponseSpec, this.loanId);
ArrayList loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec,
this.loanId);
ArrayList dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
Calendar dueDateCalendar = Calendar.getInstance();
dueDateCalendar.setFirstDayOfWeek(Calendar.MONDAY);
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
(Integer) dueDateLoanSchedule.get(2));
assertEquals(3, dueDateCalendar.get(Calendar.DAY_OF_WEEK),
"AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY");
assertEquals(3, dueDateCalendar.get(Calendar.DAY_OF_WEEK), "AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY");
// system.out.println("---------------------------------CREATING LOAN RESCHEDULE
// system.out.println("---------------------------------CREATING LOAN
// RESCHEDULE
// REQUEST------------------------------------------");
String requestJSON = new LoanRescheduleRequestTestBuilder().updateGraceOnInterest("2")
.updateGraceOnPrincipal("2").updateNewInterestRate(rescheduleInterestRate)
.updateRescheduleFromDate(rescheduleDate).updateSubmittedOnDate(rescheduleSubmittedDate)
.build(this.loanId.toString());
String requestJSON = new LoanRescheduleRequestTestBuilder().updateGraceOnInterest("2").updateGraceOnPrincipal("2")
.updateNewInterestRate(rescheduleInterestRate).updateRescheduleFromDate(rescheduleDate)
.updateSubmittedOnDate(rescheduleSubmittedDate).build(this.loanId.toString());
this.loanRescheduleRequestId = this.loanRescheduleRequestHelper
.createLoanRescheduleRequest(requestJSON);
this.loanRescheduleRequestId = this.loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
this.loanRescheduleRequestHelper.verifyCreationOfLoanRescheduleRequest(this.loanRescheduleRequestId);
loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec,
generalResponseSpec, this.loanId);
loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, this.loanId);
dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
(Integer) dueDateLoanSchedule.get(2));
assertEquals(3, dueDateCalendar.get(Calendar.DAY_OF_WEEK),
"AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER LOAN RESCHEDULE REQUEST WAS SENT");
// system.out.println("Successfully created loan reschedule request (ID: " +
// system.out.println("Successfully created loan reschedule request (ID:
// " +
// this.loanRescheduleRequestId + ")");
// system.out.println("-----------------------------APPROVING LOAN RESCHEDULE
// system.out.println("-----------------------------APPROVING LOAN
// RESCHEDULE
// REQUEST--------------------------");
requestJSON = new LoanRescheduleRequestTestBuilder().updateSubmittedOnDate(rescheduleSubmittedDate)
.getApproveLoanRescheduleRequestJSON();
this.loanRescheduleRequestHelper.approveLoanRescheduleRequest(this.loanRescheduleRequestId,
requestJSON);
this.loanRescheduleRequestHelper.approveLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
final HashMap response = (HashMap) this.loanRescheduleRequestHelper
.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
assertTrue((Boolean) response.get("approved"));
loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec,
generalResponseSpec, this.loanId);
loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, this.loanId);
dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
(Integer) dueDateLoanSchedule.get(2));
assertEquals(3, dueDateCalendar.get(Calendar.DAY_OF_WEEK),
"AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER RESCHEDULE");
// system.out.println("Successfully changed group meeting date (CAELNDAR ID: " +
// system.out.println("Successfully changed group meeting date (CAELNDAR
// ID: " +
// this.groupCalendarId
// + ") and rescheduled loan (RESCHEDULE ID: " + this.loanRescheduleRequestId +
// + ") and rescheduled loan (RESCHEDULE ID: " +
// this.loanRescheduleRequestId +
// ")");
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec,
this.responseSpecForStatusCode403);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
}
@Test
public void testChangeGroupMeetingMaturedOnDate() {
// system.out
// .println("---------------------------------STARTING GROUP LOAN MEETING CHANGE
// DATE EXPECTED MATURED CHANGE------------------------------------------");
// .println("---------------------------------STARTING GROUP LOAN
// MEETING CHANGE
// DATE EXPECTED MATURED
// CHANGE------------------------------------------");
Calendar meetingCalendar = Calendar.getInstance();
meetingCalendar.setFirstDayOfWeek(Calendar.MONDAY);
@@ -269,8 +266,7 @@ public class DisbursalAndRepaymentScheduleTest {
final String loanType = "jlg";
groupMeetingChangeCalendar.add(Calendar.DAY_OF_YEAR, 1);
final String groupMeetingNewStartDate = this.dateFormatterStandard
.format(groupMeetingChangeCalendar.getTime());
final String groupMeetingNewStartDate = this.dateFormatterStandard.format(groupMeetingChangeCalendar.getTime());
// The date
// from
// which we
@@ -282,35 +278,32 @@ public class DisbursalAndRepaymentScheduleTest {
// tuesday.
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization",
"Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("Fineract-Platform-TenantId", "default");
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.generalResponseSpec = new ResponseSpecBuilder().build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
// system.out.println("---------------------------------CREATING ENTITIES AND
// system.out.println("---------------------------------CREATING
// ENTITIES AND
// JLG LOAN ------------------------------------------");
// create all required entities
this.createRequiredEntitiesForJLGLoanSync(groupMeetingDate);
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
.withLoanTermFrequency("24").withLoanTermFrequencyAsWeeks().withNumberOfRepayments("12")
.withRepaymentEveryAfter("2").withRepaymentFrequencyTypeAsMonths()
.withAmortizationTypeAsEqualInstallments().withInterestCalculationPeriodTypeAsDays()
.withInterestRatePerPeriod(interestRatePerPeriod).withRepaymentFrequencyTypeAsWeeks()
.withSubmittedOnDate(disbursalDate).withExpectedDisbursementDate(disbursalDate)
.withLoanType(loanType).withSyncDisbursementWithMeetin()
.withCalendarID(this.groupCalendarId.toString()).build(this.clientId.toString(),
this.groupId.toString(), this.loanProductId.toString(), null);
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount).withLoanTermFrequency("24")
.withLoanTermFrequencyAsWeeks().withNumberOfRepayments("12").withRepaymentEveryAfter("2")
.withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestCalculationPeriodTypeAsDays()
.withInterestRatePerPeriod(interestRatePerPeriod).withRepaymentFrequencyTypeAsWeeks().withSubmittedOnDate(disbursalDate)
.withExpectedDisbursementDate(disbursalDate).withLoanType(loanType).withSyncDisbursementWithMeetin()
.withCalendarID(this.groupCalendarId.toString())
.build(this.clientId.toString(), this.groupId.toString(), this.loanProductId.toString(), null);
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
// Test for loan account is created
Assertions.assertNotNull(this.loanId);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec,
this.loanId);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
@@ -324,10 +317,11 @@ public class DisbursalAndRepaymentScheduleTest {
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// system.out.println("---------------------------------CHANGING GROUP MEETING
// system.out.println("---------------------------------CHANGING GROUP
// MEETING
// DATE ------------------------------------------");
CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId,
this.groupCalendarId.toString(), groupMeetingNewStartDate, "2", "2", "2"); // New
CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, this.groupCalendarId.toString(),
groupMeetingNewStartDate, "2", "2", "2"); // New
// meeting
// dates
// will be
@@ -339,18 +333,16 @@ public class DisbursalAndRepaymentScheduleTest {
Calendar expectedMaturityCalendar = Calendar.getInstance();
expectedMaturityCalendar.setFirstDayOfWeek(Calendar.MONDAY);
ArrayList expectedMaturityDate = ((ArrayList) ((HashMap) this.loanTransactionHelper
.getLoanDetail(requestSpec, generalResponseSpec, this.loanId, "timeline"))
.get("expectedMaturityDate"));
ArrayList expectedMaturityDate = ((ArrayList) ((HashMap) this.loanTransactionHelper.getLoanDetail(requestSpec, generalResponseSpec,
this.loanId, "timeline")).get("expectedMaturityDate"));
expectedMaturityCalendar.set((Integer) expectedMaturityDate.get(0),
(Integer) expectedMaturityDate.get(1) - 1, (Integer) expectedMaturityDate.get(2));
expectedMaturityCalendar.set((Integer) expectedMaturityDate.get(0), (Integer) expectedMaturityDate.get(1) - 1,
(Integer) expectedMaturityDate.get(2));
assertEquals(3, expectedMaturityCalendar.get(Calendar.DAY_OF_WEEK),
"AFTER MEETING CHANGE DATE THE EXPECTED MATURITY SHOULD BE ON TUESDAY");
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec,
this.responseSpecForStatusCode403);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
}
/**
@@ -373,20 +365,19 @@ public class DisbursalAndRepaymentScheduleTest {
*/
private void associateClientToGroup(final Integer groupId, final Integer clientId) {
GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupId.toString(),
clientId.toString());
GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupId.toString(), clientId.toString());
GroupHelper.verifyGroupMembers(this.requestSpec, this.responseSpec, groupId, clientId);
}
private void createGroupEntityWithCalendar(final String frequency, final String interval,
final String repeatsOnDay, final String groupActivationDate) {
private void createGroupEntityWithCalendar(final String frequency, final String interval, final String repeatsOnDay,
final String groupActivationDate) {
this.groupId = GroupHelper.createGroup(this.requestSpec, this.responseSpec, groupActivationDate);
GroupHelper.verifyGroupCreatedOnServer(this.requestSpec, this.responseSpec, this.groupId);
final String startDate = groupActivationDate;
this.setGroupCalendarId(CalendarHelper.createMeetingCalendarForGroup(this.requestSpec,
this.responseSpec, this.groupId, startDate, frequency, interval, repeatsOnDay));
this.setGroupCalendarId(CalendarHelper.createMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, startDate,
frequency, interval, repeatsOnDay));
}
/**
@@ -402,9 +393,8 @@ public class DisbursalAndRepaymentScheduleTest {
**/
private void createLoanProductEntity() {
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
.withNumberOfRepayments(numberOfRepayments)
.withinterestRatePerPeriod(interestRatePerPeriod).withInterestRateFrequencyTypeAsYear()
.build(null);
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
.withInterestRateFrequencyTypeAsYear().build(null);
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "rawtypes", "unchecked", "static-access" })
public class ExternalServicesConfigurationTest {
private final static Logger LOG = LoggerFactory.getLogger(ExternalServicesConfigurationTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -86,7 +86,8 @@ public class FinancialActivityAccountsTest {
* Fetch Created Financial Activity to Account Mapping and validate
* created values
**/
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount);
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID,
liabilityTransferAccount);
/**
* Update Existing Financial Activity to Account Mapping and assert
@@ -129,8 +130,8 @@ public class FinancialActivityAccountsTest {
invalidFinancialActivityAccountError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
/** Should be able to delete a Financial Activity to Account Mapping **/
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper.deleteFinancialActivityAccount(
financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper
.deleteFinancialActivityAccount(financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Assertions.assertNotNull(deletedFinancialActivityAccountId);
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
@@ -138,7 +139,8 @@ public class FinancialActivityAccountsTest {
financialActivityAccountHelper.getFinancialActivityAccount(deletedFinancialActivityAccountId, responseSpecForResourceNotFoundError);
}
private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId, Account glAccount) {
private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId,
Account glAccount) {
HashMap mappingDetails = financialActivityAccountHelper.getFinancialActivityAccount(financialActivityAccountId, responseSpec);
Assertions.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
Assertions.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
@@ -152,8 +154,8 @@ public class FinancialActivityAccountsTest {
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
for (HashMap financialActivity : financialActivities) {
Integer financialActivityAccountId = (Integer) financialActivity.get("id");
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper.deleteFinancialActivityAccount(
financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper
.deleteFinancialActivityAccount(financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Assertions.assertNotNull(deletedFinancialActivityAccountId);
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
}
@@ -65,6 +65,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "unused", "unchecked", "rawtypes", "static-access" })
public class FixedDepositTest {
private final static Logger LOG = LoggerFactory.getLogger(FixedDepositTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -100,9 +101,12 @@ public class FixedDepositTest {
public static final Integer BIANNULLY_INTERVAL = 6;
public static final Integer ANNUL_INTERVAL = 12;
// TODO Given the difference in calculation methods in test vs application, the exact values
// returned may differ enough to cause differences in rounding. Given this, we only compare the full
// digits. A proper solution would be to implement the exact interest calculation in this test,
// TODO Given the difference in calculation methods in test vs application,
// the exact values
// returned may differ enough to cause differences in rounding. Given this,
// we only compare the full
// digits. A proper solution would be to implement the exact interest
// calculation in this test,
// and then to compare the exact results
@BeforeEach
@@ -173,8 +177,8 @@ public class FixedDepositTest {
/***
* Apply for FD account with created product and verify status
*/
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -229,8 +233,7 @@ public class FixedDepositTest {
this.journalEntryHelper.checkJournalEntryForAssetAccount(expenseAccount, INTEREST_POSTED_DATE, expenseAccountEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, INTEREST_POSTED_DATE, liablilityAccountEntry);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId,
CLOSED_ON_DATE);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit(
fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -240,21 +243,19 @@ public class FixedDepositTest {
this.responseSpec, fixedDepositAccountId.toString());
FixedDepositAccountStatusChecker.verifyFixedDepositAccountIsPrematureClosed(fixedDepositAccountStatusHashMap);
/***
* Verify journal entry transactions for preclosure transaction
*/
HashMap accountDetails = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
Float maturityAmount = Float.valueOf(accountDetails.get("maturityAmount").toString());
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.DEBIT));
}
@Test
public void testFixedDepositAccountWithPrematureClosureTypeWithdrawal_WITH_HOLD_TAX() {
this.fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
@@ -367,8 +368,7 @@ public class FixedDepositTest {
this.journalEntryHelper.checkJournalEntryForAssetAccount(expenseAccount, INTEREST_POSTED_DATE, expenseAccountEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, INTEREST_POSTED_DATE, liablilityAccountEntry);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId,
CLOSED_ON_DATE);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit(
fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -389,16 +389,15 @@ public class FixedDepositTest {
Assertions.assertNotNull(summary.get("totalWithholdTax"));
Float withHoldTax = (Float) summary.get("totalWithholdTax");
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE, new JournalEntry(withHoldTax,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE,
new JournalEntry(withHoldTax, JournalEntry.TransactionType.CREDIT));
}
@Test
public void testFixedDepositAccountClosureTypeWithdrawal_WITH_HOLD_TAX() throws InterruptedException {
this.fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
@@ -518,9 +517,8 @@ public class FixedDepositTest {
HashMap summary = (HashMap) accountDetails.get("summary");
Assertions.assertNotNull(summary.get("totalWithholdTax"));
Float withHoldTax = (Float) summary.get("totalWithholdTax");
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE, new JournalEntry(withHoldTax,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE,
new JournalEntry(withHoldTax, JournalEntry.TransactionType.CREDIT));
fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -528,7 +526,6 @@ public class FixedDepositTest {
}
@Test
public void testFixedDepositAccountWithPeriodInterestRateChart() {
final String chartToUse = "period";
@@ -663,8 +660,8 @@ public class FixedDepositTest {
/***
* Apply for FD account with created product and verify status
*/
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM, depositAmount, depositPeriod);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM, depositAmount, depositPeriod);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -761,8 +758,8 @@ public class FixedDepositTest {
incomeAccount, expenseAccount);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -819,8 +816,7 @@ public class FixedDepositTest {
*/
Account financialAccount = getMappedLiabilityFinancialAccount();
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId,
CLOSED_ON_DATE);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
/***
* Preclose the account and verify journal entries
@@ -842,11 +838,13 @@ public class FixedDepositTest {
* transaction is an account transfer you should get financial account
* mapping details and verify amounts
*/
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE, new JournalEntry(prematurityAmount,
JournalEntry.TransactionType.CREDIT), new JournalEntry(prematurityAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE,
new JournalEntry(prematurityAmount, JournalEntry.TransactionType.CREDIT),
new JournalEntry(prematurityAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(financialAccount, CLOSED_ON_DATE, new JournalEntry(prematurityAmount,
JournalEntry.TransactionType.DEBIT), new JournalEntry(prematurityAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(financialAccount, CLOSED_ON_DATE,
new JournalEntry(prematurityAmount, JournalEntry.TransactionType.DEBIT),
new JournalEntry(prematurityAmount, JournalEntry.TransactionType.CREDIT));
HashMap savingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
Float balanceAfter = (Float) savingsSummaryAfter.get("accountBalance");
@@ -913,8 +911,8 @@ public class FixedDepositTest {
incomeAccount, expenseAccount);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -957,8 +955,7 @@ public class FixedDepositTest {
this.journalEntryHelper.checkJournalEntryForAssetAccount(expenseAccount, INTEREST_POSTED_DATE, expenseAccountEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, INTEREST_POSTED_DATE, liablilityAccountEntry);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId,
CLOSED_ON_DATE);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
ArrayList<HashMap> errorResponse = (ArrayList<HashMap>) fixedDepositAccountHelperValidationError.prematureCloseForFixedDeposit(
fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_REINVEST, null, CommonConstants.RESPONSE_ERROR);
@@ -994,13 +991,12 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
this.fixedDepositProductHelper.retrieveAllFixedDepositProducts(this.requestSpec,
this.responseSpec);
this.fixedDepositProductHelper.retrieveFixedDepositProductById(this.requestSpec,
this.responseSpec, fixedDepositProductId.toString());
this.fixedDepositProductHelper.retrieveAllFixedDepositProducts(this.requestSpec, this.responseSpec);
this.fixedDepositProductHelper.retrieveFixedDepositProductById(this.requestSpec, this.responseSpec,
fixedDepositProductId.toString());
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
todaysDate.add(Calendar.DATE, -1);
@@ -1038,8 +1034,8 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -1081,8 +1077,8 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -1122,8 +1118,8 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -1161,8 +1157,8 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -1204,8 +1200,8 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -1222,8 +1218,8 @@ public class FixedDepositTest {
Integer depositPeriod = (Integer) fixedDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / daysInYear;
@@ -1272,13 +1268,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360,
WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, MONTHLY, MONTHLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM,
INTEREST_CALCULATION_USING_DAILY_BALANCE, MONTHLY, MONTHLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -1294,8 +1290,8 @@ public class FixedDepositTest {
Integer depositPeriod = (Integer) fixedDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / daysInYear;
@@ -1348,8 +1344,8 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -1369,8 +1365,8 @@ public class FixedDepositTest {
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Float preClosurePenalInterestRate = (Float) fixedDepositAccountData.get("preClosurePenalInterest");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
interestRate -= preClosurePenalInterestRate;
@@ -1394,8 +1390,7 @@ public class FixedDepositTest {
principal += interestPerMonth;
LOG.info("principal = {}", principal);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId,
CLOSED_ON_DATE);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit(
fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -1450,13 +1445,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360,
WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, MONTHLY, MONTHLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM,
INTEREST_CALCULATION_USING_DAILY_BALANCE, MONTHLY, MONTHLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -1475,8 +1470,8 @@ public class FixedDepositTest {
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Float preClosurePenalInterestRate = (Float) fixedDepositAccountData.get("preClosurePenalInterest");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
interestRate -= preClosurePenalInterestRate;
@@ -1500,8 +1495,7 @@ public class FixedDepositTest {
principal += interestPerMonth;
LOG.info("principal = {}", principal);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId,
CLOSED_ON_DATE);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit(
fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -1556,8 +1550,8 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
TILL_PREMATURE_WITHDRAWAL);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, TILL_PREMATURE_WITHDRAWAL);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
@@ -1576,8 +1570,8 @@ public class FixedDepositTest {
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Float preClosurePenalInterestRate = (Float) fixedDepositAccountData.get("preClosurePenalInterest");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Calendar activationDate = Calendar.getInstance();
activationDate.add(Calendar.MONTH, -1);
@@ -1611,8 +1605,7 @@ public class FixedDepositTest {
principal += interestPerMonth;
LOG.info("principal = {}", principal);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId,
CLOSED_ON_DATE);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit(
fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -1667,13 +1660,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
TILL_PREMATURE_WITHDRAWAL);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, TILL_PREMATURE_WITHDRAWAL);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360,
TILL_PREMATURE_WITHDRAWAL, INTEREST_CALCULATION_USING_DAILY_BALANCE, MONTHLY, MONTHLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, TILL_PREMATURE_WITHDRAWAL,
INTEREST_CALCULATION_USING_DAILY_BALANCE, MONTHLY, MONTHLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -1691,8 +1684,8 @@ public class FixedDepositTest {
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Float preClosurePenalInterestRate = (Float) fixedDepositAccountData.get("preClosurePenalInterest");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Calendar activationDate = Calendar.getInstance();
activationDate.add(Calendar.MONTH, -1);
@@ -1726,8 +1719,7 @@ public class FixedDepositTest {
principal += interestPerMonth;
LOG.info("principal = {}", principal);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId,
CLOSED_ON_DATE);
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit(
fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -1778,13 +1770,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365,
WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, MONTHLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365, WHOLE_TERM,
INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, MONTHLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -1800,8 +1792,8 @@ public class FixedDepositTest {
Integer depositPeriod = (Integer) fixedDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -1853,13 +1845,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360,
WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, MONTHLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM,
INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, MONTHLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -1875,8 +1867,8 @@ public class FixedDepositTest {
Integer depositPeriod = (Integer) fixedDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -1933,13 +1925,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365,
WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, ANNUALLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365, WHOLE_TERM,
INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, ANNUALLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -1957,8 +1949,8 @@ public class FixedDepositTest {
Integer depositPeriod = (Integer) fixedDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2016,13 +2008,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360,
WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, ANNUALLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM,
INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, ANNUALLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -2040,8 +2032,8 @@ public class FixedDepositTest {
Integer depositPeriod = (Integer) fixedDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2100,13 +2092,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365,
WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, BI_ANNUALLY, BI_ANNUALLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365, WHOLE_TERM,
INTEREST_CALCULATION_USING_DAILY_BALANCE, BI_ANNUALLY, BI_ANNUALLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -2121,8 +2113,8 @@ public class FixedDepositTest {
Integer depositPeriod = (Integer) fixedDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2181,13 +2173,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360,
WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, BI_ANNUALLY, BI_ANNUALLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM,
INTEREST_CALCULATION_USING_DAILY_BALANCE, BI_ANNUALLY, BI_ANNUALLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -2202,8 +2194,8 @@ public class FixedDepositTest {
Integer depositPeriod = (Integer) fixedDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2262,13 +2254,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365,
WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, QUARTERLY, QUARTERLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365, WHOLE_TERM,
INTEREST_CALCULATION_USING_DAILY_BALANCE, QUARTERLY, QUARTERLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -2283,8 +2275,8 @@ public class FixedDepositTest {
Integer depositPeriod = (Integer) fixedDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2342,13 +2334,13 @@ public class FixedDepositTest {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM);
Assertions.assertNotNull(fixedDepositAccountId);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(),
fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360,
WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, QUARTERLY, QUARTERLY);
this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(),
fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM,
INTEREST_CALCULATION_USING_DAILY_BALANCE, QUARTERLY, QUARTERLY);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -2363,8 +2355,8 @@ public class FixedDepositTest {
Integer depositPeriod = (Integer) fixedDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) fixedDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2385,8 +2377,8 @@ public class FixedDepositTest {
}
/***
* Test case for Fixed Deposit Account rollover with maturity
* instruction as re invest maturity amount(principal+interest)
* Test case for Fixed Deposit Account rollover with maturity instruction as
* re invest maturity amount(principal+interest)
*/
@Test
public void testFixedDepositAccountWithRolloverMaturityAmount() {
@@ -2437,14 +2429,14 @@ public class FixedDepositTest {
/***
* Set maturityInstructionId as re-invest principal+interest
* */
*/
final Integer maturityInstructionId = 300;
/***
* Apply for FD account with created product and verify status
*/
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM, maturityInstructionId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM, maturityInstructionId);
Assertions.assertNotNull(fixedDepositAccountId);
@@ -2465,10 +2457,9 @@ public class FixedDepositTest {
FixedDepositAccountStatusChecker.verifyFixedDepositIsActive(fixedDepositAccountStatusHashMap);
}
/***
* Test case for Fixed Deposit Account rollover with maturity
* instruction as re invest principal only
* Test case for Fixed Deposit Account rollover with maturity instruction as
* re invest principal only
*/
@Test
public void testFixedDepositAccountWithRolloverPrincipal() {
@@ -2519,14 +2510,14 @@ public class FixedDepositTest {
/***
* Set maturityInstructionId as re-invest principal
* */
*/
final Integer maturityInstructionId = 400;
/***
* Apply for FD account with created product and verify status
*/
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE,
WHOLE_TERM, maturityInstructionId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(),
SUBMITTED_ON_DATE, WHOLE_TERM, maturityInstructionId);
Assertions.assertNotNull(fixedDepositAccountId);
@@ -2561,7 +2552,6 @@ public class FixedDepositTest {
return FixedDepositProductHelper.createFixedDepositProduct(fixedDepositProductJSON, requestSpec, responseSpec);
}
private Integer createFixedDepositProductWithWithHoldTax(final String validFrom, final String validTo, final String taxGroupId,
final String accountingRule, Account... accounts) {
LOG.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
@@ -2613,19 +2603,18 @@ public class FixedDepositTest {
LOG.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) //
.withSubmittedOnDate(submittedOnDate).build(clientID, productID, penalInterestType);
return this.fixedDepositAccountHelper
.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec);
return this.fixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec,
this.responseSpec);
}
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String submittedOnDate,
final String penalInterestType, final Integer maturityInstructionId) {
LOG.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) //
.withSubmittedOnDate(submittedOnDate)
.withMaturityInstructionId(maturityInstructionId)
.withSubmittedOnDate(submittedOnDate).withMaturityInstructionId(maturityInstructionId)
.build(clientID, productID, penalInterestType);
return this.fixedDepositAccountHelper
.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec);
return this.fixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec,
this.responseSpec);
}
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String submittedOnDate,
@@ -2635,8 +2624,8 @@ public class FixedDepositTest {
//
.withSubmittedOnDate(submittedOnDate).withDepositPeriod(depositPeriod).withDepositAmount(depositAmount)
.build(clientID, productID, penalInterestType);
return this.fixedDepositAccountHelper
.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec);
return this.fixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec,
this.responseSpec);
}
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
@@ -2701,11 +2690,13 @@ public class FixedDepositTest {
LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping.getAccountID(), this.responseSpec,
CommonConstants.RESPONSE_RESOURCE_ID);
Assertions.assertNotNull(financialActivityAccountId);
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping);
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID,
liabilityAccountForMapping);
return liabilityAccountForMapping;
}
private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId, Account glAccount) {
private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId,
Account glAccount) {
HashMap mappingDetails = this.financialActivityAccountHelper.getFinancialActivityAccount(financialActivityAccountId,
this.responseSpec);
Assertions.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
@@ -2714,7 +2705,8 @@ public class FixedDepositTest {
private Integer createTaxGroup(final String percentage, final Account liabilityAccountForTax) {
final Integer liabilityAccountId = liabilityAccountForTax.getAccountID();
final Integer taxComponentId = TaxComponentHelper.createTaxComponent(this.requestSpec, this.responseSpec, percentage, liabilityAccountId);
final Integer taxComponentId = TaxComponentHelper.createTaxComponent(this.requestSpec, this.responseSpec, percentage,
liabilityAccountId);
return TaxGroupHelper.createTaxGroup(this.requestSpec, this.responseSpec, Arrays.asList(taxComponentId));
}
@@ -2726,8 +2718,8 @@ public class FixedDepositTest {
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
for (HashMap financialActivity : financialActivities) {
Integer financialActivityAccountId = (Integer) financialActivity.get("id");
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper.deleteFinancialActivityAccount(
financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper
.deleteFinancialActivityAccount(financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Assertions.assertNotNull(deletedFinancialActivityAccountId);
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
}
@@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "rawtypes", "unused", "unchecked" })
public class FlexibleSavingsInterestPostingIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(FlexibleSavingsInterestPostingIntegrationTest.class);
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
@@ -74,8 +75,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
final Integer savingsId = createSavingsAccount(clientID, startDate);
this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate,
CommonConstants.RESPONSE_RESOURCE_ID);
this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate, CommonConstants.RESPONSE_RESOURCE_ID);
/***
* Perform Post interest transaction and verify the posted transaction
@@ -85,8 +85,9 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
ArrayList<HashMap<String, Object>> transactions = (ArrayList<HashMap<String, Object>>) accountDetails.get("transactions");
HashMap<String, Object> interestPostingTransaction = transactions.get(transactions.size() - 2);
for (Entry<String, Object> entry : interestPostingTransaction.entrySet())
{LOG.info("{} - {}",entry.getKey(), entry.getValue().toString());}
for (Entry<String, Object> entry : interestPostingTransaction.entrySet()) {
LOG.info("{} - {}", entry.getKey(), entry.getValue().toString());
}
// 1st Dec 13 to 31st March 14 - 365 days, daily compounding using daily
// balance
// 33.7016 obtained from formula in excel provided by Subramanya
@@ -123,16 +124,16 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
Boolean enabled = (Boolean) globalConfig.get(10).get("enabled");
if (!enabled.equals(periodEndEnable)) {
periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec,
this.responseSpec, periodEndConfigId.toString(), periodEndEnable);
periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
periodEndConfigId.toString(), periodEndEnable);
}
// Updating value for financial year beginning month
Integer financialYearBeginningConfigId = (Integer) globalConfig.get(11).get("id");
Assertions.assertNotNull(financialYearBeginningConfigId);
HashMap financialYearBeginningConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec,
this.responseSpec, financialYearBeginningConfigId.toString());
HashMap financialYearBeginningConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
financialYearBeginningConfigId.toString());
Assertions.assertNotNull(financialYearBeginningConfigData);
financialYearBeginningConfigId = GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
@@ -57,10 +57,7 @@ public class FundsIntegrationTest {
@Test
public void testCreateFund() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
@@ -69,10 +66,7 @@ public class FundsIntegrationTest {
@Test
public void testCreateFundWithEmptyName() {
FundsHelper fh = FundsHelper
.create(null)
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(null).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
@@ -82,10 +76,7 @@ public class FundsIntegrationTest {
@Test
public void testCreateFundWithEmptyExternalId() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(null)
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(null).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
@@ -94,19 +85,13 @@ public class FundsIntegrationTest {
@Test
public void testCreateFundWithDuplicateName() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assertions.assertNotNull(fundID);
FundsHelper fh2 = FundsHelper
.create(fh.getName())
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh2 = FundsHelper.create(fh.getName()).externalId(Utils.randomNameGenerator("fund-", 5)).build();
jsonData = fh2.toJSON();
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
@@ -116,19 +101,13 @@ public class FundsIntegrationTest {
@Test
public void testCreateFundWithDuplicateExternalId() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assertions.assertNotNull(fundID);
FundsHelper fh2 = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(fh.getExternalId())
.build();
FundsHelper fh2 = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(fh.getExternalId()).build();
jsonData = fh2.toJSON();
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
@@ -138,10 +117,7 @@ public class FundsIntegrationTest {
@Test
public void testCreateFundWithInvalidName() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 120))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 120)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
@@ -151,10 +127,7 @@ public class FundsIntegrationTest {
@Test
public void testCreateFundWithInvalidExternalId() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 120))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 120)).build();
String jsonData = fh.toJSON();
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
@@ -164,10 +137,7 @@ public class FundsIntegrationTest {
@Test
public void testRetrieveFund() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
@@ -181,10 +151,7 @@ public class FundsIntegrationTest {
@Test
public void testRetrieveAllFunds() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
@@ -207,10 +174,7 @@ public class FundsIntegrationTest {
@Test
public void testUpdateFund() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
@@ -229,17 +193,13 @@ public class FundsIntegrationTest {
String newName = Utils.randomNameGenerator("", 10);
String newExternalId = Utils.randomNameGenerator("fund-", 5);
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
FundsHelper fh = FundsResourceHandler.updateFund(Long.MAX_VALUE, newName, newExternalId, this.requestSpec,
responseSpec);
FundsHelper fh = FundsResourceHandler.updateFund(Long.MAX_VALUE, newName, newExternalId, this.requestSpec, responseSpec);
Assertions.assertNull(fh);
}
@Test
public void testUpdateFundWithInvalidNewName() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
@@ -248,18 +208,14 @@ public class FundsIntegrationTest {
String newName = Utils.randomNameGenerator("", 120);
String newExternalId = Utils.randomNameGenerator("fund-", 5);
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec,
responseSpec);
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, responseSpec);
Assertions.assertNull(fh2);
}
@Test
public void testUpdateFundWithNewExternalId() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
@@ -273,10 +229,7 @@ public class FundsIntegrationTest {
@Test
public void testUpdateFundWithInvalidNewExternalId() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
@@ -285,18 +238,14 @@ public class FundsIntegrationTest {
String newName = Utils.randomNameGenerator("", 10);
String newExternalId = Utils.randomNameGenerator("fund-", 120);
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec,
responseSpec);
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, responseSpec);
Assertions.assertNull(fh2);
}
@Test
public void testUpdateFundWithNewName() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
@@ -310,10 +259,7 @@ public class FundsIntegrationTest {
@Test
public void testUpdateFundWithEmptyParams() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
@@ -333,9 +279,7 @@ public class FundsIntegrationTest {
Assertions.assertEquals(fh.getExternalId(), fh3.getExternalId());
}
private Long createFund(final String fundJSON,
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
private Long createFund(final String fundJSON, final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
String fundId = String.valueOf(FundsResourceHandler.createFund(fundJSON, requestSpec, responseSpec));
if (fundId.equals("null")) {
// Invalid JSON data parameters
@@ -32,7 +32,6 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
private ResponseSpecification responseSpec;
@@ -59,21 +58,18 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
// Retrieving All Global Configuration details
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec,
this.responseSpec);
Assertions.assertNotNull(globalConfig);
String configName = "interest-charged-from-date-same-as-disbursal-date";
boolean newBooleanValue = true;
for (Integer configIndex = 0; configIndex < globalConfig.size(); configIndex++) {
if (globalConfig.get(configIndex).get("name")
.equals(configName)) {
String configId = globalConfig.get(configIndex).get("id")
.toString();
Integer updateConfigId = this.globalConfigurationHelper
.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
configId.toString(), newBooleanValue);
if (globalConfig.get(configIndex).get("name").equals(configName)) {
String configId = globalConfig.get(configIndex).get("id").toString();
Integer updateConfigId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec,
this.responseSpec, configId.toString(), newBooleanValue);
Assertions.assertNotNull(updateConfigId);
break;
}
@@ -137,8 +137,8 @@ public class GlobalConfigurationTest {
cacheTypeId -= 1;
}
HashMap changes = this.globalConfigurationHelper.updateIsCacheEnabledForGlobalConfiguration(this.requestSpec,
this.responseSpec, cacheTypeId.toString());
HashMap changes = this.globalConfigurationHelper.updateIsCacheEnabledForGlobalConfiguration(this.requestSpec, this.responseSpec,
cacheTypeId.toString());
Assertions.assertEquals(cacheTypeId, changes.get("cacheType"), "Verifying Is Cache Enabled Global Config after Updation");
}
}
@@ -147,8 +147,8 @@ public class GlobalConfigurationTest {
public void testGlobalConfigForcePasswordResetDays() {
// Retrieving All Global Configuration details
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec,
this.responseSpec);
Assertions.assertNotNull(globalConfig);
String configName = "force-password-reset-days";
@@ -157,23 +157,18 @@ public class GlobalConfigurationTest {
for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) {
if (globalConfig.get(configIndex).get("name").equals(configName)) {
Integer configId = (Integer) globalConfig.get(configIndex).get(
"id");
Integer configId = (Integer) globalConfig.get(configIndex).get("id");
Assertions.assertNotNull(configId);
/*
* Update force-password-reset-days with value as 0 and Enable
* as true - failure case
*/
ArrayList error = (ArrayList) this.globalConfigurationHelper
.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.httpStatusForidden,
configId, newValue, newBooleanValue,
CommonConstants.RESPONSE_ERROR);
ArrayList error = (ArrayList) this.globalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(this.requestSpec,
this.httpStatusForidden, configId, newValue, newBooleanValue, CommonConstants.RESPONSE_ERROR);
HashMap hash = (HashMap) error.get(0);
Assertions.assertEquals(
"error.msg.password.reset.days.value.must.be.greater.than.zero",
Assertions.assertEquals("error.msg.password.reset.days.value.must.be.greater.than.zero",
hash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE),
"Force Password Reset days value must be greater than zero.");
@@ -181,27 +176,23 @@ public class GlobalConfigurationTest {
* Update force-password-reset-days with value as 50 and Enable
* as true - success case
*/
final HashMap updateSuccess = (HashMap) this.globalConfigurationHelper
.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.responseSpec, configId,
"50", newBooleanValue, "changes");
final HashMap updateSuccess = (HashMap) this.globalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.responseSpec, configId, "50", newBooleanValue, "changes");
Assertions.assertNotNull(updateSuccess);
/* Update with value as 0 and Enable as false - success case */
final HashMap updateSuccess1 = (HashMap) this.globalConfigurationHelper
.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.responseSpec, configId,
newValue, "false", "changes");
final HashMap updateSuccess1 = (HashMap) this.globalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.responseSpec, configId, newValue, "false", "changes");
Assertions.assertNotNull(updateSuccess1);
/* Update without sending value and Enable as true - failure case*/
ArrayList failure = (ArrayList) this.globalConfigurationHelper
.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.httpStatusForidden, configId,
null, newBooleanValue, CommonConstants.RESPONSE_ERROR);
/*
* Update without sending value and Enable as true - failure
* case
*/
ArrayList failure = (ArrayList) this.globalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.httpStatusForidden, configId, null, newBooleanValue, CommonConstants.RESPONSE_ERROR);
HashMap failureHash = (HashMap) failure.get(0);
Assertions.assertEquals(
"error.msg.password.reset.days.value.must.be.greater.than.zero",
Assertions.assertEquals("error.msg.password.reset.days.value.must.be.greater.than.zero",
failureHash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE),
"Force Password Reset days value must be greater than zero.");
@@ -211,12 +202,9 @@ public class GlobalConfigurationTest {
/* Update other global configuration property */
String otherConfigName = "maker-checker";
for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) {
if (globalConfig.get(configIndex).get("name")
.equals(otherConfigName)) {
String configId = globalConfig.get(configIndex).get("id")
.toString();
Integer updateConfigId = this.globalConfigurationHelper
.updateValueForGlobalConfiguration(this.requestSpec,
if (globalConfig.get(configIndex).get("name").equals(otherConfigName)) {
String configId = globalConfig.get(configIndex).get("id").toString();
Integer updateConfigId = this.globalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec,
this.responseSpec, configId, newValue);
Assertions.assertNotNull(updateConfigId);
break;
@@ -98,8 +98,8 @@ public class GroupLoanIntegrationTest {
List<Map<String, Object>> approvalFormData = new ArrayList<>();
approvalFormData.add(approvalFormData(loanId, "22 September 2011"));
HashMap loanStatusHashMap = this.loanTransactionHelper.approveGlimAccount(this.requestSpec, this.responseSpec,
approvalFormData, glimId);
HashMap loanStatusHashMap = this.loanTransactionHelper.approveGlimAccount(this.requestSpec, this.responseSpec, approvalFormData,
glimId);
LOG.info("glim approval loanSchedule: {} ", loanStatusHashMap);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
@@ -174,7 +174,8 @@ public class GroupLoanIntegrationTest {
final Integer loanId = glim.get("loanId");
LOG.info("LoanId: {} ", loanId);
final List<String> retrievedGlimAccountId=GroupHelper.verifyRetrieveGlimAccountsByGlimId(this.requestSpec, this.responseSpec, glimId);
final List<String> retrievedGlimAccountId = GroupHelper.verifyRetrieveGlimAccountsByGlimId(this.requestSpec, this.responseSpec,
glimId);
Assertions.assertNotNull(retrievedGlimAccountId);
}
@@ -236,10 +237,8 @@ public class GroupLoanIntegrationTest {
.withInterestTypeAsDecliningBalance() //
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
.withExpectedDisbursementDate("20 September 2011") //
.withSubmittedOnDate("20 September 2011")
.withLoanType("glim")
.withtotalLoan("10000")
.withParentAccount("1").build(clientID.toString(), groupID.toString(), loanProductID.toString(), null);
.withSubmittedOnDate("20 September 2011").withLoanType("glim").withtotalLoan("10000").withParentAccount("1")
.build(clientID.toString(), groupID.toString(), loanProductID.toString(), null);
LOG.info(GlimApplicationJSON);
return this.loanTransactionHelper.getGlimId(GlimApplicationJSON);
}
@@ -249,10 +248,8 @@ public class GroupLoanIntegrationTest {
assertEquals(new ArrayList<>(Arrays.asList(2011, 10, 20)), loanSchedule.get(1).get("dueDate"),
"Checking for Due Date for 1st Month");
assertEquals(Float.valueOf("2911.49"), loanSchedule.get(1).get("principalOriginalDue"),
"Checking for Principal Due for 1st Month");
assertEquals(Float.valueOf("240.00"), loanSchedule.get(1).get("interestOriginalDue"),
"Checking for Interest Due for 1st Month");
assertEquals(Float.valueOf("2911.49"), loanSchedule.get(1).get("principalOriginalDue"), "Checking for Principal Due for 1st Month");
assertEquals(Float.valueOf("240.00"), loanSchedule.get(1).get("interestOriginalDue"), "Checking for Interest Due for 1st Month");
assertEquals(new ArrayList<>(Arrays.asList(2011, 11, 20)), loanSchedule.get(2).get("dueDate"),
"Checking for Due Date for 2nd Month");
@@ -162,8 +162,8 @@ public class GroupSavingsIntegrationTest {
Calendar todaysDate = Calendar.getInstance();
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
String withdrawBalance = "false";
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.closeSavingsAccountAndGetBackRequiredField(
savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper
.closeSavingsAccountAndGetBackRequiredField(savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
@@ -267,7 +267,8 @@ public class GroupSavingsIntegrationTest {
assertEquals("validation.msg.savingsaccount.reject.cannot.be.a.future.date",
error1.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
error1 = savingsAccountHelperValidationError.rejectGsimApplicationWithErrorCode(gsimID, SavingsAccountHelper.CREATED_DATE_MINUS_ONE);
error1 = savingsAccountHelperValidationError.rejectGsimApplicationWithErrorCode(gsimID,
SavingsAccountHelper.CREATED_DATE_MINUS_ONE);
assertEquals("validation.msg.savingsaccount.reject.cannot.be.before.submittal.date",
error1.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
@@ -368,7 +369,8 @@ public class GroupSavingsIntegrationTest {
Calendar todaysDate = Calendar.getInstance();
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
String withdrawBalance = "false";
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.closeGsimSavingsAccountAndGetBackRequiredField(gsimID, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper
.closeGsimSavingsAccountAndGetBackRequiredField(gsimID, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
@@ -727,7 +729,8 @@ public class GroupSavingsIntegrationTest {
totalWaiveAmount = totalWaiveAmount.add(totalWaiveAmount);
assertEquals(totalWaiveAmount.floatValue(), waiveCharge.get("amountWaived"));
final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWeeklyFeeJSON());
final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
ChargesHelper.getSavingsWeeklyFeeJSON());
Assertions.assertNotNull(weeklyFeeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId, true);
@@ -777,7 +780,8 @@ public class GroupSavingsIntegrationTest {
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
}
private Map<String, Object> clientArray(final Integer clientId, final Integer groupId, final Integer productId, final String submittedOnDate) {
private Map<String, Object> clientArray(final Integer clientId, final Integer groupId, final Integer productId,
final String submittedOnDate) {
Map<String, Object> map = new HashMap<>();
map.put("clientId", clientId);
map.put("groupId", groupId);
@@ -790,7 +794,8 @@ public class GroupSavingsIntegrationTest {
return map;
}
private Map<String, Object> savingsArray(final Integer paymentId, final Integer savingsId, final Integer transactionAmount, final String transactionDate) {
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.DATE_FORMAT);
@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
* Updating & Deletion
*/
public class GroupTest {
private final static Logger LOG = LoggerFactory.getLogger(GroupTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -40,6 +40,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HookIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(HookIntegrationTest.class);
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
@@ -42,6 +42,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings("rawtypes")
public class LoanApplicationApprovalTest {
private final static Logger LOG = LoggerFactory.getLogger(LoanApplicationApprovalTest.class);
private ResponseSpecification responseSpec;
private ResponseSpecification responseSpecForStatusCode403;
@@ -130,14 +131,13 @@ public class LoanApplicationApprovalTest {
createTranches.add(createTrancheDetail("23 March 2014", "4000"));
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}"
, clientID);
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
.withInterestTypeAsDecliningBalance().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
.build(null));
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}"
, loanProductID);
final Integer loanProductID = this.loanTransactionHelper
.getLoanProductId(new LoanProductTestBuilder().withInterestTypeAsDecliningBalance().withTranches(true)
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
loanProductID);
this.trancheLoansApprovedAmountLesserThanProposedAmount(clientID, loanProductID, createTranches);
this.trancheLoansApprovalValidation(clientID, loanProductID, createTranches);
@@ -155,8 +155,7 @@ public class LoanApplicationApprovalTest {
approveTranches.add(createTrancheDetail("23 March 2014", "1000"));
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}"
, loanID);
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
@@ -201,8 +200,7 @@ public class LoanApplicationApprovalTest {
approveTranche4.add(createTrancheDetail("24 March 2014", "100"));
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}"
, loanID);
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
HashMap<String, Object> loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
@@ -233,8 +231,8 @@ public class LoanApplicationApprovalTest {
/* No. of tranches exceeds the max tranche count at product level */
error = this.loanTransactionHelper.approveLoanForTranches(approveDate, expectedDisbursementDate, approvalAmount3, loanID,
approveTranche3, CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.disbursementData.exceeding.max.tranche.count", error.get(0)
.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
assertEquals("error.msg.disbursementData.exceeding.max.tranche.count",
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
/* If tranches are not specified for a multi-disburse loan */
/**
@@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings("rawtypes")
public class LoanApplicationUndoLastTrancheTest {
private final static Logger LOG = LoggerFactory.getLogger(LoanApplicationUndoLastTrancheTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -67,15 +68,14 @@ public class LoanApplicationUndoLastTrancheTest {
// CREATE CLIENT
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}"
, clientID);
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
// CREATE LOAN MULTIDISBURSAL PRODUCT
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
.withInterestTypeAsDecliningBalance().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
.build(null));
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}"
, loanProductID);
final Integer loanProductID = this.loanTransactionHelper
.getLoanProductId(new LoanProductTestBuilder().withInterestTypeAsDecliningBalance().withTranches(true)
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
loanProductID);
// CREATE TRANCHES
List<HashMap> createTranches = new ArrayList<>();
@@ -89,8 +89,7 @@ public class LoanApplicationUndoLastTrancheTest {
// APPLY FOR LOAN WITH TRANCHES
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}"
, loanID);
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
// VALIDATE THE LOAN STATUS
@@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings("rawtypes")
public class LoanDisbursalDateValidationTest {
private final static Logger LOG = LoggerFactory.getLogger(LoanDisbursalDateValidationTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -65,19 +66,17 @@ public class LoanDisbursalDateValidationTest {
// CREATE CLIENT
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}"
, clientID);
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
// CREATE LOAN PRODUCT
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
.withSyncExpectedWithDisbursementDate(true).build(null));
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}"
, loanProductID);
final Integer loanProductID = this.loanTransactionHelper
.getLoanProductId(new LoanProductTestBuilder().withSyncExpectedWithDisbursementDate(true).build(null));
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
loanProductID);
// APPLY FOR LOAN
final Integer loanID = applyForLoanApplication(clientID, loanProductID, proposedAmount);
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}"
, loanID);
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
// VALIDATE THE LOAN STATUS
@@ -92,7 +91,8 @@ public class LoanDisbursalDateValidationTest {
// DISBURSE A LOAN
@SuppressWarnings("unchecked")
List<HashMap> disbursalError = (List<HashMap>) this.loanTransactionHelper.disburseLoan(disbursalDate, loanID, this.responseForbiddenError);
List<HashMap> disbursalError = (List<HashMap>) this.loanTransactionHelper.disburseLoan(disbursalDate, loanID,
this.responseForbiddenError);
Assertions.assertEquals(disbursalError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE),
"error.msg.actual.disbursement.date.does.not.match.with.expected.disbursal.date");
@@ -100,18 +100,11 @@ public class LoanDisbursalDateValidationTest {
}
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, final String proposedAmount) {
final String loanApplication = new LoanApplicationTestBuilder()
.withPrincipal(proposedAmount).withLoanTermFrequency("5")
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("5")
.withRepaymentEveryAfter("1")
.withRepaymentFrequencyTypeAsMonths()
.withInterestRatePerPeriod("2")
.withExpectedDisbursementDate("1 March 2014")
.withSubmittedOnDate("26 February 2014").
build(clientID.toString(), loanProductID.toString(), null);
final String loanApplication = new LoanApplicationTestBuilder().withPrincipal(proposedAmount).withLoanTermFrequency("5")
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("5").withRepaymentEveryAfter("1")
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("2").withExpectedDisbursementDate("1 March 2014")
.withSubmittedOnDate("26 February 2014").build(clientID.toString(), loanProductID.toString(), null);
return this.loanTransactionHelper.getLoanId(loanApplication);
}
}
@@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class LoanDisbursementDetailsIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(LoanDisbursementDetailsIntegrationTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -75,20 +76,19 @@ public class LoanDisbursementDetailsIntegrationTest {
createTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "01 Sep 2015", "5000"));
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
LOG.info("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------{}"
, clientID);
LOG.info("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------{}", clientID);
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
.withInterestTypeAsDecliningBalance().withMoratorium("", "").withAmortizationTypeAsEqualInstallments().withTranches(true)
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}"
, loanProductID);
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
loanProductID);
final Integer loanIDWithEmi = applyForLoanApplicationWithEmiAmount(clientID, loanProductID, proposedAmount, createTranches,
installmentAmount);
LOG.info("-----------------------------------LOAN CREATED WITH EMI LOANID------------------------------------------------- {}"
, loanIDWithEmi);
LOG.info("-----------------------------------LOAN CREATED WITH EMI LOANID------------------------------------------------- {}",
loanIDWithEmi);
HashMap repaymentScheduleWithEmi = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
loanIDWithEmi, "repaymentSchedule");
@@ -106,7 +106,8 @@ public class LoanDisbursementDetailsIntegrationTest {
createTranches);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
LOG.info("-----------------------------------MULTI DISBURSAL LOAN WITH EMI APPROVED SUCCESSFULLY---------------------------------------");
LOG.info(
"-----------------------------------MULTI DISBURSAL LOAN WITH EMI APPROVED SUCCESSFULLY---------------------------------------");
final Integer loanIDWithoutEmi = applyForLoanApplicationWithEmiAmount(clientID, loanProductID, proposedAmount, createTranches,
withoutInstallmentAmount);
@@ -117,8 +118,8 @@ public class LoanDisbursementDetailsIntegrationTest {
ArrayList<HashMap> periods1 = (ArrayList<HashMap>) repaymentScheduleWithEmi.get("periods");
assertEquals(15, periods1.size());
LOG.info("-----------------------------------LOAN CREATED WITHOUT EMI LOANID------------------------------------------------- {}"
, loanIDWithoutEmi);
LOG.info("-----------------------------------LOAN CREATED WITHOUT EMI LOANID------------------------------------------------- {}",
loanIDWithoutEmi);
/* To be uncommented once issue MIFOSX-2006 is closed. */
// this.validateRepaymentScheduleWithoutEMI(periods1);
@@ -131,7 +132,8 @@ public class LoanDisbursementDetailsIntegrationTest {
loanIDWithoutEmi, createTranches);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
LOG.info("-----------------------------------MULTI DISBURSAL LOAN WITHOUT EMI APPROVED SUCCESSFULLY---------------------------------------");
LOG.info(
"-----------------------------------MULTI DISBURSAL LOAN WITHOUT EMI APPROVED SUCCESSFULLY---------------------------------------");
}
@@ -208,8 +210,8 @@ public class LoanDisbursementDetailsIntegrationTest {
assertEquals(period.get("dueDate").toString(), expectedRepaymentSchedule.getDueDate());
assertEquals(period.get("principalLoanBalanceOutstanding"), expectedRepaymentSchedule.getPrincipalLoanBalanceOutstanding());
LOG.info("{}", period.get("totalOriginalDueForPeriod").toString());
assertEquals(Float.valueOf(period.get("totalOriginalDueForPeriod").toString()), expectedRepaymentSchedule
.getTotalOriginalDueForPeriod().floatValue(), 0.0f);
assertEquals(Float.valueOf(period.get("totalOriginalDueForPeriod").toString()),
expectedRepaymentSchedule.getTotalOriginalDueForPeriod().floatValue(), 0.0f);
assertEquals(Float.valueOf(period.get("totalOutstandingForPeriod").toString()).floatValue(),
expectedRepaymentSchedule.getTotalOutstandingForPeriod(), 0.0f);
@@ -220,7 +222,8 @@ public class LoanDisbursementDetailsIntegrationTest {
expectedRepaymentSchedule.getInterestOutstanding(), 0.0f);
assertEquals(Float.valueOf(period.get("principalOutstanding").toString()).floatValue(),
expectedRepaymentSchedule.getPrincipalOutstanding(), 0.0f);
assertEquals(Float.valueOf(period.get("principalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalDue(), 0.0f);
assertEquals(Float.valueOf(period.get("principalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalDue(),
0.0f);
assertEquals(Float.valueOf(period.get("principalOriginalDue").toString()).floatValue(),
expectedRepaymentSchedule.getPrincipalOriginalDue(), 0.0f);
assertEquals(period.get("fromDate").toString(), expectedRepaymentSchedule.getFromDate());
@@ -371,18 +374,16 @@ public class LoanDisbursementDetailsIntegrationTest {
createTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "01 March 2014", "1000"));
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}"
, clientID);
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
.withInterestTypeAsDecliningBalance().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
.build(null));
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}"
, loanProductID);
final Integer loanProductID = this.loanTransactionHelper
.getLoanProductId(new LoanProductTestBuilder().withInterestTypeAsDecliningBalance().withTranches(true)
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).build(null));
LOG.info("----------------------------------LOAN PRODUCT CREATED WITH ID------------------------------------------- {}",
loanProductID);
this.loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}"
, loanID);
LOG.info("-----------------------------------LOAN CREATED WITH LOANID------------------------------------------------- {}", loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings("rawtypes")
public class LoanRepaymentRescheduleAtDisbursementTest {
private final static Logger LOG = LoggerFactory.getLogger(LoanRepaymentRescheduleAtDisbursementTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -75,8 +76,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
// CREATE CLIENT
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}"
, clientID);
LOG.info("---------------------------------CLIENT CREATED WITH ID--------------------------------------------------- {}", clientID);
// CREATE LOAN MULTIDISBURSAL PRODUCT WITH INTEREST RECALCULATION
final Integer loanProductID = createLoanProductWithInterestRecalculation(LoanProductTestBuilder.RBI_INDIA_STRATEGY,
@@ -116,7 +116,8 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
this.loanTransactionHelper.disburseLoanWithRepaymentReschedule(disbursementDate, loanID, adjustRepaymentDate);
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
ArrayList<HashMap> loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, loanID);
ArrayList<HashMap> loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec,
loanID);
HashMap firstInstallement = loanRepaymnetSchedule.get(1);
Map<String, Object> expectedvalues = new HashMap<>(3);
Calendar date = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -170,17 +171,10 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
final Integer recalculationCompoundingFrequencyDayOfWeekType, final Integer recalculationRestFrequencyOnDayType,
final Integer recalculationRestFrequencyDayOfWeekType) {
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
LoanProductTestBuilder builder = new LoanProductTestBuilder()
.withPrincipal("10000.00")
.withNumberOfRepayments("12")
.withRepaymentAfterEvery("2")
.withRepaymentTypeAsWeek()
.withinterestRatePerPeriod("2")
.withInterestRateFrequencyTypeAsMonths()
.withTranches(true)
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
.withRepaymentStrategy(repaymentStrategy)
.withInterestTypeAsDecliningBalance()
LoanProductTestBuilder builder = new LoanProductTestBuilder().withPrincipal("10000.00").withNumberOfRepayments("12")
.withRepaymentAfterEvery("2").withRepaymentTypeAsWeek().withinterestRatePerPeriod("2")
.withInterestRateFrequencyTypeAsMonths().withTranches(true).withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
.withRepaymentStrategy(repaymentStrategy).withInterestTypeAsDecliningBalance()
.withInterestRecalculationDetails(interestRecalculationCompoundingMethod, rescheduleStrategyMethod,
preCloseInterestCalculationStrategy)
.withInterestRecalculationRestFrequencyDetails(recalculationRestFrequencyType, recalculationRestFrequencyInterval,
@@ -221,8 +215,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
.withRepaymentFrequencyTypeAsWeeks() //
.withInterestRatePerPeriod("2") //
.withAmortizationTypeAsEqualInstallments() //
.withTranches(tranches)
.withFixedEmiAmount("") //
.withTranches(tranches).withFixedEmiAmount("") //
.withInterestTypeAsDecliningBalance() //
.withInterestCalculationPeriodTypeAsDays() //
.withInterestCalculationPeriodTypeAsDays() //
@@ -240,7 +233,6 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
private List getDateAsArray(Calendar date, int addvalue, int type) {
date.add(type, addvalue);
return new ArrayList<>(Arrays.asList(date.get(Calendar.YEAR), date.get(Calendar.MONTH) + 1,
date.get(Calendar.DAY_OF_MONTH)));
return new ArrayList<>(Arrays.asList(date.get(Calendar.YEAR), date.get(Calendar.MONTH) + 1, date.get(Calendar.DAY_OF_MONTH)));
}
}
@@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory;
**/
@SuppressWarnings({ "rawtypes" })
public class LoanRescheduleRequestTest {
private final static Logger LOG = LoggerFactory.getLogger(LoanRescheduleRequestTest.class);
private ResponseSpecification responseSpec;
private ResponseSpecification generalResponseSpec;
@@ -98,12 +99,9 @@ public class LoanRescheduleRequestTest {
private void createLoanProductEntity() {
LOG.info("---------------------------------CREATING LOAN PRODUCT------------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder()
.withPrincipal(loanPrincipalAmount)
.withNumberOfRepayments(numberOfRepayments)
.withinterestRatePerPeriod(interestRatePerPeriod)
.withInterestRateFrequencyTypeAsYear()
.build(null);
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
.withInterestRateFrequencyTypeAsYear().build(null);
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
LOG.info("Successfully created loan product (ID:{}) ", this.loanProductId);
@@ -115,21 +113,11 @@ public class LoanRescheduleRequestTest {
private void createLoanEntity() {
LOG.info("---------------------------------NEW LOAN APPLICATION------------------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder()
.withPrincipal(loanPrincipalAmount)
.withLoanTermFrequency(numberOfRepayments)
.withLoanTermFrequencyAsMonths()
.withNumberOfRepayments(numberOfRepayments)
.withRepaymentEveryAfter("1")
.withRepaymentFrequencyTypeAsMonths()
.withAmortizationTypeAsEqualInstallments()
.withInterestCalculationPeriodTypeAsDays()
.withInterestRatePerPeriod(interestRatePerPeriod)
.withLoanTermFrequencyAsMonths()
.withSubmittedOnDate(dateString)
.withExpectedDisbursementDate(dateString)
.withPrincipalGrace("2")
.withInterestGrace("2")
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsMonths().withNumberOfRepayments(numberOfRepayments)
.withRepaymentEveryAfter("1").withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments()
.withInterestCalculationPeriodTypeAsDays().withInterestRatePerPeriod(interestRatePerPeriod).withLoanTermFrequencyAsMonths()
.withSubmittedOnDate(dateString).withExpectedDisbursementDate(dateString).withPrincipalGrace("2").withInterestGrace("2")
.build(this.clientId.toString(), this.loanProductId.toString(), null);
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
@@ -208,7 +196,8 @@ public class LoanRescheduleRequestTest {
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
assertTrue((Boolean) response.get("approved"));
final Integer numberOfRepayments = (Integer) this.loanTransactionHelper.getLoanDetail(requestSpec, generalResponseSpec, loanId, "numberOfRepayments");
final Integer numberOfRepayments = (Integer) this.loanTransactionHelper.getLoanDetail(requestSpec, generalResponseSpec, loanId,
"numberOfRepayments");
final HashMap loanSummary = this.loanTransactionHelper.getLoanSummary(requestSpec, generalResponseSpec, loanId);
final Float totalExpectedRepayment = (Float) loanSummary.get("totalExpectedRepayment");
@@ -18,7 +18,6 @@
*/
package org.apache.fineract.integrationtests;
import static org.junit.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
@@ -56,6 +55,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LoanReschedulingWithinCenterTest {
private final static Logger LOG = LoggerFactory.getLogger(LoanReschedulingWithinCenterTest.class);
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
@@ -114,8 +114,7 @@ public class LoanReschedulingWithinCenterTest {
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate,
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan,
null, null);
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan, null, null);
// APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION
final Integer loanId = applyForLoanApplicationForInterestRecalculation(clientId, groupId, calendarId, loanProductID, disbursalDate,
@@ -229,8 +228,7 @@ public class LoanReschedulingWithinCenterTest {
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate,
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan,
null, null);
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan, null, null);
Calendar seondTrancheDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
seondTrancheDate.add(Calendar.MONTH, 1);
@@ -290,7 +288,8 @@ public class LoanReschedulingWithinCenterTest {
final String interestRecalculationCompoundingMethod, final String rescheduleStrategyMethod,
final String recalculationRestFrequencyType, final String recalculationRestFrequencyInterval,
final String recalculationRestFrequencyDate, final String preCloseInterestCalculationStrategy, final Account[] accounts,
final boolean isMultiTrancheLoan, final Integer recalculationRestFrequencyOnDayType, final Integer recalculationRestFrequencyDayOfWeekType) {
final boolean isMultiTrancheLoan, final Integer recalculationRestFrequencyOnDayType,
final Integer recalculationRestFrequencyDayOfWeekType) {
final String recalculationCompoundingFrequencyType = null;
final String recalculationCompoundingFrequencyInterval = null;
final String recalculationCompoundingFrequencyDate = null;
@@ -300,8 +299,8 @@ public class LoanReschedulingWithinCenterTest {
rescheduleStrategyMethod, recalculationRestFrequencyType, recalculationRestFrequencyInterval,
recalculationRestFrequencyDate, recalculationCompoundingFrequencyType, recalculationCompoundingFrequencyInterval,
recalculationCompoundingFrequencyDate, preCloseInterestCalculationStrategy, accounts, null, false, isMultiTrancheLoan,
recalculationCompoundingFrequencyOnDayType, recalculationCompoundingFrequencyDayOfWeekType, recalculationRestFrequencyOnDayType,
recalculationRestFrequencyDayOfWeekType);
recalculationCompoundingFrequencyOnDayType, recalculationCompoundingFrequencyDayOfWeekType,
recalculationRestFrequencyOnDayType, recalculationRestFrequencyDayOfWeekType);
}
private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy,
@@ -311,20 +310,13 @@ public class LoanReschedulingWithinCenterTest {
final String recalculationCompoundingFrequencyInterval, final String recalculationCompoundingFrequencyDate,
final String preCloseInterestCalculationStrategy, final Account[] accounts, final String chargeId,
boolean isArrearsBasedOnOriginalSchedule, final boolean isMultiTrancheLoan,
final Integer recalculationCompoundingFrequencyOnDayType,
final Integer recalculationCompoundingFrequencyDayOfWeekType, final Integer recalculationRestFrequencyOnDayType,
final Integer recalculationRestFrequencyDayOfWeekType) {
final Integer recalculationCompoundingFrequencyOnDayType, final Integer recalculationCompoundingFrequencyDayOfWeekType,
final Integer recalculationRestFrequencyOnDayType, final Integer recalculationRestFrequencyDayOfWeekType) {
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
LoanProductTestBuilder builder = new LoanProductTestBuilder()
.withPrincipal("10000.00")
.withNumberOfRepayments("12")
.withRepaymentAfterEvery("2")
.withRepaymentTypeAsWeek()
.withinterestRatePerPeriod("2")
.withInterestRateFrequencyTypeAsMonths()
.withTranches(isMultiTrancheLoan)
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true)
.withRepaymentStrategy(repaymentStrategy)
LoanProductTestBuilder builder = new LoanProductTestBuilder().withPrincipal("10000.00").withNumberOfRepayments("12")
.withRepaymentAfterEvery("2").withRepaymentTypeAsWeek().withinterestRatePerPeriod("2")
.withInterestRateFrequencyTypeAsMonths().withTranches(isMultiTrancheLoan)
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true).withRepaymentStrategy(repaymentStrategy)
.withInterestTypeAsDecliningBalance()
.withInterestRecalculationDetails(interestRecalculationCompoundingMethod, rescheduleStrategyMethod,
preCloseInterestCalculationStrategy)
@@ -395,8 +387,8 @@ public class LoanReschedulingWithinCenterTest {
map.put("active", "true");
map.put("activationDate", "04 March 2011");
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec, "/fineract-provider/api/v1/groups?"
+ Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec,
"/fineract-provider/api/v1/groups?" + Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
}
return groupMembers;
}
@@ -42,6 +42,7 @@ import org.slf4j.LoggerFactory;
*/
@SuppressWarnings({ "rawtypes" })
public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(LoanWithWaiveInterestAndWriteOffIntegrationTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -174,17 +175,21 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
"Checking for Principal paid ");
Assertions.assertTrue(Float.valueOf("180.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0,
"Checking for interestPaid paid ");
Assertions.assertTrue(Float.valueOf("680.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0,
Assertions.assertTrue(
Float.valueOf("680.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0,
"Checking for total paid ");
// WRITE OFF LOAN AND CHECK ACCOUNT IS CLOSED
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1 January 2011", loanID));
toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
Assertions.assertTrue(Float.valueOf("4000.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0,
Assertions.assertTrue(
Float.valueOf("4000.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0,
"Checking for Principal written off ");
Assertions.assertTrue(Float.valueOf("1440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0,
Assertions.assertTrue(
Float.valueOf("1440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0,
"Checking for interestPaid written off ");
Assertions.assertTrue(Float.valueOf("5440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0,
Assertions.assertTrue(
Float.valueOf("5440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0,
"Checking for total written off ");
}
@@ -33,6 +33,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class NotificationApiTest {
private final static Logger LOG = LoggerFactory.getLogger(NotificationApiTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -38,14 +38,9 @@ public class OfficeIntegrationTest {
@BeforeEach
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(
ContentType.JSON).build();
this.requestSpec
.header("Authorization",
"Basic "
+ Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200)
.build();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@Test
@@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class PasswordPreferencesIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(PasswordPreferencesIntegrationTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -69,8 +70,8 @@ public class PasswordPreferencesIntegrationTest {
@Test
public void updateWithInvalidPolicyId() {
String invalidValidationPolicyId = "2000";
final List<HashMap> error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec, invalidValidationPolicyId,
CommonConstants.RESPONSE_ERROR);
final List<HashMap> error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec,
invalidValidationPolicyId, CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.password.validation.policy.id.invalid", error.get(0).get("userMessageGlobalisationCode"),
"Password Validation Policy with identifier 2000 does not exist");
}
@@ -41,8 +41,7 @@ public class RatesTest {
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization",
"Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@@ -54,20 +53,15 @@ public class RatesTest {
Assertions.assertNotNull(allRatesData);
// Testing Creation and Update of Loan Rate
final Integer loanRateId = RatesHelper.createRates(this.requestSpec, this.responseSpec,
RatesHelper.getLoanRateJSON());
final Integer loanRateId = RatesHelper.createRates(this.requestSpec, this.responseSpec, RatesHelper.getLoanRateJSON());
Assertions.assertNotNull(loanRateId);
// Update Rate percentage
HashMap changes = RatesHelper.updateRates(this.requestSpec, this.responseSpec, loanRateId,
RatesHelper.getModifyRateJSON());
HashMap changes = RatesHelper.updateRates(this.requestSpec, this.responseSpec, loanRateId, RatesHelper.getModifyRateJSON());
HashMap rateDataAfterChanges = RatesHelper
.getRateById(this.requestSpec, this.responseSpec, loanRateId);
Assertions.assertEquals(rateDataAfterChanges.get("percentage"),
changes.get("percentage"), "Verifying Rate after modification");
HashMap rateDataAfterChanges = RatesHelper.getRateById(this.requestSpec, this.responseSpec, loanRateId);
Assertions.assertEquals(rateDataAfterChanges.get("percentage"), changes.get("percentage"), "Verifying Rate after modification");
}
}
@@ -64,6 +64,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "unused", "rawtypes", "unchecked", "static-access" })
public class RecurringDepositTest {
private final static Logger LOG = LoggerFactory.getLogger(RecurringDepositTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -101,9 +102,12 @@ public class RecurringDepositTest {
public static final Float DEPOSIT_AMOUNT = 2000.0f;
// TODO Given the difference in calculation methods in test vs application, the exact values
// returned may differ enough to cause differences in rounding. Given this, we only compare the full
// digits. A proper solution would be to implement the exact interest calculation in this test,
// TODO Given the difference in calculation methods in test vs application,
// the exact values
// returned may differ enough to cause differences in rounding. Given this,
// we only compare the full
// digits. A proper solution would be to implement the exact interest
// calculation in this test,
// and then to compare the exact results
@BeforeEach
@@ -181,8 +185,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
/***
@@ -211,10 +215,10 @@ public class RecurringDepositTest {
depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(depositTransactionId);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry(
depositAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry(
depositAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE,
new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE,
new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT));
/***
* Update interest earned field for RD account
@@ -240,8 +244,8 @@ public class RecurringDepositTest {
/***
* Calculate expected premature closure amount
*/
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper.calculatePrematureAmountForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper
.calculatePrematureAmountForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE);
/***
* Preclose the RD account verify whether account is preClosed
@@ -257,13 +261,13 @@ public class RecurringDepositTest {
/***
* Verify journal entry transactions for preclosure transaction
*/
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
Float maturityAmount = Float.valueOf(recurringDepositAccountData.get("maturityAmount").toString());
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.DEBIT));
}
@@ -361,8 +365,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
/***
@@ -391,10 +395,10 @@ public class RecurringDepositTest {
depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(depositTransactionId);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry(
depositAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry(
depositAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE,
new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE,
new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT));
/***
* Update interest earned field for RD account
@@ -423,8 +427,8 @@ public class RecurringDepositTest {
HashMap savingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
Float balanceBefore = (Float) savingsSummaryBefore.get("accountBalance");
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper.calculatePrematureAmountForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper
.calculatePrematureAmountForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE);
/***
* Retrieve mapped financial account for liability transfer
@@ -443,19 +447,21 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositAccountIsPrematureClosed(recurringDepositAccountStatusHashMap);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
Float maturityAmount = Float.valueOf(recurringDepositAccountData.get("maturityAmount").toString());
/***
* Verify journal entry transactions for preclosure transaction As this
* transaction is an account transfer you should get financial account
* mapping details and verify amounts
*/
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.CREDIT), new JournalEntry(maturityAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT),
new JournalEntry(maturityAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(financialAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.DEBIT), new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(financialAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.DEBIT),
new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT));
/***
* Verify rd account maturity amount and savings account balance
*/
@@ -468,8 +474,7 @@ public class RecurringDepositTest {
Double balanceAfter = Math.floor((Float) savingsSummaryAfter.get("accountBalance"));
Double expectedSavingsBalance = Math.floor(balanceBefore + prematurityAmount);
Assertions.assertEquals(expectedSavingsBalance, balanceAfter,
"Verifying Savings Account Balance after Premature Closure");
Assertions.assertEquals(expectedSavingsBalance, balanceAfter, "Verifying Savings Account Balance after Premature Closure");
}
@@ -480,7 +485,6 @@ public class RecurringDepositTest {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.recurringDepositAccountHelper = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec);
/***
* Create GL Accounts for product account mapping
*/
@@ -554,8 +558,8 @@ public class RecurringDepositTest {
* Create RD product with CashBased accounting enabled
*/
final Integer taxGroupId = createTaxGroup("10", liabilityAccountForTax);
Integer recurringDepositProductId = createRecurringDepositProductWithWithHoldTax(VALID_FROM, VALID_TO,String.valueOf(taxGroupId), accountingRule, assetAccount,
liabilityAccount, incomeAccount, expenseAccount);
Integer recurringDepositProductId = createRecurringDepositProductWithWithHoldTax(VALID_FROM, VALID_TO, String.valueOf(taxGroupId),
accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount);
Assertions.assertNotNull(recurringDepositProductId);
/***
@@ -565,8 +569,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
/***
@@ -595,10 +599,10 @@ public class RecurringDepositTest {
depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(depositTransactionId);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry(
depositAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry(
depositAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE,
new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE,
new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT));
/***
* Update interest earned field for RD account
@@ -613,12 +617,10 @@ public class RecurringDepositTest {
.postInterestForRecurringDeposit(recurringDepositAccountId);
Assertions.assertNotNull(transactionIdForPostInterest);
HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted");
Assertions.assertNull(accountSummary.get("totalWithholdTax"));
final JournalEntry[] expenseAccountEntry = { new JournalEntry(totalInterestPosted, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liablilityAccountEntry = { new JournalEntry(totalInterestPosted, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(expenseAccount, INTEREST_POSTED_DATE, expenseAccountEntry);
@@ -630,8 +632,8 @@ public class RecurringDepositTest {
HashMap savingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
Float balanceBefore = (Float) savingsSummaryBefore.get("accountBalance");
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper.calculatePrematureAmountForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper
.calculatePrematureAmountForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE);
/***
* Retrieve mapped financial account for liability transfer
@@ -650,19 +652,21 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositAccountIsPrematureClosed(recurringDepositAccountStatusHashMap);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
Float maturityAmount = Float.valueOf(recurringDepositAccountData.get("maturityAmount").toString());
/***
* Verify journal entry transactions for preclosure transaction As this
* transaction is an account transfer you should get financial account
* mapping details and verify amounts
*/
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.CREDIT), new JournalEntry(maturityAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT),
new JournalEntry(maturityAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(financialAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.DEBIT), new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(financialAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.DEBIT),
new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT));
/***
* Verify rd account maturity amount and savings account balance
*/
@@ -672,21 +676,18 @@ public class RecurringDepositTest {
HashMap summary = (HashMap) recurringDepositData.get("summary");
Assertions.assertNotNull(summary.get("totalWithholdTax"));
Float withHoldTax = (Float) summary.get("totalWithholdTax");
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE, new JournalEntry(withHoldTax,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE,
new JournalEntry(withHoldTax, JournalEntry.TransactionType.CREDIT));
HashMap savingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
Double balanceAfter = Math.floor((Float) savingsSummaryAfter.get("accountBalance"));
Double expectedSavingsBalance = Math.floor(balanceBefore + prematurityAmount);
Assertions.assertEquals(expectedSavingsBalance, balanceAfter,
"Verifying Savings Account Balance after Premature Closure");
Assertions.assertEquals(expectedSavingsBalance, balanceAfter, "Verifying Savings Account Balance after Premature Closure");
}
@Test
public void testRecurringDepositAccountWithClosureTypeTransferToSavings_WITH_HOLD_TAX() throws InterruptedException {
this.recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
@@ -694,7 +695,6 @@ public class RecurringDepositTest {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.recurringDepositAccountHelper = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec);
/***
* Create GL Accounts for product account mapping
*/
@@ -770,8 +770,8 @@ public class RecurringDepositTest {
* Create RD product with CashBased accounting enabled
*/
final Integer taxGroupId = createTaxGroup("10", liabilityAccountForTax);
Integer recurringDepositProductId = createRecurringDepositProductWithWithHoldTax(VALID_FROM, VALID_TO,String.valueOf(taxGroupId), accountingRule, assetAccount,
liabilityAccount, incomeAccount, expenseAccount);
Integer recurringDepositProductId = createRecurringDepositProductWithWithHoldTax(VALID_FROM, VALID_TO, String.valueOf(taxGroupId),
accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount);
Assertions.assertNotNull(recurringDepositProductId);
/***
@@ -781,8 +781,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
/***
@@ -815,8 +815,8 @@ public class RecurringDepositTest {
depositAmount, dateFormat.format(todaysDate.getTime()));
Assertions.assertNotNull(depositTransactionId);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, dateFormat.format(todaysDate.getTime()), new JournalEntry(
depositAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, dateFormat.format(todaysDate.getTime()),
new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, dateFormat.format(todaysDate.getTime()),
new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT));
todaysDate.add(Calendar.MONTH, 1);
@@ -836,19 +836,15 @@ public class RecurringDepositTest {
HashMap summary = (HashMap) accountDetails.get("summary");
Assertions.assertNotNull(summary.get("totalWithholdTax"));
Float withHoldTax = (Float) summary.get("totalWithholdTax");
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE, new JournalEntry(withHoldTax,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE,
new JournalEntry(withHoldTax, JournalEntry.TransactionType.CREDIT));
recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(this.requestSpec,
this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositAccountIsMatured(recurringDepositAccountStatusHashMap);
}
/***
* Test case for Recurring Deposit Account premature closure with
* transaction type ReInvest and Cash Based accounting enabled
@@ -910,8 +906,8 @@ public class RecurringDepositTest {
liabilityAccount, incomeAccount, expenseAccount);
Assertions.assertNotNull(recurringDepositProductId);
ArrayList<HashMap> allRecurringDepositProductsData = this.recurringDepositProductHelper.retrieveAllRecurringDepositProducts(
this.requestSpec, this.responseSpec);
ArrayList<HashMap> allRecurringDepositProductsData = this.recurringDepositProductHelper
.retrieveAllRecurringDepositProducts(this.requestSpec, this.responseSpec);
HashMap recurringDepositProductData = this.recurringDepositProductHelper.retrieveRecurringDepositProductById(this.requestSpec,
this.responseSpec, recurringDepositProductId.toString());
@@ -922,8 +918,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
/***
@@ -952,10 +948,10 @@ public class RecurringDepositTest {
DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(depositTransactionId);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry(
depositAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry(
depositAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE,
new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE,
new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT));
/***
* Update interest earned field for RD account
@@ -981,8 +977,8 @@ public class RecurringDepositTest {
/***
* Calculate expected premature closure amount
*/
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper.calculatePrematureAmountForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper
.calculatePrematureAmountForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE);
/***
* Expected to get an error response from api because re-invest option
@@ -1075,8 +1071,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -1123,8 +1119,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.rejectApplication(recurringDepositAccountId,
@@ -1170,8 +1166,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.withdrawApplication(recurringDepositAccountId,
@@ -1214,12 +1210,12 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountId = (Integer) this.recurringDepositAccountHelper.deleteRecurringDepositApplication(
recurringDepositAccountId, "resourceId");
recurringDepositAccountId = (Integer) this.recurringDepositAccountHelper
.deleteRecurringDepositApplication(recurringDepositAccountId, "resourceId");
Assertions.assertNotNull(recurringDepositAccountId);
}
@@ -1280,8 +1276,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
/***
@@ -1309,10 +1305,10 @@ public class RecurringDepositTest {
DEPOSIT_AMOUNT, DEPOSIT_DATE);
Assertions.assertNotNull(transactionIdForDeposit);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, DEPOSIT_DATE, new JournalEntry(DEPOSIT_AMOUNT,
JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, DEPOSIT_DATE, new JournalEntry(DEPOSIT_AMOUNT,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, DEPOSIT_DATE,
new JournalEntry(DEPOSIT_AMOUNT, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, DEPOSIT_DATE,
new JournalEntry(DEPOSIT_AMOUNT, JournalEntry.TransactionType.CREDIT));
/***
* verify account balances after transactions
@@ -1331,10 +1327,10 @@ public class RecurringDepositTest {
transactionIdForDeposit, DEPOSIT_DATE, updatedTransactionAmount);
Assertions.assertNotNull(updateTransactionId);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, DEPOSIT_DATE, new JournalEntry(updatedTransactionAmount,
JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, DEPOSIT_DATE, new JournalEntry(
updatedTransactionAmount, JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, DEPOSIT_DATE,
new JournalEntry(updatedTransactionAmount, JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, DEPOSIT_DATE,
new JournalEntry(updatedTransactionAmount, JournalEntry.TransactionType.CREDIT));
expectedBalanceAfter = DEPOSIT_AMOUNT - updatedTransactionAmount;
recurringDepositSummaryAfter = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
@@ -1394,8 +1390,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -1409,8 +1405,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
HashMap recurringDepositSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
Float principal = (Float) recurringDepositSummary.get("accountBalance");
@@ -1477,8 +1473,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, MONTHLY, MONTHLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -1492,8 +1488,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
HashMap recurringDepositSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
Float principal = (Float) recurringDepositSummary.get("accountBalance");
@@ -1552,8 +1548,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -1569,8 +1565,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE);
@@ -1603,7 +1599,8 @@ public class RecurringDepositTest {
Float principalAfter = (float) Math.floor((Float) recurringDepositAccountSummary.get("accountBalance"));
interestToBePosted = (float) Math.floor(interestToBePosted);
Assertions.assertEquals(interestToBePosted, interestAmountPosted, "Verifying Amount of Interest Posted to Recurring Deposit Account");
Assertions.assertEquals(interestToBePosted, interestAmountPosted,
"Verifying Amount of Interest Posted to Recurring Deposit Account");
Assertions.assertEquals(expectedBalanceAfter, principalAfter, "Verifying Principal Amount after Interest Posting");
}
@@ -1655,8 +1652,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -1674,8 +1671,8 @@ public class RecurringDepositTest {
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Float preClosurePenalInterestRate = (Float) recurringDepositAccountData.get("preClosurePenalInterest");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE);
@@ -1712,8 +1709,8 @@ public class RecurringDepositTest {
principal += interestPerMonth;
LOG.info("principal = {}", principal);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper.calculatePrematureAmountForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper
.calculatePrematureAmountForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE);
Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -1723,8 +1720,8 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositAccountIsPrematureClosed(recurringDepositAccountStatusHashMap);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
principal = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
@@ -1785,8 +1782,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, MONTHLY, MONTHLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -1804,8 +1801,8 @@ public class RecurringDepositTest {
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Float preClosurePenalInterestRate = (Float) recurringDepositAccountData.get("preClosurePenalInterest");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE);
@@ -1842,8 +1839,8 @@ public class RecurringDepositTest {
principal += interestPerMonth;
LOG.info("principal = {}", principal);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper.calculatePrematureAmountForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper
.calculatePrematureAmountForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE);
Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -1853,8 +1850,8 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositAccountIsPrematureClosed(recurringDepositAccountStatusHashMap);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
principal = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
@@ -1913,8 +1910,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, TILL_PREMATURE_WITHDRAWAL, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -1931,8 +1928,8 @@ public class RecurringDepositTest {
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Float preClosurePenalInterestRate = (Float) recurringDepositAccountData.get("preClosurePenalInterest");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Calendar activationDate = Calendar.getInstance();
activationDate.add(Calendar.MONTH, -1);
@@ -1980,8 +1977,8 @@ public class RecurringDepositTest {
principal += interestPerMonth;
LOG.info("principal = {}", principal);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper.calculatePrematureAmountForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper
.calculatePrematureAmountForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE);
Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -1991,8 +1988,8 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositAccountIsPrematureClosed(recurringDepositAccountStatusHashMap);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
principal = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
@@ -2056,8 +2053,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_360, TILL_PREMATURE_WITHDRAWAL, INTEREST_CALCULATION_USING_DAILY_BALANCE, MONTHLY, MONTHLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -2074,8 +2071,8 @@ public class RecurringDepositTest {
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Float preClosurePenalInterestRate = (Float) recurringDepositAccountData.get("preClosurePenalInterest");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Calendar activationDate = Calendar.getInstance();
activationDate.add(Calendar.MONTH, -1);
@@ -2123,8 +2120,8 @@ public class RecurringDepositTest {
principal += interestPerMonth;
LOG.info("principal = {}", principal);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper.calculatePrematureAmountForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE);
HashMap recurringDepositPrematureData = this.recurringDepositAccountHelper
.calculatePrematureAmountForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE);
Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit(
recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -2134,8 +2131,8 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositAccountIsPrematureClosed(recurringDepositAccountStatusHashMap);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
principal = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
@@ -2188,8 +2185,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_365, WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, MONTHLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -2205,8 +2202,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2271,8 +2268,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, MONTHLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -2288,8 +2285,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2361,8 +2358,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_365, WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, BI_ANNUALLY, BI_ANNUALLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -2377,8 +2374,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2389,8 +2386,8 @@ public class RecurringDepositTest {
principal = this.recurringDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, recurringDepositAmount,
depositPeriod, interestPerDay, BIANNULLY_INTERVAL, BIANNULLY_INTERVAL);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
@@ -2451,8 +2448,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, BI_ANNUALLY, BI_ANNUALLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -2467,8 +2464,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2479,8 +2476,8 @@ public class RecurringDepositTest {
principal = this.recurringDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, recurringDepositAmount,
depositPeriod, interestPerDay, BIANNULLY_INTERVAL, BIANNULLY_INTERVAL);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
@@ -2540,8 +2537,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_365, WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, ANNUALLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -2557,8 +2554,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2569,8 +2566,8 @@ public class RecurringDepositTest {
principal = this.recurringDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, recurringDepositAmount,
depositPeriod, interestPerDay, DAILY_COMPOUNDING_INTERVAL, ANNUL_INTERVAL);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
@@ -2630,8 +2627,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, DAILY, ANNUALLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -2647,8 +2644,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2659,8 +2656,8 @@ public class RecurringDepositTest {
principal = this.recurringDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, recurringDepositAmount,
depositPeriod, interestPerDay, DAILY_COMPOUNDING_INTERVAL, ANNUL_INTERVAL);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
@@ -2721,8 +2718,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_365, WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, QUARTERLY, QUARTERLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -2737,8 +2734,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2749,8 +2746,8 @@ public class RecurringDepositTest {
principal = this.recurringDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, recurringDepositAmount,
depositPeriod, interestPerDay, QUARTERLY_INTERVAL, QUARTERLY_INTERVAL);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
@@ -2811,8 +2808,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, DAYS_360, WHOLE_TERM, INTEREST_CALCULATION_USING_DAILY_BALANCE, QUARTERLY, QUARTERLY,
EXPECTED_FIRST_DEPOSIT_ON_DATE);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId,
@@ -2827,8 +2824,8 @@ public class RecurringDepositTest {
Integer depositPeriod = (Integer) recurringDepositAccountData.get("depositPeriod");
HashMap daysInYearMap = (HashMap) recurringDepositAccountData.get("interestCalculationDaysInYearType");
Integer daysInYear = (Integer) daysInYearMap.get("id");
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, recurringDepositProductId);
ArrayList<ArrayList<HashMap>> interestRateChartData = this.recurringDepositProductHelper
.getInterestRateChartSlabsByProductId(this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = interestRate / 100;
@@ -2839,8 +2836,8 @@ public class RecurringDepositTest {
principal = this.recurringDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, recurringDepositAmount,
depositPeriod, interestPerDay, QUARTERLY_INTERVAL, QUARTERLY_INTERVAL);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
@@ -2988,8 +2985,8 @@ public class RecurringDepositTest {
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, SUBMITTED_ON_DATE, depositAmount, depositPeriod);
Assertions.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker
.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString());
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap);
/***
@@ -3015,7 +3012,8 @@ public class RecurringDepositTest {
private Integer createRecurringDepositProduct(final String validFrom, final String validTo, final String accountingRule,
Account... accounts) {
LOG.info("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec,
this.responseSpec);
if (accountingRule.equals(CASH_BASED)) {
recurringDepositProductHelper = recurringDepositProductHelper.withAccountingRuleAsCashBased(accounts);
} else if (accountingRule.equals(NONE)) {
@@ -3025,17 +3023,17 @@ public class RecurringDepositTest {
return RecurringDepositProductHelper.createRecurringDepositProduct(recurringDepositProductJSON, requestSpec, responseSpec);
}
private Integer createRecurringDepositProductWithWithHoldTax(final String validFrom, final String validTo,final String taxGroupId, final String accountingRule,
Account... accounts) {
private Integer createRecurringDepositProductWithWithHoldTax(final String validFrom, final String validTo, final String taxGroupId,
final String accountingRule, Account... accounts) {
LOG.info("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec,
this.responseSpec);
if (accountingRule.equals(CASH_BASED)) {
recurringDepositProductHelper = recurringDepositProductHelper.withAccountingRuleAsCashBased(accounts);
} else if (accountingRule.equals(NONE)) {
recurringDepositProductHelper = recurringDepositProductHelper.withAccountingRuleAsNone();
}
final String recurringDepositProductJSON = recurringDepositProductHelper.withPeriodRangeChart()
.withWithHoldTax(taxGroupId)//
final String recurringDepositProductJSON = recurringDepositProductHelper.withPeriodRangeChart().withWithHoldTax(taxGroupId)//
.build(validFrom, validTo);
return RecurringDepositProductHelper.createRecurringDepositProduct(recurringDepositProductJSON, requestSpec, responseSpec);
}
@@ -3043,7 +3041,8 @@ public class RecurringDepositTest {
private Integer createRecurringDepositProduct(final String validFrom, final String validTo, final String accountingRule,
final String chartToBePicked, Account... accounts) {
LOG.info("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec,
this.responseSpec);
if (accountingRule.equals(CASH_BASED)) {
recurringDepositProductHelper = recurringDepositProductHelper.withAccountingRuleAsCashBased(accounts);
} else if (accountingRule.equals(NONE)) {
@@ -3151,11 +3150,13 @@ public class RecurringDepositTest {
LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping.getAccountID(), this.responseSpec,
CommonConstants.RESPONSE_RESOURCE_ID);
Assertions.assertNotNull(financialActivityAccountId);
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping);
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID,
liabilityAccountForMapping);
return liabilityAccountForMapping;
}
private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId, Account glAccount) {
private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId,
Account glAccount) {
HashMap mappingDetails = this.financialActivityAccountHelper.getFinancialActivityAccount(financialActivityAccountId,
this.responseSpec);
Assertions.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
@@ -3164,11 +3165,11 @@ public class RecurringDepositTest {
private Integer createTaxGroup(final String percentage, final Account liabilityAccountForTax) {
final Integer liabilityAccountId = liabilityAccountForTax.getAccountID();
final Integer taxComponentId = TaxComponentHelper.createTaxComponent(this.requestSpec, this.responseSpec, percentage, liabilityAccountId);
final Integer taxComponentId = TaxComponentHelper.createTaxComponent(this.requestSpec, this.responseSpec, percentage,
liabilityAccountId);
return TaxGroupHelper.createTaxGroup(this.requestSpec, this.responseSpec, Arrays.asList(taxComponentId));
}
/**
* Delete the Liability transfer account
*/
@@ -3177,8 +3178,8 @@ public class RecurringDepositTest {
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
for (HashMap financialActivity : financialActivities) {
Integer financialActivityAccountId = (Integer) financialActivity.get("id");
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper.deleteFinancialActivityAccount(
financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper
.deleteFinancialActivityAccount(financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Assertions.assertNotNull(deletedFinancialActivityAccountId);
Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
}
@@ -38,6 +38,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RolesTest {
private final static Logger LOG = LoggerFactory.getLogger(RolesTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -67,12 +67,12 @@ public class SchedulerJobsTest {
@Test // FINERACT-926
public void testDateFormat() {
// must start scheduler and make job active to have nextRunTime (which is a
// must start scheduler and make job active to have nextRunTime (which
// is a
// java.util.Date)
schedulerJobHelper.updateSchedulerStatus(true);
schedulerJobHelper.updateSchedulerJob(1, true);
String nextRunTimeText = await().until(
() -> (String) schedulerJobHelper.getSchedulerJobById(1).get("nextRunTime"),
String nextRunTimeText = await().until(() -> (String) schedulerJobHelper.getSchedulerJobById(1).get("nextRunTime"),
nextRunTime -> nextRunTime != null);
DateTimeFormatter.ISO_INSTANT.parse(nextRunTimeText);
}
@@ -102,7 +102,8 @@ public class SchedulerJobsTest {
@Test
public void testFlippingJobsActiveStatus() throws InterruptedException {
// Stop the Scheduler while we test flapping jobs' active on/off, to avoid side
// Stop the Scheduler while we test flapping jobs' active on/off, to
// avoid side
// effects
schedulerJobHelper.updateSchedulerStatus(false);
@@ -97,8 +97,7 @@ public class SchedulerJobsTestResults {
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization",
"Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("Fineract-Platform-TenantId", "default");
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.responseSpecForSchedulerJob = new ResponseSpecBuilder().expectStatusCode(202).build();
@@ -124,12 +123,11 @@ public class SchedulerJobsTestResults {
ClientSavingsIntegrationTest.MINIMUM_OPENING_BALANCE);
Assertions.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID,
savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID,
ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsProductID);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec,
this.responseSpec, savingsId);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
final Integer annualFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
@@ -149,20 +147,18 @@ public class SchedulerJobsTestResults {
String JobName = "Apply Annual Fee For Savings";
this.schedulerJobHelper.executeAndAwaitJob(JobName);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec,
annualFeeChargeId);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, annualFeeChargeId);
Float chargeAmount = (Float) chargeData.get("amount");
final HashMap savingsDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
final HashMap annualFeeDetails = (HashMap) savingsDetails.get("annualFee");
ArrayList<Integer> annualFeeDueDateAsArrayList = (ArrayList<Integer>) annualFeeDetails.get("dueDate");
LocalDate nextDueDateForAnnualFee = LocalDate.of(annualFeeDueDateAsArrayList.get(0),
annualFeeDueDateAsArrayList.get(1), annualFeeDueDateAsArrayList.get(2));
LocalDate nextDueDateForAnnualFee = LocalDate.of(annualFeeDueDateAsArrayList.get(0), annualFeeDueDateAsArrayList.get(1),
annualFeeDueDateAsArrayList.get(2));
LocalDate todaysDate = LocalDate.now(ZoneId.of("Asia/Kolkata"));
Assertions.assertTrue(nextDueDateForAnnualFee.isAfter(todaysDate),
"Verifying that all due Annual Fees have been paid ");
Assertions.assertTrue(nextDueDateForAnnualFee.isAfter(todaysDate), "Verifying that all due Annual Fees have been paid ");
}
@@ -178,12 +174,11 @@ public class SchedulerJobsTestResults {
ClientSavingsIntegrationTest.MINIMUM_OPENING_BALANCE);
Assertions.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID,
savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID,
ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsProductID);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec,
this.responseSpec, savingsId);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
@@ -217,12 +212,11 @@ public class SchedulerJobsTestResults {
ClientSavingsIntegrationTest.MINIMUM_OPENING_BALANCE);
Assertions.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID,
savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID,
ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsProductID);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec,
this.responseSpec, savingsId);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
@@ -234,16 +228,13 @@ public class SchedulerJobsTestResults {
final Integer loanProductID = createLoanProduct(null);
Assertions.assertNotNull(loanProductID);
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(),
savingsId.toString());
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), savingsId.toString());
Assertions.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec,
loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
@@ -251,13 +242,11 @@ public class SchedulerJobsTestResults {
Assertions.assertNotNull(specifiedDueDateChargeId);
this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
specifiedDueDateChargeId.toString(), "12 March 2013", "100"));
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(specifiedDueDateChargeId.toString(), "12 March 2013", "100"));
ArrayList<HashMap> chargesPendingState = this.loanTransactionHelper.getLoanCharges(loanID);
Assertions.assertEquals(1, chargesPendingState.size());
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
@@ -265,8 +254,7 @@ public class SchedulerJobsTestResults {
this.schedulerJobHelper.executeAndAwaitJob(JobName);
final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec,
specifiedDueDateChargeId);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
Float chargeAmount = (Float) chargeData.get("amount");
@@ -296,21 +284,18 @@ public class SchedulerJobsTestResults {
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
Assertions.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec,
loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// Retrieving All Global Configuration details
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec,
this.responseSpec);
Assertions.assertNotNull(globalConfig);
// Updating Value for reschedule-repayments-on-holidays Global
@@ -318,37 +303,33 @@ public class SchedulerJobsTestResults {
Integer configId = (Integer) globalConfig.get(3).get("id");
Assertions.assertNotNull(configId);
HashMap configData = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec,
this.responseSpec, configId.toString());
HashMap configData = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
configId.toString());
Assertions.assertNotNull(configData);
Boolean enabled = (Boolean) globalConfig.get(3).get("enabled");
if (enabled == false) {
enabled = true;
configId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(
this.requestSpec, this.responseSpec, configId.toString(), enabled);
configId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
configId.toString(), enabled);
}
final ArrayList<HashMap> repaymentScheduleDataBeforeJob = this.loanTransactionHelper
.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
final ArrayList<HashMap> repaymentScheduleDataBeforeJob = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
this.responseSpec, loanID);
holidayId = this.holidayHelper.activateHolidays(this.requestSpec, this.responseSpec,
holidayId.toString());
holidayId = this.holidayHelper.activateHolidays(this.requestSpec, this.responseSpec, holidayId.toString());
Assertions.assertNotNull(holidayId);
String JobName = "Apply Holidays To Loans";
this.schedulerJobHelper.executeAndAwaitJob(JobName);
final ArrayList<HashMap> repaymentScheduleDataAfterJob = this.loanTransactionHelper
.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
final ArrayList<HashMap> repaymentScheduleDataAfterJob = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
this.responseSpec, loanID);
HashMap holidayData = this.holidayHelper.getHolidayById(this.requestSpec, this.responseSpec,
holidayId.toString());
ArrayList<Integer> repaymentsRescheduledDate = (ArrayList<Integer>) holidayData
.get("repaymentsRescheduledTo");
HashMap holidayData = this.holidayHelper.getHolidayById(this.requestSpec, this.responseSpec, holidayId.toString());
ArrayList<Integer> repaymentsRescheduledDate = (ArrayList<Integer>) holidayData.get("repaymentsRescheduledTo");
ArrayList<Integer> rescheduleDateAfter = (ArrayList<Integer>) repaymentScheduleDataAfterJob.get(2)
.get("fromDate");
ArrayList<Integer> rescheduleDateAfter = (ArrayList<Integer>) repaymentScheduleDataAfterJob.get(2).get("fromDate");
Assertions.assertEquals(repaymentsRescheduledDate, repaymentsRescheduledDate,
"Verifying Repayment Rescheduled Date after Running Apply Holidays to Loans Scheduler Job");
@@ -367,16 +348,15 @@ public class SchedulerJobsTestResults {
ClientSavingsIntegrationTest.MINIMUM_OPENING_BALANCE);
Assertions.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID,
savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID,
ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsProductID);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec,
this.responseSpec, savingsId);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec,
this.responseSpec, ChargesHelper.getSavingsSpecifiedDueDateJSON());
final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
ChargesHelper.getSavingsSpecifiedDueDateJSON());
Assertions.assertNotNull(specifiedDueDateChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, specifiedDueDateChargeId, true);
@@ -396,8 +376,7 @@ public class SchedulerJobsTestResults {
this.schedulerJobHelper.executeAndAwaitJob(JobName);
HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec,
specifiedDueDateChargeId);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
Float chargeAmount = (Float) chargeData.get("amount");
@@ -419,16 +398,13 @@ public class SchedulerJobsTestResults {
final Integer accountID = assetAccount.getAccountID();
final Integer savingsProductID = createSavingsProduct(MINIMUM_OPENING_BALANCE, assetAccount,
incomeAccount, expenseAccount, liabilityAccount);
final Integer savingsProductID = createSavingsProduct(MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount,
liabilityAccount);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec,
this.DATE_OF_JOINING);
final Integer savingsID = this.savingsAccountHelper.applyForSavingsApplication(clientID,
savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
final Integer savingsID = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec,
this.responseSpec, savingsID);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsID);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsID);
@@ -438,20 +414,16 @@ public class SchedulerJobsTestResults {
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
// Checking initial Account entries.
final JournalEntry[] assetAccountInitialEntry = {
new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liablilityAccountInitialEntry = {
new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE,
assetAccountInitialEntry);
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
liablilityAccountInitialEntry);
String JobName = "Update Accounting Running Balances";
this.schedulerJobHelper.executeAndAwaitJob(JobName);
final HashMap runningBalanceAfter = this.accountHelper
.getAccountingWithRunningBalanceById(accountID.toString());
final HashMap runningBalanceAfter = this.accountHelper.getAccountingWithRunningBalanceById(accountID.toString());
final Integer INT_BALANCE = Integer.valueOf(MINIMUM_OPENING_BALANCE);
@@ -474,26 +446,21 @@ public class SchedulerJobsTestResults {
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
Assertions.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec,
loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
String JobName = "Update Loan Arrears Ageing";
this.schedulerJobHelper.executeAndAwaitJob(JobName);
HashMap loanSummaryData = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec,
loanID);
HashMap loanSummaryData = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
Float totalLoanArrearsAging = (Float) loanSummaryData.get("principalOverdue")
+ (Float) loanSummaryData.get("interestOverdue");
Float totalLoanArrearsAging = (Float) loanSummaryData.get("principalOverdue") + (Float) loanSummaryData.get("interestOverdue");
Assertions.assertEquals(totalLoanArrearsAging, loanSummaryData.get("totalOverdue"),
"Verifying Arrears Aging after Running Update Loan Arrears Aging Scheduler Job");
@@ -526,34 +493,31 @@ public class SchedulerJobsTestResults {
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
Assertions.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec,
loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
ArrayList<HashMap> loanScheduleBefore = this.loanTransactionHelper
.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
ArrayList<HashMap> loanScheduleBefore = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
loanID);
Float totalDueForCurrentPeriod = (Float) loanScheduleBefore.get(1).get("totalDueForPeriod");
this.loanTransactionHelper.makeRepayment(LOAN_FIRST_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
HashMap loanSummary = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec,
loanID);
HashMap loanSummary = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
String JobName = "Update Loan Paid In Advance";
this.schedulerJobHelper.executeAndAwaitJob(JobName);
// Retrieving Loan Repayment Schedule after the successful
// completion of
// Update Loan Paid in Advance Scheduler Job
ArrayList<HashMap> loanScheduleAfter = this.loanTransactionHelper
.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
ArrayList<HashMap> loanScheduleAfter = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
loanID);
loanSummary = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
@@ -602,26 +566,22 @@ public class SchedulerJobsTestResults {
ArrayList<HashMap> chargesPendingState = this.loanTransactionHelper.getLoanCharges(loanID);
Assertions.assertEquals(1, chargesPendingState.size());
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec,
loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
HashMap loanSummaryBefore = this.loanTransactionHelper.getLoanSummary(this.requestSpec,
this.responseSpec, loanID);
HashMap loanSummaryBefore = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
String JobName = "Update loan Summary";
this.schedulerJobHelper.executeAndAwaitJob(JobName);
Float expectedSummaryAfterJob = (Float) loanSummaryBefore.get("totalExpectedRepayment")
/* - (Float) loanSummaryBefore.get("feeChargesPaid") */;
HashMap loanSummaryAfter = this.loanTransactionHelper.getLoanSummary(this.requestSpec,
this.responseSpec, loanID);
HashMap loanSummaryAfter = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
Assertions.assertEquals(expectedSummaryAfterJob, (Float) loanSummaryAfter.get("totalExpectedRepayment"),
"Verifying Loan Summary after Running Update Loan Summary Scheduler Job");
@@ -652,12 +612,11 @@ public class SchedulerJobsTestResults {
ClientSavingsIntegrationTest.MINIMUM_OPENING_BALANCE);
Assertions.assertNotNull(savingsProductID);
final Integer fromSavingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID,
savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
final Integer fromSavingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID,
ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsProductID);
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec,
this.responseSpec, fromSavingsId);
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsId);
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
fromSavingsStatusHashMap = this.savingsAccountHelper.approveSavings(fromSavingsId);
@@ -666,12 +625,11 @@ public class SchedulerJobsTestResults {
fromSavingsStatusHashMap = this.savingsAccountHelper.activateSavings(fromSavingsId);
SavingsStatusChecker.verifySavingsIsActive(fromSavingsStatusHashMap);
final Integer toSavingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID,
savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
final Integer toSavingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID,
ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsProductID);
HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec,
this.responseSpec, toSavingsId);
HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsId);
SavingsStatusChecker.verifySavingsIsPending(toSavingsStatusHashMap);
toSavingsStatusHashMap = this.savingsAccountHelper.approveSavings(toSavingsId);
@@ -686,9 +644,9 @@ public class SchedulerJobsTestResults {
HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsId);
Float toSavingsBalanceBefore = (Float) toSavingsSummaryBefore.get("accountBalance");
Integer standingInstructionId = this.standingInstructionsHelper.createStandingInstruction(
clientID.toString(), fromSavingsId.toString(), toSavingsId.toString(),
FROM_ACCOUNT_TYPE_SAVINGS, TO_ACCOUNT_TYPE_SAVINGS, VALID_FROM, VALID_TO, MONTH_DAY);
Integer standingInstructionId = this.standingInstructionsHelper.createStandingInstruction(clientID.toString(),
fromSavingsId.toString(), toSavingsId.toString(), FROM_ACCOUNT_TYPE_SAVINGS, TO_ACCOUNT_TYPE_SAVINGS, VALID_FROM, VALID_TO,
MONTH_DAY);
Assertions.assertNotNull(standingInstructionId);
String JobName = "Execute Standing Instruction";
@@ -701,8 +659,7 @@ public class SchedulerJobsTestResults {
final HashMap standingInstructionData = this.standingInstructionsHelper
.getStandingInstructionById(standingInstructionId.toString());
Float expectedFromSavingsBalance = fromSavingsBalanceBefore
- (Float) standingInstructionData.get("amount");
Float expectedFromSavingsBalance = fromSavingsBalanceBefore - (Float) standingInstructionData.get("amount");
Float expectedToSavingsBalance = toSavingsBalanceBefore + (Float) standingInstructionData.get("amount");
Assertions.assertEquals(expectedFromSavingsBalance, fromSavingsBalanceAfter,
@@ -711,8 +668,8 @@ public class SchedulerJobsTestResults {
"Verifying To Savings Balance after Successful completion of Scheduler Job");
Integer fromAccountType = PortfolioAccountType.SAVINGS.getValue();
Integer transferType = AccountTransferType.ACCOUNT_TRANSFER.getValue();
List<HashMap> standinInstructionHistoryData = this.standingInstructionsHelper
.getStandingInstructionHistory(fromSavingsId, fromAccountType, clientID, transferType);
List<HashMap> standinInstructionHistoryData = this.standingInstructionsHelper.getStandingInstructionHistory(fromSavingsId,
fromAccountType, clientID, transferType);
Assertions.assertEquals(1, standinInstructionHistoryData.size(),
"Verifying the no of stainding instruction transactions logged for the client");
HashMap loggedTransaction = standinInstructionHistoryData.get(0);
@@ -741,31 +698,27 @@ public class SchedulerJobsTestResults {
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
Assertions.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec,
loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper
.disburseLoan(AccountTransferTest.LOAN_APPROVAL_DATE_PLUS_ONE, loanID);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_APPROVAL_DATE_PLUS_ONE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
ArrayList<HashMap> repaymentScheduleDataBefore = this.loanTransactionHelper
.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
ArrayList<HashMap> repaymentScheduleDataBefore = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
this.responseSpec, loanID);
String JobName = "Apply penalty to overdue loans";
this.schedulerJobHelper.executeAndAwaitJob(JobName);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec,
overdueFeeChargeId);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
Float chargeAmount = (Float) chargeData.get("amount");
ArrayList<HashMap> repaymentScheduleDataAfter = this.loanTransactionHelper
.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
ArrayList<HashMap> repaymentScheduleDataAfter = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
this.responseSpec, loanID);
Assertions.assertEquals(chargeAmount, (Float) repaymentScheduleDataAfter.get(1).get("penaltyChargesDue"),
"Verifying From Penalty Charges due fot first Repayment after Successful completion of Scheduler Job");
@@ -795,20 +748,17 @@ public class SchedulerJobsTestResults {
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
Assertions.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec,
loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper
.disburseLoan(AccountTransferTest.LOAN_APPROVAL_DATE_PLUS_ONE, loanID);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_APPROVAL_DATE_PLUS_ONE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
ArrayList<HashMap> repaymentScheduleDataBefore = this.loanTransactionHelper
.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
ArrayList<HashMap> repaymentScheduleDataBefore = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
this.responseSpec, loanID);
String JobName = "Apply penalty to overdue loans";
Integer jobId = 12;
@@ -824,17 +774,15 @@ public class SchedulerJobsTestResults {
Assertions.assertNotNull(schedulerJob);
}
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec,
overdueFeeChargeId);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
ArrayList<HashMap> repaymentScheduleDataAfter = this.loanTransactionHelper
.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
ArrayList<HashMap> repaymentScheduleDataAfter = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
this.responseSpec, loanID);
Assertions.assertEquals(0, repaymentScheduleDataAfter.get(1).get("penaltyChargesDue"),
"Verifying From Penalty Charges due fot first Repayment after Successful completion of Scheduler Job");
final ArrayList loanCharges = this.loanTransactionHelper.getLoanCharges(this.requestSpec,
this.responseSpec, loanID);
final ArrayList loanCharges = this.loanTransactionHelper.getLoanCharges(this.requestSpec, this.responseSpec, loanID);
Assertions.assertNull(loanCharges, "Verifying that charge isn't created when the amount is 0");
@@ -858,26 +806,21 @@ public class SchedulerJobsTestResults {
final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null);
Assertions.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec,
loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE,
loanID);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
final Boolean isNPABefore = (Boolean) this.loanTransactionHelper.getLoanDetail(requestSpec,
responseSpec, loanID, "isNPA");
final Boolean isNPABefore = (Boolean) this.loanTransactionHelper.getLoanDetail(requestSpec, responseSpec, loanID, "isNPA");
Assertions.assertFalse(isNPABefore);
// Integer jobId = (Integer) allSchedulerJobsData.get(1).get("jobId");
String JobName = "Update Non Performing Assets";
this.schedulerJobHelper.executeAndAwaitJob(JobName);
final Boolean isNPAAfter = (Boolean) this.loanTransactionHelper.getLoanDetail(requestSpec, responseSpec,
loanID, "isNPA");
final Boolean isNPAAfter = (Boolean) this.loanTransactionHelper.getLoanDetail(requestSpec, responseSpec, loanID, "isNPA");
Assertions.assertTrue(isNPAAfter);
}
@@ -889,11 +832,11 @@ public class SchedulerJobsTestResults {
// FixedDepositProductHelper(this.requestSpec,this.responseSpec);
// AccountHelper accountHelper = new AccountHelper(this.requestSpec,
// this.responseSpec);
FixedDepositAccountHelper fixedDepositAccountHelper = new FixedDepositAccountHelper(this.requestSpec,
this.responseSpec);
FixedDepositAccountHelper fixedDepositAccountHelper = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
// DateFormat monthDayFormat = new SimpleDateFormat("dd MMM", Locale.US);
// DateFormat monthDayFormat = new SimpleDateFormat("dd MMM",
// Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.MONTH, -3);
@@ -911,18 +854,15 @@ public class SchedulerJobsTestResults {
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(clientId);
Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE)
+ Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec,
String.valueOf(balance));
Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, String.valueOf(balance));
Assertions.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientId,
savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientId, savingsProductID,
ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL);
Assertions.assertNotNull(savingsId);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec,
this.responseSpec, savingsId);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
@@ -936,22 +876,18 @@ public class SchedulerJobsTestResults {
Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO);
Assertions.assertNotNull(fixedDepositProductId);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(),
fixedDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM,
savingsId.toString(), true, fixedDepositAccountHelper);
Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM,
VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, savingsId.toString(), true, fixedDepositAccountHelper);
Assertions.assertNotNull(fixedDepositAccountId);
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker
.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec,
fixedDepositAccountId.toString());
HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
FixedDepositAccountStatusChecker.verifyFixedDepositIsPending(fixedDepositAccountStatusHashMap);
fixedDepositAccountStatusHashMap = fixedDepositAccountHelper.approveFixedDeposit(fixedDepositAccountId,
APPROVED_ON_DATE);
fixedDepositAccountStatusHashMap = fixedDepositAccountHelper.approveFixedDeposit(fixedDepositAccountId, APPROVED_ON_DATE);
FixedDepositAccountStatusChecker.verifyFixedDepositIsApproved(fixedDepositAccountStatusHashMap);
fixedDepositAccountStatusHashMap = fixedDepositAccountHelper.activateFixedDeposit(fixedDepositAccountId,
ACTIVATION_DATE);
fixedDepositAccountStatusHashMap = fixedDepositAccountHelper.activateFixedDeposit(fixedDepositAccountId, ACTIVATION_DATE);
FixedDepositAccountStatusChecker.verifyFixedDepositIsActive(fixedDepositAccountStatusHashMap);
summary = savingsAccountHelper.getSavingsSummary(savingsId);
balance = Float.valueOf(MINIMUM_OPENING_BALANCE);
@@ -960,25 +896,23 @@ public class SchedulerJobsTestResults {
fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId);
HashMap fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId);
Float interestPosted = (Float) fixedDepositSummary.get("accountBalance")
- Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT);
Float interestPosted = (Float) fixedDepositSummary.get("accountBalance") - Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT);
String JobName = "Transfer Interest To Savings";
this.schedulerJobHelper.executeAndAwaitJob(JobName);
fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId);
assertEquals(Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT),
fixedDepositSummary.get("accountBalance"),
assertEquals(Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT), fixedDepositSummary.get("accountBalance"),
"Verifying opening Balance");
summary = savingsAccountHelper.getSavingsSummary(savingsId);
balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + interestPosted;
validateNumberForEqualExcludePrecission(String.valueOf(balance),
String.valueOf(summary.get("accountBalance")));
validateNumberForEqualExcludePrecission(String.valueOf(balance), String.valueOf(summary.get("accountBalance")));
}
private Integer createSavingsProduct(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String minOpenningBalance) {
// system.out.println("------------------------------CREATING NEW SAVINGS
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String minOpenningBalance) {
// system.out.println("------------------------------CREATING NEW
// SAVINGS
// PRODUCT ---------------------------------------");
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
final String savingsProductJSON = savingsProductHelper //
@@ -990,18 +924,19 @@ public class SchedulerJobsTestResults {
}
private static Integer createSavingsProduct(final String minOpenningBalance, final Account... accounts) {
// system.out.println("------------------------------CREATING NEW SAVINGS
// system.out.println("------------------------------CREATING NEW
// SAVINGS
// PRODUCT ---------------------------------------");
final String savingsProductJSON = new SavingsProductHelper().withInterestCompoundingPeriodTypeAsDaily() //
.withInterestPostingPeriodTypeAsQuarterly() //
.withInterestCalculationPeriodTypeAsDailyBalance() //
.withMinimumOpenningBalance(minOpenningBalance).withAccountingRuleAsCashBased(accounts)
.build();
.withMinimumOpenningBalance(minOpenningBalance).withAccountingRuleAsCashBased(accounts).build();
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
}
private Integer createLoanProduct(final String chargeId) {
// system.out.println("------------------------------CREATING NEW LOAN PRODUCT
// system.out.println("------------------------------CREATING NEW LOAN
// PRODUCT
// ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder() //
.withPrincipal("15,000.00") //
@@ -1016,8 +951,7 @@ public class SchedulerJobsTestResults {
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
private Integer applyForLoanApplication(final String clientID, final String loanProductID,
final String savingsID) {
private Integer applyForLoanApplication(final String clientID, final String loanProductID, final String savingsID) {
// system.out.println("--------------------------------APPLYING FOR LOAN
// APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
@@ -1038,38 +972,33 @@ public class SchedulerJobsTestResults {
}
private Integer createFixedDepositProduct(final String validFrom, final String validTo, Account... accounts) {
// system.out.println("------------------------------CREATING NEW FIXED DEPOSIT
// system.out.println("------------------------------CREATING NEW FIXED
// DEPOSIT
// PRODUCT ---------------------------------------");
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec,
this.responseSpec);
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
final String fixedDepositProductJSON = fixedDepositProductHelper //
// .withAccountingRuleAsCashBased(accounts)
.withPeriodRangeChart()//
.build(validFrom, validTo);
return FixedDepositProductHelper.createFixedDepositProduct(fixedDepositProductJSON, requestSpec,
responseSpec);
return FixedDepositProductHelper.createFixedDepositProduct(fixedDepositProductJSON, requestSpec, responseSpec);
}
private Integer applyForFixedDepositApplication(final String clientID, final String productID,
final String validFrom, final String validTo, final String submittedOnDate,
final String penalInterestType, String savingsId, final boolean transferInterest,
final FixedDepositAccountHelper fixedDepositAccountHelper) {
// system.out.println("--------------------------------APPLYING FOR FIXED
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String validFrom,
final String validTo, final String submittedOnDate, final String penalInterestType, String savingsId,
final boolean transferInterest, final FixedDepositAccountHelper fixedDepositAccountHelper) {
// system.out.println("--------------------------------APPLYING FOR
// FIXED
// DEPOSIT ACCOUNT --------------------------------");
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec,
this.responseSpec)
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec)
//
.withSubmittedOnDate(submittedOnDate).withSavings(savingsId)
.transferInterest(true)
.withLockinPeriodFrequency("1", FixedDepositAccountHelper.DAYS)
.build(clientID, productID, penalInterestType);
return fixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON,
this.requestSpec, this.responseSpec);
.withSubmittedOnDate(submittedOnDate).withSavings(savingsId).transferInterest(true)
.withLockinPeriodFrequency("1", FixedDepositAccountHelper.DAYS).build(clientID, productID, penalInterestType);
return fixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec);
}
private void validateNumberForEqualExcludePrecission(String val, String val2) {
DecimalFormat twoDForm = new DecimalFormat("#", new DecimalFormatSymbols(Locale.US));
Assertions.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(val)))
.compareTo(Float.valueOf(twoDForm.format(Float.valueOf(val2)))) == 0);
Assertions.assertTrue(
Float.valueOf(twoDForm.format(Float.valueOf(val))).compareTo(Float.valueOf(twoDForm.format(Float.valueOf(val2)))) == 0);
}
}
@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "static-access", "rawtypes", "unchecked", "deprecation" })
public class SkipRepaymentOnMonthFirstTest {
private final static Logger LOG = LoggerFactory.getLogger(SkipRepaymentOnMonthFirstTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -56,8 +57,7 @@ public class SkipRepaymentOnMonthFirstTest {
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization",
"Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@@ -72,8 +72,8 @@ public class SkipRepaymentOnMonthFirstTest {
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
// Retrieving All Global Configuration details
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec,
this.responseSpec);
Assertions.assertNotNull(globalConfig);
String configName = "skip-repayment-on-first-day-of-month";
@@ -82,8 +82,8 @@ public class SkipRepaymentOnMonthFirstTest {
for (Integer configIndex = 0; configIndex < globalConfig.size(); configIndex++) {
if (globalConfig.get(configIndex).get("name").equals(configName)) {
String configId = globalConfig.get(configIndex).get("id").toString();
Integer updateConfigId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(
this.requestSpec, this.responseSpec, configId.toString(), newBooleanValue);
Integer updateConfigId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec,
this.responseSpec, configId.toString(), newBooleanValue);
Assertions.assertNotNull(updateConfigId);
break;
}
@@ -97,26 +97,23 @@ public class SkipRepaymentOnMonthFirstTest {
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(),
clientID.toString());
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
final String startDate = "15 September 2011";
final String frequency = "3"; // Monthly
final String interval = "1"; // Every One Moth
Integer calendarID = calendarHelper.createMeetingForGroup(requestSpec, responseSpec, groupID, startDate, frequency,
interval, null);
Integer calendarID = calendarHelper.createMeetingForGroup(requestSpec, responseSpec, groupID, startDate, frequency, interval, null);
LOG.info("caladerId -------------------- {}", calendarID);
final Integer loanProductID = createLoanProduct();
final Integer loanID = applyForLoanApplication(groupID, loanProductID, calendarID, clientID);
LOG.info("loanID---- {}", loanID);
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
this.responseSpec, loanID);
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
loanID);
verifyLoanRepaymentSchedule(loanSchedule);
}
private Integer createLoanProduct() {
LOG.info(
"------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder() //
.withPrincipal("12,000.00") //
.withNumberOfRepayments("4") //
@@ -130,10 +127,8 @@ public class SkipRepaymentOnMonthFirstTest {
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
private Integer applyForLoanApplication(final Integer groupID, final Integer loanProductID, Integer calendarID,
Integer clientID) {
LOG.info(
"--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
private Integer applyForLoanApplication(final Integer groupID, final Integer loanProductID, Integer calendarID, Integer clientID) {
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
.withPrincipal("12,000.00") //
.withLoanTermFrequency("4") //
@@ -90,8 +90,8 @@ public class SystemCodeTest {
assertEquals(createResponseId, deleteResponseId, "Verify code deleted");
// verify code deleted
final HashMap deletedCodeValues = (HashMap) CodeHelper
.getCodeById(this.requestSpec, this.generalResponseSpec, deleteResponseId, "");
final HashMap deletedCodeValues = (HashMap) CodeHelper.getCodeById(this.requestSpec, this.generalResponseSpec, deleteResponseId,
"");
Assertions.assertNotNull(deletedCodeValues);
assertNull(deletedCodeValues.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME), "Verify value of codeId");
@@ -132,8 +132,8 @@ public class SystemCodeTest {
assertEquals(createResponseId, deleteResponseId, "Verify code deleted");
// verify code deleted
final HashMap deletedCodeAttributes = (HashMap) CodeHelper.getCodeById(this.requestSpec, this.generalResponseSpec,
deleteResponseId, "");
final HashMap deletedCodeAttributes = (HashMap) CodeHelper.getCodeById(this.requestSpec, this.generalResponseSpec, deleteResponseId,
"");
Assertions.assertNotNull(deletedCodeAttributes);
assertNull(deletedCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME), "Verify value of codeId");
@@ -206,11 +206,10 @@ public class SystemCodeTest {
createCodeResponseId, createCodeValueResponseId1, "");
Assertions.assertNotNull(codeValuesAttributes1);
assertEquals(createCodeValueResponseId1,
codeValuesAttributes1.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME), "Verify value of codeValueId");
assertEquals(createCodeValueResponseId1, codeValuesAttributes1.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME),
"Verify value of codeValueId");
assertEquals(codeValue1, codeValuesAttributes1.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME),
"Verify value of code name");
assertEquals(codeValue1, codeValuesAttributes1.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME), "Verify value of code name");
assertEquals(codeDescription1, codeValuesAttributes1.get(CodeHelper.CODE_VALUE_DESCRIPTION_ATTRIBUTE_NAME),
"Verify value of code description");
@@ -64,11 +64,13 @@ public class TemplateIntegrationTest {
ArrayList<?> get = Utils.performServerGet(this.requestSpec, this.responseSpec, this.GET_TEMPLATES_URL, "");
final int entriesBeforeTest = get.size();
final Integer id = Utils.performServerPost(this.requestSpec, this.responseSpec, this.GET_TEMPLATES_URL, new Gson().toJson(map), "resourceId");
final Integer id = Utils.performServerPost(this.requestSpec, this.responseSpec, this.GET_TEMPLATES_URL, new Gson().toJson(map),
"resourceId");
final String templateUrlForId = String.format(this.GET_TEMPLATE_ID_URL, id);
final String getrequest2 = Utils.performServerGet(this.requestSpec, this.responseSpec, templateUrlForId, this.RESPONSE_ATTRIBUTE_NAME);
final String getrequest2 = Utils.performServerGet(this.requestSpec, this.responseSpec, templateUrlForId,
this.RESPONSE_ATTRIBUTE_NAME);
Assertions.assertTrue(getrequest2.equals("foo"));
@@ -40,6 +40,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UserAdministrationTest {
private final static Logger LOG = LoggerFactory.getLogger(UserAdministrationTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -74,7 +75,8 @@ public class UserAdministrationTest {
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(staffId);
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "alphabet", "resourceId");
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "alphabet",
"resourceId");
Assertions.assertNotNull(userId);
this.transientUsers.add(userId);
@@ -94,7 +96,8 @@ public class UserAdministrationTest {
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(staffId);
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "alphabet", "resourceId");
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "alphabet",
"resourceId");
Assertions.assertNotNull(userId);
this.transientUsers.add(userId);
@@ -113,11 +116,13 @@ public class UserAdministrationTest {
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(staffId);
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "alphabet", "resourceId");
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "alphabet",
"resourceId");
Assertions.assertNotNull(userId);
this.transientUsers.add(userId);
final Integer userId2 = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "bilingual", "resourceId");
final Integer userId2 = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "bilingual",
"resourceId");
Assertions.assertNotNull(userId2);
this.transientUsers.add(userId2);
@@ -126,6 +131,7 @@ public class UserAdministrationTest {
Assertions.assertEquals("User with username alphabet already exists.", reason.get("defaultUserMessage"));
Assertions.assertEquals("error.msg.user.duplicate.username", reason.get("userMessageGlobalisationCode"));
}
@Test
public void testCreateNewUserBlocksDuplicateClientId() {
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
@@ -137,13 +143,16 @@ public class UserAdministrationTest {
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assertions.assertNotNull(clientId);
final Integer userId = (Integer) UserHelper.createUserForSelfService(this.requestSpec, this.responseSpec, roleId, staffId, clientId, "resourceId");
final Integer userId = (Integer) UserHelper.createUserForSelfService(this.requestSpec, this.responseSpec, roleId, staffId, clientId,
"resourceId");
Assertions.assertNotNull(userId);
this.transientUsers.add(userId);
final List errors = (List) UserHelper.createUserForSelfService(this.requestSpec, expectStatusCode(403), roleId, staffId, clientId, "errors");
final List errors = (List) UserHelper.createUserForSelfService(this.requestSpec, expectStatusCode(403), roleId, staffId, clientId,
"errors");
Map reason = (Map) errors.get(0);
Assertions.assertEquals("Self Service User Id is already created. Go to Admin->Users to edit or delete the self-service user.", reason.get("defaultUserMessage"));
Assertions.assertEquals("Self Service User Id is already created. Go to Admin->Users to edit or delete the self-service user.",
reason.get("defaultUserMessage"));
}
}
@@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class XBRLIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(XBRLIntegrationTest.class);
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
@@ -52,6 +52,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClientEntityImportHandlerTest {
private final static Logger LOG = LoggerFactory.getLogger(ClientEntityImportHandlerTest.class);
private ResponseSpecification responseSpec;
@@ -110,17 +111,22 @@ public class ClientEntityImportHandlerTest {
Date validTill = simpleDateFormat.parse("14 May 2019");
firstClientRow.createCell(ClientEntityConstants.INCOPORATION_VALID_TILL_COL).setCellValue(validTill);
firstClientRow.createCell(ClientEntityConstants.MOBILE_NO_COL).setCellValue(Utils.randomNumberGenerator(7));
firstClientRow.createCell(ClientEntityConstants.CLIENT_TYPE_COL).setCellValue(clientEntitySheet.getRow(1).getCell(ClientEntityConstants.LOOKUP_CLIENT_TYPES).getStringCellValue());
firstClientRow.createCell(ClientEntityConstants.CLIENT_CLASSIFICATION_COL).setCellValue(clientEntitySheet.getRow(1).getCell(ClientEntityConstants.LOOKUP_CLIENT_CLASSIFICATION).getStringCellValue());
firstClientRow.createCell(ClientEntityConstants.CLIENT_TYPE_COL)
.setCellValue(clientEntitySheet.getRow(1).getCell(ClientEntityConstants.LOOKUP_CLIENT_TYPES).getStringCellValue());
firstClientRow.createCell(ClientEntityConstants.CLIENT_CLASSIFICATION_COL)
.setCellValue(clientEntitySheet.getRow(1).getCell(ClientEntityConstants.LOOKUP_CLIENT_CLASSIFICATION).getStringCellValue());
firstClientRow.createCell(ClientEntityConstants.INCOPORATION_NUMBER_COL).setCellValue(Utils.randomNumberGenerator(6));
firstClientRow.createCell(ClientEntityConstants.MAIN_BUSINESS_LINE).setCellValue(clientEntitySheet.getRow(1).getCell(ClientEntityConstants.LOOKUP_MAIN_BUSINESS_LINE).getStringCellValue());
firstClientRow.createCell(ClientEntityConstants.CONSTITUTION_COL).setCellValue(clientEntitySheet.getRow(1).getCell(ClientEntityConstants.LOOKUP_CONSTITUTION_COL).getStringCellValue());
firstClientRow.createCell(ClientEntityConstants.MAIN_BUSINESS_LINE)
.setCellValue(clientEntitySheet.getRow(1).getCell(ClientEntityConstants.LOOKUP_MAIN_BUSINESS_LINE).getStringCellValue());
firstClientRow.createCell(ClientEntityConstants.CONSTITUTION_COL)
.setCellValue(clientEntitySheet.getRow(1).getCell(ClientEntityConstants.LOOKUP_CONSTITUTION_COL).getStringCellValue());
firstClientRow.createCell(ClientEntityConstants.ACTIVE_COL).setCellValue("False");
Date submittedDate = simpleDateFormat.parse("28 September 2017");
firstClientRow.createCell(ClientEntityConstants.SUBMITTED_ON_COL).setCellValue(submittedDate);
firstClientRow.createCell(ClientEntityConstants.ADDRESS_ENABLED).setCellValue("False");
File directory=new File(System.getProperty("user.home")+File.separator+"Fineract"+File.separator+"bulkimport"+File.separator+"integration_tests"+File.separator+"importhandler"+File.separator+"client") ;
File directory = new File(System.getProperty("user.home") + File.separator + "Fineract" + File.separator + "bulkimport"
+ File.separator + "integration_tests" + File.separator + "importhandler" + File.separator + "client");
if (!directory.exists()) {
directory.mkdirs();
}
@@ -134,7 +134,8 @@ public class LoanImportHandlerTest {
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String paymentTypeDescription = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Integer outcome_payment_creation= PaymentTypeHelper.createPaymentType(requestSpec, responseSpec, paymentTypeName, paymentTypeDescription, true,1);
Integer outcome_payment_creation = PaymentTypeHelper.createPaymentType(requestSpec, responseSpec, paymentTypeName,
paymentTypeDescription, true, 1);
Assertions.assertNotNull(outcome_payment_creation, "Could not create payment type");
LoanTransactionHelper loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
@@ -145,7 +146,8 @@ public class LoanImportHandlerTest {
Row firstLoanRow = loanSheet.getRow(1);
firstLoanRow.createCell(LoanConstants.OFFICE_NAME_COL).setCellValue(office.getName());
firstLoanRow.createCell(LoanConstants.LOAN_TYPE_COL).setCellValue("Individual");
firstLoanRow.createCell(LoanConstants.CLIENT_NAME_COL).setCellValue(firstName + " " + lastName + "(" + outcome_client_creation + ")");
firstLoanRow.createCell(LoanConstants.CLIENT_NAME_COL)
.setCellValue(firstName + " " + lastName + "(" + outcome_client_creation + ")");
firstLoanRow.createCell(LoanConstants.CLIENT_EXTERNAL_ID).setCellValue(externalId);
firstLoanRow.createCell(LoanConstants.PRODUCT_COL).setCellValue(loanProductJson.getString("name"));
firstLoanRow.createCell(LoanConstants.LOAN_OFFICER_NAME_COL).setCellValue((String) staffMap.get("displayName"));
@@ -159,16 +161,22 @@ public class LoanImportHandlerTest {
firstLoanRow.createCell(LoanConstants.PRINCIPAL_COL).setCellValue(loanProductJson.getFloat("principal"));
firstLoanRow.createCell(LoanConstants.NO_OF_REPAYMENTS_COL).setCellValue(loanProductJson.getInt("numberOfRepayments"));
firstLoanRow.createCell(LoanConstants.REPAID_EVERY_COL).setCellValue(loanProductJson.getInt("repaymentEvery"));
firstLoanRow.createCell(LoanConstants.REPAID_EVERY_FREQUENCY_COL).setCellValue(loanProductJson.getString("repaymentFrequencyType.value"));
firstLoanRow.createCell(LoanConstants.LOAN_TERM_COL).setCellValue(loanProductJson.getInt("repaymentEvery") * loanProductJson.getInt("numberOfRepayments"));
firstLoanRow.createCell(LoanConstants.LOAN_TERM_FREQUENCY_COL).setCellValue(loanProductJson.getString("repaymentFrequencyType.value"));
firstLoanRow.createCell(LoanConstants.REPAID_EVERY_FREQUENCY_COL)
.setCellValue(loanProductJson.getString("repaymentFrequencyType.value"));
firstLoanRow.createCell(LoanConstants.LOAN_TERM_COL)
.setCellValue(loanProductJson.getInt("repaymentEvery") * loanProductJson.getInt("numberOfRepayments"));
firstLoanRow.createCell(LoanConstants.LOAN_TERM_FREQUENCY_COL)
.setCellValue(loanProductJson.getString("repaymentFrequencyType.value"));
firstLoanRow.createCell(LoanConstants.NOMINAL_INTEREST_RATE_COL).setCellValue(loanProductJson.getDouble("interestRatePerPeriod"));
firstLoanRow.createCell(LoanConstants.NOMINAL_INTEREST_RATE_FREQUENCY_COL).setCellValue(loanProductJson.getString("interestRateFrequencyType.value"));
firstLoanRow.createCell(LoanConstants.NOMINAL_INTEREST_RATE_FREQUENCY_COL)
.setCellValue(loanProductJson.getString("interestRateFrequencyType.value"));
firstLoanRow.createCell(LoanConstants.AMORTIZATION_COL).setCellValue(loanProductJson.getString("amortizationType.value"));
firstLoanRow.createCell(LoanConstants.INTEREST_METHOD_COL).setCellValue(loanProductJson.getString("interestType.value"));
firstLoanRow.createCell(LoanConstants.INTEREST_CALCULATION_PERIOD_COL).setCellValue(loanProductJson.getString("interestCalculationPeriodType.value"));
firstLoanRow.createCell(LoanConstants.INTEREST_CALCULATION_PERIOD_COL)
.setCellValue(loanProductJson.getString("interestCalculationPeriodType.value"));
firstLoanRow.createCell(LoanConstants.ARREARS_TOLERANCE_COL).setCellValue(0);
firstLoanRow.createCell(LoanConstants.REPAYMENT_STRATEGY_COL).setCellValue(loanProductJson.getString("transactionProcessingStrategyName"));
firstLoanRow.createCell(LoanConstants.REPAYMENT_STRATEGY_COL)
.setCellValue(loanProductJson.getString("transactionProcessingStrategyName"));
firstLoanRow.createCell(LoanConstants.GRACE_ON_PRINCIPAL_PAYMENT_COL).setCellValue(0);
firstLoanRow.createCell(LoanConstants.GRACE_ON_INTEREST_PAYMENT_COL).setCellValue(0);
firstLoanRow.createCell(LoanConstants.GRACE_ON_INTEREST_CHARGED_COL).setCellValue(0);
@@ -178,8 +186,8 @@ public class LoanImportHandlerTest {
firstLoanRow.createCell(LoanConstants.REPAYMENT_TYPE_COL).setCellValue(paymentTypeName);
String currentdirectory = new File("").getAbsolutePath();
File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+
"resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"loan") ;
File directory = new File(currentdirectory + File.separator + "src" + File.separator + "integrationTest" + File.separator
+ "resources" + File.separator + "bulkimport" + File.separator + "importhandler" + File.separator + "loan");
if (!directory.exists()) {
directory.mkdirs();
}
@@ -55,12 +55,8 @@ public class OfficeImportHandlerTest {
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().build();
this.requestSpec
.header("Authorization",
"Basic "
+ Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200)
.build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@Test
@@ -72,15 +68,17 @@ public class OfficeImportHandlerTest {
Sheet sheet = workbook.getSheet(TemplatePopulateImportConstants.OFFICE_SHEET_NAME);
Row firstOfficeRow = sheet.getRow(1);
firstOfficeRow.createCell(OfficeConstants.OFFICE_NAME_COL).setCellValue(Utils.randomNameGenerator("Test_Off_", 6));
firstOfficeRow.createCell(OfficeConstants.PARENT_OFFICE_NAME_COL).setCellValue(firstOfficeRow.getCell(OfficeConstants.LOOKUP_OFFICE_COL).getStringCellValue());
firstOfficeRow.createCell(OfficeConstants.PARENT_OFFICE_ID_COL).setCellValue(firstOfficeRow.getCell(OfficeConstants.LOOKUP_OFFICE_ID_COL).getNumericCellValue());
firstOfficeRow.createCell(OfficeConstants.PARENT_OFFICE_NAME_COL)
.setCellValue(firstOfficeRow.getCell(OfficeConstants.LOOKUP_OFFICE_COL).getStringCellValue());
firstOfficeRow.createCell(OfficeConstants.PARENT_OFFICE_ID_COL)
.setCellValue(firstOfficeRow.getCell(OfficeConstants.LOOKUP_OFFICE_ID_COL).getNumericCellValue());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMM yyyy");
Date date = simpleDateFormat.parse("14 May 2001");
firstOfficeRow.createCell(OfficeConstants.OPENED_ON_COL).setCellValue(date);
String currentdirectory = new File("").getAbsolutePath();
File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+
"resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"office");
File directory = new File(currentdirectory + File.separator + "src" + File.separator + "integrationTest" + File.separator
+ "resources" + File.separator + "bulkimport" + File.separator + "importhandler" + File.separator + "office");
if (!directory.exists()) {
directory.mkdirs();
}
@@ -127,33 +127,44 @@ public class SavingsImportHandlerTest {
Row firstSavingsRow = savingsSheet.getRow(1);
firstSavingsRow.createCell(SavingsConstants.OFFICE_NAME_COL).setCellValue(office.getName());
firstSavingsRow.createCell(SavingsConstants.SAVINGS_TYPE_COL).setCellValue("Individual");
firstSavingsRow.createCell(SavingsConstants.CLIENT_NAME_COL).setCellValue(firstName + " " + lastName + "(" + outcome_client_creation + ")");
firstSavingsRow.createCell(SavingsConstants.CLIENT_NAME_COL)
.setCellValue(firstName + " " + lastName + "(" + outcome_client_creation + ")");
Sheet savingsProductSheet = workbook.getSheet(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME);
firstSavingsRow.createCell(SavingsConstants.PRODUCT_COL).setCellValue(savingsProductSheet.getRow(1).getCell(1).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.PRODUCT_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(1).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.FIELD_OFFICER_NAME_COL).setCellValue((String) staffMap.get("displayName"));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMM yyyy");
Date date = simpleDateFormat.parse("13 May 2017");
firstSavingsRow.createCell(SavingsConstants.SUBMITTED_ON_DATE_COL).setCellValue(date);
firstSavingsRow.createCell(SavingsConstants.APPROVED_DATE_COL).setCellValue(date);
firstSavingsRow.createCell(SavingsConstants.ACTIVATION_DATE_COL).setCellValue(date);
firstSavingsRow.createCell(SavingsConstants.CURRENCY_COL).setCellValue(savingsProductSheet.getRow(1).getCell(10).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.DECIMAL_PLACES_COL).setCellValue(savingsProductSheet.getRow(1).getCell(11).getNumericCellValue());
firstSavingsRow.createCell(SavingsConstants.IN_MULTIPLES_OF_COL).setCellValue(savingsProductSheet.getRow(1).getCell(12).getNumericCellValue());
firstSavingsRow.createCell(SavingsConstants.NOMINAL_ANNUAL_INTEREST_RATE_COL).setCellValue(savingsProductSheet.getRow(1).getCell(2).getNumericCellValue());
firstSavingsRow.createCell(SavingsConstants.INTEREST_COMPOUNDING_PERIOD_COL).setCellValue(savingsProductSheet.getRow(1).getCell(3).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.INTEREST_POSTING_PERIOD_COL).setCellValue(savingsProductSheet.getRow(1).getCell(4).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.INTEREST_CALCULATION_COL).setCellValue(savingsProductSheet.getRow(1).getCell(5).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.INTEREST_CALCULATION_DAYS_IN_YEAR_COL).setCellValue(savingsProductSheet.getRow(1).getCell(6).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.CURRENCY_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(10).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.DECIMAL_PLACES_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(11).getNumericCellValue());
firstSavingsRow.createCell(SavingsConstants.IN_MULTIPLES_OF_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(12).getNumericCellValue());
firstSavingsRow.createCell(SavingsConstants.NOMINAL_ANNUAL_INTEREST_RATE_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(2).getNumericCellValue());
firstSavingsRow.createCell(SavingsConstants.INTEREST_COMPOUNDING_PERIOD_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(3).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.INTEREST_POSTING_PERIOD_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(4).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.INTEREST_CALCULATION_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(5).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.INTEREST_CALCULATION_DAYS_IN_YEAR_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(6).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.MIN_OPENING_BALANCE_COL).setCellValue(1000.0);
firstSavingsRow.createCell(SavingsConstants.LOCKIN_PERIOD_COL).setCellValue(1);
firstSavingsRow.createCell(SavingsConstants.LOCKIN_PERIOD_FREQUENCY_COL).setCellValue("Weeks");
firstSavingsRow.createCell(SavingsConstants.APPLY_WITHDRAWAL_FEE_FOR_TRANSFERS).setCellValue("False");
firstSavingsRow.createCell(SavingsConstants.ALLOW_OVER_DRAFT_COL).setCellValue("False");
firstSavingsRow.createCell(SavingsConstants.OVER_DRAFT_LIMIT_COL).setCellValue(savingsProductSheet.getRow(1).getCell(15).getNumericCellValue());
firstSavingsRow.createCell(SavingsConstants.OVER_DRAFT_LIMIT_COL)
.setCellValue(savingsProductSheet.getRow(1).getCell(15).getNumericCellValue());
String currentdirectory = new File("").getAbsolutePath();
File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+
"resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"savings") ;
File directory = new File(currentdirectory + File.separator + "src" + File.separator + "integrationTest" + File.separator
+ "resources" + File.separator + "bulkimport" + File.separator + "importhandler" + File.separator + "savings");
if (!directory.exists()) {
directory.mkdirs();
}
@@ -47,13 +47,8 @@ public class ClientEntityWorkbookPopulatorTest {
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().build();
this.requestSpec
.header("Authorization",
"Basic "
+ Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200)
.build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@@ -55,6 +55,7 @@ public class LoanWorkbookPopulatorTest {
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@Test
public void testLoanWorkbookPopulate() throws IOException {
requestSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
@@ -85,9 +86,7 @@ public class LoanWorkbookPopulatorTest {
Assertions.assertNotNull(outcome_lp_creaion, "Could not create Loan Product");
FundsResourceHandler fundsResourceHandler = new FundsResourceHandler();
String jsonFund="{\n" +
"\t\"name\": \""+Utils.randomNameGenerator("Fund_Name",9)+"\"\n" +
"}";
String jsonFund = "{\n" + "\t\"name\": \"" + Utils.randomNameGenerator("Fund_Name", 9) + "\"\n" + "}";
Integer outcome_fund_creation = fundsResourceHandler.createFund(jsonFund, requestSpec, responseSpec);
Assertions.assertNotNull(outcome_fund_creation, "Could not create Fund");
@@ -96,7 +95,8 @@ public class LoanWorkbookPopulatorTest {
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = true;
Integer position = 1;
Integer outcome_payment_creation= paymentTypeHelper.createPaymentType(requestSpec, responseSpec,name,description,isCashPayment,position);
Integer outcome_payment_creation = paymentTypeHelper.createPaymentType(requestSpec, responseSpec, name, description, isCashPayment,
position);
Assertions.assertNotNull(outcome_payment_creation, "Could not create payment type");
Workbook workbook = loanTransactionHelper.getLoanWorkbook("dd MMMM yyyy");
@@ -35,6 +35,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class OfficeWorkBookPopulatorTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -42,12 +43,8 @@ public class OfficeWorkBookPopulatorTest {
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().build();
this.requestSpec
.header("Authorization",
"Basic "
+ Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200)
.build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@Test
@@ -42,6 +42,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class SavingsWorkbookPopulateTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -32,15 +32,16 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Helper class for {@link org.apache.fineract.integrationtests.BatchApiTest}. It
* takes care of creation of {@code BatchRequest} list and posting this list to
* the server.
* Helper class for {@link org.apache.fineract.integrationtests.BatchApiTest}.
* It takes care of creation of {@code BatchRequest} list and posting this list
* to the server.
*
* @author Rishabh Shukla
*
* @see org.apache.fineract.integrationtests.BatchApiTest
*/
public class BatchHelper {
private final static Logger LOG = LoggerFactory.getLogger(BatchHelper.class);
private static final String BATCH_API_URL = "/fineract-provider/api/v1/batches?" + Utils.TENANT_IDENTIFIER;
private static final String BATCH_API_URL_EXT = BATCH_API_URL + "&enclosingTransaction=true";
@@ -190,14 +191,14 @@ public class BatchHelper {
}
final String body = "{ \"officeId\": 1, \"firstname\": \"Petra\", \"lastname\": \"Yton\"," + "\"externalId\": \"" + externalId
+ "\", \"dateFormat\": \"dd MMMM yyyy\", \"locale\": \"en\"," + "\"active\": true, \"activationDate\": \"04 March 2010\", \"submittedOnDate\": \"04 March 2010\"}";
+ "\", \"dateFormat\": \"dd MMMM yyyy\", \"locale\": \"en\","
+ "\"active\": true, \"activationDate\": \"04 March 2010\", \"submittedOnDate\": \"04 March 2010\"}";
br.setBody(body);
return br;
}
/**
* Creates and returns a
* {@link org.apache.fineract.batch.command.internal.UpdateClientCommandStrategy}
@@ -408,8 +409,8 @@ public class BatchHelper {
br.setReference(reference);
br.setRelativeUrl("loans/$.loanId/transactions?command=repayment");
br.setMethod("POST");
br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", " +
"\"transactionDate\": \"15 September 2013\", \"transactionAmount\": 500}");
br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", "
+ "\"transactionDate\": \"15 September 2013\", \"transactionAmount\": 500}");
return br;
}
@@ -29,6 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CalendarHelper {
private final static Logger LOG = LoggerFactory.getLogger(CalendarHelper.class);
private static final String BASE_URL = "/fineract-provider/api/v1/";
private static final String PARENT_ENTITY_NAME = "groups/";
@@ -26,7 +26,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CenterDomain implements Comparable<CenterDomain> {
private final static Logger LOG = LoggerFactory.getLogger(CenterDomain.class);
public static class Builder {
private final Integer id;
@@ -84,9 +86,9 @@ public class CenterDomain implements Comparable<CenterDomain> {
/* super(); */
}
private CenterDomain(final Integer id, final String accountNo, final Integer statusid, final String statuscode, final String statusvalue, final boolean active,
final String name, final String externalId, final Integer staffId, final Integer officeId, final String officeName,
final String hierarchy, final ArrayList<HashMap> groupMembers) {
private CenterDomain(final Integer id, final String accountNo, final Integer statusid, final String statuscode,
final String statusvalue, final boolean active, final String name, final String externalId, final Integer staffId,
final Integer officeId, final String officeName, final String hierarchy, final ArrayList<HashMap> groupMembers) {
this.id = id;
this.accountNo = accountNo;
this.status = new HashMap<>();
@@ -256,15 +258,11 @@ public class CenterDomain implements Comparable<CenterDomain> {
public boolean equals(Object obj) {
if (obj == this) { return true; }
if (!(obj instanceof CenterDomain)) {
return false;
}
if (!(obj instanceof CenterDomain)) { return false; }
CenterDomain cd = (CenterDomain) obj;
if (this.hashCode() == cd.hashCode()) {
return true;
}
if (this.hashCode() == cd.hashCode()) { return true; }
return false;
}
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class CenterHelper {
private final static Logger LOG = LoggerFactory.getLogger(CenterHelper.class);
private static final String CENTERS_URL = "/fineract-provider/api/v1/centers";
@@ -122,8 +123,8 @@ public class CenterHelper {
HashMap groupMemberHashMap = new HashMap();
groupMemberHashMap.put("groupMembers", groupMembers);
LOG.info("---------------------------------ASSOCIATING GROUPS AT {}--------------------------------------------", id);
HashMap hash = Utils.performServerPost(requestSpec, responseSpec, ASSOCIATE_GROUP_CENTER_URL,
new Gson().toJson(groupMemberHashMap), "changes");
HashMap hash = Utils.performServerPost(requestSpec, responseSpec, ASSOCIATE_GROUP_CENTER_URL, new Gson().toJson(groupMemberHashMap),
"changes");
LOG.info("{}", hash.toString());
ArrayList<String> arr = (ArrayList<String>) hash.get("groupMembers");
int[] ret = new int[arr.size()];
@@ -182,7 +183,8 @@ public class CenterHelper {
public static Integer activateCenter(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String centerId) {
final String CENTER_ASSOCIATE_URL = "/fineract-provider/api/v1/centers/" + centerId + "?command=activate&" + Utils.TENANT_IDENTIFIER;
final String CENTER_ASSOCIATE_URL = "/fineract-provider/api/v1/centers/" + centerId + "?command=activate&"
+ Utils.TENANT_IDENTIFIER;
LOG.info("---------------------------------ACTIVATE A CENTER---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CENTER_ASSOCIATE_URL, activateCenterAsJSON(""), "groupId");
}
@@ -257,8 +259,8 @@ public class CenterHelper {
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix);
}
public static Object assignStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String groupId, final Long staffId) {
public static Object assignStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String groupId,
final Long staffId) {
final String GROUP_ASSIGN_STAFF_URL = "/fineract-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER
+ "&command=assignStaff";
LOG.info("---------------------------------Assign Staff---------------------------------------------");
@@ -96,8 +96,8 @@ public class ClientChargesTest {
* Revert the paid client charge transaction by passing the
* clientChargePaidTransactionId and ensure the same is reverted.
*/
final Integer undoTrxnId = ClientHelper.revertClientChargeTransaction(this.requestSpec, this.responseSpec,
clientId.toString(), clientChargePaidTransactionId);
final Integer undoTrxnId = ClientHelper.revertClientChargeTransaction(this.requestSpec, this.responseSpec, clientId.toString(),
clientChargePaidTransactionId);
Assertions.assertNotNull(undoTrxnId);
isReversedTransaction(clientId.toString(), undoTrxnId.toString());
/**
@@ -40,6 +40,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClientHelper {
private final static Logger LOG = LoggerFactory.getLogger(ClientHelper.class);
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
@@ -69,8 +70,7 @@ public class ClientHelper {
this.responseSpec = responseSpec;
}
public static Integer createClient(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public static Integer createClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return createClient(requestSpec, responseSpec, "04 March 2011");
}
@@ -82,79 +82,72 @@ public class ClientHelper {
public static Integer createClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String activationDate, final String officeId) {
LOG.info("---------------------------------CREATING A CLIENT---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL,
getTestClientAsJSON(activationDate, officeId), "clientId");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL, getTestClientAsJSON(activationDate, officeId),
"clientId");
}
public static Integer createClientPending(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public static Integer createClientPending(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return createClientPending(requestSpec, responseSpec, "04 March 2014");
}
public static Integer createClientPending(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String submittedOnDate) {
public static Integer createClientPending(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String submittedOnDate) {
return createClientPending(requestSpec, responseSpec, submittedOnDate, "1");
}
public static Integer createClientPending(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String submittedOnDate, final String officeId) {
LOG.info(
"---------------------------------CREATING A CLIENT IN PENDING---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL,
getTestClientAsJSONPending(submittedOnDate, officeId), "clientId");
public static Integer createClientPending(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String submittedOnDate, final String officeId) {
LOG.info("---------------------------------CREATING A CLIENT IN PENDING---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL, getTestClientAsJSONPending(submittedOnDate, officeId),
"clientId");
}
public Object createClientPendingWithError(final String jsonAttributeToGetBack) {
LOG.info(
"---------------------------------CREATING A CLIENT IN PENDING WITH ERROR---------------------------------------------");
LOG.info("---------------------------------CREATING A CLIENT IN PENDING WITH ERROR---------------------------------------------");
return Utils.performServerPost(this.requestSpec, this.responseSpec, CREATE_CLIENT_URL,
getTestClientAsJSONPending("04 March 2014", "1"), jsonAttributeToGetBack);
}
public static Integer createClientPendingWithDatatable(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String registeredTableName) {
LOG.info(
"-------------------------- CREATING A CLIENT IN PENDING WITH DATATABLES --------------------------------");
public static Integer createClientPendingWithDatatable(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String registeredTableName) {
LOG.info("-------------------------- CREATING A CLIENT IN PENDING WITH DATATABLES --------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL,
getTestPendingClientWithDatatableAsJson(registeredTableName), "clientId");
}
public static Integer createClientAsPerson(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public static Integer createClientAsPerson(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return createClientAsPerson(requestSpec, responseSpec, "04 March 2011");
}
public static Integer createClientAsPerson(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String activationDate) {
public static Integer createClientAsPerson(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String activationDate) {
return createClientAsPerson(requestSpec, responseSpec, activationDate, "1");
}
public static Integer createClientAsPerson(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String activationDate, final String officeId) {
public static Integer createClientAsPerson(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String activationDate, final String officeId) {
LOG.info(
"---------------------------------CREATING A CLIENT NON PERSON(ORGANISATION)---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL,
getTestPersonClientAsJSON(activationDate, officeId), "clientId");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL, getTestPersonClientAsJSON(activationDate, officeId),
"clientId");
}
public static Integer createClientAsEntity(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public static Integer createClientAsEntity(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return createClientAsEntity(requestSpec, responseSpec, "04 March 2011");
}
public static Integer createClientAsEntity(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String activationDate) {
public static Integer createClientAsEntity(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String activationDate) {
return createClientAsEntity(requestSpec, responseSpec, activationDate, "1");
}
public static Integer createClientAsEntity(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String activationDate, final String officeId) {
public static Integer createClientAsEntity(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String activationDate, final String officeId) {
Integer constitutionCodeId = (Integer) CodeHelper.getCodeByName(requestSpec, responseSpec, "Constitution")
Integer constitutionCodeId = (Integer) CodeHelper.getCodeByName(requestSpec, responseSpec, "Constitution").get("id");
Integer soleProprietorCodeValueId = (Integer) CodeHelper.retrieveOrCreateCodeValue(constitutionCodeId, requestSpec, responseSpec)
.get("id");
Integer soleProprietorCodeValueId = (Integer) CodeHelper
.retrieveOrCreateCodeValue(constitutionCodeId, requestSpec, responseSpec).get("id");
LOG.info(
"---------------------------------CREATING A CLIENT NON PERSON(ORGANISATION)---------------------------------------------");
@@ -162,29 +155,27 @@ public class ClientHelper {
getTestEntityClientAsJSON(activationDate, officeId, soleProprietorCodeValueId), "clientId");
}
public static Integer createClientForAccountPreference(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer clientType, String jsonAttributeToGetBack) {
public static Integer createClientForAccountPreference(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer clientType, String jsonAttributeToGetBack) {
final String activationDate = "04 March 2011";
final String officeId = "1";
LOG.info(
"---------------------------------CREATING A CLIENT BASED ON ACCOUNT PREFERENCE---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL,
getTestClientWithClientTypeAsJSON(activationDate, officeId, clientType.toString()),
jsonAttributeToGetBack);
getTestClientWithClientTypeAsJSON(activationDate, officeId, clientType.toString()), jsonAttributeToGetBack);
}
public static Object assignStaffToClient(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String clientId, final String staffId) {
final String CLIENT_ASSIGN_STAFF_URL = "/fineract-provider/api/v1/clients/" + clientId + "?"
+ Utils.TENANT_IDENTIFIER + "&command=assignStaff";
public static Object assignStaffToClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId, final String staffId) {
final String CLIENT_ASSIGN_STAFF_URL = "/fineract-provider/api/v1/clients/" + clientId + "?" + Utils.TENANT_IDENTIFIER
+ "&command=assignStaff";
LOG.info("---------------------------------CREATING A CLIENT---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CLIENT_ASSIGN_STAFF_URL,
assignStaffToClientAsJson(staffId), "changes");
return Utils.performServerPost(requestSpec, responseSpec, CLIENT_ASSIGN_STAFF_URL, assignStaffToClientAsJson(staffId), "changes");
}
public static Integer getClientsStaffId(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String clientId) {
public static Integer getClientsStaffId(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId) {
return (Integer) getClient(requestSpec, responseSpec, clientId, "staffId");
}
@@ -283,8 +274,7 @@ public class ClientHelper {
return new Gson().toJson(map);
}
public static String getTestClientWithClientTypeAsJSON(final String dateOfJoining, final String officeId,
final String clientType) {
public static String getTestClientWithClientTypeAsJSON(final String dateOfJoining, final String officeId, final String clientType) {
final HashMap<String, String> map = new HashMap<>();
map.put("officeId", officeId);
map.put("firstname", Utils.randomNameGenerator("Client_FirstName_", 5));
@@ -306,17 +296,16 @@ public class ClientHelper {
return new Gson().toJson(map);
}
public static void verifyClientCreatedOnServer(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer generatedClientID) {
public static void verifyClientCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedClientID) {
LOG.info("------------------------------CHECK CLIENT DETAILS------------------------------------\n");
final String CLIENT_URL = "/fineract-provider/api/v1/clients/" + generatedClientID + "?"
+ Utils.TENANT_IDENTIFIER;
final String CLIENT_URL = "/fineract-provider/api/v1/clients/" + generatedClientID + "?" + Utils.TENANT_IDENTIFIER;
final Integer responseClientID = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, "id");
assertEquals(generatedClientID, responseClientID, "ERROR IN CREATING THE CLIENT");
}
public static Object getClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId, final String jsonReturn) {
public static Object getClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String clientId,
final String jsonReturn) {
final String GET_CLIENT_URL = "/fineract-provider/api/v1/clients/" + clientId + "?" + Utils.TENANT_IDENTIFIER;
LOG.info("---------------------------------GET A CLIENT---------------------------------------------");
return Utils.performServerGet(requestSpec, responseSpec, GET_CLIENT_URL, jsonReturn);
@@ -325,8 +314,8 @@ public class ClientHelper {
/* Client status is a map.So adding SuppressWarnings */
@SuppressWarnings("unchecked")
public static HashMap<String, Object> getClientStatus(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String clientId) {
public static HashMap<String, Object> getClientStatus(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId) {
return (HashMap<String, Object>) getClient(requestSpec, responseSpec, clientId, "status");
}
@@ -343,8 +332,7 @@ public class ClientHelper {
Integer clientClosureCodeId = (Integer) code.get("id");
/* Retrieve/Create Code Values for the Code "ClientClosureReason" */
HashMap<String, Object> codeValue = CodeHelper.retrieveOrCreateCodeValue(clientClosureCodeId, this.requestSpec,
this.responseSpec);
HashMap<String, Object> codeValue = CodeHelper.retrieveOrCreateCodeValue(clientClosureCodeId, this.requestSpec, this.responseSpec);
Integer closureReasonId = (Integer) codeValue.get("id");
map.put("closureReasonId", closureReasonId.toString());
@@ -399,8 +387,8 @@ public class ClientHelper {
Integer clientRejectionReasonCodeId = (Integer) code.get("id");
/* Retrieve/Create Code Values for the Code "ClientRejectReason" */
HashMap<String, Object> codeValue = CodeHelper.retrieveOrCreateCodeValue(clientRejectionReasonCodeId,
this.requestSpec, this.responseSpec);
HashMap<String, Object> codeValue = CodeHelper.retrieveOrCreateCodeValue(clientRejectionReasonCodeId, this.requestSpec,
this.responseSpec);
Integer rejectionReasonId = (Integer) codeValue.get("id");
map.put("locale", CommonConstants.LOCALE);
@@ -431,8 +419,8 @@ public class ClientHelper {
Integer clientWithdrawReasonCodeId = (Integer) code.get("id");
/* Retrieve/Create Code Values for the Code "ClientWithdrawReason" */
HashMap<String, Object> codeValue = CodeHelper.retrieveOrCreateCodeValue(clientWithdrawReasonCodeId,
this.requestSpec, this.responseSpec);
HashMap<String, Object> codeValue = CodeHelper.retrieveOrCreateCodeValue(clientWithdrawReasonCodeId, this.requestSpec,
this.responseSpec);
Integer withdrawalReasonId = (Integer) codeValue.get("id");
map.put("locale", CommonConstants.LOCALE);
@@ -479,20 +467,17 @@ public class ClientHelper {
public HashMap<String, Object> closeClient(final Integer clientId) {
LOG.info("--------------------------------- CLOSE CLIENT -------------------------------");
return performClientActions(createClientOperationURL(CLOSE_CLIENT_COMMAND, clientId), getCloseClientAsJSON(),
clientId);
return performClientActions(createClientOperationURL(CLOSE_CLIENT_COMMAND, clientId), getCloseClientAsJSON(), clientId);
}
public HashMap<String, Object> reactivateClient(final Integer clientId) {
LOG.info("--------------------------------- REACTIVATE CLIENT -------------------------------");
return performClientActions(createClientOperationURL(REACTIVATE_CLIENT_COMMAND, clientId),
getReactivateClientAsJSON(), clientId);
return performClientActions(createClientOperationURL(REACTIVATE_CLIENT_COMMAND, clientId), getReactivateClientAsJSON(), clientId);
}
public HashMap<String, Object> rejectClient(final Integer clientId) {
LOG.info("--------------------------------- REJECT CLIENT -------------------------------");
return performClientActions(createClientOperationURL(REJECT_CLIENT_COMMAND, clientId), getRejectClientAsJSON(),
clientId);
return performClientActions(createClientOperationURL(REJECT_CLIENT_COMMAND, clientId), getRejectClientAsJSON(), clientId);
}
public HashMap<String, Object> activateClient(final Integer clientId) {
@@ -503,8 +488,7 @@ public class ClientHelper {
public HashMap<String, Object> withdrawClient(final Integer clientId) {
LOG.info("--------------------------------- WITHDRAWN CLIENT -------------------------------");
return performClientActions(createClientOperationURL(WITHDRAW_CLIENT_COMMAND, clientId),
getWithdrawClientAsJSON(), clientId);
return performClientActions(createClientOperationURL(WITHDRAW_CLIENT_COMMAND, clientId), getWithdrawClientAsJSON(), clientId);
}
private String createClientOperationURL(final String command, final Integer clientId) {
@@ -523,113 +507,102 @@ public class ClientHelper {
getUndoWithdrawnClientAsJSON(CREATED_DATE_PLUS_TWO), clientId);
}
public ArrayList<HashMap<String, Object>> undoRejectedclient(final Integer clientId,
final String jsonAttributeToGetBack, final String rejectedDate) {
public ArrayList<HashMap<String, Object>> undoRejectedclient(final Integer clientId, final String jsonAttributeToGetBack,
final String rejectedDate) {
LOG.info("----------------------------------UNDO REJECT CLIENT ----------------------------------");
return performClientActionsWithValidationErrors(createClientOperationURL(UNDOREJECT_CLIENT_COMMAND, clientId),
getUndoRejectClientAsJSON(rejectedDate), jsonAttributeToGetBack);
}
public ArrayList<HashMap<String, Object>> undoWithdrawclient(final Integer clientId,
final String jsonAttributeToGetBack, final String rejectedDate) {
public ArrayList<HashMap<String, Object>> undoWithdrawclient(final Integer clientId, final String jsonAttributeToGetBack,
final String rejectedDate) {
LOG.info("----------------------------------UNDO WITHDRAW CLIENT ----------------------------------");
return performClientActionsWithValidationErrors(
createClientOperationURL(UNDOWITHDRAWN_CLIENT_COMMAND, clientId),
return performClientActionsWithValidationErrors(createClientOperationURL(UNDOWITHDRAWN_CLIENT_COMMAND, clientId),
getUndoWithdrawnClientAsJSON(rejectedDate), jsonAttributeToGetBack);
}
public ArrayList<HashMap<String, Object>> activateClient(final Integer clientId,
final String jsonAttributeToGetBack) {
public ArrayList<HashMap<String, Object>> activateClient(final Integer clientId, final String jsonAttributeToGetBack) {
LOG.info("--------------------------------- ACTIVATE CLIENT -------------------------------");
return performClientActionsWithValidationErrors(createClientOperationURL(ACTIVATE_CLIENT_COMMAND, clientId),
getActivateClientAsJSON(CREATED_DATE_PLUS_ONE), jsonAttributeToGetBack);
}
public HashMap<String, Object> activateClientWithDiffDateOption(final Integer clientId,
final String activationDate) {
public HashMap<String, Object> activateClientWithDiffDateOption(final Integer clientId, final String activationDate) {
LOG.info("--------------------------------- ACTIVATE CLIENT -------------------------------");
return performClientActions(createClientOperationURL(ACTIVATE_CLIENT_COMMAND, clientId),
getActivateClientAsJSON(activationDate), clientId);
return performClientActions(createClientOperationURL(ACTIVATE_CLIENT_COMMAND, clientId), getActivateClientAsJSON(activationDate),
clientId);
}
private ArrayList<HashMap<String, Object>> performClientActionsWithValidationErrors(final String postURLForClient,
final String jsonToBeSent, final String jsonAttributeToGetBack) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent,
jsonAttributeToGetBack);
return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent, jsonAttributeToGetBack);
}
private HashMap<String, Object> performClientActions(final String postURLForClient, final String jsonToBeSent,
final Integer clientId) {
Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent,
CommonConstants.RESPONSE_STATUS);
HashMap<String, Object> response = ClientHelper.getClientStatus(requestSpec, responseSpec,
String.valueOf(clientId));
private HashMap<String, Object> performClientActions(final String postURLForClient, final String jsonToBeSent, final Integer clientId) {
Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent, CommonConstants.RESPONSE_STATUS);
HashMap<String, Object> response = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
return response;
}
public static Integer addChargesForClient(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer clientId, final String request) {
public static Integer addChargesForClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer clientId, final String request) {
LOG.info("--------------------------------- ADD CHARGES FOR Client --------------------------------");
final String ADD_CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/charges?"
+ Utils.TENANT_IDENTIFIER;
final String ADD_CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/charges?" + Utils.TENANT_IDENTIFIER;
final HashMap<?, ?> response = Utils.performServerPost(requestSpec, responseSpec, ADD_CHARGES_URL, request, "");
return (Integer) response.get("resourceId");
}
public static String payChargesForClients(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer clientId, final Integer clientChargeId,
final String json) {
public static String payChargesForClients(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer clientId, final Integer clientChargeId, final String json) {
LOG.info("--------------------------------- PAY CHARGES FOR CLIENT --------------------------------");
final String CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/charges/" + clientChargeId
+ "?command=paycharge&" + Utils.TENANT_IDENTIFIER;
final String CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/charges/" + clientChargeId + "?command=paycharge&"
+ Utils.TENANT_IDENTIFIER;
final HashMap<?, ?> response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, "");
return response.get("transactionId") != null ? response.get("transactionId").toString() : null;
}
public static String waiveChargesForClients(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer clientId, final Integer clientChargeId,
final String json) {
public static String waiveChargesForClients(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer clientId, final Integer clientChargeId, final String json) {
LOG.info("--------------------------------- WAIVE CHARGES FOR CLIENT --------------------------------");
final String CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/charges/" + clientChargeId
+ "?command=waive&" + Utils.TENANT_IDENTIFIER;
final String CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/charges/" + clientChargeId + "?command=waive&"
+ Utils.TENANT_IDENTIFIER;
final HashMap<?, ?> response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, "");
return response.get("transactionId").toString();
}
public static Integer revertClientChargeTransaction(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String clientId, String clientChargeId) {
public static Integer revertClientChargeTransaction(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId, String clientChargeId) {
LOG.info("---------------------------------UNDO TRANSACTION---------------------------------------------");
final String CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/transactions/" + clientChargeId
+ "?command=undo&" + Utils.TENANT_IDENTIFIER;
final String CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/transactions/" + clientChargeId + "?command=undo&"
+ Utils.TENANT_IDENTIFIER;
final HashMap<?, ?> response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, "", "");
return (Integer) response.get("resourceId");
}
public static Object getClientCharge(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String clientId, final String clientChargeId) {
public static Object getClientCharge(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId, final String clientChargeId) {
LOG.info("---------------------------------GET CLIENT CHARGE---------------------------------------------");
final String CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/charges/" + clientChargeId + "?"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, CHARGES_URL, "amountOutstanding");
}
public static Boolean getClientTransactions(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String clientId, final String transactionId) {
LOG.info(
"---------------------------------GET CLIENT CHARGE TRANSACTIONS---------------------------------------------");
final String CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/transactions/" + transactionId
+ "?" + Utils.TENANT_IDENTIFIER;
public static Boolean getClientTransactions(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId, final String transactionId) {
LOG.info("---------------------------------GET CLIENT CHARGE TRANSACTIONS---------------------------------------------");
final String CHARGES_URL = "/fineract-provider/api/v1/clients/" + clientId + "/transactions/" + transactionId + "?"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, CHARGES_URL, "reversed");
}
public Workbook getClientEntityWorkbook(GlobalEntityType clientsEntity, String dateFormat) throws IOException {
requestSpec.header(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel");
byte[] byteArray = Utils.performGetBinaryResponse(requestSpec, responseSpec, CLIENT_URL + "/downloadtemplate"
+ "?" + Utils.TENANT_IDENTIFIER + "&legalFormType=" + clientsEntity + "&dateFormat=" + dateFormat);
byte[] byteArray = Utils.performGetBinaryResponse(requestSpec, responseSpec, CLIENT_URL + "/downloadtemplate" + "?"
+ Utils.TENANT_IDENTIFIER + "&legalFormType=" + clientsEntity + "&dateFormat=" + dateFormat);
InputStream inputStream = new ByteArrayInputStream(byteArray);
Workbook workbook = new HSSFWorkbook(inputStream);
return workbook;
@@ -638,8 +611,7 @@ public class ClientHelper {
public String getOutputTemplateLocation(final String importDocumentId) {
requestSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN);
return Utils.performServerOutputTemplateLocationGet(requestSpec, responseSpec,
"/fineract-provider/api/v1/imports/getOutputTemplateLocation" + "?" + Utils.TENANT_IDENTIFIER,
importDocumentId);
"/fineract-provider/api/v1/imports/getOutputTemplateLocation" + "?" + Utils.TENANT_IDENTIFIER, importDocumentId);
}
public String importClientEntityTemplate(File file) {
@@ -647,8 +619,7 @@ public class ClientHelper {
String dateFormat = "dd MMMM yyyy";
String legalFormType = GlobalEntityType.CLIENTS_ENTTTY.toString();
requestSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.MULTIPART_FORM_DATA);
return Utils.performServerTemplatePost(requestSpec, responseSpec,
CLIENT_URL + "/uploadtemplate" + "?" + Utils.TENANT_IDENTIFIER, legalFormType, file, locale,
dateFormat);
return Utils.performServerTemplatePost(requestSpec, responseSpec, CLIENT_URL + "/uploadtemplate" + "?" + Utils.TENANT_IDENTIFIER,
legalFormType, file, locale, dateFormat);
}
}
@@ -18,7 +18,6 @@
*/
package org.apache.fineract.integrationtests.common;
public interface CommonConstants {
public final static String LOCALE = "en";
@@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
public class CurrenciesHelper {
private final static Logger LOG = LoggerFactory.getLogger(CurrenciesHelper.class);
private static final String CURRENCIES_URL = "/fineract-provider/api/v1/currencies";
@@ -57,9 +58,7 @@ public class CurrenciesHelper {
final String code) {
ArrayList<CurrencyDomain> currenciesList = getAllCurrencies(requestSpec, responseSpec);
for (CurrencyDomain e : currenciesList) {
if (e.getCode().equals(code)) {
return e;
}
if (e.getCode().equals(code)) { return e; }
}
return null;
}
@@ -57,8 +57,8 @@ public class CurrencyDomain implements Comparable<CurrencyDomain> {
super();
}
private CurrencyDomain(final String code, final String name, final int decimalPlaces, final String displaySymbol,
final String nameCode, final String displayLabel) {
private CurrencyDomain(final String code, final String name, final int decimalPlaces, final String displaySymbol, final String nameCode,
final String displayLabel) {
super();
this.code = code;
this.name = name;
@@ -135,9 +135,7 @@ public class CurrencyDomain implements Comparable<CurrencyDomain> {
public boolean equals(Object obj) {
if (obj == this) { return true; }
if (!(obj instanceof CurrencyDomain)) {
return false;
}
if (!(obj instanceof CurrencyDomain)) { return false; }
CurrencyDomain cd = (CurrencyDomain) obj;
@@ -29,27 +29,27 @@ public class ExternalServicesConfigurationHelper {
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
public ExternalServicesConfigurationHelper(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public ExternalServicesConfigurationHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public static ArrayList<HashMap> getExternalServicesConfigurationByServiceName(
final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String serviceName) {
final String GET_EXTERNAL_SERVICES_CONFIG_BY_SERVICE_NAME_URL = "/fineract-provider/api/v1/externalservice/"
+ serviceName + "?" + Utils.TENANT_IDENTIFIER;
// system.out.println("------------------------ RETRIEVING GLOBAL CONFIGURATION
public static ArrayList<HashMap> getExternalServicesConfigurationByServiceName(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String serviceName) {
final String GET_EXTERNAL_SERVICES_CONFIG_BY_SERVICE_NAME_URL = "/fineract-provider/api/v1/externalservice/" + serviceName + "?"
+ Utils.TENANT_IDENTIFIER;
// system.out.println("------------------------ RETRIEVING GLOBAL
// CONFIGURATION
// BY ID -------------------------");
return Utils.performServerGet(requestSpec, responseSpec, GET_EXTERNAL_SERVICES_CONFIG_BY_SERVICE_NAME_URL, "");
}
public static HashMap updateValueForExternaServicesConfiguration(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String serviceName, final String name, final String value) {
final String EXTERNAL_SERVICES_CONFIG_UPDATE_URL = "/fineract-provider/api/v1/externalservice/" + serviceName
+ "?" + Utils.TENANT_IDENTIFIER;
// system.out.println("---------------------------------UPDATE VALUE FOR GLOBAL
final String EXTERNAL_SERVICES_CONFIG_UPDATE_URL = "/fineract-provider/api/v1/externalservice/" + serviceName + "?"
+ Utils.TENANT_IDENTIFIER;
// system.out.println("---------------------------------UPDATE VALUE FOR
// GLOBAL
// CONFIG---------------------------------------------");
HashMap map = Utils.performServerPut(requestSpec, responseSpec, EXTERNAL_SERVICES_CONFIG_UPDATE_URL,
updateExternalServicesConfigUpdateValueAsJSON(name, value), "");
@@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "unused", "rawtypes" })
public class GlobalConfigurationHelper {
private final static Logger LOG = LoggerFactory.getLogger(GlobalConfigurationHelper.class);
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
@@ -38,10 +39,12 @@ public class GlobalConfigurationHelper {
this.responseSpec = responseSpec;
}
public static ArrayList<HashMap> getAllGlobalConfigurations(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
public static ArrayList<HashMap> getAllGlobalConfigurations(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String GET_ALL_GLOBAL_CONFIG_URL = "/fineract-provider/api/v1/configurations?" + Utils.TENANT_IDENTIFIER;
LOG.info("------------------------ RETRIEVING ALL GLOBAL CONFIGURATIONS -------------------------");
final HashMap<String, ArrayList<HashMap>> response = Utils.performServerGet(requestSpec, responseSpec, GET_ALL_GLOBAL_CONFIG_URL, "");
final HashMap<String, ArrayList<HashMap>> response = Utils.performServerGet(requestSpec, responseSpec, GET_ALL_GLOBAL_CONFIG_URL,
"");
return response.get("globalConfiguration");
}
@@ -52,7 +55,8 @@ public class GlobalConfigurationHelper {
return Utils.performServerGet(requestSpec, responseSpec, GET_GLOBAL_CONFIG_BY_ID_URL, "");
}
public static void resetAllDefaultGlobalConfigurations(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
public static void resetAllDefaultGlobalConfigurations(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final ArrayList<HashMap> defaults = getAllDefaultGlobalConfigurations();
for (HashMap configDefault : defaults) {
@@ -66,16 +70,20 @@ public class GlobalConfigurationHelper {
continue;
}
// Currently only values and enabled flags are modified by the integration test suite.
// If any other column is modified by the integration test suite in the future, it needs to be reset here.
// Currently only values and enabled flags are modified by the
// integration test suite.
// If any other column is modified by the integration test suite in
// the future, it needs to be reset here.
final Integer configDefaultId = (Integer) configDefault.get("id");
final Integer configDefaultValue = (Integer) configDefault.get("value");
updateValueForGlobalConfiguration(requestSpec, responseSpec, configDefaultId.toString(), configDefaultValue.toString());
updateEnabledFlagForGlobalConfiguration(requestSpec, responseSpec, configDefaultId.toString(), (Boolean)configDefault.get("enabled"));
updateEnabledFlagForGlobalConfiguration(requestSpec, responseSpec, configDefaultId.toString(),
(Boolean) configDefault.get("enabled"));
}
}
public static void verifyAllDefaultGlobalConfigurations(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
public static void verifyAllDefaultGlobalConfigurations(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
ArrayList<HashMap> expectedGlobalConfigurations = getAllDefaultGlobalConfigurations();
ArrayList<HashMap> actualGlobalConfigurations = getAllGlobalConfigurations(requestSpec, responseSpec);
@@ -92,19 +100,26 @@ public class GlobalConfigurationHelper {
Assertions.assertEquals(expectedGlobalConfiguration.get("id"), actualGlobalConfiguration.get("id"));
final String assertionFailedMessage = "Assertion failed for configID:<" + expectedGlobalConfiguration.get("id") + ">";
Assertions.assertEquals(expectedGlobalConfiguration.get("name"), actualGlobalConfiguration.get("name"), assertionFailedMessage);
Assertions.assertEquals(expectedGlobalConfiguration.get("value"), actualGlobalConfiguration.get("value"), assertionFailedMessage);
Assertions.assertEquals(expectedGlobalConfiguration.get("enabled"), actualGlobalConfiguration.get("enabled"), assertionFailedMessage);
Assertions.assertEquals(expectedGlobalConfiguration.get("trapDoor"), actualGlobalConfiguration.get("trapDoor"), assertionFailedMessage);
Assertions.assertEquals(expectedGlobalConfiguration.get("value"), actualGlobalConfiguration.get("value"),
assertionFailedMessage);
Assertions.assertEquals(expectedGlobalConfiguration.get("enabled"), actualGlobalConfiguration.get("enabled"),
assertionFailedMessage);
Assertions.assertEquals(expectedGlobalConfiguration.get("trapDoor"), actualGlobalConfiguration.get("trapDoor"),
assertionFailedMessage);
}
}
/**
* Helper method to get the current default instance data of the /configurations endpoint.
* Used to reset and verify that no global configuration affects state between integration tests.
* @see <a href="https://issues.apache.org/jira/browse/FINERACT-722">FINERACT-722</a>
* This is a quick, fail fast and early implementation to resolve this issue.
* TODO: A more robust future solution would be isolating all integration test state using Spring Framework's
* integration test infrastructure for transaction commits and rollbacks.
* Helper method to get the current default instance data of the
* /configurations endpoint. Used to reset and verify that no global
* configuration affects state between integration tests.
*
* @see <a href=
* "https://issues.apache.org/jira/browse/FINERACT-722">FINERACT-722</a>
* This is a quick, fail fast and early implementation to resolve this
* issue. TODO: A more robust future solution would be isolating all
* integration test state using Spring Framework's integration test
* infrastructure for transaction commits and rollbacks.
*/
private static ArrayList<HashMap> getAllDefaultGlobalConfigurations() {
@@ -370,11 +385,12 @@ public class GlobalConfigurationHelper {
}
public static Object updatePasswordResetDaysForGlobalConfiguration(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer configId, final String value, final String enabled, final String jsonAttributeToGetBack) {
final ResponseSpecification responseSpec, final Integer configId, final String value, final String enabled,
final String jsonAttributeToGetBack) {
final String UPDATE_URL = "/fineract-provider/api/v1/configurations/" + configId + "?" + Utils.TENANT_IDENTIFIER;
LOG.info("------------------UPDATE GLOBAL CONFIG FOR FORCE PASSWORD RESET DAYS----------------------");
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_URL,
updatePasswordResetDaysGlobalConfigAsJSON(value, enabled), jsonAttributeToGetBack);
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_URL, updatePasswordResetDaysGlobalConfigAsJSON(value, enabled),
jsonAttributeToGetBack);
}
public static String updateGlobalConfigUpdateValueAsJSON(final String value) {
@@ -70,25 +70,25 @@ public class GroupHelper {
jsonAttributeToGetBack);
}
public static Integer createGroupPendingWithDatatable(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String registeredTableName) {
public static Integer createGroupPendingWithDatatable(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String registeredTableName) {
LOG.info("-------------------------- CREATING A GROUP WITH DATATABLES --------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_GROUP_URL,
getTestGroupWithDatatableAsJson(registeredTableName), "groupId");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_GROUP_URL, getTestGroupWithDatatableAsJson(registeredTableName),
"groupId");
}
public static Integer associateClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String groupId, final String clientMember) {
final String GROUP_ASSOCIATE_URL = "/fineract-provider/api/v1/groups/" + groupId
+ "?command=associateClients&" + Utils.TENANT_IDENTIFIER;
final String GROUP_ASSOCIATE_URL = "/fineract-provider/api/v1/groups/" + groupId + "?command=associateClients&"
+ Utils.TENANT_IDENTIFIER;
LOG.info("---------------------------------Associate Client To A GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSOCIATE_URL, associateClientAsJSON(clientMember), "groupId");
}
public static Integer disAssociateClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String groupId, final String clientMember) {
final String GROUP_ASSOCIATE_URL = "/fineract-provider/api/v1/groups/" + groupId
+ "?command=disassociateClients&" + Utils.TENANT_IDENTIFIER;
final String GROUP_ASSOCIATE_URL = "/fineract-provider/api/v1/groups/" + groupId + "?command=disassociateClients&"
+ Utils.TENANT_IDENTIFIER;
LOG.info("---------------------------------Disassociate Client To A GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSOCIATE_URL, associateClientAsJSON(clientMember), "groupId");
}
@@ -107,23 +107,29 @@ public class GroupHelper {
return Utils.performServerPut(requestSpec, responseSpec, GROUP_ASSOCIATE_URL, updateGroupAsJSON(name), "groupId");
}
public static Integer deleteGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String groupId) {
public static Integer deleteGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String groupId) {
final String GROUP_ASSOCIATE_URL = "/fineract-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER;
LOG.info("---------------------------------DELETE GROUP---------------------------------------------");
return Utils.performServerDelete(requestSpec, responseSpec, GROUP_ASSOCIATE_URL, "groupId");
}
public static Object assignStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String groupId,final Long staffId){
final String GROUP_ASSIGN_STAFF_URL = "/fineract-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER + "&command=assignStaff";
public static Object assignStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String groupId,
final Long staffId) {
final String GROUP_ASSIGN_STAFF_URL = "/fineract-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER
+ "&command=assignStaff";
LOG.info("---------------------------------DELETE GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSIGN_STAFF_URL, assignStaffAsJSON(staffId), "changes");
}
public static Object assignStaffInheritStaffForClientAccounts(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String groupId,final String staffId){
final String GROUP_ASSIGN_STAFF_URL = "/fineract-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER + "&command=assignStaff";
LOG.info("---------------------------------DELETE GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSIGN_STAFF_URL,assignStaffAndInheritStaffForClientAccountsAsJSON(staffId),"changes");
}
public static Object assignStaffInheritStaffForClientAccounts(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String groupId, final String staffId) {
final String GROUP_ASSIGN_STAFF_URL = "/fineract-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER
+ "&command=assignStaff";
LOG.info("---------------------------------DELETE GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSIGN_STAFF_URL,
assignStaffAndInheritStaffForClientAccountsAsJSON(staffId), "changes");
}
public static String getTestGroupAsJSON(final boolean active, final String activationDate) {
final HashMap<String, String> map = new HashMap<>();
@@ -173,12 +179,14 @@ public class GroupHelper {
LOG.debug("map : {}", map);
return new Gson().toJson(map);
}
public static String assignStaffAsJSON(final Long staffId) {
final HashMap<String, Object> map = new HashMap<>();
map.put("staffId", staffId);
LOG.debug("map : {}", map);
return new Gson().toJson(map);
}
public static String assignStaffAndInheritStaffForClientAccountsAsJSON(final String staffId) {
final HashMap<String, String> map = new HashMap<>();
map.put("staffId", staffId);
@@ -187,7 +195,6 @@ public class GroupHelper {
return new Gson().toJson(map);
}
public static void verifyGroupCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedGroupID) {
LOG.info("------------------------------CHECK GROUP DETAILS------------------------------------\n");
@@ -216,8 +223,8 @@ public class GroupHelper {
final Integer generatedGroupID, final Integer groupMember) {
List<String> list = new ArrayList<>();
LOG.info("------------------------------CHECK GROUP MEMBERS------------------------------------\n");
final String GROUP_URL = "/fineract-provider/api/v1/groups/" + generatedGroupID
+ "?associations=clientMembers&" + Utils.TENANT_IDENTIFIER;
final String GROUP_URL = "/fineract-provider/api/v1/groups/" + generatedGroupID + "?associations=clientMembers&"
+ Utils.TENANT_IDENTIFIER;
list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "clientMembers");
LOG.debug("the list of verifyEmptyGroupMembers : {} ", list);
assertTrue(list.toString().contains("id=" + groupMember.toString()), "ERROR IN GROUP MEMBER");
@@ -227,8 +234,8 @@ public class GroupHelper {
final Integer generatedGroupID) {
List<String> list = new ArrayList<>();
LOG.info("------------------------------CHECK EMPTY GROUP MEMBER LIST------------------------------------\n");
final String GROUP_URL = "/fineract-provider/api/v1/groups/" + generatedGroupID
+ "?associations=clientMembers&" + Utils.TENANT_IDENTIFIER;
final String GROUP_URL = "/fineract-provider/api/v1/groups/" + generatedGroupID + "?associations=clientMembers&"
+ Utils.TENANT_IDENTIFIER;
list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "clientMembers");
LOG.debug("the list of verifyEmptyGroupMembers : {} ", list);
assertEquals(list, null, "GROUP MEMBER LIST NOT EMPTY");
@@ -244,8 +251,8 @@ public class GroupHelper {
}
// Glim_Gsim_testing
public static List<String> verifyRetrieveGlimAccountsByGroupId(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer groupID) {
public static List<String> verifyRetrieveGlimAccountsByGroupId(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer groupID) {
List<String> list = new ArrayList<>();
LOG.info("------------------------------CHECK GROUP Retrieve Accounts------------------------------------\n");
final String GROUP_URL = "/fineract-provider/api/v1/groups/" + groupID + "/glimaccounts?" + Utils.TENANT_IDENTIFIER;
@@ -254,8 +261,8 @@ public class GroupHelper {
return list;
}
public static List<String> verifyRetrieveGlimAccountsByGlimId(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer glimId) {
public static List<String> verifyRetrieveGlimAccountsByGlimId(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer glimId) {
List<String> list = new ArrayList<>();
LOG.info("------------------------------CHECK GROUP Retrieve Accounts------------------------------------\n");
final String GROUP_URL = "/fineract-provider/api/v1/loans/glimAccount/" + glimId + "?" + Utils.TENANT_IDENTIFIER;
@@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "unused", "rawtypes" })
public class HolidayHelper {
private final static Logger LOG = LoggerFactory.getLogger(HolidayHelper.class);
private static final String HOLIDAYS_URL = "/fineract-provider/api/v1/holidays";
private static final String CREATE_HOLIDAY_URL = HOLIDAYS_URL + "?" + Utils.TENANT_IDENTIFIER;
@@ -74,7 +75,8 @@ public class HolidayHelper {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_HOLIDAY_URL, getCreateHolidayDataAsJSON(), "resourceId");
}
public static Integer activateHolidays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String holidayID) {
public static Integer activateHolidays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String holidayID) {
final String ACTIVATE_HOLIDAY_URL = HOLIDAYS_URL + "/" + holidayID + "?command=activate&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(requestSpec, responseSpec, ACTIVATE_HOLIDAY_URL, getActivateHolidayDataAsJSON(), "resourceId");
}
@@ -30,6 +30,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HookHelper {
private final static Logger LOG = LoggerFactory.getLogger(HookHelper.class);
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
@@ -43,8 +44,7 @@ public class HookHelper {
public Integer createHook(final String payloadURL) {
LOG.info("---------------------------------CREATING A HOOK---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_HOOK_URL, getTestHookAsJson(payloadURL),
"resourceId");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_HOOK_URL, getTestHookAsJson(payloadURL), "resourceId");
}
public String getTestHookAsJson(final String payloadURL) {
@@ -88,7 +88,8 @@ public class HookHelper {
public void verifyUpdateHook(final String updateURL, final Long hookId) {
LOG.info("------------------------------CHECK UPDATE HOOK DETAILS------------------------------------\n");
final String GET_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
ArrayList<HashMap<String, String>> map = Utils.<ArrayList<HashMap<String, String>>>performServerGet(this.requestSpec, this.responseSpec, GET_URL, "config");
ArrayList<HashMap<String, String>> map = Utils.<ArrayList<HashMap<String, String>>> performServerGet(this.requestSpec,
this.responseSpec, GET_URL, "config");
HashMap<String, String> hash = map.get(1);
assertEquals(updateURL, hash.get("fieldValue"));
}
@@ -97,7 +98,8 @@ public class HookHelper {
LOG.info("------------------------------CHECK DELETE HOOK DETAILS------------------------------------\n");
final String GET_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
ResponseSpecification responseSpec404 = new ResponseSpecBuilder().expectStatusCode(404).build();
ArrayList<HashMap<String, String>> array = Utils.<ArrayList<HashMap<String, String>>>performServerGet(this.requestSpec, responseSpec404, GET_URL, "errors");
ArrayList<HashMap<String, String>> array = Utils.<ArrayList<HashMap<String, String>>> performServerGet(this.requestSpec,
responseSpec404, GET_URL, "errors");
HashMap<String, String> map = array.get(0);
assertEquals("error.msg.hook.identifier.not.found", map.get("userMessageGlobalisationCode"));
}
@@ -25,6 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ImageHelper {
private final static Logger LOG = LoggerFactory.getLogger(ImageHelper.class);
private static final String STAFF_IMAGE_URL = "/fineract-provider/api/v1/staff/";
private static final String IMAGES_URI = "/images";
@@ -59,7 +60,8 @@ public class ImageHelper {
return Utils.performGetBinaryResponse(requestSpec, responseSpec, URL);
}
public static Integer deleteStaffImage(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, Integer staffId) {
public static Integer deleteStaffImage(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
Integer staffId) {
LOG.info("---------------------------------RETRIEVING STAFF IMAGE---------------------------------------------");
String URL = STAFF_IMAGE_URL + staffId + IMAGES_URI + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerDelete(requestSpec, responseSpec, URL, "resourceId");
@@ -24,6 +24,7 @@ import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
public class LoanRescheduleRequestHelper {
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
@@ -24,6 +24,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class NotificationHelper {
private final static Logger LOG = LoggerFactory.getLogger(NotificationHelper.class);
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
@@ -32,9 +32,8 @@ public class OfficeDomain {
private String[] openingDate;
private String hierarchy;
private Builder(final int id, final String name,
final String nameDecorated, final String externalId,
final String[] openingDate, final String hierarchy) {
private Builder(final int id, final String name, final String nameDecorated, final String externalId, final String[] openingDate,
final String hierarchy) {
this.id = id;
this.name = name;
this.nameDecorated = nameDecorated;
@@ -44,8 +43,7 @@ public class OfficeDomain {
}
public OfficeDomain build() {
return new OfficeDomain(this.id, this.name, this.nameDecorated,
this.externalId, this.openingDate, this.hierarchy);
return new OfficeDomain(this.id, this.name, this.nameDecorated, this.externalId, this.openingDate, this.hierarchy);
}
}
@@ -60,9 +58,8 @@ public class OfficeDomain {
super();
}
private OfficeDomain(final int id, final String name,
final String nameDecorated, final String externalId,
final String[] openingDate, final String hierarchy) {
private OfficeDomain(final int id, final String name, final String nameDecorated, final String externalId, final String[] openingDate,
final String hierarchy) {
super();
this.id = id;
this.name = name;
@@ -80,11 +77,9 @@ public class OfficeDomain {
return new Gson().fromJson(jsonData, OfficeDomain.class);
}
public static Builder create(final int id, final String name,
final String nameDecorated, final String externalId,
public static Builder create(final int id, final String name, final String nameDecorated, final String externalId,
final String[] openingDate, final String hierarchy) {
return new Builder(id, name, nameDecorated, externalId, openingDate,
hierarchy);
return new Builder(id, name, nameDecorated, externalId, openingDate, hierarchy);
}
public int getId() {
@@ -139,20 +134,14 @@ public class OfficeDomain {
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == this) { return true; }
if (!(obj instanceof OfficeDomain)) {
return false;
}
if (!(obj instanceof OfficeDomain)) { return false; }
OfficeDomain od = (OfficeDomain) obj;
if (this.id == od.getId() && this.name.equals(od.getName())
&& this.nameDecorated.equals(od.getName())
&& this.externalId.equals(od.getExternalId())
&& Arrays.equals(this.openingDate, od.getOpeningDate())
if (this.id == od.getId() && this.name.equals(od.getName()) && this.nameDecorated.equals(od.getName())
&& this.externalId.equals(od.getExternalId()) && Arrays.equals(this.openingDate, od.getOpeningDate())
&& this.hierarchy.equals(od.getHierarchy())) {
return true;
}
@@ -35,30 +35,26 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OfficeHelper {
private final static Logger LOG = LoggerFactory.getLogger(OfficeHelper.class);
private static final String OFFICE_URL = "/fineract-provider/api/v1/offices";
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
public OfficeHelper(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public OfficeHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public OfficeDomain retrieveOfficeByID(int id) {
Object get = Utils.performServerGet(
requestSpec, responseSpec, OFFICE_URL + "/" + id + "?"
+ Utils.TENANT_IDENTIFIER, "");
Object get = Utils.performServerGet(requestSpec, responseSpec, OFFICE_URL + "/" + id + "?" + Utils.TENANT_IDENTIFIER, "");
final String json = new Gson().toJson(get);
return new Gson().fromJson(json, new TypeToken<OfficeDomain>() {
}.getType());
return new Gson().fromJson(json, new TypeToken<OfficeDomain>() {}.getType());
}
public Integer createOffice(final String openingDate) {
String json = getAsJSON(openingDate);
return Utils.performServerPost(this.requestSpec, this.responseSpec,
OFFICE_URL + "?" + Utils.TENANT_IDENTIFIER, json,
return Utils.performServerPost(this.requestSpec, this.responseSpec, OFFICE_URL + "?" + Utils.TENANT_IDENTIFIER, json,
CommonConstants.RESPONSE_RESOURCE_ID);
}
@@ -71,8 +67,7 @@ public class OfficeHelper {
LOG.info("map : {}", map);
return Utils.performServerPut(requestSpec, responseSpec, OFFICE_URL
+ "/" + id + "?" + Utils.TENANT_IDENTIFIER,
return Utils.performServerPut(requestSpec, responseSpec, OFFICE_URL + "/" + id + "?" + Utils.TENANT_IDENTIFIER,
new Gson().toJson(map), "resourceId");
}
@@ -98,13 +93,14 @@ public class OfficeHelper {
public String getOutputTemplateLocation(final String importDocumentId) {
requestSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN);
return Utils.performServerOutputTemplateLocationGet(requestSpec,responseSpec,"/fineract-provider/api/v1/imports/getOutputTemplateLocation"+"?"
+Utils.TENANT_IDENTIFIER,importDocumentId);
return Utils.performServerOutputTemplateLocationGet(requestSpec, responseSpec,
"/fineract-provider/api/v1/imports/getOutputTemplateLocation" + "?" + Utils.TENANT_IDENTIFIER, importDocumentId);
}
public Workbook getOfficeWorkBook(final String dateFormat) throws IOException {
requestSpec.header(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel");
byte[] byteArray=Utils.performGetBinaryResponse(requestSpec,responseSpec,OFFICE_URL+"/downloadtemplate"+"?"+
Utils.TENANT_IDENTIFIER+"&dateFormat="+dateFormat);
byte[] byteArray = Utils.performGetBinaryResponse(requestSpec, responseSpec,
OFFICE_URL + "/downloadtemplate" + "?" + Utils.TENANT_IDENTIFIER + "&dateFormat=" + dateFormat);
InputStream inputStream = new ByteArrayInputStream(byteArray);
Workbook workbook = new HSSFWorkbook(inputStream);
return workbook;
@@ -27,8 +27,8 @@ public class PasswordPreferencesHelper {
private static final String PASSWORD_PREFERENCES_URL = "/fineract-provider/api/v1/passwordpreferences";
public static Object updatePasswordPreferences(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, String validationPolicyId) {
public static Object updatePasswordPreferences(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
String validationPolicyId) {
final String UPDATE_PASSWORD_PREFERENCES_URL = PASSWORD_PREFERENCES_URL + "?" + Utils.TENANT_IDENTIFIER;
// system.out.println("---------------------------------UPDATE PASSWORD
// PREFERENCE---------------------------------------------");
@@ -40,9 +40,11 @@ public class PasswordPreferencesHelper {
final ResponseSpecification responseSpec, String invalidValidationPolicyId, String jsonAttributeToGetback) {
final String UPDATE_PASSWORD_PREFERENCES_URL = PASSWORD_PREFERENCES_URL + "?" + Utils.TENANT_IDENTIFIER;
// system.out
//.println("---------------------------------UPDATE PASSWORD PREFERENCES WITH INVALID ID-----------------------------------------");
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_PASSWORD_PREFERENCES_URL, updatePreferencesWithInvalidId(invalidValidationPolicyId),
jsonAttributeToGetback);
// .println("---------------------------------UPDATE PASSWORD
// PREFERENCES WITH INVALID
// ID-----------------------------------------");
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_PASSWORD_PREFERENCES_URL,
updatePreferencesWithInvalidId(invalidValidationPolicyId), jsonAttributeToGetback);
}
public static String updatePreferencesAsJson(String validationPolicyId) {
@@ -57,17 +59,15 @@ public class PasswordPreferencesHelper {
return new Gson().toJson(map);
}
public static int getActivePasswordPreference(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
return Utils.performServerGet(requestSpec, responseSpec,
PASSWORD_PREFERENCES_URL + "?" + Utils.TENANT_IDENTIFIER, "id");
public static int getActivePasswordPreference(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return Utils.performServerGet(requestSpec, responseSpec, PASSWORD_PREFERENCES_URL + "?" + Utils.TENANT_IDENTIFIER, "id");
}
public static HashMap<String, Object> getAllPreferences(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
return Utils.performServerGet(requestSpec, responseSpec,
PASSWORD_PREFERENCES_URL + "/template" + "?" + Utils.TENANT_IDENTIFIER, "");
return Utils.performServerGet(requestSpec, responseSpec, PASSWORD_PREFERENCES_URL + "/template" + "?" + Utils.TENANT_IDENTIFIER,
"");
}
@@ -29,21 +29,20 @@ import java.util.HashMap;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class PaymentTypeHelper {
private static final String CREATE_PAYMENTTYPE_URL = "/fineract-provider/api/v1/paymenttypes?"
+ Utils.TENANT_IDENTIFIER;
private static final String CREATE_PAYMENTTYPE_URL = "/fineract-provider/api/v1/paymenttypes?" + Utils.TENANT_IDENTIFIER;
private static final String PAYMENTTYPE_URL = "/fineract-provider/api/v1/paymenttypes";
public static Integer createPaymentType(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String name, final String description,
final Boolean isCashPayment, final Integer position) {
// system.out.println("---------------------------------CREATING A PAYMENT
public static Integer createPaymentType(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String name, final String description, final Boolean isCashPayment, final Integer position) {
// system.out.println("---------------------------------CREATING A
// PAYMENT
// TYPE---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_PAYMENTTYPE_URL,
getJsonToCreatePaymentType(name, description, isCashPayment, position), "resourceId");
}
public static String getJsonToCreatePaymentType(final String name, final String description,
final Boolean isCashPayment, final Integer position) {
public static String getJsonToCreatePaymentType(final String name, final String description, final Boolean isCashPayment,
final Integer position) {
HashMap hm = new HashMap();
hm.put("name", name);
if (description != null) {
@@ -59,14 +58,12 @@ public class PaymentTypeHelper {
return new Gson().toJson(hm);
}
public static void verifyPaymentTypeCreatedOnServer(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer generatedPaymentTypeID) {
public static void verifyPaymentTypeCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedPaymentTypeID) {
// system.out.println("------------------------------CHECK PAYMENT
// DETAILS------------------------------------\n");
final String GET_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "/" + generatedPaymentTypeID + "?"
+ Utils.TENANT_IDENTIFIER;
final Integer responsePaymentTypeID = Utils.performServerGet(requestSpec, responseSpec, GET_PAYMENTTYPE_URL,
"id");
final String GET_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "/" + generatedPaymentTypeID + "?" + Utils.TENANT_IDENTIFIER;
final Integer responsePaymentTypeID = Utils.performServerGet(requestSpec, responseSpec, GET_PAYMENTTYPE_URL, "id");
assertEquals(generatedPaymentTypeID, responsePaymentTypeID, "ERROR IN CREATING THE PAYMENT TYPE");
}
@@ -77,25 +74,26 @@ public class PaymentTypeHelper {
// TYPE---------------------------------------------");
Object get = Utils.performServerGet(requestSpec, responseSpec, GET_PAYMENTTYPE_URL, "");
final String jsonData = new Gson().toJson(get);
return new Gson().fromJson(jsonData, new TypeToken<PaymentTypeDomain>() {
}.getType());
return new Gson().fromJson(jsonData, new TypeToken<PaymentTypeDomain>() {}.getType());
}
public static HashMap<String, String> updatePaymentType(final int id, HashMap request,
final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
public static HashMap<String, String> updatePaymentType(final int id, HashMap request, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String UPDATE_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "/" + id + "?" + Utils.TENANT_IDENTIFIER;
// system.out.println("---------------------------------UPDATE PAYMENT TYPE " +
// system.out.println("---------------------------------UPDATE PAYMENT
// TYPE " +
// id + "---------------------------------------------");
HashMap<String, String> hash = Utils.performServerPut(requestSpec, responseSpec, UPDATE_PAYMENTTYPE_URL,
new Gson().toJson(request), "changes");
HashMap<String, String> hash = Utils.performServerPut(requestSpec, responseSpec, UPDATE_PAYMENTTYPE_URL, new Gson().toJson(request),
"changes");
return hash;
}
public static Integer deletePaymentType(final int id, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String DELETE_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "/" + id + "?" + Utils.TENANT_IDENTIFIER;
// system.out.println("---------------------------------DELETING PAYMENT TYPE "
// system.out.println("---------------------------------DELETING PAYMENT
// TYPE "
// + id + "--------------------------------------------");
return Utils.performServerDelete(requestSpec, responseSpec, DELETE_PAYMENTTYPE_URL, "resourceId");
}
@@ -49,6 +49,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class ProvisioningIntegrationTest {
private final static Logger LOG = LoggerFactory.getLogger(ProvisioningIntegrationTest.class);
private static final String NONE = "1";
private final static int LOANPRODUCTS_SIZE = 10;
@@ -43,6 +43,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SchedulerJobHelper {
private final static Logger LOG = LoggerFactory.getLogger(SchedulerJobHelper.class);
private final RequestSpecification requestSpec;
private final ResponseSpecification response200Spec;
@@ -133,12 +134,17 @@ public class SchedulerJobHelper {
return (Integer) allSchedulerJobsData.get(jobIndex).get("jobId");
}
}
throw new IllegalArgumentException("No such named Job (see org.apache.fineract.infrastructure.jobs.service.JobName enum):" + jobName);
throw new IllegalArgumentException(
"No such named Job (see org.apache.fineract.infrastructure.jobs.service.JobName enum):" + jobName);
}
/**
* Launches a Job and awaits its completion.
* @param jobName displayName (see {@link org.apache.fineract.infrastructure.jobs.service.JobName}) of Scheduler Job
*
* @param jobName
* displayName (see
* {@link org.apache.fineract.infrastructure.jobs.service.JobName})
* of Scheduler Job
*
* @author Michael Vorburger.ch
*/
@@ -148,29 +154,29 @@ public class SchedulerJobHelper {
DateTimeFormatter df = DateTimeFormatter.ISO_INSTANT; // FINERACT-926
Instant beforeExecuteTime = now().truncatedTo(ChronoUnit.SECONDS);
// Stop the Scheduler while we manually trigger execution of job, to avoid side effects and simplify debugging when readings logs
// Stop the Scheduler while we manually trigger execution of job, to
// avoid side effects and simplify debugging when readings logs
updateSchedulerStatus(false);
// Executing Scheduler Job
int jobId = getSchedulerJobIdByName(jobName);
runSchedulerJob(jobId);
// Await JobDetailData.lastRunHistory [JobDetailHistoryData] jobRunStartTime >= beforeExecuteTime (or timeout)
// Await JobDetailData.lastRunHistory [JobDetailHistoryData]
// jobRunStartTime >= beforeExecuteTime (or timeout)
await().atMost(TIMEOUT).pollInterval(PAUSE).until(jobLastRunHistorySupplier(jobId), lastRunHistory -> {
String jobRunStartText = lastRunHistory.get("jobRunStartTime");
if (jobRunStartText == null) {
return false;
}
if (jobRunStartText == null) { return false; }
Instant jobRunStartTime = df.parse(jobRunStartText, Instant::from);
return jobRunStartTime.equals(beforeExecuteTime) || jobRunStartTime.isAfter(beforeExecuteTime);
});
// Await JobDetailData.lastRunHistory [JobDetailHistoryData] jobRunEndTime to be both set and >= jobRunStartTime (or timeout)
Map<String, String> finalLastRunHistory = await().atMost(TIMEOUT).pollInterval(PAUSE).until(jobLastRunHistorySupplier(jobId), lastRunHistory -> {
// Await JobDetailData.lastRunHistory [JobDetailHistoryData]
// jobRunEndTime to be both set and >= jobRunStartTime (or timeout)
Map<String, String> finalLastRunHistory = await().atMost(TIMEOUT).pollInterval(PAUSE).until(jobLastRunHistorySupplier(jobId),
lastRunHistory -> {
String jobRunEndText = lastRunHistory.get("jobRunEndTime");
if (jobRunEndText == null) {
return false;
}
if (jobRunEndText == null) { return false; }
Instant jobRunEndTime = df.parse(jobRunEndText, Instant::from);
Instant jobRunStartTime = df.parse(lastRunHistory.get("jobRunStartTime"), Instant::from);
return jobRunEndTime.equals(jobRunStartTime) || jobRunEndTime.isAfter(jobRunStartTime);
@@ -179,22 +185,23 @@ public class SchedulerJobHelper {
// Verify triggerType
assertThat(finalLastRunHistory.get("triggerType"), is("application"));
// Verify status & propagate jobRunErrorMessage and/or jobRunErrorLog (if any)
// Verify status & propagate jobRunErrorMessage and/or jobRunErrorLog
// (if any)
String status = finalLastRunHistory.get("status");
if (!status.equals("success")) {
fail("Job status is not success: " + finalLastRunHistory.toString());
}
// PS: Checking getSchedulerJobHistory() [/runhistory] is pointless, because the lastRunHistory JobDetailHistoryData is already part of JobDetailData anyway.
// PS: Checking getSchedulerJobHistory() [/runhistory] is pointless,
// because the lastRunHistory JobDetailHistoryData is already part of
// JobDetailData anyway.
}
@SuppressWarnings("unchecked")
private Callable<Map<String, String>> jobLastRunHistorySupplier(int jobId) {
return () -> {
Map<String, Object> job = getSchedulerJobById(jobId);
if (job == null) {
return null;
}
if (job == null) { return null; }
return (Map<String, String>) job.get("lastRunHistory");
};
}
@@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
public class StandingInstructionsHelper {
private final static Logger LOG = LoggerFactory.getLogger(StandingInstructionsHelper.class);
private static final String STANDING_INSTRUCTIONS_URL = "/fineract-provider/api/v1/standinginstructions";
private static final String STANDING_INSTRUCTIONS_RUNHISTORY_URL = "/fineract-provider/api/v1/standinginstructionrunhistory";
@@ -113,10 +114,11 @@ public class StandingInstructionsHelper {
return response;
}
public List<HashMap> getStandingInstructionHistory(Integer fromSavingsId, Integer fromAccountType, Integer fromClientId, Integer transferType) {
public List<HashMap> getStandingInstructionHistory(Integer fromSavingsId, Integer fromAccountType, Integer fromClientId,
Integer transferType) {
final String STANDING_INSTRUCTIONS_HISTORY_URL = STANDING_INSTRUCTIONS_RUNHISTORY_URL + "?" + Utils.TENANT_IDENTIFIER
+ "&fromSavingsId=" + fromSavingsId + "&fromAccountType=" + fromAccountType + "&clientId=" + fromClientId
+ "&transferType=" + transferType;
+ "&fromSavingsId=" + fromSavingsId + "&fromAccountType=" + fromAccountType + "&clientId=" + fromClientId + "&transferType="
+ transferType;
LOG.info("STANDING_INSTRUCTIONS_HISTORY_URL= {}", STANDING_INSTRUCTIONS_HISTORY_URL);
final List<HashMap> response = (List<HashMap>) Utils.performServerGet(this.requestSpec, this.responseSpec,
STANDING_INSTRUCTIONS_HISTORY_URL, "pageItems");
@@ -28,6 +28,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SurveyHelper {
private final static Logger LOG = LoggerFactory.getLogger(SurveyHelper.class);
private static final String FULFIL_SURVEY_URL = "/fineract-provider/api/v1/survey/ppi_kenya_2009/clientId?" + Utils.TENANT_IDENTIFIER;
@@ -66,10 +67,10 @@ public class SurveyHelper {
public static void verifySurveyCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedClientID) {
LOG.info("------------------------------CHECK CLIENT DETAILS------------------------------------\n");
final String SURVEY_URL = "/fineract-provider/api/v1/Survey/ppi_kenya_2009/clientid/entryId" + generatedClientID + "?" + Utils.TENANT_IDENTIFIER;
final String SURVEY_URL = "/fineract-provider/api/v1/Survey/ppi_kenya_2009/clientid/entryId" + generatedClientID + "?"
+ Utils.TENANT_IDENTIFIER;
final Integer responseClientID = Utils.performServerGet(requestSpec, responseSpec, SURVEY_URL, "id");
assertEquals(generatedClientID, responseClientID, "ERROR IN CREATING THE CLIENT");
}
}
@@ -27,6 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TaxComponentHelper {
private final static Logger LOG = LoggerFactory.getLogger(TaxComponentHelper.class);
private static final String CREATE_TAX_COMPONENT_URL = "/fineract-provider/api/v1/taxes/component?" + Utils.TENANT_IDENTIFIER;
@@ -29,13 +29,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TaxGroupHelper {
private final static Logger LOG = LoggerFactory.getLogger(TaxGroupHelper.class);
private static final String CREATE_TAX_COMPONENT_URL = "/fineract-provider/api/v1/taxes/group?" + Utils.TENANT_IDENTIFIER;
public static Integer createTaxGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Collection<Integer> taxComponentIds) {
LOG.info("---------------------------------CREATING A TAX GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_TAX_COMPONENT_URL, getTaxGroupAsJSON(taxComponentIds), "resourceId");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_TAX_COMPONENT_URL, getTaxGroupAsJSON(taxComponentIds),
"resourceId");
}
public static String getTaxGroupAsJSON(final Collection<Integer> taxComponentIds) {
@@ -83,13 +83,11 @@ public class Utils {
LOG.info("{} return HTTP 200, application is now ready for integration testing!", HEALTH_URL);
return;
} else {
LOG.info("{} returned HTTP {}, going to wait and retry (attempt {})", HEALTH_URL,
healthHttpStatus, attempt++);
LOG.info("{} returned HTTP {}, going to wait and retry (attempt {})", HEALTH_URL, healthHttpStatus, attempt++);
sleep(3);
}
} catch (Exception e) {
LOG.info("{} caused {}, going to wait and retry (attempt {})", HEALTH_URL, e.getMessage(),
attempt++);
LOG.info("{} caused {}, going to wait and retry (attempt {})", HEALTH_URL, e.getMessage(), attempt++);
lastException = e;
sleep(3);
}
@@ -99,8 +97,7 @@ public class Utils {
LOG.error("{} still not reachable, giving up", HEALTH_URL, lastException);
throw new AssertionError(HEALTH_URL + " not reachable", lastException);
} else {
LOG.error("{} still has not returned HTTP 200, giving up (last) body: {}", HEALTH_URL,
response.prettyPrint());
LOG.error("{} still has not returned HTTP 200, giving up (last) body: {}", HEALTH_URL, response.prettyPrint());
fail(HEALTH_URL + " returned " + response.prettyPrint());
}
}
@@ -119,9 +116,8 @@ public class Utils {
try {
LOG.info("Logging in, for integration test...");
// system.out.println("-----------------------------------LOGIN-----------------------------------------");
String json = RestAssured.given().contentType(ContentType.JSON)
.body("{\"username\":\"mifos\", \"password\":\"password\"}").expect().log().ifError().when()
.post(LOGIN_URL).asString();
String json = RestAssured.given().contentType(ContentType.JSON).body("{\"username\":\"mifos\", \"password\":\"password\"}")
.expect().log().ifError().when().post(LOGIN_URL).asString();
assertThat("Failed to login into fineract platform", StringUtils.isBlank(json), is(false));
String key = JsonPath.with(json).get("base64EncodedAuthenticationKey");
assertThat("Failed to obtain key: " + json, StringUtils.isBlank(key), is(false));
@@ -136,59 +132,49 @@ public class Utils {
}
}
public static <T> T performServerGet(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String getURL, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL)
public static <T> T performServerGet(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String getURL, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString();
if (jsonAttributeToGetBack == null) { return (T) json; }
return (T) from(json).get(jsonAttributeToGetBack);
}
public static String performGetTextResponse(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String getURL) {
return given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString();
}
public static byte[] performGetBinaryResponse(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String getURL) {
return given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asByteArray();
}
public static <T> T performServerPost(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String postURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when().post(postURL)
.andReturn().asString();
if (jsonAttributeToGetBack == null) {
return (T) json;
}
if (jsonAttributeToGetBack == null) { return (T) json; }
return (T) from(json).get(jsonAttributeToGetBack);
}
public static String performGetTextResponse(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String getURL) {
return given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn()
public static <T> T performServerPut(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String putURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when().put(putURL)
.andReturn().asString();
return (T) from(json).get(jsonAttributeToGetBack);
}
public static <T> T performServerDelete(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String deleteURL, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().delete(deleteURL).andReturn()
.asString();
}
public static byte[] performGetBinaryResponse(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String getURL) {
return given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn()
.asByteArray();
}
public static <T> T performServerPost(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String postURL, final String jsonBodyToSend,
final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError()
.when().post(postURL).andReturn().asString();
if (jsonAttributeToGetBack == null) {
return (T) json;
}
return (T) from(json).get(jsonAttributeToGetBack);
}
public static <T> T performServerPut(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String putURL, final String jsonBodyToSend,
final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError()
.when().put(putURL).andReturn().asString();
return (T) from(json).get(jsonAttributeToGetBack);
}
public static <T> T performServerDelete(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String deleteURL, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when()
public static <T> T performServerDelete(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String deleteURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when()
.delete(deleteURL).andReturn().asString();
return (T) from(json).get(jsonAttributeToGetBack);
}
public static <T> T performServerDelete(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String deleteURL, final String jsonBodyToSend,
final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError()
.when().delete(deleteURL).andReturn().asString();
return (T) (jsonAttributeToGetBack == null ? json : from(json).get(jsonAttributeToGetBack));
}
@@ -250,20 +236,19 @@ public class Utils {
return TimeZone.getTimeZone(TENANT_TIME_ZONE);
}
public static String performServerTemplatePost(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String postURL, final String legalFormType, final File file,
final String locale, final String dateFormat) {
public static String performServerTemplatePost(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String postURL, final String legalFormType, final File file, final String locale, final String dateFormat) {
final String importDocumentId = given().spec(requestSpec).queryParam("legalFormType", legalFormType)
.multiPart("file", file).formParam("locale", locale).formParam("dateFormat", dateFormat).expect()
.spec(responseSpec).log().ifError().when().post(postURL).andReturn().asString();
final String importDocumentId = given().spec(requestSpec).queryParam("legalFormType", legalFormType).multiPart("file", file)
.formParam("locale", locale).formParam("dateFormat", dateFormat).expect().spec(responseSpec).log().ifError().when()
.post(postURL).andReturn().asString();
return importDocumentId;
}
public static String performServerOutputTemplateLocationGet(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String getURL, final String importDocumentId) {
final String templateLocation = given().spec(requestSpec).queryParam("importDocumentId", importDocumentId)
.expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString();
final String templateLocation = given().spec(requestSpec).queryParam("importDocumentId", importDocumentId).expect()
.spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString();
return templateLocation.substring(1, templateLocation.length() - 1);
}
}
@@ -27,6 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WorkingDaysHelper {
private final static Logger LOG = LoggerFactory.getLogger(WorkingDaysHelper.class);
private static final String WORKINGDAYS_URL = "/fineract-provider/api/v1/workingdays";
@@ -69,7 +70,8 @@ public class WorkingDaysHelper {
return (int) workingDays.get("id");
}
public static HashMap<String, Object> getAllWorkingDays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
public static HashMap<String, Object> getAllWorkingDays(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
return Utils.performServerGet(requestSpec, responseSpec, WORKINGDAYS_URL + "?" + Utils.TENANT_IDENTIFIER, "");
@@ -21,6 +21,7 @@ package org.apache.fineract.integrationtests.common.accounting;
public class Account {
public enum AccountType {
ASSET("1"), INCOME("4"), EXPENSE("5"), LIABILITY("2"), EQUITY("3");
private final String accountValue;
@@ -40,22 +40,22 @@ public class AccountHelper {
public Account createAssetAccount() {
final String assetAccountJSON = new GLAccountBuilder().withAccountTypeAsAsset().build();
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL,
assetAccountJSON, this.GL_ACCOUNT_ID_RESPONSE);
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL, assetAccountJSON,
this.GL_ACCOUNT_ID_RESPONSE);
return new Account(accountID, Account.AccountType.ASSET);
}
public Account createIncomeAccount() {
final String assetAccountJSON = new GLAccountBuilder().withAccountTypeAsIncome().build();
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL,
assetAccountJSON, this.GL_ACCOUNT_ID_RESPONSE);
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL, assetAccountJSON,
this.GL_ACCOUNT_ID_RESPONSE);
return new Account(accountID, Account.AccountType.INCOME);
}
public Account createExpenseAccount() {
final String assetAccountJSON = new GLAccountBuilder().withAccountTypeAsExpense().build();
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL,
assetAccountJSON, this.GL_ACCOUNT_ID_RESPONSE);
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL, assetAccountJSON,
this.GL_ACCOUNT_ID_RESPONSE);
return new Account(accountID, Account.AccountType.EXPENSE);
}
@@ -68,7 +68,8 @@ public class AccountHelper {
public ArrayList getAccountingWithRunningBalances() {
final String GET_RUNNING_BALANCE_URL = "/fineract-provider/api/v1/glaccounts?fetchRunningBalance=true";
final ArrayList<HashMap> accountRunningBalance = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_RUNNING_BALANCE_URL, "");
final ArrayList<HashMap> accountRunningBalance = Utils.performServerGet(this.requestSpec, this.responseSpec,
GET_RUNNING_BALANCE_URL, "");
return accountRunningBalance;
}
@@ -37,18 +37,19 @@ public class FinancialActivityAccountHelper {
public Object createFinancialActivityAccount(Integer financialActivityId, Integer glAccountId,
final ResponseSpecification responseSpecification, String jsonBack) {
String json = FinancialActivityAccountsMappingBuilder.build(financialActivityId, glAccountId);
return Utils.performServerPost(this.requestSpec, responseSpecification, FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL + "?"
+ Utils.TENANT_IDENTIFIER, json, jsonBack);
return Utils.performServerPost(this.requestSpec, responseSpecification,
FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL + "?" + Utils.TENANT_IDENTIFIER, json, jsonBack);
}
public Object updateFinancialActivityAccount(Integer financialActivityAccountId, Integer financialActivityId, Integer glAccountId,
final ResponseSpecification responseSpecification, String jsonBack) {
String json = FinancialActivityAccountsMappingBuilder.build(financialActivityId, glAccountId);
return Utils.performServerPut(this.requestSpec, responseSpecification, FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL + "/"
+ financialActivityAccountId + "?" + Utils.TENANT_IDENTIFIER, json, jsonBack);
return Utils.performServerPut(this.requestSpec, responseSpecification,
FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL + "/" + financialActivityAccountId + "?" + Utils.TENANT_IDENTIFIER, json, jsonBack);
}
public HashMap getFinancialActivityAccount(final Integer financialActivityAccountId, final ResponseSpecification responseSpecification) {
public HashMap getFinancialActivityAccount(final Integer financialActivityAccountId,
final ResponseSpecification responseSpecification) {
final String url = FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL + "/" + financialActivityAccountId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpecification, url, "");
}
@@ -21,6 +21,7 @@ package org.apache.fineract.integrationtests.common.accounting;
public class JournalEntry {
public enum TransactionType {
CREDIT("CREDIT"), DEBIT("DEBIT");
private TransactionType(final String type) {
@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class ChargesHelper {
private final static Logger LOG = LoggerFactory.getLogger(ChargesHelper.class);
private static final String CHARGES_URL = "/fineract-provider/api/v1/charges";
private static final String CREATE_CHARGES_URL = CHARGES_URL + "?" + Utils.TENANT_IDENTIFIER;
@@ -168,14 +169,11 @@ public class ChargesHelper {
return getLoanDisbursementJSON(chargeCalculationType, amount, ChargesHelper.CHARGE_PAYMENT_MODE_REGULAR);
}
public static String getLoanDisbursementAccountTransferJSON(final Integer chargeCalculationType,
final String amount) {
return getLoanDisbursementJSON(chargeCalculationType, amount,
ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
public static String getLoanDisbursementAccountTransferJSON(final Integer chargeCalculationType, final String amount) {
return getLoanDisbursementJSON(chargeCalculationType, amount, ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
}
public static String getLoanDisbursementJSON(final Integer chargeCalculationType, final String amount,
final Integer paymentmode) {
public static String getLoanDisbursementJSON(final Integer chargeCalculationType, final String amount, final Integer paymentmode) {
final HashMap<String, Object> map = populateDefaultsForLoan();
map.put("chargeTimeType", CHARGE_DISBURSEMENT_FEE);
map.put("chargePaymentMode", paymentmode);
@@ -187,18 +185,15 @@ public class ChargesHelper {
}
public static String getLoanSpecifiedDueDateJSON() {
return getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.AMOUNT,
ChargesHelper.PENALTY);
return getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.AMOUNT, ChargesHelper.PENALTY);
}
public static String getLoanSpecifiedDueDateJSON(final Integer chargeCalculationType, final String amount,
boolean penalty) {
return getLoanSpecifiedDueDateJSON(chargeCalculationType, amount, penalty,
ChargesHelper.CHARGE_PAYMENT_MODE_REGULAR);
public static String getLoanSpecifiedDueDateJSON(final Integer chargeCalculationType, final String amount, boolean penalty) {
return getLoanSpecifiedDueDateJSON(chargeCalculationType, amount, penalty, ChargesHelper.CHARGE_PAYMENT_MODE_REGULAR);
}
public static String getLoanSpecifiedDueDateJSON(final Integer chargeCalculationType, final String amount,
final boolean penalty, final Integer paymentMode) {
public static String getLoanSpecifiedDueDateJSON(final Integer chargeCalculationType, final String amount, final boolean penalty,
final Integer paymentMode) {
final HashMap<String, Object> map = populateDefaultsForLoan();
map.put("chargeTimeType", CHARGE_SPECIFIED_DUE_DATE);
map.put("chargePaymentMode", paymentMode);
@@ -211,25 +206,22 @@ public class ChargesHelper {
return chargesCreateJson;
}
public static String getLoanSpecifiedDueDateWithAccountTransferJSON(final Integer chargeCalculationType,
final String amount, boolean penalty) {
return getLoanSpecifiedDueDateJSON(chargeCalculationType, amount, penalty,
ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
public static String getLoanSpecifiedDueDateWithAccountTransferJSON(final Integer chargeCalculationType, final String amount,
boolean penalty) {
return getLoanSpecifiedDueDateJSON(chargeCalculationType, amount, penalty, ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
}
public static String getLoanSpecifiedDueDateWithAccountTransferJSON() {
return getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.AMOUNT,
ChargesHelper.PENALTY, ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
return getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.AMOUNT, ChargesHelper.PENALTY,
ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
}
public static String getLoanInstallmentJSON(final Integer chargeCalculationType, final String amount,
boolean penalty) {
return getLoanInstallmentJSON(chargeCalculationType, amount, penalty,
ChargesHelper.CHARGE_PAYMENT_MODE_REGULAR);
public static String getLoanInstallmentJSON(final Integer chargeCalculationType, final String amount, boolean penalty) {
return getLoanInstallmentJSON(chargeCalculationType, amount, penalty, ChargesHelper.CHARGE_PAYMENT_MODE_REGULAR);
}
public static String getLoanInstallmentJSON(final Integer chargeCalculationType, final String amount,
final boolean penalty, final Integer paymentMode) {
public static String getLoanInstallmentJSON(final Integer chargeCalculationType, final String amount, final boolean penalty,
final Integer paymentMode) {
final HashMap<String, Object> map = populateDefaultsForLoan();
map.put("chargeTimeType", CHARGE_INSTALLMENT_FEE);
map.put("chargePaymentMode", paymentMode);
@@ -242,15 +234,13 @@ public class ChargesHelper {
return chargesCreateJson;
}
public static String getLoanInstallmentWithAccountTransferJSON(final Integer chargeCalculationType,
final String amount, boolean penalty) {
return getLoanInstallmentJSON(chargeCalculationType, amount, penalty,
ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
public static String getLoanInstallmentWithAccountTransferJSON(final Integer chargeCalculationType, final String amount,
boolean penalty) {
return getLoanInstallmentJSON(chargeCalculationType, amount, penalty, ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
}
public static String getLoanInstallmentFeeJSON() {
return getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.AMOUNT,
ChargesHelper.PENALTY);
return getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.AMOUNT, ChargesHelper.PENALTY);
}
public static String getShareAccountActivationChargeJson() {
@@ -365,40 +355,36 @@ public class ChargesHelper {
return map;
}
public static Integer createCharges(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String request) {
public static Integer createCharges(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String request) {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CHARGES_URL, request, "resourceId");
}
public static ArrayList<HashMap> getCharges(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
return (ArrayList) Utils.performServerGet(requestSpec, responseSpec,
CHARGES_URL + "?" + Utils.TENANT_IDENTIFIER, "");
public static ArrayList<HashMap> getCharges(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return (ArrayList) Utils.performServerGet(requestSpec, responseSpec, CHARGES_URL + "?" + Utils.TENANT_IDENTIFIER, "");
}
public static HashMap getChargeById(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer chargeId) {
return Utils.performServerGet(requestSpec, responseSpec,
CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER, "");
public static HashMap getChargeById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer chargeId) {
return Utils.performServerGet(requestSpec, responseSpec, CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER, "");
}
public static HashMap getChargeChanges(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer chargeId) {
return Utils.performServerGet(requestSpec, responseSpec,
CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER, CommonConstants.RESPONSE_CHANGES);
public static HashMap getChargeChanges(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer chargeId) {
return Utils.performServerGet(requestSpec, responseSpec, CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER,
CommonConstants.RESPONSE_CHANGES);
}
public static HashMap updateCharges(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer chargeId, final String request) {
return Utils.performServerPut(requestSpec, responseSpec,
CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER, request,
public static HashMap updateCharges(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer chargeId, final String request) {
return Utils.performServerPut(requestSpec, responseSpec, CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER, request,
CommonConstants.RESPONSE_CHANGES);
}
public static Integer deleteCharge(final ResponseSpecification responseSpec, final RequestSpecification requestSpec,
final Integer chargeId) {
return Utils.performServerDelete(requestSpec, responseSpec,
CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER, CommonConstants.RESPONSE_RESOURCE_ID);
return Utils.performServerDelete(requestSpec, responseSpec, CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER,
CommonConstants.RESPONSE_RESOURCE_ID);
}
public static String getModifyChargeJSON() {
@@ -496,10 +482,9 @@ public class ChargesHelper {
return chargesCreateJson;
}
public static String applyCharge(RequestSpecification requestSpec, ResponseSpecification responseSpec,
String chargeId, String json) {
return Utils.performServerPost(requestSpec, responseSpec,
CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER, json, "status");
public static String applyCharge(RequestSpecification requestSpec, ResponseSpecification responseSpec, String chargeId, String json) {
return Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER, json,
"status");
}
}
@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "unused", "rawtypes" })
public class FixedDepositAccountHelper {
private final static Logger LOG = LoggerFactory.getLogger(FixedDepositAccountHelper.class);
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
@@ -41,8 +42,7 @@ public class FixedDepositAccountHelper {
}
private static final String FIXED_DEPOSIT_ACCOUNT_URL = "/fineract-provider/api/v1/fixeddepositaccounts";
private static final String APPLY_FIXED_DEPOSIT_ACCOUNT_URL = FIXED_DEPOSIT_ACCOUNT_URL + "?"
+ Utils.TENANT_IDENTIFIER;
private static final String APPLY_FIXED_DEPOSIT_ACCOUNT_URL = FIXED_DEPOSIT_ACCOUNT_URL + "?" + Utils.TENANT_IDENTIFIER;
private static final String APPROVE_FIXED_DEPOSIT_COMMAND = "approve";
private static final String UNDO_APPROVAL_FIXED_DEPOSIT_COMMAND = "undoapproval";
private static final String REJECT_FIXED_DEPOSIT_COMMAND = "reject";
@@ -135,17 +135,16 @@ public class FixedDepositAccountHelper {
return fixedDepositAccountJson;
}
public static Integer applyFixedDepositApplication(final String fixedDepositAccountAsJson,
final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
public static Integer applyFixedDepositApplication(final String fixedDepositAccountAsJson, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
LOG.info("--------------------- APPLYING FOR FIXED DEPOSIT ACCOUNT ------------------------");
return Utils.performServerPost(requestSpec, responseSpec, APPLY_FIXED_DEPOSIT_ACCOUNT_URL,
fixedDepositAccountAsJson, CommonConstants.RESPONSE_RESOURCE_ID);
return Utils.performServerPost(requestSpec, responseSpec, APPLY_FIXED_DEPOSIT_ACCOUNT_URL, fixedDepositAccountAsJson,
CommonConstants.RESPONSE_RESOURCE_ID);
}
public static HashMap getFixedDepositAccountById(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer accountID) {
final String GET_FIXED_DEPOSIT_BY_ID_URL = FIXED_DEPOSIT_ACCOUNT_URL + "/" + accountID + "?"
+ Utils.TENANT_IDENTIFIER;
public static HashMap getFixedDepositAccountById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer accountID) {
final String GET_FIXED_DEPOSIT_BY_ID_URL = FIXED_DEPOSIT_ACCOUNT_URL + "/" + accountID + "?" + Utils.TENANT_IDENTIFIER;
LOG.info("------------------------ RETRIEVING FIXED DEPOSIT ACCOUNT BY ID -------------------------");
return Utils.performServerGet(requestSpec, responseSpec, GET_FIXED_DEPOSIT_BY_ID_URL, "");
}
@@ -179,8 +178,8 @@ public class FixedDepositAccountHelper {
return annualInterestRate;
}
public static Float getPrincipalAfterCompoundingInterest(Calendar currentDate, Float principal,
Integer depositPeriod, double interestPerDay, Integer compoundingInterval, Integer postingInterval) {
public static Float getPrincipalAfterCompoundingInterest(Calendar currentDate, Float principal, Integer depositPeriod,
double interestPerDay, Integer compoundingInterval, Integer postingInterval) {
Float totalInterest = 0.0f;
Float interestEarned = 0.0f;
@@ -209,23 +208,22 @@ public class FixedDepositAccountHelper {
return principal;
}
public HashMap updateFixedDepositAccount(final String clientID, final String productID, final String accountID,
final String validFrom, final String validTo, final String penalInterestType,
final String submittedOnDate) {
public HashMap updateFixedDepositAccount(final String clientID, final String productID, final String accountID, final String validFrom,
final String validTo, final String penalInterestType, final String submittedOnDate) {
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) //
.withSubmittedOnDate(submittedOnDate) //
.build(clientID, productID, penalInterestType);
return Utils.performServerPut(this.requestSpec, this.responseSpec,
FIXED_DEPOSIT_ACCOUNT_URL + "/" + accountID + "?" + Utils.TENANT_IDENTIFIER,
fixedDepositApplicationJSON, CommonConstants.RESPONSE_CHANGES);
FIXED_DEPOSIT_ACCOUNT_URL + "/" + accountID + "?" + Utils.TENANT_IDENTIFIER, fixedDepositApplicationJSON,
CommonConstants.RESPONSE_CHANGES);
}
public HashMap updateInterestCalculationConfigForFixedDeposit(final String clientID, final String productID,
final String accountID, final String submittedOnDate, final String validFrom, final String validTo,
final String numberOfDaysPerYear, final String penalInterestType, final String interestCalculationType,
final String interestCompoundingPeriodType, final String interestPostingPeriodType) {
public HashMap updateInterestCalculationConfigForFixedDeposit(final String clientID, final String productID, final String accountID,
final String submittedOnDate, final String validFrom, final String validTo, final String numberOfDaysPerYear,
final String penalInterestType, final String interestCalculationType, final String interestCompoundingPeriodType,
final String interestPostingPeriodType) {
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) //
.withSubmittedOnDate(submittedOnDate) //
@@ -236,63 +234,51 @@ public class FixedDepositAccountHelper {
.build(clientID, productID, penalInterestType);
return Utils.performServerPut(this.requestSpec, this.responseSpec,
FIXED_DEPOSIT_ACCOUNT_URL + "/" + accountID + "?" + Utils.TENANT_IDENTIFIER,
fixedDepositApplicationJSON, CommonConstants.RESPONSE_CHANGES);
FIXED_DEPOSIT_ACCOUNT_URL + "/" + accountID + "?" + Utils.TENANT_IDENTIFIER, fixedDepositApplicationJSON,
CommonConstants.RESPONSE_CHANGES);
}
public HashMap approveFixedDeposit(final Integer fixedDepositAccountID, final String approvedOnDate) {
LOG.info(
"--------------------------------- APPROVING FIXED DEPOSIT APPLICATION ------------------------------------");
return performFixedDepositApplicationActions(
createFixedDepositOperationURL(APPROVE_FIXED_DEPOSIT_COMMAND, fixedDepositAccountID),
LOG.info("--------------------------------- APPROVING FIXED DEPOSIT APPLICATION ------------------------------------");
return performFixedDepositApplicationActions(createFixedDepositOperationURL(APPROVE_FIXED_DEPOSIT_COMMAND, fixedDepositAccountID),
getApproveFixedDepositAccountAsJSON(approvedOnDate));
}
public HashMap undoApproval(final Integer fixedDepositAccountID) {
LOG.info(
"--------------------------------- UNDO APPROVING FIXED DEPOSIT APPLICATION -------------------------------");
LOG.info("--------------------------------- UNDO APPROVING FIXED DEPOSIT APPLICATION -------------------------------");
final String undoBodyJson = "{'note':'UNDO APPROVAL'}";
return performFixedDepositApplicationActions(
createFixedDepositOperationURL(UNDO_APPROVAL_FIXED_DEPOSIT_COMMAND, fixedDepositAccountID),
undoBodyJson);
createFixedDepositOperationURL(UNDO_APPROVAL_FIXED_DEPOSIT_COMMAND, fixedDepositAccountID), undoBodyJson);
}
public HashMap rejectApplication(final Integer fixedDepositAccountID, final String rejectedOnDate) {
LOG.info("--------------------------------- REJECT FIXED DEPOSIT APPLICATION -------------------------------");
return performFixedDepositApplicationActions(
createFixedDepositOperationURL(REJECT_FIXED_DEPOSIT_COMMAND, fixedDepositAccountID),
return performFixedDepositApplicationActions(createFixedDepositOperationURL(REJECT_FIXED_DEPOSIT_COMMAND, fixedDepositAccountID),
getRejectedFixedDepositAsJSON(rejectedOnDate));
}
public HashMap withdrawApplication(final Integer fixedDepositAccountID, final String withdrawApplicationOnDate) {
LOG.info(
"--------------------------------- Withdraw FIXED DEPOSIT APPLICATION -------------------------------");
LOG.info("--------------------------------- Withdraw FIXED DEPOSIT APPLICATION -------------------------------");
return performFixedDepositApplicationActions(
createFixedDepositOperationURL(WITHDRAWN_BY_CLIENT_FIXED_DEPOSIT_COMMAND, fixedDepositAccountID),
getWithdrawnFixedDepositAccountAsJSON(withdrawApplicationOnDate));
}
public HashMap activateFixedDeposit(final Integer fixedDepositAccountID, final String activationDate) {
LOG.info(
"---------------------------------- ACTIVATING FIXED DEPOSIT APPLICATION ----------------------------------");
return performFixedDepositApplicationActions(
createFixedDepositOperationURL(ACTIVATE_FIXED_DEPOSIT_COMMAND, fixedDepositAccountID),
LOG.info("---------------------------------- ACTIVATING FIXED DEPOSIT APPLICATION ----------------------------------");
return performFixedDepositApplicationActions(createFixedDepositOperationURL(ACTIVATE_FIXED_DEPOSIT_COMMAND, fixedDepositAccountID),
getActivatedFixedDepositAccountAsJSON(activationDate));
}
public Object deleteFixedDepositApplication(final Integer fixedDepositAccountID,
final String jsonAttributeToGetBack) {
LOG.info(
"---------------------------------- DELETE FIXED DEPOSIT APPLICATION ----------------------------------");
public Object deleteFixedDepositApplication(final Integer fixedDepositAccountID, final String jsonAttributeToGetBack) {
LOG.info("---------------------------------- DELETE FIXED DEPOSIT APPLICATION ----------------------------------");
return Utils.performServerDelete(this.requestSpec, this.responseSpec,
FIXED_DEPOSIT_ACCOUNT_URL + "/" + fixedDepositAccountID + "?" + Utils.TENANT_IDENTIFIER,
jsonAttributeToGetBack);
FIXED_DEPOSIT_ACCOUNT_URL + "/" + fixedDepositAccountID + "?" + Utils.TENANT_IDENTIFIER, jsonAttributeToGetBack);
}
public Integer calculateInterestForFixedDeposit(final Integer fixedDepositAccountId) {
LOG.info(
"--------------------------------- CALCULATING INTEREST FOR FIXED DEPOSIT --------------------------------");
LOG.info("--------------------------------- CALCULATING INTEREST FOR FIXED DEPOSIT --------------------------------");
return (Integer) performFixedDepositActions(
createFixedDepositCalculateInterestURL(CALCULATE_INTEREST_FIXED_DEPOSIT_COMMAND, fixedDepositAccountId),
getCalculatedInterestForFixedDepositApplicationAsJSON(), CommonConstants.RESPONSE_RESOURCE_ID);
@@ -305,21 +291,18 @@ public class FixedDepositAccountHelper {
getCalculatedInterestForFixedDepositApplicationAsJSON(), CommonConstants.RESPONSE_RESOURCE_ID);
}
public HashMap calculatePrematureAmountForFixedDeposit(final Integer fixedDepositAccountId,
final String closedOnDate) {
public HashMap calculatePrematureAmountForFixedDeposit(final Integer fixedDepositAccountId, final String closedOnDate) {
LOG.info("--------------------- CALCULATING PREMATURE AMOUNT FOR FIXED DEPOSIT ----------------------------");
return (HashMap) performFixedDepositActions(
createFixedDepositCalculateInterestURL(CALCULATE_PREMATURE_AMOUNT_COMMAND, fixedDepositAccountId),
getCalculatedPrematureAmountForFixedDepositAccountAsJSON(closedOnDate), "");
}
public Object prematureCloseForFixedDeposit(final Integer fixedDepositAccountId, final String closedOnDate,
final String closureType, final Integer toSavingsId, final String jsonAttributeToGetBack) {
public Object prematureCloseForFixedDeposit(final Integer fixedDepositAccountId, final String closedOnDate, final String closureType,
final Integer toSavingsId, final String jsonAttributeToGetBack) {
LOG.info("--------------------- PREMATURE CLOSE FOR FIXED DEPOSIT ----------------------------");
return performFixedDepositActions(
createFixedDepositCalculateInterestURL(PREMATURE_CLOSE_COMMAND, fixedDepositAccountId),
getPrematureCloseForFixedDepositAccountAsJSON(closedOnDate, closureType, toSavingsId),
jsonAttributeToGetBack);
return performFixedDepositActions(createFixedDepositCalculateInterestURL(PREMATURE_CLOSE_COMMAND, fixedDepositAccountId),
getPrematureCloseForFixedDepositAccountAsJSON(closedOnDate, closureType, toSavingsId), jsonAttributeToGetBack);
}
private String getApproveFixedDepositAccountAsJSON(final String approvedOnDate) {
@@ -399,21 +382,18 @@ public class FixedDepositAccountHelper {
}
private String createFixedDepositOperationURL(final String command, final Integer fixedDepositAccountID) {
return FIXED_DEPOSIT_ACCOUNT_URL + "/" + fixedDepositAccountID + "?command=" + command + "&"
+ Utils.TENANT_IDENTIFIER;
return FIXED_DEPOSIT_ACCOUNT_URL + "/" + fixedDepositAccountID + "?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
}
private Object performFixedDepositActions(final String postURLForFixedDeposit, final String jsonToBeSent,
final String jsonAttributeToGetBack) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForFixedDeposit, jsonToBeSent,
jsonAttributeToGetBack);
return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForFixedDeposit, jsonToBeSent, jsonAttributeToGetBack);
}
private HashMap performFixedDepositApplicationActions(final String postURLForFixedDepositAction,
final String jsonToBeSent) {
private HashMap performFixedDepositApplicationActions(final String postURLForFixedDepositAction, final String jsonToBeSent) {
HashMap status = null;
final HashMap response = Utils.performServerPost(this.requestSpec, this.responseSpec,
postURLForFixedDepositAction, jsonToBeSent, CommonConstants.RESPONSE_CHANGES);
final HashMap response = Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForFixedDepositAction, jsonToBeSent,
CommonConstants.RESPONSE_CHANGES);
if (response != null) {
status = (HashMap) response.get("status");
}
@@ -421,8 +401,7 @@ public class FixedDepositAccountHelper {
}
private String createFixedDepositCalculateInterestURL(final String command, final Integer fixedDepositAccountID) {
return FIXED_DEPOSIT_ACCOUNT_URL + "/" + fixedDepositAccountID + "?command=" + command + "&"
+ Utils.TENANT_IDENTIFIER;
return FIXED_DEPOSIT_ACCOUNT_URL + "/" + fixedDepositAccountID + "?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
}
public static ArrayList retrieveAllFixedDepositAccounts(final RequestSpecification requestSpec,
@@ -486,9 +465,7 @@ public class FixedDepositAccountHelper {
}
private String getDepositAmount() {
if (this.newDepositAmount == null) {
return DEPOSIT_AMOUNT;
}
if (this.newDepositAmount == null) { return DEPOSIT_AMOUNT; }
return this.newDepositAmount;
}
@@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings("rawtypes")
public class FixedDepositAccountStatusChecker {
private final static Logger LOG = LoggerFactory.getLogger(FixedDepositAccountStatusChecker.class);
private static final String FIXED_DEPOSIT_ACCOUNT_URL = "/fineract-provider/api/v1/fixeddepositaccounts";
@@ -41,8 +42,7 @@ public class FixedDepositAccountStatusChecker {
public static void verifyFixedDepositIsPending(final HashMap fixedDepositStatusHashMap) {
LOG.info("-------------------- VERIFYING FIXED DEPOSIT APPLICATION IS PENDING --------------------");
assertTrue(getStatus(fixedDepositStatusHashMap, "submittedAndPendingApproval"),
"FIXED DEPOSIT ACCOUNT IS NOT IN PENDING STATE");
assertTrue(getStatus(fixedDepositStatusHashMap, "submittedAndPendingApproval"), "FIXED DEPOSIT ACCOUNT IS NOT IN PENDING STATE");
LOG.info("{}", fixedDepositStatusHashMap.toString());
}
@@ -54,15 +54,13 @@ public class FixedDepositAccountStatusChecker {
public static void verifyFixedDepositIsRejected(final HashMap fixedDepositStatusHashMap) {
LOG.info("-------------- VERIFYING FIXED DEPOSIT APPLICATION IS REJECTED ----------------");
assertTrue(getStatus(fixedDepositStatusHashMap, "rejected"),
"ERROR IN REJECTING THE FIXED DEPOSIT APPLICATION");
assertTrue(getStatus(fixedDepositStatusHashMap, "rejected"), "ERROR IN REJECTING THE FIXED DEPOSIT APPLICATION");
LOG.info("{}", fixedDepositStatusHashMap.toString());
}
public static void verifyFixedDepositIsWithdrawn(final HashMap fixedDepositStatusHashMap) {
LOG.info("---------------- VERIFYING FIXED DEPOSIT APPLICATION IS WITHDRAWN ----------------");
assertTrue(getStatus(fixedDepositStatusHashMap, "withdrawnByApplicant"),
"ERROR IN WITHDRAW THE FIXED DEPOSIT APPLICATION");
assertTrue(getStatus(fixedDepositStatusHashMap, "withdrawnByApplicant"), "ERROR IN WITHDRAW THE FIXED DEPOSIT APPLICATION");
LOG.info("{}", fixedDepositStatusHashMap.toString());
}
@@ -78,24 +76,22 @@ public class FixedDepositAccountStatusChecker {
LOG.info("{}", fixedDepositStatusHashMap.toString());
}
public static HashMap getStatusOfFixedDepositAccount(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String fixedDepositAccountID) {
final String GET_STATUS_OF_FIXED_DEPOSIT_ACCOUNT_URL = FIXED_DEPOSIT_ACCOUNT_URL + "/" + fixedDepositAccountID
+ "?" + Utils.TENANT_IDENTIFIER;
public static HashMap getStatusOfFixedDepositAccount(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String fixedDepositAccountID) {
final String GET_STATUS_OF_FIXED_DEPOSIT_ACCOUNT_URL = FIXED_DEPOSIT_ACCOUNT_URL + "/" + fixedDepositAccountID + "?"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, GET_STATUS_OF_FIXED_DEPOSIT_ACCOUNT_URL, "status");
}
public static void verifyFixedDepositAccountIsPrematureClosed(HashMap fixedDepositStatusHashMap) {
LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS CLOSED ---------------------");
assertTrue(getStatus(fixedDepositStatusHashMap, "prematureClosed"),
"ERROR IN PREMATURELY CLOSING THE FIXED DEPOSIT ACCOUNT");
assertTrue(getStatus(fixedDepositStatusHashMap, "prematureClosed"), "ERROR IN PREMATURELY CLOSING THE FIXED DEPOSIT ACCOUNT");
LOG.info("{}", fixedDepositStatusHashMap.toString());
}
public static void verifyFixedDepositAccountIsMatured(HashMap fixedDepositStatusHashMap) {
LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS MATURED ---------------------");
assertTrue(getStatus(fixedDepositStatusHashMap, "matured"),
"ERROR IN MATURITY JOB OF THE FIXED DEPOSIT ACCOUNT");
assertTrue(getStatus(fixedDepositStatusHashMap, "matured"), "ERROR IN MATURITY JOB OF THE FIXED DEPOSIT ACCOUNT");
LOG.info("{}", fixedDepositStatusHashMap.toString());
}
@@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "unused", "rawtypes" })
public class FixedDepositProductHelper {
private final static Logger LOG = LoggerFactory.getLogger(FixedDepositProductHelper.class);
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
@@ -70,7 +71,6 @@ public class FixedDepositProductHelper {
private static final String WHOLE_TERM = "1";
private static final String TILL_PREMATURE_WITHDRAWAL = "2";
private String name = Utils.randomNameGenerator("FIXED_DEPOSIT_PRODUCT_", 6);
private String shortName = Utils.randomNameGenerator("", 4);
private String description = Utils.randomNameGenerator("", 20);
@@ -142,8 +142,6 @@ public class FixedDepositProductHelper {
map.put("taxGroupId", taxGroupId);
}
if (this.accountingRule.equals(CASH_BASED)) {
map.putAll(getAccountMappingForCashBased());
}
@@ -393,7 +391,6 @@ public class FixedDepositProductHelper {
return this;
}
private Map<String, String> getAccountMappingForCashBased() {
final Map<String, String> map = new HashMap<>();
if (accountList != null) {
@@ -428,10 +425,11 @@ public class FixedDepositProductHelper {
CommonConstants.RESPONSE_RESOURCE_ID);
}
public static ArrayList retrieveAllFixedDepositProducts(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
public static ArrayList retrieveAllFixedDepositProducts(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
LOG.info("-------------------- RETRIEVING ALL FIXED DEPOSIT PRODUCTS ---------------------");
final ArrayList response = Utils.performServerGet(requestSpec, responseSpec, FIXED_DEPOSIT_PRODUCT_URL + "?"
+ Utils.TENANT_IDENTIFIER, "");
final ArrayList response = Utils.performServerGet(requestSpec, responseSpec,
FIXED_DEPOSIT_PRODUCT_URL + "?" + Utils.TENANT_IDENTIFIER, "");
return response;
}
@@ -50,8 +50,7 @@ public class FundsHelper {
super();
}
private FundsHelper(final String name,
final String externalId) {
private FundsHelper(final String name, final String externalId) {
super();
this.name = name;
this.externalId = externalId;
@@ -83,27 +82,19 @@ public class FundsHelper {
@Override
public int hashCode() {
if (this.name != null) {
return this.name.hashCode();
}
if (this.name != null) { return this.name.hashCode(); }
return super.hashCode();
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o == this) { return true; }
if (!(o instanceof FundsHelper)) {
return false;
}
if (!(o instanceof FundsHelper)) { return false; }
FundsHelper fh = (FundsHelper) o;
if (this.name.equals(fh.name)) {
return true;
}
if (this.name.equals(fh.name)) { return true; }
return false;
}
@@ -31,33 +31,26 @@ public class FundsResourceHandler {
private static final String FUNDS_URL = "/fineract-provider/api/v1/funds";
private static final String CREATE_FUNDS_URL = FUNDS_URL + "?" + Utils.TENANT_IDENTIFIER;
public static Integer createFund(final String fundJSON,
final RequestSpecification requestSpec,
public static Integer createFund(final String fundJSON, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_FUNDS_URL, fundJSON, "resourceId");
}
public static List<FundsHelper> retrieveAllFunds(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public static List<FundsHelper> retrieveAllFunds(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String URL = FUNDS_URL + "?" + Utils.TENANT_IDENTIFIER;
List<HashMap<String, Object>> list = Utils.performServerGet(requestSpec, responseSpec, URL, "");
final String jsonData = new Gson().toJson(list);
return new Gson().fromJson(jsonData, new TypeToken<List<FundsHelper>>() {}.getType());
}
public static String retrieveFund(final Long fundID,
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public static String retrieveFund(final Long fundID, final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String URL = FUNDS_URL + "/" + fundID + "?" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "");
return new Gson().toJson(response);
}
public static FundsHelper updateFund(final Long fundID,
final String newName,
final String newExternalId,
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public static FundsHelper updateFund(final Long fundID, final String newName, final String newExternalId,
final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
FundsHelper fh = FundsHelper.create(newName).externalId(newExternalId).build();
String updateJSON = new Gson().toJson(fh);
@@ -42,7 +42,6 @@ public class LoanApplicationTestBuilder {
public static final String DEFAULT_STRATEGY = "1";
public static final String RBI_INDIA_STRATEGY = "4";
private String principal = "10,000";
private String loanTermFrequency = "";
private String loanTermFrequencyType = "";
@@ -75,7 +74,6 @@ public class LoanApplicationTestBuilder {
private List<HashMap<String, Object>> datatables = null;
private List<Map<String, Object>> approvalFormData = null;
public String build(final String clientID, final String groupID, final String loanProductId, final String savingsID) {
final HashMap<String, Object> map = new HashMap<>();
map.put("groupId", groupID);
@@ -111,8 +109,7 @@ public class LoanApplicationTestBuilder {
return build(map, loanProductId, savingsID);
}
public String build()
{
public String build() {
final HashMap<String, Object> map = new HashMap<>();
if (this.approvalFormData != null) {
@@ -314,8 +311,6 @@ public class LoanApplicationTestBuilder {
return this;
}
public LoanApplicationTestBuilder withFirstRepaymentDate(final String firstRepaymentDate) {
this.repaymentsStartingFromDate = firstRepaymentDate;
return this;
@@ -80,25 +80,29 @@ public class LoanDisbursementTestBuilder {
return this.fromDate;
}
/*public HashMap<String, String> build(String dueDate,String totalOriginalDueForPeriod,String totalOutstandingForPeriod,
String interestOutstanding, String principalOutstanding, String principalLoanBalanceOutstanding, String principalDue,
String principalOriginalDue, String fromDate) {
HashMap<String, String> expectedRepaymentSchedule = new HashMap<String, String>();
expectedRepaymentSchedule.put("dueDate", dueDate);
expectedRepaymentSchedule.put("totalOriginalDueForPeriod",
totalOriginalDueForPeriod);
expectedRepaymentSchedule.put("totalOutstandingForPeriod",
totalOutstandingForPeriod);
expectedRepaymentSchedule.put("interestOutstanding", interestOutstanding);
expectedRepaymentSchedule.put("principalOutstanding",
principalOutstanding);
expectedRepaymentSchedule.put("principalLoanBalanceOutstanding",
principalLoanBalanceOutstanding);
expectedRepaymentSchedule.put("principalDue", principalDue);
expectedRepaymentSchedule.put("principalOriginalDue",
principalOriginalDue);
expectedRepaymentSchedule.put("fromDate", fromDate);
return expectedRepaymentSchedule;
}*/
/*
* public HashMap<String, String> build(String dueDate,String
* totalOriginalDueForPeriod,String totalOutstandingForPeriod, String
* interestOutstanding, String principalOutstanding, String
* principalLoanBalanceOutstanding, String principalDue, String
* principalOriginalDue, String fromDate) { HashMap<String, String>
* expectedRepaymentSchedule = new HashMap<String, String>();
* expectedRepaymentSchedule.put("dueDate", dueDate);
* expectedRepaymentSchedule.put("totalOriginalDueForPeriod",
* totalOriginalDueForPeriod);
* expectedRepaymentSchedule.put("totalOutstandingForPeriod",
* totalOutstandingForPeriod);
* expectedRepaymentSchedule.put("interestOutstanding",
* interestOutstanding);
* expectedRepaymentSchedule.put("principalOutstanding",
* principalOutstanding);
* expectedRepaymentSchedule.put("principalLoanBalanceOutstanding",
* principalLoanBalanceOutstanding);
* expectedRepaymentSchedule.put("principalDue", principalDue);
* expectedRepaymentSchedule.put("principalOriginalDue",
* principalOriginalDue); expectedRepaymentSchedule.put("fromDate",
* fromDate);
*
* return expectedRepaymentSchedule; }
*/
}
@@ -210,8 +210,7 @@ public class LoanProductTestBuilder {
map.put("minimumGap", minimumGap);
map.put("maximumGap", maximumGap);
}
map.put("syncExpectedWithDisbursementDate",
this.syncExpectedWithDisbursementDate);
map.put("syncExpectedWithDisbursementDate", this.syncExpectedWithDisbursementDate);
return new Gson().toJson(map);
}
@@ -463,7 +462,8 @@ public class LoanProductTestBuilder {
return this;
}
public LoanProductTestBuilder withMinimumDaysBetweenDisbursalAndFirstRepayment(final String minimumDaysBetweenDisbursalAndFirstRepayment) {
public LoanProductTestBuilder withMinimumDaysBetweenDisbursalAndFirstRepayment(
final String minimumDaysBetweenDisbursalAndFirstRepayment) {
this.minimumDaysBetweenDisbursalAndFirstRepayment = minimumDaysBetweenDisbursalAndFirstRepayment;
return this;
}
@@ -493,7 +493,8 @@ public class LoanProductTestBuilder {
return this;
}
public LoanProductTestBuilder withVariableInstallmentsConfig(Boolean allowVariableInstallments, Integer minimumGap, Integer maximumGap) {
public LoanProductTestBuilder withVariableInstallmentsConfig(Boolean allowVariableInstallments, Integer minimumGap,
Integer maximumGap) {
this.allowVariableInstallments = allowVariableInstallments;
this.minimumGap = minimumGap;
this.maximumGap = maximumGap;
@@ -501,8 +502,7 @@ public class LoanProductTestBuilder {
}
public LoanProductTestBuilder withSyncExpectedWithDisbursementDate(Boolean syncExpectedWithDisbursementDate) {
this.syncExpectedWithDisbursementDate =
syncExpectedWithDisbursementDate ;
this.syncExpectedWithDisbursementDate = syncExpectedWithDisbursementDate;
return this;
}
}
@@ -49,8 +49,7 @@ public class LoanTransactionHelper {
private final ResponseSpecification responseSpec;
private final static Logger LOG = LoggerFactory.getLogger(LoanTransactionHelper.class);
private static final String CREATE_LOAN_PRODUCT_URL = "/fineract-provider/api/v1/loanproducts?"
+ Utils.TENANT_IDENTIFIER;
private static final String CREATE_LOAN_PRODUCT_URL = "/fineract-provider/api/v1/loanproducts?" + Utils.TENANT_IDENTIFIER;
private static final String APPLY_LOAN_URL = "/fineract-provider/api/v1/loans?" + Utils.TENANT_IDENTIFIER;
private static final String LOAN_ACCOUNT_URL = "/fineract-provider/api/v1/loans";
private static final String APPROVE_LOAN_COMMAND = "approve";
@@ -76,13 +75,11 @@ public class LoanTransactionHelper {
}
public Integer getLoanProductId(final String loanProductJSON) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, CREATE_LOAN_PRODUCT_URL, loanProductJSON,
"resourceId");
return Utils.performServerPost(this.requestSpec, this.responseSpec, CREATE_LOAN_PRODUCT_URL, loanProductJSON, "resourceId");
}
public Integer getLoanId(final String loanApplicationJSON) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON,
"loanId");
return Utils.performServerPost(this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON, "loanId");
}
public HashMap<String, Integer> getGlimId(final String loanApplicationJSON) {
@@ -90,15 +87,13 @@ public class LoanTransactionHelper {
}
public Object getGlimLoanId(final String glimId) {
final String GET_LOAN_URL = "/fineract-provider/api/v1/loans/glimAccount/" + glimId + "?"
+ Utils.TENANT_IDENTIFIER;
final String GET_LOAN_URL = "/fineract-provider/api/v1/loans/glimAccount/" + glimId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(this.requestSpec, this.responseSpec, GET_LOAN_URL, "childLoanId");
}
public Object getLoanError(final String loanApplicationJSON, final String responseAttribute) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON,
responseAttribute);
return Utils.performServerPost(this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON, responseAttribute);
}
public Integer getLoanOfficerId(final String loanId) {
@@ -107,8 +102,7 @@ public class LoanTransactionHelper {
}
public Object createLoanAccount(final String loanApplicationJSON, final String responseAttribute) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON,
responseAttribute);
return Utils.performServerPost(this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON, responseAttribute);
}
public Integer updateLoan(final Integer id, final String loanApplicationJSON) {
@@ -116,65 +110,58 @@ public class LoanTransactionHelper {
"/fineract-provider/api/v1/loans/" + id + "?" + Utils.TENANT_IDENTIFIER, loanApplicationJSON, "loanId");
}
public ArrayList getLoanRepaymentSchedule(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=repaymentSchedule&"
+ Utils.TENANT_IDENTIFIER;
public ArrayList getLoanRepaymentSchedule(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=repaymentSchedule&" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "repaymentSchedule");
return (ArrayList) response.get("periods");
}
public ArrayList getLoanCharges(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=charges&"
+ Utils.TENANT_IDENTIFIER;
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=charges&" + Utils.TENANT_IDENTIFIER;
return (ArrayList) Utils.performServerGet(requestSpec, responseSpec, URL, "charges");
}
public ArrayList getLoanFutureRepaymentSchedule(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID
+ "?associations=repaymentSchedule,futureSchedule&" + Utils.TENANT_IDENTIFIER;
public ArrayList getLoanFutureRepaymentSchedule(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=repaymentSchedule,futureSchedule&"
+ Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "repaymentSchedule");
return (ArrayList) response.get("futurePeriods");
}
public HashMap getLoanSummary(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
public HashMap getLoanSummary(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=all&" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "summary");
return response;
}
public Object getLoanDetail(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID, final String param) {
public Object getLoanDetail(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID,
final String param) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=all&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, param);
}
public String getLoanDetails(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
public String getLoanDetails(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "?associations=all&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, null);
}
public Object getLoanProductDetail(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanProductId, final String jsonAttributeToGetBack) {
final String URL = "/fineract-provider/api/v1/loanproducts/" + loanProductId + "?associations=all&"
+ Utils.TENANT_IDENTIFIER;
final String URL = "/fineract-provider/api/v1/loanproducts/" + loanProductId + "?associations=all&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, jsonAttributeToGetBack);
}
public String getLoanProductDetails(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer loanProductId) {
final String URL = "/fineract-provider/api/v1/loanproducts/" + loanProductId + "?associations=all&"
+ Utils.TENANT_IDENTIFIER;
public String getLoanProductDetails(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanProductId) {
final String URL = "/fineract-provider/api/v1/loanproducts/" + loanProductId + "?associations=all&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, null);
}
public ArrayList getLoanCharges(final Integer loanId) {
final String GET_LOAN_CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges?"
+ Utils.TENANT_IDENTIFIER;
final String GET_LOAN_CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, GET_LOAN_CHARGES_URL, "");
}
@@ -192,13 +179,10 @@ public class LoanTransactionHelper {
getApproveLoanAsJSON(approvalDate, expectedDisbursementDate, approvalAmount, tranches));
}
public List<HashMap<String, Object>> approveLoanForTranches(final String approvalDate,
final String expectedDisbursementDate, final String approvalAmount, final Integer loanID,
List<HashMap> tranches, final String responseAttribute) {
return (List<HashMap<String, Object>>) performLoanTransaction(
createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID),
getApproveLoanAsJSON(approvalDate, expectedDisbursementDate, approvalAmount, tranches),
responseAttribute);
public List<HashMap<String, Object>> approveLoanForTranches(final String approvalDate, final String expectedDisbursementDate,
final String approvalAmount, final Integer loanID, List<HashMap> tranches, final String responseAttribute) {
return (List<HashMap<String, Object>>) performLoanTransaction(createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID),
getApproveLoanAsJSON(approvalDate, expectedDisbursementDate, approvalAmount, tranches), responseAttribute);
}
public Object approveLoan(final String approvalDate, final String approvalAmount, final Integer loanID,
@@ -216,29 +200,25 @@ public class LoanTransactionHelper {
}
public HashMap disburseLoan(final String date, final Integer loanID) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID),
getDisburseLoanAsJSON(date, null));
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID), getDisburseLoanAsJSON(date, null));
}
public HashMap disburseLoanWithRepaymentReschedule(final String date, final Integer loanID,
String adjustRepaymentDate) {
public HashMap disburseLoanWithRepaymentReschedule(final String date, final Integer loanID, String adjustRepaymentDate) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID),
getDisburseLoanWithRepaymentRescheduleAsJSON(date, null, adjustRepaymentDate));
}
public HashMap disburseLoan(final String date, final Integer loanID, final String disburseAmt) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID),
getDisburseLoanAsJSON(date, disburseAmt));
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID), getDisburseLoanAsJSON(date, disburseAmt));
}
public Object disburseLoan(final String date, final Integer loanID, ResponseSpecification responseValidationError) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID),
getDisburseLoanAsJSON(date, null), responseValidationError);
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID), getDisburseLoanAsJSON(date, null),
responseValidationError);
}
public HashMap disburseLoanToSavings(final String date, final Integer loanID) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_TO_SAVINGS_COMMAND, loanID),
getDisburseLoanAsJSON(date, null));
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_TO_SAVINGS_COMMAND, loanID), getDisburseLoanAsJSON(date, null));
}
public HashMap undoDisbursal(final Integer loanID) {
@@ -253,8 +233,8 @@ public class LoanTransactionHelper {
final String undoLastDisburseJson = "{'note' : 'UNDO LAST DISBURSAL'}";
final String url = createLoanOperationURL(UNDO_LAST_DISBURSE_LOAN_COMMAND, loanID);
LOG.info("IN UNDO LAST DISBURSE LOAN URL : {} ", url);
return performUndoLastLoanDisbursementTransaction(
createLoanOperationURL(UNDO_LAST_DISBURSE_LOAN_COMMAND, loanID), undoLastDisburseJson);
return performUndoLastLoanDisbursementTransaction(createLoanOperationURL(UNDO_LAST_DISBURSE_LOAN_COMMAND, loanID),
undoLastDisburseJson);
}
// glimtesting
@@ -294,20 +274,16 @@ public class LoanTransactionHelper {
}
public HashMap writeOffLoan(final String date, final Integer loanID) {
return performLoanTransaction(createLoanTransactionURL(WRITE_OFF_LOAN_COMMAND, loanID),
getWriteOffBodyAsJSON(date));
return performLoanTransaction(createLoanTransactionURL(WRITE_OFF_LOAN_COMMAND, loanID), getWriteOffBodyAsJSON(date));
}
public HashMap waiveInterest(final String date, final String amountToBeWaived, final Integer loanID) {
return performLoanTransaction(createLoanTransactionURL(WAIVE_INTEREST_COMMAND, loanID),
getWaiveBodyAsJSON(date, amountToBeWaived));
return performLoanTransaction(createLoanTransactionURL(WAIVE_INTEREST_COMMAND, loanID), getWaiveBodyAsJSON(date, amountToBeWaived));
}
public Integer waiveInterestAndReturnTransactionId(final String date, final String amountToBeWaived,
final Integer loanID) {
public Integer waiveInterestAndReturnTransactionId(final String date, final String amountToBeWaived, final Integer loanID) {
Integer resourceId = Utils.performServerPost(this.requestSpec, this.responseSpec,
createLoanTransactionURL(WAIVE_INTEREST_COMMAND, loanID), getWaiveBodyAsJSON(date, amountToBeWaived),
"resourceId");
createLoanTransactionURL(WAIVE_INTEREST_COMMAND, loanID), getWaiveBodyAsJSON(date, amountToBeWaived), "resourceId");
return resourceId;
}
@@ -328,16 +304,14 @@ public class LoanTransactionHelper {
public Integer addChargesForLoan(final Integer loanId, final String request) {
LOG.info("--------------------------------- ADD CHARGES FOR LOAN --------------------------------");
final String ADD_CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges?"
+ Utils.TENANT_IDENTIFIER;
final String ADD_CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges?" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, ADD_CHARGES_URL, request, "");
return (Integer) response.get("resourceId");
}
public Object addChargesForAllreadyDisursedLoan(final Integer loanId, final String request,
final ResponseSpecification responseSpecification) {
final String ADD_CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges?"
+ Utils.TENANT_IDENTIFIER;
final String ADD_CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, responseSpecification, ADD_CHARGES_URL, request, "");
}
@@ -359,16 +333,16 @@ public class LoanTransactionHelper {
public Integer waiveChargesForLoan(final Integer loanId, final Integer loanchargeId, final String json) {
LOG.info("--------------------------------- WAIVE CHARGES FOR LOAN --------------------------------");
final String CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId
+ "?command=waive&" + Utils.TENANT_IDENTIFIER;
final String CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?command=waive&"
+ Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, "");
return (Integer) response.get("resourceId");
}
public Integer payChargesForLoan(final Integer loanId, final Integer loanchargeId, final String json) {
LOG.info("--------------------------------- WAIVE CHARGES FOR LOAN --------------------------------");
final String CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId
+ "?command=pay&" + Utils.TENANT_IDENTIFIER;
final String CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?command=pay&"
+ Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, "");
return (Integer) response.get("resourceId");
}
@@ -386,8 +360,8 @@ public class LoanTransactionHelper {
return new Gson().toJson(map);
}
private String getDisburseLoanWithRepaymentRescheduleAsJSON(final String actualDisbursementDate,
final String transactionAmount, final String adjustRepaymentDate) {
private String getDisburseLoanWithRepaymentRescheduleAsJSON(final String actualDisbursementDate, final String transactionAmount,
final String adjustRepaymentDate) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
@@ -405,8 +379,8 @@ public class LoanTransactionHelper {
return getApproveLoanAsJSON(approvalDate, null, null, null);
}
private String getApproveLoanAsJSON(final String approvalDate, final String expectedDisbursementDate,
final String approvalAmount, List<HashMap> tranches) {
private String getApproveLoanAsJSON(final String approvalDate, final String expectedDisbursementDate, final String approvalAmount,
List<HashMap> tranches) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
@@ -494,8 +468,7 @@ public class LoanTransactionHelper {
return getSpecifiedDueDateChargesForLoanAsJSON(chargeId, "12 January 2013", "100");
}
public static String getSpecifiedDueDateChargesForLoanAsJSON(final String chargeId, final String dueDate,
final String amount) {
public static String getSpecifiedDueDateChargesForLoanAsJSON(final String chargeId, final String dueDate, final String amount) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en_GB");
map.put("dateFormat", "dd MMMM yyyy");
@@ -591,53 +564,47 @@ public class LoanTransactionHelper {
}
private String createLoanTransactionURL(final String command, final Integer loanID) {
return "/fineract-provider/api/v1/loans/" + loanID + "/transactions?command=" + command + "&"
+ Utils.TENANT_IDENTIFIER;
return "/fineract-provider/api/v1/loans/" + loanID + "/transactions?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
}
private String createGlimAccountURL(final String command, final Integer glimID) {
return "/fineract-provider/api/v1/loans/glimAccount/" + glimID + "?command=" + command + "&"
+ Utils.TENANT_IDENTIFIER;
return "/fineract-provider/api/v1/loans/glimAccount/" + glimID + "?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
}
private HashMap performLoanTransaction(final String postURLForLoanTransaction, final String jsonToBeSent) {
final HashMap response = Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForLoanTransaction,
jsonToBeSent, "changes");
final HashMap response = Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForLoanTransaction, jsonToBeSent,
"changes");
return (HashMap) response.get("status");
}
private Float performUndoLastLoanDisbursementTransaction(final String postURLForLoanTransaction,
final String jsonToBeSent) {
private Float performUndoLastLoanDisbursementTransaction(final String postURLForLoanTransaction, final String jsonToBeSent) {
final HashMap response = Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForLoanTransaction,
jsonToBeSent, "changes");
final HashMap response = Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForLoanTransaction, jsonToBeSent,
"changes");
return (Float) response.get("disbursedAmount");
}
private Object performLoanTransaction(final String postURLForLoanTransaction, final String jsonToBeSent,
final String responseAttribute) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForLoanTransaction, jsonToBeSent,
responseAttribute);
return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForLoanTransaction, jsonToBeSent, responseAttribute);
}
private Object performLoanTransaction(final String postURLForLoanTransaction, final String jsonToBeSent,
ResponseSpecification responseValidationError) {
return Utils.performServerPost(this.requestSpec, responseValidationError, postURLForLoanTransaction,
jsonToBeSent, CommonConstants.RESPONSE_ERROR);
return Utils.performServerPost(this.requestSpec, responseValidationError, postURLForLoanTransaction, jsonToBeSent,
CommonConstants.RESPONSE_ERROR);
}
public Object adjustLoanTransaction(final Integer loanId, final Integer transactionId, final String date,
final String transactionAmount, final String responseAttribute) {
return adjustLoanTransaction(loanId, transactionId, getAdjustTransactionJSON(date, transactionAmount),
responseAttribute);
return adjustLoanTransaction(loanId, transactionId, getAdjustTransactionJSON(date, transactionAmount), responseAttribute);
}
private Object adjustLoanTransaction(final Integer loanId, final Integer tansactionId, final String jsonToBeSent,
final String responseAttribute) {
final String URL = "/fineract-provider/api/v1/loans/" + loanId + "/transactions/" + tansactionId + "?"
+ Utils.TENANT_IDENTIFIER;
final String URL = "/fineract-provider/api/v1/loans/" + loanId + "/transactions/" + tansactionId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, this.responseSpec, URL, jsonToBeSent, responseAttribute);
}
@@ -652,8 +619,7 @@ public class LoanTransactionHelper {
return json;
}
public HashMap getPrepayAmount(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
public HashMap getPrepayAmount(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID) {
final String URL = "/fineract-provider/api/v1/loans/" + loanID + "/transactions/template?command=prepayLoan&"
+ Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "");
@@ -664,21 +630,17 @@ public class LoanTransactionHelper {
return "/fineract-provider/api/v1/accounttransfers/refundByTransfer?tenantIdentifier=default";
}
public void verifyRepaymentScheduleEntryFor(final int repaymentNumber, final float expectedPrincipalOutstanding,
final Integer loanID) {
public void verifyRepaymentScheduleEntryFor(final int repaymentNumber, final float expectedPrincipalOutstanding, final Integer loanID) {
LOG.info("---------------------------GETTING LOAN REPAYMENT SCHEDULE--------------------------------");
final ArrayList<HashMap> repaymentPeriods = getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
loanID);
assertEquals(expectedPrincipalOutstanding,
repaymentPeriods.get(repaymentNumber).get("principalLoanBalanceOutstanding"),
final ArrayList<HashMap> repaymentPeriods = getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
assertEquals(expectedPrincipalOutstanding, repaymentPeriods.get(repaymentNumber).get("principalLoanBalanceOutstanding"),
"Mismatch in Principal Loan Balance Outstanding ");
}
public void checkAccrualTransactionForRepayment(final LocalDate transactionDate, final Float interestPortion,
final Float feePortion, final Float penaltyPortion, final Integer loanID) {
public void checkAccrualTransactionForRepayment(final LocalDate transactionDate, final Float interestPortion, final Float feePortion,
final Float penaltyPortion, final Integer loanID) {
ArrayList<HashMap> transactions = (ArrayList<HashMap>) getLoanDetail(this.requestSpec, this.responseSpec,
loanID, "transactions");
ArrayList<HashMap> transactions = (ArrayList<HashMap>) getLoanDetail(this.requestSpec, this.responseSpec, loanID, "transactions");
boolean isTransactionFound = false;
for (int i = 0; i < transactions.size(); i++) {
HashMap transactionType = (HashMap) transactions.get(i).get("type");
@@ -686,19 +648,16 @@ public class LoanTransactionHelper {
if (isAccrualTransaction) {
ArrayList<Integer> accrualEntryDateAsArray = (ArrayList<Integer>) transactions.get(i).get("date");
LocalDate accrualEntryDate = new LocalDate(accrualEntryDateAsArray.get(0),
accrualEntryDateAsArray.get(1), accrualEntryDateAsArray.get(2));
LocalDate accrualEntryDate = new LocalDate(accrualEntryDateAsArray.get(0), accrualEntryDateAsArray.get(1),
accrualEntryDateAsArray.get(2));
if (transactionDate.equals(accrualEntryDate)) {
isTransactionFound = true;
assertEquals(interestPortion,
Float.valueOf(String.valueOf(transactions.get(i).get("interestPortion"))),
assertEquals(interestPortion, Float.valueOf(String.valueOf(transactions.get(i).get("interestPortion"))),
"Mismatch in transaction amounts");
assertEquals(feePortion,
Float.valueOf(String.valueOf(transactions.get(i).get("feeChargesPortion"))),
assertEquals(feePortion, Float.valueOf(String.valueOf(transactions.get(i).get("feeChargesPortion"))),
"Mismatch in transaction amounts");
assertEquals(penaltyPortion,
Float.valueOf(String.valueOf(transactions.get(i).get("penaltyChargesPortion"))),
assertEquals(penaltyPortion, Float.valueOf(String.valueOf(transactions.get(i).get("penaltyChargesPortion"))),
"Mismatch in transaction amounts");
break;
}
@@ -713,10 +672,10 @@ public class LoanTransactionHelper {
getRefundByCashBodyAsJSON(date, amountToBeRefunded));
}
public HashMap makeRefundByTransfer(final Integer fromAccountId, final Integer toClientId,
final Integer toAccountId, final Integer fromClientId, final String date, final Float amountToBeRefunded) {
return performLoanTransaction(createLoanRefundTransferURL(), getRefundByTransferBodyAsJSON(fromAccountId,
toClientId, toAccountId, fromClientId, date, amountToBeRefunded));
public HashMap makeRefundByTransfer(final Integer fromAccountId, final Integer toClientId, final Integer toAccountId,
final Integer fromClientId, final String date, final Float amountToBeRefunded) {
return performLoanTransaction(createLoanRefundTransferURL(),
getRefundByTransferBodyAsJSON(fromAccountId, toClientId, toAccountId, fromClientId, date, amountToBeRefunded));
}
private String getRefundByCashBodyAsJSON(final String transactionDate, final Float transactionAmount) {
@@ -729,9 +688,8 @@ public class LoanTransactionHelper {
return new Gson().toJson(map);
}
private String getRefundByTransferBodyAsJSON(final Integer fromAccountId, final Integer toClientId,
final Integer toAccountId, final Integer fromClientId, final String transactionDate,
final Float transactionAmount) {
private String getRefundByTransferBodyAsJSON(final Integer fromAccountId, final Integer toClientId, final Integer toAccountId,
final Integer fromClientId, final String transactionDate, final Float transactionAmount) {
final HashMap<String, String> map = new HashMap<>();
map.put("fromAccountId", fromAccountId.toString());
map.put("fromAccountType", "1");
@@ -760,34 +718,28 @@ public class LoanTransactionHelper {
return detail;
}
public Object editDisbursementDetail(final Integer loanID, final Integer disbursementId,
final String approvalAmount, final String expectedDisbursementDate,
final String updatedExpectedDisbursementDate, final String updatedPrincipal,
public Object editDisbursementDetail(final Integer loanID, final Integer disbursementId, final String approvalAmount,
final String expectedDisbursementDate, final String updatedExpectedDisbursementDate, final String updatedPrincipal,
final String jsonAttributeToGetBack) {
return Utils.performServerPut(this.requestSpec, this.responseSpec,
createEditDisbursementURL(loanID, disbursementId), getEditDisbursementsAsJSON(approvalAmount,
expectedDisbursementDate, updatedExpectedDisbursementDate, updatedPrincipal),
return Utils.performServerPut(this.requestSpec, this.responseSpec, createEditDisbursementURL(loanID, disbursementId),
getEditDisbursementsAsJSON(approvalAmount, expectedDisbursementDate, updatedExpectedDisbursementDate, updatedPrincipal),
jsonAttributeToGetBack);
}
public Object addAndDeleteDisbursementDetail(final Integer loanID, final String approvalAmount,
final String expectedDisbursementDate, List<HashMap> disbursementData,
final String jsonAttributeToGetBack) {
public Object addAndDeleteDisbursementDetail(final Integer loanID, final String approvalAmount, final String expectedDisbursementDate,
List<HashMap> disbursementData, final String jsonAttributeToGetBack) {
return Utils.performServerPut(this.requestSpec, this.responseSpec, createAddAndDeleteDisbursementURL(loanID),
getAddAndDeleteDisbursementsAsJSON(approvalAmount, expectedDisbursementDate, disbursementData),
jsonAttributeToGetBack);
getAddAndDeleteDisbursementsAsJSON(approvalAmount, expectedDisbursementDate, disbursementData), jsonAttributeToGetBack);
}
private String createEditDisbursementURL(Integer loanID, Integer disbursementId) {
return "/fineract-provider/api/v1/loans/" + loanID + "/disbursements/" + disbursementId + "?"
+ Utils.TENANT_IDENTIFIER;
return "/fineract-provider/api/v1/loans/" + loanID + "/disbursements/" + disbursementId + "?" + Utils.TENANT_IDENTIFIER;
}
private String createAddAndDeleteDisbursementURL(Integer loanID) {
return "/fineract-provider/api/v1/loans/" + loanID + "/disbursements/editDisbursements?"
+ Utils.TENANT_IDENTIFIER;
return "/fineract-provider/api/v1/loans/" + loanID + "/disbursements/editDisbursements?" + Utils.TENANT_IDENTIFIER;
}
public static String getEditDisbursementsAsJSON(final String approvalAmount, final String expectedDisbursementDate,
@@ -804,8 +756,8 @@ public class LoanTransactionHelper {
return json;
}
public static String getAddAndDeleteDisbursementsAsJSON(final String approvalAmount,
final String expectedDisbursementDate, final List<HashMap> disbursementData) {
public static String getAddAndDeleteDisbursementsAsJSON(final String approvalAmount, final String expectedDisbursementDate,
final List<HashMap> disbursementData) {
final HashMap map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
@@ -849,14 +801,12 @@ public class LoanTransactionHelper {
String legalFormType = null;
requestSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.MULTIPART_FORM_DATA);
return Utils.performServerTemplatePost(requestSpec, responseSpec,
LOAN_ACCOUNT_URL + "/uploadtemplate" + "?" + Utils.TENANT_IDENTIFIER, legalFormType, file, locale,
dateFormat);
LOAN_ACCOUNT_URL + "/uploadtemplate" + "?" + Utils.TENANT_IDENTIFIER, legalFormType, file, locale, dateFormat);
}
public String getOutputTemplateLocation(final String importDocumentId) {
requestSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN);
return Utils.performServerOutputTemplateLocationGet(requestSpec, responseSpec,
"/fineract-provider/api/v1/imports/getOutputTemplateLocation" + "?" + Utils.TENANT_IDENTIFIER,
importDocumentId);
"/fineract-provider/api/v1/imports/getOutputTemplateLocation" + "?" + Utils.TENANT_IDENTIFIER, importDocumentId);
}
}
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
public class CampaignsHelper {
private final static Logger LOG = LoggerFactory.getLogger(CampaignsHelper.class);
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
@@ -56,54 +57,48 @@ public class CampaignsHelper {
public Integer createCampaign(String reportName, Integer triggerType) {
LOG.info("---------------------------------CREATING A CAMPAIGN---------------------------------------------");
final String CREATE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(requestSpec, responseSpec, CREATE_SMS_CAMPAIGNS_URL,
getCreateCampaignJSON(reportName, triggerType), "resourceId");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_SMS_CAMPAIGNS_URL, getCreateCampaignJSON(reportName, triggerType),
"resourceId");
}
public void verifyCampaignCreatedOnServer(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer generatedCampaignId) {
public void verifyCampaignCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedCampaignId) {
LOG.info("------------------------------CHECK CAMPAIGN DETAILS------------------------------------\n");
final String RETRIEVE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?"
+ Utils.TENANT_IDENTIFIER;
final Integer responseCampaignId = Utils.performServerGet(requestSpec, responseSpec, RETRIEVE_SMS_CAMPAIGNS_URL,
"id");
final String RETRIEVE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?" + Utils.TENANT_IDENTIFIER;
final Integer responseCampaignId = Utils.performServerGet(requestSpec, responseSpec, RETRIEVE_SMS_CAMPAIGNS_URL, "id");
assertEquals(generatedCampaignId, responseCampaignId, "ERROR IN CREATING THE CAMPAIGN");
}
public Integer updateCampaign(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedCampaignId, String reportName, Integer triggerType) {
LOG.info("------------------------------UPDATE CAMPAIGN DETAILS------------------------------------\n");
final String UPDATE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_SMS_CAMPAIGNS_URL,
getUpdateCampaignJSON(reportName, triggerType), "resourceId");
final String UPDATE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_SMS_CAMPAIGNS_URL, getUpdateCampaignJSON(reportName, triggerType),
"resourceId");
}
public Integer deleteCampaign(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedCampaignId) {
LOG.info("------------------------------DELETE CAMPAIGN DETAILS------------------------------------\n");
final String DELETE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?"
+ Utils.TENANT_IDENTIFIER;
final String DELETE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerDelete(requestSpec, responseSpec, DELETE_SMS_CAMPAIGNS_URL, "resourceId");
}
public Integer performActionsOnCampaign(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer generatedCampaignId, String command) {
LOG.info(
"------------------------------PERFORM ACTION ON CAMPAIGN DETAILS------------------------------------\n");
final String SMS_CAMPAIGNS_ACTION_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?command=" + command
+ "&" + Utils.TENANT_IDENTIFIER;
public Integer performActionsOnCampaign(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedCampaignId, String command) {
LOG.info("------------------------------PERFORM ACTION ON CAMPAIGN DETAILS------------------------------------\n");
final String SMS_CAMPAIGNS_ACTION_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?command=" + command + "&"
+ Utils.TENANT_IDENTIFIER;
String actionDate = Utils.getLocalDateOfTenant().toString(DATE_FORMAT);
return Utils.performServerPost(requestSpec, responseSpec, SMS_CAMPAIGNS_ACTION_URL,
getJSONForCampaignAction(command, actionDate), "resourceId");
return Utils.performServerPost(requestSpec, responseSpec, SMS_CAMPAIGNS_ACTION_URL, getJSONForCampaignAction(command, actionDate),
"resourceId");
}
public Object performActionsOnCampaignWithFailure(final Integer generatedCampaignId, String command,
String actionDate, String responseJsonAttribute) {
LOG.info(
"--------------------------PERFORM ACTION ON CAMPAIGN DETAILS WITH FAILURE-------------------------------\n");
final String SMS_CAMPAIGNS_ACTION_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?command=" + command
+ "&" + Utils.TENANT_IDENTIFIER;
public Object performActionsOnCampaignWithFailure(final Integer generatedCampaignId, String command, String actionDate,
String responseJsonAttribute) {
LOG.info("--------------------------PERFORM ACTION ON CAMPAIGN DETAILS WITH FAILURE-------------------------------\n");
final String SMS_CAMPAIGNS_ACTION_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?command=" + command + "&"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, this.responseSpec, SMS_CAMPAIGNS_ACTION_URL,
getJSONForCampaignAction(command, actionDate), responseJsonAttribute);
}
@@ -179,15 +174,14 @@ public class CampaignsHelper {
LOG.info("--------------------------------- GET REPORTS OPTIONS -------------------------------");
Assert.notNull(jsonAttributeToGetBack, "jsonAttributeToGetBack may not be null");
final String templateUrl = SMS_CAMPAIGNS_URL + "/template?" + Utils.TENANT_IDENTIFIER;
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when()
.get(templateUrl).andReturn().asString();
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(templateUrl).andReturn()
.asString();
Assert.notNull(json, "json");
ArrayList<ReportData> reportsList = new ArrayList<>();
String reportsString = new Gson().toJson(from(json).get(jsonAttributeToGetBack));
Assert.notNull(reportsString, "reportsString");
final Gson gson = new Gson();
final Type typeOfHashMap = new TypeToken<List<ReportData>>() {
}.getType();
final Type typeOfHashMap = new TypeToken<List<ReportData>>() {}.getType();
reportsList = gson.fromJson(reportsString, typeOfHashMap);
return reportsList;
}
@@ -197,9 +191,7 @@ public class CampaignsHelper {
if (reports != null && !reports.isEmpty()) {
for (ReportData reportData : reports) {
if (reportName.equals(reportData.getReportName())) {
return reportData.getReportId();
}
if (reportName.equals(reportData.getReportName())) { return reportData.getReportId(); }
}
}
Assert.notNull(null, "null");
@@ -27,8 +27,7 @@ public class Currency {
String nameCode;
String displayLabel;
public Currency(String code, String name, Integer decimalPlaces, String displaySymbol,
String nameCode, String displayLabel) {
public Currency(String code, String name, Integer decimalPlaces, String displaySymbol, String nameCode, String displayLabel) {
this.code = code;
this.name = name;
this.decimalPlaces = decimalPlaces;
@@ -38,11 +37,10 @@ public class Currency {
}
public boolean isValid() {
return (this.code != null && this.code.length() == 3) &&
(this.name != null && this.name.length() > 0) &&
(this.decimalPlaces != null && this.decimalPlaces >= 0) &&
(this.nameCode != null && this.nameCode.startsWith("currency.")) &&
(this.displayLabel != null && this.displayLabel.length() > 0);
return (this.code != null && this.code.length() == 3) && (this.name != null && this.name.length() > 0)
&& (this.decimalPlaces != null && this.decimalPlaces >= 0)
&& (this.nameCode != null && this.nameCode.startsWith("currency."))
&& (this.displayLabel != null && this.displayLabel.length() > 0);
}
}

Some files were not shown because too many files have changed in this diff Show More