diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index 16e6ab529..7ba0ba757 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -2014,6 +2014,22 @@
| Codes |
codes |
@@ -14452,6 +14468,337 @@ GET https://DomainName/api/v1/audits
+
+
+
+
+
+
Account number format
+
Account number preferences are used to describe custom formats for account numbers associated with Customer, Loan and Savings accounts.
+
+
+
+
+
+
+
+
+
List Account number formats
+
Example Requests:
+
accountnumberformats
+
+
+
accountnumberformats?fields=accountType,prefixType
+
+
+
+GET https://DomainName/api/v1/accountnumberformats
+
+
+[
+ {
+ "id": 2,
+ "accountType":
+ {
+ "id": 1,
+ "code": "accountType.client",
+ "value": "CLIENT"
+ },
+ "prefixType":
+ {
+ "id": 101,
+ "code": "accountNumberPrefixType.clientType",
+ "value": "CLIENT_TYPE"
+ }
+ },
+ {
+ "id": 3,
+ "accountType":
+ {
+ "id": 2,
+ "code": "accountType.loan",
+ "value": "LOAN"
+ },
+ "prefixType":
+ {
+ "id": 201,
+ "code": "accountNumberPrefixType.loanProductShortName",
+ "value": "LOAN_PRODUCT_SHORT_NAME"
+ }
+ }
+]
+
+
+
+
+
+
+
+
Retrieve Account number format Template
+
This is a convenience resource. It can be useful when
+ building maintenance user interface screens for client
+ applications. The template data returned consists of any or all
+ of:
+
+ - Field Defaults
+ - Allowed Value Lists
+
+
+
Example Request:
+
accountnumberformats/template
+
+
+
+GET https://DomainName/api/v1/accountnumberformats/template
+
+
+
+
+ {
+ "accountTypeOptions":
+ [
+ {
+ "id": 1,
+ "code": "accountType.client",
+ "value": "CLIENT"
+ },
+ {
+ "id": 2,
+ "code": "accountType.loan",
+ "value": "LOAN"
+ },
+ {
+ "id": 3,
+ "code": "accountType.savings",
+ "value": "SAVINGS"
+ }
+ ],
+ "prefixTypeOptions":
+ {
+ "accountType.loan":
+ [
+ {
+ "id": 201,
+ "code": "accountNumberPrefixType.loanProductShortName",
+ "value": "LOAN_PRODUCT_SHORT_NAME"
+ },
+ {
+ "id": 1,
+ "code": "accountNumberPrefixType.officeName",
+ "value": "OFFICE_NAME"
+ }
+ ],
+ "accountType.client":
+ [
+ {
+ "id": 1,
+ "code": "accountNumberPrefixType.officeName",
+ "value": "OFFICE_NAME"
+ },
+ {
+ "id": 101,
+ "code": "accountNumberPrefixType.clientType",
+ "value": "CLIENT_TYPE"
+ }
+ ],
+ "accountType.savings":
+ [
+ {
+ "id": 301,
+ "code": "accountNumberPrefixType.savingsProductShortName",
+ "value": "SAVINGS_PRODUCT_SHORT_NAME"
+ },
+ {
+ "id": 1,
+ "code": "accountNumberPrefixType.officeName",
+ "value": "OFFICE_NAME"
+ }
+ ]
+ }
+ }
+
+
+
+
+
+
+
+
+
+
Retrieve an Account number format
+
Example Requests:
+
accountnumberformats/1
+
+
+
accountnumberformats/1?template=true
+
+
+
accountnumberformats/1?fields=accountType,prefixType
+
+
+
+GET https://DomainName/api/v1/accountnumberformats/{accountnumberformatId}
+
+
+
+{
+ "id": 2,
+ "accountType":
+ {
+ "id": 1,
+ "code": "accountType.client",
+ "value": "CLIENT"
+ },
+ "prefixType":
+ {
+ "id": 101,
+ "code": "accountNumberPrefixType.clientType",
+ "value": "CLIENT_TYPE"
+ }
+}
+
+
+
+
+
+
+
+
+
Create an Account number format
+
+ Note: You may associate a single Account number format for a given account type
+
+
+
+ Mandatory Fields
+ for Account number formats |
+
+
+ | accountType |
+
+
+
+
+
+POST https://DomainName/api/v1/accountnumberformats
+
+
+POST /accountnumberformats
+Content-Type: application/json
+Request Body:
+{
+ accountType :1,
+ prefixType: 101
+}
+
+
+{
+ "resourceId": 4
+}
+
+
+
+POST /accountnumberformats
+Content-Type: application/json
+Request Body:
+{
+ accountType :2,
+ prefixType: 201
+}
+
+
+{
+ "resourceId": 5
+}
+
+
+
+
+
+
+
+
Update an Account number format
+
+
+
+PUT https://DomainName/api/v1/accountnumberformats/{accountnumberformatId}
+
+
+PUT accountnumberformats/2
+Content-Type: application/json
+Request Body:
+{
+ prefixType:1
+}
+
+
+{
+ "resourceId": 2,
+ "changes":
+ {
+ "prefixType": "OFFICE_NAME"
+ }
+}
+
+
+
+
+
+
+
+
+
Delete an Account number format
+
+ Note: Account numbers created while this format was active would remain unchanged.
+
+
+
+
+DELETE https://DomainName/api/v1/accountnumberformats/{accountnumberformatId}
+
+
+DELETE accountnumberformats/2
+Content-Type: application/json
+No Request Body:
+
+
+{
+ "resourceId": 2
+}
+
+
+
+
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
index 6c2f3aa4b..39a47bf19 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
@@ -5,6 +5,7 @@
*/
package org.mifosplatform.commands.domain;
+import org.mifosplatform.infrastructure.accountnumberformat.service.AccountNumberFormatConstants;
import org.mifosplatform.portfolio.loanaccount.rescheduleloan.RescheduleLoansApiConstants;
public class CommandWrapper {
@@ -245,25 +246,30 @@ public class CommandWrapper {
return this.entityName.equalsIgnoreCase("SMS");
}
- public boolean isSmsCampaignResource(){
+ public boolean isSmsCampaignResource() {
return this.entityName.equals("SMS_CAMPAIGN");
}
-
+
public boolean isLoanRescheduleResource() {
- return this.entityName.equals(RescheduleLoansApiConstants.ENTITY_NAME);
+ return this.entityName.equals(RescheduleLoansApiConstants.ENTITY_NAME);
}
-
+
+ public boolean isAccountNumberFormatResource() {
+ return this.entityName.equals(AccountNumberFormatConstants.ENTITY_NAME.toUpperCase());
+ }
+
public boolean isApprove() {
- return this.actionName.equalsIgnoreCase("APPROVE");
+ return this.actionName.equalsIgnoreCase("APPROVE");
}
-
+
public boolean isReject() {
- return this.actionName.equalsIgnoreCase("REJECT");
+ return this.actionName.equalsIgnoreCase("REJECT");
}
public boolean isSmsCampaignActivation() {
return this.actionName.equalsIgnoreCase("ACTIVATE") && this.entityName.equalsIgnoreCase("SMS_CAMPAIGN");
}
+
public boolean isSmsCampaignClosure() {
return this.actionName.equalsIgnoreCase("CLOSE") && this.entityName.equalsIgnoreCase("SMS_CAMPAIGN");
}
@@ -295,11 +301,11 @@ public class CommandWrapper {
public boolean isJournalEntryResource() {
return this.entityName.equalsIgnoreCase("JOURNALENTRY");
}
-
+
public boolean isPeriodicAccrualResource() {
return this.entityName.equalsIgnoreCase("PERIODICACCRUALACCOUNTING");
}
-
+
public boolean isExecute() {
return this.actionName.equalsIgnoreCase("EXECUTE");
}
@@ -588,15 +594,15 @@ public class CommandWrapper {
public boolean isAdjustSavingsAccountTransaction() {
return this.actionName.equalsIgnoreCase("ADJUSTTRANSACTION") && this.entityName.equalsIgnoreCase("SAVINGSACCOUNT");
}
-
- public boolean isUpdateSavingsOfficer(){
- return this.actionName.equalsIgnoreCase("UPDATESAVINGSOFFICER") && this.entityName.equalsIgnoreCase("SAVINGSACCOUNT");
+
+ public boolean isUpdateSavingsOfficer() {
+ return this.actionName.equalsIgnoreCase("UPDATESAVINGSOFFICER") && this.entityName.equalsIgnoreCase("SAVINGSACCOUNT");
}
- public boolean isRemoveSavingsOfficer(){
- return this.actionName.equalsIgnoreCase("REMOVESAVINGSOFFICER") && this.entityName.equalsIgnoreCase("SAVINGSACCOUNT");
+ public boolean isRemoveSavingsOfficer() {
+ return this.actionName.equalsIgnoreCase("REMOVESAVINGSOFFICER") && this.entityName.equalsIgnoreCase("SAVINGSACCOUNT");
}
-
+
public boolean isSavingsAccountChargeResource() {
return this.entityName.equalsIgnoreCase("SAVINGSACCOUNTCHARGE");
}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
index a9c83213b..f12c2c948 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
@@ -6,6 +6,7 @@
package org.mifosplatform.commands.service;
import org.mifosplatform.commands.domain.CommandWrapper;
+import org.mifosplatform.infrastructure.accountnumberformat.service.AccountNumberFormatConstants;
public class CommandWrapperBuilder {
@@ -833,7 +834,7 @@ public class CommandWrapperBuilder {
this.href = "/glclosures/" + glClosureId;
return this;
}
-
+
public CommandWrapperBuilder excuteAccrualAccounting() {
this.actionName = "EXECUTE";
this.entityName = "PERIODICACCRUALACCOUNTING";
@@ -1504,7 +1505,7 @@ public class CommandWrapperBuilder {
this.href = "/centers/" + centerId + "?command=close";
return this;
}
-
+
public CommandWrapperBuilder associateGroupsToCenter(final Long centerId) {
this.actionName = "ASSOCIATEGROUPS";
this.entityName = "CENTER";
@@ -2074,8 +2075,9 @@ public class CommandWrapperBuilder {
this.entityId = entityId;
return this;
}
+
public CommandWrapperBuilder assignSavingsOfficer(final Long accountId) {
- this.actionName = "UPDATESAVINGSOFFICER";
+ this.actionName = "UPDATESAVINGSOFFICER";
this.entityName = "SAVINGSACCOUNT";
this.entityId = accountId;
this.href = "/savingsaccounts/" + accountId + "?command=assignSavingsOfficer";
@@ -2097,20 +2099,44 @@ public class CommandWrapperBuilder {
this.href = "/rescheduleloans";
return this;
}
-
+
public CommandWrapperBuilder approveLoanRescheduleRequest(final String entityName, final Long requestId) {
- this.actionName = "APPROVE";
- this.entityName = entityName;
- this.entityId = requestId;
- this.href = "/rescheduleloans/" + requestId + "?command=approve";
- return this;
+ this.actionName = "APPROVE";
+ this.entityName = entityName;
+ this.entityId = requestId;
+ this.href = "/rescheduleloans/" + requestId + "?command=approve";
+ return this;
}
-
+
public CommandWrapperBuilder rejectLoanRescheduleRequest(final String entityName, final Long requestId) {
- this.actionName = "REJECT";
- this.entityName = entityName;
- this.entityId = requestId;
- this.href = "/rescheduleloans/" + requestId + "?command=reject";
- return this;
+ this.actionName = "REJECT";
+ this.entityName = entityName;
+ this.entityId = requestId;
+ this.href = "/rescheduleloans/" + requestId + "?command=reject";
+ return this;
+ }
+
+ public CommandWrapperBuilder createAccountNumberFormat() {
+ this.actionName = "CREATE";
+ this.entityName = AccountNumberFormatConstants.ENTITY_NAME.toUpperCase();
+ this.href = AccountNumberFormatConstants.resourceRelativeURL;
+ return this;
+ }
+
+ public CommandWrapperBuilder updateAccountNumberFormat(final Long accountNumberFormatId) {
+ this.actionName = "UPDATE";
+ this.entityName = AccountNumberFormatConstants.ENTITY_NAME.toUpperCase();
+ this.entityId = accountNumberFormatId;
+ this.href = AccountNumberFormatConstants.resourceRelativeURL + "/" + accountNumberFormatId;
+ return this;
+ }
+
+ public CommandWrapperBuilder deleteAccountNumberFormat(final Long accountNumberFormatId) {
+ this.actionName = "DELETE";
+ this.entityName = AccountNumberFormatConstants.ENTITY_NAME.toUpperCase();
+ this.entityId = accountNumberFormatId;
+ this.href = "AccountNumberFormatConstants.resourceRelativeURL" + "/" + accountNumberFormatId;
+ this.json = "{}";
+ return this;
}
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
index bb146845e..ec44c6471 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
@@ -43,8 +43,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
public SynchronousCommandProcessingService(final PlatformSecurityContext context, final ApplicationContext applicationContext,
final ToApiJsonSerializer