[MIFOSX-1012] JUnit Test Cases for Account Transfer
This commit is contained in:
+168
-38
@@ -19,9 +19,8 @@ import org.mifosplatform.integrationtests.common.loans.LoanApplicationTestBuilde
|
||||
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
|
||||
import org.mifosplatform.integrationtests.common.loans.LoanStatusChecker;
|
||||
import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
|
||||
import org.mifosplatform.integrationtests.common.savings.AccountTransferHelper;
|
||||
import org.mifosplatform.integrationtests.common.savings.SavingsAccountHelper;
|
||||
import org.mifosplatform.integrationtests.common.savings.SavingsAccountTransferTestBuilder;
|
||||
import org.mifosplatform.integrationtests.common.savings.SavingsAccountTransferTestBuilder;
|
||||
import org.mifosplatform.integrationtests.common.savings.SavingsProductHelper;
|
||||
import org.mifosplatform.integrationtests.common.savings.SavingsStatusChecker;
|
||||
|
||||
@@ -34,11 +33,15 @@ import com.jayway.restassured.specification.ResponseSpecification;
|
||||
/**
|
||||
* JUnit Test Cases for Account Transfer for.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unused", "static-access" })
|
||||
public class SavingsAccountTransfer {
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
public class AccountTransferTest {
|
||||
|
||||
public static final String MINIMUM_OPENING_BALANCE = "10000.0";
|
||||
public static final String MINIMUM_OPENING_BALANCE = "30000.0";
|
||||
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
||||
public static final String ACCOUNT_TRANSFER_AMOUNT = "15000.0";
|
||||
public static final String ACCOUNT_TRANSFER_AMOUNT_ADJUST = "3000.0";
|
||||
public static final String FROM_LOAN_ACCOUNT_TYPE = "1";
|
||||
public static final String FROM_SAVINGS_ACCOUNT_TYPE = "2";
|
||||
public static final String TO_LOAN_ACCOUNT_TYPE = "1";
|
||||
public static final String TO_SAVINGS_ACCOUNT_TYPE = "2";
|
||||
|
||||
@@ -48,10 +51,11 @@ public class SavingsAccountTransfer {
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private SavingsAccountHelper savingsAccountHelper;
|
||||
private SavingsAccountTransferTestBuilder savingsAccountTransferTestBuilder;
|
||||
private AccountTransferHelper accountTransferHelper;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
|
||||
Float TRANSFER_AMOUNT = new Float(savingsAccountHelper.ACCOUNT_TRANSFER_AMOUNT);
|
||||
Float TRANSFER_AMOUNT = new Float(ACCOUNT_TRANSFER_AMOUNT);
|
||||
Float TRANSFER_AMOUNT_ADJUST = new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
@@ -62,29 +66,9 @@ public class SavingsAccountTransfer {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFundTransferToSavingsAccount() {
|
||||
public void testFromSavingsToSavingsAccountTransfer() {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
// Creating Loan Account to which Fund to be Transferred.
|
||||
final Integer toClientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(toClientId);
|
||||
|
||||
final Integer toLoanProductID = createLoanProduct();
|
||||
Assert.assertNotNull(toLoanProductID);
|
||||
|
||||
final Integer toLoanID = applyForLoanApplication(toClientId, toLoanProductID);
|
||||
Assert.assertNotNull(toLoanID);
|
||||
|
||||
HashMap toLoanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, toLoanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(toLoanStatusHashMap);
|
||||
|
||||
toLoanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_APPROVAL_DATE, toLoanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(toLoanStatusHashMap);
|
||||
|
||||
toLoanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSAL_DATE, toLoanID);
|
||||
LoanStatusChecker.verifyLoanIsActive(toLoanStatusHashMap);
|
||||
this.accountTransferHelper = new AccountTransferHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
// Creating Savings Account to which fund to be Transferred
|
||||
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
@@ -133,10 +117,11 @@ public class SavingsAccountTransfer {
|
||||
Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
||||
Float toSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
||||
|
||||
this.savingsAccountHelper.toSavingsAccountTransfer(fromClientID, fromSavingsID, toClientID, toSavingsID, TO_SAVINGS_ACCOUNT_TYPE);
|
||||
this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, toClientID, toSavingsID, FROM_SAVINGS_ACCOUNT_TYPE,
|
||||
TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT);
|
||||
|
||||
fromSavingsBalance -= new Float(savingsAccountHelper.ACCOUNT_TRANSFER_AMOUNT);
|
||||
toSavingsBalance += new Float(savingsAccountHelper.ACCOUNT_TRANSFER_AMOUNT);
|
||||
fromSavingsBalance -= new Float(ACCOUNT_TRANSFER_AMOUNT);
|
||||
toSavingsBalance += new Float(ACCOUNT_TRANSFER_AMOUNT);
|
||||
|
||||
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
|
||||
@@ -145,17 +130,162 @@ public class SavingsAccountTransfer {
|
||||
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
||||
assertEquals("Verifying To Savings Account Balance after Account Transfer", toSavingsBalance,
|
||||
toSavingsSummaryAfter.get("accountBalance"));
|
||||
}
|
||||
|
||||
this.savingsAccountHelper.toSavingsAccountTransfer(fromClientID, fromSavingsID, toClientId, toLoanID, TO_LOAN_ACCOUNT_TYPE);
|
||||
@Test
|
||||
public void testFromSavingsToLoanAccountTransfer() {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||
this.accountTransferHelper = new AccountTransferHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
fromSavingsBalance -= TRANSFER_AMOUNT;
|
||||
// Creating Loan Account to which Fund to be Transferred.
|
||||
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(toClientID);
|
||||
|
||||
fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||
final Integer toLoanProductID = createLoanProduct();
|
||||
Assert.assertNotNull(toLoanProductID);
|
||||
|
||||
final Integer toLoanID = applyForLoanApplication(toClientID, toLoanProductID);
|
||||
Assert.assertNotNull(toLoanID);
|
||||
|
||||
HashMap toLoanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, toLoanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(toLoanStatusHashMap);
|
||||
|
||||
toLoanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_APPROVAL_DATE, toLoanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(toLoanStatusHashMap);
|
||||
|
||||
toLoanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSAL_DATE, toLoanID);
|
||||
LoanStatusChecker.verifyLoanIsActive(toLoanStatusHashMap);
|
||||
|
||||
// Creating Savings Account from which Fund to be Transferred
|
||||
final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(fromClientID);
|
||||
|
||||
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
|
||||
Assert.assertNotNull(fromSavingsProductID);
|
||||
|
||||
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID,
|
||||
ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assert.assertNotNull(fromSavingsID);
|
||||
|
||||
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
||||
|
||||
fromSavingsStatusHashMap = this.savingsAccountHelper.approveSavings(fromSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsApproved(fromSavingsStatusHashMap);
|
||||
|
||||
fromSavingsStatusHashMap = this.savingsAccountHelper.activateSavings(fromSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsActive(fromSavingsStatusHashMap);
|
||||
|
||||
final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||
|
||||
Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
||||
|
||||
this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, toClientID, toLoanID, FROM_SAVINGS_ACCOUNT_TYPE,
|
||||
TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||
|
||||
fromSavingsBalance -= TRANSFER_AMOUNT_ADJUST;
|
||||
|
||||
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
|
||||
fromSavingsSummaryAfter.get("accountBalance"));
|
||||
|
||||
HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, toLoanID);
|
||||
assertEquals("Verifying To Loan Repayment Amount after Account Transfer", TRANSFER_AMOUNT, toLoanSummaryAfter.get("totalRepayment"));
|
||||
assertEquals("Verifying To Loan Repayment Amount after Account Transfer", TRANSFER_AMOUNT_ADJUST, toLoanSummaryAfter.get("totalRepayment"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFromLoanToSavingsAccountTransfer() {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||
this.accountTransferHelper = new AccountTransferHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
// Creating Savings Account to which Fund to be Transferred
|
||||
final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(toClientID);
|
||||
|
||||
final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
|
||||
Assert.assertNotNull(toSavingsProductID);
|
||||
|
||||
final Integer toSavingsID = this.savingsAccountHelper.applyForSavingsApplication(toClientID, toSavingsProductID,
|
||||
ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assert.assertNotNull(toSavingsID);
|
||||
|
||||
HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsPending(toSavingsStatusHashMap);
|
||||
|
||||
toSavingsStatusHashMap = this.savingsAccountHelper.approveSavings(toSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsApproved(toSavingsStatusHashMap);
|
||||
|
||||
toSavingsStatusHashMap = this.savingsAccountHelper.activateSavings(toSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsActive(toSavingsStatusHashMap);
|
||||
|
||||
// Creating Loan Account to or from which Fund to be Transferred.
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(clientID);
|
||||
|
||||
final Integer loanProductID = createLoanProduct();
|
||||
Assert.assertNotNull(loanProductID);
|
||||
|
||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||
Assert.assertNotNull(loanID);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_APPROVAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// Creating Savings Account from which Fund to be Transferred
|
||||
final Integer fromClientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assert.assertNotNull(fromClientId);
|
||||
|
||||
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
|
||||
Assert.assertNotNull(fromSavingsProductID);
|
||||
|
||||
final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientId, fromSavingsProductID,
|
||||
ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assert.assertNotNull(fromSavingsID);
|
||||
|
||||
HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap);
|
||||
|
||||
fromSavingsStatusHashMap = this.savingsAccountHelper.approveSavings(fromSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsApproved(fromSavingsStatusHashMap);
|
||||
|
||||
fromSavingsStatusHashMap = this.savingsAccountHelper.activateSavings(fromSavingsID);
|
||||
SavingsStatusChecker.verifySavingsIsActive(fromSavingsStatusHashMap);
|
||||
|
||||
final HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
||||
|
||||
Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
||||
|
||||
this.accountTransferHelper.accountTransfer(fromClientId, fromSavingsID, clientID, loanID, FROM_SAVINGS_ACCOUNT_TYPE,
|
||||
TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT);
|
||||
|
||||
fromSavingsBalance -= TRANSFER_AMOUNT;
|
||||
|
||||
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
|
||||
|
||||
// Verifying fromSavings Account Balance after Account Transfer
|
||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
|
||||
fromSavingsSummaryAfter.get("accountBalance"));
|
||||
|
||||
Float toSavingsBalance = new Float(MINIMUM_OPENING_BALANCE);
|
||||
|
||||
this.accountTransferHelper.accountTransfer(clientID, loanID, toClientID, toSavingsID, FROM_LOAN_ACCOUNT_TYPE,
|
||||
TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||
|
||||
toSavingsBalance += TRANSFER_AMOUNT_ADJUST;
|
||||
|
||||
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
|
||||
|
||||
// Verifying toSavings Account Balance after Account Transfer
|
||||
assertEquals("Verifying From Savings Account Balance after Account Transfer", toSavingsBalance,
|
||||
toSavingsSummaryAfter.get("accountBalance"));
|
||||
}
|
||||
|
||||
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
@@ -173,7 +303,7 @@ public class SavingsAccountTransfer {
|
||||
private Integer createLoanProduct() {
|
||||
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder() //
|
||||
.withPrincipal("12,000.00") //
|
||||
.withPrincipal("8,000.00") //
|
||||
.withNumberOfRepayments("4") //
|
||||
.withRepaymentAfterEvery("1") //
|
||||
.withRepaymentTypeAsMonth() //
|
||||
@@ -188,7 +318,7 @@ public class SavingsAccountTransfer {
|
||||
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
|
||||
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||
.withPrincipal("15,000.00") //
|
||||
.withPrincipal("8,000.00") //
|
||||
.withLoanTermFrequency("4") //
|
||||
.withLoanTermFrequencyAsMonths() //
|
||||
.withNumberOfRepayments("4") //
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package org.mifosplatform.integrationtests.common.savings;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.mifosplatform.integrationtests.common.Utils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jayway.restassured.specification.RequestSpecification;
|
||||
import com.jayway.restassured.specification.ResponseSpecification;
|
||||
|
||||
public class AccountTransferHelper {
|
||||
|
||||
private static final String ACCOUNT_TRANSFER_URL = "/mifosng-provider/api/v1/accounttransfers";
|
||||
private static final String LOCALE = "en_GB";
|
||||
private static final String OFFICE_ID = "1";
|
||||
private static final String TRANSFER_DESCRIPTION = "Transfer";
|
||||
private static final String ACCOUNT_TRANSFER_DATE = "01 March 2013";
|
||||
|
||||
private String transferDate = "";
|
||||
private String officeId = OFFICE_ID;
|
||||
private String transferDescription = TRANSFER_DESCRIPTION;
|
||||
|
||||
private RequestSpecification requestSpec;
|
||||
private ResponseSpecification responseSpec;
|
||||
|
||||
public AccountTransferHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
|
||||
this.requestSpec = requestSpec;
|
||||
this.responseSpec = responseSpec;
|
||||
}
|
||||
|
||||
public String build(final String fromAccountId, final String fromClientId, final String toAccountId, final String toClientId,
|
||||
final String fromAccountType, final String toAccountType, final String transferAmount) {
|
||||
|
||||
final HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("locale", LOCALE);
|
||||
map.put("fromClientId", fromClientId);
|
||||
map.put("fromAccountId", fromAccountId);
|
||||
map.put("fromAccountType", fromAccountType);
|
||||
map.put("fromOfficeId", this.officeId);
|
||||
map.put("toClientId", toClientId);
|
||||
map.put("toAccountId", toAccountId);
|
||||
map.put("toAccountType", toAccountType);
|
||||
map.put("toOfficeId", this.officeId);
|
||||
map.put("transferDate", this.transferDate);
|
||||
map.put("transferAmount", transferAmount);
|
||||
map.put("transferDescription", this.transferDescription);
|
||||
String savingsApplicationJSON = new Gson().toJson(map);
|
||||
System.out.println(savingsApplicationJSON);
|
||||
return savingsApplicationJSON;
|
||||
}
|
||||
|
||||
public AccountTransferHelper withTransferOnDate(final String savingsAccountTransferDate) {
|
||||
this.transferDate = savingsAccountTransferDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer accountTransfer(final Integer fromClientId, final Integer fromAccountId, final Integer toClientId,
|
||||
final Integer toAccountId, final String fromAccountType, final String toAccountType, final String transferAmount) {
|
||||
System.out.println("--------------------------------ACCOUNT TRANSFER--------------------------------");
|
||||
final String accountTransferJSON = new AccountTransferHelper(this.requestSpec, this.responseSpec) //
|
||||
.withTransferOnDate(ACCOUNT_TRANSFER_DATE) //
|
||||
.build(fromAccountId.toString(), fromClientId.toString(), toAccountId.toString(), toClientId.toString(), fromAccountType,
|
||||
toAccountType, transferAmount);
|
||||
return Utils.performServerPost(this.requestSpec, this.responseSpec, ACCOUNT_TRANSFER_URL + "?" + Utils.TENANT_IDENTIFIER,
|
||||
accountTransferJSON, "savingsId");
|
||||
}
|
||||
}
|
||||
+1
-15
@@ -20,7 +20,6 @@ public class SavingsAccountHelper {
|
||||
private final ResponseSpecification responseSpec;
|
||||
|
||||
private static final String SAVINGS_ACCOUNT_URL = "/mifosng-provider/api/v1/savingsaccounts";
|
||||
private static final String ACCOUNT_TRANSFER_URL = "/mifosng-provider/api/v1/accounttransfers";
|
||||
private static final String APPROVE_SAVINGS_COMMAND = "approve";
|
||||
private static final String UNDO_APPROVAL_SAVINGS_COMMAND = "undoApproval";
|
||||
private static final String ACTIVATE_SAVINGS_COMMAND = "activate";
|
||||
@@ -40,9 +39,6 @@ public class SavingsAccountHelper {
|
||||
public static final String CREATED_DATE_MINUS_ONE = "07 January 2013";
|
||||
public static final String TRANSACTION_DATE = "10 January 2013";
|
||||
public static final String LAST_TRANSACTION_DATE = "11 January 2013";
|
||||
public static final String ACCOUNT_TRANSFER_DATE = "01 March 2013";
|
||||
|
||||
public static final String ACCOUNT_TRANSFER_AMOUNT = "3200";
|
||||
|
||||
public SavingsAccountHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
|
||||
this.requestSpec = requestSpec;
|
||||
@@ -182,16 +178,6 @@ public class SavingsAccountHelper {
|
||||
+ chargeId + "?" + Utils.TENANT_IDENTIFIER, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
}
|
||||
|
||||
public Integer toSavingsAccountTransfer(final Integer fromClientId, final Integer fromAccountId, final Integer toClientId, final Integer toAccountId, final String toAccountType) {
|
||||
System.out.println("--------------------------------ACCOUNT TRANSFER--------------------------------");
|
||||
final String savingsAccountTransferJSON = new SavingsAccountTransferTestBuilder() //
|
||||
.withTransferOnDate(ACCOUNT_TRANSFER_DATE) //
|
||||
.withTransferAmount(ACCOUNT_TRANSFER_AMOUNT) //
|
||||
.build(fromAccountId.toString(), fromClientId.toString(), toAccountId.toString(), toClientId.toString(), toAccountType);
|
||||
return Utils.performServerPost(this.requestSpec, this.responseSpec, ACCOUNT_TRANSFER_URL + "?" + Utils.TENANT_IDENTIFIER,
|
||||
savingsAccountTransferJSON, "savingsId");
|
||||
}
|
||||
|
||||
private String getApproveSavingsAsJSON() {
|
||||
final HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("locale", CommonConstants.locale);
|
||||
@@ -229,7 +215,7 @@ public class SavingsAccountHelper {
|
||||
final HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("locale", CommonConstants.locale);
|
||||
map.put("dateFormat", CommonConstants.dateFormat);
|
||||
map.put("activatedOnDate", "10 January 2013");
|
||||
map.put("activatedOnDate", "01 March 2013");
|
||||
String savingsAccountActivateJson = new Gson().toJson(map);
|
||||
System.out.println(savingsAccountActivateJson);
|
||||
return savingsAccountActivateJson;
|
||||
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
package org.mifosplatform.integrationtests.common.savings;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
public class SavingsAccountTransferTestBuilder {
|
||||
|
||||
private static final String LOCALE = "en_GB";
|
||||
private static final String OFFICE_ID = "1";
|
||||
private static final String FROM_ACCOUNT_TYPE_SAVINGS = "2";
|
||||
private static final String TRANSFER_DESCRIPTION = "Transfer";
|
||||
|
||||
private String transferDate = "";
|
||||
private String transferAmount = "";
|
||||
private String fromAccountType = FROM_ACCOUNT_TYPE_SAVINGS;
|
||||
private String officeId = OFFICE_ID;
|
||||
private String transferDescription = TRANSFER_DESCRIPTION;
|
||||
|
||||
public String build(final String fromAccountId, final String fromClientId, final String toAccountId, final String toClientId, final String toAccountType) {
|
||||
|
||||
final HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("locale", LOCALE);
|
||||
map.put("fromClientId", fromClientId);
|
||||
map.put("fromAccountId", fromAccountId);
|
||||
map.put("fromAccountType", this.fromAccountType);
|
||||
map.put("fromOfficeId", this.officeId);
|
||||
map.put("toClientId", toClientId);
|
||||
map.put("toAccountId", toAccountId);
|
||||
map.put("toAccountType", toAccountType);
|
||||
map.put("toOfficeId", this.officeId);
|
||||
map.put("transferDate", this.transferDate);
|
||||
map.put("transferAmount", this.transferAmount);
|
||||
map.put("transferDescription", this.transferDescription);
|
||||
String savingsApplicationJSON = new Gson().toJson(map);
|
||||
System.out.println(savingsApplicationJSON);
|
||||
return savingsApplicationJSON;
|
||||
}
|
||||
|
||||
public SavingsAccountTransferTestBuilder withTransferOnDate(final String savingsAccountTransferDate) {
|
||||
this.transferDate = savingsAccountTransferDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SavingsAccountTransferTestBuilder withTransferAmount(final String savingsAccountTransferAmount) {
|
||||
this.transferAmount = savingsAccountTransferAmount;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user