diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index ec69a86f9..590a876e3 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -17763,36 +17763,83 @@ Request Body:
POST savingsaccount/5?command=close
Content-Type: application/json
Request Body:
- {
- "dateFormat":"dd MMMM yyyy",
- "locale":"en",
- "closedOnDate":"26 August 2013",
- "note":"close note"
- }
+{
+ "dateFormat":"dd MMMM yyyy",
+ "locale":"en",
+ "closedOnDate":"26 August 2013",
+ "note":"close note"
+}
{
-"officeId":1,
-"clientId":1,
-"savingsId":5,
-"resourceId":5,
-"changes":{
- "status":{
- "id":600,
- "code":"savingsAccountStatusType.closed",
- "value":"Closed",
- "submittedAndPendingApproval":false,
- "approved":false,
- "rejected":false,
- "withdrawnByApplicant":false,
- "active":false,
- "closed":true
- },
- "locale":"en",
- "dateFormat":"dd MMMM yyyy",
- "closedOnDate":"26 August 2013",
- "note":"close note"
- }
+ "officeId":1,
+ "clientId":1,
+ "savingsId":5,
+ "resourceId":5,
+ "changes":{
+ "status":{
+ "id":600,
+ "code":"savingsAccountStatusType.closed",
+ "value":"Closed",
+ "submittedAndPendingApproval":false,
+ "approved":false,
+ "rejected":false,
+ "withdrawnByApplicant":false,
+ "active":false,
+ "closed":true
+ },
+ "locale":"en",
+ "dateFormat":"dd MMMM yyyy",
+ "closedOnDate":"26 August 2013",
+ "note":"close note"
+ }
+}
+
+ POST savingsaccount/5?command=close
+Content-Type: application/json
+Request Body:
+{
+ "dateFormat":"dd MMMM yyyy",
+ "locale":"en",
+ "closedOnDate":"26 August 2013",
+ "note":"close note",
+ "withdrawBalance":true,
+ "paymentTypeId": "14",
+ "accountNumber": "acc123",
+ "checkNumber": "che123",
+ "routingCode": "rou123",
+ "receiptNumber": "rec123",
+ "bankNumber": "ban123"
+}
+
+
+{
+ "officeId":1,
+ "clientId":1,
+ "savingsId":5,
+ "resourceId":5,
+ "changes":{
+ "accountNumber": "acc123",
+ "checkNumber": "che123",
+ "routingCode": "rou123",
+ "receiptNumber": "rec123",
+ "bankNumber": "ban123",
+ "status":{
+ "id":600,
+ "code":"savingsAccountStatusType.closed",
+ "value":"Closed",
+ "submittedAndPendingApproval":false,
+ "approved":false,
+ "rejected":false,
+ "withdrawnByApplicant":false,
+ "active":false,
+ "closed":true
+ },
+ "locale":"en",
+ "dateFormat":"dd MMMM yyyy",
+ "closedOnDate":"26 August 2013",
+ "note":"close note"
+ }
}
diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountTransferTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountTransferTest.java
index 1c72843fa..0b6463c4a 100644
--- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountTransferTest.java
+++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountTransferTest.java
@@ -3,6 +3,7 @@ package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
+import java.util.List;
import org.junit.After;
import org.junit.Assert;
@@ -17,6 +18,7 @@ import org.mifosplatform.integrationtests.common.accounting.AccountHelper;
import org.mifosplatform.integrationtests.common.accounting.FinancialActivityAccountHelper;
import org.mifosplatform.integrationtests.common.accounting.JournalEntry;
import org.mifosplatform.integrationtests.common.accounting.JournalEntryHelper;
+import org.mifosplatform.integrationtests.common.accounting.Account.AccountType;
import org.mifosplatform.integrationtests.common.loans.LoanApplicationTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanStatusChecker;
@@ -76,16 +78,29 @@ public class AccountTransferTest {
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.financialActivityAccountHelper = new FinancialActivityAccountHelper(this.requestSpec);
- /** Setup liability transfer account **/
- /** Create a Liability and an Asset Transfer Account **/
- liabilityTransferAccount = accountHelper.createLiabilityAccount();
- Assert.assertNotNull(liabilityTransferAccount);
+ List financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
+ if (financialActivities.isEmpty()) {
+ /** Setup liability transfer account **/
+ /** Create a Liability and an Asset Transfer Account **/
+ liabilityTransferAccount = accountHelper.createLiabilityAccount();
+ Assert.assertNotNull(liabilityTransferAccount);
- /*** Create A Financial Activity to Account Mapping **/
- financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
- FinancialActivityAccountsTest.liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(), responseSpec,
- CommonConstants.RESPONSE_RESOURCE_ID);
- Assert.assertNotNull(financialActivityAccountId);
+ /*** Create A Financial Activity to Account Mapping **/
+ financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
+ FinancialActivityAccountsTest.liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(),
+ responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
+ Assert.assertNotNull(financialActivityAccountId);
+ } else {
+ for (HashMap financialActivity : financialActivities) {
+ HashMap financialActivityData = (HashMap) financialActivity.get("financialActivityData");
+ if (financialActivityData.get("id").equals(FinancialActivityAccountsTest.liabilityTransferFinancialActivityId)) {
+ HashMap glAccountData = (HashMap) financialActivity.get("glAccountData");
+ liabilityTransferAccount = new Account((Integer) glAccountData.get("id"), AccountType.LIABILITY);
+ financialActivityAccountId = (Integer) financialActivity.get("id");
+ break;
+ }
+ }
+ }
}
/**
diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/FinancialActivityAccountsTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/FinancialActivityAccountsTest.java
index e89d248da..5d55397a0 100755
--- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/FinancialActivityAccountsTest.java
+++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/FinancialActivityAccountsTest.java
@@ -7,6 +7,7 @@ import java.util.List;
import junit.framework.Assert;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
@@ -127,4 +128,19 @@ public class FinancialActivityAccountsTest {
Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
}
+
+ /**
+ * Delete the Financial activities
+ */
+ @After
+ public void tearDown() {
+ List 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);
+ Assert.assertNotNull(deletedFinancialActivityAccountId);
+ Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
+ }
+ }
}
diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/FixedDepositTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/FixedDepositTest.java
index 9b761da46..f3fa02b77 100644
--- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/FixedDepositTest.java
+++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/FixedDepositTest.java
@@ -15,6 +15,7 @@ import java.util.List;
import org.joda.time.DateTime;
import org.joda.time.Days;
import org.joda.time.Months;
+import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -88,6 +89,7 @@ public class FixedDepositTest {
this.requestSpec.header("X-Mifos-Platform-TenantId", "default");
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
+ this.financialActivityAccountHelper = new FinancialActivityAccountHelper(this.requestSpec);
}
/***
@@ -240,7 +242,6 @@ public class FixedDepositTest {
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.fixedDepositAccountHelper = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec);
- this.financialActivityAccountHelper = new FinancialActivityAccountHelper(this.requestSpec);
/***
* Create GL Accounts for product account mapping
@@ -2040,4 +2041,19 @@ public class FixedDepositTest {
Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
}
+
+ /**
+ * Delete the Liability transfer account
+ */
+ @After
+ public void tearDown() {
+ List 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);
+ Assert.assertNotNull(deletedFinancialActivityAccountId);
+ Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
+ }
+ }
}
\ No newline at end of file
diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/RecurringDepositTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/RecurringDepositTest.java
index b8799b7ed..37694237b 100644
--- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/RecurringDepositTest.java
+++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/RecurringDepositTest.java
@@ -14,6 +14,7 @@ import net.sf.ehcache.transaction.xa.EhcacheXAException;
import org.joda.time.DateTime;
import org.joda.time.Months;
+import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -90,6 +91,7 @@ public class RecurringDepositTest {
this.requestSpec.header("X-Mifos-Platform-TenantId", "default");
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
+ this.financialActivityAccountHelper = new FinancialActivityAccountHelper(this.requestSpec);
}
/***
@@ -253,7 +255,6 @@ public class RecurringDepositTest {
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.recurringDepositAccountHelper = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec);
- this.financialActivityAccountHelper = new FinancialActivityAccountHelper(this.requestSpec);
/***
* Create GL Accounts for product account mapping
@@ -2568,4 +2569,19 @@ public class RecurringDepositTest {
Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
}
+
+ /**
+ * Delete the Liability transfer account
+ */
+ @After
+ public void tearDown() {
+ List 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);
+ Assert.assertNotNull(deletedFinancialActivityAccountId);
+ Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
+ }
+ }
}
\ No newline at end of file