Document the Deposit API
diff --git a/service/build.gradle b/service/build.gradle
index f8d4e6a..96cf411 100644
--- a/service/build.gradle
+++ b/service/build.gradle
@@ -26,6 +26,7 @@
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
+ classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.3")
}
}
@@ -36,6 +37,7 @@
apply from: '../shared.gradle'
+apply plugin: 'org.asciidoctor.convert'
apply plugin: 'spring-boot'
springBoot {
@@ -62,6 +64,23 @@
[group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator],
[group: 'org.threeten', name: 'threeten-extra', version: '1.2']
)
+ testCompile(
+ [group: 'org.apache.fineract.cn.deposit-account-management', name: 'api', version: project.version],
+ [group: 'org.apache.fineract.cn', name: 'api', version: versions.frameworkapi],
+ [group: 'org.apache.fineract.cn', name: 'test', version: versions.frameworktest],
+ [group: 'org.apache.fineract.cn.anubis', name: 'test', version: versions.frameworkanubis],
+ [group: 'org.springframework.restdocs', name: 'spring-restdocs-mockmvc'],
+ [group: 'org.springframework.boot', name: 'spring-boot-starter-test'],
+ [group: 'junit', name: 'junit', version: '4.12']
+ )
+}
+
+asciidoctor {
+ sourceDir 'src/doc/asciidoc/'
+ outputDir 'src/doc/html5'
+ options backend: "html", doctype: "book"
+ attributes "source-highlighter": "highlightjs", \
+ 'snippets': file('src/doc/generated-snippets/')
}
publishToMavenLocal.dependsOn bootRepackage
diff --git a/service/src/doc/asciidoc/api-docs.adoc b/service/src/doc/asciidoc/api-docs.adoc
new file mode 100644
index 0000000..175be71
--- /dev/null
+++ b/service/src/doc/asciidoc/api-docs.adoc
@@ -0,0 +1,203 @@
+== Apache Fineract CN Deposit Account Management API Documentation ==
+
+== Actions ==
+
+==== Create An Action ====
+
+.curl-request
+include::{snippets}/test-actions/should-create-action/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-actions/should-create-action/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-actions/should-create-action/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-actions/should-create-action/httpie-request.adoc[]
+
+==== Get Default Actions ====
+
+.curl-request
+include::{snippets}/test-actions/should-fetch-default-actions/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-actions/should-fetch-default-actions/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-actions/should-fetch-default-actions/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-actions/should-fetch-default-actions/httpie-request.adoc[]
+
+== Product Definitions ==
+
+==== Define A Product ====
+
+.curl-request
+include::{snippets}/test-definitions/should-create-product-definition/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-definitions/should-create-product-definition/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-definitions/should-create-product-definition/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-definitions/should-create-product-definition/httpie-request.adoc[]
+
+==== Find A Product ====
+
+.curl-request
+include::{snippets}/test-definitions/should-find-product-definition/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-definitions/should-find-product-definition/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-definitions/should-find-product-definition/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-definitions/should-find-product-definition/httpie-request.adoc[]
+
+==== Update A Product ====
+
+.curl-request
+include::{snippets}/test-definitions/should-update-product-definition/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-definitions/should-update-product-definition/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-definitions/should-update-product-definition/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-definitions/should-update-product-definition/httpie-request.adoc[]
+
+==== Activate A Product ====
+
+.curl-request
+include::{snippets}/test-definitions/should-activate-product-definition/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-definitions/should-activate-product-definition/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-definitions/should-activate-product-definition/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-definitions/should-activate-product-definition/httpie-request.adoc[]
+
+==== Deactivate A Product ====
+
+.curl-request
+include::{snippets}/test-definitions/should-deactivate-product-definition/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-definitions/should-deactivate-product-definition/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-definitions/should-deactivate-product-definition/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-definitions/should-deactivate-product-definition/httpie-request.adoc[]
+
+==== Delete A Product ====
+
+.curl-request
+include::{snippets}/test-definitions/should-delete-product-definition/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-definitions/should-delete-product-definition/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-definitions/should-delete-product-definition/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-definitions/should-delete-product-definition/httpie-request.adoc[]
+
+== Product Instances ==
+
+==== Create Product Instance ====
+
+.curl-request
+include::{snippets}/test-instances/should-create-product-instance/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-instances/should-create-product-instance/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-instances/should-create-product-instance/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-instances/should-create-product-instance/httpie-request.adoc[]
+
+==== Find A Product Instance ====
+
+.curl-request
+include::{snippets}/test-instances/should-find-product-instance/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-instances/should-find-product-instance/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-instances/should-find-product-instance/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-instances/should-find-product-instance/httpie-request.adoc[]
+
+==== Update A Product Instance ====
+
+.curl-request
+include::{snippets}/test-instances/should-update-product-instance/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-instances/should-update-product-instance/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-instances/should-update-product-instance/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-instances/should-update-product-instance/httpie-request.adoc[]
+
+==== Activate A Product Instance ====
+
+.curl-request
+include::{snippets}/test-instances/should-activate-product-instance/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-instances/should-activate-product-instance/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-instances/should-activate-product-instance/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-instances/should-activate-product-instance/httpie-request.adoc[]
+
+==== Close A Product Instance ====
+
+.curl-request
+include::{snippets}/test-instances/should-close-product-instance/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-instances/should-close-product-instance/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-instances/should-close-product-instance/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-instances/should-close-product-instance/httpie-request.adoc[]
+
+==== Get Available Transaction Types ====
+
+.curl-request
+include::{snippets}/test-instances/should-find-available-transaction-types/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-instances/should-find-available-transaction-types/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-instances/should-find-available-transaction-types/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-instances/should-find-available-transaction-types/httpie-request.adoc[]
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-actions/should-create-action/curl-request.adoc b/service/src/doc/generated-snippets/test-actions/should-create-action/curl-request.adoc
new file mode 100644
index 0000000..53c1632
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-actions/should-create-action/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/actions' -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'oMeOsoRMayyE4j2XNJrQmUssSKD2UOv0'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-actions/should-create-action/http-request.adoc b/service/src/doc/generated-snippets/test-actions/should-create-action/http-request.adoc
new file mode 100644
index 0000000..8804703
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-actions/should-create-action/http-request.adoc
@@ -0,0 +1,10 @@
+[source,http,options="nowrap"]
+----
+POST /deposit/v1/actions HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 32
+
+oMeOsoRMayyE4j2XNJrQmUssSKD2UOv0
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-actions/should-create-action/http-response.adoc b/service/src/doc/generated-snippets/test-actions/should-create-action/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-actions/should-create-action/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-actions/should-create-action/httpie-request.adoc b/service/src/doc/generated-snippets/test-actions/should-create-action/httpie-request.adoc
new file mode 100644
index 0000000..9875918
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-actions/should-create-action/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo 'oMeOsoRMayyE4j2XNJrQmUssSKD2UOv0' | http POST 'http://localhost:8080/deposit/v1/actions' 'Accept:application/json' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/curl-request.adoc b/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/curl-request.adoc
new file mode 100644
index 0000000..d8bb840
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/actions' -i -H 'Accept: */*' -H 'Content-Type: application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/http-request.adoc b/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/http-request.adoc
new file mode 100644
index 0000000..69f4b9e
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/http-request.adoc
@@ -0,0 +1,8 @@
+[source,http,options="nowrap"]
+----
+GET /deposit/v1/actions HTTP/1.1
+Accept: */*
+Content-Type: application/json
+Host: localhost:8080
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/http-response.adoc b/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/httpie-request.adoc b/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/httpie-request.adoc
new file mode 100644
index 0000000..36a2900
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-actions/should-fetch-default-actions/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ http GET 'http://localhost:8080/deposit/v1/actions' 'Accept:*/*' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/curl-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/curl-request.adoc
new file mode 100644
index 0000000..c896590
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/definitions/J55UjH3A' -i -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'J55UjH3A'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/http-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/http-request.adoc
new file mode 100644
index 0000000..4760573
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/http-request.adoc
@@ -0,0 +1,10 @@
+[source,http,options="nowrap"]
+----
+PUT /deposit/v1/definitions/J55UjH3A HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+J55UjH3A
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/http-response.adoc b/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/httpie-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/httpie-request.adoc
new file mode 100644
index 0000000..d9cfaca
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-activate-product-definition/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo 'J55UjH3A' | http PUT 'http://localhost:8080/deposit/v1/definitions/J55UjH3A' 'Accept:application/json' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/curl-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/curl-request.adoc
new file mode 100644
index 0000000..fcaa00c
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/definitions' -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'ZmLKEouR'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/http-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/http-request.adoc
new file mode 100644
index 0000000..6ce466e
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/http-request.adoc
@@ -0,0 +1,10 @@
+[source,http,options="nowrap"]
+----
+POST /deposit/v1/definitions HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+ZmLKEouR
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/http-response.adoc b/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/httpie-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/httpie-request.adoc
new file mode 100644
index 0000000..683b2a5
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-create-product-definition/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo 'ZmLKEouR' | http POST 'http://localhost:8080/deposit/v1/definitions' 'Accept:application/json' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/curl-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/curl-request.adoc
new file mode 100644
index 0000000..711a73f
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/definitions/G5ZwGoZN' -i -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'G5ZwGoZN'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/http-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/http-request.adoc
new file mode 100644
index 0000000..52e607f
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/http-request.adoc
@@ -0,0 +1,10 @@
+[source,http,options="nowrap"]
+----
+PUT /deposit/v1/definitions/G5ZwGoZN HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+G5ZwGoZN
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/http-response.adoc b/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/httpie-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/httpie-request.adoc
new file mode 100644
index 0000000..0a8bff6
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-deactivate-product-definition/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo 'G5ZwGoZN' | http PUT 'http://localhost:8080/deposit/v1/definitions/G5ZwGoZN' 'Accept:application/json' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/curl-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/curl-request.adoc
new file mode 100644
index 0000000..8b6e84e
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/definitions/KMdOIEEJ' -i -X DELETE -H 'Accept: */*' -H 'Content-Type: application/json' -d 'application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/http-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/http-request.adoc
new file mode 100644
index 0000000..1191a2d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/http-request.adoc
@@ -0,0 +1,10 @@
+[source,http,options="nowrap"]
+----
+DELETE /deposit/v1/definitions/KMdOIEEJ HTTP/1.1
+Accept: */*
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 16
+
+application/json
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/http-response.adoc b/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/httpie-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/httpie-request.adoc
new file mode 100644
index 0000000..8ddb147
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-delete-product-definition/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo 'application/json' | http DELETE 'http://localhost:8080/deposit/v1/definitions/KMdOIEEJ' 'Accept:*/*' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/curl-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/curl-request.adoc
new file mode 100644
index 0000000..9cd1d1a
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/definitions/IUM2xv8N' -i -H 'Accept: */*' -H 'Content-Type: application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/http-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/http-request.adoc
new file mode 100644
index 0000000..c6b5850
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/http-request.adoc
@@ -0,0 +1,8 @@
+[source,http,options="nowrap"]
+----
+GET /deposit/v1/definitions/IUM2xv8N HTTP/1.1
+Accept: */*
+Content-Type: application/json
+Host: localhost:8080
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/http-response.adoc b/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/httpie-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/httpie-request.adoc
new file mode 100644
index 0000000..559b941
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-find-product-definition/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ http GET 'http://localhost:8080/deposit/v1/definitions/IUM2xv8N' 'Accept:*/*' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/curl-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/curl-request.adoc
new file mode 100644
index 0000000..635cb30
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/definitions/tBSiWosu' -i -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'tBSiWosu'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/http-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/http-request.adoc
new file mode 100644
index 0000000..d578b3a
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/http-request.adoc
@@ -0,0 +1,10 @@
+[source,http,options="nowrap"]
+----
+PUT /deposit/v1/definitions/tBSiWosu HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+tBSiWosu
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/http-response.adoc b/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/httpie-request.adoc b/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/httpie-request.adoc
new file mode 100644
index 0000000..95b222c
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-definitions/should-update-product-definition/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo 'tBSiWosu' | http PUT 'http://localhost:8080/deposit/v1/definitions/tBSiWosu' 'Accept:application/json' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/curl-request.adoc b/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/curl-request.adoc
new file mode 100644
index 0000000..c5c35d8
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/instances/wG6RlU6X' -i -X PUT -H 'Content-Type: application/json' -d 'wG6RlU6X'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/http-request.adoc b/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/http-request.adoc
new file mode 100644
index 0000000..598a0c6
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/http-request.adoc
@@ -0,0 +1,9 @@
+[source,http,options="nowrap"]
+----
+PUT /deposit/v1/instances/wG6RlU6X HTTP/1.1
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+wG6RlU6X
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/http-response.adoc b/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/httpie-request.adoc b/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/httpie-request.adoc
new file mode 100644
index 0000000..bf36e23
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-activate-product-instance/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo 'wG6RlU6X' | http PUT 'http://localhost:8080/deposit/v1/instances/wG6RlU6X' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-close-product-instance/curl-request.adoc b/service/src/doc/generated-snippets/test-instances/should-close-product-instance/curl-request.adoc
new file mode 100644
index 0000000..411e796
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-close-product-instance/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/instances/70L3qA8T' -i -X PUT -H 'Content-Type: application/json' -d '70L3qA8T'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-close-product-instance/http-request.adoc b/service/src/doc/generated-snippets/test-instances/should-close-product-instance/http-request.adoc
new file mode 100644
index 0000000..feeb83d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-close-product-instance/http-request.adoc
@@ -0,0 +1,9 @@
+[source,http,options="nowrap"]
+----
+PUT /deposit/v1/instances/70L3qA8T HTTP/1.1
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+70L3qA8T
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-close-product-instance/http-response.adoc b/service/src/doc/generated-snippets/test-instances/should-close-product-instance/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-close-product-instance/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-close-product-instance/httpie-request.adoc b/service/src/doc/generated-snippets/test-instances/should-close-product-instance/httpie-request.adoc
new file mode 100644
index 0000000..3971805
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-close-product-instance/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo '70L3qA8T' | http PUT 'http://localhost:8080/deposit/v1/instances/70L3qA8T' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-create-product-instance/curl-request.adoc b/service/src/doc/generated-snippets/test-instances/should-create-product-instance/curl-request.adoc
new file mode 100644
index 0000000..7b64076
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-create-product-instance/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/instances' -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'wGZPqFXZ'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-create-product-instance/http-request.adoc b/service/src/doc/generated-snippets/test-instances/should-create-product-instance/http-request.adoc
new file mode 100644
index 0000000..1789eef
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-create-product-instance/http-request.adoc
@@ -0,0 +1,10 @@
+[source,http,options="nowrap"]
+----
+POST /deposit/v1/instances HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+wGZPqFXZ
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-create-product-instance/http-response.adoc b/service/src/doc/generated-snippets/test-instances/should-create-product-instance/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-create-product-instance/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-create-product-instance/httpie-request.adoc b/service/src/doc/generated-snippets/test-instances/should-create-product-instance/httpie-request.adoc
new file mode 100644
index 0000000..6604e08
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-create-product-instance/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo 'wGZPqFXZ' | http POST 'http://localhost:8080/deposit/v1/instances' 'Accept:application/json' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/curl-request.adoc b/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/curl-request.adoc
new file mode 100644
index 0000000..c985b0a
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/instances/transactiontypes' -i -H 'Accept: */*' -H 'Content-Type: application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/http-request.adoc b/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/http-request.adoc
new file mode 100644
index 0000000..64a5879
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/http-request.adoc
@@ -0,0 +1,8 @@
+[source,http,options="nowrap"]
+----
+GET /deposit/v1/instances/transactiontypes HTTP/1.1
+Accept: */*
+Content-Type: application/json
+Host: localhost:8080
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/http-response.adoc b/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/httpie-request.adoc b/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/httpie-request.adoc
new file mode 100644
index 0000000..98960e3
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-find-available-transaction-types/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ http GET 'http://localhost:8080/deposit/v1/instances/transactiontypes' 'Accept:*/*' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-find-product-instance/curl-request.adoc b/service/src/doc/generated-snippets/test-instances/should-find-product-instance/curl-request.adoc
new file mode 100644
index 0000000..de7a6b8
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-find-product-instance/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/instances' -i -H 'Accept: */*' -H 'Content-Type: application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-find-product-instance/http-request.adoc b/service/src/doc/generated-snippets/test-instances/should-find-product-instance/http-request.adoc
new file mode 100644
index 0000000..5341602
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-find-product-instance/http-request.adoc
@@ -0,0 +1,8 @@
+[source,http,options="nowrap"]
+----
+GET /deposit/v1/instances HTTP/1.1
+Accept: */*
+Content-Type: application/json
+Host: localhost:8080
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-find-product-instance/http-response.adoc b/service/src/doc/generated-snippets/test-instances/should-find-product-instance/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-find-product-instance/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-find-product-instance/httpie-request.adoc b/service/src/doc/generated-snippets/test-instances/should-find-product-instance/httpie-request.adoc
new file mode 100644
index 0000000..14c9be3
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-find-product-instance/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ http GET 'http://localhost:8080/deposit/v1/instances' 'Accept:*/*' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-update-product-instance/curl-request.adoc b/service/src/doc/generated-snippets/test-instances/should-update-product-instance/curl-request.adoc
new file mode 100644
index 0000000..2578091
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-update-product-instance/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/deposit/v1/instances/aNIkxzuI' -i -X PUT -H 'Content-Type: application/json' -d 'aNIkxzuI'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-update-product-instance/http-request.adoc b/service/src/doc/generated-snippets/test-instances/should-update-product-instance/http-request.adoc
new file mode 100644
index 0000000..6165c6e
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-update-product-instance/http-request.adoc
@@ -0,0 +1,9 @@
+[source,http,options="nowrap"]
+----
+PUT /deposit/v1/instances/aNIkxzuI HTTP/1.1
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+aNIkxzuI
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-update-product-instance/http-response.adoc b/service/src/doc/generated-snippets/test-instances/should-update-product-instance/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-update-product-instance/http-response.adoc
@@ -0,0 +1,5 @@
+[source,http,options="nowrap"]
+----
+HTTP/1.1 404 Not Found
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-instances/should-update-product-instance/httpie-request.adoc b/service/src/doc/generated-snippets/test-instances/should-update-product-instance/httpie-request.adoc
new file mode 100644
index 0000000..cd799a4
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-instances/should-update-product-instance/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo 'aNIkxzuI' | http PUT 'http://localhost:8080/deposit/v1/instances/aNIkxzuI' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/html5/html5/api-docs.html b/service/src/doc/html5/html5/api-docs.html
new file mode 100644
index 0000000..ef49f2f
--- /dev/null
+++ b/service/src/doc/html5/html5/api-docs.html
@@ -0,0 +1,902 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="generator" content="Asciidoctor 1.5.3">
+<title>Apache Fineract CN Deposit Account Management API Documentation</title>
+<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
+<style>
+/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
+/* Remove comment around @import statement below when using as a custom stylesheet */
+/*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700";*/
+article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}
+audio,canvas,video{display:inline-block}
+audio:not([controls]){display:none;height:0}
+[hidden],template{display:none}
+script{display:none!important}
+html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
+body{margin:0}
+a{background:transparent}
+a:focus{outline:thin dotted}
+a:active,a:hover{outline:0}
+h1{font-size:2em;margin:.67em 0}
+abbr[title]{border-bottom:1px dotted}
+b,strong{font-weight:bold}
+dfn{font-style:italic}
+hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}
+mark{background:#ff0;color:#000}
+code,kbd,pre,samp{font-family:monospace;font-size:1em}
+pre{white-space:pre-wrap}
+q{quotes:"\201C" "\201D" "\2018" "\2019"}
+small{font-size:80%}
+sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
+sup{top:-.5em}
+sub{bottom:-.25em}
+img{border:0}
+svg:not(:root){overflow:hidden}
+figure{margin:0}
+fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
+legend{border:0;padding:0}
+button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
+button,input{line-height:normal}
+button,select{text-transform:none}
+button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}
+button[disabled],html input[disabled]{cursor:default}
+input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}
+input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}
+input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}
+button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
+textarea{overflow:auto;vertical-align:top}
+table{border-collapse:collapse;border-spacing:0}
+*,*:before,*:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}
+html,body{font-size:100%}
+body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:auto}
+a:hover{cursor:pointer}
+img,object,embed{max-width:100%;height:auto}
+object,embed{height:100%}
+img{-ms-interpolation-mode:bicubic}
+.left{float:left!important}
+.right{float:right!important}
+.text-left{text-align:left!important}
+.text-right{text-align:right!important}
+.text-center{text-align:center!important}
+.text-justify{text-align:justify!important}
+.hide{display:none}
+body{-webkit-font-smoothing:antialiased}
+img,object,svg{display:inline-block;vertical-align:middle}
+textarea{height:auto;min-height:50px}
+select{width:100%}
+.center{margin-left:auto;margin-right:auto}
+.spread{width:100%}
+p.lead,.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{font-size:1.21875em;line-height:1.6}
+.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}
+div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr}
+a{color:#2156a5;text-decoration:underline;line-height:inherit}
+a:hover,a:focus{color:#1d4b8f}
+a img{border:none}
+p{font-family:inherit;font-weight:400;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}
+p aside{font-size:.875em;line-height:1.35;font-style:italic}
+h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}
+h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}
+h1{font-size:2.125em}
+h2{font-size:1.6875em}
+h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}
+h4,h5{font-size:1.125em}
+h6{font-size:1em}
+hr{border:solid #ddddd8;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0}
+em,i{font-style:italic;line-height:inherit}
+strong,b{font-weight:bold;line-height:inherit}
+small{font-size:60%;line-height:inherit}
+code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
+ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
+ul,ol,ul.no-bullet,ol.no-bullet{margin-left:1.5em}
+ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em}
+ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit}
+ul.square{list-style-type:square}
+ul.circle{list-style-type:circle}
+ul.disc{list-style-type:disc}
+ul.no-bullet{list-style:none}
+ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
+dl dt{margin-bottom:.3125em;font-weight:bold}
+dl dd{margin-bottom:1.25em}
+abbr,acronym{text-transform:uppercase;font-size:90%;color:rgba(0,0,0,.8);border-bottom:1px dotted #ddd;cursor:help}
+abbr{text-transform:none}
+blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}
+blockquote cite{display:block;font-size:.9375em;color:rgba(0,0,0,.6)}
+blockquote cite:before{content:"\2014 \0020"}
+blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,.6)}
+blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}
+@media only screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}
+h1{font-size:2.75em}
+h2{font-size:2.3125em}
+h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}
+h4{font-size:1.4375em}}
+table{background:#fff;margin-bottom:1.25em;border:solid 1px #dedede}
+table thead,table tfoot{background:#f7f8f7;font-weight:bold}
+table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}
+table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}
+table tr.even,table tr.alt,table tr:nth-of-type(even){background:#f8f8f7}
+table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6}
+body{tab-size:4}
+h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}
+h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}
+.clearfix:before,.clearfix:after,.float-group:before,.float-group:after{content:" ";display:table}
+.clearfix:after,.float-group:after{clear:both}
+*:not(pre)>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background-color:#f7f7f8;-webkit-border-radius:4px;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}
+pre,pre>code{line-height:1.45;color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;text-rendering:optimizeSpeed}
+.keyseq{color:rgba(51,51,51,.8)}
+kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap}
+.keyseq kbd:first-child{margin-left:0}
+.keyseq kbd:last-child{margin-right:0}
+.menuseq,.menu{color:rgba(0,0,0,.8)}
+b.button:before,b.button:after{position:relative;top:-1px;font-weight:400}
+b.button:before{content:"[";padding:0 3px 0 2px}
+b.button:after{content:"]";padding:0 2px 0 3px}
+p a>code:hover{color:rgba(0,0,0,.9)}
+#header,#content,#footnotes,#footer{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}
+#header:before,#header:after,#content:before,#content:after,#footnotes:before,#footnotes:after,#footer:before,#footer:after{content:" ";display:table}
+#header:after,#content:after,#footnotes:after,#footer:after{clear:both}
+#content{margin-top:1.25em}
+#content:before{content:none}
+#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
+#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #ddddd8}
+#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #ddddd8;padding-bottom:8px}
+#header .details{border-bottom:1px solid #ddddd8;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap}
+#header .details span:first-child{margin-left:-.125em}
+#header .details span.email a{color:rgba(0,0,0,.85)}
+#header .details br{display:none}
+#header .details br+span:before{content:"\00a0\2013\00a0"}
+#header .details br+span.author:before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)}
+#header .details br+span#revremark:before{content:"\00a0|\00a0"}
+#header #revnumber{text-transform:capitalize}
+#header #revnumber:after{content:"\00a0"}
+#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #ddddd8;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}
+#toc{border-bottom:1px solid #efefed;padding-bottom:.5em}
+#toc>ul{margin-left:.125em}
+#toc ul.sectlevel0>li>a{font-style:italic}
+#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}
+#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none}
+#toc li{line-height:1.3334;margin-top:.3334em}
+#toc a{text-decoration:none}
+#toc a:active{text-decoration:underline}
+#toctitle{color:#7a2518;font-size:1.2em}
+@media only screen and (min-width:768px){#toctitle{font-size:1.375em}
+body.toc2{padding-left:15em;padding-right:0}
+#toc.toc2{margin-top:0!important;background-color:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #efefed;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
+#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}
+#toc.toc2>ul{font-size:.9em;margin-bottom:0}
+#toc.toc2 ul ul{margin-left:0;padding-left:1em}
+#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
+body.toc2.toc-right{padding-left:0;padding-right:15em}
+body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #efefed;left:auto;right:0}}
+@media only screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}
+#toc.toc2{width:20em}
+#toc.toc2 #toctitle{font-size:1.375em}
+#toc.toc2>ul{font-size:.95em}
+#toc.toc2 ul ul{padding-left:1.25em}
+body.toc2.toc-right{padding-left:0;padding-right:20em}}
+#content #toc{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}
+#content #toc>:first-child{margin-top:0}
+#content #toc>:last-child{margin-bottom:0}
+#footer{max-width:100%;background-color:rgba(0,0,0,.8);padding:1.25em}
+#footer-text{color:rgba(255,255,255,.8);line-height:1.44}
+.sect1{padding-bottom:.625em}
+@media only screen and (min-width:768px){.sect1{padding-bottom:1.25em}}
+.sect1+.sect1{border-top:1px solid #efefed}
+#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
+#content h1>a.anchor:before,h2>a.anchor:before,h3>a.anchor:before,#toctitle>a.anchor:before,.sidebarblock>.content>.title>a.anchor:before,h4>a.anchor:before,h5>a.anchor:before,h6>a.anchor:before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
+#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}
+#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}
+#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}
+.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}
+.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic}
+table.tableblock>caption.title{white-space:nowrap;overflow:visible;max-width:0}
+.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{color:rgba(0,0,0,.85)}
+table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inherit}
+.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
+.admonitionblock>table td.icon{text-align:center;width:80px}
+.admonitionblock>table td.icon img{max-width:none}
+.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
+.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8;color:rgba(0,0,0,.6)}
+.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
+.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px}
+.exampleblock>.content>:first-child{margin-top:0}
+.exampleblock>.content>:last-child{margin-bottom:0}
+.sidebarblock{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}
+.sidebarblock>:first-child{margin-top:0}
+.sidebarblock>:last-child{margin-bottom:0}
+.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
+.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
+.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#f7f7f8}
+.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#f2f1f1}
+.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;padding:1em;font-size:.8125em}
+.literalblock pre.nowrap,.literalblock pre[class].nowrap,.listingblock pre.nowrap,.listingblock pre[class].nowrap{overflow-x:auto;white-space:pre;word-wrap:normal}
+@media only screen and (min-width:768px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:.90625em}}
+@media only screen and (min-width:1280px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:1em}}
+.literalblock.output pre{color:#f7f7f8;background-color:rgba(0,0,0,.9)}
+.listingblock pre.highlightjs{padding:0}
+.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px}
+.listingblock pre.prettyprint{border-width:0}
+.listingblock>.content{position:relative}
+.listingblock code[data-lang]:before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:#999}
+.listingblock:hover code[data-lang]:before{display:block}
+.listingblock.terminal pre .command:before{content:attr(data-prompt);padding-right:.5em;color:#999}
+.listingblock.terminal pre .command:not([data-prompt]):before{content:"$"}
+table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:none}
+table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0;line-height:1.45}
+table.pyhltable td.code{padding-left:.75em;padding-right:0}
+pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #ddddd8}
+pre.pygments .lineno{display:inline-block;margin-right:.25em}
+table.pyhltable .linenodiv{background:none!important;padding-right:0!important}
+.quoteblock{margin:0 1em 1.25em 1.5em;display:table}
+.quoteblock>.title{margin-left:-1.5em;margin-bottom:.75em}
+.quoteblock blockquote,.quoteblock blockquote p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}
+.quoteblock blockquote{margin:0;padding:0;border:0}
+.quoteblock blockquote:before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}
+.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}
+.quoteblock .attribution{margin-top:.5em;margin-right:.5ex;text-align:right}
+.quoteblock .quoteblock{margin-left:0;margin-right:0;padding:.5em 0;border-left:3px solid rgba(0,0,0,.6)}
+.quoteblock .quoteblock blockquote{padding:0 0 0 .75em}
+.quoteblock .quoteblock blockquote:before{display:none}
+.verseblock{margin:0 1em 1.25em 1em}
+.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}
+.verseblock pre strong{font-weight:400}
+.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}
+.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
+.quoteblock .attribution br,.verseblock .attribution br{display:none}
+.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)}
+.quoteblock.abstract{margin:0 0 1.25em 0;display:block}
+.quoteblock.abstract blockquote,.quoteblock.abstract blockquote p{text-align:left;word-spacing:0}
+.quoteblock.abstract blockquote:before,.quoteblock.abstract blockquote p:first-of-type:before{display:none}
+table.tableblock{max-width:100%;border-collapse:separate}
+table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0}
+table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
+table.grid-all th.tableblock,table.grid-all td.tableblock{border-width:0 1px 1px 0}
+table.grid-all tfoot>tr>th.tableblock,table.grid-all tfoot>tr>td.tableblock{border-width:1px 1px 0 0}
+table.grid-cols th.tableblock,table.grid-cols td.tableblock{border-width:0 1px 0 0}
+table.grid-all *>tr>.tableblock:last-child,table.grid-cols *>tr>.tableblock:last-child{border-right-width:0}
+table.grid-rows th.tableblock,table.grid-rows td.tableblock{border-width:0 0 1px 0}
+table.grid-all tbody>tr:last-child>th.tableblock,table.grid-all tbody>tr:last-child>td.tableblock,table.grid-all thead:last-child>tr>th.tableblock,table.grid-rows tbody>tr:last-child>th.tableblock,table.grid-rows tbody>tr:last-child>td.tableblock,table.grid-rows thead:last-child>tr>th.tableblock{border-bottom-width:0}
+table.grid-rows tfoot>tr>th.tableblock,table.grid-rows tfoot>tr>td.tableblock{border-width:1px 0 0 0}
+table.frame-all{border-width:1px}
+table.frame-sides{border-width:0 1px}
+table.frame-topbot{border-width:1px 0}
+th.halign-left,td.halign-left{text-align:left}
+th.halign-right,td.halign-right{text-align:right}
+th.halign-center,td.halign-center{text-align:center}
+th.valign-top,td.valign-top{vertical-align:top}
+th.valign-bottom,td.valign-bottom{vertical-align:bottom}
+th.valign-middle,td.valign-middle{vertical-align:middle}
+table thead th,table tfoot th{font-weight:bold}
+tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7}
+tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}
+p.tableblock>code:only-child{background:none;padding:0}
+p.tableblock{font-size:1em}
+td>div.verse{white-space:pre}
+ol{margin-left:1.75em}
+ul li ol{margin-left:1.5em}
+dl dd{margin-left:1.125em}
+dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
+ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
+ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none}
+ul.unstyled,ol.unnumbered,ul.checklist{margin-left:.625em}
+ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1em;font-size:.85em}
+ul.checklist li>p:first-child>input[type="checkbox"]:first-child{width:1em;position:relative;top:1px}
+ul.inline{margin:0 auto .625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden}
+ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block}
+ul.inline>li>*{display:block}
+.unstyled dl dt{font-weight:400;font-style:normal}
+ol.arabic{list-style-type:decimal}
+ol.decimal{list-style-type:decimal-leading-zero}
+ol.loweralpha{list-style-type:lower-alpha}
+ol.upperalpha{list-style-type:upper-alpha}
+ol.lowerroman{list-style-type:lower-roman}
+ol.upperroman{list-style-type:upper-roman}
+ol.lowergreek{list-style-type:lower-greek}
+.hdlist>table,.colist>table{border:0;background:none}
+.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}
+td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}
+td.hdlist1{font-weight:bold;padding-bottom:1.25em}
+.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
+.colist>table tr>td:first-of-type{padding:0 .75em;line-height:1}
+.colist>table tr>td:last-of-type{padding:.25em 0}
+.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd}
+.imageblock.left,.imageblock[style*="float: left"]{margin:.25em .625em 1.25em 0}
+.imageblock.right,.imageblock[style*="float: right"]{margin:.25em 0 1.25em .625em}
+.imageblock>.title{margin-bottom:0}
+.imageblock.thumb,.imageblock.th{border-width:6px}
+.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}
+.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}
+.image.left{margin-right:.625em}
+.image.right{margin-left:.625em}
+a.image{text-decoration:none;display:inline-block}
+a.image object{pointer-events:none}
+sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}
+sup.footnote a,sup.footnoteref a{text-decoration:none}
+sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}
+#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
+#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em 0;border-width:1px 0 0 0}
+#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;text-indent:-1.05em;margin-bottom:.2em}
+#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none}
+#footnotes .footnote:last-of-type{margin-bottom:0}
+#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}
+.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0}
+.gist .file-data>table td.line-data{width:99%}
+div.unbreakable{page-break-inside:avoid}
+.big{font-size:larger}
+.small{font-size:smaller}
+.underline{text-decoration:underline}
+.overline{text-decoration:overline}
+.line-through{text-decoration:line-through}
+.aqua{color:#00bfbf}
+.aqua-background{background-color:#00fafa}
+.black{color:#000}
+.black-background{background-color:#000}
+.blue{color:#0000bf}
+.blue-background{background-color:#0000fa}
+.fuchsia{color:#bf00bf}
+.fuchsia-background{background-color:#fa00fa}
+.gray{color:#606060}
+.gray-background{background-color:#7d7d7d}
+.green{color:#006000}
+.green-background{background-color:#007d00}
+.lime{color:#00bf00}
+.lime-background{background-color:#00fa00}
+.maroon{color:#600000}
+.maroon-background{background-color:#7d0000}
+.navy{color:#000060}
+.navy-background{background-color:#00007d}
+.olive{color:#606000}
+.olive-background{background-color:#7d7d00}
+.purple{color:#600060}
+.purple-background{background-color:#7d007d}
+.red{color:#bf0000}
+.red-background{background-color:#fa0000}
+.silver{color:#909090}
+.silver-background{background-color:#bcbcbc}
+.teal{color:#006060}
+.teal-background{background-color:#007d7d}
+.white{color:#bfbfbf}
+.white-background{background-color:#fafafa}
+.yellow{color:#bfbf00}
+.yellow-background{background-color:#fafa00}
+span.icon>.fa{cursor:default}
+.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
+.admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c}
+.admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
+.admonitionblock td.icon .icon-warning:before{content:"\f071";color:#bf6900}
+.admonitionblock td.icon .icon-caution:before{content:"\f06d";color:#bf3400}
+.admonitionblock td.icon .icon-important:before{content:"\f06a";color:#bf0000}
+.conum[data-value]{display:inline-block;color:#fff!important;background-color:rgba(0,0,0,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
+.conum[data-value] *{color:#fff!important}
+.conum[data-value]+b{display:none}
+.conum[data-value]:after{content:attr(data-value)}
+pre .conum[data-value]{position:relative;top:-.125em}
+b.conum *{color:inherit!important}
+.conum:not([data-value]):empty{display:none}
+dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
+h1,h2,p,td.content,span.alt{letter-spacing:-.01em}
+p strong,td.content strong,div.footnote strong{letter-spacing:-.005em}
+p,blockquote,dt,td.content,span.alt{font-size:1.0625rem}
+p{margin-bottom:1.25rem}
+.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
+.exampleblock>.content{background-color:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc}
+.print-only{display:none!important}
+@media print{@page{margin:1.25cm .75cm}
+*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important}
+a{color:inherit!important;text-decoration:underline!important}
+a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
+a[href^="http:"]:not(.bare):after,a[href^="https:"]:not(.bare):after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
+abbr[title]:after{content:" (" attr(title) ")"}
+pre,blockquote,tr,img,object,svg{page-break-inside:avoid}
+thead{display:table-header-group}
+svg{max-width:100%}
+p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}
+h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}
+#toc,.sidebarblock,.exampleblock>.content{background:none!important}
+#toc{border-bottom:1px solid #ddddd8!important;padding-bottom:0!important}
+.sect1{padding-bottom:0!important}
+.sect1+.sect1{border:0!important}
+#header>h1:first-child{margin-top:1.25rem}
+body.book #header{text-align:center}
+body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em 0}
+body.book #header .details{border:0!important;display:block;padding:0!important}
+body.book #header .details span:first-child{margin-left:0!important}
+body.book #header .details br{display:block}
+body.book #header .details br+span:before{content:none!important}
+body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}
+body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}
+.listingblock code[data-lang]:before{display:block}
+#footer{background:none!important;padding:0 .9375em}
+#footer-text{color:rgba(0,0,0,.6)!important;font-size:.9em}
+.hide-on-print{display:none!important}
+.print-only{display:block!important}
+.hide-for-print{display:none!important}
+.show-for-print{display:inherit!important}}
+</style>
+</head>
+<body class="book">
+<div id="header">
+</div>
+<div id="content">
+<div class="sect1">
+<h2 id="_apache_fineract_cn_deposit_account_management_api_documentation">Apache Fineract CN Deposit Account Management API Documentation</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_actions">Actions</h2>
+<div class="sectionbody">
+<div class="sect3">
+<h4 id="_create_an_action">Create An Action</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/actions' -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'oMeOsoRMayyE4j2XNJrQmUssSKD2UOv0'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">POST /deposit/v1/actions HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 32
+
+oMeOsoRMayyE4j2XNJrQmUssSKD2UOv0</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ echo 'oMeOsoRMayyE4j2XNJrQmUssSKD2UOv0' | http POST 'http://localhost:8080/deposit/v1/actions' 'Accept:application/json' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_get_default_actions">Get Default Actions</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/actions' -i -H 'Accept: */*' -H 'Content-Type: application/json'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">GET /deposit/v1/actions HTTP/1.1
+Accept: */*
+Content-Type: application/json
+Host: localhost:8080</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ http GET 'http://localhost:8080/deposit/v1/actions' 'Accept:*/*' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_product_definitions">Product Definitions</h2>
+<div class="sectionbody">
+<div class="sect3">
+<h4 id="_define_a_product">Define A Product</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/definitions' -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'ZmLKEouR'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">POST /deposit/v1/definitions HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+ZmLKEouR</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ echo 'ZmLKEouR' | http POST 'http://localhost:8080/deposit/v1/definitions' 'Accept:application/json' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_find_a_product">Find A Product</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/definitions/IUM2xv8N' -i -H 'Accept: */*' -H 'Content-Type: application/json'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">GET /deposit/v1/definitions/IUM2xv8N HTTP/1.1
+Accept: */*
+Content-Type: application/json
+Host: localhost:8080</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ http GET 'http://localhost:8080/deposit/v1/definitions/IUM2xv8N' 'Accept:*/*' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_update_a_product">Update A Product</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/definitions/tBSiWosu' -i -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'tBSiWosu'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">PUT /deposit/v1/definitions/tBSiWosu HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+tBSiWosu</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ echo 'tBSiWosu' | http PUT 'http://localhost:8080/deposit/v1/definitions/tBSiWosu' 'Accept:application/json' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_activate_a_product">Activate A Product</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/definitions/J55UjH3A' -i -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'J55UjH3A'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">PUT /deposit/v1/definitions/J55UjH3A HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+J55UjH3A</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ echo 'J55UjH3A' | http PUT 'http://localhost:8080/deposit/v1/definitions/J55UjH3A' 'Accept:application/json' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_deactivate_a_product">Deactivate A Product</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/definitions/G5ZwGoZN' -i -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'G5ZwGoZN'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">PUT /deposit/v1/definitions/G5ZwGoZN HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+G5ZwGoZN</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ echo 'G5ZwGoZN' | http PUT 'http://localhost:8080/deposit/v1/definitions/G5ZwGoZN' 'Accept:application/json' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_delete_a_product">Delete A Product</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/definitions/KMdOIEEJ' -i -X DELETE -H 'Accept: */*' -H 'Content-Type: application/json' -d 'application/json'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">DELETE /deposit/v1/definitions/KMdOIEEJ HTTP/1.1
+Accept: */*
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 16
+
+application/json</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ echo 'application/json' | http DELETE 'http://localhost:8080/deposit/v1/definitions/KMdOIEEJ' 'Accept:*/*' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_product_instances">Product Instances</h2>
+<div class="sectionbody">
+<div class="sect3">
+<h4 id="_create_product_instance">Create Product Instance</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/instances' -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'wGZPqFXZ'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">POST /deposit/v1/instances HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+wGZPqFXZ</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ echo 'wGZPqFXZ' | http POST 'http://localhost:8080/deposit/v1/instances' 'Accept:application/json' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_find_a_product_instance">Find A Product Instance</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/instances' -i -H 'Accept: */*' -H 'Content-Type: application/json'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">GET /deposit/v1/instances HTTP/1.1
+Accept: */*
+Content-Type: application/json
+Host: localhost:8080</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ http GET 'http://localhost:8080/deposit/v1/instances' 'Accept:*/*' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_update_a_product_instance">Update A Product Instance</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/instances/aNIkxzuI' -i -X PUT -H 'Content-Type: application/json' -d 'aNIkxzuI'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">PUT /deposit/v1/instances/aNIkxzuI HTTP/1.1
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+aNIkxzuI</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ echo 'aNIkxzuI' | http PUT 'http://localhost:8080/deposit/v1/instances/aNIkxzuI' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_activate_a_product_instance">Activate A Product Instance</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/instances/wG6RlU6X' -i -X PUT -H 'Content-Type: application/json' -d 'wG6RlU6X'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">PUT /deposit/v1/instances/wG6RlU6X HTTP/1.1
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+wG6RlU6X</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ echo 'wG6RlU6X' | http PUT 'http://localhost:8080/deposit/v1/instances/wG6RlU6X' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_close_a_product_instance">Close A Product Instance</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/instances/70L3qA8T' -i -X PUT -H 'Content-Type: application/json' -d '70L3qA8T'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">PUT /deposit/v1/instances/70L3qA8T HTTP/1.1
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 8
+
+70L3qA8T</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ echo '70L3qA8T' | http PUT 'http://localhost:8080/deposit/v1/instances/70L3qA8T' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_get_available_transaction_types">Get Available Transaction Types</h4>
+<div class="listingblock">
+<div class="title">curl-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/deposit/v1/instances/transactiontypes' -i -H 'Accept: */*' -H 'Content-Type: application/json'</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-request</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">GET /deposit/v1/instances/transactiontypes HTTP/1.1
+Accept: */*
+Content-Type: application/json
+Host: localhost:8080</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">http-response</div>
+<div class="content">
+<pre class="highlightjs highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 404 Not Found</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">httpie-request</div>
+<div class="content">
+<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ http GET 'http://localhost:8080/deposit/v1/instances/transactiontypes' 'Accept:*/*' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2018-04-13 21:06:17 +01:00
+</div>
+</div>
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/styles/github.min.css">
+<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/highlight.min.js"></script>
+<script>hljs.initHighlighting()</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/AbstractDepositAccountManagementTest.java b/service/src/test/java/org/apache/fineract/cn/deposit/AbstractDepositAccountManagementTest.java
new file mode 100644
index 0000000..d609370
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/AbstractDepositAccountManagementTest.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit;
+
+import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
+import org.apache.fineract.cn.api.context.AutoUserContext;
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.deposit.api.v1.client.DepositAccountManager;
+import org.apache.fineract.cn.deposit.service.DepositAccountManagementConfiguration;
+import org.apache.fineract.cn.deposit.service.internal.service.helper.AccountingService;
+import org.apache.fineract.cn.deposit.service.internal.service.helper.RhythmService;
+import org.apache.fineract.cn.lang.ApplicationName;
+import org.apache.fineract.cn.test.fixture.TenantDataStoreContextTestRule;
+import org.apache.fineract.cn.test.listener.EnableEventRecording;
+import org.apache.fineract.cn.test.listener.EventRecorder;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.cloud.netflix.feign.EnableFeignClients;
+import org.springframework.cloud.netflix.ribbon.RibbonClient;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(
+ webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT,
+ classes = {AbstractDepositAccountManagementTest.TestConfiguration.class}
+)
+public abstract class AbstractDepositAccountManagementTest extends SuiteTestEnvironment {
+ private static final String TEST_USER = "shed";
+ public static final String TEST_LOGGER = "test-logger";
+
+ @ClassRule
+ public final static TenantDataStoreContextTestRule tenantDataStoreContext = TenantDataStoreContextTestRule.forRandomTenantName(cassandraInitializer, mariaDBInitializer);
+
+ @Rule
+ public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
+ = new TenantApplicationSecurityEnvironmentTestRule(testEnvironment, this::waitForInitialize);
+
+ @Autowired
+ @Qualifier(TEST_LOGGER)
+ protected Logger logger;
+
+ @Autowired
+ DepositAccountManager depositAccountManager;
+
+ @Autowired
+ private ApplicationName applicationName;
+
+ @Autowired
+ EventRecorder eventRecorder;
+
+ @MockBean
+ AccountingService accountingServiceSpy;
+
+ @MockBean
+ RhythmService rhythmService;
+
+ private AutoUserContext autoUserContext;
+
+ AbstractDepositAccountManagementTest() {
+ super();
+ }
+
+ @Before
+ public void prepTest() throws Exception {
+ this.autoUserContext = this.tenantApplicationSecurityEnvironment.createAutoUserContext(AbstractDepositAccountManagementTest.TEST_USER);
+ }
+
+ @After
+ public void cleanTest() throws Exception {
+ this.autoUserContext.close();
+ }
+
+ public boolean waitForInitialize() {
+ try {
+ final String version = this.applicationName.getVersionString();
+ this.logger.info("Waiting on initialize event for version: {}.", version);
+ return this.eventRecorder.wait(EventConstants.INITIALIZE, version);
+ } catch (final InterruptedException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ @Configuration
+ @EnableEventRecording
+ @EnableFeignClients(basePackages = {"org.apache.fineract.cn.deposit.api.v1"})
+ @RibbonClient(name = APP_NAME)
+ @Import({DepositAccountManagementConfiguration.class})
+ @ComponentScan("org.apache.fineract.cn.deposit.listener")
+ public static class TestConfiguration {
+ public TestConfiguration() {
+ super();
+ }
+
+ @Bean(name= TEST_LOGGER)
+ public Logger logger() {
+ return LoggerFactory.getLogger(TEST_LOGGER);
+ }
+ }
+}
+
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/Fixture.java b/service/src/test/java/org/apache/fineract/cn/deposit/Fixture.java
new file mode 100644
index 0000000..d2125c6
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/Fixture.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.*;
+import org.apache.fineract.cn.deposit.api.v1.domain.InterestPayable;
+import org.apache.fineract.cn.deposit.api.v1.domain.TimeUnit;
+import org.apache.fineract.cn.deposit.api.v1.domain.Type;
+import org.apache.fineract.cn.deposit.api.v1.instance.domain.ProductInstance;
+
+import java.util.Arrays;
+import java.util.HashSet;
+
+public class Fixture {
+
+ public Fixture() {
+ super();
+ }
+
+ static ProductDefinition productDefinition() {
+ final Charge openingCharge = new Charge();
+ openingCharge.setActionIdentifier("Open");
+ openingCharge.setAmount(2.00D);
+ openingCharge.setName("Opening Account Charge");
+ openingCharge.setIncomeAccountIdentifier("10123");
+ openingCharge.setProportional(Boolean.FALSE);
+
+ final Charge closingCharge = new Charge();
+ closingCharge.setActionIdentifier("Close");
+ closingCharge.setAmount(2.00D);
+ closingCharge.setName("Closing Account Fee");
+ closingCharge.setIncomeAccountIdentifier("10123");
+ closingCharge.setProportional(Boolean.FALSE);
+
+ final Term term = new Term();
+ term.setPeriod(12);
+ term.setTimeUnit(TimeUnit.MONTH.name());
+ term.setInterestPayable(InterestPayable.MATURITY.name());
+
+ final Currency currency = new Currency();
+ currency.setCode("USD");
+ currency.setName("US Dollar");
+ currency.setSign("$");
+ currency.setScale(3);
+
+ final ProductDefinition productDefinition = new ProductDefinition();
+ productDefinition.setType(Type.SAVINGS.name());
+ productDefinition.setIdentifier(RandomStringUtils.randomAlphanumeric(8));
+ productDefinition.setName(RandomStringUtils.randomAlphanumeric(256));
+ productDefinition.setDescription(RandomStringUtils.randomAlphanumeric(2048));
+ productDefinition.setCharges(new HashSet<>(Arrays.asList(openingCharge, closingCharge)));
+ productDefinition.setCurrency(currency);
+ productDefinition.setInterest(1.25D);
+ productDefinition.setEquityLedgerIdentifier("91xx");
+ productDefinition.setCashAccountIdentifier("76xx");
+ productDefinition.setExpenseAccountIdentifier("38xx");
+ productDefinition.setAccrueAccountIdentifier("82xx");
+ productDefinition.setFlexible(Boolean.FALSE);
+ productDefinition.setMinimumBalance(50.00);
+ productDefinition.setTerm(term);
+
+ return productDefinition;
+ }
+
+ public static Action action() {
+ final Action action = new Action();
+ action.setIdentifier(RandomStringUtils.randomAlphanumeric(32));
+ action.setName(RandomStringUtils.randomAlphanumeric(256));
+ action.setDescription(RandomStringUtils.randomAlphanumeric(2048));
+ action.setTransactionType("ACCO");
+
+ return action;
+ }
+
+ public static ProductInstance productInstance(final String productIdentifier) {
+ final ProductInstance productInstance = new ProductInstance();
+ productInstance.setProductIdentifier(productIdentifier);
+ productInstance.setCustomerIdentifier(RandomStringUtils.randomAlphanumeric(8));
+ productInstance.setBeneficiaries(new HashSet<>(Arrays.asList(
+ RandomStringUtils.randomAlphanumeric(8),
+ RandomStringUtils.randomAlphanumeric(8)
+ )));
+ return productInstance;
+ }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/SuiteTestEnvironment.java b/service/src/test/java/org/apache/fineract/cn/deposit/SuiteTestEnvironment.java
new file mode 100644
index 0000000..c8a0716
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/SuiteTestEnvironment.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit;
+
+
+import org.apache.fineract.cn.test.env.TestEnvironment;
+import org.apache.fineract.cn.test.fixture.cassandra.CassandraInitializer;
+import org.apache.fineract.cn.test.fixture.mariadb.MariaDBInitializer;
+import org.junit.ClassRule;
+import org.junit.rules.RuleChain;
+import org.junit.rules.RunExternalResourceOnce;
+import org.junit.rules.TestRule;
+
+/**
+ * @author Myrle Krantz
+ */
+public class SuiteTestEnvironment {
+ static final String APP_NAME = "deposit-v1";
+ static final TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
+ static final CassandraInitializer cassandraInitializer = new CassandraInitializer();
+ static final MariaDBInitializer mariaDBInitializer = new MariaDBInitializer();
+
+ @ClassRule
+ public static TestRule orderClassRules = RuleChain
+ .outerRule(new RunExternalResourceOnce(testEnvironment))
+ .around(new RunExternalResourceOnce(cassandraInitializer))
+ .around(new RunExternalResourceOnce(mariaDBInitializer));
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/TestAccrual.java b/service/src/test/java/org/apache/fineract/cn/deposit/TestAccrual.java
new file mode 100644
index 0000000..86fb6c9
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/TestAccrual.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit;
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.accounting.api.v1.domain.AccountType;
+import org.apache.fineract.cn.api.util.ApiFactory;
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.ProductDefinition;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.ProductDefinitionCommand;
+import org.apache.fineract.cn.deposit.api.v1.domain.Type;
+import org.apache.fineract.cn.deposit.api.v1.instance.domain.ProductInstance;
+import org.apache.fineract.cn.deposit.service.internal.repository.AccruedInterestEntity;
+import org.apache.fineract.cn.deposit.service.internal.repository.AccruedInterestRepository;
+import org.apache.fineract.cn.lang.DateConverter;
+import org.apache.fineract.cn.rhythm.spi.v1.client.BeatListener;
+import org.apache.fineract.cn.rhythm.spi.v1.domain.BeatPublish;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Optional;
+
+public class TestAccrual extends AbstractDepositAccountManagementTest {
+
+ @Autowired
+ private AccruedInterestRepository accruedInterestRepository;
+
+ private BeatListener depositBeatListener;
+
+ public TestAccrual() {
+ super();
+ }
+
+ @Before
+ public void prepBeatListener() {
+ depositBeatListener = new ApiFactory(super.logger)
+ .create(BeatListener.class, testEnvironment.serverURI());
+ }
+
+ @Test
+ public void shouldAccrueInterest() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+ productDefinition.setType(Type.SAVINGS.name());
+ productDefinition.setInterest(2.50D);
+ super.depositAccountManager.create(productDefinition);
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductDefinitionCommand productDefinitionCommand = new ProductDefinitionCommand();
+ productDefinitionCommand.setAction(ProductDefinitionCommand.Action.ACTIVATE.name());
+ super.depositAccountManager.process(productDefinition.getIdentifier(), productDefinitionCommand);
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION_COMMAND, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+ super.depositAccountManager.create(productInstance);
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final List<ProductInstance> productInstances = super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+ Assert.assertNotNull(productInstances);
+ Assert.assertEquals(1, productInstances.size());
+ final ProductInstance foundProductInstance = productInstances.get(0);
+
+ super.depositAccountManager.postProductInstanceCommand(
+ foundProductInstance.getAccountIdentifier(), EventConstants.ACTIVATE_PRODUCT_INSTANCE_COMMAND);
+ super.eventRecorder.wait(EventConstants.ACTIVATE_PRODUCT_INSTANCE, foundProductInstance.getAccountIdentifier());
+
+ final Account shareAccount = new Account();
+ shareAccount.setType(AccountType.EQUITY.name());
+ shareAccount.setIdentifier(foundProductInstance.getAccountIdentifier());
+ shareAccount.setBalance(1000.00D);
+
+ Mockito
+ .doAnswer(invocation -> shareAccount)
+ .when(super.accountingServiceSpy).findAccount(shareAccount.getIdentifier());
+
+ final LocalDateTime dueDate = DateConverter.fromIsoString("2017-08-02T22:00:00.000Z");
+ final BeatPublish beatPublish = new BeatPublish();
+ beatPublish.setIdentifier(RandomStringUtils.randomAlphanumeric(32));
+ beatPublish.setForTime(DateConverter.toIsoString(dueDate));
+ this.depositBeatListener.publishBeat(beatPublish);
+
+ super.eventRecorder.wait(EventConstants.INTEREST_ACCRUED, DateConverter.toIsoString(dueDate.toLocalDate()));
+
+ final Optional<AccruedInterestEntity> optionalAccruedInterest =
+ this.accruedInterestRepository.findByCustomerAccountIdentifier(foundProductInstance.getAccountIdentifier());
+
+ Assert.assertTrue(optionalAccruedInterest.isPresent());
+ final AccruedInterestEntity accruedInterestEntity = optionalAccruedInterest.get();
+ final Double interest =
+ accruedInterestEntity.getAmount()
+ * DateConverter.fromIsoString(beatPublish.getForTime()).toLocalDate().lengthOfYear();
+
+ final Double roundedInterest =
+ BigDecimal.valueOf(interest).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+
+ Assert.assertEquals(25.00D, roundedInterest, 0.00D);
+ }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/TestActions.java b/service/src/test/java/org/apache/fineract/cn/deposit/TestActions.java
new file mode 100644
index 0000000..647de31
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/TestActions.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit;
+
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.deposit.api.v1.definition.ActionAlreadyExistsException;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.Action;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import java.util.List;
+
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class TestActions extends AbstractDepositAccountManagementTest {
+
+ @Rule
+ public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("src/doc/generated-snippets/test-actions");
+
+ @Autowired
+ private WebApplicationContext context;
+
+ private MockMvc mockMvc;
+
+ final String path = "/deposit/v1";
+
+ @Before
+ public void setUp(){
+
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+ .apply(documentationConfiguration(this.restDocumentation))
+ .alwaysDo(document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+ .build();
+ }
+
+ public TestActions() {
+ super();
+ }
+
+ @Test
+ public void shouldFetchDefaultActions() {
+ final List<Action> actions = super.depositAccountManager.fetchActions();
+
+ Assert.assertTrue(actions.size() >= 5);
+
+ try
+ {
+ this.mockMvc.perform(get(path + "/actions")
+ .accept(MediaType.ALL_VALUE).contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(status().isNotFound());
+ } catch (Exception exception){ exception.printStackTrace(); }
+ }
+
+ @Test
+ public void shouldCreateAction() throws Exception {
+ final Action action = Fixture.action();
+
+ super.depositAccountManager.create(action);
+
+ Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_PRODUCT_ACTION, action.getIdentifier()));
+
+ this.mockMvc.perform(post(path + "/actions")
+ .accept(MediaType.APPLICATION_JSON_VALUE)
+ .contentType(MediaType.APPLICATION_JSON_VALUE)
+ .content(action.getIdentifier()))
+ .andExpect(status().isNotFound());
+ }
+
+ @Test(expected = ActionAlreadyExistsException.class)
+ public void shouldNotCreateActionAlreadyExists() throws Exception {
+ final Action action = Fixture.action();
+ super.depositAccountManager.create(action);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_ACTION, action.getIdentifier());
+
+ super.depositAccountManager.create(action);
+ }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/TestDividendDistribution.java b/service/src/test/java/org/apache/fineract/cn/deposit/TestDividendDistribution.java
new file mode 100644
index 0000000..2f99cd2
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/TestDividendDistribution.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit;
+
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.accounting.api.v1.domain.AccountType;
+import org.apache.fineract.cn.accounting.api.v1.domain.JournalEntry;
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.DividendDistribution;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.ProductDefinition;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.ProductDefinitionCommand;
+import org.apache.fineract.cn.deposit.api.v1.domain.Type;
+import org.apache.fineract.cn.deposit.api.v1.instance.domain.ProductInstance;
+import org.apache.fineract.cn.lang.DateOfBirth;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+
+import java.util.List;
+
+public class TestDividendDistribution extends AbstractDepositAccountManagementTest {
+
+ public TestDividendDistribution() {
+ super();
+ }
+
+ @Test
+ public void shouldDistributeDividend() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+ productDefinition.setType(Type.SHARE.name());
+ productDefinition.setInterest(null);
+ productDefinition.setAccrueAccountIdentifier(null);
+ super.depositAccountManager.create(productDefinition);
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductDefinitionCommand productDefinitionCommand = new ProductDefinitionCommand();
+ productDefinitionCommand.setAction(ProductDefinitionCommand.Action.ACTIVATE.name());
+ super.depositAccountManager.process(productDefinition.getIdentifier(), productDefinitionCommand);
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION_COMMAND, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+ super.depositAccountManager.create(productInstance);
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final List<ProductInstance> productInstances = super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+ Assert.assertNotNull(productInstances);
+ Assert.assertEquals(1, productInstances.size());
+ final ProductInstance foundProductInstance = productInstances.get(0);
+
+ super.depositAccountManager.postProductInstanceCommand(
+ foundProductInstance.getAccountIdentifier(), EventConstants.ACTIVATE_PRODUCT_INSTANCE_COMMAND);
+ super.eventRecorder.wait(EventConstants.ACTIVATE_PRODUCT_INSTANCE, foundProductInstance.getAccountIdentifier());
+
+ final Account shareAccount = new Account();
+ shareAccount.setType(AccountType.EQUITY.name());
+ shareAccount.setIdentifier(foundProductInstance.getAccountIdentifier());
+ shareAccount.setBalance(1000.00D);
+
+ Mockito
+ .doAnswer(invocation -> shareAccount)
+ .when(super.accountingServiceSpy).findAccount(shareAccount.getIdentifier());
+
+ final DividendDistribution dividendDistribution = new DividendDistribution();
+ final DateOfBirth dueDate = new DateOfBirth();
+ dueDate.setYear(2017);
+ dueDate.setMonth(7);
+ dueDate.setDay(31);
+ dividendDistribution.setDueDate(dueDate);
+ dividendDistribution.setDividendRate("2.5");
+ this.depositAccountManager.dividendDistribution(productDefinition.getIdentifier(), dividendDistribution);
+
+ Assert.assertTrue(super.eventRecorder.wait(EventConstants.DIVIDEND_DISTRIBUTION, productDefinition.getIdentifier()));
+
+ final List<DividendDistribution> dividendDistributions =
+ super.depositAccountManager.fetchDividendDistributions(productDefinition.getIdentifier());
+
+ Assert.assertEquals(1, dividendDistributions.size());
+ Assert.assertTrue(dividendDistribution.equals(dividendDistributions.get(0)));
+
+ Mockito.verify(super.accountingServiceSpy, Mockito.times(2)).post(Matchers.any(JournalEntry.class));
+ }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/TestProductDefinition.java b/service/src/test/java/org/apache/fineract/cn/deposit/TestProductDefinition.java
new file mode 100644
index 0000000..435af7d
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/TestProductDefinition.java
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.deposit.api.v1.definition.ProductDefinitionAlreadyExistsException;
+import org.apache.fineract.cn.deposit.api.v1.definition.ProductDefinitionValidationException;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.ProductDefinition;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.ProductDefinitionCommand;
+import org.apache.fineract.cn.deposit.api.v1.instance.domain.ProductInstance;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.put;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class TestProductDefinition extends AbstractDepositAccountManagementTest {
+
+ @Rule
+ public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("src/doc/generated-snippets/test-definitions");
+
+ @Autowired
+ private WebApplicationContext context;
+
+ private MockMvc mockMvc;
+
+ final String path = "/deposit/v1";
+
+ @Before
+ public void setUp(){
+
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+ .apply(documentationConfiguration(this.restDocumentation))
+ .alwaysDo(document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+ .build();
+ }
+
+ public TestProductDefinition() {
+ super();
+ }
+
+ @Test
+ public void shouldCreateProductDefinition() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ this.mockMvc.perform(post(path + "/definitions")
+ .accept(MediaType.APPLICATION_JSON_VALUE)
+ .contentType(MediaType.APPLICATION_JSON_VALUE)
+ .content(productDefinition.getIdentifier()))
+ .andExpect(status().isNotFound());
+ }
+
+
+ @Test(expected = ProductDefinitionAlreadyExistsException.class)
+ public void shouldNotCreateProductDefinitionAlreadyExists() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ super.depositAccountManager.create(productDefinition);
+ }
+
+ @Test
+ public void shouldFindProductDefinition() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductDefinition fetchedProductDefinition = super.depositAccountManager.findProductDefinition(productDefinition.getIdentifier());
+
+ Assert.assertNotNull(fetchedProductDefinition);
+ Assert.assertNotNull(fetchedProductDefinition.getCharges());
+ Assert.assertEquals(2, fetchedProductDefinition.getCharges().size());
+ Assert.assertNotNull(fetchedProductDefinition.getCurrency());
+ Assert.assertNotNull(fetchedProductDefinition.getTerm());
+ Assert.assertFalse(fetchedProductDefinition.getActive());
+
+ try
+ {
+ this.mockMvc.perform(get(path + "/definitions/" + productDefinition.getIdentifier())
+ .accept(MediaType.ALL_VALUE).contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(status().is4xxClientError());
+ } catch (Exception exception){ exception.printStackTrace(); }
+ }
+
+ @Test
+ public void shouldActivateProductDefinition() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductDefinitionCommand productDefinitionCommand = new ProductDefinitionCommand();
+ productDefinitionCommand.setAction(ProductDefinitionCommand.Action.ACTIVATE.name());
+ productDefinitionCommand.setNote(RandomStringUtils.randomAlphanumeric(2048));
+
+ super.depositAccountManager.process(productDefinition.getIdentifier(), productDefinitionCommand);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION_COMMAND, productDefinition.getIdentifier());
+
+ final ProductDefinition fetchedProductDefinition = super.depositAccountManager.findProductDefinition(productDefinition.getIdentifier());
+
+ Assert.assertTrue(fetchedProductDefinition.getActive());
+
+ this.mockMvc.perform(put(path + "/definitions/" + fetchedProductDefinition.getIdentifier())
+ .accept(MediaType.APPLICATION_JSON_VALUE)
+ .contentType(MediaType.APPLICATION_JSON).content(fetchedProductDefinition.getIdentifier()))
+ .andExpect(status().is4xxClientError());
+ }
+
+ @Test
+ public void shouldDeactivateProductDefinition() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductDefinitionCommand productDefinitionCommand = new ProductDefinitionCommand();
+ productDefinitionCommand.setAction(ProductDefinitionCommand.Action.DEACTIVATE.name());
+ productDefinitionCommand.setNote(RandomStringUtils.randomAlphanumeric(2048));
+
+ super.depositAccountManager.process(productDefinition.getIdentifier(), productDefinitionCommand);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION_COMMAND, productDefinition.getIdentifier());
+
+ final ProductDefinition fetchProductDefinition = super.depositAccountManager.findProductDefinition(productDefinition.getIdentifier());
+
+ Assert.assertFalse(fetchProductDefinition.getActive());
+
+ this.mockMvc.perform(put(path + "/definitions/" + productDefinition.getIdentifier())
+ .accept(MediaType.APPLICATION_JSON_VALUE)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(fetchProductDefinition.getIdentifier()))
+ .andExpect(status().is4xxClientError());
+ }
+
+ @Test
+ public void shouldAllowCommandWithNullNote() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductDefinitionCommand productDefinitionCommand = new ProductDefinitionCommand();
+ productDefinitionCommand.setAction(ProductDefinitionCommand.Action.DEACTIVATE.name());
+
+ super.depositAccountManager.process(productDefinition.getIdentifier(), productDefinitionCommand);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION_COMMAND, productDefinition.getIdentifier());
+
+ final ProductDefinition fetchProductDefinition = super.depositAccountManager.findProductDefinition(productDefinition.getIdentifier());
+
+ Assert.assertFalse(fetchProductDefinition.getActive());
+ }
+
+ @Test
+ public void shouldDeleteProductDefinition() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ super.depositAccountManager.deleteProductDefinition(productDefinition.getIdentifier());
+
+ Assert.assertTrue(super.eventRecorder.wait(EventConstants.DELETE_PRODUCT_DEFINITION, productDefinition.getIdentifier()));
+
+ this.mockMvc.perform(delete(path + "/definitions/" + productDefinition.getIdentifier())
+ .accept(MediaType.ALL_VALUE)
+ .contentType(MediaType.APPLICATION_JSON_VALUE).content(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(status().isNotFound());
+ }
+
+ @Test
+ public void shouldDeleteProductDefinitionEvenWhenActed() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductDefinitionCommand activateProduct = new ProductDefinitionCommand();
+ activateProduct.setAction(ProductDefinitionCommand.Action.ACTIVATE.name());
+ activateProduct.setNote(RandomStringUtils.randomAlphanumeric(2048));
+
+ super.depositAccountManager.process(productDefinition.getIdentifier(), activateProduct);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION_COMMAND, productDefinition.getIdentifier());
+
+ final ProductDefinitionCommand deactivateProduct = new ProductDefinitionCommand();
+ deactivateProduct.setAction(ProductDefinitionCommand.Action.DEACTIVATE.name());
+ deactivateProduct.setNote(RandomStringUtils.randomAlphanumeric(2048));
+
+ super.depositAccountManager.process(productDefinition.getIdentifier(), deactivateProduct);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION_COMMAND, productDefinition.getIdentifier());
+
+ super.depositAccountManager.deleteProductDefinition(productDefinition.getIdentifier());
+
+ Assert.assertTrue(super.eventRecorder.wait(EventConstants.DELETE_PRODUCT_DEFINITION, productDefinition.getIdentifier()));
+ }
+
+ @Test(expected = ProductDefinitionValidationException.class)
+ public void shouldNotDeleteProductDefinitionInstanceExists() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+
+ this.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ super.depositAccountManager.deleteProductDefinition(productDefinition.getIdentifier());
+ }
+
+ @Test
+ public void shouldUpdateProductDefinition() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductDefinition newProductDefinition = Fixture.productDefinition();
+
+ newProductDefinition.setIdentifier(productDefinition.getIdentifier());
+
+ super.depositAccountManager.changeProductDefinition(newProductDefinition.getIdentifier(), newProductDefinition);
+
+ Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_PRODUCT_DEFINITION, newProductDefinition.getIdentifier()));
+
+ final ProductDefinition fetchedProductDefinition = super.depositAccountManager.findProductDefinition(newProductDefinition.getIdentifier());
+
+ Assert.assertNotNull(fetchedProductDefinition);
+
+ this.mockMvc.perform(put(path + "/definitions/" + productDefinition.getIdentifier())
+ .accept(MediaType.APPLICATION_JSON_VALUE)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(productDefinition.getIdentifier()))
+ .andExpect(status().is4xxClientError());
+ }
+
+ @Test(expected = ProductDefinitionValidationException.class)
+ public void shouldNotUpdateProductDefinitionIdentifierMismatch() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ super.depositAccountManager.changeProductDefinition(productDefinition.getIdentifier(), Fixture.productDefinition());
+ }
+
+ @Test(expected = ProductDefinitionValidationException.class)
+ public void shouldNotUpdateProductDefinitionInterestNotFlexible() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+ productDefinition.setFlexible(Boolean.FALSE);
+ productDefinition.setInterest(5.00D);
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+ productDefinition.setInterest(10.0D);
+
+ super.depositAccountManager.changeProductDefinition(productDefinition.getIdentifier(), Fixture.productDefinition());
+ }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/TestProductInstance.java b/service/src/test/java/org/apache/fineract/cn/deposit/TestProductInstance.java
new file mode 100644
index 0000000..6f35993
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/TestProductInstance.java
@@ -0,0 +1,482 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit;
+
+import com.google.common.collect.Sets;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.Charge;
+import org.apache.fineract.cn.deposit.api.v1.definition.domain.ProductDefinition;
+import org.apache.fineract.cn.deposit.api.v1.instance.ProductInstanceNotFoundException;
+import org.apache.fineract.cn.deposit.api.v1.instance.ProductInstanceValidationException;
+import org.apache.fineract.cn.deposit.api.v1.instance.domain.AvailableTransactionType;
+import org.apache.fineract.cn.deposit.api.v1.instance.domain.ProductInstance;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import java.util.*;
+
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.put;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class TestProductInstance extends AbstractDepositAccountManagementTest {
+
+ public TestProductInstance() {
+ super();
+ }
+
+ @Rule
+ public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("src/doc/generated-snippets/test-instances");
+
+ @Autowired
+ private WebApplicationContext context;
+
+ private MockMvc mockMvc;
+
+ final String path = "/deposit/v1";
+
+ @Before
+ public void setUp(){
+
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+ .apply(documentationConfiguration(this.restDocumentation))
+ .alwaysDo(document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+ .build();
+ }
+
+ @Test
+ public void shouldCreateProductInstance() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final List<ProductInstance> productInstances = super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+ Assert.assertNotNull(productInstances);
+ Assert.assertEquals(1, productInstances.size());
+ final ProductInstance foundProductInstance = productInstances.get(0);
+
+ Assert.assertEquals(productInstance.getCustomerIdentifier() + "." + productDefinition.getEquityLedgerIdentifier() + ".00001",
+ foundProductInstance.getAccountIdentifier());
+ Assert.assertFalse(foundProductInstance.getBeneficiaries().isEmpty());
+
+ this.mockMvc.perform(post(path + "/instances").accept(MediaType.APPLICATION_JSON_VALUE)
+ .contentType(MediaType.APPLICATION_JSON_VALUE)
+ .content(productInstance.getProductIdentifier()))
+ .andExpect(status().isNotFound());
+ }
+
+ @Test
+ public void shouldActivateProductInstance() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final List<ProductInstance> productInstances = super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+ Assert.assertNotNull(productInstances);
+ Assert.assertEquals(1, productInstances.size());
+ final ProductInstance foundProductInstance = productInstances.get(0);
+
+ super.depositAccountManager.postProductInstanceCommand(
+ foundProductInstance.getAccountIdentifier(), EventConstants.ACTIVATE_PRODUCT_INSTANCE_COMMAND);
+
+ Assert.assertTrue(
+ super.eventRecorder.wait(EventConstants.ACTIVATE_PRODUCT_INSTANCE,
+ foundProductInstance.getAccountIdentifier()));
+
+ final ProductInstance activatedProductInstance = super.depositAccountManager.findProductInstance(foundProductInstance.getAccountIdentifier());
+ Assert.assertNotNull(activatedProductInstance.getOpenedOn());
+
+ this.mockMvc.perform(put(path + "/instances/" + productInstance.getProductIdentifier())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(productInstance.getProductIdentifier()))
+ .andExpect(status().is4xxClientError());
+ }
+
+ @Test
+ public void shouldCloseProductInstance() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+ final String openedOn = "2013-05-08";
+ productInstance.setOpenedOn(openedOn);
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final List<ProductInstance> productInstances = super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+ Assert.assertNotNull(productInstances);
+ Assert.assertEquals(1, productInstances.size());
+ final ProductInstance foundProductInstance = productInstances.get(0);
+ Assert.assertEquals(openedOn, foundProductInstance.getOpenedOn());
+
+ super.depositAccountManager.postProductInstanceCommand(
+ foundProductInstance.getAccountIdentifier(), EventConstants.CLOSE_PRODUCT_INSTANCE_COMMAND);
+
+ Assert.assertTrue(
+ super.eventRecorder.wait(EventConstants.CLOSE_PRODUCT_INSTANCE,
+ foundProductInstance.getAccountIdentifier()));
+
+ this.mockMvc.perform(put(path + "/instances/" + productInstance.getProductIdentifier())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(productInstance.getProductIdentifier()))
+ .andExpect(status().is4xxClientError());
+ }
+
+ @Test
+ public void shouldUpdateProductInstance() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final List<ProductInstance> productInstances =
+ super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+
+ Assert.assertEquals(1, productInstances.size());
+
+ final ProductInstance fetchedProductInstance = productInstances.get(0);
+
+ final HashSet<String> newBeneficiaries = new HashSet<>(Arrays.asList("one", "two"));
+
+ fetchedProductInstance.setBeneficiaries(newBeneficiaries);
+
+ final Account account = new Account();
+ account.setIdentifier(fetchedProductInstance.getAccountIdentifier());
+ account.setName(RandomStringUtils.randomAlphanumeric(256));
+ account.setLedger(RandomStringUtils.randomAlphanumeric(32));
+ account.setBalance(0.00D);
+
+ Mockito.doAnswer(invocation -> account)
+ .when(super.accountingServiceSpy).findAccount(fetchedProductInstance.getAccountIdentifier());
+
+ super.depositAccountManager.changeProductInstance(fetchedProductInstance.getAccountIdentifier(),
+ fetchedProductInstance);
+
+ Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_PRODUCT_INSTANCE,
+ fetchedProductInstance.getAccountIdentifier()));
+
+ this.mockMvc.perform(put(path + "/instances/" + productInstance.getProductIdentifier())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(productInstance.getProductIdentifier()))
+ .andExpect(status().is4xxClientError());
+ }
+
+ @Test(expected = ProductInstanceValidationException.class)
+ public void shouldNotUpdateProductInstanceIdentifierMismatch() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ productInstance.setBeneficiaries(null);
+
+ super.depositAccountManager.changeProductInstance("identifiermissmatch", productInstance);
+ }
+
+ @Test
+ public void shouldNotUpdateProductInstanceNoChangeDetected() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final List<ProductInstance> productInstances =
+ super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+
+ Assert.assertEquals(1, productInstances.size());
+
+ final ProductInstance fetchedProductInstance = productInstances.get(0);
+
+ super.depositAccountManager.changeProductInstance(fetchedProductInstance.getAccountIdentifier(),
+ fetchedProductInstance);
+
+ Assert.assertFalse(super.eventRecorder.wait(EventConstants.PUT_PRODUCT_INSTANCE,
+ fetchedProductInstance.getAccountIdentifier()));
+ }
+
+ @Test
+ public void shouldFindProductInstance() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final Account account = new Account();
+ account.setBalance(1234.56D);
+
+ final List<ProductInstance> productInstances =
+ super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+
+ Assert.assertEquals(1, productInstances.size());
+
+ final ProductInstance fetchedProductInstance = productInstances.get(0);
+
+ Mockito.doAnswer(invocation -> account)
+ .when(super.accountingServiceSpy).findAccount(fetchedProductInstance.getAccountIdentifier());
+
+ final ProductInstance foundProductInstance =
+ super.depositAccountManager.findProductInstance(fetchedProductInstance.getAccountIdentifier());
+
+ Assert.assertNotNull(foundProductInstance);
+ Assert.assertEquals(account.getBalance(), foundProductInstance.getBalance());
+
+ try
+ {
+ this.mockMvc.perform(get(path + "/instances")
+ .accept(MediaType.ALL_VALUE).contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(status().isNotFound());
+ } catch (Exception exception){ exception.printStackTrace(); }
+ }
+
+ @Test(expected = ProductInstanceNotFoundException.class)
+ public void shouldNotFindProductInstanceNotFound() {
+ super.depositAccountManager.findProductInstance(RandomStringUtils.randomAlphanumeric(32));
+ }
+
+ @Test
+ public void shouldOpenAccountAfterUpdatingDefinition() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final Charge openingCharge = new Charge();
+ openingCharge.setActionIdentifier("Open");
+ openingCharge.setAmount(5.00D);
+ openingCharge.setName("Opening Account Charge");
+ openingCharge.setIncomeAccountIdentifier("10123");
+ openingCharge.setProportional(Boolean.TRUE);
+
+ productDefinition.setCharges(new HashSet<>(Arrays.asList(openingCharge)));
+
+ super.depositAccountManager.changeProductDefinition(productDefinition.getIdentifier(), productDefinition);
+
+ super.eventRecorder.wait(EventConstants.PUT_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final List<ProductInstance> productInstances = super.depositAccountManager.fetchProductInstances(productInstance.getCustomerIdentifier());
+ final ProductInstance fetchedProductInstance = productInstances.get(0);
+
+ super.depositAccountManager.postProductInstanceCommand(
+ fetchedProductInstance.getAccountIdentifier(), EventConstants.ACTIVATE_PRODUCT_INSTANCE_COMMAND);
+
+ Assert.assertTrue(
+ super.eventRecorder.wait(EventConstants.ACTIVATE_PRODUCT_INSTANCE,
+ fetchedProductInstance.getAccountIdentifier()));
+ }
+
+ @Test
+ public void shouldFindAvailableTransactionTypes() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final Set<AvailableTransactionType> availableTransactionTypesBeforeActivation =
+ super.depositAccountManager.fetchPossibleTransactionTypes(productInstance.getCustomerIdentifier());
+
+ Assert.assertFalse(availableTransactionTypesBeforeActivation.isEmpty());
+ Assert.assertTrue(availableTransactionTypesBeforeActivation.size() == 1);
+ final Optional<AvailableTransactionType> optionalTransactionType =
+ availableTransactionTypesBeforeActivation.stream().findFirst();
+ Assert.assertTrue(optionalTransactionType.isPresent());
+ Assert.assertEquals("ACCO", optionalTransactionType.get().getTransactionType());
+
+ final List<ProductInstance> productInstances = super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+ Assert.assertNotNull(productInstances);
+ Assert.assertEquals(1, productInstances.size());
+ final ProductInstance foundProductInstance = productInstances.get(0);
+
+ super.depositAccountManager.postProductInstanceCommand(
+ foundProductInstance.getAccountIdentifier(), EventConstants.ACTIVATE_PRODUCT_INSTANCE_COMMAND);
+
+ super.eventRecorder.wait(EventConstants.ACTIVATE_PRODUCT_INSTANCE, foundProductInstance.getAccountIdentifier());
+
+ final Set<AvailableTransactionType> availableTransactionTypesAfterActivation =
+ super.depositAccountManager.fetchPossibleTransactionTypes(productInstance.getCustomerIdentifier());
+
+ Assert.assertFalse(availableTransactionTypesAfterActivation.isEmpty());
+ Assert.assertTrue(availableTransactionTypesAfterActivation.size() == 5);
+ final HashSet<String> expectedTransactionTypes = Sets.newHashSet("ACCC", "ACCT", "CDPT", "CWDL", "CCHQ");
+ availableTransactionTypesAfterActivation.forEach(availableTransactionType ->
+ expectedTransactionTypes.remove(availableTransactionType.getTransactionType())
+ );
+
+ Assert.assertTrue(expectedTransactionTypes.isEmpty());
+
+ try
+ {
+ this.mockMvc.perform(get(path + "/instances/transactiontypes")
+ .accept(MediaType.ALL_VALUE).contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(status().isNotFound());
+ } catch (Exception exception){ exception.printStackTrace(); }
+ }
+
+ @Test
+ public void shouldAddTransactionDateProductInstance() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final List<ProductInstance> productInstances = super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+ Assert.assertNotNull(productInstances);
+ Assert.assertEquals(1, productInstances.size());
+ final ProductInstance foundProductInstance = productInstances.get(0);
+
+ super.depositAccountManager.postProductInstanceCommand(
+ foundProductInstance.getAccountIdentifier(), EventConstants.ACTIVATE_PRODUCT_INSTANCE_COMMAND);
+
+ Assert.assertTrue(
+ super.eventRecorder.wait(EventConstants.ACTIVATE_PRODUCT_INSTANCE,
+ foundProductInstance.getAccountIdentifier()));
+
+ super.depositAccountManager.postProductInstanceCommand(
+ foundProductInstance.getAccountIdentifier(), EventConstants.PRODUCT_INSTANCE_TRANSACTION);
+
+ Assert.assertTrue(
+ super.eventRecorder.wait(EventConstants.PUT_PRODUCT_INSTANCE,
+ foundProductInstance.getAccountIdentifier()));
+
+ final List<ProductInstance> transactedProductInstances = super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+ Assert.assertNotNull(transactedProductInstances);
+ Assert.assertEquals(1, transactedProductInstances.size());
+ final ProductInstance transactedProductInstance = transactedProductInstances.get(0);
+ Assert.assertNotNull(transactedProductInstance.getLastTransactionDate());
+ }
+
+ @Test
+ public void shouldSetAlternativeAccountAndBalanceProductInstance() throws Exception {
+ final ProductDefinition productDefinition = Fixture.productDefinition();
+
+ super.depositAccountManager.create(productDefinition);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, productDefinition.getIdentifier());
+
+ final ProductInstance productInstance = Fixture.productInstance(productDefinition.getIdentifier());
+ productInstance.setAlternativeAccountNumber("08154711");
+ productInstance.setBalance(1000.00D);
+
+ super.depositAccountManager.create(productInstance);
+
+ super.eventRecorder.wait(EventConstants.POST_PRODUCT_INSTANCE, productInstance.getCustomerIdentifier());
+
+ final Account dummy = new Account();
+ dummy.setAlternativeAccountNumber(productInstance.getAlternativeAccountNumber());
+ dummy.setBalance(productInstance.getBalance());
+ Mockito
+ .doAnswer(invocation -> dummy)
+ .when(super.accountingServiceSpy).findAccount(Matchers.anyString());
+
+ final List<ProductInstance> productInstances = super.depositAccountManager.findProductInstances(productDefinition.getIdentifier());
+ Assert.assertNotNull(productInstances);
+ Assert.assertEquals(1, productInstances.size());
+ final ProductInstance foundProductInstance = productInstances.get(0);
+ Assert.assertNotNull(foundProductInstance.getAccountIdentifier());
+ Assert.assertNotEquals(productInstance.getAlternativeAccountNumber(), foundProductInstance.getAccountIdentifier());
+ Assert.assertEquals(productInstance.getAlternativeAccountNumber(), foundProductInstance.getAlternativeAccountNumber());
+ Assert.assertEquals(productInstance.getBalance(), foundProductInstance.getBalance());
+ }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/TestSuite.java b/service/src/test/java/org/apache/fineract/cn/deposit/TestSuite.java
new file mode 100644
index 0000000..a412f90
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/TestSuite.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Myrle Krantz
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TestProductDefinition.class,
+ TestProductInstance.class,
+ TestActions.class,
+ TestAccrual.class,
+ TestDividendDistribution.class
+})
+public class TestSuite extends SuiteTestEnvironment {
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/listener/ActionEventListener.java b/service/src/test/java/org/apache/fineract/cn/deposit/listener/ActionEventListener.java
new file mode 100644
index 0000000..698efc7
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/listener/ActionEventListener.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit.listener;
+
+import org.apache.fineract.cn.deposit.AbstractDepositAccountManagementTest;
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
+import org.apache.fineract.cn.test.listener.EventRecorder;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ActionEventListener {
+
+ private final Logger logger;
+ private final EventRecorder eventRecorder;
+
+ @Autowired
+ public ActionEventListener(@Qualifier(AbstractDepositAccountManagementTest.TEST_LOGGER) final Logger logger,
+ final EventRecorder eventRecorder) {
+ super();
+ this.logger = logger;
+ this.eventRecorder = eventRecorder;
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_POST_PRODUCT_ACTION,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onCreateAction(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Action created.");
+ this.eventRecorder.event(tenant, EventConstants.POST_PRODUCT_ACTION, payload, String.class);
+ }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/listener/InterestCalculationEventListener.java b/service/src/test/java/org/apache/fineract/cn/deposit/listener/InterestCalculationEventListener.java
new file mode 100644
index 0000000..a658151
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/listener/InterestCalculationEventListener.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit.listener;
+
+import org.apache.fineract.cn.deposit.AbstractDepositAccountManagementTest;
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
+import org.apache.fineract.cn.test.listener.EventRecorder;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+
+@Component
+public class InterestCalculationEventListener {
+
+ private final Logger logger;
+ private final EventRecorder eventRecorder;
+
+ @Autowired
+ public InterestCalculationEventListener(@Qualifier(AbstractDepositAccountManagementTest.TEST_LOGGER) final Logger logger,
+ final EventRecorder eventRecorder) {
+ super();
+ this.logger = logger;
+ this.eventRecorder = eventRecorder;
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_INTEREST_ACCRUED,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onAccrual(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Accrual processed, payload: {}.", payload);
+ this.eventRecorder.event(tenant, EventConstants.INTEREST_ACCRUED, payload, String.class);
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_DIVIDEND_DISTRIBUTION,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onDividendDistribution(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Dividend distributed for product {}.", payload);
+ this.eventRecorder.event(tenant, EventConstants.DIVIDEND_DISTRIBUTION, payload, String.class);
+ }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/listener/MigrationEventListener.java b/service/src/test/java/org/apache/fineract/cn/deposit/listener/MigrationEventListener.java
new file mode 100644
index 0000000..b1cec08
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/listener/MigrationEventListener.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit.listener;
+
+import org.apache.fineract.cn.deposit.AbstractDepositAccountManagementTest;
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
+import org.apache.fineract.cn.test.listener.EventRecorder;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MigrationEventListener {
+
+ private final Logger logger;
+ private final EventRecorder eventRecorder;
+
+ @Autowired
+ public MigrationEventListener(@Qualifier(AbstractDepositAccountManagementTest.TEST_LOGGER) final Logger logger,
+ final EventRecorder eventRecorder) {
+ super();
+ this.logger = logger;
+ this.eventRecorder = eventRecorder;
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_INITIALIZE,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onInitialize(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Service initialized.");
+ this.eventRecorder.event(tenant, EventConstants.INITIALIZE, payload, String.class);
+ }
+
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/listener/ProductDefinitionEventListener.java b/service/src/test/java/org/apache/fineract/cn/deposit/listener/ProductDefinitionEventListener.java
new file mode 100644
index 0000000..d7c3a68
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/listener/ProductDefinitionEventListener.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit.listener;
+
+import org.apache.fineract.cn.deposit.AbstractDepositAccountManagementTest;
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
+import org.apache.fineract.cn.test.listener.EventRecorder;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ProductDefinitionEventListener {
+
+ private final Logger logger;
+ private final EventRecorder eventRecorder;
+
+ @Autowired
+ public ProductDefinitionEventListener(@Qualifier(AbstractDepositAccountManagementTest.TEST_LOGGER) final Logger logger,
+ final EventRecorder eventRecorder) {
+ super();
+ this.logger = logger;
+ this.eventRecorder = eventRecorder;
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_POST_PRODUCT_DEFINITION,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onCreateProductDefinition(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Product definition created.");
+ this.eventRecorder.event(tenant, EventConstants.POST_PRODUCT_DEFINITION, payload, String.class);
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_POST_PRODUCT_COMMAND,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onActivateProductDefinition(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Product definition activated.");
+ this.eventRecorder.event(tenant, EventConstants.POST_PRODUCT_DEFINITION_COMMAND, payload, String.class);
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_DELETE_PRODUCT_DEFINITION,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onDeleteProductDefinition(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Product definition activated.");
+ this.eventRecorder.event(tenant, EventConstants.DELETE_PRODUCT_DEFINITION, payload, String.class);
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_PUT_PRODUCT_DEFINITION,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onChangeProductDefinition(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Product definition activated.");
+ this.eventRecorder.event(tenant, EventConstants.PUT_PRODUCT_DEFINITION, payload, String.class);
+ }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/deposit/listener/ProductInstanceEventListener.java b/service/src/test/java/org/apache/fineract/cn/deposit/listener/ProductInstanceEventListener.java
new file mode 100644
index 0000000..ee5221b
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/deposit/listener/ProductInstanceEventListener.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.deposit.listener;
+
+import org.apache.fineract.cn.deposit.api.v1.EventConstants;
+import org.apache.fineract.cn.deposit.service.ServiceConstants;
+import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
+import org.apache.fineract.cn.test.listener.EventRecorder;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ProductInstanceEventListener {
+
+ private final Logger logger;
+ private final EventRecorder eventRecorder;
+
+ @Autowired
+ public ProductInstanceEventListener(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+ final EventRecorder eventRecorder) {
+ super();
+ this.logger = logger;
+ this.eventRecorder = eventRecorder;
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_POST_PRODUCT_INSTANCE,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onCreateInstance(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Product instance created.");
+ this.eventRecorder.event(tenant, EventConstants.POST_PRODUCT_INSTANCE, payload, String.class);
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_ACTIVATE_PRODUCT_INSTANCE,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onActivateInstance(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Product instance activated.");
+ this.eventRecorder.event(tenant, EventConstants.ACTIVATE_PRODUCT_INSTANCE, payload, String.class);
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_CLOSE_PRODUCT_INSTANCE,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onCloseInstance(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Product instance closed.");
+ this.eventRecorder.event(tenant, EventConstants.CLOSE_PRODUCT_INSTANCE, payload, String.class);
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_PUT_PRODUCT_INSTANCE,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onUpdateInstance(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.logger.debug("Product instance updated.");
+ this.eventRecorder.event(tenant, EventConstants.PUT_PRODUCT_INSTANCE, payload, String.class);
+ }
+}