merging Mardukars work arounf standing instructions

This commit is contained in:
Vishwas Babu A J
2014-06-30 18:28:26 -07:00
6 changed files with 256 additions and 4 deletions
@@ -717,6 +717,7 @@ public class FixedDepositTest {
todaysDate.add(Calendar.DATE, daysInMonth);
System.out.println(monthDayFormat.format(todaysDate.getTime()));
currentDate = currentDate - 1;
interestPerMonth = (float) (interestPerDay * principal * currentDate);
System.out.println("IPM = " + interestPerMonth);
principal += interestPerMonth;
@@ -824,6 +825,7 @@ public class FixedDepositTest {
todaysDate.add(Calendar.DATE, daysInMonth);
System.out.println(monthDayFormat.format(todaysDate.getTime()));
currentDate = currentDate - 1;
interestPerMonth = (float) (interestPerDay * principal * currentDate);
System.out.println("IPM = " + interestPerMonth);
principal += interestPerMonth;
@@ -936,6 +938,7 @@ public class FixedDepositTest {
todaysDate.add(Calendar.DATE, daysInMonth);
System.out.println(monthDayFormat.format(todaysDate.getTime()));
currentDate = currentDate - 1;
interestPerMonth = (float) (interestPerDay * principal * currentDate);
System.out.println("IPM = " + interestPerMonth);
principal += interestPerMonth;
@@ -1051,6 +1054,7 @@ public class FixedDepositTest {
todaysDate.add(Calendar.DATE, daysInMonth);
System.out.println(monthDayFormat.format(todaysDate.getTime()));
currentDate = currentDate - 1;
interestPerMonth = (float) (interestPerDay * principal * currentDate);
System.out.println("IPM = " + interestPerMonth);
principal += interestPerMonth;
@@ -8,6 +8,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
@@ -33,6 +34,8 @@ import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsAccountHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsProductHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsStatusChecker;
import org.mifosplatform.portfolio.account.PortfolioAccountType;
import org.mifosplatform.portfolio.account.domain.AccountTransferType;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
@@ -628,6 +631,16 @@ public class SchedulerJobsTestResults {
fromSavingsBalanceAfter);
Assert.assertEquals("Verifying To Savings Balance after Successful completion of Scheduler Job", expectedToSavingsBalance,
toSavingsBalanceAfter);
Integer fromAccountType = PortfolioAccountType.SAVINGS.getValue();
Integer transferType = AccountTransferType.ACCOUNT_TRANSFER.getValue();
List<HashMap> standinInstructionHistoryData = this.standingInstructionsHelper.getStandingInstructionHistory(fromSavingsId,
fromAccountType, clientID, transferType);
Assert.assertEquals("Verifying the no of stainding instruction transactions logged for the client", 1,
standinInstructionHistoryData.size());
HashMap loggedTransaction = standinInstructionHistoryData.get(0);
Assert.assertEquals("Verifying transferred amount and logged transaction amounts", (Float) standingInstructionData.get("amount"),
(Float) loggedTransaction.get("amount"));
}
@@ -1,6 +1,7 @@
package org.mifosplatform.integrationtests.common;
import java.util.HashMap;
import java.util.List;
import org.mifosplatform.integrationtests.common.Utils;
@@ -10,7 +11,7 @@ import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings({ "unused", "rawtypes" })
@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
public class StandingInstructionsHelper {
private static final String STANDING_INSTRUCTIONS_URL = "/mifosng-provider/api/v1/standinginstructions";
@@ -95,4 +96,14 @@ public class StandingInstructionsHelper {
final HashMap response = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_STANDING_INSTRUCTION_BY_ID_URL, "");
return response;
}
public List<HashMap> getStandingInstructionHistory(Integer fromSavingsId, Integer fromAccountType, Integer fromClientId, Integer transferType) {
final String STANDING_INSTRUCTIONS_HISTORY_URL = STANDING_INSTRUCTIONS_URL + "/history?" + Utils.TENANT_IDENTIFIER
+ "&fromSavingsId=" + fromSavingsId + "&fromAccountType=" + fromAccountType + "&clientId=" + fromClientId
+ "&transferType=" + transferType;
System.out.println("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");
return response;
}
}
@@ -13,7 +13,7 @@ import org.mifosplatform.portfolio.account.AccountDetailConstants;
public class StandingInstructionApiConstants {
public static final String STANDING_INSTRUCTION_RESOURCE_NAME = "standinginstructions";
public static final String STANDING_INSTRUCTION_RESOURCE_NAME = "standinginstruction";
public static final String nameParamName = "name";
public static final String priorityParamName = "priority";
@@ -817,11 +817,11 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
sqlBuilder.append("sp.min_balance_for_interest_calculation as minBalanceForInterestCalculation, ");
sqlBuilder.append("sp.allow_overdraft as allowOverdraft, ");
sqlBuilder.append("sp.overdraft_limit as overdraftLimit, ");
sqlBuilder.append("sp.min_required_balance as minRequiredBalance, ");
sqlBuilder.append("sp.allow_overdraft_min_balance as allowOverdraftMinBalance ");
// sqlBuilder.append("sp.annual_fee_amount as annualFeeAmount,");
// sqlBuilder.append("sp.annual_fee_on_month as annualFeeOnMonth, ");
// sqlBuilder.append("sp.annual_fee_on_day as annualFeeOnDay ");
sqlBuilder.append("sp.min_required_balance as minRequiredBalance, ");
sqlBuilder.append("sp.allow_overdraft_min_balance as allowOverdraftMinBalance ");
sqlBuilder.append("from m_savings_product sp ");
sqlBuilder.append("join m_currency curr on curr.code = sp.currency_code ");