diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index 74252fa5b..9bf849ba1 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -316,6 +316,14 @@ Update Standing Instruction Delete Standing Instruction(status change) + + + standinginstructions/history + + Standinginstructions History + + + Account Transfer accounttransfers @@ -24532,6 +24540,214 @@ No Request Body: + +   +
+
+

Standing Instructions Logged History:

+

The list capability of history can support pagination and sorting.

+
Optional Arguments
+
+
offset
+
+ Integer optional, defaults to 0 +
+
Indicates from what result to start from.
+ +
limit
+
+ Integer optional, defaults to 200 +
+
Restricts the size of results returned. To override the default and return all entries you must explicitly pass a non-positive integer value for limit e.g. limit=0, or limit=-1
+ +
orderBy
+
+ String optional, one of name,standingInstructionId +
+
Orders the results by the field indicated.
+ +
sortBy
+
+ String optional, one of ASC, DESC +
+
Indicates what way to order results if orderBy is used.
+ +
clientId
+
+ Integer optional +
+
Use clientId of clients to restrict results.
+ +
clientName
+
+ String optional +
+
Use displayName of clients to restrict results.
+ +
fromAccountId
+
+ Integer optional +
+
Use fromAccountId of standing instruction transaction to restrict results. fromAccountId is id of fromAccountType.
+ +
fromAccountType
+
+ Integer optional +
+
Use fromAccountType of standing instruction transaction to restrict results. fromAccountType is enum value entity type Ex:Loan Account:1, Savings Account:2
+ +
transferType
+
+ Integer optional +
+
Use transferType of standing instruction transaction to restrict results. transferType is enum value transfer type Ex:Loan Repayment:2, Account Transfer:1
+ +
fromDate
+
+ Dateoptional +
+
Filters for transactions whose entry Date is greater than or equal to the passed in Date +
+
toDate
+
+ Date optional +
+
Filters for transactions whose entry Date is lesser than or equal to the passed in Date +
+ +
sqlSearch
+
+ String optional +
+
Use an sql fragment valid for the underlying standing instruction schema to filter results. e.g. name like %K%
+
+

Example Requests :

+
standinginstructions/history
+
+
standinginstructions/history?orderBy=name&sortOrder=DESC
+
+
standinginstructions/history?offset=10&limit=50
+
+
+
+ GET https://DomainName/api/v1/standinginstructions/history + +{ + "totalFilteredRecords": 2, + "pageItems": [ + { + "standingInstructionId": 1, + "name": "ACC Transfer", + "fromOffice": { + "id": 1, + "name": "Head Office" + }, + "fromClient": { + "id": 1, + "displayName": "Test client", + "officeId": 1, + "officeName": "Head Office" + }, + "fromAccountType": { + "id": 2, + "code": "accountType.savings", + "value": "Savings Account" + }, + "fromAccount": { + "id": 2, + "accountNo": "000000002", + "productId": 1, + "productName": "General Savings" + }, + "toAccountType": { + "id": 2, + "code": "accountType.savings", + "value": "Savings Account" + }, + "toAccount": { + "id": 1, + "accountNo": "000000001", + "productId": 1, + "productName": "General Savings" + }, + "toOffice": { + "id": 1, + "name": "Head Office" + }, + "toClient": { + "id": 1, + "displayName": "Test client", + "officeId": 1, + "officeName": "Head Office" + }, + "amount": 10, + "status": "success", + "executionTime": [ + 2014, + 6, + 30 + ], + "errorLog": "" + }, + { + "standingInstructionId": 2, + "name": "Pay overdues", + "fromOffice": { + "id": 1, + "name": "Head Office" + }, + "fromClient": { + "id": 1, + "displayName": "Test client", + "officeId": 1, + "officeName": "Head Office" + }, + "fromAccountType": { + "id": 2, + "code": "accountType.savings", + "value": "Savings Account" + }, + "fromAccount": { + "id": 1, + "accountNo": "000000001", + "productId": 1, + "productName": "General Savings" + }, + "toAccountType": { + "id": 1, + "code": "accountType.loan", + "value": "Loan Account" + }, + "toAccount": { + "id": 1, + "accountNo": "000000001", + "productId": 1, + "productName": "Daily Loan" + }, + "toOffice": { + "id": 1, + "name": "Head Office" + }, + "toClient": { + "id": 1, + "displayName": "Test client", + "officeId": 1, + "officeName": "Head Office" + }, + "amount": 7038.01, + "status": "success", + "executionTime": [ + 2014, + 6, + 30 + ], + "errorLog": "" + } + ] +} + +
+
@@ -30638,6 +30854,14 @@ No Request Body: Update Standing Instruction Delete Standing Instruction(status change) + + + standinginstructions/history + + Standinginstructions History + + + standinginstructions/template 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 a3cedd5c1..ba86d13e8 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/FixedDepositTest.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/FixedDepositTest.java @@ -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; diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/SchedulerJobsTestResults.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/SchedulerJobsTestResults.java index 73c811c26..209d5e8a7 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/SchedulerJobsTestResults.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/SchedulerJobsTestResults.java @@ -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 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")); } diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/StandingInstructionsHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/StandingInstructionsHelper.java index abeed868f..689f38a62 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/StandingInstructionsHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/StandingInstructionsHelper.java @@ -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 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 response = (List) Utils.performServerGet(this.requestSpec, this.responseSpec, + STANDING_INSTRUCTIONS_HISTORY_URL, "pageItems"); + return response; + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/StandingInstructionApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/StandingInstructionApiConstants.java index f363958df..1c1972508 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/StandingInstructionApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/StandingInstructionApiConstants.java @@ -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"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java index 6b81b59a1..df0bc60d6 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java @@ -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 ");