You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by aw...@apache.org on 2019/06/03 19:02:35 UTC

[fineract-cn-payroll] branch develop updated (bcb953f -> 676ff48)

This is an automated email from the ASF dual-hosted git repository.

awasum pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git.


    from bcb953f  Merge pull request #10 from Anh3h/develop
     new 3b540cc  Adding rat report to After Failure procedure
     new 676ff48  Merge pull request #11 from ebenezergraham/FINCN-157

The 50 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .travis.yml   | 3 +++
 shared.gradle | 1 +
 2 files changed, 4 insertions(+)


[fineract-cn-payroll] 02/50: Making headers consistent.

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit ba7f6cf26b7917e20720b4678cefb4205987aa6c
Author: myrle-krantz <mk...@mifos.org>
AuthorDate: Tue Apr 4 16:50:52 2017 +0200

    Making headers consistent.
---
 api/src/main/java/io/mifos/template/api/v1/EventConstants.java          | 2 +-
 api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java     | 2 +-
 .../main/java/io/mifos/template/api/v1/client/IamATeapotException.java  | 2 +-
 api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java  | 2 +-
 api/src/main/java/io/mifos/template/api/v1/domain/Sample.java           | 2 +-
 component-test/src/main/java/io/mifos/template/TestSample.java          | 2 +-
 .../main/java/io/mifos/template/listener/MigrationEventListener.java    | 2 +-
 .../src/main/java/io/mifos/template/listener/SampleEventListener.java   | 2 +-
 service/src/main/java/io/mifos/template/service/ServiceConstants.java   | 2 +-
 .../src/main/java/io/mifos/template/service/TemplateApplication.java    | 2 +-
 .../src/main/java/io/mifos/template/service/TemplateConfiguration.java  | 2 +-
 .../template/service/internal/command/InitializeServiceCommand.java     | 2 +-
 .../java/io/mifos/template/service/internal/command/SampleCommand.java  | 2 +-
 .../template/service/internal/command/handler/MigrationAggregate.java   | 2 +-
 .../template/service/internal/command/handler/SampleAggregate.java      | 2 +-
 .../java/io/mifos/template/service/internal/mapper/SampleMapper.java    | 2 +-
 .../io/mifos/template/service/internal/repository/SampleJpaEntity.java  | 2 +-
 .../template/service/internal/repository/SampleJpaEntityRepository.java | 2 +-
 .../java/io/mifos/template/service/internal/service/SampleService.java  | 2 +-
 .../main/java/io/mifos/template/service/rest/SampleRestController.java  | 2 +-
 service/src/main/resources/application.yml                              | 2 +-
 service/src/main/resources/bootstrap.yml                                | 2 +-
 service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql  | 2 +-
 23 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/api/src/main/java/io/mifos/template/api/v1/EventConstants.java b/api/src/main/java/io/mifos/template/api/v1/EventConstants.java
index ec508b0..69b1343 100644
--- a/api/src/main/java/io/mifos/template/api/v1/EventConstants.java
+++ b/api/src/main/java/io/mifos/template/api/v1/EventConstants.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java b/api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java
index 2a3bdb1..239e2ac 100644
--- a/api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java
+++ b/api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/api/src/main/java/io/mifos/template/api/v1/client/IamATeapotException.java b/api/src/main/java/io/mifos/template/api/v1/client/IamATeapotException.java
index c1c9e74..ec4383c 100644
--- a/api/src/main/java/io/mifos/template/api/v1/client/IamATeapotException.java
+++ b/api/src/main/java/io/mifos/template/api/v1/client/IamATeapotException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java b/api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java
index 6b0cb4c..9914e36 100644
--- a/api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java
+++ b/api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/api/src/main/java/io/mifos/template/api/v1/domain/Sample.java b/api/src/main/java/io/mifos/template/api/v1/domain/Sample.java
index d3dbd54..6f25719 100644
--- a/api/src/main/java/io/mifos/template/api/v1/domain/Sample.java
+++ b/api/src/main/java/io/mifos/template/api/v1/domain/Sample.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/component-test/src/main/java/io/mifos/template/TestSample.java b/component-test/src/main/java/io/mifos/template/TestSample.java
index ea40b09..b829355 100644
--- a/component-test/src/main/java/io/mifos/template/TestSample.java
+++ b/component-test/src/main/java/io/mifos/template/TestSample.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java b/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
index 3f67928..82408bb 100644
--- a/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
+++ b/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java b/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java
index 6f547a4..2e3c2cb 100644
--- a/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java
+++ b/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/ServiceConstants.java b/service/src/main/java/io/mifos/template/service/ServiceConstants.java
index e9ee910..e9e0623 100644
--- a/service/src/main/java/io/mifos/template/service/ServiceConstants.java
+++ b/service/src/main/java/io/mifos/template/service/ServiceConstants.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/TemplateApplication.java b/service/src/main/java/io/mifos/template/service/TemplateApplication.java
index bd2464b..7ca88f0 100644
--- a/service/src/main/java/io/mifos/template/service/TemplateApplication.java
+++ b/service/src/main/java/io/mifos/template/service/TemplateApplication.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java b/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java
index 2b6ce06..d0fd484 100644
--- a/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java
+++ b/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java b/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java
index 5e8dc63..db85b9d 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java b/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java
index d700762..8ee6d92 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
index 6108d06..e4e3de1 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
index 7109b49..4de453a 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/internal/mapper/SampleMapper.java b/service/src/main/java/io/mifos/template/service/internal/mapper/SampleMapper.java
index de36734..983b5d5 100644
--- a/service/src/main/java/io/mifos/template/service/internal/mapper/SampleMapper.java
+++ b/service/src/main/java/io/mifos/template/service/internal/mapper/SampleMapper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntity.java b/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntity.java
index c8c741e..9cbcd73 100644
--- a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntity.java
+++ b/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java b/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
index 3f5539e..87ea8a7 100644
--- a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
+++ b/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/internal/service/SampleService.java b/service/src/main/java/io/mifos/template/service/internal/service/SampleService.java
index 5b4be95..caba840 100644
--- a/service/src/main/java/io/mifos/template/service/internal/service/SampleService.java
+++ b/service/src/main/java/io/mifos/template/service/internal/service/SampleService.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/java/io/mifos/template/service/rest/SampleRestController.java b/service/src/main/java/io/mifos/template/service/rest/SampleRestController.java
index 9cce47d..9919252 100644
--- a/service/src/main/java/io/mifos/template/service/rest/SampleRestController.java
+++ b/service/src/main/java/io/mifos/template/service/rest/SampleRestController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 The Mifos Initiative
+ * Copyright 2017 The Mifos Initiative.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml
index 1859323..8b395ca 100644
--- a/service/src/main/resources/application.yml
+++ b/service/src/main/resources/application.yml
@@ -1,5 +1,5 @@
 #
-# Copyright 2017 The Mifos Initiative
+# Copyright 2017 The Mifos Initiative.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/service/src/main/resources/bootstrap.yml b/service/src/main/resources/bootstrap.yml
index b814525..6b9e3e8 100644
--- a/service/src/main/resources/bootstrap.yml
+++ b/service/src/main/resources/bootstrap.yml
@@ -1,5 +1,5 @@
 #
-# Copyright 2017 The Mifos Initiative
+# Copyright 2017 The Mifos Initiative.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql b/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
index 3719a09..fb1b54e 100644
--- a/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
+++ b/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
@@ -1,5 +1,5 @@
 --
--- Copyright 2017 The Mifos Initiative
+-- Copyright 2017 The Mifos Initiative.
 --
 -- Licensed under the Apache License, Version 2.0 (the "License");
 -- you may not use this file except in compliance with the License.


[fineract-cn-payroll] 01/50: Initial Commit

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit e51bec140fe7f7f19a1fa8ac5f89e44c50359919
Author: Markus Geiss <mg...@mifos.org>
AuthorDate: Wed Mar 15 08:06:19 2017 +0100

    Initial Commit
---
 .gitignore                                         |  16 ++
 HEADER                                             |  13 ++
 LICENSE                                            | 201 +++++++++++++++++++++
 README.md                                          |  66 +++++++
 api/build.gradle                                   |  35 ++++
 api/settings.gradle                                |   1 +
 .../io/mifos/template/api/v1/EventConstants.java   |  27 +++
 .../mifos/template/api/v1/PermittableGroupIds.java |  22 +++
 .../api/v1/client/IamATeapotException.java         |  20 ++
 .../template/api/v1/client/TemplateManager.java    |  57 ++++++
 .../io/mifos/template/api/v1/domain/Sample.java    |  70 +++++++
 build.gradle                                       |  36 ++++
 component-test/build.gradle                        |  38 ++++
 component-test/settings.gradle                     |   1 +
 .../main/java/io/mifos/template/TestSample.java    | 136 ++++++++++++++
 .../template/listener/MigrationEventListener.java  |  47 +++++
 .../template/listener/SampleEventListener.java     |  47 +++++
 gradle/wrapper/gradle-wrapper.jar                  | Bin 0 -> 54212 bytes
 gradle/wrapper/gradle-wrapper.properties           |   6 +
 gradlew                                            | 172 ++++++++++++++++++
 gradlew.bat                                        |  84 +++++++++
 service/build.gradle                               |  63 +++++++
 service/settings.gradle                            |   1 +
 .../mifos/template/service/ServiceConstants.java   |  20 ++
 .../template/service/TemplateApplication.java      |  29 +++
 .../template/service/TemplateConfiguration.java    |  64 +++++++
 .../internal/command/InitializeServiceCommand.java |  23 +++
 .../service/internal/command/SampleCommand.java    |  32 ++++
 .../command/handler/MigrationAggregate.java        |  60 ++++++
 .../internal/command/handler/SampleAggregate.java  |  52 ++++++
 .../service/internal/mapper/SampleMapper.java      |  43 +++++
 .../internal/repository/SampleJpaEntity.java       |  61 +++++++
 .../repository/SampleJpaEntityRepository.java      |  26 +++
 .../service/internal/service/SampleService.java    |  45 +++++
 .../service/rest/SampleRestController.java         | 112 ++++++++++++
 service/src/main/resources/application.yml         |  66 +++++++
 service/src/main/resources/bootstrap.yml           |  19 ++
 .../db/migrations/mariadb/V1__initial_setup.sql    |  22 +++
 settings.gradle                                    |   6 +
 shared.gradle                                      |  69 +++++++
 40 files changed, 1908 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f9d7cba
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,16 @@
+.gradle
+.idea
+build/
+target/
+
+# Ignore Gradle GUI config
+gradle-app.setting
+
+# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
+!gradle-wrapper.jar
+
+*.iml
+
+*.log
+
+*.toDelete
diff --git a/HEADER b/HEADER
new file mode 100644
index 0000000..4b2eadf
--- /dev/null
+++ b/HEADER
@@ -0,0 +1,13 @@
+Copyright ${year} ${name}.
+
+Licensed 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.
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..8dada3e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright {yyyy} {name of copyright owner}
+
+   Licensed 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.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1839633
--- /dev/null
+++ b/README.md
@@ -0,0 +1,66 @@
+# Mifos I/O Template
+
+[![Join the chat at https://gitter.im/mifos-initiative/mifos.io](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mifos-initiative/mifos.io?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+This project provides a template layout for all Mifos I/O microservices.
+
+## Abstract
+Mifos I/O is an application framework for digital financial services, a system to support nationwide and cross-national financial transactions and help to level and speed the creation of an inclusive, interconnected digital economy for every nation in the world.
+
+## Steps needed to turn the template project into a real project
+
+1.  Git clone template into {project name} folder
+
+        git clone https://github.com/mifosio/template.git {project name}
+
+2.  Delete _.git_
+
+        rm -rf .git
+    
+3.  Open settings.gradle and replace value of _rootProject.name_ with {project name}
+
+4.  Open root build.gradle and replace value of _version_ with 0.1.0-snapshot
+
+6.  Create Gradle wrapper
+
+        gradle wrapper
+
+6.  Open all module specific build.gradle files (api, service, and component-test) and replace value of _group_ with io.mifos.{project name}
+
+7.  Import project into IDE
+
+8.  Rename all io.mifos.template packages to io.mifos.{project name}
+
+9.  Open _SampleRestConfiguration_ and _SampleServiceConfiguration_, adjust @ComponentScan to reflect the new package name
+
+10. Open _application.yml_ and replace _server.contextPath_ with /{project name}/v1/*
+
+11. Open _bootstrap.yml_ and replace _spring.application.name_ with {project name}/v1/
+
+12. Open _SampleTest_ and replace constructor argument of TestEnvironment in line 80 with {project name}/v1/
+
+13. Run _SampleTest_
+
+14. Replace the contents of the README with text describing your new project.
+
+15. Happy coding! ; o) 
+
+## Versioning
+The version numbers follow the [Semantic Versioning](http://semver.org/) scheme.
+
+In addition to MAJOR.MINOR.PATCH the following postfixes are used to indicate the development state.
+
+* BUILD-SNAPSHOT - A release currently in development. 
+* M - A _milestone_ release include specific sets of functions and are released as soon as the functionality is complete.
+* RC - A _release candidate_ is a version with potential to be a final product, considered _code complete_.
+* RELEASE - _General availability_ indicates that this release is the best available version and is recommended for all usage.
+
+The versioning layout is {MAJOR}.{MINOR}.{PATCH}-{INDICATOR}[.{PATCH}]. Only milestones and release candidates can  have patch versions. Some examples:
+
+1.2.3.BUILD-SNAPSHOT  
+1.3.5.M.1  
+1.5.7.RC.2  
+2.0.0.RELEASE
+
+## License
+See [LICENSE](LICENSE) file.
diff --git a/api/build.gradle b/api/build.gradle
new file mode 100644
index 0000000..c5b6745
--- /dev/null
+++ b/api/build.gradle
@@ -0,0 +1,35 @@
+buildscript {
+    repositories {
+        jcenter()
+    }
+
+    dependencies {
+        classpath 'io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE'
+    }
+}
+
+plugins {
+    id "com.github.hierynomus.license" version "0.13.1"
+}
+
+apply from: '../shared.gradle'
+
+dependencies {
+    compile(
+            [group: 'org.springframework.cloud', name: 'spring-cloud-starter-feign'],
+            [group: 'io.mifos.core', name: 'api', version: versions.frameworkapi],
+            [group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator],
+            [group: 'org.hibernate', name: 'hibernate-validator-annotation-processor', version: versions.validator]
+    )
+}
+
+publishing {
+    publications {
+        api(MavenPublication) {
+            from components.java
+            groupId project.group
+            artifactId project.name
+            version project.version
+        }
+    }
+}
diff --git a/api/settings.gradle b/api/settings.gradle
new file mode 100644
index 0000000..7c8e3dc
--- /dev/null
+++ b/api/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'api'
\ No newline at end of file
diff --git a/api/src/main/java/io/mifos/template/api/v1/EventConstants.java b/api/src/main/java/io/mifos/template/api/v1/EventConstants.java
new file mode 100644
index 0000000..ec508b0
--- /dev/null
+++ b/api/src/main/java/io/mifos/template/api/v1/EventConstants.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.api.v1;
+
+@SuppressWarnings("unused")
+public interface EventConstants {
+
+  String DESTINATION = "template-v1";
+  String SELECTOR_NAME = "action";
+  String INITIALIZE = "initialize";
+  String POST_SAMPLE = "post-sample";
+  String SELECTOR_INITIALIZE = SELECTOR_NAME + " = '" + INITIALIZE + "'";
+  String SELECTOR_POST_SAMPLE = SELECTOR_NAME + " = '" + POST_SAMPLE + "'";
+}
diff --git a/api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java b/api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java
new file mode 100644
index 0000000..2a3bdb1
--- /dev/null
+++ b/api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.api.v1;
+
+@SuppressWarnings("unused")
+public interface PermittableGroupIds {
+  String SAMPLE_MANAGEMENT = "template__v1__samples";
+  String SELF_MANAGEMENT = "template__v1__self";
+}
diff --git a/api/src/main/java/io/mifos/template/api/v1/client/IamATeapotException.java b/api/src/main/java/io/mifos/template/api/v1/client/IamATeapotException.java
new file mode 100644
index 0000000..c1c9e74
--- /dev/null
+++ b/api/src/main/java/io/mifos/template/api/v1/client/IamATeapotException.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.api.v1.client;
+
+@SuppressWarnings("WeakerAccess")
+public class IamATeapotException extends RuntimeException {
+}
diff --git a/api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java b/api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java
new file mode 100644
index 0000000..6b0cb4c
--- /dev/null
+++ b/api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.api.v1.client;
+
+import io.mifos.core.api.annotation.ThrowsException;
+import io.mifos.core.api.util.CustomFeignClientsConfiguration;
+import io.mifos.template.api.v1.domain.Sample;
+import org.springframework.cloud.netflix.feign.FeignClient;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+@SuppressWarnings("unused")
+@FeignClient(value="template-v1", path="/template/v1", configuration = CustomFeignClientsConfiguration.class)
+public interface TemplateManager {
+
+  @RequestMapping(
+          value = "/sample",
+          method = RequestMethod.GET,
+          produces = MediaType.ALL_VALUE,
+          consumes = MediaType.APPLICATION_JSON_VALUE
+  )
+  List<Sample> findAllEntities();
+
+  @RequestMapping(
+          value = "/sample/{identifier}",
+          method = RequestMethod.GET,
+          produces = MediaType.ALL_VALUE,
+          consumes = MediaType.APPLICATION_JSON_VALUE)
+  Sample getEntity(@PathVariable("identifier") final String identifier);
+
+  @RequestMapping(
+      value = "/sample",
+      method = RequestMethod.POST,
+      produces = MediaType.APPLICATION_JSON_VALUE,
+      consumes = MediaType.APPLICATION_JSON_VALUE
+  )
+  @ThrowsException(status = HttpStatus.I_AM_A_TEAPOT, exception = IamATeapotException.class)
+  void createEntity(final Sample sample);
+}
diff --git a/api/src/main/java/io/mifos/template/api/v1/domain/Sample.java b/api/src/main/java/io/mifos/template/api/v1/domain/Sample.java
new file mode 100644
index 0000000..d3dbd54
--- /dev/null
+++ b/api/src/main/java/io/mifos/template/api/v1/domain/Sample.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.api.v1.domain;
+
+import io.mifos.core.lang.validation.constraints.ValidIdentifier;
+import org.hibernate.validator.constraints.Length;
+
+import java.util.Objects;
+
+@SuppressWarnings({"WeakerAccess", "unused"})
+public class Sample {
+  @ValidIdentifier
+  private String identifier;
+  @Length(max = 512)
+  private String payload;
+
+  public Sample() {
+    super();
+  }
+
+  public static Sample create(final String identifier, final String payload) {
+    final Sample sample = new Sample();
+    sample.setIdentifier(identifier);
+    sample.setPayload(payload);
+    return sample;
+  }
+
+  public String getIdentifier() {
+    return this.identifier;
+  }
+
+  public void setIdentifier(final String identifier) {
+    this.identifier = identifier;
+  }
+
+  public String getPayload() {
+    return payload;
+  }
+
+  public void setPayload(String payload) {
+    this.payload = payload;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+    Sample sample = (Sample) o;
+    return Objects.equals(identifier, sample.identifier) &&
+            Objects.equals(payload, sample.payload);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(identifier, payload);
+  }
+}
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..b30bd55
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,36 @@
+group 'io.mifos'
+
+task publishApiToMavenLocal {
+    dependsOn gradle.includedBuild('api').task(':publishToMavenLocal')
+}
+
+task publishServiceToMavenLocal {
+    mustRunAfter publishApiToMavenLocal
+    dependsOn gradle.includedBuild('service').task(':publishToMavenLocal')
+}
+
+task publishComponentTestToMavenLocal {
+    mustRunAfter publishApiToMavenLocal
+    mustRunAfter publishServiceToMavenLocal
+    dependsOn gradle.includedBuild('component-test').task(':publishToMavenLocal')
+}
+
+task publishToMavenLocal {
+    group 'all'
+    dependsOn publishApiToMavenLocal
+    dependsOn publishServiceToMavenLocal
+    dependsOn publishComponentTestToMavenLocal
+}
+
+task prepareForTest {
+    group 'all'
+    dependsOn publishToMavenLocal
+    dependsOn gradle.includedBuild('component-test').task(':build')
+}
+
+task licenseFormat {
+    group 'all'
+    dependsOn gradle.includedBuild('api').task(':licenseFormat')
+    dependsOn gradle.includedBuild('service').task(':licenseFormat')
+    dependsOn gradle.includedBuild('component-test').task(':licenseFormat')
+}
diff --git a/component-test/build.gradle b/component-test/build.gradle
new file mode 100644
index 0000000..7818273
--- /dev/null
+++ b/component-test/build.gradle
@@ -0,0 +1,38 @@
+buildscript {
+    ext {
+        springBootVersion = '1.4.1.RELEASE'
+    }
+
+    repositories {
+        jcenter()
+    }
+
+    dependencies {
+        classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
+    }
+}
+
+plugins {
+    id "com.github.hierynomus.license" version "0.13.1"
+}
+apply from: '../shared.gradle'
+
+dependencies {
+    compile(
+            [group: 'io.mifos.template', name: 'api', version: project.version],
+            [group: 'io.mifos.template', name: 'service', version: project.version],
+            [group: 'io.mifos.anubis', name: 'test', version: versions.frameworkanubis],
+            [group: 'io.mifos.core', name: 'api', version: versions.frameworkapi],
+            [group: 'io.mifos.core', name: 'test', version: versions.frameworktest],
+            [group: 'io.mifos.core', name: 'lang', version: versions.frameworklang],
+            [group: 'org.springframework.boot', name: 'spring-boot-starter-test']
+    )
+}
+
+publishing {
+    publications {
+        mavenJava(MavenPublication) {
+            from components.java
+        }
+    }
+}
diff --git a/component-test/settings.gradle b/component-test/settings.gradle
new file mode 100644
index 0000000..07867cb
--- /dev/null
+++ b/component-test/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'component-test'
\ No newline at end of file
diff --git a/component-test/src/main/java/io/mifos/template/TestSample.java b/component-test/src/main/java/io/mifos/template/TestSample.java
new file mode 100644
index 0000000..ea40b09
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/template/TestSample.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template;
+
+import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
+import io.mifos.core.api.context.AutoUserContext;
+import io.mifos.core.test.env.TestEnvironment;
+import io.mifos.core.test.fixture.TenantDataStoreContextTestRule;
+import io.mifos.core.test.fixture.cassandra.CassandraInitializer;
+import io.mifos.core.test.fixture.mariadb.MariaDBInitializer;
+import io.mifos.core.test.listener.EnableEventRecording;
+import io.mifos.core.test.listener.EventRecorder;
+import io.mifos.template.api.v1.EventConstants;
+import io.mifos.template.api.v1.client.TemplateManager;
+import io.mifos.template.api.v1.domain.Sample;
+import io.mifos.template.service.TemplateConfiguration;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.*;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TestRule;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+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;
+
+import java.util.List;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
+public class TestSample {
+
+  private static final String APP_NAME = "template-v1";
+
+  @Configuration
+  @EnableEventRecording
+  @EnableFeignClients(basePackages = {"io.mifos.template.api.v1.client"})
+  @RibbonClient(name = APP_NAME)
+  @Import({TemplateConfiguration.class})
+  @ComponentScan("io.mifos.template.listener")
+  public static class TestConfiguration {
+    public TestConfiguration() {
+      super();
+    }
+
+    @Bean()
+    public Logger logger() {
+      return LoggerFactory.getLogger("test-logger");
+    }
+  }
+  private static final String TEST_USER = "homer";
+
+  private final static TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
+  private final static CassandraInitializer cassandraInitializer = new CassandraInitializer();
+  private final static MariaDBInitializer mariaDBInitializer = new MariaDBInitializer();
+  private final static TenantDataStoreContextTestRule tenantDataStoreContext = TenantDataStoreContextTestRule.forRandomTenantName(cassandraInitializer, mariaDBInitializer);
+
+  @ClassRule
+  public static TestRule orderClassRules = RuleChain
+          .outerRule(testEnvironment)
+          .around(cassandraInitializer)
+          .around(mariaDBInitializer)
+          .around(tenantDataStoreContext);
+
+  @Rule
+  public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
+          = new TenantApplicationSecurityEnvironmentTestRule(testEnvironment, this::waitForInitialize);
+
+  private AutoUserContext userContext;
+
+  @Autowired
+  private TemplateManager testSubject;
+
+  @Autowired
+  private EventRecorder eventRecorder;
+
+  public TestSample() {
+    super();
+  }
+
+  @Before
+  public void prepTest() {
+    userContext = tenantApplicationSecurityEnvironment.createAutoUserContext(TestSample.TEST_USER);
+  }
+
+  @After
+  public void cleanTest() {
+    userContext.close();
+    eventRecorder.clear();
+  }
+
+  public boolean waitForInitialize() {
+    try {
+      return this.eventRecorder.wait(EventConstants.INITIALIZE, EventConstants.INITIALIZE);
+    } catch (final InterruptedException e) {
+      throw new IllegalStateException(e);
+    }
+  }
+
+  @Test
+  public void shouldCreateSample() throws InterruptedException {
+    final Sample sample = Sample.create(RandomStringUtils.randomAlphanumeric(8), RandomStringUtils.randomAlphanumeric(512));
+    this.testSubject.createEntity(sample);
+
+    Assert.assertTrue(this.eventRecorder.wait(EventConstants.POST_SAMPLE, sample.getIdentifier()));
+
+    final Sample createdSample = this.testSubject.getEntity(sample.getIdentifier());
+    Assert.assertEquals(sample, createdSample);
+  }
+
+  @Test
+  public void shouldListSamples() {
+    final List<Sample> allEntities = this.testSubject.findAllEntities();
+    Assert.assertNotNull(allEntities);
+  }
+}
diff --git a/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java b/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
new file mode 100644
index 0000000..3f67928
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.listener;
+
+import io.mifos.core.lang.config.TenantHeaderFilter;
+import io.mifos.core.test.listener.EventRecorder;
+import io.mifos.template.api.v1.EventConstants;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+
+@SuppressWarnings("unused")
+@Component
+public class MigrationEventListener {
+
+  private final EventRecorder eventRecorder;
+
+  @Autowired
+  public MigrationEventListener(@SuppressWarnings("SpringJavaAutowiringInspection") final EventRecorder eventRecorder) {
+    super();
+    this.eventRecorder = eventRecorder;
+  }
+
+  @JmsListener(
+      subscription = EventConstants.DESTINATION,
+      destination = EventConstants.DESTINATION,
+      selector = EventConstants.SELECTOR_INITIALIZE
+  )
+  public void onInitialization(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+                               final String payload) {
+    this.eventRecorder.event(tenant, EventConstants.INITIALIZE, payload, String.class);
+  }
+}
diff --git a/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java b/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java
new file mode 100644
index 0000000..6f547a4
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.listener;
+
+import io.mifos.core.lang.config.TenantHeaderFilter;
+import io.mifos.core.test.listener.EventRecorder;
+import io.mifos.template.api.v1.EventConstants;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+
+@SuppressWarnings("unused")
+@Component
+public class SampleEventListener {
+
+  private final EventRecorder eventRecorder;
+
+  @Autowired
+  public SampleEventListener(@SuppressWarnings("SpringJavaAutowiringInspection") final EventRecorder eventRecorder) {
+    super();
+    this.eventRecorder = eventRecorder;
+  }
+
+  @JmsListener(
+      subscription = EventConstants.DESTINATION,
+      destination = EventConstants.DESTINATION,
+      selector = EventConstants.SELECTOR_POST_SAMPLE
+  )
+  public void onCreateSample(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+                             final String payload) {
+    this.eventRecorder.event(tenant, EventConstants.POST_SAMPLE, payload, String.class);
+  }
+}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..400f155
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..2888922
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Mar 17 17:54:20 CET 2017
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-bin.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..4453cce
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+    echo "$*"
+}
+
+die ( ) {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save ( ) {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..e95643d
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/service/build.gradle b/service/build.gradle
new file mode 100644
index 0000000..a9b4de9
--- /dev/null
+++ b/service/build.gradle
@@ -0,0 +1,63 @@
+buildscript {
+    ext {
+        springBootVersion = '1.4.1.RELEASE'
+    }
+
+    repositories {
+        jcenter()
+    }
+
+    dependencies {
+        classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
+    }
+}
+
+plugins {
+    id "com.github.hierynomus.license" version "0.13.1"
+}
+
+apply from: '../shared.gradle'
+
+apply plugin: 'spring-boot'
+
+springBoot {
+    executable = true
+    classifier = 'boot'
+}
+
+dependencies {
+    compile(
+            [group: 'org.springframework.cloud', name: 'spring-cloud-starter-config'],
+            [group: 'org.springframework.cloud', name: 'spring-cloud-starter-eureka'],
+            [group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'],
+            [group: 'io.mifos.template', name: 'api', version: project.version],
+            [group: 'io.mifos.anubis', name: 'library', version: versions.frameworkanubis],
+            [group: 'com.google.code.gson', name: 'gson'],
+            [group: 'io.mifos.core', name: 'lang', version: versions.frameworklang],
+            [group: 'io.mifos.core', name: 'async', version: versions.frameworkasync],
+            [group: 'io.mifos.core', name: 'cassandra', version: versions.frameworkcassandra],
+            [group: 'io.mifos.core', name: 'mariadb', version: versions.frameworkmariadb],
+            [group: 'io.mifos.core', name: 'command', version: versions.frameworkcommand],
+            [group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator]
+    )
+}
+
+publishToMavenLocal.dependsOn bootRepackage
+
+publishing {
+    publications {
+        service(MavenPublication) {
+            from components.java
+            groupId project.group
+            artifactId project.name
+            version project.version
+        }
+        bootService(MavenPublication) {
+            // "boot" jar
+            artifact ("$buildDir/libs/$project.name-$version-boot.jar")
+            groupId project.group
+            artifactId ("$project.name-boot")
+            version project.version
+        }
+    }
+}
diff --git a/service/settings.gradle b/service/settings.gradle
new file mode 100644
index 0000000..081feb4
--- /dev/null
+++ b/service/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'service'
\ No newline at end of file
diff --git a/service/src/main/java/io/mifos/template/service/ServiceConstants.java b/service/src/main/java/io/mifos/template/service/ServiceConstants.java
new file mode 100644
index 0000000..e9ee910
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/ServiceConstants.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service;
+
+public interface ServiceConstants {
+  String LOGGER_NAME = "rest-logger";
+}
diff --git a/service/src/main/java/io/mifos/template/service/TemplateApplication.java b/service/src/main/java/io/mifos/template/service/TemplateApplication.java
new file mode 100644
index 0000000..bd2464b
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/TemplateApplication.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service;
+
+import org.springframework.boot.SpringApplication;
+
+public class TemplateApplication {
+
+  public TemplateApplication() {
+    super();
+  }
+
+  public static void main(String[] args) {
+    SpringApplication.run(TemplateConfiguration.class, args);
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java b/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java
new file mode 100644
index 0000000..2b6ce06
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service;
+
+import io.mifos.anubis.config.EnableAnubis;
+import io.mifos.core.async.config.EnableAsync;
+import io.mifos.core.cassandra.config.EnableCassandra;
+import io.mifos.core.command.config.EnableCommandProcessing;
+import io.mifos.core.lang.config.EnableServiceException;
+import io.mifos.core.lang.config.EnableTenantContext;
+import io.mifos.core.mariadb.config.EnableMariaDB;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+
+@SuppressWarnings("WeakerAccess")
+@Configuration
+@EnableAutoConfiguration
+@EnableDiscoveryClient
+@EnableAsync
+@EnableTenantContext
+@EnableCassandra
+@EnableMariaDB
+@EnableCommandProcessing
+@EnableAnubis
+@EnableServiceException
+@ComponentScan({
+    "io.mifos.template.service.rest",
+    "io.mifos.template.service.internal.service",
+    "io.mifos.template.service.internal.repository",
+    "io.mifos.template.service.internal.command.handler"
+})
+@EnableJpaRepositories({
+    "io.mifos.template.service.internal.repository"
+})
+public class TemplateConfiguration {
+
+  public TemplateConfiguration() {
+    super();
+  }
+
+  @Bean(name = ServiceConstants.LOGGER_NAME)
+  public Logger logger() {
+    return LoggerFactory.getLogger(ServiceConstants.LOGGER_NAME);
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java b/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java
new file mode 100644
index 0000000..5e8dc63
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service.internal.command;
+
+public class InitializeServiceCommand {
+
+  public InitializeServiceCommand() {
+    super();
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java b/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java
new file mode 100644
index 0000000..d700762
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service.internal.command;
+
+import io.mifos.template.api.v1.domain.Sample;
+
+public class SampleCommand {
+
+  private final Sample sample;
+
+  public SampleCommand(final Sample sample) {
+    super();
+    this.sample = sample;
+  }
+
+  public Sample sample() {
+    return this.sample;
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
new file mode 100644
index 0000000..6108d06
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service.internal.command.handler;
+
+import io.mifos.core.command.annotation.Aggregate;
+import io.mifos.core.command.annotation.CommandHandler;
+import io.mifos.core.command.annotation.EventEmitter;
+import io.mifos.core.mariadb.domain.FlywayFactoryBean;
+import io.mifos.template.api.v1.EventConstants;
+import io.mifos.template.service.ServiceConstants;
+import io.mifos.template.service.internal.command.InitializeServiceCommand;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.sql.DataSource;
+
+@SuppressWarnings({
+    "unused"
+})
+@Aggregate
+public class MigrationAggregate {
+
+  private final Logger logger;
+  private final DataSource dataSource;
+  private final FlywayFactoryBean flywayFactoryBean;
+
+  @Autowired
+  public MigrationAggregate(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                            final DataSource dataSource,
+                            final FlywayFactoryBean flywayFactoryBean) {
+    super();
+    this.logger = logger;
+    this.dataSource = dataSource;
+    this.flywayFactoryBean = flywayFactoryBean;
+  }
+
+  @CommandHandler
+  @Transactional
+  @EventEmitter(selectorName = EventConstants.SELECTOR_NAME, selectorValue = EventConstants.INITIALIZE)
+  public String initialize(final InitializeServiceCommand initializeServiceCommand) {
+    this.logger.debug("Start service migration.");
+    this.flywayFactoryBean.create(this.dataSource).migrate();
+    return EventConstants.INITIALIZE;
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
new file mode 100644
index 0000000..7109b49
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service.internal.command.handler;
+
+import io.mifos.core.command.annotation.Aggregate;
+import io.mifos.core.command.annotation.CommandHandler;
+import io.mifos.core.command.annotation.EventEmitter;
+import io.mifos.template.api.v1.EventConstants;
+import io.mifos.template.service.internal.command.SampleCommand;
+import io.mifos.template.service.internal.repository.SampleJpaEntity;
+import io.mifos.template.service.internal.repository.SampleJpaEntityRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@SuppressWarnings("unused")
+@Aggregate
+public class SampleAggregate {
+
+  private final SampleJpaEntityRepository sampleJpaEntityRepository;
+
+  @Autowired
+  public SampleAggregate(final SampleJpaEntityRepository sampleJpaEntityRepository) {
+    super();
+    this.sampleJpaEntityRepository = sampleJpaEntityRepository;
+  }
+
+  @CommandHandler
+  @Transactional
+  @EventEmitter(selectorName = EventConstants.SELECTOR_NAME, selectorValue = EventConstants.POST_SAMPLE)
+  public String sample(final SampleCommand sampleCommand) {
+
+    final SampleJpaEntity entity = new SampleJpaEntity();
+    entity.setIdentifier(sampleCommand.sample().getIdentifier());
+    entity.setPayload(sampleCommand.sample().getPayload());
+    this.sampleJpaEntityRepository.save(entity);
+
+    return sampleCommand.sample().getIdentifier();
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/mapper/SampleMapper.java b/service/src/main/java/io/mifos/template/service/internal/mapper/SampleMapper.java
new file mode 100644
index 0000000..de36734
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/internal/mapper/SampleMapper.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service.internal.mapper;
+
+import io.mifos.template.api.v1.domain.Sample;
+import io.mifos.template.service.internal.repository.SampleJpaEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class SampleMapper {
+
+  private SampleMapper() {
+    super();
+  }
+
+  public static Sample map(final SampleJpaEntity sampleJpaEntity) {
+    final Sample sample = new Sample();
+    sample.setIdentifier(sampleJpaEntity.getIdentifier());
+    sample.setPayload(sampleJpaEntity.getPayload());
+    return sample;
+  }
+
+  public static List<Sample> map(final List<SampleJpaEntity> sampleJpaEntities) {
+    final ArrayList<Sample> samples = new ArrayList<>(sampleJpaEntities.size());
+    samples.addAll(sampleJpaEntities.stream().map(SampleMapper::map).collect(Collectors.toList()));
+    return samples;
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntity.java b/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntity.java
new file mode 100644
index 0000000..c8c741e
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntity.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service.internal.repository;
+
+import javax.persistence.*;
+
+@SuppressWarnings("unused")
+@Entity
+@Table(name = "template_samples")
+public class SampleJpaEntity {
+
+  @Id
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
+  @Column(name = "id")
+  private Long id;
+  @Column(name = "identifier")
+  private String identifier;
+  @Column(name = "payload")
+  private String payload;
+
+  public SampleJpaEntity() {
+    super();
+  }
+
+  public Long getId() {
+    return id;
+  }
+
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public String getIdentifier() {
+    return this.identifier;
+  }
+
+  public void setIdentifier(final String identifier) {
+    this.identifier = identifier;
+  }
+
+  public String getPayload() {
+    return payload;
+  }
+
+  public void setPayload(String payload) {
+    this.payload = payload;
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java b/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
new file mode 100644
index 0000000..3f5539e
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service.internal.repository;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.Optional;
+
+@Repository
+public interface SampleJpaEntityRepository extends JpaRepository<SampleJpaEntity, Long> {
+  Optional<SampleJpaEntity> findByIdentifier(String identifier);
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/service/SampleService.java b/service/src/main/java/io/mifos/template/service/internal/service/SampleService.java
new file mode 100644
index 0000000..5b4be95
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/internal/service/SampleService.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service.internal.service;
+
+import io.mifos.template.api.v1.domain.Sample;
+import io.mifos.template.service.internal.mapper.SampleMapper;
+import io.mifos.template.service.internal.repository.SampleJpaEntityRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
+
+@Service
+public class SampleService {
+
+  private final SampleJpaEntityRepository sampleJpaEntityRepository;
+
+  @Autowired
+  public SampleService(final SampleJpaEntityRepository sampleJpaEntityRepository) {
+    super();
+    this.sampleJpaEntityRepository = sampleJpaEntityRepository;
+  }
+
+  public List<Sample> findAllEntities() {
+    return SampleMapper.map(this.sampleJpaEntityRepository.findAll());
+  }
+
+  public Optional<Sample> findByIdentifier(final String identifier) {
+    return this.sampleJpaEntityRepository.findByIdentifier(identifier).map(SampleMapper::map);
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/rest/SampleRestController.java b/service/src/main/java/io/mifos/template/service/rest/SampleRestController.java
new file mode 100644
index 0000000..9cce47d
--- /dev/null
+++ b/service/src/main/java/io/mifos/template/service/rest/SampleRestController.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2017 The Mifos Initiative
+ *
+ * Licensed 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 io.mifos.template.service.rest;
+
+import io.mifos.anubis.annotation.AcceptedTokenType;
+import io.mifos.anubis.annotation.Permittable;
+import io.mifos.core.command.gateway.CommandGateway;
+import io.mifos.core.lang.ServiceException;
+import io.mifos.template.api.v1.PermittableGroupIds;
+import io.mifos.template.api.v1.domain.Sample;
+import io.mifos.template.service.ServiceConstants;
+import io.mifos.template.service.internal.command.InitializeServiceCommand;
+import io.mifos.template.service.internal.command.SampleCommand;
+import io.mifos.template.service.internal.service.SampleService;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+@SuppressWarnings("unused")
+@RestController
+@RequestMapping("/")
+public class SampleRestController {
+
+  private final Logger logger;
+  private final CommandGateway commandGateway;
+  private final SampleService sampleService;
+
+  @Autowired
+  public SampleRestController(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                              final CommandGateway commandGateway,
+                              final SampleService sampleService) {
+    super();
+    this.logger = logger;
+    this.commandGateway = commandGateway;
+    this.sampleService = sampleService;
+  }
+
+  @Permittable(value = AcceptedTokenType.SYSTEM)
+  @RequestMapping(
+      value = "/initialize",
+      method = RequestMethod.POST,
+      consumes = MediaType.ALL_VALUE,
+      produces = MediaType.APPLICATION_JSON_VALUE
+  )
+  public
+  @ResponseBody
+  ResponseEntity<Void> initialize() throws InterruptedException {
+      this.commandGateway.process(new InitializeServiceCommand());
+      return ResponseEntity.accepted().build();
+  }
+
+  @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.SAMPLE_MANAGEMENT)
+  @RequestMapping(
+          value = "/sample",
+          method = RequestMethod.GET,
+          consumes = MediaType.ALL_VALUE,
+          produces = MediaType.APPLICATION_JSON_VALUE
+  )
+  public
+  @ResponseBody
+  List<Sample> findAllEntities() {
+    return this.sampleService.findAllEntities();
+  }
+
+  @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.SAMPLE_MANAGEMENT)
+  @RequestMapping(
+          value = "/sample/{identifier}",
+          method = RequestMethod.GET,
+          consumes = MediaType.ALL_VALUE,
+          produces = MediaType.APPLICATION_JSON_VALUE
+  )
+  public
+  @ResponseBody
+  ResponseEntity<Sample> getEntity(@PathVariable("identifier") final String identifier) {
+    return this.sampleService.findByIdentifier(identifier)
+            .map(ResponseEntity::ok)
+            .orElseThrow(() -> ServiceException.notFound("Instance with identifier " + identifier + " doesn't exist."));
+  }
+
+  @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.SAMPLE_MANAGEMENT)
+  @RequestMapping(
+      value = "/sample",
+      method = RequestMethod.POST,
+      consumes = MediaType.APPLICATION_JSON_VALUE,
+      produces = MediaType.APPLICATION_JSON_VALUE
+  )
+  public
+  @ResponseBody
+  ResponseEntity<Void> createEntity(@RequestBody @Valid final Sample instance) throws InterruptedException {
+    this.commandGateway.process(new SampleCommand(instance));
+    return ResponseEntity.accepted().build();
+  }
+}
diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml
new file mode 100644
index 0000000..1859323
--- /dev/null
+++ b/service/src/main/resources/application.yml
@@ -0,0 +1,66 @@
+#
+# Copyright 2017 The Mifos Initiative
+#
+# Licensed 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.
+#
+
+spring:
+  cloud:
+    discovery:
+      enabled: false
+    config:
+      enabled: false
+
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://localhost:8761/eureka/
+
+server:
+  port: 8081
+  contextPath: /template/v1/*
+
+cassandra:
+  clusterName: staging_cluster
+  contactPoints: 127.0.0.1:9042,127.0.0.2:9042,127.0.0.3:9042
+  keyspace: seshat
+  cl:
+    read: LOCAL_QUORUM
+    write: LOCAL_QUORUM
+    delete: LOCAL_QUORUM
+
+mariadb:
+  driverClass: org.mariadb.jdbc.Driver
+  database: seshat
+  host: localhost
+  port: 3306
+  user: root
+  password: mysql
+
+bonecp:
+  idleMaxAgeInMinutes: 240
+  idleConnectionTestPeriodInMinutes: 60
+  maxConnectionsPerPartition: 10
+  minConnectionsPerPartition: 1
+  partitionCount: 2
+  acquireIncrement: 5
+  statementsCacheSize: 100
+
+async:
+  corePoolSize: 32
+  maxPoolSize: 16384
+  queueCapacity: 0
+  threadName: async-processor-
+
+flyway:
+  enabled: false
diff --git a/service/src/main/resources/bootstrap.yml b/service/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..b814525
--- /dev/null
+++ b/service/src/main/resources/bootstrap.yml
@@ -0,0 +1,19 @@
+#
+# Copyright 2017 The Mifos Initiative
+#
+# Licensed 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.
+#
+
+spring:
+    application:
+        name: template-v1
diff --git a/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql b/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
new file mode 100644
index 0000000..3719a09
--- /dev/null
+++ b/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
@@ -0,0 +1,22 @@
+--
+-- Copyright 2017 The Mifos Initiative
+--
+-- Licensed 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.
+--
+
+CREATE TABLE template_samples (
+  id BIGINT NOT NULL AUTO_INCREMENT,
+  identifier VARCHAR(8) NOT NULL,
+  payload VARCHAR(512) NULL,
+  CONSTRAINT template_samples_pk PRIMARY KEY (id)
+);
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..1630ef8
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,6 @@
+rootProject.name = 'template'
+
+includeBuild 'api'
+includeBuild 'service'
+includeBuild 'component-test'
+
diff --git a/shared.gradle b/shared.gradle
new file mode 100644
index 0000000..4a79b9c
--- /dev/null
+++ b/shared.gradle
@@ -0,0 +1,69 @@
+group 'io.mifos.template'
+version '0.1.0.BUILD-SNAPSHOT'
+
+ext.versions = [
+        frameworkapi : '0.1.0-BUILD-SNAPSHOT',
+        frameworklang : '0.1.0-BUILD-SNAPSHOT',
+        frameworkasync : '0.1.0-BUILD-SNAPSHOT',
+        frameworkcassandra : '0.1.0-BUILD-SNAPSHOT',
+        frameworkmariadb : '0.1.0-BUILD-SNAPSHOT',
+        frameworkcommand : '0.1.0-BUILD-SNAPSHOT',
+        frameworktest: '0.1.0-BUILD-SNAPSHOT',
+        frameworkanubis: '0.1.0-BUILD-SNAPSHOT',
+        validator : '5.3.0.Final'
+]
+
+apply plugin: 'java'
+apply plugin: 'idea'
+apply plugin: 'maven-publish'
+apply plugin: 'io.spring.dependency-management'
+
+tasks.withType(JavaCompile) {
+    sourceCompatibility = JavaVersion.VERSION_1_8
+    targetCompatibility = JavaVersion.VERSION_1_8
+}
+
+repositories {
+    jcenter()
+    mavenLocal()
+}
+
+dependencyManagement {
+    imports {
+        mavenBom 'io.spring.platform:platform-bom:Athens-RELEASE'
+        mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Camden.SR1'
+    }
+}
+
+// override certain dependency provided by Spring platform using newer releases
+ext['cassandra.version'] = '3.6'
+ext['cassandra-driver.version'] = '3.1.2'
+ext['activemq.version'] = '5.13.2'
+ext['spring-data-releasetrain.version'] = 'Gosling-SR2A'
+
+dependencies {
+    compile(
+            [group: 'com.google.code.findbugs', name: 'jsr305']
+    )
+
+    testCompile(
+            [group: 'org.springframework.boot', name: 'spring-boot-starter-test']
+    )
+}
+
+jar {
+    from sourceSets.main.allSource
+}
+
+license {
+    header rootProject.file('../HEADER')
+    strictCheck true
+    mapping {
+        java = 'SLASHSTAR_STYLE'
+        xml = 'XML_STYLE'
+        yml = 'SCRIPT_STYLE'
+        yaml = 'SCRIPT_STYLE'
+    }
+    ext.year = Calendar.getInstance().get(Calendar.YEAR)
+    ext.name = 'The Mifos Initiative'
+}
\ No newline at end of file


[fineract-cn-payroll] 25/50: Merge pull request #5 from markusgeiss/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 4a46a9904a1c1e4d4bb105c84172eb39cade74e6
Merge: a797401 f4bea51
Author: Markus Geiss <ma...@kuelap.io>
AuthorDate: Tue Oct 10 11:16:45 2017 +0200

    Merge pull request #5 from markusgeiss/develop
    
    retrofitted percentage calculation for payroll distribution

 .../service/internal/service/adaptor/AccountingAdaptor.java        | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)


[fineract-cn-payroll] 20/50: only allow one account per config and allocation

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit d59dc5c81b2a096f3f7f10cebe772b4af77126e9
Author: mgeiss <mg...@mifos.org>
AuthorDate: Wed Sep 20 13:58:20 2017 +0200

    only allow one account per config and allocation
---
 .../io/mifos/payroll/api/v1/domain/PayrollAllocation.java | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
index 3a4d42c..ad606f4 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
@@ -59,4 +59,19 @@ public class PayrollAllocation {
   public void setProportional(final Boolean proportional) {
     this.proportional = proportional;
   }
+
+  @Override
+  public boolean equals(final Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+
+    final PayrollAllocation that = (PayrollAllocation) o;
+
+    return accountNumber != null ? accountNumber.equals(that.accountNumber) : that.accountNumber == null;
+  }
+
+  @Override
+  public int hashCode() {
+    return accountNumber != null ? accountNumber.hashCode() : 0;
+  }
 }


[fineract-cn-payroll] 27/50: Merge pull request #6 from markusgeiss/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 8405db37c70093c36b0ddffc744b6cf54f4853cc
Merge: 4a46a99 91bdfbf
Author: Markus Geiss <ma...@kuelap.io>
AuthorDate: Wed Oct 11 08:41:54 2017 +0200

    Merge pull request #6 from markusgeiss/develop
    
    fix for ATEN-480

 .../io/mifos/payroll/api/v1/domain/PayrollConfiguration.java   | 10 +++++-----
 .../main/java/io/mifos/payroll/TestPayrollConfiguration.java   |  4 ++--
 .../java/io/mifos/payroll/domain/DomainObjectGenerator.java    |  4 ++--
 .../service/internal/service/PayrollConfigurationService.java  |  5 ++++-
 .../service/rest/PayrollConfigurationRestController.java       |  4 ++--
 5 files changed, 15 insertions(+), 12 deletions(-)


[fineract-cn-payroll] 35/50: Adjusting to package name changes in upstream repositories.

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit ba4109b158828bf3e713a2faa9108d16a823acb2
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Apr 16 14:03:09 2018 +0200

    Adjusting to package name changes in upstream repositories.
---
 .../payroll/api/v1/client/PayrollManager.java      | 11 +++++------
 .../payroll/api/v1/domain/PayrollAllocation.java   |  5 ++---
 .../api/v1/domain/PayrollCollectionHistory.java    |  3 +--
 .../api/v1/domain/PayrollCollectionSheet.java      |  7 +++----
 .../api/v1/domain/PayrollConfiguration.java        |  5 ++---
 .../payroll/api/v1/domain/PayrollPayment.java      |  5 ++---
 .../java/io/mifos/payroll/AbstractPayrollTest.java | 10 +++++-----
 .../io/mifos/payroll/SuiteTestEnvironment.java     |  6 +++---
 .../io/mifos/payroll/TestPayrollConfiguration.java |  9 ++++-----
 .../io/mifos/payroll/TestPayrollDistribution.java  | 11 +++++------
 .../payroll/listener/MigrationEventListener.java   |  4 ++--
 .../listener/PayrollConfigurationListener.java     |  4 ++--
 .../listener/PayrollDistributionListener.java      |  4 ++--
 .../service/PayrollServiceConfiguration.java       | 18 ++++++++---------
 .../command/handler/MigrationAggregate.java        | 15 +++++++-------
 .../handler/PayrollConfigurationAggregate.java     | 15 +++++++-------
 .../handler/PayrollDistributionAggregate.java      | 15 +++++++-------
 .../mapper/PayrollConfigurationMapper.java         |  2 +-
 .../repository/PayrollCollectionEntity.java        |  5 ++---
 .../repository/PayrollConfigurationEntity.java     |  5 ++---
 .../service/PayrollConfigurationService.java       | 11 +++++------
 .../service/PayrollDistributionService.java        | 11 +++++------
 .../service/adaptor/AccountingAdaptor.java         | 23 +++++++++++-----------
 .../internal/service/adaptor/CustomerAdaptor.java  |  9 ++++-----
 .../service/rest/MigrationRestController.java      |  6 +++---
 .../rest/PayrollConfigurationRestController.java   | 18 ++++++++---------
 .../rest/PayrollDistributionRestController.java    | 17 ++++++++--------
 27 files changed, 118 insertions(+), 136 deletions(-)

diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
index 6931edd..bbc410e 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
@@ -18,13 +18,15 @@
  */
 package io.mifos.payroll.api.v1.client;
 
-import io.mifos.core.api.annotation.ThrowsException;
-import io.mifos.core.api.annotation.ThrowsExceptions;
-import io.mifos.core.api.util.CustomFeignClientsConfiguration;
 import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
 import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
 import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
+import java.util.List;
+import javax.validation.Valid;
+import org.apache.fineract.cn.api.annotation.ThrowsException;
+import org.apache.fineract.cn.api.annotation.ThrowsExceptions;
+import org.apache.fineract.cn.api.util.CustomFeignClientsConfiguration;
 import org.springframework.cloud.netflix.feign.FeignClient;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
@@ -34,9 +36,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
-import javax.validation.Valid;
-import java.util.List;
-
 @SuppressWarnings("unused")
 @FeignClient(name="payroll-v1", path="/payroll/v1", configuration = CustomFeignClientsConfiguration.class)
 public interface PayrollManager {
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
index ded3ff1..9bc8e45 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
@@ -18,12 +18,11 @@
  */
 package io.mifos.payroll.api.v1.domain;
 
-import io.mifos.core.lang.validation.constraints.ValidIdentifier;
-
+import java.math.BigDecimal;
 import javax.validation.constraints.DecimalMax;
 import javax.validation.constraints.DecimalMin;
 import javax.validation.constraints.NotNull;
-import java.math.BigDecimal;
+import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
 
 public class PayrollAllocation {
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java
index c38a6a6..876f0c4 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java
@@ -18,9 +18,8 @@
  */
 package io.mifos.payroll.api.v1.domain;
 
-import io.mifos.core.lang.validation.constraints.ValidIdentifier;
-
 import javax.validation.constraints.NotNull;
+import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
 
 public class PayrollCollectionHistory {
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
index bd7bcf3..5f493a1 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
@@ -18,11 +18,10 @@
  */
 package io.mifos.payroll.api.v1.domain;
 
-import io.mifos.core.lang.validation.constraints.ValidIdentifier;
-import org.hibernate.validator.constraints.NotEmpty;
-
-import javax.validation.Valid;
 import java.util.List;
+import javax.validation.Valid;
+import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
+import org.hibernate.validator.constraints.NotEmpty;
 
 public class PayrollCollectionSheet {
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
index 253fee6..35757ee 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
@@ -18,11 +18,10 @@
  */
 package io.mifos.payroll.api.v1.domain;
 
-import io.mifos.core.lang.validation.constraints.ValidIdentifier;
-
-import javax.validation.Valid;
 import java.util.ArrayList;
 import java.util.List;
+import javax.validation.Valid;
+import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
 
 public class PayrollConfiguration {
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
index a7f195a..cc38f75 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
@@ -18,12 +18,11 @@
  */
 package io.mifos.payroll.api.v1.domain;
 
-import io.mifos.core.lang.validation.constraints.ValidIdentifier;
-
+import java.math.BigDecimal;
 import javax.validation.constraints.DecimalMax;
 import javax.validation.constraints.DecimalMin;
 import javax.validation.constraints.NotNull;
-import java.math.BigDecimal;
+import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
 
 public class PayrollPayment {
 
diff --git a/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java b/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java
index 8cb455a..be6f8ce 100644
--- a/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java
+++ b/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java
@@ -19,14 +19,14 @@
 package io.mifos.payroll;
 
 
-import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
-import io.mifos.core.api.context.AutoUserContext;
-import io.mifos.core.test.fixture.TenantDataStoreContextTestRule;
-import io.mifos.core.test.listener.EnableEventRecording;
-import io.mifos.core.test.listener.EventRecorder;
 import io.mifos.payroll.api.v1.EventConstants;
 import io.mifos.payroll.api.v1.client.PayrollManager;
 import io.mifos.payroll.service.PayrollServiceConfiguration;
+import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
+import org.apache.fineract.cn.api.context.AutoUserContext;
+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;
diff --git a/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java b/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
index 9566a65..4eb6812 100644
--- a/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
+++ b/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
@@ -18,9 +18,9 @@
  */
 package io.mifos.payroll;
 
-import io.mifos.core.test.env.TestEnvironment;
-import io.mifos.core.test.fixture.cassandra.CassandraInitializer;
-import io.mifos.core.test.fixture.mariadb.MariaDBInitializer;
+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;
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java b/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
index 2d250b8..82e49a2 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
+++ b/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
@@ -19,24 +19,23 @@
 package io.mifos.payroll;
 
 import com.google.common.collect.Lists;
-import io.mifos.accounting.api.v1.domain.Account;
-import io.mifos.customer.api.v1.domain.Customer;
 import io.mifos.payroll.api.v1.EventConstants;
 import io.mifos.payroll.api.v1.domain.PayrollAllocation;
 import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.domain.DomainObjectGenerator;
 import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
 import io.mifos.payroll.service.internal.service.adaptor.CustomerAdaptor;
+import java.math.BigDecimal;
+import java.util.Optional;
 import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.customer.api.v1.domain.Customer;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Matchers;
 import org.mockito.Mockito;
 import org.springframework.boot.test.mock.mockito.MockBean;
 
-import java.math.BigDecimal;
-import java.util.Optional;
-
 public class TestPayrollConfiguration extends AbstractPayrollTest {
 
   @MockBean
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java b/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
index 097d460..0d1e358 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
+++ b/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
@@ -19,8 +19,6 @@
 package io.mifos.payroll;
 
 import com.google.common.collect.Lists;
-import io.mifos.accounting.api.v1.domain.Account;
-import io.mifos.customer.api.v1.domain.Customer;
 import io.mifos.payroll.api.v1.EventConstants;
 import io.mifos.payroll.api.v1.client.PayrollPaymentValidationException;
 import io.mifos.payroll.api.v1.domain.PayrollAllocation;
@@ -33,17 +31,18 @@ import io.mifos.payroll.domain.DomainObjectGenerator;
 import io.mifos.payroll.service.internal.repository.PayrollCollectionEntity;
 import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
 import io.mifos.payroll.service.internal.service.adaptor.CustomerAdaptor;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Optional;
 import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.customer.api.v1.domain.Customer;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Matchers;
 import org.mockito.Mockito;
 import org.springframework.boot.test.mock.mockito.MockBean;
 
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Optional;
-
 public class TestPayrollDistribution extends AbstractPayrollTest {
 
   @MockBean
diff --git a/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java b/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
index 27d28f5..2a33ca6 100644
--- a/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
+++ b/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
@@ -18,9 +18,9 @@
  */
 package io.mifos.payroll.listener;
 
-import io.mifos.core.lang.config.TenantHeaderFilter;
-import io.mifos.core.test.listener.EventRecorder;
 import io.mifos.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
+import org.apache.fineract.cn.test.listener.EventRecorder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jms.annotation.JmsListener;
 import org.springframework.messaging.handler.annotation.Header;
diff --git a/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java b/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
index 56c31b5..14894e1 100644
--- a/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
+++ b/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
@@ -18,10 +18,10 @@
  */
 package io.mifos.payroll.listener;
 
-import io.mifos.core.lang.config.TenantHeaderFilter;
-import io.mifos.core.test.listener.EventRecorder;
 import io.mifos.payroll.api.v1.EventConstants;
 import io.mifos.payroll.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;
diff --git a/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java b/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
index 7514b88..b99f1fd 100644
--- a/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
+++ b/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
@@ -18,10 +18,10 @@
  */
 package io.mifos.payroll.listener;
 
-import io.mifos.core.lang.config.TenantHeaderFilter;
-import io.mifos.core.test.listener.EventRecorder;
 import io.mifos.payroll.api.v1.EventConstants;
 import io.mifos.payroll.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;
diff --git a/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java b/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
index 6559900..3e94283 100644
--- a/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
+++ b/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
@@ -18,15 +18,15 @@
  */
 package io.mifos.payroll.service;
 
-import io.mifos.accounting.api.v1.client.LedgerManager;
-import io.mifos.anubis.config.EnableAnubis;
-import io.mifos.core.async.config.EnableAsync;
-import io.mifos.core.cassandra.config.EnableCassandra;
-import io.mifos.core.command.config.EnableCommandProcessing;
-import io.mifos.core.lang.config.EnableServiceException;
-import io.mifos.core.lang.config.EnableTenantContext;
-import io.mifos.core.mariadb.config.EnableMariaDB;
-import io.mifos.customer.api.v1.client.CustomerManager;
+import org.apache.fineract.cn.accounting.api.v1.client.LedgerManager;
+import org.apache.fineract.cn.anubis.config.EnableAnubis;
+import org.apache.fineract.cn.async.config.EnableAsync;
+import org.apache.fineract.cn.cassandra.config.EnableCassandra;
+import org.apache.fineract.cn.command.config.EnableCommandProcessing;
+import org.apache.fineract.cn.customer.api.v1.client.CustomerManager;
+import org.apache.fineract.cn.lang.config.EnableServiceException;
+import org.apache.fineract.cn.lang.config.EnableTenantContext;
+import org.apache.fineract.cn.mariadb.config.EnableMariaDB;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
index 279c211..7e836fb 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
@@ -18,18 +18,17 @@
  */
 package io.mifos.payroll.service.internal.command.handler;
 
-import io.mifos.accounting.api.v1.EventConstants;
-import io.mifos.core.command.annotation.Aggregate;
-import io.mifos.core.command.annotation.CommandHandler;
-import io.mifos.core.command.annotation.EventEmitter;
-import io.mifos.core.lang.ApplicationName;
-import io.mifos.core.mariadb.domain.FlywayFactoryBean;
 import io.mifos.payroll.service.internal.command.MigrateServiceCommand;
+import javax.sql.DataSource;
+import org.apache.fineract.cn.accounting.api.v1.EventConstants;
+import org.apache.fineract.cn.command.annotation.Aggregate;
+import org.apache.fineract.cn.command.annotation.CommandHandler;
+import org.apache.fineract.cn.command.annotation.EventEmitter;
+import org.apache.fineract.cn.lang.ApplicationName;
+import org.apache.fineract.cn.mariadb.domain.FlywayFactoryBean;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.sql.DataSource;
-
 @Aggregate
 public class MigrationAggregate {
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
index f2e7161..b1ca617 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
@@ -18,10 +18,6 @@
  */
 package io.mifos.payroll.service.internal.command.handler;
 
-import io.mifos.core.api.util.UserContextHolder;
-import io.mifos.core.command.annotation.Aggregate;
-import io.mifos.core.command.annotation.CommandHandler;
-import io.mifos.core.command.annotation.EventEmitter;
 import io.mifos.payroll.api.v1.EventConstants;
 import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.service.ServiceConstants;
@@ -32,15 +28,18 @@ import io.mifos.payroll.service.internal.repository.PayrollAllocationRepository;
 import io.mifos.payroll.service.internal.repository.PayrollConfigurationEntity;
 import io.mifos.payroll.service.internal.repository.PayrollConfigurationRepository;
 import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
+import java.time.Clock;
+import java.time.LocalDateTime;
+import java.util.Optional;
+import org.apache.fineract.cn.api.util.UserContextHolder;
+import org.apache.fineract.cn.command.annotation.Aggregate;
+import org.apache.fineract.cn.command.annotation.CommandHandler;
+import org.apache.fineract.cn.command.annotation.EventEmitter;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.time.Clock;
-import java.time.LocalDateTime;
-import java.util.Optional;
-
 @Aggregate
 public class PayrollConfigurationAggregate {
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
index 6bead07..61470b4 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
@@ -18,10 +18,6 @@
  */
 package io.mifos.payroll.service.internal.command.handler;
 
-import io.mifos.core.api.util.UserContextHolder;
-import io.mifos.core.command.annotation.Aggregate;
-import io.mifos.core.command.annotation.CommandHandler;
-import io.mifos.core.command.annotation.EventEmitter;
 import io.mifos.payroll.api.v1.EventConstants;
 import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
 import io.mifos.payroll.service.ServiceConstants;
@@ -32,16 +28,19 @@ import io.mifos.payroll.service.internal.repository.PayrollPaymentEntity;
 import io.mifos.payroll.service.internal.repository.PayrollPaymentRepository;
 import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
 import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import java.time.Clock;
+import java.time.LocalDateTime;
+import java.util.Optional;
 import org.apache.commons.lang.RandomStringUtils;
+import org.apache.fineract.cn.api.util.UserContextHolder;
+import org.apache.fineract.cn.command.annotation.Aggregate;
+import org.apache.fineract.cn.command.annotation.CommandHandler;
+import org.apache.fineract.cn.command.annotation.EventEmitter;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.time.Clock;
-import java.time.LocalDateTime;
-import java.util.Optional;
-
 @Aggregate
 public class PayrollDistributionAggregate {
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
index 586b7b8..4429ff5 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
@@ -18,9 +18,9 @@
  */
 package io.mifos.payroll.service.internal.mapper;
 
-import io.mifos.core.lang.DateConverter;
 import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.service.internal.repository.PayrollConfigurationEntity;
+import org.apache.fineract.cn.lang.DateConverter;
 
 public class PayrollConfigurationMapper {
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java
index 2715dc0..4c999aa 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java
@@ -18,8 +18,7 @@
  */
 package io.mifos.payroll.service.internal.repository;
 
-import io.mifos.core.mariadb.util.LocalDateTimeConverter;
-
+import java.time.LocalDateTime;
 import javax.persistence.Column;
 import javax.persistence.Convert;
 import javax.persistence.Entity;
@@ -27,7 +26,7 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
-import java.time.LocalDateTime;
+import org.apache.fineract.cn.mariadb.util.LocalDateTimeConverter;
 
 @Entity
 @Table(name = "meketre_payroll_collections")
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java
index c92cee9..23ddebd 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java
@@ -18,8 +18,7 @@
  */
 package io.mifos.payroll.service.internal.repository;
 
-import io.mifos.core.mariadb.util.LocalDateTimeConverter;
-
+import java.time.LocalDateTime;
 import javax.persistence.Column;
 import javax.persistence.Convert;
 import javax.persistence.Entity;
@@ -27,7 +26,7 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
-import java.time.LocalDateTime;
+import org.apache.fineract.cn.mariadb.util.LocalDateTimeConverter;
 
 @Entity
 @Table(name = "meketre_payroll_configurations")
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
index e00fbd3..3385436 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
@@ -18,8 +18,6 @@
  */
 package io.mifos.payroll.service.internal.service;
 
-import io.mifos.accounting.api.v1.domain.Account;
-import io.mifos.customer.api.v1.domain.Customer;
 import io.mifos.payroll.api.v1.domain.PayrollAllocation;
 import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.service.ServiceConstants;
@@ -29,15 +27,16 @@ import io.mifos.payroll.service.internal.repository.PayrollAllocationRepository;
 import io.mifos.payroll.service.internal.repository.PayrollConfigurationRepository;
 import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
 import io.mifos.payroll.service.internal.service.adaptor.CustomerAdaptor;
+import java.util.Comparator;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.customer.api.v1.domain.Customer;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
-import java.util.Comparator;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
 @Service
 public class PayrollConfigurationService {
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java
index 748d097..4eadd63 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java
@@ -18,8 +18,6 @@
  */
 package io.mifos.payroll.service.internal.service;
 
-import io.mifos.core.lang.DateConverter;
-import io.mifos.core.lang.ServiceException;
 import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
 import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
 import io.mifos.payroll.service.ServiceConstants;
@@ -29,6 +27,11 @@ import io.mifos.payroll.service.internal.repository.PayrollCollectionRepository;
 import io.mifos.payroll.service.internal.repository.PayrollPaymentEntity;
 import io.mifos.payroll.service.internal.repository.PayrollPaymentRepository;
 import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import org.apache.fineract.cn.lang.DateConverter;
+import org.apache.fineract.cn.lang.ServiceException;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -36,10 +39,6 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
 @Service
 public class PayrollDistributionService {
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
index 600f5a4..7f6fab0 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
@@ -19,22 +19,10 @@
 package io.mifos.payroll.service.internal.service.adaptor;
 
 import com.google.common.collect.Sets;
-import io.mifos.accounting.api.v1.client.AccountNotFoundException;
-import io.mifos.accounting.api.v1.client.LedgerManager;
-import io.mifos.accounting.api.v1.domain.Account;
-import io.mifos.accounting.api.v1.domain.Creditor;
-import io.mifos.accounting.api.v1.domain.Debtor;
-import io.mifos.accounting.api.v1.domain.JournalEntry;
-import io.mifos.core.lang.DateConverter;
 import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.api.v1.domain.PayrollPayment;
 import io.mifos.payroll.service.ServiceConstants;
 import io.mifos.payroll.service.internal.repository.PayrollCollectionEntity;
-import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.stereotype.Service;
-
 import java.math.BigDecimal;
 import java.math.MathContext;
 import java.math.RoundingMode;
@@ -43,6 +31,17 @@ import java.time.LocalDateTime;
 import java.util.HashSet;
 import java.util.Optional;
 import java.util.UUID;
+import org.apache.fineract.cn.accounting.api.v1.client.AccountNotFoundException;
+import org.apache.fineract.cn.accounting.api.v1.client.LedgerManager;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.accounting.api.v1.domain.Creditor;
+import org.apache.fineract.cn.accounting.api.v1.domain.Debtor;
+import org.apache.fineract.cn.accounting.api.v1.domain.JournalEntry;
+import org.apache.fineract.cn.lang.DateConverter;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
 
 @Service
 public class AccountingAdaptor {
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
index 13d14d5..713a495 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
@@ -18,17 +18,16 @@
  */
 package io.mifos.payroll.service.internal.service.adaptor;
 
-import io.mifos.customer.api.v1.client.CustomerManager;
-import io.mifos.customer.api.v1.client.CustomerNotFoundException;
-import io.mifos.customer.api.v1.domain.Customer;
 import io.mifos.payroll.service.ServiceConstants;
+import java.util.Optional;
+import org.apache.fineract.cn.customer.api.v1.client.CustomerManager;
+import org.apache.fineract.cn.customer.api.v1.client.CustomerNotFoundException;
+import org.apache.fineract.cn.customer.api.v1.domain.Customer;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
-import java.util.Optional;
-
 @Service
 public class CustomerAdaptor {
 
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java
index cdad73a..997dd32 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java
@@ -18,10 +18,10 @@
  */
 package io.mifos.payroll.service.rest;
 
-import io.mifos.anubis.annotation.AcceptedTokenType;
-import io.mifos.anubis.annotation.Permittable;
-import io.mifos.core.command.gateway.CommandGateway;
 import io.mifos.payroll.service.internal.command.MigrateServiceCommand;
+import org.apache.fineract.cn.anubis.annotation.AcceptedTokenType;
+import org.apache.fineract.cn.anubis.annotation.Permittable;
+import org.apache.fineract.cn.command.gateway.CommandGateway;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
index 7df6f25..84782ee 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
@@ -18,17 +18,19 @@
  */
 package io.mifos.payroll.service.rest;
 
-import io.mifos.anubis.annotation.AcceptedTokenType;
-import io.mifos.anubis.annotation.Permittable;
-import io.mifos.anubis.annotation.Permittables;
-import io.mifos.core.command.gateway.CommandGateway;
-import io.mifos.core.lang.ServiceException;
 import io.mifos.payroll.api.v1.PermittableGroupIds;
 import io.mifos.payroll.api.v1.domain.PayrollAllocation;
 import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.service.ServiceConstants;
 import io.mifos.payroll.service.internal.command.PutPayrollConfigurationCommand;
 import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
+import java.util.List;
+import javax.validation.Valid;
+import org.apache.fineract.cn.anubis.annotation.AcceptedTokenType;
+import org.apache.fineract.cn.anubis.annotation.Permittable;
+import org.apache.fineract.cn.anubis.annotation.Permittables;
+import org.apache.fineract.cn.command.gateway.CommandGateway;
+import org.apache.fineract.cn.lang.ServiceException;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -41,9 +43,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.validation.Valid;
-import java.util.List;
-
 @RestController
 @RequestMapping("/customers/{identifier}/payroll")
 public class PayrollConfigurationRestController {
@@ -78,7 +77,8 @@ public class PayrollConfigurationRestController {
   public ResponseEntity<Void> setPayrollConfiguration(@PathVariable(value = "identifier") final String customerIdentifier,
                                                      @RequestBody @Valid final PayrollConfiguration payrollConfiguration) {
     this.payrollConfigurationService.findCustomer(customerIdentifier)
-        .orElseThrow(() -> ServiceException.notFound("Customer {0} not available.", customerIdentifier)
+        .orElseThrow(() -> ServiceException
+            .notFound("Customer {0} not available.", customerIdentifier)
     );
 
     this.payrollConfigurationService.findAccount(payrollConfiguration.getMainAccountNumber())
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
index 244610a..a4c2435 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
@@ -18,12 +18,6 @@
  */
 package io.mifos.payroll.service.rest;
 
-import io.mifos.accounting.api.v1.domain.Account;
-import io.mifos.anubis.annotation.AcceptedTokenType;
-import io.mifos.anubis.annotation.Permittable;
-import io.mifos.anubis.annotation.Permittables;
-import io.mifos.core.command.gateway.CommandGateway;
-import io.mifos.core.lang.ServiceException;
 import io.mifos.payroll.api.v1.PermittableGroupIds;
 import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
 import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
@@ -35,6 +29,14 @@ import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
 import io.mifos.payroll.service.internal.service.PayrollDistributionService;
 import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
 import io.mifos.payroll.service.rest.util.PageableBuilder;
+import java.util.List;
+import javax.validation.Valid;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.anubis.annotation.AcceptedTokenType;
+import org.apache.fineract.cn.anubis.annotation.Permittable;
+import org.apache.fineract.cn.anubis.annotation.Permittables;
+import org.apache.fineract.cn.command.gateway.CommandGateway;
+import org.apache.fineract.cn.lang.ServiceException;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -48,9 +50,6 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.validation.Valid;
-import java.util.List;
-
 @RestController
 @RequestMapping("/distribution")
 public class PayrollDistributionRestController {


[fineract-cn-payroll] 12/50: Merge pull request #4 from myrle-krantz/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 7232d32efa7531b34a8adae0d27bb05ceda5b20a
Merge: 6b00c28 486ae6b
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Jul 10 12:16:57 2017 +0200

    Merge pull request #4 from myrle-krantz/develop
    
    Changed initialize payload to the version number as agreed.

 .../src/main/java/io/mifos/template/SuiteTestEnvironment.java     | 4 +++-
 component-test/src/main/java/io/mifos/template/TestSample.java    | 2 +-
 .../service/internal/command/handler/MigrationAggregate.java      | 8 ++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)


[fineract-cn-payroll] 30/50: Updated copyright information in payroll

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 7afa0fddf46cf7703b45ab9e27b5ae6e57f1eafc
Author: Isaac Kamga <u2...@gmail.com>
AuthorDate: Fri Mar 2 22:03:57 2018 +0100

    Updated copyright information in payroll
---
 HEADER                                             | 25 +++++++++++--------
 NOTICE.txt                                         |  5 ++++
 README.md                                          |  2 +-
 .../io/mifos/payroll/api/v1/EventConstants.java    | 25 +++++++++++--------
 .../mifos/payroll/api/v1/PermittableGroupIds.java  | 25 +++++++++++--------
 .../api/v1/client/CustomerNotFoundException.java   | 25 +++++++++++--------
 .../PayrollConfigurationNotFoundException.java     | 25 +++++++++++--------
 .../PayrollDistributionValidationException.java    | 25 +++++++++++--------
 .../payroll/api/v1/client/PayrollManager.java      | 25 +++++++++++--------
 .../client/PayrollPaymentValidationException.java  | 25 +++++++++++--------
 .../payroll/api/v1/domain/PayrollAllocation.java   | 25 +++++++++++--------
 .../api/v1/domain/PayrollCollectionHistory.java    | 25 +++++++++++--------
 .../api/v1/domain/PayrollCollectionSheet.java      | 25 +++++++++++--------
 .../api/v1/domain/PayrollConfiguration.java        | 25 +++++++++++--------
 .../payroll/api/v1/domain/PayrollPayment.java      | 25 +++++++++++--------
 .../payroll/api/v1/domain/PayrollPaymentPage.java  | 25 +++++++++++--------
 .../java/io/mifos/payroll/AbstractPayrollTest.java | 25 +++++++++++--------
 .../io/mifos/payroll/SuiteTestEnvironment.java     | 25 +++++++++++--------
 .../io/mifos/payroll/TestPayrollConfiguration.java | 25 +++++++++++--------
 .../io/mifos/payroll/TestPayrollDistribution.java  | 25 +++++++++++--------
 .../src/main/java/io/mifos/payroll/TestSuite.java  | 25 +++++++++++--------
 .../payroll/domain/DomainObjectGenerator.java      | 25 +++++++++++--------
 .../payroll/listener/MigrationEventListener.java   | 25 +++++++++++--------
 .../listener/PayrollConfigurationListener.java     | 25 +++++++++++--------
 .../listener/PayrollDistributionListener.java      | 25 +++++++++++--------
 component-test/src/main/resources/logback-test.xml | 25 +++++++++++--------
 .../mifos/payroll/service/PayrollApplication.java  | 25 +++++++++++--------
 .../service/PayrollServiceConfiguration.java       | 25 +++++++++++--------
 .../io/mifos/payroll/service/ServiceConstants.java | 25 +++++++++++--------
 .../internal/command/DistributePayrollCommand.java | 25 +++++++++++--------
 .../internal/command/MigrateServiceCommand.java    | 25 +++++++++++--------
 .../command/PutPayrollConfigurationCommand.java    | 25 +++++++++++--------
 .../command/handler/MigrationAggregate.java        | 25 +++++++++++--------
 .../handler/PayrollConfigurationAggregate.java     | 25 +++++++++++--------
 .../handler/PayrollDistributionAggregate.java      | 25 +++++++++++--------
 .../internal/mapper/PayrollAllocationMapper.java   | 25 +++++++++++--------
 .../mapper/PayrollConfigurationMapper.java         | 25 +++++++++++--------
 .../internal/mapper/PayrollPaymentMapper.java      | 25 +++++++++++--------
 .../repository/PayrollAllocationEntity.java        | 25 +++++++++++--------
 .../repository/PayrollAllocationRepository.java    | 25 +++++++++++--------
 .../repository/PayrollCollectionEntity.java        | 25 +++++++++++--------
 .../repository/PayrollCollectionRepository.java    | 25 +++++++++++--------
 .../repository/PayrollConfigurationEntity.java     | 25 +++++++++++--------
 .../repository/PayrollConfigurationRepository.java | 25 +++++++++++--------
 .../internal/repository/PayrollPaymentEntity.java  | 25 +++++++++++--------
 .../repository/PayrollPaymentRepository.java       | 25 +++++++++++--------
 .../service/PayrollConfigurationService.java       | 25 +++++++++++--------
 .../service/PayrollDistributionService.java        | 25 +++++++++++--------
 .../service/adaptor/AccountingAdaptor.java         | 25 +++++++++++--------
 .../internal/service/adaptor/CustomerAdaptor.java  | 25 +++++++++++--------
 .../service/rest/MigrationRestController.java      | 25 +++++++++++--------
 .../rest/PayrollConfigurationRestController.java   | 25 +++++++++++--------
 .../rest/PayrollDistributionRestController.java    | 25 +++++++++++--------
 .../payroll/service/rest/util/PageableBuilder.java | 25 +++++++++++--------
 service/src/main/resources/application.yml         | 25 +++++++++++--------
 service/src/main/resources/bootstrap.yml           | 25 +++++++++++--------
 .../db/migrations/mariadb/V1__initial_setup.sql    | 25 +++++++++++--------
 .../V2__add_distribution_processing_behavior.sql   | 25 +++++++++++--------
 service/src/main/resources/logback.xml             | 29 ++++++++++++----------
 shared.gradle                                      |  2 +-
 60 files changed, 807 insertions(+), 631 deletions(-)

diff --git a/HEADER b/HEADER
index 4b2eadf..90705e0 100644
--- a/HEADER
+++ b/HEADER
@@ -1,13 +1,16 @@
-Copyright ${year} ${name}.
+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
 
-Licensed 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
 
-   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.
\ No newline at end of file
+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.
\ No newline at end of file
diff --git a/NOTICE.txt b/NOTICE.txt
new file mode 100644
index 0000000..acc95e4
--- /dev/null
+++ b/NOTICE.txt
@@ -0,0 +1,5 @@
+Apache Fineract CN Payroll
+Copyright [2017-2018] The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
diff --git a/README.md b/README.md
index 8636dff..8d684de 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Mifos I/O Payroll
+# Apache Fineract CN Payroll
 
 This project provides functionality to configure payroll allocations and distribute payroll payments for customers.
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/EventConstants.java b/api/src/main/java/io/mifos/payroll/api/v1/EventConstants.java
index 72e925b..17cd448 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/EventConstants.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/EventConstants.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/PermittableGroupIds.java b/api/src/main/java/io/mifos/payroll/api/v1/PermittableGroupIds.java
index f925986..d6dbe1b 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/PermittableGroupIds.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/PermittableGroupIds.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/CustomerNotFoundException.java b/api/src/main/java/io/mifos/payroll/api/v1/client/CustomerNotFoundException.java
index ca8d1c8..2168504 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/CustomerNotFoundException.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/CustomerNotFoundException.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.client;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollConfigurationNotFoundException.java b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
index 0c39d16..44dff96 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.client;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollDistributionValidationException.java b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollDistributionValidationException.java
index 2f330f2..e4d73f8 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollDistributionValidationException.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollDistributionValidationException.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.client;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
index d9235cf..6931edd 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.client;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollPaymentValidationException.java b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollPaymentValidationException.java
index 90ee5e5..dc016cb 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollPaymentValidationException.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollPaymentValidationException.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.client;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
index ad606f4..ded3ff1 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.domain;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java
index b0b5f77..c38a6a6 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.domain;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
index 043ca02..bd7bcf3 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.domain;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
index ee4319f..253fee6 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.domain;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
index dbee945..a7f195a 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.domain;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPaymentPage.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPaymentPage.java
index 2e28399..33aeb97 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPaymentPage.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPaymentPage.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.api.v1.domain;
 
diff --git a/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java b/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java
index a995040..8cb455a 100644
--- a/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java
+++ b/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll;
 
diff --git a/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java b/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
index 8341aec..9566a65 100644
--- a/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
+++ b/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll;
 
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java b/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
index 3f7d8df..2d250b8 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
+++ b/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll;
 
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java b/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
index cca752c..097d460 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
+++ b/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll;
 
diff --git a/component-test/src/main/java/io/mifos/payroll/TestSuite.java b/component-test/src/main/java/io/mifos/payroll/TestSuite.java
index 09862e8..18994aa 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestSuite.java
+++ b/component-test/src/main/java/io/mifos/payroll/TestSuite.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll;
 
diff --git a/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java b/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java
index 695b7df..c97cc29 100644
--- a/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java
+++ b/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.domain;
 
diff --git a/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java b/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
index b521aad..27d28f5 100644
--- a/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
+++ b/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.listener;
 
diff --git a/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java b/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
index 66e5719..56c31b5 100644
--- a/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
+++ b/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.listener;
 
diff --git a/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java b/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
index 72edede..7514b88 100644
--- a/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
+++ b/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.listener;
 
diff --git a/component-test/src/main/resources/logback-test.xml b/component-test/src/main/resources/logback-test.xml
index 222fc38..cdfc084 100644
--- a/component-test/src/main/resources/logback-test.xml
+++ b/component-test/src/main/resources/logback-test.xml
@@ -1,18 +1,21 @@
 <!--
 
-    Copyright 2017 The Mifos Initiative.
+    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
 
-    Licensed 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
 
-       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.
+    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.
 
 -->
 <configuration>
diff --git a/service/src/main/java/io/mifos/payroll/service/PayrollApplication.java b/service/src/main/java/io/mifos/payroll/service/PayrollApplication.java
index 2fe3036..6caf110 100644
--- a/service/src/main/java/io/mifos/payroll/service/PayrollApplication.java
+++ b/service/src/main/java/io/mifos/payroll/service/PayrollApplication.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java b/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
index d9a00e4..6559900 100644
--- a/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
+++ b/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/ServiceConstants.java b/service/src/main/java/io/mifos/payroll/service/ServiceConstants.java
index a5cfc4f..f379023 100644
--- a/service/src/main/java/io/mifos/payroll/service/ServiceConstants.java
+++ b/service/src/main/java/io/mifos/payroll/service/ServiceConstants.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/DistributePayrollCommand.java b/service/src/main/java/io/mifos/payroll/service/internal/command/DistributePayrollCommand.java
index e3b4202..44dec7e 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/DistributePayrollCommand.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/DistributePayrollCommand.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.command;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/MigrateServiceCommand.java b/service/src/main/java/io/mifos/payroll/service/internal/command/MigrateServiceCommand.java
index 4cacdc2..7053c9a 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/MigrateServiceCommand.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/MigrateServiceCommand.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.command;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/PutPayrollConfigurationCommand.java b/service/src/main/java/io/mifos/payroll/service/internal/command/PutPayrollConfigurationCommand.java
index 3507489..b1f6ab7 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/PutPayrollConfigurationCommand.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/PutPayrollConfigurationCommand.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.command;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
index 4d9d2c8..279c211 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.command.handler;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
index b5383bd..f2e7161 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.command.handler;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
index 93f9596..6bead07 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.command.handler;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollAllocationMapper.java b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollAllocationMapper.java
index 832fd12..5c9e752 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollAllocationMapper.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollAllocationMapper.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.mapper;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
index 69ba999..586b7b8 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.mapper;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java
index 738d8ed..b52ebec 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.mapper;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationEntity.java
index d059f2a..ed7e0c4 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationEntity.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationEntity.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.repository;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationRepository.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationRepository.java
index bcc43f5..9826c10 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationRepository.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationRepository.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.repository;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java
index c896995..2715dc0 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.repository;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionRepository.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionRepository.java
index 8986a79..98ead7f 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionRepository.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionRepository.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.repository;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java
index 0ccd490..c92cee9 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.repository;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationRepository.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationRepository.java
index fb2944a..9d8a4b3 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationRepository.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationRepository.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.repository;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java
index c04dc8d..36ca60c 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.repository;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentRepository.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentRepository.java
index 91685ce..60f624f 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentRepository.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentRepository.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.repository;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
index 34572dd..e00fbd3 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.service;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java
index dd4012e..748d097 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.service;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
index f7c549b..600f5a4 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.service.adaptor;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
index dde236f..13d14d5 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.internal.service.adaptor;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java
index 84f58ef..cdad73a 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.rest;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
index c8849a2..7df6f25 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.rest;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
index 681c48f..244610a 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.rest;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/util/PageableBuilder.java b/service/src/main/java/io/mifos/payroll/service/rest/util/PageableBuilder.java
index ff34371..8a7ec5a 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/util/PageableBuilder.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/util/PageableBuilder.java
@@ -1,17 +1,20 @@
 /*
- * Copyright 2017 The Mifos Initiative.
+ * 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
  *
- * Licensed 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
  *
- *    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.
+ * 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 io.mifos.payroll.service.rest.util;
 
diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml
index 124f606..482a7e3 100644
--- a/service/src/main/resources/application.yml
+++ b/service/src/main/resources/application.yml
@@ -1,17 +1,20 @@
 #
-# Copyright 2017 The Mifos Initiative.
+# 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
 #
-# Licensed 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
 #
-#    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.
+# 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.
 #
 
 spring:
diff --git a/service/src/main/resources/bootstrap.yml b/service/src/main/resources/bootstrap.yml
index dac5589..1a36d3a 100644
--- a/service/src/main/resources/bootstrap.yml
+++ b/service/src/main/resources/bootstrap.yml
@@ -1,17 +1,20 @@
 #
-# Copyright 2017 The Mifos Initiative.
+# 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
 #
-# Licensed 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
 #
-#    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.
+# 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.
 #
 
 spring:
diff --git a/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql b/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
index 578e373..91ca05e 100644
--- a/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
+++ b/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
@@ -1,17 +1,20 @@
 --
--- Copyright 2017 The Mifos Initiative.
+-- 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
 --
--- Licensed 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
 --
---    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.
+-- 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.
 --
 
 CREATE TABLE meketre_payroll_configurations (
diff --git a/service/src/main/resources/db/migrations/mariadb/V2__add_distribution_processing_behavior.sql b/service/src/main/resources/db/migrations/mariadb/V2__add_distribution_processing_behavior.sql
index c7d1ab3..53568a5 100644
--- a/service/src/main/resources/db/migrations/mariadb/V2__add_distribution_processing_behavior.sql
+++ b/service/src/main/resources/db/migrations/mariadb/V2__add_distribution_processing_behavior.sql
@@ -1,17 +1,20 @@
 --
--- Copyright 2017 The Mifos Initiative.
+-- 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
 --
--- Licensed 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
 --
---    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.
+-- 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.
 --
 
 ALTER TABLE meketre_payroll_payments ADD processed BOOLEAN NOT NULL;
diff --git a/service/src/main/resources/logback.xml b/service/src/main/resources/logback.xml
index e594df5..62bc71f 100644
--- a/service/src/main/resources/logback.xml
+++ b/service/src/main/resources/logback.xml
@@ -1,18 +1,21 @@
 <!--
 
-    Copyright 2017 The Mifos Initiative.
-
-    Licensed 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.
+    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.
 
 -->
 <configuration>
diff --git a/shared.gradle b/shared.gradle
index 16fe692..b8a3316 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -68,5 +68,5 @@ license {
         yaml = 'SCRIPT_STYLE'
     }
     ext.year = Calendar.getInstance().get(Calendar.YEAR)
-    ext.name = 'The Mifos Initiative'
+    ext.name = 'The Apache Software Foundation'
 }


[fineract-cn-payroll] 13/50: removing duplicate resources from build artifacts.

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit f35c15cb56174f79e8cb87425d9b960c7dd7f98c
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Wed Jul 12 23:32:58 2017 +0200

    removing duplicate resources from build artifacts.
---
 shared.gradle | 1 +
 1 file changed, 1 insertion(+)

diff --git a/shared.gradle b/shared.gradle
index 4a79b9c..1bfef46 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -53,6 +53,7 @@ dependencies {
 
 jar {
     from sourceSets.main.allSource
+    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
 }
 
 license {


[fineract-cn-payroll] 04/50: Merge pull request #1 from myrle-krantz/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit ec0791dcdfd7fc91c0a5876f9810d5c349407aaf
Merge: e51bec1 8a38bb1
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Tue Apr 4 17:13:14 2017 +0200

    Merge pull request #1 from myrle-krantz/develop
    
    adding example for api domain object testing.

 api/build.gradle                                   |  4 ++
 .../io/mifos/template/api/v1/EventConstants.java   |  2 +-
 .../mifos/template/api/v1/PermittableGroupIds.java |  2 +-
 .../api/v1/client/IamATeapotException.java         |  2 +-
 .../template/api/v1/client/TemplateManager.java    |  2 +-
 .../io/mifos/template/api/v1/domain/Sample.java    |  2 +-
 .../mifos/template/api/v1/domain/SampleTest.java   | 55 ++++++++++++++++++++++
 .../main/java/io/mifos/template/TestSample.java    |  2 +-
 .../template/listener/MigrationEventListener.java  |  2 +-
 .../template/listener/SampleEventListener.java     |  2 +-
 .../mifos/template/service/ServiceConstants.java   |  2 +-
 .../template/service/TemplateApplication.java      |  2 +-
 .../template/service/TemplateConfiguration.java    |  2 +-
 .../internal/command/InitializeServiceCommand.java |  2 +-
 .../service/internal/command/SampleCommand.java    |  2 +-
 .../command/handler/MigrationAggregate.java        |  2 +-
 .../internal/command/handler/SampleAggregate.java  |  2 +-
 .../service/internal/mapper/SampleMapper.java      |  2 +-
 .../internal/repository/SampleJpaEntity.java       |  2 +-
 .../repository/SampleJpaEntityRepository.java      |  2 +-
 .../service/internal/service/SampleService.java    |  2 +-
 .../service/rest/SampleRestController.java         |  2 +-
 service/src/main/resources/application.yml         |  2 +-
 service/src/main/resources/bootstrap.yml           |  2 +-
 .../db/migrations/mariadb/V1__initial_setup.sql    |  2 +-
 25 files changed, 82 insertions(+), 23 deletions(-)


[fineract-cn-payroll] 49/50: Merge pull request #10 from Anh3h/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit bcb953fcbebe13bce0a7a4683084787f46eefe45
Merge: 36edf1d 7943293
Author: Ang3h Courage <co...@gmail.com>
AuthorDate: Wed May 29 13:18:45 2019 -0400

    Merge pull request #10 from Anh3h/develop
    
    Add Docker configuration

 .dockerignore | 17 +++++++++++++++++
 .gitignore    |  2 ++
 Dockerfile    | 30 ++++++++++++++++++++++++++++++
 shared.gradle |  3 ++-
 4 files changed, 51 insertions(+), 1 deletion(-)


[fineract-cn-payroll] 37/50: Merge pull request #4 from myrle-krantz/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 131263e250b521f49012a3c3f1fdf9701d740fc6
Merge: b1773fe 52de03e
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Apr 16 21:18:53 2018 +0200

    Merge pull request #4 from myrle-krantz/develop
    
    Updating package names.

 .../cn}/payroll/api/v1/EventConstants.java         |  2 +-
 .../cn}/payroll/api/v1/PermittableGroupIds.java    |  2 +-
 .../api/v1/client/CustomerNotFoundException.java   |  2 +-
 .../PayrollConfigurationNotFoundException.java     |  2 +-
 .../PayrollDistributionValidationException.java    |  2 +-
 .../cn}/payroll/api/v1/client/PayrollManager.java  | 21 ++++++-----
 .../client/PayrollPaymentValidationException.java  |  2 +-
 .../payroll/api/v1/domain/PayrollAllocation.java   |  7 ++--
 .../api/v1/domain/PayrollCollectionHistory.java    |  5 ++-
 .../api/v1/domain/PayrollCollectionSheet.java      |  9 +++--
 .../api/v1/domain/PayrollConfiguration.java        |  7 ++--
 .../cn}/payroll/api/v1/domain/PayrollPayment.java  |  7 ++--
 .../payroll/api/v1/domain/PayrollPaymentPage.java  |  2 +-
 .../fineract/cn}/payroll/AbstractPayrollTest.java  | 22 ++++++------
 .../fineract/cn}/payroll/SuiteTestEnvironment.java |  8 ++---
 .../cn}/payroll/TestPayrollConfiguration.java      | 23 ++++++------
 .../cn}/payroll/TestPayrollDistribution.java       | 37 ++++++++++---------
 .../apache/fineract/cn}/payroll/TestSuite.java     |  2 +-
 .../cn}/payroll/domain/DomainObjectGenerator.java  |  6 ++--
 .../payroll/listener/MigrationEventListener.java   |  8 ++---
 .../listener/PayrollConfigurationListener.java     | 10 +++---
 .../listener/PayrollDistributionListener.java      | 10 +++---
 .../cn}/payroll/service/PayrollApplication.java    |  2 +-
 .../service/PayrollServiceConfiguration.java       | 30 ++++++++--------
 .../cn}/payroll/service/ServiceConstants.java      |  2 +-
 .../internal/command/DistributePayrollCommand.java |  4 +--
 .../internal/command/MigrateServiceCommand.java    |  2 +-
 .../command/PutPayrollConfigurationCommand.java    |  4 +--
 .../command/handler/MigrationAggregate.java        | 19 +++++-----
 .../handler/PayrollConfigurationAggregate.java     | 37 ++++++++++---------
 .../handler/PayrollDistributionAggregate.java      | 37 ++++++++++---------
 .../internal/mapper/PayrollAllocationMapper.java   |  6 ++--
 .../mapper/PayrollConfigurationMapper.java         |  8 ++---
 .../internal/mapper/PayrollPaymentMapper.java      |  6 ++--
 .../repository/PayrollAllocationEntity.java        |  2 +-
 .../repository/PayrollAllocationRepository.java    |  2 +-
 .../repository/PayrollCollectionEntity.java        |  7 ++--
 .../repository/PayrollCollectionRepository.java    |  2 +-
 .../repository/PayrollConfigurationEntity.java     |  7 ++--
 .../repository/PayrollConfigurationRepository.java |  2 +-
 .../internal/repository/PayrollPaymentEntity.java  |  2 +-
 .../repository/PayrollPaymentRepository.java       |  2 +-
 .../service/PayrollConfigurationService.java       | 31 ++++++++--------
 .../service/PayrollDistributionService.java        | 31 ++++++++--------
 .../service/adaptor/AccountingAdaptor.java         | 33 +++++++++--------
 .../internal/service/adaptor/CustomerAdaptor.java  | 13 ++++---
 .../service/rest/MigrationRestController.java      | 10 +++---
 .../rest/PayrollConfigurationRestController.java   | 32 ++++++++---------
 .../rest/PayrollDistributionRestController.java    | 41 +++++++++++-----------
 .../payroll/service/rest/util/PageableBuilder.java |  2 +-
 50 files changed, 277 insertions(+), 295 deletions(-)


[fineract-cn-payroll] 29/50: Merge pull request #1 from myrle-krantz/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit ae11bb9149a72c0a6e4122c765f0a898bca9dace
Merge: 8405db3 50d905b
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Feb 26 18:33:40 2018 +0100

    Merge pull request #1 from myrle-krantz/develop
    
    updating artifact ids to apache fineract from mifos io

 api/build.gradle            |  4 ++--
 build.gradle                |  2 +-
 component-test/build.gradle | 12 ++++++------
 service/build.gradle        | 18 +++++++++---------
 shared.gradle               |  4 ++--
 5 files changed, 20 insertions(+), 20 deletions(-)


[fineract-cn-payroll] 38/50: Document the payroll API

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 1316234a8ae9751a3bf2f125fa6ea5f62c138162
Author: Isaac Kamga <u2...@gmail.com>
AuthorDate: Mon Apr 23 17:32:30 2018 +0100

    Document the payroll API
---
 service/build.gradle                               |  20 +
 service/src/doc/asciidoc/api-docs.adoc             |  31 ++
 .../curl-request.adoc                              |   4 +
 .../http-request.adoc                              |  10 +
 .../http-response.adoc                             |   5 +
 .../httpie-request.adoc                            |   4 +
 .../curl-request.adoc                              |   4 +
 .../http-request.adoc                              |   8 +
 .../http-response.adoc                             |   5 +
 .../httpie-request.adoc                            |   4 +
 service/src/doc/html5/html5/api-docs.html          | 508 +++++++++++++++++++++
 .../fineract/cn/payroll/AbstractPayrollTest.java   | 114 +++++
 .../fineract/cn/payroll/SuiteTestEnvironment.java  |  48 ++
 .../cn/payroll/TestPayrollConfiguration.java       | 172 +++++++
 .../cn/payroll/TestPayrollDistribution.java        | 198 ++++++++
 .../org/apache/fineract/cn/payroll/TestSuite.java  |  30 ++
 .../cn/payroll/domain/DomainObjectGenerator.java   |  49 ++
 .../payroll/listener/MigrationEventListener.java   |  50 ++
 .../listener/PayrollConfigurationListener.java     |  56 +++
 .../listener/PayrollDistributionListener.java      |  56 +++
 20 files changed, 1376 insertions(+)

diff --git a/service/build.gradle b/service/build.gradle
index b7d4e95..79f2200 100644
--- a/service/build.gradle
+++ b/service/build.gradle
@@ -26,6 +26,7 @@ buildscript {
 
     dependencies {
         classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
+        classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.3")
     }
 }
 
@@ -36,6 +37,7 @@ plugins {
 
 apply from: '../shared.gradle'
 
+apply plugin: 'org.asciidoctor.convert'
 apply plugin: 'spring-boot'
 
 springBoot {
@@ -60,6 +62,24 @@ dependencies {
             [group: 'org.apache.fineract.cn', name: 'command', version: versions.frameworkcommand],
             [group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator]
     )
+    testCompile(
+            [group: 'org.apache.fineract.cn.payroll', name: 'api', version: project.version],
+            [group: 'org.apache.fineract.cn.anubis', name: 'test', version: versions.frameworkanubis],
+            [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', name: 'lang', version: versions.frameworklang],
+            [group: 'org.springframework.boot', name: 'spring-boot-starter-test'],
+            [group: 'org.springframework.restdocs', name: 'spring-restdocs-mockmvc'],
+            [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..8ab3b68
--- /dev/null
+++ b/service/src/doc/asciidoc/api-docs.adoc
@@ -0,0 +1,31 @@
+== Apache Fineract CN Payroll Management API Documentation ==
+
+== Payroll Configurations ==
+
+==== Configure Payroll Distribution ====
+
+.curl-request
+include::{snippets}/test-configurations/should-create-payroll-distribution/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-configurations/should-create-payroll-distribution/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-configurations/should-create-payroll-distribution/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-configurations/should-create-payroll-distribution/httpie-request.adoc[]
+
+==== Update Payroll Distribution ====
+
+.curl-request
+include::{snippets}/test-configurations/should-update-payroll-distribution/curl-request.adoc[]
+
+.http-request
+include::{snippets}/test-configurations/should-update-payroll-distribution/http-request.adoc[]
+
+.http-response
+include::{snippets}/test-configurations/should-update-payroll-distribution/http-response.adoc[]
+
+.httpie-request
+include::{snippets}/test-configurations/should-update-payroll-distribution/httpie-request.adoc[]
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/curl-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/curl-request.adoc
new file mode 100644
index 0000000..369d46e
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll' -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-request.adoc
new file mode 100644
index 0000000..973bc8e
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-request.adoc
@@ -0,0 +1,10 @@
+[source,http,options="nowrap"]
+----
+POST /payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 32
+
+wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-response.adoc b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/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-configurations/should-create-payroll-distribution/httpie-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/httpie-request.adoc
new file mode 100644
index 0000000..58f2cf5
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ echo 'wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3' | http POST 'http://localhost:8080/payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll' 'Accept:application/json' 'Content-Type:application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/curl-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/curl-request.adoc
new file mode 100644
index 0000000..cf59595
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/curl-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4' -i -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json'
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-request.adoc
new file mode 100644
index 0000000..da20ea8
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-request.adoc
@@ -0,0 +1,8 @@
+[source,http,options="nowrap"]
+----
+PUT /payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4 HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+
+----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-response.adoc b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-response.adoc
new file mode 100644
index 0000000..f3b256d
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/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-configurations/should-update-payroll-distribution/httpie-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/httpie-request.adoc
new file mode 100644
index 0000000..352b69e
--- /dev/null
+++ b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/httpie-request.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ http PUT 'http://localhost:8080/payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4' 'Accept:application/json' '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..105514b
--- /dev/null
+++ b/service/src/doc/html5/html5/api-docs.html
@@ -0,0 +1,508 @@
+<!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 Payroll 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_payroll_management_api_documentation">Apache Fineract CN Payroll Management API Documentation</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_payroll_configurations">Payroll Configurations</h2>
+<div class="sectionbody">
+<div class="sect3">
+<h4 id="_configure_payroll_distribution">Configure Payroll Distribution</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/payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll' -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3'</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 /payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+Host: localhost:8080
+Content-Length: 32
+
+wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3</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 'wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3' | http POST 'http://localhost:8080/payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll' 'Accept:application/json' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_update_payroll_distribution">Update Payroll Distribution</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/payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4' -i -X PUT -H 'Accept: application/json' -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">PUT /payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4 HTTP/1.1
+Accept: application/json
+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 PUT 'http://localhost:8080/payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4' 'Accept:application/json' 'Content-Type:application/json'</code></pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2018-04-23 16:34:50 +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/payroll/AbstractPayrollTest.java b/service/src/test/java/org/apache/fineract/cn/payroll/AbstractPayrollTest.java
new file mode 100644
index 0000000..5aca3d0
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/payroll/AbstractPayrollTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.payroll;
+
+
+import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
+import org.apache.fineract.cn.api.context.AutoUserContext;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.api.v1.client.PayrollManager;
+import org.apache.fineract.cn.payroll.service.PayrollServiceConfiguration;
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.cloud.netflix.feign.EnableFeignClients;
+import org.springframework.cloud.netflix.ribbon.RibbonClient;
+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 = {
+        AbstractPayrollTest.TestConfiguration.class
+    }
+)
+public class AbstractPayrollTest extends SuiteTestEnvironment {
+
+  @Configuration
+  @EnableEventRecording
+  @EnableFeignClients(basePackages = {
+      "org.apache.fineract.cn.payroll.api.v1.client"
+  })
+  @RibbonClient(name = SuiteTestEnvironment.APP_NAME)
+  @ComponentScan(
+      basePackages = {
+          "org.apache.fineract.cn.payroll.listener"
+      }
+  )
+  @Import({
+      PayrollServiceConfiguration.class
+  })
+  public static class TestConfiguration {
+    public TestConfiguration() {
+      super();
+    }
+  }
+
+  static final String TEST_USER = "mage";
+
+  @ClassRule
+  public final static TenantDataStoreContextTestRule tenantDataStoreContext =
+      TenantDataStoreContextTestRule.forRandomTenantName(SuiteTestEnvironment.cassandraInitializer,
+          SuiteTestEnvironment.mariaDBInitializer);
+
+  @Rule
+  public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
+      = new TenantApplicationSecurityEnvironmentTestRule(SuiteTestEnvironment.testEnvironment, this::waitForInitialize);
+
+  @Autowired
+  EventRecorder eventRecorder;
+
+  private AutoUserContext userContext;
+
+  @Autowired
+  PayrollManager testSubject;
+
+  public AbstractPayrollTest() {
+    super();
+  }
+
+  @Before
+  public void prepareTest() {
+    this.userContext = this.tenantApplicationSecurityEnvironment.createAutoUserContext(AbstractPayrollTest.TEST_USER);
+  }
+
+  @After
+  public void cleanupTest() {
+    userContext.close();
+  }
+
+  public boolean waitForInitialize() {
+    try {
+      return this.eventRecorder.wait(EventConstants.INITIALIZE, SuiteTestEnvironment.APP_VERSION);
+    } catch (final InterruptedException e) {
+      throw new IllegalStateException(e);
+    }
+  }
+
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/SuiteTestEnvironment.java b/service/src/test/java/org/apache/fineract/cn/payroll/SuiteTestEnvironment.java
new file mode 100644
index 0000000..ebe1880
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/payroll/SuiteTestEnvironment.java
@@ -0,0 +1,48 @@
+/*
+ * 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.payroll;
+
+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;
+
+/**
+ * This contains the database resources required by the test.  They are in a separate
+ * class so that the test suite can initialize them before the classes it calls. This
+ * makes test runs faster and prevents tests from "stepping on each other's toes" when
+ * initializing and de-initializing external resources.
+ */
+public class SuiteTestEnvironment {
+  static final String APP_VERSION = "1";
+  static final String APP_NAME = "payroll-v" + APP_VERSION;
+
+  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/payroll/TestPayrollConfiguration.java b/service/src/test/java/org/apache/fineract/cn/payroll/TestPayrollConfiguration.java
new file mode 100644
index 0000000..d5e41d6
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/payroll/TestPayrollConfiguration.java
@@ -0,0 +1,172 @@
+/*
+ * 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.payroll;
+
+import com.google.common.collect.Lists;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.customer.api.v1.domain.Customer;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollAllocation;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.domain.DomainObjectGenerator;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.CustomerAdaptor;
+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.boot.test.mock.mockito.MockBean;
+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.math.BigDecimal;
+import java.util.Optional;
+
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+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 TestPayrollConfiguration extends AbstractPayrollTest {
+
+  @Rule
+  public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("src/doc/generated-snippets/test-configurations");
+
+  @Autowired
+  private WebApplicationContext context;
+
+  private MockMvc mockMvc;
+
+  final String path = "/payroll/v1";
+
+  @Before
+  public void setUp(){
+
+    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+            .apply(documentationConfiguration(this.restDocumentation))
+            .alwaysDo(document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+            .build();
+  }
+
+  @MockBean
+  private CustomerAdaptor customerAdaptorSpy;
+  @MockBean
+  private AccountingAdaptor accountingAdaptorSpy;
+
+  public TestPayrollConfiguration() {
+    super();
+  }
+
+  @Test
+  public void shouldCreatePayrollDistribution() throws Exception {
+    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    this.prepareMocks(customerIdentifier, payrollConfiguration);
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    try {
+      this.mockMvc.perform(post(path + "/customers/" + customerIdentifier + "/payroll")
+              .accept(MediaType.APPLICATION_JSON_VALUE)
+              .contentType(MediaType.APPLICATION_JSON_VALUE)
+              .content(customerIdentifier))
+              .andExpect(status().isNotFound());
+    } catch (Exception e) { e.printStackTrace(); }
+  }
+
+  @Test
+  public void shouldUpdatePayrollDistribution() throws Exception {
+    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    this.prepareMocks(customerIdentifier, payrollConfiguration);
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    final PayrollAllocation newPayrollAllocation = new PayrollAllocation();
+    payrollConfiguration.setPayrollAllocations(Lists.newArrayList(newPayrollAllocation));
+    newPayrollAllocation.setAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    newPayrollAllocation.setAmount(BigDecimal.valueOf(15.00D));
+    newPayrollAllocation.setProportional(Boolean.FALSE);
+
+    Mockito
+            .doAnswer(invocation -> Optional.of(new Account()))
+            .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(newPayrollAllocation.getAccountNumber()));
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    Thread.sleep(500L);
+
+    final PayrollConfiguration fetchedPayrollConfiguration =
+            super.testSubject.findPayrollConfiguration(customerIdentifier);
+
+    Assert.assertNotNull(fetchedPayrollConfiguration.getLastModifiedBy());
+    Assert.assertNotNull(fetchedPayrollConfiguration.getLastModifiedOn());
+    Assert.assertEquals(1, fetchedPayrollConfiguration.getPayrollAllocations().size());
+
+    final Optional<PayrollAllocation> optionalPayrollAllocation =
+            fetchedPayrollConfiguration.getPayrollAllocations().stream().findFirst();
+
+    Assert.assertTrue(optionalPayrollAllocation.isPresent());
+
+    this.comparePayrollAllocations(newPayrollAllocation, optionalPayrollAllocation.get());
+
+    try {
+      this.mockMvc.perform(put(path + "/customers/" + customerIdentifier + "/payroll/" + payrollConfiguration.toString())
+              .accept(MediaType.APPLICATION_JSON_VALUE)
+              .contentType(MediaType.APPLICATION_JSON))
+              .andExpect(status().is4xxClientError());
+    } catch ( Exception E) { E.printStackTrace(); }
+  }
+
+  private void prepareMocks(final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
+    Mockito
+            .doAnswer(invocation -> Optional.of(new Customer()))
+            .when(this.customerAdaptorSpy).findCustomer(Matchers.eq(customerIdentifier));
+
+    Mockito
+            .doAnswer(invocation -> Optional.of(new Account()))
+            .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollConfiguration.getMainAccountNumber()));
+
+    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation ->
+            Mockito
+                    .doAnswer(invocation -> Optional.of(new Account()))
+                    .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()))
+    );
+  }
+
+  private void comparePayrollAllocations(final PayrollAllocation expected, final PayrollAllocation actual) {
+    Assert.assertEquals(expected.getAccountNumber(), actual.getAccountNumber());
+    Assert.assertTrue(expected.getAmount().compareTo(actual.getAmount()) == 0);
+    Assert.assertEquals(expected.getProportional(), actual.getProportional());
+  }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/TestPayrollDistribution.java b/service/src/test/java/org/apache/fineract/cn/payroll/TestPayrollDistribution.java
new file mode 100644
index 0000000..68c2991
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/payroll/TestPayrollDistribution.java
@@ -0,0 +1,198 @@
+/*
+ * 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.payroll;
+
+import com.google.common.collect.Lists;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.customer.api.v1.domain.Customer;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.api.v1.client.PayrollPaymentValidationException;
+import org.apache.fineract.cn.payroll.api.v1.domain.*;
+import org.apache.fineract.cn.payroll.domain.DomainObjectGenerator;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollCollectionEntity;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.CustomerAdaptor;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.springframework.boot.test.mock.mockito.MockBean;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Optional;
+
+public class TestPayrollDistribution extends AbstractPayrollTest {
+
+  @MockBean
+  private CustomerAdaptor customerAdaptorSpy;
+  @MockBean
+  private AccountingAdaptor accountingAdaptorSpy;
+
+  public TestPayrollDistribution() {
+    super();
+  }
+
+  @Test
+  public void shouldDistributePayments() throws Exception {
+    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    this.prepareMocks(customerIdentifier, payrollConfiguration);
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    final PayrollCollectionSheet payrollCollectionSheet = new PayrollCollectionSheet();
+    payrollCollectionSheet.setSourceAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    final PayrollPayment payrollPayment = new PayrollPayment();
+    payrollPayment.setCustomerIdentifier(customerIdentifier);
+    payrollPayment.setEmployer("ACME, Inc.");
+    payrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
+    payrollCollectionSheet.setPayrollPayments(Lists.newArrayList(payrollPayment));
+
+    final Account sourceAccount = new Account();
+    sourceAccount.setState(Account.State.OPEN.name());
+    Mockito
+        .doAnswer(invocation -> Optional.of(sourceAccount))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
+
+    Mockito
+        .doAnswer(invocation -> Optional.empty())
+        .when(this.accountingAdaptorSpy).postPayrollPayment(
+        Matchers.any(PayrollCollectionEntity.class),
+        Matchers.refEq(payrollPayment),
+        Matchers.any(PayrollConfiguration.class)
+    );
+
+    super.testSubject.distribute(payrollCollectionSheet);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_DISTRIBUTION, payrollCollectionSheet.getSourceAccountNumber()));
+
+    final List<PayrollCollectionHistory> payrollCollectionHistories = super.testSubject.fetchDistributionHistory();
+    Assert.assertEquals(1, payrollCollectionHistories.size());
+
+    final PayrollCollectionHistory payrollCollectionHistory = payrollCollectionHistories.get(0);
+    final PayrollPaymentPage payrollPaymentPage =
+        super.testSubject.fetchPayments(payrollCollectionHistory.getIdentifier(), 0, 10, null, null);
+    Assert.assertEquals(Long.valueOf(1L), payrollPaymentPage.getTotalElements());
+
+    final PayrollPayment fetchedPayrollPayment = payrollPaymentPage.getPayrollPayments().get(0);
+    Assert.assertTrue(fetchedPayrollPayment.getProcessed());
+  }
+
+  @Test(expected = PayrollPaymentValidationException.class)
+  public void shouldNotDistributePaymentsAllocatedAccountClosed() throws Exception {
+    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    this.prepareMocks(customerIdentifier, payrollConfiguration);
+
+    final PayrollAllocation invalidPayrollAllocation = new PayrollAllocation();
+    invalidPayrollAllocation.setAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    invalidPayrollAllocation.setProportional(Boolean.FALSE);
+    invalidPayrollAllocation.setAmount(BigDecimal.valueOf(200.00D));
+    payrollConfiguration.getPayrollAllocations().add(invalidPayrollAllocation);
+
+    final Account invalidPayrollAccount = new Account();
+    invalidPayrollAccount.setState(Account.State.CLOSED.name());
+    Mockito
+        .doAnswer(invocation -> Optional.of(invalidPayrollAccount))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(invalidPayrollAllocation.getAccountNumber()));
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    final PayrollCollectionSheet payrollCollectionSheet = new PayrollCollectionSheet();
+    payrollCollectionSheet.setSourceAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    final PayrollPayment payrollPayment = new PayrollPayment();
+    payrollPayment.setCustomerIdentifier(customerIdentifier);
+    payrollPayment.setEmployer("ACME, Inc.");
+    payrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
+    payrollCollectionSheet.setPayrollPayments(Lists.newArrayList(payrollPayment));
+
+    final Account sourceAccount = new Account();
+    sourceAccount.setState(Account.State.OPEN.name());
+    Mockito
+        .doAnswer(invocation -> Optional.of(sourceAccount))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
+
+    Mockito
+        .doAnswer(invocation -> Optional.empty())
+        .when(this.accountingAdaptorSpy).postPayrollPayment(
+        Matchers.any(PayrollCollectionEntity.class),
+        Matchers.refEq(payrollPayment),
+        Matchers.any(PayrollConfiguration.class)
+    );
+
+    super.testSubject.distribute(payrollCollectionSheet);
+  }
+
+  @Test(expected = PayrollPaymentValidationException.class)
+  public void shouldNotDistributePaymentsSourceAccountClosed() throws Exception {
+    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    this.prepareMocks(customerIdentifier, payrollConfiguration);
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    final PayrollCollectionSheet payrollCollectionSheet = new PayrollCollectionSheet();
+    payrollCollectionSheet.setSourceAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    final PayrollPayment payrollPayment = new PayrollPayment();
+    payrollPayment.setCustomerIdentifier(customerIdentifier);
+    payrollPayment.setEmployer("ACME, Inc.");
+    payrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
+    payrollCollectionSheet.setPayrollPayments(Lists.newArrayList(payrollPayment));
+
+    final Account sourceAccount = new Account();
+    sourceAccount.setState(Account.State.CLOSED.name());
+    Mockito
+        .doAnswer(invocation -> Optional.of(sourceAccount))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
+
+    Mockito
+        .doAnswer(invocation -> Optional.empty())
+        .when(this.accountingAdaptorSpy).postPayrollPayment(
+        Matchers.any(PayrollCollectionEntity.class),
+        Matchers.refEq(payrollPayment),
+        Matchers.any(PayrollConfiguration.class)
+    );
+
+    super.testSubject.distribute(payrollCollectionSheet);
+  }
+
+  private void prepareMocks(final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
+    Mockito
+        .doAnswer(invocation -> Optional.of(new Customer()))
+        .when(this.customerAdaptorSpy).findCustomer(Matchers.eq(customerIdentifier));
+
+    final Account mainAccount = new Account();
+    mainAccount.setState(Account.State.OPEN.name());
+    Mockito
+        .doAnswer(invocation -> Optional.of(mainAccount))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollConfiguration.getMainAccountNumber()));
+
+    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation -> {
+      final Account allocatedAccount = new Account();
+      allocatedAccount.setState(Account.State.OPEN.name());
+      Mockito
+          .doAnswer(invocation -> Optional.of(allocatedAccount))
+          .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()));
+    });
+  }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/TestSuite.java b/service/src/test/java/org/apache/fineract/cn/payroll/TestSuite.java
new file mode 100644
index 0000000..5fe0817
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/payroll/TestSuite.java
@@ -0,0 +1,30 @@
+/*
+ * 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.payroll;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TestPayrollConfiguration.class,
+    TestPayrollDistribution.class
+})
+public class TestSuite extends SuiteTestEnvironment {
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/domain/DomainObjectGenerator.java b/service/src/test/java/org/apache/fineract/cn/payroll/domain/DomainObjectGenerator.java
new file mode 100644
index 0000000..dc3dbfe
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/payroll/domain/DomainObjectGenerator.java
@@ -0,0 +1,49 @@
+/*
+ * 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.payroll.domain;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollAllocation;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+
+public class DomainObjectGenerator {
+
+  private DomainObjectGenerator() {
+    super();
+  }
+
+  public static PayrollConfiguration getPayrollConfiguration() {
+    final PayrollConfiguration payrollConfiguration = new PayrollConfiguration();
+    payrollConfiguration.setMainAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+
+    final ArrayList<PayrollAllocation> payrollAllocations = new ArrayList<>();
+    payrollConfiguration.setPayrollAllocations(payrollAllocations);
+
+    final PayrollAllocation savingsAllocation = new PayrollAllocation();
+    payrollAllocations.add(savingsAllocation);
+    savingsAllocation.setAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    savingsAllocation.setAmount(BigDecimal.valueOf(5.00D));
+    savingsAllocation.setProportional(Boolean.TRUE);
+
+    return payrollConfiguration;
+  }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/listener/MigrationEventListener.java b/service/src/test/java/org/apache/fineract/cn/payroll/listener/MigrationEventListener.java
new file mode 100644
index 0000000..fc5867b
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/payroll/listener/MigrationEventListener.java
@@ -0,0 +1,50 @@
+/*
+ * 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.payroll.listener;
+
+import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.test.listener.EventRecorder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+
+@SuppressWarnings("unused")
+@Component
+public class MigrationEventListener {
+
+  private final EventRecorder eventRecorder;
+
+  @Autowired
+  public MigrationEventListener(@SuppressWarnings("SpringJavaAutowiringInspection") final EventRecorder eventRecorder) {
+    super();
+    this.eventRecorder = eventRecorder;
+  }
+
+  @JmsListener(
+      subscription = EventConstants.DESTINATION,
+      destination = EventConstants.DESTINATION,
+      selector = EventConstants.SELECTOR_INITIALIZE
+  )
+  public void onInitialization(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+                               final String payload) {
+    this.eventRecorder.event(tenant, EventConstants.INITIALIZE, payload, String.class);
+  }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollConfigurationListener.java b/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollConfigurationListener.java
new file mode 100644
index 0000000..776112d
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollConfigurationListener.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.payroll.listener;
+
+import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
+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 PayrollConfigurationListener {
+
+  private final Logger logger;
+  private final EventRecorder eventRecorder;
+
+  @Autowired
+  public PayrollConfigurationListener(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                                      final EventRecorder eventRecorder) {
+    super();
+    this.logger = logger;
+    this.eventRecorder = eventRecorder;
+  }
+
+  @JmsListener(
+      subscription = EventConstants.DESTINATION,
+      destination = EventConstants.DESTINATION,
+      selector = EventConstants.SELECTOR_PUT_CONFIGURATION
+  )
+  public void onPutConfiguration(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+                                 final String payload) {
+    this.logger.info("Payment configuration for customer {} processed.", payload);
+    this.eventRecorder.event(tenant, EventConstants.PUT_CONFIGURATION, payload, String.class);
+  }
+}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollDistributionListener.java b/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollDistributionListener.java
new file mode 100644
index 0000000..c489f2a
--- /dev/null
+++ b/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollDistributionListener.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.payroll.listener;
+
+import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
+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 PayrollDistributionListener {
+
+  private final Logger logger;
+  private final EventRecorder eventRecorder;
+
+  @Autowired
+  public PayrollDistributionListener(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                                     final EventRecorder eventRecorder) {
+    super();
+    this.logger = logger;
+    this.eventRecorder = eventRecorder;
+  }
+
+  @JmsListener(
+      subscription = EventConstants.DESTINATION,
+      destination = EventConstants.DESTINATION,
+      selector = EventConstants.SELECTOR_POST_DISTRIBUTION
+  )
+  public void onPostCollection(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+                               final String payload) {
+    this.logger.info("Payment distribution with source account {0} processed.", payload);
+    this.eventRecorder.event(tenant, EventConstants.POST_DISTRIBUTION, payload, String.class);
+  }
+}


[fineract-cn-payroll] 44/50: Merge pull request #7 from Izakey/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 9f53efc1a7e813c0c1870534a8c8667d04d6c34b
Merge: 3b637b9 d596ee2
Author: Awasum Yannick <ya...@gmail.com>
AuthorDate: Thu Sep 6 11:29:11 2018 +0100

    Merge pull request #7 from Izakey/develop
    
    Document Payroll API to configure payroll allocations

 component-test/build.gradle                        |  13 +-
 .../cn/payroll/PayrollApiDocumentation.java        | 413 +++++++++++++++++++++
 2 files changed, 425 insertions(+), 1 deletion(-)


[fineract-cn-payroll] 45/50: FINCN-148 build with travis-ci.com and upload artifacts to Artifactory

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 70f439baf17f663cd73d11e1ac0fd4b750c024be
Author: Juhan Aasaru <Ju...@nortal.com>
AuthorDate: Thu Apr 25 13:58:30 2019 +0300

    FINCN-148 build with travis-ci.com and upload artifacts to Artifactory
---
 .travis.yml                 | 30 +++++++++++++++++++
 README.md                   |  2 +-
 api/build.gradle            |  3 +-
 build.gradle                |  8 +++++
 component-test/build.gradle |  4 ++-
 service/build.gradle        |  5 ++--
 shared.gradle               | 17 +++++++++++
 travis.sh                   | 71 +++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 135 insertions(+), 5 deletions(-)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..8abfb4f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+language: java
+sudo: false
+jdk:
+- openjdk8
+install: true
+script: "./travis.sh"
+env:
+  global:
+    - BUILD_SNAPSHOTS_BRANCH=develop
+    - ARTIFACTORY_URL=https://mifos.jfrog.io/mifos
+    - ARTIFACTORY_USER=travis-ci
+    - secure: "CEwvv6FRZQvFB2PO7HE0rvjQB2nvGvbE7uLzSeBJDTLc3KygcokOlaDBBolpvHUvydLG7RTQwLKLZv4C5E0aSgIFyszcDlPFOn9638GaLqmdhT41ihUKlmMkv6xAbQhq2cCEoIy8HWrcnOg6e5pj4FXlfKDRI/GNDMV+x0GblW0UoYSSyMb45SWGc0PJxa5vPYaukGnNQoVfqcynE5rHqvpbaBBbXgidQsLsZRp/vukcsblIpo04N5X+mjoQVGNCsgng/Vt5p/B/VFKC8l6kxKIq1eIDe+wjdotfBw9krXjKWZVq/whDvGvCHBdwCM5rGrLUBN0fJ2qf01loo05t57s0YcBxtAZtlxhHppW7TW2hv7lH+HoN+pNEFj7fnSFtldCvwqJwlqWBOFAQhLVNPajZQRwrcU6RDnPPeUEvOCvUveSfSecvlsJ3ykbA6OG1Xalc7y+VRQdthxuNzI0TA6hrd8/lz [...]
diff --git a/README.md b/README.md
index 8d684de..eed37e6 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Apache Fineract CN Payroll
+# Apache Fineract CN Payroll [![Build Status](https://api.travis-ci.com/apache/fineract-cn-payroll.svg?branch=develop)](https://travis-ci.com/apache/fineract-cn-payroll)
 
 This project provides functionality to configure payroll allocations and distribute payroll payments for customers.
 
diff --git a/api/build.gradle b/api/build.gradle
index 5b9924a..a11f487 100644
--- a/api/build.gradle
+++ b/api/build.gradle
@@ -28,6 +28,7 @@ buildscript {
 plugins {
     id "com.github.hierynomus.license" version "0.13.1"
     id("org.nosphere.apache.rat") version "0.3.1"
+    id "com.jfrog.artifactory" version "4.9.5"
 }
 
 apply from: '../shared.gradle'
@@ -51,7 +52,7 @@ publishing {
             from components.java
             groupId project.group
             artifactId project.name
-            version project.version
+            version project.findProperty('externalVersion') ?: project.version
         }
     }
 }
diff --git a/build.gradle b/build.gradle
index 848847a..eeb68fb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -39,6 +39,14 @@ task publishToMavenLocal {
     dependsOn publishComponentTestToMavenLocal
 }
 
+task artifactoryPublish {
+    group 'all'
+    dependsOn publishToMavenLocal
+    dependsOn gradle.includedBuild('api').task(':artifactoryPublish')
+    dependsOn gradle.includedBuild('service').task(':artifactoryPublish')
+    dependsOn gradle.includedBuild('component-test').task(':artifactoryPublish')
+}
+
 task prepareForTest {
     group 'all'
     dependsOn publishToMavenLocal
diff --git a/component-test/build.gradle b/component-test/build.gradle
index 7723165..ec66397 100644
--- a/component-test/build.gradle
+++ b/component-test/build.gradle
@@ -33,6 +33,7 @@ buildscript {
 plugins {
     id "com.github.hierynomus.license" version "0.13.1"
     id("org.nosphere.apache.rat") version "0.3.1"
+    id "com.jfrog.artifactory" version "4.9.5"
 }
 apply from: '../shared.gradle'
 apply plugin: 'org.asciidoctor.convert'
@@ -60,8 +61,9 @@ asciidoctor {
 
 publishing {
     publications {
-        mavenJava(MavenPublication) {
+        componentTest(MavenPublication) {
             from components.java
+            version project.findProperty('externalVersion') ?: project.version
         }
     }
 }
diff --git a/service/build.gradle b/service/build.gradle
index b7d4e95..0b514d9 100644
--- a/service/build.gradle
+++ b/service/build.gradle
@@ -32,6 +32,7 @@ buildscript {
 plugins {
     id "com.github.hierynomus.license" version "0.13.1"
     id("org.nosphere.apache.rat") version "0.3.1"
+    id "com.jfrog.artifactory" version "4.9.5"
 }
 
 apply from: '../shared.gradle'
@@ -70,14 +71,14 @@ publishing {
             from components.java
             groupId project.group
             artifactId project.name
-            version project.version
+            version project.findProperty('externalVersion') ?: project.version
         }
         bootService(MavenPublication) {
             // "boot" jar
             artifact ("$buildDir/libs/$project.name-$version-boot.jar")
             groupId project.group
             artifactId ("$project.name-boot")
-            version project.version
+            version project.findProperty('externalVersion') ?: project.version
         }
     }
 }
diff --git a/shared.gradle b/shared.gradle
index 588312c..f5b0848 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -45,6 +45,7 @@ tasks.withType(JavaCompile) {
 repositories {
     jcenter()
     mavenLocal()
+    maven { url 'https://mifos.jfrog.io/mifos/libs-snapshot/' }
 }
 
 dependencyManagement {
@@ -75,6 +76,22 @@ jar {
     duplicatesStrategy = DuplicatesStrategy.EXCLUDE
 }
 
+artifactory {
+    contextUrl = System.getenv("ARTIFACTORY_URL")
+    publish {
+        repository {
+            repoKey = project.findProperty('artifactoryRepoKey')
+            username = System.getenv("ARTIFACTORY_USER")
+            password = System.getenv("ARTIFACTORY_PASSWORD")
+        }
+
+        defaults {
+            publications ('api', 'componentTest', 'service', 'bootService') 
+        }
+    }
+}
+artifactoryPublish.dependsOn('clean','publishToMavenLocal')
+
 license {
     header rootProject.file('../HEADER')
     strictCheck true
diff --git a/travis.sh b/travis.sh
new file mode 100755
index 0000000..03a75ee
--- /dev/null
+++ b/travis.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+#
+# 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.
+#
+
+# Documentation: https://cwiki.apache.org/confluence/display/FINERACT/Fineract-CN+Artifactory
+
+#Exit immediately if a command exits with a non-zero status.
+set -e
+EXIT_STATUS=0
+
+# Builds and Publishes a SNAPSHOT
+function build_snapshot() {
+  echo -e "Building and publishing a snapshot out of branch [$TRAVIS_BRANCH]"
+  ./gradlew -PartifactoryRepoKey=libs-snapshot-local -DbuildInfo.build.number=${TRAVIS_COMMIT::7} artifactoryPublish --stacktrace || EXIT_STATUS=$?
+}
+
+# Builds a Pull Request
+function build_pullrequest() {
+  echo -e "Building pull request #$TRAVIS_PULL_REQUEST of branch [$TRAVIS_BRANCH]. Won't publish anything to Artifactory."
+  ./gradlew publishToMavenLocal rat || EXIT_STATUS=$?
+}
+
+# For other branches we need to add branch name as prefix
+function build_otherbranch() {
+  echo -e "Building a snapshot out of branch [$TRAVIS_BRANCH] and publishing it with prefix '${TRAVIS_BRANCH}-SNAPSHOT'"
+  ./gradlew -PartifactoryRepoKey=libs-snapshot-local -DbuildInfo.build.number=${TRAVIS_COMMIT::7} -PexternalVersion=${TRAVIS_BRANCH}-SNAPSHOT artifactoryPublish --stacktrace || EXIT_STATUS=$?
+}
+
+# Builds and Publishes a Tag
+function build_tag() {
+  echo -e "Building tag [$TRAVIS_TAG] and publishing it as a release"
+  ./gradlew -PartifactoryRepoKey=libs-release-local -PexternalVersion=$TRAVIS_TAG artifactoryPublish --stacktrace || EXIT_STATUS=$?
+
+}
+
+echo -e "TRAVIS_BRANCH=$TRAVIS_BRANCH"
+echo -e "TRAVIS_TAG=$TRAVIS_TAG"
+echo -e "TRAVIS_COMMIT=${TRAVIS_COMMIT::7}"
+echo -e "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST"
+
+# Build Logic
+if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
+  build_pullrequest
+elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" != "$BUILD_SNAPSHOTS_BRANCH" ] && [ "$TRAVIS_TAG" == "" ]  ; then
+  build_otherbranch
+elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "$BUILD_SNAPSHOTS_BRANCH" ] && [ "$TRAVIS_TAG" == "" ] ; then
+  build_snapshot
+elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
+  build_tag
+else
+  echo -e "WARN: Unexpected env variable values => Branch [$TRAVIS_BRANCH], Tag [$TRAVIS_TAG], Pull Request [#$TRAVIS_PULL_REQUEST]"
+  ./gradlew clean build
+fi
+
+exit ${EXIT_STATUS}


[fineract-cn-payroll] 11/50: Changed initialize payload to the version number as agreed.

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 486ae6b52dc351172e7a2c6be4b511914ebb3cb1
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Jul 10 12:16:22 2017 +0200

    Changed initialize payload to the version number as agreed.
---
 .../src/main/java/io/mifos/template/SuiteTestEnvironment.java     | 4 +++-
 component-test/src/main/java/io/mifos/template/TestSample.java    | 2 +-
 .../service/internal/command/handler/MigrationAggregate.java      | 8 ++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java b/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java
index dd5bfd0..923cf79 100644
--- a/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java
+++ b/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java
@@ -30,7 +30,9 @@ import org.junit.rules.TestRule;
  * initializing and de-initializing external resources.
  */
 public class SuiteTestEnvironment {
-  static final String APP_NAME = "template-v1";
+  static final String APP_VERSION = "1";
+  static final String APP_NAME = "template-v" + APP_VERSION;
+
   static final TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
   static final CassandraInitializer cassandraInitializer = new CassandraInitializer();
   static final MariaDBInitializer mariaDBInitializer = new MariaDBInitializer();
diff --git a/component-test/src/main/java/io/mifos/template/TestSample.java b/component-test/src/main/java/io/mifos/template/TestSample.java
index 924512b..92ae690 100644
--- a/component-test/src/main/java/io/mifos/template/TestSample.java
+++ b/component-test/src/main/java/io/mifos/template/TestSample.java
@@ -103,7 +103,7 @@ public class TestSample extends SuiteTestEnvironment {
 
   public boolean waitForInitialize() {
     try {
-      return this.eventRecorder.wait(EventConstants.INITIALIZE, EventConstants.INITIALIZE);
+      return this.eventRecorder.wait(EventConstants.INITIALIZE, APP_VERSION);
     } catch (final InterruptedException e) {
       throw new IllegalStateException(e);
     }
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
index 920465a..12ae643 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
@@ -19,6 +19,7 @@ import io.mifos.core.command.annotation.Aggregate;
 import io.mifos.core.command.annotation.CommandHandler;
 import io.mifos.core.command.annotation.CommandLogLevel;
 import io.mifos.core.command.annotation.EventEmitter;
+import io.mifos.core.lang.ApplicationName;
 import io.mifos.core.mariadb.domain.FlywayFactoryBean;
 import io.mifos.template.api.v1.events.EventConstants;
 import io.mifos.template.service.ServiceConstants;
@@ -39,15 +40,18 @@ public class MigrationAggregate {
   private final Logger logger;
   private final DataSource dataSource;
   private final FlywayFactoryBean flywayFactoryBean;
+  private final ApplicationName applicationName;
 
   @Autowired
   public MigrationAggregate(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
                             final DataSource dataSource,
-                            final FlywayFactoryBean flywayFactoryBean) {
+                            final FlywayFactoryBean flywayFactoryBean,
+                            final ApplicationName applicationName) {
     super();
     this.logger = logger;
     this.dataSource = dataSource;
     this.flywayFactoryBean = flywayFactoryBean;
+    this.applicationName = applicationName;
   }
 
   @CommandHandler(logStart = CommandLogLevel.INFO, logFinish = CommandLogLevel.INFO)
@@ -56,6 +60,6 @@ public class MigrationAggregate {
   public String initialize(final InitializeServiceCommand initializeServiceCommand) {
     this.logger.debug("Start service migration.");
     this.flywayFactoryBean.create(this.dataSource).migrate();
-    return EventConstants.INITIALIZE;
+    return this.applicationName.getVersionString();
   }
 }


[fineract-cn-payroll] 47/50: Add Docker configuration

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 7943293b8369024ddb4623c88f0871500194a9b9
Author: Anh3h <co...@gmail.com>
AuthorDate: Mon May 20 16:16:33 2019 -0400

    Add Docker configuration
---
 .dockerignore | 17 +++++++++++++++++
 .gitignore    |  2 ++
 Dockerfile    | 30 ++++++++++++++++++++++++++++++
 shared.gradle |  3 ++-
 4 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..8d88495
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,17 @@
+api/
+component-test/
+gradle/
+gradlew.bat
+LICENSE
+README.md
+settings.gradle
+build.gradle
+docs/
+gradlew
+HEADER
+NOTICE.txt
+service/
+.git/
+.gradle/
+.gitignore
+shared.gradle
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 1d62734..91f20f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,5 @@ gradle-app.setting
 *.log
 
 *.toDelete
+
+*.jar 
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..82451f6
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+FROM openjdk:8-jdk-alpine
+
+ARG payroll_port=2030
+
+ENV server.max-http-header-size=16384 \
+    cassandra.clusterName="Test Cluster" \
+    server.port=$payroll_port
+
+WORKDIR /tmp
+COPY payroll-service-boot-0.1.0-BUILD-SNAPSHOT.jar .
+
+CMD ["java", "-jar", "payroll-service-boot-0.1.0-BUILD-SNAPSHOT.jar"]
diff --git a/shared.gradle b/shared.gradle
index f5b0848..f9aef4d 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -112,6 +112,7 @@ rat {
             "**/build/**",
             "gradlew",
             "gradlew.bat",
-            "README.md"
+            "README.md",
+            "**/.dockerignore/**"
     ]
 }
\ No newline at end of file


[fineract-cn-payroll] 09/50: Provided example for hands-off command handler logging, and documented it's constraints.

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 9e03ed87002217cca55d8d91823f95254432f75b
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Jul 10 12:05:02 2017 +0200

    Provided example for hands-off command handler logging, and documented
     it's constraints.
---
 .../internal/command/InitializeServiceCommand.java        |  5 +++++
 .../template/service/internal/command/SampleCommand.java  |  7 +++++++
 .../internal/command/handler/MigrationAggregate.java      |  2 +-
 .../service/internal/command/handler/SampleAggregate.java | 15 ++++++++++++++-
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java b/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java
index db85b9d..e02d2d0 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java
@@ -20,4 +20,9 @@ public class InitializeServiceCommand {
   public InitializeServiceCommand() {
     super();
   }
+
+  @Override
+  public String toString() {
+    return "InitializeServiceCommand{}";
+  }
 }
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java b/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java
index 8ee6d92..5957f1b 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java
@@ -29,4 +29,11 @@ public class SampleCommand {
   public Sample sample() {
     return this.sample;
   }
+
+  @Override
+  public String toString() {
+    return "SampleCommand{" +
+        "sample=" + sample.getIdentifier() +
+        '}';
+  }
 }
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
index 083513c..920465a 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
@@ -50,7 +50,7 @@ public class MigrationAggregate {
     this.flywayFactoryBean = flywayFactoryBean;
   }
 
-  @CommandHandler
+  @CommandHandler(logStart = CommandLogLevel.INFO, logFinish = CommandLogLevel.INFO)
   @Transactional
   @EventEmitter(selectorName = EventConstants.SELECTOR_NAME, selectorValue = EventConstants.INITIALIZE)
   public String initialize(final InitializeServiceCommand initializeServiceCommand) {
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
index b2e8d5d..9a7c572 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
@@ -17,6 +17,7 @@ package io.mifos.template.service.internal.command.handler;
 
 import io.mifos.core.command.annotation.Aggregate;
 import io.mifos.core.command.annotation.CommandHandler;
+import io.mifos.core.command.annotation.CommandLogLevel;
 import io.mifos.core.command.annotation.EventEmitter;
 import io.mifos.template.api.v1.events.EventConstants;
 import io.mifos.template.service.internal.command.SampleCommand;
@@ -37,7 +38,19 @@ public class SampleAggregate {
     this.sampleJpaEntityRepository = sampleJpaEntityRepository;
   }
 
-  @CommandHandler
+  //TODO: Think about your command handler logging, then delete this comment.
+  // The log levels provided in the command handler cause log messages to be emitted each time this
+  // command handler is called before and after the call. Before the call, the command is logged
+  // using its toString() method, and after the call, the emitted event is logged via its toString()
+  // method.
+  //
+  // If you wish to adjust the information in the log messages, do so via the toString() methods.
+  // Financial transactions, passwords, and customer address data are examples of information which
+  // should not be placed in the logs.
+  //
+  // If a command handler should not emit a log message, change logStart and logFinish to:
+  // CommandLogLevel.NONE.
+  @CommandHandler(logStart = CommandLogLevel.INFO, logFinish = CommandLogLevel.INFO)
   @Transactional
   @EventEmitter(selectorName = EventConstants.SELECTOR_NAME, selectorValue = EventConstants.POST_SAMPLE)
   public String sample(final SampleCommand sampleCommand) {


[fineract-cn-payroll] 31/50: Removed unused year and name variables

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 173d3151eb031d536f4646a962896d310e60d237
Author: Isaac Kamga <u2...@gmail.com>
AuthorDate: Mon Mar 5 21:33:12 2018 +0100

    Removed unused year and name variables
---
 shared.gradle | 2 --
 1 file changed, 2 deletions(-)

diff --git a/shared.gradle b/shared.gradle
index b8a3316..68c1b02 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -67,6 +67,4 @@ license {
         yml = 'SCRIPT_STYLE'
         yaml = 'SCRIPT_STYLE'
     }
-    ext.year = Calendar.getInstance().get(Calendar.YEAR)
-    ext.name = 'The Apache Software Foundation'
 }


[fineract-cn-payroll] 41/50: Merge pull request #6 from apache/revert-5-develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 3b637b99dbb03e75658d866e50af1cfea26cf508
Merge: a050e1d e94c0e3
Author: Isaac Kamga <u2...@gmail.com>
AuthorDate: Mon Jun 11 02:26:59 2018 +0100

    Merge pull request #6 from apache/revert-5-develop
    
    Revert "Document the payroll API"

 service/build.gradle                               |  20 -
 service/src/doc/asciidoc/api-docs.adoc             |  31 --
 .../curl-request.adoc                              |   4 -
 .../http-request.adoc                              |  10 -
 .../http-response.adoc                             |   5 -
 .../httpie-request.adoc                            |   4 -
 .../curl-request.adoc                              |   4 -
 .../http-request.adoc                              |   8 -
 .../http-response.adoc                             |   5 -
 .../httpie-request.adoc                            |   4 -
 service/src/doc/html5/html5/api-docs.html          | 508 ---------------------
 .../fineract/cn/payroll/AbstractPayrollTest.java   | 114 -----
 .../fineract/cn/payroll/SuiteTestEnvironment.java  |  48 --
 .../cn/payroll/TestPayrollConfiguration.java       | 172 -------
 .../cn/payroll/TestPayrollDistribution.java        | 198 --------
 .../org/apache/fineract/cn/payroll/TestSuite.java  |  30 --
 .../cn/payroll/domain/DomainObjectGenerator.java   |  49 --
 .../payroll/listener/MigrationEventListener.java   |  50 --
 .../listener/PayrollConfigurationListener.java     |  56 ---
 .../listener/PayrollDistributionListener.java      |  56 ---
 20 files changed, 1376 deletions(-)


[fineract-cn-payroll] 21/50: Merge pull request #3 from markusgeiss/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 468e43fc5a7dddfbca170506af0bd872513865a1
Merge: ce161c6 d59dc5c
Author: Markus Geiss <ma...@kuelap.io>
AuthorDate: Wed Sep 20 13:59:56 2017 +0200

    Merge pull request #3 from markusgeiss/develop
    
    only allow one account per config and allocation

 .../io/mifos/payroll/api/v1/domain/PayrollAllocation.java | 15 +++++++++++++++
 1 file changed, 15 insertions(+)


[fineract-cn-payroll] 50/50: Merge pull request #11 from ebenezergraham/FINCN-157

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 676ff4837e90ad847bd6c2b48bbf432089a2b011
Merge: bcb953f 3b540cc
Author: Awasum Yannick <aw...@apache.org>
AuthorDate: Mon Jun 3 20:02:31 2019 +0100

    Merge pull request #11 from ebenezergraham/FINCN-157
    
    Adding rat report to After Failure procedure

 .travis.yml   | 3 +++
 shared.gradle | 1 +
 2 files changed, 4 insertions(+)

diff --cc shared.gradle
index f9aef4d,be05e13..9d6ba9a
--- a/shared.gradle
+++ b/shared.gradle
@@@ -112,7 -112,7 +112,8 @@@ rat 
              "**/build/**",
              "gradlew",
              "gradlew.bat",
 -            "README.md"
 +            "README.md",
 +            "**/.dockerignore/**"
      ]
+     plainOutput = true
  }


[fineract-cn-payroll] 05/50: added path configurer to allow dots in url

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit a0d25be681d7a3cd5033068eb735b02009408798
Author: mgeiss <mg...@mifos.org>
AuthorDate: Wed Apr 26 18:12:55 2017 +0200

    added path configurer to allow dots in url
---
 .../java/io/mifos/template/service/TemplateConfiguration.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java b/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java
index d0fd484..33ee609 100644
--- a/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java
+++ b/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java
@@ -30,6 +30,8 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
 
 @SuppressWarnings("WeakerAccess")
 @Configuration
@@ -51,7 +53,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
 @EnableJpaRepositories({
     "io.mifos.template.service.internal.repository"
 })
-public class TemplateConfiguration {
+public class TemplateConfiguration extends WebMvcConfigurerAdapter {
 
   public TemplateConfiguration() {
     super();
@@ -61,4 +63,9 @@ public class TemplateConfiguration {
   public Logger logger() {
     return LoggerFactory.getLogger(ServiceConstants.LOGGER_NAME);
   }
+
+  @Override
+  public void configurePathMatch(final PathMatchConfigurer configurer) {
+    configurer.setUseSuffixPatternMatch(Boolean.FALSE);
+  }
 }


[fineract-cn-payroll] 06/50: Merge pull request #2 from mgeiss/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit d9745aa49188b07df5ad5f328dcf7e9ac6da2b6b
Merge: ec0791d a0d25be
Author: Markus Geiß <ma...@apache.org>
AuthorDate: Wed Apr 26 20:07:26 2017 +0200

    Merge pull request #2 from mgeiss/develop
    
    added path configurer to allow dots in url

 .../java/io/mifos/template/service/TemplateConfiguration.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)


[fineract-cn-payroll] 10/50: Merge pull request #3 from myrle-krantz/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 6b00c28ab9002b5fb186c2f7662271e5ed344abd
Merge: d9745aa 9e03ed8
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Jul 10 12:08:59 2017 +0200

    Merge pull request #3 from myrle-krantz/develop
    
    added helpful examples to template.

 .../api/v1/{ => events}/EventConstants.java        |  2 +-
 .../io/mifos/template/SuiteTestEnvironment.java    | 43 ++++++++++++++++++++++
 .../main/java/io/mifos/template/TestSample.java    | 36 ++++++++----------
 .../src/main/java/io/mifos/template/TestSuite.java | 14 ++++---
 .../template/listener/MigrationEventListener.java  |  2 +-
 .../template/listener/SampleEventListener.java     |  2 +-
 .../internal/command/InitializeServiceCommand.java |  5 +++
 .../service/internal/command/SampleCommand.java    |  7 ++++
 .../command/handler/MigrationAggregate.java        |  5 ++-
 .../internal/command/handler/SampleAggregate.java  | 17 ++++++++-
 10 files changed, 100 insertions(+), 33 deletions(-)


[fineract-cn-payroll] 17/50: Merge pull request #1 from markvanveen/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 5955e0850c6d9753b47f3fa519cc47c6b357139f
Merge: 118dd1d 4cd0af4
Author: Mark van Veen <30...@users.noreply.github.com>
AuthorDate: Tue Sep 19 14:34:39 2017 +0200

    Merge pull request #1 from markvanveen/develop
    
    Remove dot from version to be consistent

 .../service/internal/command/handler/PayrollConfigurationAggregate.java | 2 ++
 .../payroll/service/internal/mapper/PayrollConfigurationMapper.java     | 2 +-
 shared.gradle                                                           | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)


[fineract-cn-payroll] 33/50: Adding rat checks.

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 025fb9e5a3f9685342a2a44595a13faf24eb0e0e
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Apr 9 20:31:56 2018 +0200

    Adding rat checks.
---
 api/build.gradle               | 18 ++++++++++++++++++
 api/settings.gradle            | 17 +++++++++++++++++
 build.gradle                   | 24 ++++++++++++++++++++++++
 component-test/build.gradle    | 18 ++++++++++++++++++
 component-test/settings.gradle | 17 +++++++++++++++++
 service/build.gradle           | 18 ++++++++++++++++++
 service/settings.gradle        | 17 +++++++++++++++++
 settings.gradle                | 17 +++++++++++++++++
 shared.gradle                  | 30 ++++++++++++++++++++++++++++++
 9 files changed, 176 insertions(+)

diff --git a/api/build.gradle b/api/build.gradle
index 1ed9d2b..5b9924a 100644
--- a/api/build.gradle
+++ b/api/build.gradle
@@ -1,3 +1,20 @@
+/*
+ * 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.
+ */
+
 buildscript {
     repositories {
         jcenter()
@@ -10,6 +27,7 @@ buildscript {
 
 plugins {
     id "com.github.hierynomus.license" version "0.13.1"
+    id("org.nosphere.apache.rat") version "0.3.1"
 }
 
 apply from: '../shared.gradle'
diff --git a/api/settings.gradle b/api/settings.gradle
index 7c8e3dc..491f745 100644
--- a/api/settings.gradle
+++ b/api/settings.gradle
@@ -1 +1,18 @@
+/*
+ * 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.
+ */
+
 rootProject.name = 'api'
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index b82a3b2..848847a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,3 +1,20 @@
+/*
+ * 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.
+ */
+
 group 'org.apache.fineract.cn'
 
 task publishApiToMavenLocal {
@@ -34,3 +51,10 @@ task licenseFormat {
     dependsOn gradle.includedBuild('service').task(':licenseFormat')
     dependsOn gradle.includedBuild('component-test').task(':licenseFormat')
 }
+
+task rat {
+    group 'all'
+    dependsOn gradle.includedBuild('api').task(':rat')
+    dependsOn gradle.includedBuild('service').task(':rat')
+    dependsOn gradle.includedBuild('component-test').task(':rat')
+}
diff --git a/component-test/build.gradle b/component-test/build.gradle
index 83583a1..95878f3 100644
--- a/component-test/build.gradle
+++ b/component-test/build.gradle
@@ -1,3 +1,20 @@
+/*
+ * 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.
+ */
+
 buildscript {
     ext {
         springBootVersion = '1.4.1.RELEASE'
@@ -14,6 +31,7 @@ buildscript {
 
 plugins {
     id "com.github.hierynomus.license" version "0.13.1"
+    id("org.nosphere.apache.rat") version "0.3.1"
 }
 apply from: '../shared.gradle'
 
diff --git a/component-test/settings.gradle b/component-test/settings.gradle
index 07867cb..a07a3bc 100644
--- a/component-test/settings.gradle
+++ b/component-test/settings.gradle
@@ -1 +1,18 @@
+/*
+ * 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.
+ */
+
 rootProject.name = 'component-test'
\ No newline at end of file
diff --git a/service/build.gradle b/service/build.gradle
index f90732b..b7d4e95 100644
--- a/service/build.gradle
+++ b/service/build.gradle
@@ -1,3 +1,20 @@
+/*
+ * 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.
+ */
+
 buildscript {
     ext {
         springBootVersion = '1.4.1.RELEASE'
@@ -14,6 +31,7 @@ buildscript {
 
 plugins {
     id "com.github.hierynomus.license" version "0.13.1"
+    id("org.nosphere.apache.rat") version "0.3.1"
 }
 
 apply from: '../shared.gradle'
diff --git a/service/settings.gradle b/service/settings.gradle
index 081feb4..1a4c2fd 100644
--- a/service/settings.gradle
+++ b/service/settings.gradle
@@ -1 +1,18 @@
+/*
+ * 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.
+ */
+
 rootProject.name = 'service'
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index f97fef4..0537ec0 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,3 +1,20 @@
+/*
+ * 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.
+ */
+
 rootProject.name = 'payroll'
 
 includeBuild 'api'
diff --git a/shared.gradle b/shared.gradle
index 68c1b02..588312c 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -1,3 +1,20 @@
+/*
+ * 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.
+ */
+
 group 'org.apache.fineract.cn.payroll'
 version '0.1.0-BUILD-SNAPSHOT'
 
@@ -68,3 +85,16 @@ license {
         yaml = 'SCRIPT_STYLE'
     }
 }
+
+rat {
+    // List of exclude directives, defaults to ['**/.gradle/**']
+    excludes = [
+            "**/.idea/**",
+            "**/.gradle/**",
+            "**/gradle/**",
+            "**/build/**",
+            "gradlew",
+            "gradlew.bat",
+            "README.md"
+    ]
+}
\ No newline at end of file


[fineract-cn-payroll] 07/50: Provided example necessary for running multiple tests as a suite. This is a pre-req for continuous integration.

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 15528625ed719bc3350f337f0f59b6e3e0ff7f4f
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Jul 10 11:51:53 2017 +0200

    Provided example necessary for running multiple tests as a suite. This
    is a pre-req for continuous integration.
---
 .../io/mifos/template/SuiteTestEnvironment.java    | 43 ++++++++++++++++++++++
 .../main/java/io/mifos/template/TestSample.java    | 34 +++++++----------
 .../src/main/java/io/mifos/template/TestSuite.java | 27 ++++++++++++++
 3 files changed, 84 insertions(+), 20 deletions(-)

diff --git a/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java b/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java
new file mode 100644
index 0000000..dd5bfd0
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.template;
+
+import io.mifos.core.test.env.TestEnvironment;
+import io.mifos.core.test.fixture.cassandra.CassandraInitializer;
+import io.mifos.core.test.fixture.mariadb.MariaDBInitializer;
+import org.junit.ClassRule;
+import org.junit.rules.RuleChain;
+import org.junit.rules.RunExternalResourceOnce;
+import org.junit.rules.TestRule;
+
+/**
+ * This contains the database resources required by the test.  They are in a separate
+ * class so that the test suite can initialize them before the classes it calls. This
+ * makes test runs faster and prevents tests from "stepping on each other's toes" when
+ * initializing and de-initializing external resources.
+ */
+public class SuiteTestEnvironment {
+  static final String APP_NAME = "template-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/component-test/src/main/java/io/mifos/template/TestSample.java b/component-test/src/main/java/io/mifos/template/TestSample.java
index b829355..9e90129 100644
--- a/component-test/src/main/java/io/mifos/template/TestSample.java
+++ b/component-test/src/main/java/io/mifos/template/TestSample.java
@@ -17,10 +17,7 @@ package io.mifos.template;
 
 import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
 import io.mifos.core.api.context.AutoUserContext;
-import io.mifos.core.test.env.TestEnvironment;
 import io.mifos.core.test.fixture.TenantDataStoreContextTestRule;
-import io.mifos.core.test.fixture.cassandra.CassandraInitializer;
-import io.mifos.core.test.fixture.mariadb.MariaDBInitializer;
 import io.mifos.core.test.listener.EnableEventRecording;
 import io.mifos.core.test.listener.EventRecorder;
 import io.mifos.template.api.v1.EventConstants;
@@ -29,12 +26,11 @@ import io.mifos.template.api.v1.domain.Sample;
 import io.mifos.template.service.TemplateConfiguration;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.junit.*;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TestRule;
 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.cloud.netflix.feign.EnableFeignClients;
 import org.springframework.cloud.netflix.ribbon.RibbonClient;
@@ -48,9 +44,10 @@ import java.util.List;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
-public class TestSample {
+public class TestSample extends SuiteTestEnvironment {
+  private static final String LOGGER_NAME = "test-logger";
+  private static final String TEST_USER = "homer";
 
-  private static final String APP_NAME = "template-v1";
 
   @Configuration
   @EnableEventRecording
@@ -63,24 +60,14 @@ public class TestSample {
       super();
     }
 
-    @Bean()
+    @Bean(name = LOGGER_NAME)
     public Logger logger() {
-      return LoggerFactory.getLogger("test-logger");
+      return LoggerFactory.getLogger(LOGGER_NAME);
     }
   }
-  private static final String TEST_USER = "homer";
-
-  private final static TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
-  private final static CassandraInitializer cassandraInitializer = new CassandraInitializer();
-  private final static MariaDBInitializer mariaDBInitializer = new MariaDBInitializer();
-  private final static TenantDataStoreContextTestRule tenantDataStoreContext = TenantDataStoreContextTestRule.forRandomTenantName(cassandraInitializer, mariaDBInitializer);
 
   @ClassRule
-  public static TestRule orderClassRules = RuleChain
-          .outerRule(testEnvironment)
-          .around(cassandraInitializer)
-          .around(mariaDBInitializer)
-          .around(tenantDataStoreContext);
+  public final static TenantDataStoreContextTestRule tenantDataStoreContext = TenantDataStoreContextTestRule.forRandomTenantName(cassandraInitializer, mariaDBInitializer);
 
   @Rule
   public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
@@ -94,6 +81,11 @@ public class TestSample {
   @Autowired
   private EventRecorder eventRecorder;
 
+  @SuppressWarnings("WeakerAccess")
+  @Autowired
+  @Qualifier(LOGGER_NAME)
+  Logger logger;
+
   public TestSample() {
     super();
   }
@@ -119,6 +111,7 @@ public class TestSample {
 
   @Test
   public void shouldCreateSample() throws InterruptedException {
+    logger.info("Running test shouldCreateSample.");
     final Sample sample = Sample.create(RandomStringUtils.randomAlphanumeric(8), RandomStringUtils.randomAlphanumeric(512));
     this.testSubject.createEntity(sample);
 
@@ -130,6 +123,7 @@ public class TestSample {
 
   @Test
   public void shouldListSamples() {
+    logger.info("Running test shouldListSamples.");
     final List<Sample> allEntities = this.testSubject.findAllEntities();
     Assert.assertNotNull(allEntities);
   }
diff --git a/component-test/src/main/java/io/mifos/template/TestSuite.java b/component-test/src/main/java/io/mifos/template/TestSuite.java
new file mode 100644
index 0000000..44ed340
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/template/TestSuite.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.template;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TestSample.class,
+    //TODO: when you create a new component test, add it here so you can run it with the suite.
+})
+public class TestSuite extends SuiteTestEnvironment {
+}


[fineract-cn-payroll] 15/50: initial commit

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 118dd1df0e001f35cdbc3889f07915c5b60491b3
Author: mgeiss <mg...@mifos.org>
AuthorDate: Mon Sep 18 16:36:23 2017 +0200

    initial commit
---
 .gitignore                                         |   1 +
 README.md                                          |  47 +------
 .../events => payroll/api/v1}/EventConstants.java  |  16 ++-
 .../api/v1/PermittableGroupIds.java                |   6 +-
 .../api/v1/client/CustomerNotFoundException.java}  |   5 +-
 .../PayrollConfigurationNotFoundException.java     |   5 +-
 .../PayrollDistributionValidationException.java    |   5 +-
 .../payroll/api/v1/client/PayrollManager.java      |  96 ++++++++++++++
 .../client/PayrollPaymentValidationException.java  |   5 +-
 .../payroll/api/v1/domain/PayrollAllocation.java   |  62 +++++++++
 .../api/v1/domain/PayrollCollectionHistory.java    |  68 ++++++++++
 .../api/v1/domain/PayrollCollectionSheet.java      |  51 +++++++
 .../api/v1/domain/PayrollConfiguration.java        |  86 ++++++++++++
 .../payroll/api/v1/domain/PayrollPayment.java      |  63 +++++++++
 .../payroll/api/v1/domain/PayrollPaymentPage.java  |  61 +++++++++
 .../template/api/v1/client/TemplateManager.java    |  57 --------
 .../io/mifos/template/api/v1/domain/Sample.java    |  70 ----------
 .../mifos/template/api/v1/domain/SampleTest.java   |  55 --------
 component-test/build.gradle                        |   4 +-
 .../java/io/mifos/payroll/AbstractPayrollTest.java | 111 ++++++++++++++++
 .../SuiteTestEnvironment.java                      |   4 +-
 .../io/mifos/payroll/TestPayrollConfiguration.java | 118 +++++++++++++++++
 .../io/mifos/payroll/TestPayrollDistribution.java  | 101 ++++++++++++++
 .../io/mifos/{template => payroll}/TestSuite.java  |   6 +-
 .../payroll/domain/DomainObjectGenerator.java      |  46 +++++++
 .../listener/MigrationEventListener.java           |   4 +-
 .../listener/PayrollConfigurationListener.java}    |  24 ++--
 .../listener/PayrollDistributionListener.java}     |  22 ++--
 .../main/java/io/mifos/template/TestSample.java    | 130 ------------------
 component-test/src/main/resources/logback-test.xml |  34 +++++
 gradle/wrapper/gradle-wrapper.properties           |   4 +-
 service/build.gradle                               |   4 +-
 .../service/PayrollApplication.java}               |   8 +-
 .../service/PayrollServiceConfiguration.java}      |  23 ++--
 .../service/ServiceConstants.java                  |   4 +-
 .../command/DistributePayrollCommand.java}         |  24 ++--
 .../internal/command/MigrateServiceCommand.java}   |  12 +-
 .../command/PutPayrollConfigurationCommand.java    |  38 ++++++
 .../command/handler/MigrationAggregate.java        |  26 ++--
 .../handler/PayrollConfigurationAggregate.java     |  99 ++++++++++++++
 .../handler/PayrollDistributionAggregate.java      |  96 ++++++++++++++
 .../internal/mapper/PayrollAllocationMapper.java   |  42 ++++++
 .../mapper/PayrollConfigurationMapper.java         |  39 ++++++
 .../internal/mapper/PayrollPaymentMapper.java      |  34 +++++
 .../repository/PayrollAllocationEntity.java        |  89 +++++++++++++
 .../repository/PayrollAllocationRepository.java}   |  14 +-
 .../repository/PayrollCollectionEntity.java        |  89 +++++++++++++
 .../repository/PayrollCollectionRepository.java}   |   9 +-
 .../repository/PayrollConfigurationEntity.java     | 111 ++++++++++++++++
 .../PayrollConfigurationRepository.java}           |   6 +-
 .../internal/repository/PayrollPaymentEntity.java  |  89 +++++++++++++
 .../repository/PayrollPaymentRepository.java}      |  11 +-
 .../service/PayrollConfigurationService.java       |  83 ++++++++++++
 .../service/PayrollDistributionService.java        | 100 ++++++++++++++
 .../service/adaptor/AccountingAdaptor.java         | 112 ++++++++++++++++
 .../internal/service/adaptor/CustomerAdaptor.java  |  51 +++++++
 .../service/rest/MigrationRestController.java      |  56 ++++++++
 .../rest/PayrollConfigurationRestController.java   | 113 ++++++++++++++++
 .../rest/PayrollDistributionRestController.java    | 146 +++++++++++++++++++++
 .../payroll/service/rest/util/PageableBuilder.java |  41 ++++++
 .../internal/command/handler/SampleAggregate.java  |  65 ---------
 .../service/internal/mapper/SampleMapper.java      |  43 ------
 .../internal/repository/SampleJpaEntity.java       |  61 ---------
 .../service/internal/service/SampleService.java    |  45 -------
 .../service/rest/SampleRestController.java         | 112 ----------------
 service/src/main/resources/application.yml         |   2 +-
 service/src/main/resources/bootstrap.yml           |   2 +-
 .../db/migrations/mariadb/V1__initial_setup.sql    |  46 ++++++-
 service/src/main/resources/logback.xml             |  55 ++++++++
 settings.gradle                                    |   2 +-
 shared.gradle                                      |   4 +-
 71 files changed, 2561 insertions(+), 812 deletions(-)

diff --git a/.gitignore b/.gitignore
index f9d7cba..1d62734 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
 .idea
 build/
 target/
+out/
 
 # Ignore Gradle GUI config
 gradle-app.setting
diff --git a/README.md b/README.md
index 1839633..8636dff 100644
--- a/README.md
+++ b/README.md
@@ -1,49 +1,6 @@
-# Mifos I/O Template
+# Mifos I/O Payroll
 
-[![Join the chat at https://gitter.im/mifos-initiative/mifos.io](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mifos-initiative/mifos.io?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
-This project provides a template layout for all Mifos I/O microservices.
-
-## Abstract
-Mifos I/O is an application framework for digital financial services, a system to support nationwide and cross-national financial transactions and help to level and speed the creation of an inclusive, interconnected digital economy for every nation in the world.
-
-## Steps needed to turn the template project into a real project
-
-1.  Git clone template into {project name} folder
-
-        git clone https://github.com/mifosio/template.git {project name}
-
-2.  Delete _.git_
-
-        rm -rf .git
-    
-3.  Open settings.gradle and replace value of _rootProject.name_ with {project name}
-
-4.  Open root build.gradle and replace value of _version_ with 0.1.0-snapshot
-
-6.  Create Gradle wrapper
-
-        gradle wrapper
-
-6.  Open all module specific build.gradle files (api, service, and component-test) and replace value of _group_ with io.mifos.{project name}
-
-7.  Import project into IDE
-
-8.  Rename all io.mifos.template packages to io.mifos.{project name}
-
-9.  Open _SampleRestConfiguration_ and _SampleServiceConfiguration_, adjust @ComponentScan to reflect the new package name
-
-10. Open _application.yml_ and replace _server.contextPath_ with /{project name}/v1/*
-
-11. Open _bootstrap.yml_ and replace _spring.application.name_ with {project name}/v1/
-
-12. Open _SampleTest_ and replace constructor argument of TestEnvironment in line 80 with {project name}/v1/
-
-13. Run _SampleTest_
-
-14. Replace the contents of the README with text describing your new project.
-
-15. Happy coding! ; o) 
+This project provides functionality to configure payroll allocations and distribute payroll payments for customers.
 
 ## Versioning
 The version numbers follow the [Semantic Versioning](http://semver.org/) scheme.
diff --git a/api/src/main/java/io/mifos/template/api/v1/events/EventConstants.java b/api/src/main/java/io/mifos/payroll/api/v1/EventConstants.java
similarity index 67%
rename from api/src/main/java/io/mifos/template/api/v1/events/EventConstants.java
rename to api/src/main/java/io/mifos/payroll/api/v1/EventConstants.java
index 6207c03..72e925b 100644
--- a/api/src/main/java/io/mifos/template/api/v1/events/EventConstants.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/EventConstants.java
@@ -13,14 +13,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.api.v1.events;
+package io.mifos.payroll.api.v1;
 
 @SuppressWarnings("unused")
 public interface EventConstants {
 
-  String DESTINATION = "template-v1";
+  String DESTINATION = "payroll-v1";
   String SELECTOR_NAME = "action";
+
+  // Migration events
   String INITIALIZE = "initialize";
+
+  // Payroll configuration events
+  String PUT_CONFIGURATION = "put-configuration";
+  String SELECTOR_PUT_CONFIGURATION = SELECTOR_NAME + " = '" + PUT_CONFIGURATION + "'";
+
+  // Payroll distribution events
+  String POST_DISTRIBUTION = "post-distribution";
+  String SELECTOR_POST_DISTRIBUTION = SELECTOR_NAME + " = '" + POST_DISTRIBUTION + "'";
+
+
   String POST_SAMPLE = "post-sample";
   String SELECTOR_INITIALIZE = SELECTOR_NAME + " = '" + INITIALIZE + "'";
   String SELECTOR_POST_SAMPLE = SELECTOR_NAME + " = '" + POST_SAMPLE + "'";
diff --git a/api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java b/api/src/main/java/io/mifos/payroll/api/v1/PermittableGroupIds.java
similarity index 82%
rename from api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java
rename to api/src/main/java/io/mifos/payroll/api/v1/PermittableGroupIds.java
index 239e2ac..f925986 100644
--- a/api/src/main/java/io/mifos/template/api/v1/PermittableGroupIds.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/PermittableGroupIds.java
@@ -13,10 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.api.v1;
+package io.mifos.payroll.api.v1;
 
 @SuppressWarnings("unused")
 public interface PermittableGroupIds {
-  String SAMPLE_MANAGEMENT = "template__v1__samples";
-  String SELF_MANAGEMENT = "template__v1__self";
+  String CONFIGURATION = "payroll__v1__configuration";
+  String DISTRIBUTION = "payroll__v1__distribution";
 }
diff --git a/api/src/main/java/io/mifos/template/api/v1/client/IamATeapotException.java b/api/src/main/java/io/mifos/payroll/api/v1/client/CustomerNotFoundException.java
similarity index 81%
rename from api/src/main/java/io/mifos/template/api/v1/client/IamATeapotException.java
rename to api/src/main/java/io/mifos/payroll/api/v1/client/CustomerNotFoundException.java
index ec4383c..ca8d1c8 100644
--- a/api/src/main/java/io/mifos/template/api/v1/client/IamATeapotException.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/CustomerNotFoundException.java
@@ -13,8 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.api.v1.client;
+package io.mifos.payroll.api.v1.client;
 
-@SuppressWarnings("WeakerAccess")
-public class IamATeapotException extends RuntimeException {
+public class CustomerNotFoundException extends RuntimeException {
 }
diff --git a/service/src/main/java/io/mifos/template/service/ServiceConstants.java b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
similarity index 83%
copy from service/src/main/java/io/mifos/template/service/ServiceConstants.java
copy to api/src/main/java/io/mifos/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
index e9e0623..0c39d16 100644
--- a/service/src/main/java/io/mifos/template/service/ServiceConstants.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
@@ -13,8 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service;
+package io.mifos.payroll.api.v1.client;
 
-public interface ServiceConstants {
-  String LOGGER_NAME = "rest-logger";
+public class PayrollConfigurationNotFoundException extends RuntimeException {
 }
diff --git a/service/src/main/java/io/mifos/template/service/ServiceConstants.java b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollDistributionValidationException.java
similarity index 83%
copy from service/src/main/java/io/mifos/template/service/ServiceConstants.java
copy to api/src/main/java/io/mifos/payroll/api/v1/client/PayrollDistributionValidationException.java
index e9e0623..2f330f2 100644
--- a/service/src/main/java/io/mifos/template/service/ServiceConstants.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollDistributionValidationException.java
@@ -13,8 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service;
+package io.mifos.payroll.api.v1.client;
 
-public interface ServiceConstants {
-  String LOGGER_NAME = "rest-logger";
+public class PayrollDistributionValidationException extends RuntimeException {
 }
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
new file mode 100644
index 0000000..5c232c0
--- /dev/null
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.api.v1.client;
+
+import io.mifos.core.api.annotation.ThrowsException;
+import io.mifos.core.api.annotation.ThrowsExceptions;
+import io.mifos.core.api.util.CustomFeignClientsConfiguration;
+import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
+import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
+import org.springframework.cloud.netflix.feign.FeignClient;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.validation.Valid;
+import java.util.List;
+
+@SuppressWarnings("unused")
+@FeignClient(name="payroll-v1", path="/payroll/v1", configuration = CustomFeignClientsConfiguration.class)
+public interface PayrollManager {
+
+  @RequestMapping(
+      value = "/customers/{identifier}/payroll",
+      method = RequestMethod.PUT,
+      produces = MediaType.APPLICATION_JSON_VALUE,
+      consumes = MediaType.APPLICATION_JSON_VALUE
+  )
+  @ThrowsExceptions({
+      @ThrowsException(status = HttpStatus.NOT_FOUND, exception = CustomerNotFoundException.class),
+      @ThrowsException(status = HttpStatus.BAD_REQUEST, exception = PayrollDistributionValidationException.class)
+  })
+  void setPayrollConfiguration(@PathVariable(value = "identifier") final String customerIdentifier,
+                               @RequestBody @Valid final PayrollConfiguration payrollConfiguration);
+
+  @RequestMapping(
+      value = "/customers/{identifier}/payroll",
+      method = RequestMethod.GET,
+      produces = MediaType.ALL_VALUE,
+      consumes = MediaType.APPLICATION_JSON_VALUE
+  )
+  @ThrowsExceptions({
+      @ThrowsException(status = HttpStatus.NOT_FOUND, exception = PayrollConfigurationNotFoundException.class)
+  })
+  PayrollConfiguration findPayrollConfiguration(@PathVariable(value = "identifier") final String customerIdentifier);
+
+  @RequestMapping(
+      value = "/distribution",
+      method = RequestMethod.POST,
+      produces = MediaType.APPLICATION_JSON_VALUE,
+      consumes = MediaType.APPLICATION_JSON_VALUE
+  )
+  @ThrowsExceptions({
+      @ThrowsException(status = HttpStatus.BAD_REQUEST, exception = PayrollPaymentValidationException.class)
+  })
+  void distribute(@RequestBody @Valid final PayrollCollectionSheet payrollCollectionSheet);
+
+  @RequestMapping(
+      value = "/distribution",
+      method = RequestMethod.GET,
+      produces = MediaType.ALL_VALUE,
+      consumes = MediaType.APPLICATION_JSON_VALUE
+  )
+  List<PayrollCollectionHistory> fetchDistributionHistory();
+
+  @RequestMapping(
+      value = "/distribution/{identifier}/payments",
+      method = RequestMethod.GET,
+      produces = MediaType.ALL_VALUE,
+      consumes = MediaType.APPLICATION_JSON_VALUE
+  )
+  PayrollPaymentPage fetchPayments(@PathVariable("identifier") final String identifier,
+                                   @RequestParam(value = "pageIndex", required = false) final Integer pageIndex,
+                                   @RequestParam(value = "size", required = false) final Integer size,
+                                   @RequestParam(value = "sortColumn", required = false) final String sortColumn,
+                                   @RequestParam(value = "sortDirection", required = false) final String sortDirection);
+
+}
diff --git a/service/src/main/java/io/mifos/template/service/ServiceConstants.java b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollPaymentValidationException.java
similarity index 84%
copy from service/src/main/java/io/mifos/template/service/ServiceConstants.java
copy to api/src/main/java/io/mifos/payroll/api/v1/client/PayrollPaymentValidationException.java
index e9e0623..90ee5e5 100644
--- a/service/src/main/java/io/mifos/template/service/ServiceConstants.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollPaymentValidationException.java
@@ -13,8 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service;
+package io.mifos.payroll.api.v1.client;
 
-public interface ServiceConstants {
-  String LOGGER_NAME = "rest-logger";
+public class PayrollPaymentValidationException extends RuntimeException {
 }
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
new file mode 100644
index 0000000..3a4d42c
--- /dev/null
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.api.v1.domain;
+
+import io.mifos.core.lang.validation.constraints.ValidIdentifier;
+
+import javax.validation.constraints.DecimalMax;
+import javax.validation.constraints.DecimalMin;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+public class PayrollAllocation {
+
+  @ValidIdentifier(maxLength = 34)
+  private String accountNumber;
+  @NotNull
+  @DecimalMin("0.001")
+  @DecimalMax("9999999999.99999")
+  private BigDecimal amount;
+  private Boolean proportional = Boolean.FALSE;
+
+  public PayrollAllocation() {
+    super();
+  }
+
+  public String getAccountNumber() {
+    return this.accountNumber;
+  }
+
+  public void setAccountNumber(final String accountNumber) {
+    this.accountNumber = accountNumber;
+  }
+
+  public BigDecimal getAmount() {
+    return this.amount;
+  }
+
+  public void setAmount(final BigDecimal amount) {
+    this.amount = amount;
+  }
+
+  public Boolean getProportional() {
+    return this.proportional;
+  }
+
+  public void setProportional(final Boolean proportional) {
+    this.proportional = proportional;
+  }
+}
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java
new file mode 100644
index 0000000..b0b5f77
--- /dev/null
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.api.v1.domain;
+
+import io.mifos.core.lang.validation.constraints.ValidIdentifier;
+
+import javax.validation.constraints.NotNull;
+
+public class PayrollCollectionHistory {
+
+  @ValidIdentifier
+  private String identifier;
+  @ValidIdentifier(maxLength = 34)
+  private String sourceAccountNumber;
+  @ValidIdentifier
+  private String createdBy;
+  @NotNull
+  private String createdOn;
+
+  public PayrollCollectionHistory() {
+    super();
+  }
+
+  public String getIdentifier() {
+    return this.identifier;
+  }
+
+  public void setIdentifier(final String identifier) {
+    this.identifier = identifier;
+  }
+
+  public String getSourceAccountNumber() {
+    return this.sourceAccountNumber;
+  }
+
+  public void setSourceAccountNumber(final String sourceAccountNumber) {
+    this.sourceAccountNumber = sourceAccountNumber;
+  }
+
+  public String getCreatedBy() {
+    return this.createdBy;
+  }
+
+  public void setCreatedBy(final String createdBy) {
+    this.createdBy = createdBy;
+  }
+
+  public String getCreatedOn() {
+    return this.createdOn;
+  }
+
+  public void setCreatedOn(final String createdOn) {
+    this.createdOn = createdOn;
+  }
+}
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
new file mode 100644
index 0000000..99f2f78
--- /dev/null
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.api.v1.domain;
+
+import io.mifos.core.lang.validation.constraints.ValidIdentifier;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class PayrollCollectionSheet {
+
+  @ValidIdentifier(maxLength = 34)
+  private String sourceAccountNumber;
+  @NotNull
+  @Valid
+  private List<PayrollPayment> payrollPayments;
+
+  public PayrollCollectionSheet() {
+    super();
+  }
+
+  public String getSourceAccountNumber() {
+    return this.sourceAccountNumber;
+  }
+
+  public void setSourceAccountNumber(final String sourceAccountNumber) {
+    this.sourceAccountNumber = sourceAccountNumber;
+  }
+
+  public List<PayrollPayment> getPayrollPayments() {
+    return this.payrollPayments;
+  }
+
+  public void setPayrollPayments(final List<PayrollPayment> payrollPayments) {
+    this.payrollPayments = payrollPayments;
+  }
+}
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
new file mode 100644
index 0000000..5375a9a
--- /dev/null
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.api.v1.domain;
+
+import io.mifos.core.lang.validation.constraints.ValidIdentifier;
+
+import javax.validation.Valid;
+import java.util.HashSet;
+import java.util.Set;
+
+public class PayrollConfiguration {
+
+  @ValidIdentifier(maxLength = 34)
+  private String mainAccountNumber;
+  @Valid
+  private Set<PayrollAllocation> payrollAllocations = new HashSet<>();
+  private String createdBy;
+  private String createdOn;
+  private String lastModifiedBy;
+  private String lastModifiedOn;
+
+  public PayrollConfiguration() {
+    super();
+  }
+
+  public String getMainAccountNumber() {
+    return this.mainAccountNumber;
+  }
+
+  public void setMainAccountNumber(final String mainAccountNumber) {
+    this.mainAccountNumber = mainAccountNumber;
+  }
+
+  public Set<PayrollAllocation> getPayrollAllocations() {
+    return this.payrollAllocations;
+  }
+
+  public void setPayrollAllocations(final Set<PayrollAllocation> payrollAllocations) {
+    this.payrollAllocations = payrollAllocations;
+  }
+
+  public String getCreatedBy() {
+    return this.createdBy;
+  }
+
+  public void setCreatedBy(final String createdBy) {
+    this.createdBy = createdBy;
+  }
+
+  public String getCreatedOn() {
+    return this.createdOn;
+  }
+
+  public void setCreatedOn(final String createdOn) {
+    this.createdOn = createdOn;
+  }
+
+  public String getLastModifiedBy() {
+    return this.lastModifiedBy;
+  }
+
+  public void setLastModifiedBy(final String lastModifiedBy) {
+    this.lastModifiedBy = lastModifiedBy;
+  }
+
+  public String getLastModifiedOn() {
+    return this.lastModifiedOn;
+  }
+
+  public void setLastModifiedOn(final String lastModifiedOn) {
+    this.lastModifiedOn = lastModifiedOn;
+  }
+}
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
new file mode 100644
index 0000000..50daa4b
--- /dev/null
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.api.v1.domain;
+
+import io.mifos.core.lang.validation.constraints.ValidIdentifier;
+
+import javax.validation.constraints.DecimalMax;
+import javax.validation.constraints.DecimalMin;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+public class PayrollPayment {
+
+  @ValidIdentifier
+  private String customerIdentifier;
+  @NotNull
+  private String employer;
+  @NotNull
+  @DecimalMin("0.001")
+  @DecimalMax("9999999999.99999")
+  private BigDecimal salary;
+
+  public PayrollPayment() {
+    super();
+  }
+
+  public String getCustomerIdentifier() {
+    return this.customerIdentifier;
+  }
+
+  public void setCustomerIdentifier(final String customerIdentifier) {
+    this.customerIdentifier = customerIdentifier;
+  }
+
+  public String getEmployer() {
+    return this.employer;
+  }
+
+  public void setEmployer(final String employer) {
+    this.employer = employer;
+  }
+
+  public BigDecimal getSalary() {
+    return this.salary;
+  }
+
+  public void setSalary(final BigDecimal salary) {
+    this.salary = salary;
+  }
+}
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPaymentPage.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPaymentPage.java
new file mode 100644
index 0000000..2e28399
--- /dev/null
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPaymentPage.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.api.v1.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PayrollPaymentPage {
+
+  private List<PayrollPayment> payrollPayments;
+  private Integer totalPages;
+  private Long totalElements;
+
+  public PayrollPaymentPage() {
+    super();
+  }
+
+  public List<PayrollPayment> getPayrollPayments() {
+    return this.payrollPayments;
+  }
+
+  public void setPayrollPayments(final List<PayrollPayment> payrollPayments) {
+    this.payrollPayments = payrollPayments;
+  }
+
+  public Integer getTotalPages() {
+    return this.totalPages;
+  }
+
+  public void setTotalPages(final Integer totalPages) {
+    this.totalPages = totalPages;
+  }
+
+  public Long getTotalElements() {
+    return this.totalElements;
+  }
+
+  public void setTotalElements(final Long totalElements) {
+    this.totalElements = totalElements;
+  }
+
+  public void add(final PayrollPayment payrollPayment) {
+    if (this.payrollPayments == null) {
+      this.payrollPayments = new ArrayList<>();
+    }
+    this.payrollPayments.add(payrollPayment);
+  }
+}
diff --git a/api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java b/api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java
deleted file mode 100644
index 9914e36..0000000
--- a/api/src/main/java/io/mifos/template/api/v1/client/TemplateManager.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2017 The Mifos Initiative.
- *
- * Licensed 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 io.mifos.template.api.v1.client;
-
-import io.mifos.core.api.annotation.ThrowsException;
-import io.mifos.core.api.util.CustomFeignClientsConfiguration;
-import io.mifos.template.api.v1.domain.Sample;
-import org.springframework.cloud.netflix.feign.FeignClient;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
-import java.util.List;
-
-@SuppressWarnings("unused")
-@FeignClient(value="template-v1", path="/template/v1", configuration = CustomFeignClientsConfiguration.class)
-public interface TemplateManager {
-
-  @RequestMapping(
-          value = "/sample",
-          method = RequestMethod.GET,
-          produces = MediaType.ALL_VALUE,
-          consumes = MediaType.APPLICATION_JSON_VALUE
-  )
-  List<Sample> findAllEntities();
-
-  @RequestMapping(
-          value = "/sample/{identifier}",
-          method = RequestMethod.GET,
-          produces = MediaType.ALL_VALUE,
-          consumes = MediaType.APPLICATION_JSON_VALUE)
-  Sample getEntity(@PathVariable("identifier") final String identifier);
-
-  @RequestMapping(
-      value = "/sample",
-      method = RequestMethod.POST,
-      produces = MediaType.APPLICATION_JSON_VALUE,
-      consumes = MediaType.APPLICATION_JSON_VALUE
-  )
-  @ThrowsException(status = HttpStatus.I_AM_A_TEAPOT, exception = IamATeapotException.class)
-  void createEntity(final Sample sample);
-}
diff --git a/api/src/main/java/io/mifos/template/api/v1/domain/Sample.java b/api/src/main/java/io/mifos/template/api/v1/domain/Sample.java
deleted file mode 100644
index 6f25719..0000000
--- a/api/src/main/java/io/mifos/template/api/v1/domain/Sample.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2017 The Mifos Initiative.
- *
- * Licensed 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 io.mifos.template.api.v1.domain;
-
-import io.mifos.core.lang.validation.constraints.ValidIdentifier;
-import org.hibernate.validator.constraints.Length;
-
-import java.util.Objects;
-
-@SuppressWarnings({"WeakerAccess", "unused"})
-public class Sample {
-  @ValidIdentifier
-  private String identifier;
-  @Length(max = 512)
-  private String payload;
-
-  public Sample() {
-    super();
-  }
-
-  public static Sample create(final String identifier, final String payload) {
-    final Sample sample = new Sample();
-    sample.setIdentifier(identifier);
-    sample.setPayload(payload);
-    return sample;
-  }
-
-  public String getIdentifier() {
-    return this.identifier;
-  }
-
-  public void setIdentifier(final String identifier) {
-    this.identifier = identifier;
-  }
-
-  public String getPayload() {
-    return payload;
-  }
-
-  public void setPayload(String payload) {
-    this.payload = payload;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-    Sample sample = (Sample) o;
-    return Objects.equals(identifier, sample.identifier) &&
-            Objects.equals(payload, sample.payload);
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(identifier, payload);
-  }
-}
diff --git a/api/src/test/java/io/mifos/template/api/v1/domain/SampleTest.java b/api/src/test/java/io/mifos/template/api/v1/domain/SampleTest.java
deleted file mode 100644
index acf33cb..0000000
--- a/api/src/test/java/io/mifos/template/api/v1/domain/SampleTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2017 The Mifos Initiative.
- *
- * Licensed 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 io.mifos.template.api.v1.domain;
-
-import io.mifos.core.test.domain.ValidationTest;
-import io.mifos.core.test.domain.ValidationTestCase;
-import org.apache.commons.lang.RandomStringUtils;
-import org.junit.runners.Parameterized;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-public class SampleTest extends ValidationTest<Sample> {
-
-  public SampleTest(ValidationTestCase<Sample> testCase) {
-    super(testCase);
-  }
-
-  @Override
-  protected Sample createValidTestSubject() {
-    return Sample.create("xxxx", "yyy");
-  }
-
-  @Parameterized.Parameters
-  public static Collection testCases() {
-    final Collection<ValidationTestCase> ret = new ArrayList<>();
-    ret.add(new ValidationTestCase<Sample>("basicCase")
-            .adjustment(x -> {})
-            .valid(true));
-    ret.add(new ValidationTestCase<Sample>("nullIdentifier")
-            .adjustment(x -> x.setIdentifier(null))
-            .valid(false));
-    ret.add(new ValidationTestCase<Sample>("tooShortIdentifier")
-            .adjustment(x -> x.setIdentifier("z"))
-            .valid(false));
-    ret.add(new ValidationTestCase<Sample>("tooLongPayload")
-            .adjustment(x -> x.setPayload(RandomStringUtils.randomAlphanumeric(513)))
-            .valid(false));
-    return ret;
-  }
-
-}
\ No newline at end of file
diff --git a/component-test/build.gradle b/component-test/build.gradle
index 7818273..4e0cc53 100644
--- a/component-test/build.gradle
+++ b/component-test/build.gradle
@@ -19,8 +19,8 @@ apply from: '../shared.gradle'
 
 dependencies {
     compile(
-            [group: 'io.mifos.template', name: 'api', version: project.version],
-            [group: 'io.mifos.template', name: 'service', version: project.version],
+            [group: 'io.mifos.payroll', name: 'api', version: project.version],
+            [group: 'io.mifos.payroll', name: 'service', version: project.version],
             [group: 'io.mifos.anubis', name: 'test', version: versions.frameworkanubis],
             [group: 'io.mifos.core', name: 'api', version: versions.frameworkapi],
             [group: 'io.mifos.core', name: 'test', version: versions.frameworktest],
diff --git a/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java b/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java
new file mode 100644
index 0000000..a995040
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll;
+
+
+import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
+import io.mifos.core.api.context.AutoUserContext;
+import io.mifos.core.test.fixture.TenantDataStoreContextTestRule;
+import io.mifos.core.test.listener.EnableEventRecording;
+import io.mifos.core.test.listener.EventRecorder;
+import io.mifos.payroll.api.v1.EventConstants;
+import io.mifos.payroll.api.v1.client.PayrollManager;
+import io.mifos.payroll.service.PayrollServiceConfiguration;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.cloud.netflix.feign.EnableFeignClients;
+import org.springframework.cloud.netflix.ribbon.RibbonClient;
+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 = {
+        AbstractPayrollTest.TestConfiguration.class
+    }
+)
+public class AbstractPayrollTest extends SuiteTestEnvironment {
+
+  @Configuration
+  @EnableEventRecording
+  @EnableFeignClients(basePackages = {
+      "io.mifos.payroll.api.v1.client"
+  })
+  @RibbonClient(name = SuiteTestEnvironment.APP_NAME)
+  @ComponentScan(
+      basePackages = {
+          "io.mifos.payroll.listener"
+      }
+  )
+  @Import({
+      PayrollServiceConfiguration.class
+  })
+  public static class TestConfiguration {
+    public TestConfiguration() {
+      super();
+    }
+  }
+
+  static final String TEST_USER = "mage";
+
+  @ClassRule
+  public final static TenantDataStoreContextTestRule tenantDataStoreContext =
+      TenantDataStoreContextTestRule.forRandomTenantName(SuiteTestEnvironment.cassandraInitializer,
+          SuiteTestEnvironment.mariaDBInitializer);
+
+  @Rule
+  public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
+      = new TenantApplicationSecurityEnvironmentTestRule(SuiteTestEnvironment.testEnvironment, this::waitForInitialize);
+
+  @Autowired
+  EventRecorder eventRecorder;
+
+  private AutoUserContext userContext;
+
+  @Autowired
+  PayrollManager testSubject;
+
+  public AbstractPayrollTest() {
+    super();
+  }
+
+  @Before
+  public void prepareTest() {
+    this.userContext = this.tenantApplicationSecurityEnvironment.createAutoUserContext(AbstractPayrollTest.TEST_USER);
+  }
+
+  @After
+  public void cleanupTest() {
+    userContext.close();
+  }
+
+  public boolean waitForInitialize() {
+    try {
+      return this.eventRecorder.wait(EventConstants.INITIALIZE, SuiteTestEnvironment.APP_VERSION);
+    } catch (final InterruptedException e) {
+      throw new IllegalStateException(e);
+    }
+  }
+
+}
diff --git a/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java b/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
similarity index 95%
rename from component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java
rename to component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
index 923cf79..8341aec 100644
--- a/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java
+++ b/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template;
+package io.mifos.payroll;
 
 import io.mifos.core.test.env.TestEnvironment;
 import io.mifos.core.test.fixture.cassandra.CassandraInitializer;
@@ -31,7 +31,7 @@ import org.junit.rules.TestRule;
  */
 public class SuiteTestEnvironment {
   static final String APP_VERSION = "1";
-  static final String APP_NAME = "template-v" + APP_VERSION;
+  static final String APP_NAME = "payroll-v" + APP_VERSION;
 
   static final TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
   static final CassandraInitializer cassandraInitializer = new CassandraInitializer();
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java b/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
new file mode 100644
index 0000000..f2db0c4
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll;
+
+import com.google.common.collect.Sets;
+import io.mifos.accounting.api.v1.domain.Account;
+import io.mifos.customer.api.v1.domain.Customer;
+import io.mifos.payroll.api.v1.EventConstants;
+import io.mifos.payroll.api.v1.domain.PayrollAllocation;
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import io.mifos.payroll.domain.DomainObjectGenerator;
+import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import io.mifos.payroll.service.internal.service.adaptor.CustomerAdaptor;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.springframework.boot.test.mock.mockito.MockBean;
+
+import java.math.BigDecimal;
+import java.util.Optional;
+
+public class TestPayrollConfiguration extends AbstractPayrollTest {
+
+  @MockBean
+  private CustomerAdaptor customerAdaptorSpy;
+  @MockBean
+  private AccountingAdaptor accountingAdaptorSpy;
+
+  public TestPayrollConfiguration() {
+    super();
+  }
+
+  @Test
+  public void shouldCreatePayrollDistribution() throws Exception {
+    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    this.prepareMocks(customerIdentifier, payrollConfiguration);
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+  }
+
+  @Test
+  public void shouldUpdatePayrollDistribution() throws Exception {
+    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    this.prepareMocks(customerIdentifier, payrollConfiguration);
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    final PayrollAllocation newPayrollAllocation = new PayrollAllocation();
+    payrollConfiguration.setPayrollAllocations(Sets.newHashSet(newPayrollAllocation));
+    newPayrollAllocation.setAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    newPayrollAllocation.setAmount(BigDecimal.valueOf(15.00D));
+    newPayrollAllocation.setProportional(Boolean.FALSE);
+
+    Mockito
+        .doAnswer(invocation -> Optional.of(new Account()))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(newPayrollAllocation.getAccountNumber()));
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    Thread.sleep(500L);
+
+    final PayrollConfiguration fetchedPayrollConfiguration =
+        super.testSubject.findPayrollConfiguration(customerIdentifier);
+
+    Assert.assertNotNull(fetchedPayrollConfiguration.getLastModifiedBy());
+    Assert.assertNotNull(fetchedPayrollConfiguration.getLastModifiedOn());
+    Assert.assertEquals(1, fetchedPayrollConfiguration.getPayrollAllocations().size());
+
+    final Optional<PayrollAllocation> optionalPayrollAllocation =
+        fetchedPayrollConfiguration.getPayrollAllocations().stream().findFirst();
+
+    Assert.assertTrue(optionalPayrollAllocation.isPresent());
+
+    this.comparePayrollAllocations(newPayrollAllocation, optionalPayrollAllocation.get());
+  }
+
+  private void prepareMocks(final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
+    Mockito
+        .doAnswer(invocation -> Optional.of(new Customer()))
+        .when(this.customerAdaptorSpy).findCustomer(Matchers.eq(customerIdentifier));
+
+    Mockito
+        .doAnswer(invocation -> Optional.of(new Account()))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollConfiguration.getMainAccountNumber()));
+
+    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation ->
+        Mockito
+            .doAnswer(invocation -> Optional.of(new Account()))
+            .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()))
+    );
+  }
+
+  private void comparePayrollAllocations(final PayrollAllocation expected, final PayrollAllocation actual) {
+    Assert.assertEquals(expected.getAccountNumber(), actual.getAccountNumber());
+    Assert.assertTrue(expected.getAmount().compareTo(actual.getAmount()) == 0);
+    Assert.assertEquals(expected.getProportional(), actual.getProportional());
+  }
+}
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java b/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
new file mode 100644
index 0000000..0bcae44
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll;
+
+import com.google.common.collect.Lists;
+import io.mifos.accounting.api.v1.domain.Account;
+import io.mifos.customer.api.v1.domain.Customer;
+import io.mifos.payroll.api.v1.EventConstants;
+import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
+import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import io.mifos.payroll.api.v1.domain.PayrollPayment;
+import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
+import io.mifos.payroll.domain.DomainObjectGenerator;
+import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import io.mifos.payroll.service.internal.service.adaptor.CustomerAdaptor;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.springframework.boot.test.mock.mockito.MockBean;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Optional;
+
+public class TestPayrollDistribution extends AbstractPayrollTest {
+
+  @MockBean
+  private CustomerAdaptor customerAdaptorSpy;
+  @MockBean
+  private AccountingAdaptor accountingAdaptorSpy;
+
+  public TestPayrollDistribution() {
+    super();
+  }
+
+  @Test
+  public void shouldDistributePayments() throws Exception {
+    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    this.prepareMocks(customerIdentifier, payrollConfiguration);
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    final PayrollCollectionSheet payrollCollectionSheet = new PayrollCollectionSheet();
+    payrollCollectionSheet.setSourceAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    final PayrollPayment payrollPayment = new PayrollPayment();
+    payrollPayment.setCustomerIdentifier(customerIdentifier);
+    payrollPayment.setEmployer("ACME, Inc.");
+    payrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
+    payrollCollectionSheet.setPayrollPayments(Lists.newArrayList(payrollPayment));
+
+    Mockito
+        .doAnswer(invocation -> Optional.of(new Account()))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
+
+    super.testSubject.distribute(payrollCollectionSheet);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_DISTRIBUTION, payrollCollectionSheet.getSourceAccountNumber()));
+
+    final List<PayrollCollectionHistory> payrollCollectionHistories = super.testSubject.fetchDistributionHistory();
+    Assert.assertEquals(1, payrollCollectionHistories.size());
+
+    final PayrollCollectionHistory payrollCollectionHistory = payrollCollectionHistories.get(0);
+    final PayrollPaymentPage payrollPaymentPage =
+        super.testSubject.fetchPayments(payrollCollectionHistory.getIdentifier(), 0, 10, null, null);
+    Assert.assertEquals(Long.valueOf(1L), payrollPaymentPage.getTotalElements());
+  }
+
+  private void prepareMocks(final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
+    Mockito
+        .doAnswer(invocation -> Optional.of(new Customer()))
+        .when(this.customerAdaptorSpy).findCustomer(Matchers.eq(customerIdentifier));
+
+    Mockito
+        .doAnswer(invocation -> Optional.of(new Account()))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollConfiguration.getMainAccountNumber()));
+
+    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation ->
+        Mockito
+            .doAnswer(invocation -> Optional.of(new Account()))
+            .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()))
+    );
+  }
+
+}
diff --git a/component-test/src/main/java/io/mifos/template/TestSuite.java b/component-test/src/main/java/io/mifos/payroll/TestSuite.java
similarity index 84%
rename from component-test/src/main/java/io/mifos/template/TestSuite.java
rename to component-test/src/main/java/io/mifos/payroll/TestSuite.java
index 44ed340..09862e8 100644
--- a/component-test/src/main/java/io/mifos/template/TestSuite.java
+++ b/component-test/src/main/java/io/mifos/payroll/TestSuite.java
@@ -13,15 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template;
+package io.mifos.payroll;
 
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
-    TestSample.class,
-    //TODO: when you create a new component test, add it here so you can run it with the suite.
+    TestPayrollConfiguration.class,
+    TestPayrollDistribution.class
 })
 public class TestSuite extends SuiteTestEnvironment {
 }
diff --git a/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java b/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java
new file mode 100644
index 0000000..389cde2
--- /dev/null
+++ b/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.domain;
+
+import io.mifos.payroll.api.v1.domain.PayrollAllocation;
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.commons.lang3.RandomStringUtils;
+
+import java.math.BigDecimal;
+import java.util.HashSet;
+
+public class DomainObjectGenerator {
+
+  private DomainObjectGenerator() {
+    super();
+  }
+
+  public static PayrollConfiguration getPayrollConfiguration() {
+    final PayrollConfiguration payrollConfiguration = new PayrollConfiguration();
+    payrollConfiguration.setMainAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+
+    final HashSet<PayrollAllocation> payrollAllocations = new HashSet<>();
+    payrollConfiguration.setPayrollAllocations(payrollAllocations);
+
+    final PayrollAllocation savingsAllocation = new PayrollAllocation();
+    payrollAllocations.add(savingsAllocation);
+    savingsAllocation.setAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    savingsAllocation.setAmount(BigDecimal.valueOf(5.00D));
+    savingsAllocation.setProportional(Boolean.TRUE);
+
+    return payrollConfiguration;
+  }
+}
diff --git a/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java b/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
similarity index 94%
copy from component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
copy to component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
index 52be53b..b521aad 100644
--- a/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
+++ b/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
@@ -13,11 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.listener;
+package io.mifos.payroll.listener;
 
 import io.mifos.core.lang.config.TenantHeaderFilter;
 import io.mifos.core.test.listener.EventRecorder;
-import io.mifos.template.api.v1.events.EventConstants;
+import io.mifos.payroll.api.v1.EventConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jms.annotation.JmsListener;
 import org.springframework.messaging.handler.annotation.Header;
diff --git a/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java b/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
similarity index 57%
rename from component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java
rename to component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
index b54a819..66e5719 100644
--- a/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java
+++ b/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
@@ -13,35 +13,41 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.listener;
+package io.mifos.payroll.listener;
 
 import io.mifos.core.lang.config.TenantHeaderFilter;
 import io.mifos.core.test.listener.EventRecorder;
-import io.mifos.template.api.v1.events.EventConstants;
+import io.mifos.payroll.api.v1.EventConstants;
+import io.mifos.payroll.service.ServiceConstants;
+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;
 
-@SuppressWarnings("unused")
 @Component
-public class SampleEventListener {
+public class PayrollConfigurationListener {
 
+  private final Logger logger;
   private final EventRecorder eventRecorder;
 
   @Autowired
-  public SampleEventListener(@SuppressWarnings("SpringJavaAutowiringInspection") final EventRecorder eventRecorder) {
+  public PayrollConfigurationListener(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                                      final EventRecorder eventRecorder) {
     super();
+    this.logger = logger;
     this.eventRecorder = eventRecorder;
   }
 
   @JmsListener(
       subscription = EventConstants.DESTINATION,
       destination = EventConstants.DESTINATION,
-      selector = EventConstants.SELECTOR_POST_SAMPLE
+      selector = EventConstants.SELECTOR_PUT_CONFIGURATION
   )
-  public void onCreateSample(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
-                             final String payload) {
-    this.eventRecorder.event(tenant, EventConstants.POST_SAMPLE, payload, String.class);
+  public void onPutConfiguration(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+                                 final String payload) {
+    this.logger.info("Payment configuration for customer {} processed.", payload);
+    this.eventRecorder.event(tenant, EventConstants.PUT_CONFIGURATION, payload, String.class);
   }
 }
diff --git a/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java b/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
similarity index 61%
rename from component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
rename to component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
index 52be53b..72edede 100644
--- a/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
+++ b/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
@@ -13,35 +13,41 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.listener;
+package io.mifos.payroll.listener;
 
 import io.mifos.core.lang.config.TenantHeaderFilter;
 import io.mifos.core.test.listener.EventRecorder;
-import io.mifos.template.api.v1.events.EventConstants;
+import io.mifos.payroll.api.v1.EventConstants;
+import io.mifos.payroll.service.ServiceConstants;
+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;
 
-@SuppressWarnings("unused")
 @Component
-public class MigrationEventListener {
+public class PayrollDistributionListener {
 
+  private final Logger logger;
   private final EventRecorder eventRecorder;
 
   @Autowired
-  public MigrationEventListener(@SuppressWarnings("SpringJavaAutowiringInspection") final EventRecorder eventRecorder) {
+  public PayrollDistributionListener(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                                     final EventRecorder eventRecorder) {
     super();
+    this.logger = logger;
     this.eventRecorder = eventRecorder;
   }
 
   @JmsListener(
       subscription = EventConstants.DESTINATION,
       destination = EventConstants.DESTINATION,
-      selector = EventConstants.SELECTOR_INITIALIZE
+      selector = EventConstants.SELECTOR_POST_DISTRIBUTION
   )
-  public void onInitialization(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+  public void onPostCollection(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
                                final String payload) {
-    this.eventRecorder.event(tenant, EventConstants.INITIALIZE, payload, String.class);
+    this.logger.info("Payment distribution with source account {0} processed.", payload);
+    this.eventRecorder.event(tenant, EventConstants.POST_DISTRIBUTION, payload, String.class);
   }
 }
diff --git a/component-test/src/main/java/io/mifos/template/TestSample.java b/component-test/src/main/java/io/mifos/template/TestSample.java
deleted file mode 100644
index 92ae690..0000000
--- a/component-test/src/main/java/io/mifos/template/TestSample.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2017 The Mifos Initiative.
- *
- * Licensed 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 io.mifos.template;
-
-import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
-import io.mifos.core.api.context.AutoUserContext;
-import io.mifos.core.test.fixture.TenantDataStoreContextTestRule;
-import io.mifos.core.test.listener.EnableEventRecording;
-import io.mifos.core.test.listener.EventRecorder;
-import io.mifos.template.api.v1.events.EventConstants;
-import io.mifos.template.api.v1.client.TemplateManager;
-import io.mifos.template.api.v1.domain.Sample;
-import io.mifos.template.service.TemplateConfiguration;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.junit.*;
-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.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;
-
-import java.util.List;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
-public class TestSample extends SuiteTestEnvironment {
-  private static final String LOGGER_NAME = "test-logger";
-  private static final String TEST_USER = "homer";
-
-
-  @Configuration
-  @EnableEventRecording
-  @EnableFeignClients(basePackages = {"io.mifos.template.api.v1.client"})
-  @RibbonClient(name = APP_NAME)
-  @Import({TemplateConfiguration.class})
-  @ComponentScan("io.mifos.template.listener")
-  public static class TestConfiguration {
-    public TestConfiguration() {
-      super();
-    }
-
-    @Bean(name = LOGGER_NAME)
-    public Logger logger() {
-      return LoggerFactory.getLogger(LOGGER_NAME);
-    }
-  }
-
-  @ClassRule
-  public final static TenantDataStoreContextTestRule tenantDataStoreContext = TenantDataStoreContextTestRule.forRandomTenantName(cassandraInitializer, mariaDBInitializer);
-
-  @Rule
-  public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
-          = new TenantApplicationSecurityEnvironmentTestRule(testEnvironment, this::waitForInitialize);
-
-  private AutoUserContext userContext;
-
-  @Autowired
-  private TemplateManager testSubject;
-
-  @Autowired
-  private EventRecorder eventRecorder;
-
-  @SuppressWarnings("WeakerAccess")
-  @Autowired
-  @Qualifier(LOGGER_NAME)
-  Logger logger;
-
-  public TestSample() {
-    super();
-  }
-
-  @Before
-  public void prepTest() {
-    userContext = tenantApplicationSecurityEnvironment.createAutoUserContext(TestSample.TEST_USER);
-  }
-
-  @After
-  public void cleanTest() {
-    userContext.close();
-    eventRecorder.clear();
-  }
-
-  public boolean waitForInitialize() {
-    try {
-      return this.eventRecorder.wait(EventConstants.INITIALIZE, APP_VERSION);
-    } catch (final InterruptedException e) {
-      throw new IllegalStateException(e);
-    }
-  }
-
-  @Test
-  public void shouldCreateSample() throws InterruptedException {
-    logger.info("Running test shouldCreateSample.");
-    final Sample sample = Sample.create(RandomStringUtils.randomAlphanumeric(8), RandomStringUtils.randomAlphanumeric(512));
-    this.testSubject.createEntity(sample);
-
-    Assert.assertTrue(this.eventRecorder.wait(EventConstants.POST_SAMPLE, sample.getIdentifier()));
-
-    final Sample createdSample = this.testSubject.getEntity(sample.getIdentifier());
-    Assert.assertEquals(sample, createdSample);
-  }
-
-  @Test
-  public void shouldListSamples() {
-    logger.info("Running test shouldListSamples.");
-    final List<Sample> allEntities = this.testSubject.findAllEntities();
-    Assert.assertNotNull(allEntities);
-  }
-}
diff --git a/component-test/src/main/resources/logback-test.xml b/component-test/src/main/resources/logback-test.xml
new file mode 100644
index 0000000..222fc38
--- /dev/null
+++ b/component-test/src/main/resources/logback-test.xml
@@ -0,0 +1,34 @@
+<!--
+
+    Copyright 2017 The Mifos Initiative.
+
+    Licensed 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.
+
+-->
+<configuration>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org" level="OFF"/>
+    <logger name="org.hibernate" level="DEBUG"/>
+    <logger name="io" level="OFF"/>
+    <logger name="com" level="OFF"/>
+    <logger name="ch" level="OFF"/>
+
+    <root level="DEBUG">
+        <appender-ref ref="STDOUT"/>
+    </root>
+</configuration>
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2888922..61d11e0 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Mar 17 17:54:20 CET 2017
+#Thu Sep 14 14:33:32 CEST 2017
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
diff --git a/service/build.gradle b/service/build.gradle
index a9b4de9..65e1431 100644
--- a/service/build.gradle
+++ b/service/build.gradle
@@ -30,7 +30,9 @@ dependencies {
             [group: 'org.springframework.cloud', name: 'spring-cloud-starter-config'],
             [group: 'org.springframework.cloud', name: 'spring-cloud-starter-eureka'],
             [group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'],
-            [group: 'io.mifos.template', name: 'api', version: project.version],
+            [group: 'io.mifos.payroll', name: 'api', version: project.version],
+            [group: 'io.mifos.accounting', name: 'api', version: versions.frameworkaccounting],
+            [group: 'io.mifos.customer', name: 'api', version: versions.frameworkcustomer],
             [group: 'io.mifos.anubis', name: 'library', version: versions.frameworkanubis],
             [group: 'com.google.code.gson', name: 'gson'],
             [group: 'io.mifos.core', name: 'lang', version: versions.frameworklang],
diff --git a/service/src/main/java/io/mifos/template/service/TemplateApplication.java b/service/src/main/java/io/mifos/payroll/service/PayrollApplication.java
similarity index 81%
rename from service/src/main/java/io/mifos/template/service/TemplateApplication.java
rename to service/src/main/java/io/mifos/payroll/service/PayrollApplication.java
index 7ca88f0..2fe3036 100644
--- a/service/src/main/java/io/mifos/template/service/TemplateApplication.java
+++ b/service/src/main/java/io/mifos/payroll/service/PayrollApplication.java
@@ -13,17 +13,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service;
+package io.mifos.payroll.service;
 
 import org.springframework.boot.SpringApplication;
 
-public class TemplateApplication {
+public class PayrollApplication {
 
-  public TemplateApplication() {
+  public PayrollApplication() {
     super();
   }
 
   public static void main(String[] args) {
-    SpringApplication.run(TemplateConfiguration.class, args);
+    SpringApplication.run(PayrollServiceConfiguration.class, args);
   }
 }
diff --git a/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java b/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
similarity index 76%
rename from service/src/main/java/io/mifos/template/service/TemplateConfiguration.java
rename to service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
index 33ee609..d9a00e4 100644
--- a/service/src/main/java/io/mifos/template/service/TemplateConfiguration.java
+++ b/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
@@ -13,8 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service;
+package io.mifos.payroll.service;
 
+import io.mifos.accounting.api.v1.client.LedgerManager;
 import io.mifos.anubis.config.EnableAnubis;
 import io.mifos.core.async.config.EnableAsync;
 import io.mifos.core.cassandra.config.EnableCassandra;
@@ -22,10 +23,12 @@ import io.mifos.core.command.config.EnableCommandProcessing;
 import io.mifos.core.lang.config.EnableServiceException;
 import io.mifos.core.lang.config.EnableTenantContext;
 import io.mifos.core.mariadb.config.EnableMariaDB;
+import io.mifos.customer.api.v1.client.CustomerManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.netflix.feign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
@@ -44,18 +47,22 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
 @EnableCommandProcessing
 @EnableAnubis
 @EnableServiceException
+@EnableFeignClients(clients = {
+    LedgerManager.class,
+    CustomerManager.class
+})
 @ComponentScan({
-    "io.mifos.template.service.rest",
-    "io.mifos.template.service.internal.service",
-    "io.mifos.template.service.internal.repository",
-    "io.mifos.template.service.internal.command.handler"
+    "io.mifos.payroll.service.rest",
+    "io.mifos.payroll.service.internal.service",
+    "io.mifos.payroll.service.internal.repository",
+    "io.mifos.payroll.service.internal.command.handler"
 })
 @EnableJpaRepositories({
-    "io.mifos.template.service.internal.repository"
+    "io.mifos.payroll.service.internal.repository"
 })
-public class TemplateConfiguration extends WebMvcConfigurerAdapter {
+public class PayrollServiceConfiguration extends WebMvcConfigurerAdapter {
 
-  public TemplateConfiguration() {
+  public PayrollServiceConfiguration() {
     super();
   }
 
diff --git a/service/src/main/java/io/mifos/template/service/ServiceConstants.java b/service/src/main/java/io/mifos/payroll/service/ServiceConstants.java
similarity index 89%
rename from service/src/main/java/io/mifos/template/service/ServiceConstants.java
rename to service/src/main/java/io/mifos/payroll/service/ServiceConstants.java
index e9e0623..a5cfc4f 100644
--- a/service/src/main/java/io/mifos/template/service/ServiceConstants.java
+++ b/service/src/main/java/io/mifos/payroll/service/ServiceConstants.java
@@ -13,8 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service;
+package io.mifos.payroll.service;
 
 public interface ServiceConstants {
-  String LOGGER_NAME = "rest-logger";
+  String LOGGER_NAME = "payroll-logger";
 }
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java b/service/src/main/java/io/mifos/payroll/service/internal/command/DistributePayrollCommand.java
similarity index 57%
rename from service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java
rename to service/src/main/java/io/mifos/payroll/service/internal/command/DistributePayrollCommand.java
index 5957f1b..e3b4202 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/SampleCommand.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/DistributePayrollCommand.java
@@ -13,27 +13,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service.internal.command;
+package io.mifos.payroll.service.internal.command;
 
-import io.mifos.template.api.v1.domain.Sample;
+import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
 
-public class SampleCommand {
+public class DistributePayrollCommand {
+  private final PayrollCollectionSheet payrollCollectionSheet;
 
-  private final Sample sample;
-
-  public SampleCommand(final Sample sample) {
+  public DistributePayrollCommand(final PayrollCollectionSheet payrollCollectionSheet) {
     super();
-    this.sample = sample;
-  }
-
-  public Sample sample() {
-    return this.sample;
+    this.payrollCollectionSheet = payrollCollectionSheet;
   }
 
-  @Override
-  public String toString() {
-    return "SampleCommand{" +
-        "sample=" + sample.getIdentifier() +
-        '}';
+  public PayrollCollectionSheet payrollCollectionSheet() {
+    return this.payrollCollectionSheet;
   }
 }
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java b/service/src/main/java/io/mifos/payroll/service/internal/command/MigrateServiceCommand.java
similarity index 74%
rename from service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java
rename to service/src/main/java/io/mifos/payroll/service/internal/command/MigrateServiceCommand.java
index e02d2d0..4cacdc2 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/InitializeServiceCommand.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/MigrateServiceCommand.java
@@ -13,16 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service.internal.command;
+package io.mifos.payroll.service.internal.command;
 
-public class InitializeServiceCommand {
-
-  public InitializeServiceCommand() {
+public class MigrateServiceCommand {
+  public MigrateServiceCommand() {
     super();
   }
-
-  @Override
-  public String toString() {
-    return "InitializeServiceCommand{}";
-  }
 }
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/PutPayrollConfigurationCommand.java b/service/src/main/java/io/mifos/payroll/service/internal/command/PutPayrollConfigurationCommand.java
new file mode 100644
index 0000000..3507489
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/PutPayrollConfigurationCommand.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.command;
+
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+
+public class PutPayrollConfigurationCommand {
+  private final String customerIdentifier;
+  private final PayrollConfiguration payrollConfiguration;
+
+  public PutPayrollConfigurationCommand(final String customerIdentifier,
+                                        final PayrollConfiguration payrollConfiguration) {
+    super();
+    this.customerIdentifier = customerIdentifier;
+    this.payrollConfiguration = payrollConfiguration;
+  }
+
+  public String customerIdentifier() {
+    return this.customerIdentifier;
+  }
+
+  public PayrollConfiguration payrollConfiguration() {
+    return this.payrollConfiguration;
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
similarity index 64%
rename from service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
rename to service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
index 12ae643..4d9d2c8 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
@@ -13,52 +13,42 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service.internal.command.handler;
+package io.mifos.payroll.service.internal.command.handler;
 
+import io.mifos.accounting.api.v1.EventConstants;
 import io.mifos.core.command.annotation.Aggregate;
 import io.mifos.core.command.annotation.CommandHandler;
-import io.mifos.core.command.annotation.CommandLogLevel;
 import io.mifos.core.command.annotation.EventEmitter;
 import io.mifos.core.lang.ApplicationName;
 import io.mifos.core.mariadb.domain.FlywayFactoryBean;
-import io.mifos.template.api.v1.events.EventConstants;
-import io.mifos.template.service.ServiceConstants;
-import io.mifos.template.service.internal.command.InitializeServiceCommand;
-import org.slf4j.Logger;
+import io.mifos.payroll.service.internal.command.MigrateServiceCommand;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.sql.DataSource;
 
-@SuppressWarnings({
-    "unused"
-})
 @Aggregate
 public class MigrationAggregate {
 
-  private final Logger logger;
   private final DataSource dataSource;
   private final FlywayFactoryBean flywayFactoryBean;
   private final ApplicationName applicationName;
 
   @Autowired
-  public MigrationAggregate(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
-                            final DataSource dataSource,
-                            final FlywayFactoryBean flywayFactoryBean,
+  public MigrationAggregate(@SuppressWarnings("SpringJavaAutowiringInspection") final DataSource dataSource,
+                            @SuppressWarnings("SpringJavaAutowiringInspection") final FlywayFactoryBean flywayFactoryBean,
                             final ApplicationName applicationName) {
     super();
-    this.logger = logger;
     this.dataSource = dataSource;
     this.flywayFactoryBean = flywayFactoryBean;
     this.applicationName = applicationName;
   }
 
-  @CommandHandler(logStart = CommandLogLevel.INFO, logFinish = CommandLogLevel.INFO)
+  @SuppressWarnings("unused")
   @Transactional
+  @CommandHandler
   @EventEmitter(selectorName = EventConstants.SELECTOR_NAME, selectorValue = EventConstants.INITIALIZE)
-  public String initialize(final InitializeServiceCommand initializeServiceCommand) {
-    this.logger.debug("Start service migration.");
+  public String initialize(final MigrateServiceCommand migrateServiceCommand) {
     this.flywayFactoryBean.create(this.dataSource).migrate();
     return this.applicationName.getVersionString();
   }
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
new file mode 100644
index 0000000..d71fe45
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.command.handler;
+
+import io.mifos.core.api.util.UserContextHolder;
+import io.mifos.core.command.annotation.Aggregate;
+import io.mifos.core.command.annotation.CommandHandler;
+import io.mifos.core.command.annotation.EventEmitter;
+import io.mifos.payroll.api.v1.EventConstants;
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import io.mifos.payroll.service.ServiceConstants;
+import io.mifos.payroll.service.internal.command.PutPayrollConfigurationCommand;
+import io.mifos.payroll.service.internal.mapper.PayrollAllocationMapper;
+import io.mifos.payroll.service.internal.repository.PayrollAllocationEntity;
+import io.mifos.payroll.service.internal.repository.PayrollAllocationRepository;
+import io.mifos.payroll.service.internal.repository.PayrollConfigurationEntity;
+import io.mifos.payroll.service.internal.repository.PayrollConfigurationRepository;
+import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.Clock;
+import java.time.LocalDateTime;
+import java.util.Optional;
+
+@Aggregate
+public class PayrollConfigurationAggregate {
+
+  private Logger logger;
+  private PayrollConfigurationService payrollConfigurationService;
+  private PayrollConfigurationRepository payrollConfigurationRepository;
+  private PayrollAllocationRepository payrollAllocationRepository;
+
+  @Autowired
+  public PayrollConfigurationAggregate(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                                       final PayrollConfigurationService payrollConfigurationService,
+                                       final PayrollConfigurationRepository payrollConfigurationRepository,
+                                       final PayrollAllocationRepository payrollAllocationRepository) {
+    super();
+    this.logger = logger;
+    this.payrollConfigurationService = payrollConfigurationService;
+    this.payrollConfigurationRepository = payrollConfigurationRepository;
+    this.payrollAllocationRepository = payrollAllocationRepository;
+  }
+
+  @Transactional
+  @CommandHandler
+  @EventEmitter(selectorName = EventConstants.SELECTOR_NAME, selectorValue = EventConstants.PUT_CONFIGURATION)
+  public String process(final PutPayrollConfigurationCommand putPayrollConfigurationCommand) {
+    final String customerIdentifier = putPayrollConfigurationCommand.customerIdentifier();
+    final PayrollConfiguration payrollConfiguration = putPayrollConfigurationCommand.payrollConfiguration();
+
+    final PayrollConfigurationEntity payrollConfigurationEntity;
+
+    final Optional<PayrollConfigurationEntity> optionalPayrollConfiguration =
+        this.payrollConfigurationRepository.findByCustomerIdentifier(customerIdentifier);
+    if (optionalPayrollConfiguration.isPresent()) {
+      payrollConfigurationEntity = optionalPayrollConfiguration.get();
+      this.payrollAllocationRepository.deleteByPayrollConfiguration(payrollConfigurationEntity);
+
+      payrollConfigurationEntity.setLastModifiedBy(UserContextHolder.checkedGetUser());
+      payrollConfigurationEntity.setLastModifiedOn(LocalDateTime.now(Clock.systemUTC()));
+    } else {
+      payrollConfigurationEntity = new PayrollConfigurationEntity();
+      payrollConfigurationEntity.setCustomerIdentifier(customerIdentifier);
+      payrollConfigurationEntity.setCreatedBy(UserContextHolder.checkedGetUser());
+      payrollConfigurationEntity.setCreatedOn(LocalDateTime.now(Clock.systemUTC()));
+    }
+
+    payrollConfigurationEntity.setMainAccountNumber(payrollConfiguration.getMainAccountNumber());
+    final PayrollConfigurationEntity savedPayrollConfigurationEntity =
+        this.payrollConfigurationRepository.save(payrollConfigurationEntity);
+
+    if (payrollConfiguration.getPayrollAllocations() != null) {
+      payrollConfiguration.getPayrollAllocations()
+          .forEach(payrollAllocation -> {
+            final PayrollAllocationEntity payrollAllocationEntity = PayrollAllocationMapper.map(payrollAllocation);
+            payrollAllocationEntity.setPayrollConfiguration(savedPayrollConfigurationEntity);
+            this.payrollAllocationRepository.save(payrollAllocationEntity);
+          });
+    }
+    return customerIdentifier;
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
new file mode 100644
index 0000000..86f4aae
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.command.handler;
+
+import io.mifos.core.api.util.UserContextHolder;
+import io.mifos.core.command.annotation.Aggregate;
+import io.mifos.core.command.annotation.CommandHandler;
+import io.mifos.core.command.annotation.EventEmitter;
+import io.mifos.payroll.api.v1.EventConstants;
+import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
+import io.mifos.payroll.service.ServiceConstants;
+import io.mifos.payroll.service.internal.command.DistributePayrollCommand;
+import io.mifos.payroll.service.internal.repository.PayrollCollectionEntity;
+import io.mifos.payroll.service.internal.repository.PayrollCollectionRepository;
+import io.mifos.payroll.service.internal.repository.PayrollPaymentEntity;
+import io.mifos.payroll.service.internal.repository.PayrollPaymentRepository;
+import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
+import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.apache.commons.lang.RandomStringUtils;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.Clock;
+import java.time.LocalDateTime;
+
+@Aggregate
+public class PayrollDistributionAggregate {
+
+  private final Logger logger;
+  private final PayrollConfigurationService payrollConfigurationService;
+  private final PayrollCollectionRepository payrollCollectionRepository;
+  private final PayrollPaymentRepository payrollPaymentRepository;
+  private final AccountingAdaptor accountingAdaptor;
+
+  @Autowired
+  public PayrollDistributionAggregate(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                                      PayrollConfigurationService payrollConfigurationService,
+                                      final PayrollCollectionRepository payrollCollectionRepository,
+                                      final PayrollPaymentRepository payrollPaymentRepository,
+                                      final AccountingAdaptor accountingAdaptor) {
+    super();
+    this.logger = logger;
+    this.payrollConfigurationService = payrollConfigurationService;
+    this.payrollCollectionRepository = payrollCollectionRepository;
+    this.payrollPaymentRepository = payrollPaymentRepository;
+    this.accountingAdaptor = accountingAdaptor;
+  }
+
+  @Transactional
+  @CommandHandler
+  @EventEmitter(selectorName = EventConstants.SELECTOR_NAME, selectorValue = EventConstants.POST_DISTRIBUTION)
+  public String process(final DistributePayrollCommand distributePayrollCommand) {
+    final PayrollCollectionSheet payrollCollectionSheet = distributePayrollCommand.payrollCollectionSheet();
+
+    final PayrollCollectionEntity payrollCollectionEntity = new PayrollCollectionEntity();
+    payrollCollectionEntity.setIdentifier(RandomStringUtils.randomAlphanumeric(32));
+    payrollCollectionEntity.setSourceAccountNumber(payrollCollectionSheet.getSourceAccountNumber());
+    payrollCollectionEntity.setCreatedBy(UserContextHolder.checkedGetUser());
+    payrollCollectionEntity.setCreatedOn(LocalDateTime.now(Clock.systemUTC()));
+
+    final PayrollCollectionEntity savedPayrollCollectionEntity = this.payrollCollectionRepository.save(payrollCollectionEntity);
+
+    payrollCollectionSheet.getPayrollPayments().forEach(payrollPayment ->
+        this.payrollConfigurationService
+            .findPayrollConfiguration(payrollPayment.getCustomerIdentifier())
+            .ifPresent(payrollConfiguration -> {
+          final PayrollPaymentEntity payrollPaymentEntity = new PayrollPaymentEntity();
+          payrollPaymentEntity.setPayrollCollection(savedPayrollCollectionEntity);
+          payrollPaymentEntity.setCustomerIdentifier(payrollPayment.getCustomerIdentifier());
+          payrollPaymentEntity.setEmployer(payrollPayment.getEmployer());
+          payrollPaymentEntity.setSalary(payrollPayment.getSalary());
+
+          this.payrollPaymentRepository.save(payrollPaymentEntity);
+
+          this.accountingAdaptor.postPayrollPayment(savedPayrollCollectionEntity, payrollPayment, payrollConfiguration);
+        })
+    );
+
+    return payrollCollectionSheet.getSourceAccountNumber();
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollAllocationMapper.java b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollAllocationMapper.java
new file mode 100644
index 0000000..832fd12
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollAllocationMapper.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.mapper;
+
+import io.mifos.payroll.api.v1.domain.PayrollAllocation;
+import io.mifos.payroll.service.internal.repository.PayrollAllocationEntity;
+
+public class PayrollAllocationMapper {
+
+  private PayrollAllocationMapper() {
+    super();
+  }
+
+  public static PayrollAllocation map(final PayrollAllocationEntity payrollAllocationEntity) {
+    final PayrollAllocation payrollAllocation = new PayrollAllocation();
+    payrollAllocation.setAccountNumber(payrollAllocationEntity.getAccountNumber());
+    payrollAllocation.setAmount(payrollAllocationEntity.getAmount());
+    payrollAllocation.setProportional(payrollAllocationEntity.getProportional());
+    return payrollAllocation;
+  }
+
+  public static PayrollAllocationEntity map(final PayrollAllocation payrollAllocation) {
+    final PayrollAllocationEntity payrollAllocationEntity = new PayrollAllocationEntity();
+    payrollAllocationEntity.setAccountNumber(payrollAllocation.getAccountNumber());
+    payrollAllocationEntity.setAmount(payrollAllocation.getAmount());
+    payrollAllocationEntity.setProportional(payrollAllocation.getProportional());
+    return payrollAllocationEntity;
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
new file mode 100644
index 0000000..140a2e0
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.mapper;
+
+import io.mifos.core.lang.DateConverter;
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import io.mifos.payroll.service.internal.repository.PayrollConfigurationEntity;
+
+public class PayrollConfigurationMapper {
+
+  private PayrollConfigurationMapper() {
+    super();
+  }
+
+  public static PayrollConfiguration map(final PayrollConfigurationEntity payrollConfigurationEntity) {
+    final PayrollConfiguration payrollConfiguration = new PayrollConfiguration();
+    payrollConfiguration.setMainAccountNumber(payrollConfigurationEntity.getMainAccountNumber());
+    payrollConfiguration.setCreatedBy(payrollConfiguration.getCreatedOn());
+    payrollConfiguration.setCreatedOn(DateConverter.toIsoString(payrollConfigurationEntity.getCreatedOn()));
+    if (payrollConfigurationEntity.getLastModifiedBy() != null) {
+      payrollConfiguration.setLastModifiedBy(payrollConfigurationEntity.getLastModifiedBy());
+      payrollConfiguration.setLastModifiedOn(DateConverter.toIsoString(payrollConfigurationEntity.getLastModifiedOn()));
+    }
+    return payrollConfiguration;
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java
new file mode 100644
index 0000000..fd7538a
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.mapper;
+
+import io.mifos.payroll.api.v1.domain.PayrollPayment;
+import io.mifos.payroll.service.internal.repository.PayrollPaymentEntity;
+
+public class PayrollPaymentMapper {
+
+  private PayrollPaymentMapper() {
+    super();
+  }
+
+  public static PayrollPayment map(final PayrollPaymentEntity payrollPaymentEntity) {
+    final PayrollPayment payrollPayment = new PayrollPayment();
+    payrollPayment.setCustomerIdentifier(payrollPaymentEntity.getCustomerIdentifier());
+    payrollPayment.setEmployer(payrollPaymentEntity.getEmployer());
+    payrollPayment.setSalary(payrollPaymentEntity.getSalary());
+    return payrollPayment;
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationEntity.java
new file mode 100644
index 0000000..d059f2a
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationEntity.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.repository;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import java.math.BigDecimal;
+
+@Entity
+@Table(name = "meketre_payroll_allocations")
+public class PayrollAllocationEntity {
+
+  @Id
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
+  @Column(name = "id", nullable = false)
+  private Long id;
+  @ManyToOne
+  @JoinColumn(name = "payroll_configuration_id", nullable = false)
+  private PayrollConfigurationEntity payrollConfiguration;
+  @Column(name = "account_number", nullable = false, length = 34)
+  private String accountNumber;
+  @Column(name = "amount", nullable = false, precision = 15, scale = 5)
+  private BigDecimal amount;
+  @Column(name = "proportional", nullable = false)
+  private Boolean proportional = Boolean.FALSE;
+
+  public PayrollAllocationEntity() {
+    super();
+  }
+
+  public Long getId() {
+    return this.id;
+  }
+
+  public void setId(final Long id) {
+    this.id = id;
+  }
+
+  public PayrollConfigurationEntity getPayrollConfiguration() {
+    return this.payrollConfiguration;
+  }
+
+  public void setPayrollConfiguration(final PayrollConfigurationEntity payrollConfiguration) {
+    this.payrollConfiguration = payrollConfiguration;
+  }
+
+  public String getAccountNumber() {
+    return this.accountNumber;
+  }
+
+  public void setAccountNumber(final String accountNumber) {
+    this.accountNumber = accountNumber;
+  }
+
+  public BigDecimal getAmount() {
+    return this.amount;
+  }
+
+  public void setAmount(final BigDecimal amount) {
+    this.amount = amount;
+  }
+
+  public Boolean getProportional() {
+    return this.proportional;
+  }
+
+  public void setProportional(final Boolean proportional) {
+    this.proportional = proportional;
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationRepository.java
similarity index 62%
copy from service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
copy to service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationRepository.java
index 87ea8a7..bcc43f5 100644
--- a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationRepository.java
@@ -13,14 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service.internal.repository;
+package io.mifos.payroll.service.internal.repository;
+
 
 import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
 
-import java.util.Optional;
+import java.util.List;
+
+public interface PayrollAllocationRepository extends JpaRepository<PayrollAllocationEntity, Long> {
+
+  void deleteByPayrollConfiguration(final PayrollConfigurationEntity payrollConfigurationEntity);
 
-@Repository
-public interface SampleJpaEntityRepository extends JpaRepository<SampleJpaEntity, Long> {
-  Optional<SampleJpaEntity> findByIdentifier(String identifier);
+  List<PayrollAllocationEntity> findByPayrollConfiguration(final PayrollConfigurationEntity payrollConfigurationEntity);
 }
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java
new file mode 100644
index 0000000..c896995
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.repository;
+
+import io.mifos.core.mariadb.util.LocalDateTimeConverter;
+
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.time.LocalDateTime;
+
+@Entity
+@Table(name = "meketre_payroll_collections")
+public class PayrollCollectionEntity {
+  @Id
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
+  @Column(name = "id", nullable = false)
+  private Long id;
+  @Column(name = "identifier", nullable = false, length = 32)
+  private String identifier;
+  @Column(name = "source_account_number", nullable = false, length = 34)
+  private String sourceAccountNumber;
+  @Column(name = "created_by", nullable = false, length = 32)
+  private String createdBy;
+  @Column(name = "created_on")
+  @Convert(converter = LocalDateTimeConverter.class)
+  private LocalDateTime createdOn;
+
+  public PayrollCollectionEntity() {
+    super();
+  }
+
+  public Long getId() {
+    return this.id;
+  }
+
+  public void setId(final Long id) {
+    this.id = id;
+  }
+
+  public String getIdentifier() {
+    return this.identifier;
+  }
+
+  public void setIdentifier(final String identifier) {
+    this.identifier = identifier;
+  }
+
+  public String getSourceAccountNumber() {
+    return this.sourceAccountNumber;
+  }
+
+  public void setSourceAccountNumber(final String sourceAccountNumber) {
+    this.sourceAccountNumber = sourceAccountNumber;
+  }
+
+  public String getCreatedBy() {
+    return this.createdBy;
+  }
+
+  public void setCreatedBy(final String createdBy) {
+    this.createdBy = createdBy;
+  }
+
+  public LocalDateTime getCreatedOn() {
+    return this.createdOn;
+  }
+
+  public void setCreatedOn(final LocalDateTime createdOn) {
+    this.createdOn = createdOn;
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionRepository.java
similarity index 70%
copy from service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
copy to service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionRepository.java
index 87ea8a7..8986a79 100644
--- a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionRepository.java
@@ -13,14 +13,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service.internal.repository;
+package io.mifos.payroll.service.internal.repository;
 
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
 import java.util.Optional;
 
 @Repository
-public interface SampleJpaEntityRepository extends JpaRepository<SampleJpaEntity, Long> {
-  Optional<SampleJpaEntity> findByIdentifier(String identifier);
+public interface PayrollCollectionRepository extends JpaRepository<PayrollCollectionEntity, Long> {
+  List<PayrollCollectionEntity> findAllByOrderByCreatedOnDesc();
+
+  Optional<PayrollCollectionEntity> findByIdentifier(String identifier);
 }
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java
new file mode 100644
index 0000000..0ccd490
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.repository;
+
+import io.mifos.core.mariadb.util.LocalDateTimeConverter;
+
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.time.LocalDateTime;
+
+@Entity
+@Table(name = "meketre_payroll_configurations")
+public class PayrollConfigurationEntity {
+
+  @Id
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
+  @Column(name = "id", nullable = false)
+  private Long id;
+  @Column(name = "customer_identifier", nullable = false, length = 32)
+  private String customerIdentifier;
+  @Column(name = "main_account_number", nullable = false, length = 34)
+  private String mainAccountNumber;
+  @Column(name = "created_by")
+  private String createdBy;
+  @Column(name = "created_on")
+  @Convert(converter = LocalDateTimeConverter.class)
+  private LocalDateTime createdOn;
+  @Column(name = "last_modified_by")
+  private String lastModifiedBy;
+  @Column(name = "last_modified_on")
+  @Convert(converter = LocalDateTimeConverter.class)
+  private LocalDateTime lastModifiedOn;
+
+  public PayrollConfigurationEntity() {
+    super();
+  }
+
+  public Long getId() {
+    return this.id;
+  }
+
+  public void setId(final Long id) {
+    this.id = id;
+  }
+
+  public String getCustomerIdentifier() {
+    return this.customerIdentifier;
+  }
+
+  public void setCustomerIdentifier(final String customerIdentifier) {
+    this.customerIdentifier = customerIdentifier;
+  }
+
+  public String getMainAccountNumber() {
+    return this.mainAccountNumber;
+  }
+
+  public void setMainAccountNumber(final String mainAccountNumber) {
+    this.mainAccountNumber = mainAccountNumber;
+  }
+
+  public String getCreatedBy() {
+    return this.createdBy;
+  }
+
+  public void setCreatedBy(final String createdBy) {
+    this.createdBy = createdBy;
+  }
+
+  public LocalDateTime getCreatedOn() {
+    return this.createdOn;
+  }
+
+  public void setCreatedOn(final LocalDateTime createdOn) {
+    this.createdOn = createdOn;
+  }
+
+  public String getLastModifiedBy() {
+    return this.lastModifiedBy;
+  }
+
+  public void setLastModifiedBy(final String lastModifiedBy) {
+    this.lastModifiedBy = lastModifiedBy;
+  }
+
+  public LocalDateTime getLastModifiedOn() {
+    return this.lastModifiedOn;
+  }
+
+  public void setLastModifiedOn(final LocalDateTime lastModifiedOn) {
+    this.lastModifiedOn = lastModifiedOn;
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationRepository.java
similarity index 74%
copy from service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
copy to service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationRepository.java
index 87ea8a7..fb2944a 100644
--- a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationRepository.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service.internal.repository;
+package io.mifos.payroll.service.internal.repository;
 
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
@@ -21,6 +21,6 @@ import org.springframework.stereotype.Repository;
 import java.util.Optional;
 
 @Repository
-public interface SampleJpaEntityRepository extends JpaRepository<SampleJpaEntity, Long> {
-  Optional<SampleJpaEntity> findByIdentifier(String identifier);
+public interface PayrollConfigurationRepository extends JpaRepository<PayrollConfigurationEntity, Long> {
+  Optional<PayrollConfigurationEntity> findByCustomerIdentifier(final String customerIdentifier);
 }
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java
new file mode 100644
index 0000000..3b782ed
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.repository;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import java.math.BigDecimal;
+
+@Entity
+@Table(name = "meketre_payroll_payments")
+public class PayrollPaymentEntity {
+
+  @Id
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
+  @Column(name = "id", nullable = false)
+  private Long id;
+  @ManyToOne
+  @JoinColumn(name = "payroll_collection_id", nullable = false)
+  private PayrollCollectionEntity payrollCollection;
+  @Column(name = "customer_identifier", nullable = false, length = 32)
+  private String customerIdentifier;
+  @Column(name = "employer", nullable = false, length = 256)
+  private String employer;
+  @Column(name = "salary", nullable = false, precision = 15, scale = 5)
+  private BigDecimal salary;
+
+  public PayrollPaymentEntity() {
+    super();
+  }
+
+  public Long getId() {
+    return this.id;
+  }
+
+  public void setId(final Long id) {
+    this.id = id;
+  }
+
+  public PayrollCollectionEntity getPayrollCollection() {
+    return this.payrollCollection;
+  }
+
+  public void setPayrollCollection(final PayrollCollectionEntity payrollCollection) {
+    this.payrollCollection = payrollCollection;
+  }
+
+  public String getCustomerIdentifier() {
+    return this.customerIdentifier;
+  }
+
+  public void setCustomerIdentifier(final String customerIdentifier) {
+    this.customerIdentifier = customerIdentifier;
+  }
+
+  public String getEmployer() {
+    return this.employer;
+  }
+
+  public void setEmployer(final String employer) {
+    this.employer = employer;
+  }
+
+  public BigDecimal getSalary() {
+    return this.salary;
+  }
+
+  public void setSalary(final BigDecimal salary) {
+    this.salary = salary;
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentRepository.java
similarity index 63%
rename from service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
rename to service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentRepository.java
index 87ea8a7..91685ce 100644
--- a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntityRepository.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentRepository.java
@@ -13,14 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.service.internal.repository;
+package io.mifos.payroll.service.internal.repository;
 
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
 
-import java.util.Optional;
-
 @Repository
-public interface SampleJpaEntityRepository extends JpaRepository<SampleJpaEntity, Long> {
-  Optional<SampleJpaEntity> findByIdentifier(String identifier);
+public interface PayrollPaymentRepository extends JpaRepository<PayrollPaymentEntity, Long> {
+  Page<PayrollPaymentEntity> findByPayrollCollection(final PayrollCollectionEntity payrollCollectionEntity,
+                                                     Pageable pageable);
 }
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
new file mode 100644
index 0000000..eefeca3
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.service;
+
+import io.mifos.accounting.api.v1.domain.Account;
+import io.mifos.customer.api.v1.domain.Customer;
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import io.mifos.payroll.service.ServiceConstants;
+import io.mifos.payroll.service.internal.mapper.PayrollAllocationMapper;
+import io.mifos.payroll.service.internal.mapper.PayrollConfigurationMapper;
+import io.mifos.payroll.service.internal.repository.PayrollAllocationRepository;
+import io.mifos.payroll.service.internal.repository.PayrollConfigurationRepository;
+import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import io.mifos.payroll.service.internal.service.adaptor.CustomerAdaptor;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+@Service
+public class PayrollConfigurationService {
+
+  private final Logger logger;
+  private final PayrollConfigurationRepository payrollConfigurationRepository;
+  private final PayrollAllocationRepository payrollAllocationRepository;
+  private final CustomerAdaptor customerAdaptor;
+  private final AccountingAdaptor accountingAdaptor;
+
+  @Autowired
+  public PayrollConfigurationService(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                                     final PayrollConfigurationRepository payrollConfigurationRepository,
+                                     final PayrollAllocationRepository payrollAllocationRepository,
+                                     final CustomerAdaptor customerAdaptor,
+                                     final AccountingAdaptor accountingAdaptor) {
+    super();
+    this.logger = logger;
+    this.payrollConfigurationRepository = payrollConfigurationRepository;
+    this.payrollAllocationRepository = payrollAllocationRepository;
+    this.customerAdaptor = customerAdaptor;
+    this.accountingAdaptor = accountingAdaptor;
+  }
+
+  public Optional<Customer> findCustomer(final String customerIdentifier) {
+    return this.customerAdaptor.findCustomer(customerIdentifier);
+  }
+
+  public Optional<Account> findAccount(final String accountIdentifier) {
+    return this.accountingAdaptor.findAccount(accountIdentifier);
+  }
+
+  public Optional<PayrollConfiguration> findPayrollConfiguration(final String customerIdentifier) {
+    return this.payrollConfigurationRepository
+        .findByCustomerIdentifier(customerIdentifier)
+        .map(payrollConfigurationEntity -> {
+          final PayrollConfiguration payrollConfiguration = PayrollConfigurationMapper.map(payrollConfigurationEntity);
+
+          payrollConfiguration.setPayrollAllocations(
+              this.payrollAllocationRepository.findByPayrollConfiguration(payrollConfigurationEntity)
+                  .stream()
+                  .map(PayrollAllocationMapper::map)
+              .collect(Collectors.toSet())
+          );
+
+          return payrollConfiguration;
+        });
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java
new file mode 100644
index 0000000..dd4012e
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.service;
+
+import io.mifos.core.lang.DateConverter;
+import io.mifos.core.lang.ServiceException;
+import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
+import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
+import io.mifos.payroll.service.ServiceConstants;
+import io.mifos.payroll.service.internal.mapper.PayrollPaymentMapper;
+import io.mifos.payroll.service.internal.repository.PayrollCollectionEntity;
+import io.mifos.payroll.service.internal.repository.PayrollCollectionRepository;
+import io.mifos.payroll.service.internal.repository.PayrollPaymentEntity;
+import io.mifos.payroll.service.internal.repository.PayrollPaymentRepository;
+import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+@Service
+public class PayrollDistributionService {
+
+  private final Logger logger;
+  private final PayrollCollectionRepository payrollCollectionRepository;
+  private final PayrollPaymentRepository payrollPaymentRepository;
+  private final AccountingAdaptor accountingAdaptor;
+
+  @Autowired
+  public PayrollDistributionService(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                                    final PayrollCollectionRepository payrollCollectionRepository,
+                                    final PayrollPaymentRepository payrollPaymentRepository,
+                                    final AccountingAdaptor accountingAdaptor) {
+    super();
+    this.logger = logger;
+    this.payrollCollectionRepository = payrollCollectionRepository;
+    this.payrollPaymentRepository = payrollPaymentRepository;
+    this.accountingAdaptor = accountingAdaptor;
+  }
+
+
+  public List<PayrollCollectionHistory> fetchHistory() {
+    return this.payrollCollectionRepository.findAllByOrderByCreatedOnDesc()
+        .stream()
+        .map(this::mapPayrollCollection)
+        .collect(Collectors.toList());
+  }
+
+  public Optional<PayrollCollectionHistory> findDistribution(final String identifier) {
+    return this.payrollCollectionRepository.findByIdentifier(identifier)
+        .map(this::mapPayrollCollection);
+  }
+
+  public PayrollPaymentPage fetchPayments(final String identifier, final Pageable pageable) {
+    final PayrollPaymentPage payrollPaymentPage = new PayrollPaymentPage();
+
+    final PayrollCollectionEntity payrollCollectionEntity =
+        this.payrollCollectionRepository.findByIdentifier(identifier).orElseThrow(
+            () -> ServiceException.notFound("Payroll distribution {0} not found.", identifier)
+        );
+
+    final Page<PayrollPaymentEntity> pagedEntities =
+        this.payrollPaymentRepository.findByPayrollCollection(payrollCollectionEntity, pageable);
+    payrollPaymentPage.setTotalElements(pagedEntities.getTotalElements());
+    payrollPaymentPage.setTotalPages(pagedEntities.getTotalPages());
+    pagedEntities.forEach(
+        payrollPaymentEntity -> payrollPaymentPage.add(PayrollPaymentMapper.map(payrollPaymentEntity))
+    );
+
+    return payrollPaymentPage;
+  }
+
+  private PayrollCollectionHistory mapPayrollCollection(final PayrollCollectionEntity payrollCollectionEntity) {
+    final PayrollCollectionHistory payrollCollectionHistory = new PayrollCollectionHistory();
+    payrollCollectionHistory.setIdentifier(payrollCollectionEntity.getIdentifier());
+    payrollCollectionHistory.setSourceAccountNumber(payrollCollectionEntity.getSourceAccountNumber());
+    payrollCollectionHistory.setCreatedBy(payrollCollectionEntity.getCreatedBy());
+    payrollCollectionHistory.setCreatedOn(DateConverter.toIsoString(payrollCollectionEntity.getCreatedOn()));
+    return payrollCollectionHistory;
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
new file mode 100644
index 0000000..41f19df
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.service.adaptor;
+
+import com.google.common.collect.Sets;
+import io.mifos.accounting.api.v1.client.AccountNotFoundException;
+import io.mifos.accounting.api.v1.client.LedgerManager;
+import io.mifos.accounting.api.v1.domain.Account;
+import io.mifos.accounting.api.v1.domain.Creditor;
+import io.mifos.accounting.api.v1.domain.Debtor;
+import io.mifos.accounting.api.v1.domain.JournalEntry;
+import io.mifos.core.lang.DateConverter;
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import io.mifos.payroll.api.v1.domain.PayrollPayment;
+import io.mifos.payroll.service.ServiceConstants;
+import io.mifos.payroll.service.internal.repository.PayrollCollectionEntity;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
+import java.time.Clock;
+import java.time.LocalDateTime;
+import java.util.HashSet;
+import java.util.Optional;
+import java.util.UUID;
+
+@Service
+public class AccountingAdaptor {
+
+  private final Logger logger;
+  private final LedgerManager ledgerManager;
+
+  @Autowired
+  public AccountingAdaptor(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                           final LedgerManager ledgerManager) {
+    super();
+    this.logger = logger;
+    this.ledgerManager = ledgerManager;
+  }
+
+  public Optional<Account> findAccount(final String accountIdentifier) {
+    try {
+      return Optional.of(this.ledgerManager.findAccount(accountIdentifier));
+    } catch (final AccountNotFoundException anfex) {
+      this.logger.warn("Account {} not found.", accountIdentifier);
+      return Optional.empty();
+    }
+  }
+
+  public void postPayrollPayment(final PayrollCollectionEntity payrollCollectionEntity,
+                                 final PayrollPayment payrollPayment,
+                                 final PayrollConfiguration payrollConfiguration) {
+
+    final MathContext mathContext = new MathContext(2, RoundingMode.HALF_EVEN);
+
+    final JournalEntry journalEntry = new JournalEntry();
+    journalEntry.setTransactionIdentifier(UUID.randomUUID().toString());
+    journalEntry.setTransactionDate(DateConverter.toIsoString(LocalDateTime.now(Clock.systemUTC())));
+    journalEntry.setTransactionType("SALA");
+    journalEntry.setClerk(payrollCollectionEntity.getCreatedBy());
+    journalEntry.setNote("Payroll Distribution");
+
+    final Debtor debtor = new Debtor();
+    debtor.setAccountNumber(payrollCollectionEntity.getSourceAccountNumber());
+    debtor.setAmount(payrollPayment.getSalary().toString());
+    journalEntry.setDebtors(Sets.newHashSet(debtor));
+
+    final HashSet<Creditor> creditors = new HashSet<>();
+    journalEntry.setCreditors(creditors);
+
+    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation -> {
+      final Creditor allocationCreditor = new Creditor();
+      allocationCreditor.setAccountNumber(payrollAllocation.getAccountNumber());
+      if (!payrollAllocation.getProportional()) {
+        allocationCreditor.setAmount(payrollAllocation.getAmount().toString());
+      } else {
+        final BigDecimal value = payrollPayment.getSalary().multiply(
+            payrollAllocation.getAmount().divide(BigDecimal.valueOf(100.00D), mathContext)
+        ).round(mathContext);
+        allocationCreditor.setAmount(value.toString());
+      }
+      creditors.add(allocationCreditor);
+    });
+
+    final BigDecimal currentCreditorSum =
+        BigDecimal.valueOf(creditors.stream().mapToDouble(value -> Double.valueOf(value.getAmount())).sum());
+
+    final Creditor mainCreditor = new Creditor();
+    mainCreditor.setAccountNumber(payrollConfiguration.getMainAccountNumber());
+    mainCreditor.setAmount(payrollPayment.getSalary().subtract(currentCreditorSum).toString());
+    creditors.add(mainCreditor);
+
+    this.ledgerManager.createJournalEntry(journalEntry);
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
new file mode 100644
index 0000000..9fd9d0c
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.internal.service.adaptor;
+
+import io.mifos.customer.api.v1.client.CustomerManager;
+import io.mifos.customer.api.v1.client.CustomerNotFoundException;
+import io.mifos.customer.api.v1.domain.Customer;
+import io.mifos.payroll.service.ServiceConstants;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+import java.util.Optional;
+
+@Service
+public class CustomerAdaptor {
+
+  private final Logger logger;
+  private final CustomerManager customerManager;
+
+  @Autowired
+  public CustomerAdaptor(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                         final CustomerManager customerManager) {
+    super();
+    this.logger = logger;
+    this.customerManager = customerManager;
+  }
+
+  public Optional<Customer> findCustomer(final String customerIdentifier) {
+    try {
+      return Optional.of(this.customerManager.findCustomer(customerIdentifier));
+    } catch (final CustomerNotFoundException cnfex) {
+      this.logger.warn("Customer {} not found.", customerIdentifier);
+      return Optional.empty();
+    }
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java
new file mode 100644
index 0000000..84f58ef
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.rest;
+
+import io.mifos.anubis.annotation.AcceptedTokenType;
+import io.mifos.anubis.annotation.Permittable;
+import io.mifos.core.command.gateway.CommandGateway;
+import io.mifos.payroll.service.internal.command.MigrateServiceCommand;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@SuppressWarnings("unused")
+@RestController
+@RequestMapping("/")
+public class MigrationRestController {
+
+  private final CommandGateway commandGateway;
+
+  @Autowired
+  public MigrationRestController(final CommandGateway commandGateway) {
+    super();
+    this.commandGateway = commandGateway;
+  }
+
+  @Permittable(AcceptedTokenType.SYSTEM)
+  @RequestMapping(
+      value = "/initialize",
+      method = RequestMethod.POST,
+      consumes = MediaType.ALL_VALUE,
+      produces = MediaType.APPLICATION_JSON_VALUE
+  )
+  public
+  @ResponseBody
+  ResponseEntity<Void> initialize() throws InterruptedException {
+    this.commandGateway.process(new MigrateServiceCommand());
+    return ResponseEntity.accepted().build();
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
new file mode 100644
index 0000000..100319d
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.rest;
+
+import io.mifos.anubis.annotation.AcceptedTokenType;
+import io.mifos.anubis.annotation.Permittable;
+import io.mifos.anubis.annotation.Permittables;
+import io.mifos.core.command.gateway.CommandGateway;
+import io.mifos.core.lang.ServiceException;
+import io.mifos.payroll.api.v1.PermittableGroupIds;
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import io.mifos.payroll.service.ServiceConstants;
+import io.mifos.payroll.service.internal.command.PutPayrollConfigurationCommand;
+import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+@RestController
+@RequestMapping("/customers/{identifier}/payroll")
+public class PayrollConfigurationRestController {
+
+  private final Logger logger;
+  private final CommandGateway commandGateway;
+  private final PayrollConfigurationService payrollConfigurationService;
+
+  @Autowired
+  public PayrollConfigurationRestController(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                                            final CommandGateway commandGateway,
+                                            final PayrollConfigurationService payrollConfigurationService) {
+    super();
+    this.logger = logger;
+    this.commandGateway = commandGateway;
+    this.payrollConfigurationService = payrollConfigurationService;
+  }
+
+  @Permittables({
+      @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.CONFIGURATION)
+  })
+  @RequestMapping(
+      method = RequestMethod.PUT,
+      consumes = {
+          MediaType.APPLICATION_JSON_VALUE
+      },
+      produces = {
+          MediaType.APPLICATION_JSON_VALUE
+      }
+  )
+  @ResponseBody
+  public ResponseEntity<Void> setPayrollConfiguration(@PathVariable(value = "identifier") final String customerIdentifier,
+                                                     @RequestBody @Valid final PayrollConfiguration payrollConfiguration) {
+    this.payrollConfigurationService.findCustomer(customerIdentifier)
+        .orElseThrow(() -> ServiceException.notFound("Customer {0} not found.", customerIdentifier)
+    );
+
+    this.payrollConfigurationService.findAccount(payrollConfiguration.getMainAccountNumber())
+        .orElseThrow(() -> ServiceException.notFound("Main account {0} not found.", payrollConfiguration.getMainAccountNumber()));
+
+    if (payrollConfiguration.getPayrollAllocations() != null
+        && payrollConfiguration.getPayrollAllocations()
+        .stream()
+        .filter(payrollAllocation ->
+          !this.payrollConfigurationService.findAccount(payrollAllocation.getAccountNumber()).isPresent()
+        ).count() > 0L) {
+      throw ServiceException.notFound("Certain allocated accounts not found.");
+    }
+
+    this.commandGateway.process(new PutPayrollConfigurationCommand(customerIdentifier, payrollConfiguration));
+
+    return ResponseEntity.accepted().build();
+  }
+
+  @Permittables({
+      @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.CONFIGURATION)
+  })
+  @RequestMapping(
+      method = RequestMethod.GET,
+      consumes = {
+          MediaType.ALL_VALUE
+      },
+      produces = {
+          MediaType.APPLICATION_JSON_VALUE
+      }
+  )
+  @ResponseBody
+  PayrollConfiguration findPayrollConfiguration(@PathVariable(value = "identifier") final String customerIdentifier) {
+    return this.payrollConfigurationService.findPayrollConfiguration(customerIdentifier)
+        .orElseThrow(() -> ServiceException.notFound("Payroll configuration for customer {0} not found.", customerIdentifier));
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
new file mode 100644
index 0000000..86d3203
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.rest;
+
+import io.mifos.anubis.annotation.AcceptedTokenType;
+import io.mifos.anubis.annotation.Permittable;
+import io.mifos.anubis.annotation.Permittables;
+import io.mifos.core.command.gateway.CommandGateway;
+import io.mifos.core.lang.ServiceException;
+import io.mifos.payroll.api.v1.PermittableGroupIds;
+import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
+import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
+import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
+import io.mifos.payroll.service.ServiceConstants;
+import io.mifos.payroll.service.internal.command.DistributePayrollCommand;
+import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
+import io.mifos.payroll.service.internal.service.PayrollDistributionService;
+import io.mifos.payroll.service.rest.util.PageableBuilder;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.List;
+
+@RestController
+@RequestMapping("/distribution")
+public class PayrollDistributionRestController {
+
+  private final Logger logger;
+  private final CommandGateway commandGateway;
+  private final PayrollDistributionService payrollDistributionService;
+  private final PayrollConfigurationService payrollConfigurationService;
+
+  @Autowired
+  public PayrollDistributionRestController(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
+                                           final CommandGateway commandGateway,
+                                           final PayrollDistributionService payrollDistributionService,
+                                           final PayrollConfigurationService payrollConfigurationService) {
+    super();
+    this.logger = logger;
+    this.commandGateway = commandGateway;
+    this.payrollDistributionService = payrollDistributionService;
+    this.payrollConfigurationService = payrollConfigurationService;
+  }
+
+  @Permittables({
+      @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.DISTRIBUTION)
+  })
+  @RequestMapping(
+      method = RequestMethod.POST,
+      consumes = {
+          MediaType.APPLICATION_JSON_VALUE
+      },
+      produces = {
+          MediaType.APPLICATION_JSON_VALUE
+      }
+  )
+  @ResponseBody
+  public ResponseEntity<Void> distribute(@RequestBody @Valid final PayrollCollectionSheet payrollCollectionSheet) {
+
+    this.payrollConfigurationService.findAccount(payrollCollectionSheet.getSourceAccountNumber())
+        .orElseThrow(() -> ServiceException.notFound("Account {0} not found.", payrollCollectionSheet.getSourceAccountNumber()));
+
+    if (payrollCollectionSheet.getPayrollPayments()
+        .stream()
+        .filter(
+            payrollPayment -> !this.payrollConfigurationService
+                .findPayrollConfiguration(payrollPayment.getCustomerIdentifier())
+                .isPresent()
+        )
+        .count() > 0L) {
+      throw ServiceException.conflict("Missing payroll configuration for certain customers.");
+    }
+
+    this.commandGateway.process(new DistributePayrollCommand(payrollCollectionSheet));
+
+    return ResponseEntity.accepted().build();
+  }
+
+  @Permittables({
+      @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.DISTRIBUTION)
+  })
+  @RequestMapping(
+      method = RequestMethod.GET,
+      consumes = {
+          MediaType.ALL_VALUE
+      },
+      produces = {
+          MediaType.APPLICATION_JSON_VALUE
+      }
+  )
+  @ResponseBody
+  public ResponseEntity<List<PayrollCollectionHistory>> fetchDistributionHistory() {
+    return ResponseEntity.ok(this.payrollDistributionService.fetchHistory());
+  }
+
+  @Permittables({
+      @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.DISTRIBUTION)
+  })
+  @RequestMapping(
+      value = "/{identifier}/payments",
+      method = RequestMethod.GET,
+      consumes = {
+          MediaType.ALL_VALUE
+      },
+      produces = {
+          MediaType.APPLICATION_JSON_VALUE
+      }
+  )
+  @ResponseBody
+  ResponseEntity<PayrollPaymentPage> fetchPayments(
+      @PathVariable("identifier") final String identifier,
+      @RequestParam(value = "pageIndex", required = false) final Integer pageIndex,
+      @RequestParam(value = "size", required = false) final Integer size,
+      @RequestParam(value = "sortColumn", required = false) final String sortColumn,
+      @RequestParam(value = "sortDirection", required = false) final String sortDirection) {
+    this.payrollDistributionService.findDistribution(identifier)
+        .orElseThrow(() -> ServiceException.notFound("Payroll distribution {0} not found."));
+
+    return ResponseEntity.ok(this.payrollDistributionService
+        .fetchPayments(identifier, PageableBuilder.create(pageIndex, size, sortColumn, sortDirection)));
+  }
+}
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/util/PageableBuilder.java b/service/src/main/java/io/mifos/payroll/service/rest/util/PageableBuilder.java
new file mode 100644
index 0000000..ff34371
--- /dev/null
+++ b/service/src/main/java/io/mifos/payroll/service/rest/util/PageableBuilder.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.payroll.service.rest.util;
+
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+
+import javax.annotation.Nullable;
+
+public class PageableBuilder {
+
+  private PageableBuilder() {
+    super();
+  }
+
+  public static Pageable create(
+      @Nullable final Integer pageIndex,
+      @Nullable final Integer size,
+      @Nullable final String sortColumn,
+      @Nullable final String sortDirection) {
+    final Integer pageIndexToUse = pageIndex != null ? pageIndex : 0;
+    final Integer sizeToUse = size != null ? size : 20;
+    final String sortColumnToUse = sortColumn != null ? sortColumn : "customerIdentifier";
+    final Sort.Direction direction = sortDirection != null ? Sort.Direction.valueOf(sortDirection.toUpperCase()) : Sort.Direction.ASC;
+    return new PageRequest(pageIndexToUse, sizeToUse, direction, sortColumnToUse);
+  }
+}
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
deleted file mode 100644
index 9a7c572..0000000
--- a/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2017 The Mifos Initiative.
- *
- * Licensed 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 io.mifos.template.service.internal.command.handler;
-
-import io.mifos.core.command.annotation.Aggregate;
-import io.mifos.core.command.annotation.CommandHandler;
-import io.mifos.core.command.annotation.CommandLogLevel;
-import io.mifos.core.command.annotation.EventEmitter;
-import io.mifos.template.api.v1.events.EventConstants;
-import io.mifos.template.service.internal.command.SampleCommand;
-import io.mifos.template.service.internal.repository.SampleJpaEntity;
-import io.mifos.template.service.internal.repository.SampleJpaEntityRepository;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@SuppressWarnings("unused")
-@Aggregate
-public class SampleAggregate {
-
-  private final SampleJpaEntityRepository sampleJpaEntityRepository;
-
-  @Autowired
-  public SampleAggregate(final SampleJpaEntityRepository sampleJpaEntityRepository) {
-    super();
-    this.sampleJpaEntityRepository = sampleJpaEntityRepository;
-  }
-
-  //TODO: Think about your command handler logging, then delete this comment.
-  // The log levels provided in the command handler cause log messages to be emitted each time this
-  // command handler is called before and after the call. Before the call, the command is logged
-  // using its toString() method, and after the call, the emitted event is logged via its toString()
-  // method.
-  //
-  // If you wish to adjust the information in the log messages, do so via the toString() methods.
-  // Financial transactions, passwords, and customer address data are examples of information which
-  // should not be placed in the logs.
-  //
-  // If a command handler should not emit a log message, change logStart and logFinish to:
-  // CommandLogLevel.NONE.
-  @CommandHandler(logStart = CommandLogLevel.INFO, logFinish = CommandLogLevel.INFO)
-  @Transactional
-  @EventEmitter(selectorName = EventConstants.SELECTOR_NAME, selectorValue = EventConstants.POST_SAMPLE)
-  public String sample(final SampleCommand sampleCommand) {
-
-    final SampleJpaEntity entity = new SampleJpaEntity();
-    entity.setIdentifier(sampleCommand.sample().getIdentifier());
-    entity.setPayload(sampleCommand.sample().getPayload());
-    this.sampleJpaEntityRepository.save(entity);
-
-    return sampleCommand.sample().getIdentifier();
-  }
-}
diff --git a/service/src/main/java/io/mifos/template/service/internal/mapper/SampleMapper.java b/service/src/main/java/io/mifos/template/service/internal/mapper/SampleMapper.java
deleted file mode 100644
index 983b5d5..0000000
--- a/service/src/main/java/io/mifos/template/service/internal/mapper/SampleMapper.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2017 The Mifos Initiative.
- *
- * Licensed 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 io.mifos.template.service.internal.mapper;
-
-import io.mifos.template.api.v1.domain.Sample;
-import io.mifos.template.service.internal.repository.SampleJpaEntity;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class SampleMapper {
-
-  private SampleMapper() {
-    super();
-  }
-
-  public static Sample map(final SampleJpaEntity sampleJpaEntity) {
-    final Sample sample = new Sample();
-    sample.setIdentifier(sampleJpaEntity.getIdentifier());
-    sample.setPayload(sampleJpaEntity.getPayload());
-    return sample;
-  }
-
-  public static List<Sample> map(final List<SampleJpaEntity> sampleJpaEntities) {
-    final ArrayList<Sample> samples = new ArrayList<>(sampleJpaEntities.size());
-    samples.addAll(sampleJpaEntities.stream().map(SampleMapper::map).collect(Collectors.toList()));
-    return samples;
-  }
-}
diff --git a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntity.java b/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntity.java
deleted file mode 100644
index 9cbcd73..0000000
--- a/service/src/main/java/io/mifos/template/service/internal/repository/SampleJpaEntity.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2017 The Mifos Initiative.
- *
- * Licensed 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 io.mifos.template.service.internal.repository;
-
-import javax.persistence.*;
-
-@SuppressWarnings("unused")
-@Entity
-@Table(name = "template_samples")
-public class SampleJpaEntity {
-
-  @Id
-  @GeneratedValue(strategy = GenerationType.IDENTITY)
-  @Column(name = "id")
-  private Long id;
-  @Column(name = "identifier")
-  private String identifier;
-  @Column(name = "payload")
-  private String payload;
-
-  public SampleJpaEntity() {
-    super();
-  }
-
-  public Long getId() {
-    return id;
-  }
-
-  public void setId(Long id) {
-    this.id = id;
-  }
-
-  public String getIdentifier() {
-    return this.identifier;
-  }
-
-  public void setIdentifier(final String identifier) {
-    this.identifier = identifier;
-  }
-
-  public String getPayload() {
-    return payload;
-  }
-
-  public void setPayload(String payload) {
-    this.payload = payload;
-  }
-}
diff --git a/service/src/main/java/io/mifos/template/service/internal/service/SampleService.java b/service/src/main/java/io/mifos/template/service/internal/service/SampleService.java
deleted file mode 100644
index caba840..0000000
--- a/service/src/main/java/io/mifos/template/service/internal/service/SampleService.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2017 The Mifos Initiative.
- *
- * Licensed 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 io.mifos.template.service.internal.service;
-
-import io.mifos.template.api.v1.domain.Sample;
-import io.mifos.template.service.internal.mapper.SampleMapper;
-import io.mifos.template.service.internal.repository.SampleJpaEntityRepository;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.Optional;
-
-@Service
-public class SampleService {
-
-  private final SampleJpaEntityRepository sampleJpaEntityRepository;
-
-  @Autowired
-  public SampleService(final SampleJpaEntityRepository sampleJpaEntityRepository) {
-    super();
-    this.sampleJpaEntityRepository = sampleJpaEntityRepository;
-  }
-
-  public List<Sample> findAllEntities() {
-    return SampleMapper.map(this.sampleJpaEntityRepository.findAll());
-  }
-
-  public Optional<Sample> findByIdentifier(final String identifier) {
-    return this.sampleJpaEntityRepository.findByIdentifier(identifier).map(SampleMapper::map);
-  }
-}
diff --git a/service/src/main/java/io/mifos/template/service/rest/SampleRestController.java b/service/src/main/java/io/mifos/template/service/rest/SampleRestController.java
deleted file mode 100644
index 9919252..0000000
--- a/service/src/main/java/io/mifos/template/service/rest/SampleRestController.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2017 The Mifos Initiative.
- *
- * Licensed 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 io.mifos.template.service.rest;
-
-import io.mifos.anubis.annotation.AcceptedTokenType;
-import io.mifos.anubis.annotation.Permittable;
-import io.mifos.core.command.gateway.CommandGateway;
-import io.mifos.core.lang.ServiceException;
-import io.mifos.template.api.v1.PermittableGroupIds;
-import io.mifos.template.api.v1.domain.Sample;
-import io.mifos.template.service.ServiceConstants;
-import io.mifos.template.service.internal.command.InitializeServiceCommand;
-import io.mifos.template.service.internal.command.SampleCommand;
-import io.mifos.template.service.internal.service.SampleService;
-import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-import java.util.List;
-
-@SuppressWarnings("unused")
-@RestController
-@RequestMapping("/")
-public class SampleRestController {
-
-  private final Logger logger;
-  private final CommandGateway commandGateway;
-  private final SampleService sampleService;
-
-  @Autowired
-  public SampleRestController(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
-                              final CommandGateway commandGateway,
-                              final SampleService sampleService) {
-    super();
-    this.logger = logger;
-    this.commandGateway = commandGateway;
-    this.sampleService = sampleService;
-  }
-
-  @Permittable(value = AcceptedTokenType.SYSTEM)
-  @RequestMapping(
-      value = "/initialize",
-      method = RequestMethod.POST,
-      consumes = MediaType.ALL_VALUE,
-      produces = MediaType.APPLICATION_JSON_VALUE
-  )
-  public
-  @ResponseBody
-  ResponseEntity<Void> initialize() throws InterruptedException {
-      this.commandGateway.process(new InitializeServiceCommand());
-      return ResponseEntity.accepted().build();
-  }
-
-  @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.SAMPLE_MANAGEMENT)
-  @RequestMapping(
-          value = "/sample",
-          method = RequestMethod.GET,
-          consumes = MediaType.ALL_VALUE,
-          produces = MediaType.APPLICATION_JSON_VALUE
-  )
-  public
-  @ResponseBody
-  List<Sample> findAllEntities() {
-    return this.sampleService.findAllEntities();
-  }
-
-  @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.SAMPLE_MANAGEMENT)
-  @RequestMapping(
-          value = "/sample/{identifier}",
-          method = RequestMethod.GET,
-          consumes = MediaType.ALL_VALUE,
-          produces = MediaType.APPLICATION_JSON_VALUE
-  )
-  public
-  @ResponseBody
-  ResponseEntity<Sample> getEntity(@PathVariable("identifier") final String identifier) {
-    return this.sampleService.findByIdentifier(identifier)
-            .map(ResponseEntity::ok)
-            .orElseThrow(() -> ServiceException.notFound("Instance with identifier " + identifier + " doesn't exist."));
-  }
-
-  @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.SAMPLE_MANAGEMENT)
-  @RequestMapping(
-      value = "/sample",
-      method = RequestMethod.POST,
-      consumes = MediaType.APPLICATION_JSON_VALUE,
-      produces = MediaType.APPLICATION_JSON_VALUE
-  )
-  public
-  @ResponseBody
-  ResponseEntity<Void> createEntity(@RequestBody @Valid final Sample instance) throws InterruptedException {
-    this.commandGateway.process(new SampleCommand(instance));
-    return ResponseEntity.accepted().build();
-  }
-}
diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml
index 8b395ca..124f606 100644
--- a/service/src/main/resources/application.yml
+++ b/service/src/main/resources/application.yml
@@ -28,7 +28,7 @@ eureka:
 
 server:
   port: 8081
-  contextPath: /template/v1/*
+  contextPath: /payroll/v1/*
 
 cassandra:
   clusterName: staging_cluster
diff --git a/service/src/main/resources/bootstrap.yml b/service/src/main/resources/bootstrap.yml
index 6b9e3e8..dac5589 100644
--- a/service/src/main/resources/bootstrap.yml
+++ b/service/src/main/resources/bootstrap.yml
@@ -16,4 +16,4 @@
 
 spring:
     application:
-        name: template-v1
+        name: payroll-v1
diff --git a/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql b/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
index fb1b54e..578e373 100644
--- a/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
+++ b/service/src/main/resources/db/migrations/mariadb/V1__initial_setup.sql
@@ -14,9 +14,45 @@
 -- limitations under the License.
 --
 
-CREATE TABLE template_samples (
-  id BIGINT NOT NULL AUTO_INCREMENT,
-  identifier VARCHAR(8) NOT NULL,
-  payload VARCHAR(512) NULL,
-  CONSTRAINT template_samples_pk PRIMARY KEY (id)
+CREATE TABLE meketre_payroll_configurations (
+  id                  BIGINT       NOT NULL AUTO_INCREMENT,
+  customer_identifier VARCHAR(32)  NOT NULL,
+  main_account_number VARCHAR(34)  NOT NULL,
+  created_by          VARCHAR(32)  NOT NULL,
+  created_on          TIMESTAMP(3) NOT NULL,
+  last_modified_by    VARCHAR(32)  NULL,
+  last_modified_on    TIMESTAMP(3) NULL,
+  CONSTRAINT meketre_payroll_config_pk PRIMARY KEY (id),
+  CONSTRAINT meketre_payroll_config_acct_uq UNIQUE (customer_identifier, main_account_number)
+);
+
+CREATE TABLE meketre_payroll_allocations (
+  id                       BIGINT        NOT NULL AUTO_INCREMENT,
+  payroll_configuration_id BIGINT        NOT NULL,
+  account_number           VARCHAR(34)   NOT NULL,
+  amount                   NUMERIC(15,5) NOT NULL,
+  proportional             BOOLEAN       NOT NULL,
+  CONSTRAINT meketre_payroll_allocations_pk PRIMARY KEY (id),
+  CONSTRAINT meketre_payroll_alloc_acct_uq UNIQUE (payroll_configuration_id, account_number),
+  CONSTRAINT meketre_payroll_alloc_config_fk FOREIGN KEY (payroll_configuration_id) REFERENCES meketre_payroll_configurations (id)
+);
+
+CREATE TABLE meketre_payroll_collections (
+  id                    BIGINT       NOT NULL AUTO_INCREMENT,
+  identifier            VARCHAR(32)  NOT NULL,
+  source_account_number VARCHAR(34)  NOT NULL,
+  created_by            VARCHAR(32)  NOT NULL,
+  created_on            TIMESTAMP(3) NOT NULL,
+  CONSTRAINT meketre_payroll_collections_pk PRIMARY KEY (id),
+  CONSTRAINT meketre_pay_col_identifier_uq UNIQUE (identifier)
+);
+
+CREATE TABLE meketre_payroll_payments (
+  id                    BIGINT        NOT NULL AUTO_INCREMENT,
+  payroll_collection_id BIGINT        NOT NULL,
+  customer_identifier   VARCHAR(32)   NOT NULL,
+  employer              VARCHAR(256)  NOT NULL,
+  salary                NUMERIC(15,5) NOT NULL,
+  CONSTRAINT meketre_payroll_payments_pk PRIMARY KEY (id),
+  CONSTRAINT meketre_payroll_pay_coll_fk FOREIGN KEY (payroll_collection_id) REFERENCES meketre_payroll_collections (id)
 );
diff --git a/service/src/main/resources/logback.xml b/service/src/main/resources/logback.xml
new file mode 100644
index 0000000..e594df5
--- /dev/null
+++ b/service/src/main/resources/logback.xml
@@ -0,0 +1,55 @@
+<!--
+
+    Copyright 2017 The Mifos Initiative.
+
+    Licensed 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.
+
+-->
+<configuration>
+    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>logs/payroll.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>logs/archive/payroll.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <maxHistory>7</maxHistory>
+            <totalSizeCap>2GB</totalSizeCap>
+        </rollingPolicy>
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="com" level="INFO">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org" level="INFO">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="io" level="INFO">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="net" level="INFO">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <root level="DEBUG">
+        <appender-ref ref="FILE"/>
+    </root>
+</configuration>
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 1630ef8..f97fef4 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,4 @@
-rootProject.name = 'template'
+rootProject.name = 'payroll'
 
 includeBuild 'api'
 includeBuild 'service'
diff --git a/shared.gradle b/shared.gradle
index 1bfef46..831fede 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -1,4 +1,4 @@
-group 'io.mifos.template'
+group 'io.mifos.payroll'
 version '0.1.0.BUILD-SNAPSHOT'
 
 ext.versions = [
@@ -10,6 +10,8 @@ ext.versions = [
         frameworkcommand : '0.1.0-BUILD-SNAPSHOT',
         frameworktest: '0.1.0-BUILD-SNAPSHOT',
         frameworkanubis: '0.1.0-BUILD-SNAPSHOT',
+        frameworkcustomer: '0.1.0-BUILD-SNAPSHOT',
+        frameworkaccounting: '0.1.0-BUILD-SNAPSHOT',
         validator : '5.3.0.Final'
 ]
 


[fineract-cn-payroll] 42/50: Document Payroll API to configure payroll alocations

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 6094e1ecbdc916da558d1fca4ec655f7127d1b9b
Author: Isaac Kamga <u2...@gmail.com>
AuthorDate: Tue Sep 4 13:16:29 2018 +0100

    Document Payroll API to configure payroll alocations
---
 component-test/build.gradle                        |  13 +-
 .../cn/payroll/PayrollApiDocumentation.java        | 395 +++++++++++++++++++++
 2 files changed, 407 insertions(+), 1 deletion(-)

diff --git a/component-test/build.gradle b/component-test/build.gradle
index 95878f3..7723165 100644
--- a/component-test/build.gradle
+++ b/component-test/build.gradle
@@ -26,6 +26,7 @@ buildscript {
 
     dependencies {
         classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
+        classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.3")
     }
 }
 
@@ -34,6 +35,7 @@ plugins {
     id("org.nosphere.apache.rat") version "0.3.1"
 }
 apply from: '../shared.gradle'
+apply plugin: 'org.asciidoctor.convert'
 
 dependencies {
     compile(
@@ -43,10 +45,19 @@ dependencies {
             [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', name: 'lang', version: versions.frameworklang],
-            [group: 'org.springframework.boot', name: 'spring-boot-starter-test']
+            [group: 'org.springframework.boot', name: 'spring-boot-starter-test'],
+            [group: 'org.springframework.restdocs', name: 'spring-restdocs-mockmvc'],
+            [group: 'junit', name: 'junit', version: '4.12']
     )
 }
 
+asciidoctor {
+    sourceDir 'build/doc/asciidoc/'
+    outputDir 'build/doc/html5'
+    options backend: "html", doctype: "book"
+    attributes "source-highlighter": "highlightjs", 'snippets': file('build/doc/generated-snippets/')
+}
+
 publishing {
     publications {
         mavenJava(MavenPublication) {
diff --git a/component-test/src/main/java/org/apache/fineract/cn/payroll/PayrollApiDocumentation.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/PayrollApiDocumentation.java
new file mode 100644
index 0000000..39a38fc
--- /dev/null
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/PayrollApiDocumentation.java
@@ -0,0 +1,395 @@
+package org.apache.fineract.cn.payroll;
+
+import com.google.common.collect.Lists;
+import com.google.gson.Gson;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.customer.api.v1.domain.Customer;
+
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.api.v1.domain.*;
+import org.apache.fineract.cn.payroll.domain.DomainObjectGenerator;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollCollectionEntity;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.CustomerAdaptor;
+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.boot.test.mock.mockito.MockBean;
+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.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+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;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.put;
+import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
+import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields;
+import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
+
+public class PayrollApiDocumentation extends AbstractPayrollTest {
+
+  @Rule
+  public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("build/doc/generated-snippets/test-payroll");
+
+  @Autowired
+  private WebApplicationContext context;
+
+  private MockMvc mockMvc;
+
+  @MockBean
+  private CustomerAdaptor customerAdaptor;
+
+  @MockBean
+  private AccountingAdaptor accountingAdaptor;
+
+  @Before
+  public void setUp ( ) {
+
+    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+            .apply(documentationConfiguration(this.restDocumentation))
+            .build();
+  }
+
+  @Test
+  public void documentSetPayrollConfiguration ( ) throws Exception {
+
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    payrollConfiguration.setMainAccountNumber("12345678910");
+
+    final PayrollAllocation savingsAllocation = new PayrollAllocation();
+    savingsAllocation.setAccountNumber("9876543210");
+    savingsAllocation.setAmount(BigDecimal.valueOf(5500.00D));
+    savingsAllocation.setProportional(Boolean.TRUE);
+
+    final PayrollAllocation tradeUnionAllocation = new PayrollAllocation();
+    tradeUnionAllocation.setAccountNumber("24681097531");
+    tradeUnionAllocation.setAmount(BigDecimal.valueOf(43.00D));
+    tradeUnionAllocation.setProportional(Boolean.TRUE);
+
+    final ArrayList <PayrollAllocation> payrollAllocations = new ArrayList <>();
+    payrollConfiguration.setPayrollAllocations(payrollAllocations);
+    payrollAllocations.add(savingsAllocation);
+    payrollAllocations.add(tradeUnionAllocation);
+
+    final Customer customer = new Customer();
+    customer.setIdentifier("customerOne");
+
+    this.prepareConfigurationMocks(customer.getIdentifier(), payrollConfiguration);
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(put("/customers/" + customer.getIdentifier() + "/payroll")
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(payrollConfiguration)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-set-payroll-configuration", preprocessRequest(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("mainAccountNumber").description("Main account number"),
+                            fieldWithPath("payrollAllocations[].accountNumber").description("Account from where you pay first allocation"),
+                            fieldWithPath("payrollAllocations[].amount").type("Integer").description("Amount to be paid during first allocation"),
+                            fieldWithPath("payrollAllocations[].proportional").type("Boolean").description("Should payments be proportional ?"),
+                            fieldWithPath("payrollAllocations[1].accountNumber").description("Account from where you pay second allocation"),
+                            fieldWithPath("payrollAllocations[1].amount").type("Integer").description("Amount to be paid during first allocation"),
+                            fieldWithPath("payrollAllocations[1].proportional").type("Boolean").description("Should payments be proportional ?")
+                    )
+            ));
+  }
+
+  @Test
+  public void documentFindPayrollConfiguration ( ) throws Exception {
+
+    final PayrollConfiguration payrollConf = DomainObjectGenerator.getPayrollConfiguration();
+    payrollConf.setMainAccountNumber("AB12345");
+
+    final PayrollAllocation savingsAllocation = new PayrollAllocation();
+    savingsAllocation.setAccountNumber("BAH97531");
+    savingsAllocation.setAmount(BigDecimal.valueOf(73.00D));
+    savingsAllocation.setProportional(Boolean.TRUE);
+
+    final PayrollAllocation tradeUnionAllocation = new PayrollAllocation();
+    tradeUnionAllocation.setAccountNumber("CAG24680");
+    tradeUnionAllocation.setAmount(BigDecimal.valueOf(21.00D));
+    tradeUnionAllocation.setProportional(Boolean.TRUE);
+
+    final ArrayList <PayrollAllocation> payrollAllocations = new ArrayList <>();
+    payrollConf.setPayrollAllocations(payrollAllocations);
+    payrollAllocations.add(savingsAllocation);
+    payrollAllocations.add(tradeUnionAllocation);
+
+    final Customer customer = new Customer();
+    customer.setIdentifier("faundCostoma");
+
+    this.prepareConfigurationMocks(customer.getIdentifier(), payrollConf);
+    super.testSubject.setPayrollConfiguration(customer.getIdentifier(), payrollConf);
+    super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customer.getIdentifier());
+
+    this.mockMvc.perform(get("/customers/" + customer.getIdentifier() + "/payroll")
+            .accept(MediaType.APPLICATION_JSON_VALUE)
+            .contentType(MediaType.APPLICATION_JSON_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-find-payroll-configuration", preprocessResponse(prettyPrint()),
+                    responseFields(
+                            fieldWithPath("mainAccountNumber").description("Main account number"),
+                            fieldWithPath("payrollAllocations[].accountNumber").description("Account from where you pay first allocation"),
+                            fieldWithPath("payrollAllocations[].amount").type("Integer").description("Amount to be paid during first allocation"),
+                            fieldWithPath("payrollAllocations[].proportional").type("Boolean").description("Should payments be proportional ?"),
+                            fieldWithPath("payrollAllocations[1].accountNumber").description("Account from where you pay second allocation"),
+                            fieldWithPath("payrollAllocations[1].amount").type("Integer").description("Amount to be paid during first allocation"),
+                            fieldWithPath("payrollAllocations[1].proportional").type("Boolean").description("Should payments be proportional ?"),
+                            fieldWithPath("createdBy").description("Employee who configured payroll"),
+                            fieldWithPath("createdOn").description("Date when payroll was configured"),
+                            fieldWithPath("lastModifiedBy").type("String").description("Employee who last modified payroll"),
+                            fieldWithPath("lastModifiedOn").type("String").description("Date when payroll was last modified")
+                    )
+            ));
+  }
+
+  @Test
+  public void documentDistributePayments ( ) throws Exception {
+
+    final PayrollConfiguration payrollConf = DomainObjectGenerator.getPayrollConfiguration();
+    payrollConf.setMainAccountNumber("ABC09876");
+
+    final Customer customer = new Customer();
+    customer.setIdentifier("flauna");
+
+    this.prepareDistributionMocks(customer.getIdentifier(), payrollConf);
+    super.testSubject.setPayrollConfiguration(customer.getIdentifier(), payrollConf);
+    super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customer.getIdentifier());
+
+    final PayrollCollectionSheet payrollSheet = new PayrollCollectionSheet();
+    payrollSheet.setSourceAccountNumber("S1R2C3A4C5C6");
+    final PayrollPayment firstPayrollPayment = new PayrollPayment();
+    firstPayrollPayment.setCustomerIdentifier(customer.getIdentifier());
+    firstPayrollPayment.setEmployer("The Shop");
+    firstPayrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
+
+    final PayrollPayment secondPayrollPayment = new PayrollPayment();
+    secondPayrollPayment.setCustomerIdentifier(customer.getIdentifier());
+    secondPayrollPayment.setEmployer("The Tank");
+    secondPayrollPayment.setSalary(BigDecimal.valueOf(14.54D));
+
+    payrollSheet.setPayrollPayments(Lists.newArrayList(firstPayrollPayment, secondPayrollPayment));
+
+    final Account sourceAccount = new Account();
+    sourceAccount.setState(Account.State.OPEN.name());
+    Mockito
+            .doAnswer(invocation -> Optional.of(sourceAccount))
+            .when(this.accountingAdaptor).findAccount(Matchers.eq(payrollSheet.getSourceAccountNumber()));
+
+    Mockito
+            .doAnswer(invocation -> Optional.empty())
+            .when(this.accountingAdaptor).postPayrollPayment(
+            Matchers.any(PayrollCollectionEntity.class),
+            Matchers.refEq(firstPayrollPayment),
+            Matchers.any(PayrollConfiguration.class)
+    );
+
+    Mockito
+            .doAnswer(invocation -> Optional.empty())
+            .when(this.accountingAdaptor).postPayrollPayment(
+            Matchers.any(PayrollCollectionEntity.class),
+            Matchers.refEq(secondPayrollPayment),
+            Matchers.any(PayrollConfiguration.class)
+    );
+
+    Gson gson = new Gson();
+    this.mockMvc.perform(post("/distribution")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .content(gson.toJson(payrollSheet)))
+            .andExpect(status().isAccepted())
+            .andDo(document("document-distribute-payments", preprocessRequest(prettyPrint()),
+                    requestFields(
+                            fieldWithPath("sourceAccountNumber").description("Account from which payments ensue"),
+                            fieldWithPath("payrollPayments[].customerIdentifier").description("first customer's identifier"),
+                            fieldWithPath("payrollPayments[].employer").description("first customer's employer"),
+                            fieldWithPath("payrollPayments[].salary").description("first customer's salary"),
+                            fieldWithPath("payrollPayments[1].customerIdentifier").description("second customer's identifier"),
+                            fieldWithPath("payrollPayments[1].employer").description("second customer's employer"),
+                            fieldWithPath("payrollPayments[1].salary").description("second customer's salary")
+                    )));
+  }
+
+  @Test
+  public void documentFetchDistributionHistory ( ) throws Exception {
+
+    final PayrollConfiguration payrollConf = DomainObjectGenerator.getPayrollConfiguration();
+    payrollConf.setMainAccountNumber("XYVZ12345");
+
+    final Customer customer = new Customer();
+    customer.setIdentifier("splundna");
+
+    this.prepareDistributionMocks(customer.getIdentifier(), payrollConf);
+    super.testSubject.setPayrollConfiguration(customer.getIdentifier(), payrollConf);
+    super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customer.getIdentifier());
+
+    final PayrollCollectionSheet payrollSheet = new PayrollCollectionSheet();
+    payrollSheet.setSourceAccountNumber("S9R7C5A3C1C");
+    final PayrollPayment firstPayrollPayment = new PayrollPayment();
+    firstPayrollPayment.setCustomerIdentifier(customer.getIdentifier());
+    firstPayrollPayment.setEmployer("Awa & Sons");
+    firstPayrollPayment.setSalary(BigDecimal.valueOf(234.56D));
+
+    final PayrollPayment secondPayrollPayment = new PayrollPayment();
+    secondPayrollPayment.setCustomerIdentifier(customer.getIdentifier());
+    secondPayrollPayment.setEmployer("Njeiforbi");
+    secondPayrollPayment.setSalary(BigDecimal.valueOf(120.D));
+
+    payrollSheet.setPayrollPayments(Lists.newArrayList(firstPayrollPayment, secondPayrollPayment));
+
+    final Account sourceAccount = new Account();
+    sourceAccount.setState(Account.State.OPEN.name());
+    Mockito
+            .doAnswer(invocation -> Optional.of(sourceAccount))
+            .when(this.accountingAdaptor).findAccount(Matchers.eq(payrollSheet.getSourceAccountNumber()));
+
+    Mockito
+            .doAnswer(invocation -> Optional.empty())
+            .when(this.accountingAdaptor).postPayrollPayment(
+            Matchers.any(PayrollCollectionEntity.class),
+            Matchers.refEq(firstPayrollPayment),
+            Matchers.any(PayrollConfiguration.class)
+    );
+
+    Mockito
+            .doAnswer(invocation -> Optional.empty())
+            .when(this.accountingAdaptor).postPayrollPayment(
+            Matchers.any(PayrollCollectionEntity.class),
+            Matchers.refEq(secondPayrollPayment),
+            Matchers.any(PayrollConfiguration.class)
+    );
+
+    super.testSubject.distribute(payrollSheet);
+    super.eventRecorder.wait(EventConstants.POST_DISTRIBUTION, payrollSheet.getSourceAccountNumber());
+
+    this.mockMvc.perform(get("/distribution")
+            .accept(MediaType.ALL_VALUE)
+            .contentType(MediaType.APPLICATION_JSON_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-distribution-history", preprocessResponse(prettyPrint()),
+                    responseFields(
+                            fieldWithPath("[].identifier").description("Payroll history identifier"),
+                            fieldWithPath("[].sourceAccountNumber").description("Account from which payments ensue"),
+                            fieldWithPath("[].createdBy").description("Employee who distributed payroll"),
+                            fieldWithPath("[].createdOn").description("Date when payroll was distributed")
+                    )
+            ));
+  }
+
+  @Test
+  public void documentFetchPayments ( ) throws Exception {
+
+    final PayrollConfiguration payrollConf = DomainObjectGenerator.getPayrollConfiguration();
+    payrollConf.setMainAccountNumber("BDK232942");
+
+    final Customer customer = new Customer();
+    customer.setIdentifier("ngone");
+
+    this.prepareDistributionMocks(customer.getIdentifier(), payrollConf);
+    super.testSubject.setPayrollConfiguration(customer.getIdentifier(), payrollConf);
+    super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customer.getIdentifier());
+
+    final PayrollCollectionSheet payrollSheet = new PayrollCollectionSheet();
+    payrollSheet.setSourceAccountNumber("O3C87O643E45C4");
+    final PayrollPayment firstPayrollPayment = new PayrollPayment();
+    firstPayrollPayment.setCustomerIdentifier(customer.getIdentifier());
+    firstPayrollPayment.setEmployer("Nkwane");
+    firstPayrollPayment.setSalary(BigDecimal.valueOf(945));
+
+    payrollSheet.setPayrollPayments(Lists.newArrayList(firstPayrollPayment));
+
+    final Account sourceAccount = new Account();
+    sourceAccount.setState(Account.State.OPEN.name());
+    Mockito
+            .doAnswer(invocation -> Optional.of(sourceAccount))
+            .when(this.accountingAdaptor).findAccount(Matchers.eq(payrollSheet.getSourceAccountNumber()));
+
+    Mockito
+            .doAnswer(invocation -> Optional.empty())
+            .when(this.accountingAdaptor).postPayrollPayment(
+            Matchers.any(PayrollCollectionEntity.class),
+            Matchers.refEq(firstPayrollPayment),
+            Matchers.any(PayrollConfiguration.class)
+    );
+
+    super.testSubject.distribute(payrollSheet);
+    super.eventRecorder.wait(EventConstants.POST_DISTRIBUTION, payrollSheet.getSourceAccountNumber());
+
+    final List <PayrollCollectionHistory> payrollCollectionHistories = super.testSubject.fetchDistributionHistory();
+    Assert.assertEquals(1, payrollCollectionHistories.size());
+
+    final PayrollCollectionHistory payrollCollectionHistory = payrollCollectionHistories.get(0);
+    final PayrollPaymentPage payrollPaymentPage =
+            super.testSubject.fetchPayments(payrollCollectionHistory.getIdentifier(), 0, 10, null, null);
+    Assert.assertEquals(Long.valueOf(1L), payrollPaymentPage.getTotalElements());
+
+    this.mockMvc.perform(get("/distribution/" + payrollCollectionHistories.get(0).getIdentifier() + "/payments")
+            .accept(MediaType.ALL_VALUE)
+            .contentType(MediaType.APPLICATION_JSON_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-fetch-payments", preprocessResponse(prettyPrint()),
+                    responseFields(
+                            fieldWithPath("payrollPayments[0].customerIdentifier").description("second customer's identifier"),
+                            fieldWithPath("payrollPayments[0].employer").description("second customer's employer"),
+                            fieldWithPath("payrollPayments[0].salary").description("second customer's salary"),
+                            fieldWithPath("payrollPayments[0].processed").description("second customer's employer"),
+                            fieldWithPath("payrollPayments[0].message").description("second customer's salary"),
+                            fieldWithPath("totalPages").type("Integer").description("Pages of payroll payments"),
+                            fieldWithPath("totalElements").type("Integer").description("Number of payroll payments")
+                    )
+            ));
+  }
+
+  private void prepareConfigurationMocks (final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
+    Mockito
+            .doAnswer(invocation -> Optional.of(new Customer()))
+            .when(this.customerAdaptor).findCustomer(Matchers.eq(customerIdentifier));
+
+    Mockito
+            .doAnswer(invocation -> Optional.of(new Account()))
+            .when(this.accountingAdaptor).findAccount(Matchers.eq(payrollConfiguration.getMainAccountNumber()));
+
+    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation ->
+            Mockito
+                    .doAnswer(invocation -> Optional.of(new Account()))
+                    .when(this.accountingAdaptor).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()))
+    );
+  }
+
+  private void prepareDistributionMocks (final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
+    Mockito
+            .doAnswer(invocation -> Optional.of(new Customer()))
+            .when(this.customerAdaptor).findCustomer(Matchers.eq(customerIdentifier));
+
+    final Account mainAccount = new Account();
+    mainAccount.setState(Account.State.OPEN.name());
+    Mockito
+            .doAnswer(invocation -> Optional.of(mainAccount))
+            .when(this.accountingAdaptor).findAccount(Matchers.eq(payrollConfiguration.getMainAccountNumber()));
+
+    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation -> {
+      final Account allocatedAccount = new Account();
+      allocatedAccount.setState(Account.State.OPEN.name());
+      Mockito
+              .doAnswer(invocation -> Optional.of(allocatedAccount))
+              .when(this.accountingAdaptor).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()));
+    });
+  }
+}


[fineract-cn-payroll] 08/50: moved EventConstants to events package. events package is the appropriate location for multi-parameter event classes.

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 7a59849308aff186b7fb286923428799221232c0
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Jul 10 12:02:16 2017 +0200

    moved EventConstants to events package.  events package is the
    appropriate location for multi-parameter event classes.
---
 .../java/io/mifos/template/api/v1/{ => events}/EventConstants.java     | 2 +-
 component-test/src/main/java/io/mifos/template/TestSample.java         | 2 +-
 .../main/java/io/mifos/template/listener/MigrationEventListener.java   | 2 +-
 .../src/main/java/io/mifos/template/listener/SampleEventListener.java  | 2 +-
 .../template/service/internal/command/handler/MigrationAggregate.java  | 3 ++-
 .../template/service/internal/command/handler/SampleAggregate.java     | 2 +-
 6 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/api/src/main/java/io/mifos/template/api/v1/EventConstants.java b/api/src/main/java/io/mifos/template/api/v1/events/EventConstants.java
similarity index 95%
rename from api/src/main/java/io/mifos/template/api/v1/EventConstants.java
rename to api/src/main/java/io/mifos/template/api/v1/events/EventConstants.java
index 69b1343..6207c03 100644
--- a/api/src/main/java/io/mifos/template/api/v1/EventConstants.java
+++ b/api/src/main/java/io/mifos/template/api/v1/events/EventConstants.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.mifos.template.api.v1;
+package io.mifos.template.api.v1.events;
 
 @SuppressWarnings("unused")
 public interface EventConstants {
diff --git a/component-test/src/main/java/io/mifos/template/TestSample.java b/component-test/src/main/java/io/mifos/template/TestSample.java
index 9e90129..924512b 100644
--- a/component-test/src/main/java/io/mifos/template/TestSample.java
+++ b/component-test/src/main/java/io/mifos/template/TestSample.java
@@ -20,7 +20,7 @@ import io.mifos.core.api.context.AutoUserContext;
 import io.mifos.core.test.fixture.TenantDataStoreContextTestRule;
 import io.mifos.core.test.listener.EnableEventRecording;
 import io.mifos.core.test.listener.EventRecorder;
-import io.mifos.template.api.v1.EventConstants;
+import io.mifos.template.api.v1.events.EventConstants;
 import io.mifos.template.api.v1.client.TemplateManager;
 import io.mifos.template.api.v1.domain.Sample;
 import io.mifos.template.service.TemplateConfiguration;
diff --git a/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java b/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
index 82408bb..52be53b 100644
--- a/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
+++ b/component-test/src/main/java/io/mifos/template/listener/MigrationEventListener.java
@@ -17,7 +17,7 @@ package io.mifos.template.listener;
 
 import io.mifos.core.lang.config.TenantHeaderFilter;
 import io.mifos.core.test.listener.EventRecorder;
-import io.mifos.template.api.v1.EventConstants;
+import io.mifos.template.api.v1.events.EventConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jms.annotation.JmsListener;
 import org.springframework.messaging.handler.annotation.Header;
diff --git a/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java b/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java
index 2e3c2cb..b54a819 100644
--- a/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java
+++ b/component-test/src/main/java/io/mifos/template/listener/SampleEventListener.java
@@ -17,7 +17,7 @@ package io.mifos.template.listener;
 
 import io.mifos.core.lang.config.TenantHeaderFilter;
 import io.mifos.core.test.listener.EventRecorder;
-import io.mifos.template.api.v1.EventConstants;
+import io.mifos.template.api.v1.events.EventConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jms.annotation.JmsListener;
 import org.springframework.messaging.handler.annotation.Header;
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
index e4e3de1..083513c 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
@@ -17,9 +17,10 @@ package io.mifos.template.service.internal.command.handler;
 
 import io.mifos.core.command.annotation.Aggregate;
 import io.mifos.core.command.annotation.CommandHandler;
+import io.mifos.core.command.annotation.CommandLogLevel;
 import io.mifos.core.command.annotation.EventEmitter;
 import io.mifos.core.mariadb.domain.FlywayFactoryBean;
-import io.mifos.template.api.v1.EventConstants;
+import io.mifos.template.api.v1.events.EventConstants;
 import io.mifos.template.service.ServiceConstants;
 import io.mifos.template.service.internal.command.InitializeServiceCommand;
 import org.slf4j.Logger;
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
index 4de453a..b2e8d5d 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/handler/SampleAggregate.java
@@ -18,7 +18,7 @@ package io.mifos.template.service.internal.command.handler;
 import io.mifos.core.command.annotation.Aggregate;
 import io.mifos.core.command.annotation.CommandHandler;
 import io.mifos.core.command.annotation.EventEmitter;
-import io.mifos.template.api.v1.EventConstants;
+import io.mifos.template.api.v1.events.EventConstants;
 import io.mifos.template.service.internal.command.SampleCommand;
 import io.mifos.template.service.internal.repository.SampleJpaEntity;
 import io.mifos.template.service.internal.repository.SampleJpaEntityRepository;


[fineract-cn-payroll] 03/50: Adding example for test

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 8a38bb19f1dad2156cb095821852f29a7b1a3153
Author: myrle-krantz <mk...@mifos.org>
AuthorDate: Tue Apr 4 17:11:41 2017 +0200

    Adding example for test
---
 api/build.gradle                                   |  4 ++
 .../mifos/template/api/v1/domain/SampleTest.java   | 55 ++++++++++++++++++++++
 2 files changed, 59 insertions(+)

diff --git a/api/build.gradle b/api/build.gradle
index c5b6745..17c6648 100644
--- a/api/build.gradle
+++ b/api/build.gradle
@@ -21,6 +21,10 @@ dependencies {
             [group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator],
             [group: 'org.hibernate', name: 'hibernate-validator-annotation-processor', version: versions.validator]
     )
+
+    testCompile(
+            [group: 'io.mifos.core', name: 'test', version: versions.frameworktest],
+    )
 }
 
 publishing {
diff --git a/api/src/test/java/io/mifos/template/api/v1/domain/SampleTest.java b/api/src/test/java/io/mifos/template/api/v1/domain/SampleTest.java
new file mode 100644
index 0000000..acf33cb
--- /dev/null
+++ b/api/src/test/java/io/mifos/template/api/v1/domain/SampleTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.template.api.v1.domain;
+
+import io.mifos.core.test.domain.ValidationTest;
+import io.mifos.core.test.domain.ValidationTestCase;
+import org.apache.commons.lang.RandomStringUtils;
+import org.junit.runners.Parameterized;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class SampleTest extends ValidationTest<Sample> {
+
+  public SampleTest(ValidationTestCase<Sample> testCase) {
+    super(testCase);
+  }
+
+  @Override
+  protected Sample createValidTestSubject() {
+    return Sample.create("xxxx", "yyy");
+  }
+
+  @Parameterized.Parameters
+  public static Collection testCases() {
+    final Collection<ValidationTestCase> ret = new ArrayList<>();
+    ret.add(new ValidationTestCase<Sample>("basicCase")
+            .adjustment(x -> {})
+            .valid(true));
+    ret.add(new ValidationTestCase<Sample>("nullIdentifier")
+            .adjustment(x -> x.setIdentifier(null))
+            .valid(false));
+    ret.add(new ValidationTestCase<Sample>("tooShortIdentifier")
+            .adjustment(x -> x.setIdentifier("z"))
+            .valid(false));
+    ret.add(new ValidationTestCase<Sample>("tooLongPayload")
+            .adjustment(x -> x.setPayload(RandomStringUtils.randomAlphanumeric(513)))
+            .valid(false));
+    return ret;
+  }
+
+}
\ No newline at end of file


[fineract-cn-payroll] 14/50: Merge pull request #5 from myrle-krantz/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 08f84198fe12b8b7547ef6c104a3be23558278be
Merge: 7232d32 f35c15c
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Wed Jul 12 23:42:22 2017 +0200

    Merge pull request #5 from myrle-krantz/develop
    
    removing duplicate resources from build artifacts.

 shared.gradle | 1 +
 1 file changed, 1 insertion(+)


[fineract-cn-payroll] 32/50: Merge pull request #2 from Izakey/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 63d995f6b7abef132bacdc50de4f3a67cda300b0
Merge: ae11bb9 173d315
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Fri Mar 16 11:55:10 2018 +0100

    Merge pull request #2 from Izakey/develop
    
    Updated copyright information in payroll

 HEADER                                             | 25 +++++++++++--------
 NOTICE.txt                                         |  5 ++++
 README.md                                          |  2 +-
 .../io/mifos/payroll/api/v1/EventConstants.java    | 25 +++++++++++--------
 .../mifos/payroll/api/v1/PermittableGroupIds.java  | 25 +++++++++++--------
 .../api/v1/client/CustomerNotFoundException.java   | 25 +++++++++++--------
 .../PayrollConfigurationNotFoundException.java     | 25 +++++++++++--------
 .../PayrollDistributionValidationException.java    | 25 +++++++++++--------
 .../payroll/api/v1/client/PayrollManager.java      | 25 +++++++++++--------
 .../client/PayrollPaymentValidationException.java  | 25 +++++++++++--------
 .../payroll/api/v1/domain/PayrollAllocation.java   | 25 +++++++++++--------
 .../api/v1/domain/PayrollCollectionHistory.java    | 25 +++++++++++--------
 .../api/v1/domain/PayrollCollectionSheet.java      | 25 +++++++++++--------
 .../api/v1/domain/PayrollConfiguration.java        | 25 +++++++++++--------
 .../payroll/api/v1/domain/PayrollPayment.java      | 25 +++++++++++--------
 .../payroll/api/v1/domain/PayrollPaymentPage.java  | 25 +++++++++++--------
 .../java/io/mifos/payroll/AbstractPayrollTest.java | 25 +++++++++++--------
 .../io/mifos/payroll/SuiteTestEnvironment.java     | 25 +++++++++++--------
 .../io/mifos/payroll/TestPayrollConfiguration.java | 25 +++++++++++--------
 .../io/mifos/payroll/TestPayrollDistribution.java  | 25 +++++++++++--------
 .../src/main/java/io/mifos/payroll/TestSuite.java  | 25 +++++++++++--------
 .../payroll/domain/DomainObjectGenerator.java      | 25 +++++++++++--------
 .../payroll/listener/MigrationEventListener.java   | 25 +++++++++++--------
 .../listener/PayrollConfigurationListener.java     | 25 +++++++++++--------
 .../listener/PayrollDistributionListener.java      | 25 +++++++++++--------
 component-test/src/main/resources/logback-test.xml | 25 +++++++++++--------
 .../mifos/payroll/service/PayrollApplication.java  | 25 +++++++++++--------
 .../service/PayrollServiceConfiguration.java       | 25 +++++++++++--------
 .../io/mifos/payroll/service/ServiceConstants.java | 25 +++++++++++--------
 .../internal/command/DistributePayrollCommand.java | 25 +++++++++++--------
 .../internal/command/MigrateServiceCommand.java    | 25 +++++++++++--------
 .../command/PutPayrollConfigurationCommand.java    | 25 +++++++++++--------
 .../command/handler/MigrationAggregate.java        | 25 +++++++++++--------
 .../handler/PayrollConfigurationAggregate.java     | 25 +++++++++++--------
 .../handler/PayrollDistributionAggregate.java      | 25 +++++++++++--------
 .../internal/mapper/PayrollAllocationMapper.java   | 25 +++++++++++--------
 .../mapper/PayrollConfigurationMapper.java         | 25 +++++++++++--------
 .../internal/mapper/PayrollPaymentMapper.java      | 25 +++++++++++--------
 .../repository/PayrollAllocationEntity.java        | 25 +++++++++++--------
 .../repository/PayrollAllocationRepository.java    | 25 +++++++++++--------
 .../repository/PayrollCollectionEntity.java        | 25 +++++++++++--------
 .../repository/PayrollCollectionRepository.java    | 25 +++++++++++--------
 .../repository/PayrollConfigurationEntity.java     | 25 +++++++++++--------
 .../repository/PayrollConfigurationRepository.java | 25 +++++++++++--------
 .../internal/repository/PayrollPaymentEntity.java  | 25 +++++++++++--------
 .../repository/PayrollPaymentRepository.java       | 25 +++++++++++--------
 .../service/PayrollConfigurationService.java       | 25 +++++++++++--------
 .../service/PayrollDistributionService.java        | 25 +++++++++++--------
 .../service/adaptor/AccountingAdaptor.java         | 25 +++++++++++--------
 .../internal/service/adaptor/CustomerAdaptor.java  | 25 +++++++++++--------
 .../service/rest/MigrationRestController.java      | 25 +++++++++++--------
 .../rest/PayrollConfigurationRestController.java   | 25 +++++++++++--------
 .../rest/PayrollDistributionRestController.java    | 25 +++++++++++--------
 .../payroll/service/rest/util/PageableBuilder.java | 25 +++++++++++--------
 service/src/main/resources/application.yml         | 25 +++++++++++--------
 service/src/main/resources/bootstrap.yml           | 25 +++++++++++--------
 .../db/migrations/mariadb/V1__initial_setup.sql    | 25 +++++++++++--------
 .../V2__add_distribution_processing_behavior.sql   | 25 +++++++++++--------
 service/src/main/resources/logback.xml             | 29 ++++++++++++----------
 shared.gradle                                      |  2 --
 60 files changed, 806 insertions(+), 632 deletions(-)


[fineract-cn-payroll] 19/50: Merge pull request #2 from markusgeiss/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit ce161c6b29e713612eba3a2e76bf6b39b8f956af
Merge: 5955e08 d042127
Author: Markus Geiss <ma...@kuelap.io>
AuthorDate: Wed Sep 20 10:47:48 2017 +0200

    Merge pull request #2 from markusgeiss/develop
    
    added validation for accounts and customers

 .../api/v1/domain/PayrollCollectionSheet.java      |  4 +--
 .../payroll/api/v1/domain/PayrollPayment.java      | 18 +++++++++++++
 .../io/mifos/payroll/TestPayrollDistribution.java  | 12 +++++++++
 .../handler/PayrollConfigurationAggregate.java     |  1 -
 .../handler/PayrollDistributionAggregate.java      | 25 ++++++++++-------
 .../internal/mapper/PayrollPaymentMapper.java      |  2 ++
 .../internal/repository/PayrollPaymentEntity.java  | 20 ++++++++++++++
 .../service/adaptor/AccountingAdaptor.java         | 31 ++++++++++++++++------
 .../internal/service/adaptor/CustomerAdaptor.java  |  7 +++--
 .../rest/PayrollConfigurationRestController.java   | 26 +++++++++++-------
 .../rest/PayrollDistributionRestController.java    | 13 +++------
 .../V2__add_distribution_processing_behavior.sql   | 18 +++++++++++++
 12 files changed, 137 insertions(+), 40 deletions(-)


[fineract-cn-payroll] 46/50: Merge pull request #8 from aasaru/artifactory

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 36edf1d9b3b9e88772cc796bf5e1a371f8708b90
Merge: 9f53efc 70f439b
Author: Awasum Yannick <aw...@apache.org>
AuthorDate: Tue Apr 30 09:22:13 2019 +0100

    Merge pull request #8 from aasaru/artifactory
    
    FINCN-148 build with travis-ci.com and upload artifacts to Artifactory

 .travis.yml                 | 30 +++++++++++++++++++
 README.md                   |  2 +-
 api/build.gradle            |  3 +-
 build.gradle                |  8 +++++
 component-test/build.gradle |  4 ++-
 service/build.gradle        |  5 ++--
 shared.gradle               | 17 +++++++++++
 travis.sh                   | 71 +++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 135 insertions(+), 5 deletions(-)


[fineract-cn-payroll] 39/50: Merge pull request #5 from Izakey/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit a050e1dd7a0eab242c63a8c9c48081a2703e2ac2
Merge: 131263e 1316234
Author: Isaac Kamga <u2...@gmail.com>
AuthorDate: Mon Apr 23 19:29:10 2018 +0100

    Merge pull request #5 from Izakey/develop
    
    Document the payroll API

 service/build.gradle                               |  20 +
 service/src/doc/asciidoc/api-docs.adoc             |  31 ++
 .../curl-request.adoc                              |   4 +
 .../http-request.adoc                              |  10 +
 .../http-response.adoc                             |   5 +
 .../httpie-request.adoc                            |   4 +
 .../curl-request.adoc                              |   4 +
 .../http-request.adoc                              |   8 +
 .../http-response.adoc                             |   5 +
 .../httpie-request.adoc                            |   4 +
 service/src/doc/html5/html5/api-docs.html          | 508 +++++++++++++++++++++
 .../fineract/cn/payroll/AbstractPayrollTest.java   | 114 +++++
 .../fineract/cn/payroll/SuiteTestEnvironment.java  |  48 ++
 .../cn/payroll/TestPayrollConfiguration.java       | 172 +++++++
 .../cn/payroll/TestPayrollDistribution.java        | 198 ++++++++
 .../org/apache/fineract/cn/payroll/TestSuite.java  |  30 ++
 .../cn/payroll/domain/DomainObjectGenerator.java   |  49 ++
 .../payroll/listener/MigrationEventListener.java   |  50 ++
 .../listener/PayrollConfigurationListener.java     |  56 +++
 .../listener/PayrollDistributionListener.java      |  56 +++
 20 files changed, 1376 insertions(+)


[fineract-cn-payroll] 36/50: Change package names from mifos to apache fineract.

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 52de03e06164f07e713890f94ca359725a406ec5
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Apr 16 14:05:36 2018 +0200

    Change package names from mifos to apache fineract.
---
 .../cn}/payroll/api/v1/EventConstants.java         |  2 +-
 .../cn}/payroll/api/v1/PermittableGroupIds.java    |  2 +-
 .../api/v1/client/CustomerNotFoundException.java   |  2 +-
 .../PayrollConfigurationNotFoundException.java     |  2 +-
 .../PayrollDistributionValidationException.java    |  2 +-
 .../cn}/payroll/api/v1/client/PayrollManager.java  | 10 ++++-----
 .../client/PayrollPaymentValidationException.java  |  2 +-
 .../payroll/api/v1/domain/PayrollAllocation.java   |  2 +-
 .../api/v1/domain/PayrollCollectionHistory.java    |  2 +-
 .../api/v1/domain/PayrollCollectionSheet.java      |  2 +-
 .../api/v1/domain/PayrollConfiguration.java        |  2 +-
 .../cn}/payroll/api/v1/domain/PayrollPayment.java  |  2 +-
 .../payroll/api/v1/domain/PayrollPaymentPage.java  |  2 +-
 .../fineract/cn}/payroll/AbstractPayrollTest.java  | 12 +++++-----
 .../fineract/cn}/payroll/SuiteTestEnvironment.java |  2 +-
 .../cn}/payroll/TestPayrollConfiguration.java      | 14 ++++++------
 .../cn}/payroll/TestPayrollDistribution.java       | 26 +++++++++++-----------
 .../apache/fineract/cn}/payroll/TestSuite.java     |  2 +-
 .../cn}/payroll/domain/DomainObjectGenerator.java  |  6 ++---
 .../payroll/listener/MigrationEventListener.java   |  4 ++--
 .../listener/PayrollConfigurationListener.java     |  6 ++---
 .../listener/PayrollDistributionListener.java      |  6 ++---
 .../cn}/payroll/service/PayrollApplication.java    |  2 +-
 .../service/PayrollServiceConfiguration.java       | 12 +++++-----
 .../cn}/payroll/service/ServiceConstants.java      |  2 +-
 .../internal/command/DistributePayrollCommand.java |  4 ++--
 .../internal/command/MigrateServiceCommand.java    |  2 +-
 .../command/PutPayrollConfigurationCommand.java    |  4 ++--
 .../command/handler/MigrationAggregate.java        |  4 ++--
 .../handler/PayrollConfigurationAggregate.java     | 22 +++++++++---------
 .../handler/PayrollDistributionAggregate.java      | 22 +++++++++---------
 .../internal/mapper/PayrollAllocationMapper.java   |  6 ++---
 .../mapper/PayrollConfigurationMapper.java         |  6 ++---
 .../internal/mapper/PayrollPaymentMapper.java      |  6 ++---
 .../repository/PayrollAllocationEntity.java        |  2 +-
 .../repository/PayrollAllocationRepository.java    |  2 +-
 .../repository/PayrollCollectionEntity.java        |  2 +-
 .../repository/PayrollCollectionRepository.java    |  2 +-
 .../repository/PayrollConfigurationEntity.java     |  2 +-
 .../repository/PayrollConfigurationRepository.java |  2 +-
 .../internal/repository/PayrollPaymentEntity.java  |  2 +-
 .../repository/PayrollPaymentRepository.java       |  2 +-
 .../service/PayrollConfigurationService.java       | 20 ++++++++---------
 .../service/PayrollDistributionService.java        | 20 ++++++++---------
 .../service/adaptor/AccountingAdaptor.java         | 10 ++++-----
 .../internal/service/adaptor/CustomerAdaptor.java  |  4 ++--
 .../service/rest/MigrationRestController.java      |  4 ++--
 .../rest/PayrollConfigurationRestController.java   | 14 ++++++------
 .../rest/PayrollDistributionRestController.java    | 24 ++++++++++----------
 .../payroll/service/rest/util/PageableBuilder.java |  2 +-
 50 files changed, 159 insertions(+), 159 deletions(-)

diff --git a/api/src/main/java/io/mifos/payroll/api/v1/EventConstants.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/EventConstants.java
similarity index 97%
rename from api/src/main/java/io/mifos/payroll/api/v1/EventConstants.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/EventConstants.java
index 17cd448..bbf0ac2 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/EventConstants.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/EventConstants.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1;
+package org.apache.fineract.cn.payroll.api.v1;
 
 @SuppressWarnings("unused")
 public interface EventConstants {
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/PermittableGroupIds.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/PermittableGroupIds.java
similarity index 95%
rename from api/src/main/java/io/mifos/payroll/api/v1/PermittableGroupIds.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/PermittableGroupIds.java
index d6dbe1b..06528c3 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/PermittableGroupIds.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/PermittableGroupIds.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1;
+package org.apache.fineract.cn.payroll.api.v1;
 
 @SuppressWarnings("unused")
 public interface PermittableGroupIds {
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/CustomerNotFoundException.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/CustomerNotFoundException.java
similarity index 94%
rename from api/src/main/java/io/mifos/payroll/api/v1/client/CustomerNotFoundException.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/CustomerNotFoundException.java
index 2168504..a59ce73 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/CustomerNotFoundException.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/CustomerNotFoundException.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.client;
+package org.apache.fineract.cn.payroll.api.v1.client;
 
 public class CustomerNotFoundException extends RuntimeException {
 }
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollConfigurationNotFoundException.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
similarity index 94%
rename from api/src/main/java/io/mifos/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
index 44dff96..94c05c6 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollConfigurationNotFoundException.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.client;
+package org.apache.fineract.cn.payroll.api.v1.client;
 
 public class PayrollConfigurationNotFoundException extends RuntimeException {
 }
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollDistributionValidationException.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollDistributionValidationException.java
similarity index 94%
rename from api/src/main/java/io/mifos/payroll/api/v1/client/PayrollDistributionValidationException.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollDistributionValidationException.java
index e4d73f8..a604090 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollDistributionValidationException.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollDistributionValidationException.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.client;
+package org.apache.fineract.cn.payroll.api.v1.client;
 
 public class PayrollDistributionValidationException extends RuntimeException {
 }
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollManager.java
similarity index 92%
rename from api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollManager.java
index bbc410e..bae7952 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollManager.java
@@ -16,12 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.client;
+package org.apache.fineract.cn.payroll.api.v1.client;
 
-import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
-import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
-import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollCollectionHistory;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollCollectionSheet;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollPaymentPage;
 import java.util.List;
 import javax.validation.Valid;
 import org.apache.fineract.cn.api.annotation.ThrowsException;
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollPaymentValidationException.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollPaymentValidationException.java
similarity index 94%
rename from api/src/main/java/io/mifos/payroll/api/v1/client/PayrollPaymentValidationException.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollPaymentValidationException.java
index dc016cb..fd249e2 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollPaymentValidationException.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/client/PayrollPaymentValidationException.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.client;
+package org.apache.fineract.cn.payroll.api.v1.client;
 
 public class PayrollPaymentValidationException extends RuntimeException {
 }
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollAllocation.java
similarity index 97%
rename from api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollAllocation.java
index 9bc8e45..ee4fb4a 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollAllocation.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollAllocation.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.domain;
+package org.apache.fineract.cn.payroll.api.v1.domain;
 
 import java.math.BigDecimal;
 import javax.validation.constraints.DecimalMax;
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollCollectionHistory.java
similarity index 97%
rename from api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollCollectionHistory.java
index 876f0c4..3180fd8 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionHistory.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollCollectionHistory.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.domain;
+package org.apache.fineract.cn.payroll.api.v1.domain;
 
 import javax.validation.constraints.NotNull;
 import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollCollectionSheet.java
similarity index 96%
rename from api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollCollectionSheet.java
index 5f493a1..be5da6e 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollCollectionSheet.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.domain;
+package org.apache.fineract.cn.payroll.api.v1.domain;
 
 import java.util.List;
 import javax.validation.Valid;
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollConfiguration.java
similarity index 97%
rename from api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollConfiguration.java
index 35757ee..60aa71d 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollConfiguration.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.domain;
+package org.apache.fineract.cn.payroll.api.v1.domain;
 
 import java.util.ArrayList;
 import java.util.List;
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollPayment.java
similarity index 97%
rename from api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollPayment.java
index cc38f75..b40ad83 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollPayment.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.domain;
+package org.apache.fineract.cn.payroll.api.v1.domain;
 
 import java.math.BigDecimal;
 import javax.validation.constraints.DecimalMax;
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPaymentPage.java b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollPaymentPage.java
similarity index 97%
rename from api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPaymentPage.java
rename to api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollPaymentPage.java
index 33aeb97..e6c587c 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPaymentPage.java
+++ b/api/src/main/java/org/apache/fineract/cn/payroll/api/v1/domain/PayrollPaymentPage.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.api.v1.domain;
+package org.apache.fineract.cn.payroll.api.v1.domain;
 
 import java.util.ArrayList;
 import java.util.List;
diff --git a/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/AbstractPayrollTest.java
similarity index 91%
rename from component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java
rename to component-test/src/main/java/org/apache/fineract/cn/payroll/AbstractPayrollTest.java
index be6f8ce..2030b48 100644
--- a/component-test/src/main/java/io/mifos/payroll/AbstractPayrollTest.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/AbstractPayrollTest.java
@@ -16,12 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll;
+package org.apache.fineract.cn.payroll;
 
 
-import io.mifos.payroll.api.v1.EventConstants;
-import io.mifos.payroll.api.v1.client.PayrollManager;
-import io.mifos.payroll.service.PayrollServiceConfiguration;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.api.v1.client.PayrollManager;
+import org.apache.fineract.cn.payroll.service.PayrollServiceConfiguration;
 import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
 import org.apache.fineract.cn.api.context.AutoUserContext;
 import org.apache.fineract.cn.test.fixture.TenantDataStoreContextTestRule;
@@ -53,12 +53,12 @@ public class AbstractPayrollTest extends SuiteTestEnvironment {
   @Configuration
   @EnableEventRecording
   @EnableFeignClients(basePackages = {
-      "io.mifos.payroll.api.v1.client"
+      "org.apache.fineract.cn.payroll.api.v1.client"
   })
   @RibbonClient(name = SuiteTestEnvironment.APP_NAME)
   @ComponentScan(
       basePackages = {
-          "io.mifos.payroll.listener"
+          "org.apache.fineract.cn.payroll.listener"
       }
   )
   @Import({
diff --git a/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/SuiteTestEnvironment.java
similarity index 98%
rename from component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
rename to component-test/src/main/java/org/apache/fineract/cn/payroll/SuiteTestEnvironment.java
index 4eb6812..ebe1880 100644
--- a/component-test/src/main/java/io/mifos/payroll/SuiteTestEnvironment.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/SuiteTestEnvironment.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll;
+package org.apache.fineract.cn.payroll;
 
 import org.apache.fineract.cn.test.env.TestEnvironment;
 import org.apache.fineract.cn.test.fixture.cassandra.CassandraInitializer;
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/TestPayrollConfiguration.java
similarity index 91%
rename from component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
rename to component-test/src/main/java/org/apache/fineract/cn/payroll/TestPayrollConfiguration.java
index 82e49a2..b79b6a3 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/TestPayrollConfiguration.java
@@ -16,15 +16,15 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll;
+package org.apache.fineract.cn.payroll;
 
 import com.google.common.collect.Lists;
-import io.mifos.payroll.api.v1.EventConstants;
-import io.mifos.payroll.api.v1.domain.PayrollAllocation;
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
-import io.mifos.payroll.domain.DomainObjectGenerator;
-import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
-import io.mifos.payroll.service.internal.service.adaptor.CustomerAdaptor;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollAllocation;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.domain.DomainObjectGenerator;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.CustomerAdaptor;
 import java.math.BigDecimal;
 import java.util.Optional;
 import org.apache.commons.lang3.RandomStringUtils;
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/TestPayrollDistribution.java
similarity index 90%
rename from component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
rename to component-test/src/main/java/org/apache/fineract/cn/payroll/TestPayrollDistribution.java
index 0d1e358..2b759eb 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/TestPayrollDistribution.java
@@ -16,21 +16,21 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll;
+package org.apache.fineract.cn.payroll;
 
 import com.google.common.collect.Lists;
-import io.mifos.payroll.api.v1.EventConstants;
-import io.mifos.payroll.api.v1.client.PayrollPaymentValidationException;
-import io.mifos.payroll.api.v1.domain.PayrollAllocation;
-import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
-import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
-import io.mifos.payroll.api.v1.domain.PayrollPayment;
-import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
-import io.mifos.payroll.domain.DomainObjectGenerator;
-import io.mifos.payroll.service.internal.repository.PayrollCollectionEntity;
-import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
-import io.mifos.payroll.service.internal.service.adaptor.CustomerAdaptor;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.api.v1.client.PayrollPaymentValidationException;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollAllocation;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollCollectionHistory;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollCollectionSheet;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollPayment;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollPaymentPage;
+import org.apache.fineract.cn.payroll.domain.DomainObjectGenerator;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollCollectionEntity;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.CustomerAdaptor;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Optional;
diff --git a/component-test/src/main/java/io/mifos/payroll/TestSuite.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/TestSuite.java
similarity index 96%
rename from component-test/src/main/java/io/mifos/payroll/TestSuite.java
rename to component-test/src/main/java/org/apache/fineract/cn/payroll/TestSuite.java
index 18994aa..5fe0817 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestSuite.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/TestSuite.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll;
+package org.apache.fineract.cn.payroll;
 
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
diff --git a/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/domain/DomainObjectGenerator.java
similarity index 90%
rename from component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java
rename to component-test/src/main/java/org/apache/fineract/cn/payroll/domain/DomainObjectGenerator.java
index c97cc29..bfa6f7e 100644
--- a/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/domain/DomainObjectGenerator.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.domain;
+package org.apache.fineract.cn.payroll.domain;
 
-import io.mifos.payroll.api.v1.domain.PayrollAllocation;
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollAllocation;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
 import org.apache.commons.lang3.RandomStringUtils;
 
 import java.math.BigDecimal;
diff --git a/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/listener/MigrationEventListener.java
similarity index 94%
rename from component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
rename to component-test/src/main/java/org/apache/fineract/cn/payroll/listener/MigrationEventListener.java
index 2a33ca6..2cb7a17 100644
--- a/component-test/src/main/java/io/mifos/payroll/listener/MigrationEventListener.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/listener/MigrationEventListener.java
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.listener;
+package org.apache.fineract.cn.payroll.listener;
 
-import io.mifos.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
 import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
 import org.apache.fineract.cn.test.listener.EventRecorder;
 import org.springframework.beans.factory.annotation.Autowired;
diff --git a/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/listener/PayrollConfigurationListener.java
similarity index 92%
rename from component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
rename to component-test/src/main/java/org/apache/fineract/cn/payroll/listener/PayrollConfigurationListener.java
index 14894e1..dfb5984 100644
--- a/component-test/src/main/java/io/mifos/payroll/listener/PayrollConfigurationListener.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/listener/PayrollConfigurationListener.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.listener;
+package org.apache.fineract.cn.payroll.listener;
 
-import io.mifos.payroll.api.v1.EventConstants;
-import io.mifos.payroll.service.ServiceConstants;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
 import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
 import org.apache.fineract.cn.test.listener.EventRecorder;
 import org.slf4j.Logger;
diff --git a/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/listener/PayrollDistributionListener.java
similarity index 92%
rename from component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
rename to component-test/src/main/java/org/apache/fineract/cn/payroll/listener/PayrollDistributionListener.java
index b99f1fd..2f89973 100644
--- a/component-test/src/main/java/io/mifos/payroll/listener/PayrollDistributionListener.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/listener/PayrollDistributionListener.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.listener;
+package org.apache.fineract.cn.payroll.listener;
 
-import io.mifos.payroll.api.v1.EventConstants;
-import io.mifos.payroll.service.ServiceConstants;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
 import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
 import org.apache.fineract.cn.test.listener.EventRecorder;
 import org.slf4j.Logger;
diff --git a/service/src/main/java/io/mifos/payroll/service/PayrollApplication.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/PayrollApplication.java
similarity index 95%
rename from service/src/main/java/io/mifos/payroll/service/PayrollApplication.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/PayrollApplication.java
index 6caf110..01635dc 100644
--- a/service/src/main/java/io/mifos/payroll/service/PayrollApplication.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/PayrollApplication.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service;
+package org.apache.fineract.cn.payroll.service;
 
 import org.springframework.boot.SpringApplication;
 
diff --git a/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/PayrollServiceConfiguration.java
similarity index 88%
rename from service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/PayrollServiceConfiguration.java
index 3e94283..ab36995 100644
--- a/service/src/main/java/io/mifos/payroll/service/PayrollServiceConfiguration.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/PayrollServiceConfiguration.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service;
+package org.apache.fineract.cn.payroll.service;
 
 import org.apache.fineract.cn.accounting.api.v1.client.LedgerManager;
 import org.apache.fineract.cn.anubis.config.EnableAnubis;
@@ -55,13 +55,13 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
     CustomerManager.class
 })
 @ComponentScan({
-    "io.mifos.payroll.service.rest",
-    "io.mifos.payroll.service.internal.service",
-    "io.mifos.payroll.service.internal.repository",
-    "io.mifos.payroll.service.internal.command.handler"
+    "org.apache.fineract.cn.payroll.service.rest",
+    "org.apache.fineract.cn.payroll.service.internal.service",
+    "org.apache.fineract.cn.payroll.service.internal.repository",
+    "org.apache.fineract.cn.payroll.service.internal.command.handler"
 })
 @EnableJpaRepositories({
-    "io.mifos.payroll.service.internal.repository"
+    "org.apache.fineract.cn.payroll.service.internal.repository"
 })
 public class PayrollServiceConfiguration extends WebMvcConfigurerAdapter {
 
diff --git a/service/src/main/java/io/mifos/payroll/service/ServiceConstants.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/ServiceConstants.java
similarity index 94%
rename from service/src/main/java/io/mifos/payroll/service/ServiceConstants.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/ServiceConstants.java
index f379023..e6f7664 100644
--- a/service/src/main/java/io/mifos/payroll/service/ServiceConstants.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/ServiceConstants.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service;
+package org.apache.fineract.cn.payroll.service;
 
 public interface ServiceConstants {
   String LOGGER_NAME = "payroll-logger";
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/DistributePayrollCommand.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/DistributePayrollCommand.java
similarity index 89%
rename from service/src/main/java/io/mifos/payroll/service/internal/command/DistributePayrollCommand.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/DistributePayrollCommand.java
index 44dec7e..e6a7583 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/DistributePayrollCommand.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/DistributePayrollCommand.java
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.command;
+package org.apache.fineract.cn.payroll.service.internal.command;
 
-import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollCollectionSheet;
 
 public class DistributePayrollCommand {
   private final PayrollCollectionSheet payrollCollectionSheet;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/MigrateServiceCommand.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/MigrateServiceCommand.java
similarity index 93%
rename from service/src/main/java/io/mifos/payroll/service/internal/command/MigrateServiceCommand.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/MigrateServiceCommand.java
index 7053c9a..ba3b948 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/MigrateServiceCommand.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/MigrateServiceCommand.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.command;
+package org.apache.fineract.cn.payroll.service.internal.command;
 
 public class MigrateServiceCommand {
   public MigrateServiceCommand() {
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/PutPayrollConfigurationCommand.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/PutPayrollConfigurationCommand.java
similarity index 91%
rename from service/src/main/java/io/mifos/payroll/service/internal/command/PutPayrollConfigurationCommand.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/PutPayrollConfigurationCommand.java
index b1f6ab7..3eddc0c 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/PutPayrollConfigurationCommand.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/PutPayrollConfigurationCommand.java
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.command;
+package org.apache.fineract.cn.payroll.service.internal.command;
 
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
 
 public class PutPayrollConfigurationCommand {
   private final String customerIdentifier;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/handler/MigrationAggregate.java
similarity index 93%
rename from service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/handler/MigrationAggregate.java
index 7e836fb..ba185a4 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/MigrationAggregate.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/handler/MigrationAggregate.java
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.command.handler;
+package org.apache.fineract.cn.payroll.service.internal.command.handler;
 
-import io.mifos.payroll.service.internal.command.MigrateServiceCommand;
+import org.apache.fineract.cn.payroll.service.internal.command.MigrateServiceCommand;
 import javax.sql.DataSource;
 import org.apache.fineract.cn.accounting.api.v1.EventConstants;
 import org.apache.fineract.cn.command.annotation.Aggregate;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
similarity index 83%
rename from service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
index b1ca617..2d016ae 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
@@ -16,18 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.command.handler;
+package org.apache.fineract.cn.payroll.service.internal.command.handler;
 
-import io.mifos.payroll.api.v1.EventConstants;
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
-import io.mifos.payroll.service.ServiceConstants;
-import io.mifos.payroll.service.internal.command.PutPayrollConfigurationCommand;
-import io.mifos.payroll.service.internal.mapper.PayrollAllocationMapper;
-import io.mifos.payroll.service.internal.repository.PayrollAllocationEntity;
-import io.mifos.payroll.service.internal.repository.PayrollAllocationRepository;
-import io.mifos.payroll.service.internal.repository.PayrollConfigurationEntity;
-import io.mifos.payroll.service.internal.repository.PayrollConfigurationRepository;
-import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
+import org.apache.fineract.cn.payroll.service.internal.command.PutPayrollConfigurationCommand;
+import org.apache.fineract.cn.payroll.service.internal.mapper.PayrollAllocationMapper;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollAllocationEntity;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollAllocationRepository;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollConfigurationEntity;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollConfigurationRepository;
+import org.apache.fineract.cn.payroll.service.internal.service.PayrollConfigurationService;
 import java.time.Clock;
 import java.time.LocalDateTime;
 import java.util.Optional;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
similarity index 83%
rename from service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
index 61470b4..322afec 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
@@ -16,18 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.command.handler;
+package org.apache.fineract.cn.payroll.service.internal.command.handler;
 
-import io.mifos.payroll.api.v1.EventConstants;
-import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
-import io.mifos.payroll.service.ServiceConstants;
-import io.mifos.payroll.service.internal.command.DistributePayrollCommand;
-import io.mifos.payroll.service.internal.repository.PayrollCollectionEntity;
-import io.mifos.payroll.service.internal.repository.PayrollCollectionRepository;
-import io.mifos.payroll.service.internal.repository.PayrollPaymentEntity;
-import io.mifos.payroll.service.internal.repository.PayrollPaymentRepository;
-import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
-import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.apache.fineract.cn.payroll.api.v1.EventConstants;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollCollectionSheet;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
+import org.apache.fineract.cn.payroll.service.internal.command.DistributePayrollCommand;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollCollectionEntity;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollCollectionRepository;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollPaymentEntity;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollPaymentRepository;
+import org.apache.fineract.cn.payroll.service.internal.service.PayrollConfigurationService;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
 import java.time.Clock;
 import java.time.LocalDateTime;
 import java.util.Optional;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollAllocationMapper.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/mapper/PayrollAllocationMapper.java
similarity index 88%
rename from service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollAllocationMapper.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/mapper/PayrollAllocationMapper.java
index 5c9e752..2b948f1 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollAllocationMapper.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/mapper/PayrollAllocationMapper.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.mapper;
+package org.apache.fineract.cn.payroll.service.internal.mapper;
 
-import io.mifos.payroll.api.v1.domain.PayrollAllocation;
-import io.mifos.payroll.service.internal.repository.PayrollAllocationEntity;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollAllocation;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollAllocationEntity;
 
 public class PayrollAllocationMapper {
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/mapper/PayrollConfigurationMapper.java
similarity index 88%
rename from service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/mapper/PayrollConfigurationMapper.java
index 4429ff5..450c48b 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/mapper/PayrollConfigurationMapper.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.mapper;
+package org.apache.fineract.cn.payroll.service.internal.mapper;
 
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
-import io.mifos.payroll.service.internal.repository.PayrollConfigurationEntity;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollConfigurationEntity;
 import org.apache.fineract.cn.lang.DateConverter;
 
 public class PayrollConfigurationMapper {
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/mapper/PayrollPaymentMapper.java
similarity index 86%
rename from service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/mapper/PayrollPaymentMapper.java
index b52ebec..9fa087d 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/mapper/PayrollPaymentMapper.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.mapper;
+package org.apache.fineract.cn.payroll.service.internal.mapper;
 
-import io.mifos.payroll.api.v1.domain.PayrollPayment;
-import io.mifos.payroll.service.internal.repository.PayrollPaymentEntity;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollPayment;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollPaymentEntity;
 
 public class PayrollPaymentMapper {
 
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationEntity.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollAllocationEntity.java
similarity index 97%
rename from service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationEntity.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollAllocationEntity.java
index ed7e0c4..415e4cd 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationEntity.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollAllocationEntity.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.repository;
+package org.apache.fineract.cn.payroll.service.internal.repository;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationRepository.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollAllocationRepository.java
similarity index 94%
rename from service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationRepository.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollAllocationRepository.java
index 9826c10..bd2782e 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollAllocationRepository.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollAllocationRepository.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.repository;
+package org.apache.fineract.cn.payroll.service.internal.repository;
 
 
 import org.springframework.data.jpa.repository.JpaRepository;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollCollectionEntity.java
similarity index 97%
rename from service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollCollectionEntity.java
index 4c999aa..92fdad3 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionEntity.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollCollectionEntity.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.repository;
+package org.apache.fineract.cn.payroll.service.internal.repository;
 
 import java.time.LocalDateTime;
 import javax.persistence.Column;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionRepository.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollCollectionRepository.java
similarity index 94%
rename from service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionRepository.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollCollectionRepository.java
index 98ead7f..a4da0ba 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollCollectionRepository.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollCollectionRepository.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.repository;
+package org.apache.fineract.cn.payroll.service.internal.repository;
 
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollConfigurationEntity.java
similarity index 97%
rename from service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollConfigurationEntity.java
index 23ddebd..aaf99fa 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationEntity.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollConfigurationEntity.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.repository;
+package org.apache.fineract.cn.payroll.service.internal.repository;
 
 import java.time.LocalDateTime;
 import javax.persistence.Column;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationRepository.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollConfigurationRepository.java
similarity index 94%
rename from service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationRepository.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollConfigurationRepository.java
index 9d8a4b3..23d93c3 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollConfigurationRepository.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollConfigurationRepository.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.repository;
+package org.apache.fineract.cn.payroll.service.internal.repository;
 
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollPaymentEntity.java
similarity index 97%
rename from service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollPaymentEntity.java
index 36ca60c..c0620c7 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollPaymentEntity.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.repository;
+package org.apache.fineract.cn.payroll.service.internal.repository;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentRepository.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollPaymentRepository.java
similarity index 95%
rename from service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentRepository.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollPaymentRepository.java
index 60f624f..5b3fc7a 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentRepository.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/repository/PayrollPaymentRepository.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.repository;
+package org.apache.fineract.cn.payroll.service.internal.repository;
 
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/PayrollConfigurationService.java
similarity index 80%
rename from service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/PayrollConfigurationService.java
index 3385436..96c1d14 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/PayrollConfigurationService.java
@@ -16,17 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.service;
+package org.apache.fineract.cn.payroll.service.internal.service;
 
-import io.mifos.payroll.api.v1.domain.PayrollAllocation;
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
-import io.mifos.payroll.service.ServiceConstants;
-import io.mifos.payroll.service.internal.mapper.PayrollAllocationMapper;
-import io.mifos.payroll.service.internal.mapper.PayrollConfigurationMapper;
-import io.mifos.payroll.service.internal.repository.PayrollAllocationRepository;
-import io.mifos.payroll.service.internal.repository.PayrollConfigurationRepository;
-import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
-import io.mifos.payroll.service.internal.service.adaptor.CustomerAdaptor;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollAllocation;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
+import org.apache.fineract.cn.payroll.service.internal.mapper.PayrollAllocationMapper;
+import org.apache.fineract.cn.payroll.service.internal.mapper.PayrollConfigurationMapper;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollAllocationRepository;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollConfigurationRepository;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.CustomerAdaptor;
 import java.util.Comparator;
 import java.util.Optional;
 import java.util.stream.Collectors;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/PayrollDistributionService.java
similarity index 83%
rename from service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/PayrollDistributionService.java
index 4eadd63..293d48b 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollDistributionService.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/PayrollDistributionService.java
@@ -16,17 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.service;
+package org.apache.fineract.cn.payroll.service.internal.service;
 
-import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
-import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
-import io.mifos.payroll.service.ServiceConstants;
-import io.mifos.payroll.service.internal.mapper.PayrollPaymentMapper;
-import io.mifos.payroll.service.internal.repository.PayrollCollectionEntity;
-import io.mifos.payroll.service.internal.repository.PayrollCollectionRepository;
-import io.mifos.payroll.service.internal.repository.PayrollPaymentEntity;
-import io.mifos.payroll.service.internal.repository.PayrollPaymentRepository;
-import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollCollectionHistory;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollPaymentPage;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
+import org.apache.fineract.cn.payroll.service.internal.mapper.PayrollPaymentMapper;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollCollectionEntity;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollCollectionRepository;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollPaymentEntity;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollPaymentRepository;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/adaptor/AccountingAdaptor.java
similarity index 93%
rename from service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/adaptor/AccountingAdaptor.java
index 7f6fab0..d4c5c51 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/adaptor/AccountingAdaptor.java
@@ -16,13 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.service.adaptor;
+package org.apache.fineract.cn.payroll.service.internal.service.adaptor;
 
 import com.google.common.collect.Sets;
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
-import io.mifos.payroll.api.v1.domain.PayrollPayment;
-import io.mifos.payroll.service.ServiceConstants;
-import io.mifos.payroll.service.internal.repository.PayrollCollectionEntity;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollPayment;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
+import org.apache.fineract.cn.payroll.service.internal.repository.PayrollCollectionEntity;
 import java.math.BigDecimal;
 import java.math.MathContext;
 import java.math.RoundingMode;
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/adaptor/CustomerAdaptor.java
similarity index 93%
rename from service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/adaptor/CustomerAdaptor.java
index 713a495..a350e02 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/internal/service/adaptor/CustomerAdaptor.java
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.internal.service.adaptor;
+package org.apache.fineract.cn.payroll.service.internal.service.adaptor;
 
-import io.mifos.payroll.service.ServiceConstants;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
 import java.util.Optional;
 import org.apache.fineract.cn.customer.api.v1.client.CustomerManager;
 import org.apache.fineract.cn.customer.api.v1.client.CustomerNotFoundException;
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/rest/MigrationRestController.java
similarity index 93%
rename from service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/rest/MigrationRestController.java
index 997dd32..268e4f8 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/MigrationRestController.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/rest/MigrationRestController.java
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.rest;
+package org.apache.fineract.cn.payroll.service.rest;
 
-import io.mifos.payroll.service.internal.command.MigrateServiceCommand;
+import org.apache.fineract.cn.payroll.service.internal.command.MigrateServiceCommand;
 import org.apache.fineract.cn.anubis.annotation.AcceptedTokenType;
 import org.apache.fineract.cn.anubis.annotation.Permittable;
 import org.apache.fineract.cn.command.gateway.CommandGateway;
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/rest/PayrollConfigurationRestController.java
similarity index 90%
rename from service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/rest/PayrollConfigurationRestController.java
index 84782ee..32aa19b 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/rest/PayrollConfigurationRestController.java
@@ -16,14 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.rest;
+package org.apache.fineract.cn.payroll.service.rest;
 
-import io.mifos.payroll.api.v1.PermittableGroupIds;
-import io.mifos.payroll.api.v1.domain.PayrollAllocation;
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
-import io.mifos.payroll.service.ServiceConstants;
-import io.mifos.payroll.service.internal.command.PutPayrollConfigurationCommand;
-import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
+import org.apache.fineract.cn.payroll.api.v1.PermittableGroupIds;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollAllocation;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
+import org.apache.fineract.cn.payroll.service.internal.command.PutPayrollConfigurationCommand;
+import org.apache.fineract.cn.payroll.service.internal.service.PayrollConfigurationService;
 import java.util.List;
 import javax.validation.Valid;
 import org.apache.fineract.cn.anubis.annotation.AcceptedTokenType;
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/rest/PayrollDistributionRestController.java
similarity index 87%
rename from service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/rest/PayrollDistributionRestController.java
index a4c2435..801a92b 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/rest/PayrollDistributionRestController.java
@@ -16,19 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.rest;
+package org.apache.fineract.cn.payroll.service.rest;
 
-import io.mifos.payroll.api.v1.PermittableGroupIds;
-import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
-import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
-import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
-import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
-import io.mifos.payroll.service.ServiceConstants;
-import io.mifos.payroll.service.internal.command.DistributePayrollCommand;
-import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
-import io.mifos.payroll.service.internal.service.PayrollDistributionService;
-import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
-import io.mifos.payroll.service.rest.util.PageableBuilder;
+import org.apache.fineract.cn.payroll.api.v1.PermittableGroupIds;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollCollectionHistory;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollCollectionSheet;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
+import org.apache.fineract.cn.payroll.api.v1.domain.PayrollPaymentPage;
+import org.apache.fineract.cn.payroll.service.ServiceConstants;
+import org.apache.fineract.cn.payroll.service.internal.command.DistributePayrollCommand;
+import org.apache.fineract.cn.payroll.service.internal.service.PayrollConfigurationService;
+import org.apache.fineract.cn.payroll.service.internal.service.PayrollDistributionService;
+import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
+import org.apache.fineract.cn.payroll.service.rest.util.PageableBuilder;
 import java.util.List;
 import javax.validation.Valid;
 import org.apache.fineract.cn.accounting.api.v1.domain.Account;
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/util/PageableBuilder.java b/service/src/main/java/org/apache/fineract/cn/payroll/service/rest/util/PageableBuilder.java
similarity index 96%
rename from service/src/main/java/io/mifos/payroll/service/rest/util/PageableBuilder.java
rename to service/src/main/java/org/apache/fineract/cn/payroll/service/rest/util/PageableBuilder.java
index 8a7ec5a..82befa0 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/util/PageableBuilder.java
+++ b/service/src/main/java/org/apache/fineract/cn/payroll/service/rest/util/PageableBuilder.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package io.mifos.payroll.service.rest.util;
+package org.apache.fineract.cn.payroll.service.rest.util;
 
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;


[fineract-cn-payroll] 43/50: Fix failing test and licensing information

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit d596ee2678805b845e7ffca79ce9157112e76345
Author: Isaac Kamga <u2...@gmail.com>
AuthorDate: Wed Sep 5 19:14:20 2018 +0100

    Fix failing test and licensing information
---
 .../fineract/cn/payroll/PayrollApiDocumentation.java | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/component-test/src/main/java/org/apache/fineract/cn/payroll/PayrollApiDocumentation.java b/component-test/src/main/java/org/apache/fineract/cn/payroll/PayrollApiDocumentation.java
index 39a38fc..03841fe 100644
--- a/component-test/src/main/java/org/apache/fineract/cn/payroll/PayrollApiDocumentation.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/payroll/PayrollApiDocumentation.java
@@ -1,3 +1,21 @@
+/*
+ * 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.payroll;
 
 import com.google.common.collect.Lists;
@@ -333,7 +351,7 @@ public class PayrollApiDocumentation extends AbstractPayrollTest {
     super.eventRecorder.wait(EventConstants.POST_DISTRIBUTION, payrollSheet.getSourceAccountNumber());
 
     final List <PayrollCollectionHistory> payrollCollectionHistories = super.testSubject.fetchDistributionHistory();
-    Assert.assertEquals(1, payrollCollectionHistories.size());
+    Assert.assertTrue(payrollCollectionHistories.size() >= 1);
 
     final PayrollCollectionHistory payrollCollectionHistory = payrollCollectionHistories.get(0);
     final PayrollPaymentPage payrollPaymentPage =


[fineract-cn-payroll] 23/50: Merge pull request #4 from markusgeiss/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit a797401e2382ed4d849bac26a910f9317f210fed
Merge: 468e43f 23bd6e3
Author: Markus Geiss <ma...@kuelap.io>
AuthorDate: Fri Oct 6 17:11:33 2017 +0200

    Merge pull request #4 from markusgeiss/develop
    
    added account validation before initializing payroll transaction

 .../payroll/api/v1/client/PayrollManager.java      |   3 +-
 .../io/mifos/payroll/TestPayrollDistribution.java  | 111 ++++++++++++++++++---
 .../rest/PayrollDistributionRestController.java    |  35 +++++--
 3 files changed, 128 insertions(+), 21 deletions(-)


[fineract-cn-payroll] 40/50: Revert "Document the payroll API"

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit e94c0e35a279ad01669f20a3018f8cc81932aa34
Author: Isaac Kamga <u2...@gmail.com>
AuthorDate: Mon Jun 11 02:26:48 2018 +0100

    Revert "Document the payroll API"
---
 service/build.gradle                               |  20 -
 service/src/doc/asciidoc/api-docs.adoc             |  31 --
 .../curl-request.adoc                              |   4 -
 .../http-request.adoc                              |  10 -
 .../http-response.adoc                             |   5 -
 .../httpie-request.adoc                            |   4 -
 .../curl-request.adoc                              |   4 -
 .../http-request.adoc                              |   8 -
 .../http-response.adoc                             |   5 -
 .../httpie-request.adoc                            |   4 -
 service/src/doc/html5/html5/api-docs.html          | 508 ---------------------
 .../fineract/cn/payroll/AbstractPayrollTest.java   | 114 -----
 .../fineract/cn/payroll/SuiteTestEnvironment.java  |  48 --
 .../cn/payroll/TestPayrollConfiguration.java       | 172 -------
 .../cn/payroll/TestPayrollDistribution.java        | 198 --------
 .../org/apache/fineract/cn/payroll/TestSuite.java  |  30 --
 .../cn/payroll/domain/DomainObjectGenerator.java   |  49 --
 .../payroll/listener/MigrationEventListener.java   |  50 --
 .../listener/PayrollConfigurationListener.java     |  56 ---
 .../listener/PayrollDistributionListener.java      |  56 ---
 20 files changed, 1376 deletions(-)

diff --git a/service/build.gradle b/service/build.gradle
index 79f2200..b7d4e95 100644
--- a/service/build.gradle
+++ b/service/build.gradle
@@ -26,7 +26,6 @@ buildscript {
 
     dependencies {
         classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
-        classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.3")
     }
 }
 
@@ -37,7 +36,6 @@ plugins {
 
 apply from: '../shared.gradle'
 
-apply plugin: 'org.asciidoctor.convert'
 apply plugin: 'spring-boot'
 
 springBoot {
@@ -62,24 +60,6 @@ dependencies {
             [group: 'org.apache.fineract.cn', name: 'command', version: versions.frameworkcommand],
             [group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator]
     )
-    testCompile(
-            [group: 'org.apache.fineract.cn.payroll', name: 'api', version: project.version],
-            [group: 'org.apache.fineract.cn.anubis', name: 'test', version: versions.frameworkanubis],
-            [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', name: 'lang', version: versions.frameworklang],
-            [group: 'org.springframework.boot', name: 'spring-boot-starter-test'],
-            [group: 'org.springframework.restdocs', name: 'spring-restdocs-mockmvc'],
-            [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
deleted file mode 100644
index 8ab3b68..0000000
--- a/service/src/doc/asciidoc/api-docs.adoc
+++ /dev/null
@@ -1,31 +0,0 @@
-== Apache Fineract CN Payroll Management API Documentation ==
-
-== Payroll Configurations ==
-
-==== Configure Payroll Distribution ====
-
-.curl-request
-include::{snippets}/test-configurations/should-create-payroll-distribution/curl-request.adoc[]
-
-.http-request
-include::{snippets}/test-configurations/should-create-payroll-distribution/http-request.adoc[]
-
-.http-response
-include::{snippets}/test-configurations/should-create-payroll-distribution/http-response.adoc[]
-
-.httpie-request
-include::{snippets}/test-configurations/should-create-payroll-distribution/httpie-request.adoc[]
-
-==== Update Payroll Distribution ====
-
-.curl-request
-include::{snippets}/test-configurations/should-update-payroll-distribution/curl-request.adoc[]
-
-.http-request
-include::{snippets}/test-configurations/should-update-payroll-distribution/http-request.adoc[]
-
-.http-response
-include::{snippets}/test-configurations/should-update-payroll-distribution/http-response.adoc[]
-
-.httpie-request
-include::{snippets}/test-configurations/should-update-payroll-distribution/httpie-request.adoc[]
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/curl-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/curl-request.adoc
deleted file mode 100644
index 369d46e..0000000
--- a/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/curl-request.adoc
+++ /dev/null
@@ -1,4 +0,0 @@
-[source,bash]
-----
-$ curl 'http://localhost:8080/payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll' -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3'
-----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-request.adoc
deleted file mode 100644
index 973bc8e..0000000
--- a/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-request.adoc
+++ /dev/null
@@ -1,10 +0,0 @@
-[source,http,options="nowrap"]
-----
-POST /payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll HTTP/1.1
-Accept: application/json
-Content-Type: application/json
-Host: localhost:8080
-Content-Length: 32
-
-wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3
-----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-response.adoc b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-response.adoc
deleted file mode 100644
index f3b256d..0000000
--- a/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/http-response.adoc
+++ /dev/null
@@ -1,5 +0,0 @@
-[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-configurations/should-create-payroll-distribution/httpie-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/httpie-request.adoc
deleted file mode 100644
index 58f2cf5..0000000
--- a/service/src/doc/generated-snippets/test-configurations/should-create-payroll-distribution/httpie-request.adoc
+++ /dev/null
@@ -1,4 +0,0 @@
-[source,bash]
-----
-$ echo 'wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3' | http POST 'http://localhost:8080/payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll' 'Accept:application/json' 'Content-Type:application/json'
-----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/curl-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/curl-request.adoc
deleted file mode 100644
index cf59595..0000000
--- a/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/curl-request.adoc
+++ /dev/null
@@ -1,4 +0,0 @@
-[source,bash]
-----
-$ curl 'http://localhost:8080/payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4' -i -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json'
-----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-request.adoc
deleted file mode 100644
index da20ea8..0000000
--- a/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-request.adoc
+++ /dev/null
@@ -1,8 +0,0 @@
-[source,http,options="nowrap"]
-----
-PUT /payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4 HTTP/1.1
-Accept: application/json
-Content-Type: application/json
-Host: localhost:8080
-
-----
\ No newline at end of file
diff --git a/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-response.adoc b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-response.adoc
deleted file mode 100644
index f3b256d..0000000
--- a/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/http-response.adoc
+++ /dev/null
@@ -1,5 +0,0 @@
-[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-configurations/should-update-payroll-distribution/httpie-request.adoc b/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/httpie-request.adoc
deleted file mode 100644
index 352b69e..0000000
--- a/service/src/doc/generated-snippets/test-configurations/should-update-payroll-distribution/httpie-request.adoc
+++ /dev/null
@@ -1,4 +0,0 @@
-[source,bash]
-----
-$ http PUT 'http://localhost:8080/payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4' 'Accept:application/json' '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
deleted file mode 100644
index 105514b..0000000
--- a/service/src/doc/html5/html5/api-docs.html
+++ /dev/null
@@ -1,508 +0,0 @@
-<!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 Payroll 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_payroll_management_api_documentation">Apache Fineract CN Payroll Management API Documentation</h2>
-<div class="sectionbody">
-
-</div>
-</div>
-<div class="sect1">
-<h2 id="_payroll_configurations">Payroll Configurations</h2>
-<div class="sectionbody">
-<div class="sect3">
-<h4 id="_configure_payroll_distribution">Configure Payroll Distribution</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/payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll' -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d 'wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3'</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 /payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll HTTP/1.1
-Accept: application/json
-Content-Type: application/json
-Host: localhost:8080
-Content-Length: 32
-
-wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3</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 'wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3' | http POST 'http://localhost:8080/payroll/v1/customers/wwiP1hjgY4urDKHZZmE7K7Pbwr5OV9J3/payroll' 'Accept:application/json' 'Content-Type:application/json'</code></pre>
-</div>
-</div>
-</div>
-<div class="sect3">
-<h4 id="_update_payroll_distribution">Update Payroll Distribution</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/payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4' -i -X PUT -H 'Accept: application/json' -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">PUT /payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4 HTTP/1.1
-Accept: application/json
-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 PUT 'http://localhost:8080/payroll/v1/customers/WhfpMOMifcLw4XIoImryT51O75wTyfVa/payroll/org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration@42c661d4' 'Accept:application/json' 'Content-Type:application/json'</code></pre>
-</div>
-</div>
-</div>
-</div>
-</div>
-</div>
-<div id="footer">
-<div id="footer-text">
-Last updated 2018-04-23 16:34:50 +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/payroll/AbstractPayrollTest.java b/service/src/test/java/org/apache/fineract/cn/payroll/AbstractPayrollTest.java
deleted file mode 100644
index 5aca3d0..0000000
--- a/service/src/test/java/org/apache/fineract/cn/payroll/AbstractPayrollTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.payroll;
-
-
-import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
-import org.apache.fineract.cn.api.context.AutoUserContext;
-import org.apache.fineract.cn.payroll.api.v1.EventConstants;
-import org.apache.fineract.cn.payroll.api.v1.client.PayrollManager;
-import org.apache.fineract.cn.payroll.service.PayrollServiceConfiguration;
-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.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.netflix.feign.EnableFeignClients;
-import org.springframework.cloud.netflix.ribbon.RibbonClient;
-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 = {
-        AbstractPayrollTest.TestConfiguration.class
-    }
-)
-public class AbstractPayrollTest extends SuiteTestEnvironment {
-
-  @Configuration
-  @EnableEventRecording
-  @EnableFeignClients(basePackages = {
-      "org.apache.fineract.cn.payroll.api.v1.client"
-  })
-  @RibbonClient(name = SuiteTestEnvironment.APP_NAME)
-  @ComponentScan(
-      basePackages = {
-          "org.apache.fineract.cn.payroll.listener"
-      }
-  )
-  @Import({
-      PayrollServiceConfiguration.class
-  })
-  public static class TestConfiguration {
-    public TestConfiguration() {
-      super();
-    }
-  }
-
-  static final String TEST_USER = "mage";
-
-  @ClassRule
-  public final static TenantDataStoreContextTestRule tenantDataStoreContext =
-      TenantDataStoreContextTestRule.forRandomTenantName(SuiteTestEnvironment.cassandraInitializer,
-          SuiteTestEnvironment.mariaDBInitializer);
-
-  @Rule
-  public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
-      = new TenantApplicationSecurityEnvironmentTestRule(SuiteTestEnvironment.testEnvironment, this::waitForInitialize);
-
-  @Autowired
-  EventRecorder eventRecorder;
-
-  private AutoUserContext userContext;
-
-  @Autowired
-  PayrollManager testSubject;
-
-  public AbstractPayrollTest() {
-    super();
-  }
-
-  @Before
-  public void prepareTest() {
-    this.userContext = this.tenantApplicationSecurityEnvironment.createAutoUserContext(AbstractPayrollTest.TEST_USER);
-  }
-
-  @After
-  public void cleanupTest() {
-    userContext.close();
-  }
-
-  public boolean waitForInitialize() {
-    try {
-      return this.eventRecorder.wait(EventConstants.INITIALIZE, SuiteTestEnvironment.APP_VERSION);
-    } catch (final InterruptedException e) {
-      throw new IllegalStateException(e);
-    }
-  }
-
-}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/SuiteTestEnvironment.java b/service/src/test/java/org/apache/fineract/cn/payroll/SuiteTestEnvironment.java
deleted file mode 100644
index ebe1880..0000000
--- a/service/src/test/java/org/apache/fineract/cn/payroll/SuiteTestEnvironment.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.payroll;
-
-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;
-
-/**
- * This contains the database resources required by the test.  They are in a separate
- * class so that the test suite can initialize them before the classes it calls. This
- * makes test runs faster and prevents tests from "stepping on each other's toes" when
- * initializing and de-initializing external resources.
- */
-public class SuiteTestEnvironment {
-  static final String APP_VERSION = "1";
-  static final String APP_NAME = "payroll-v" + APP_VERSION;
-
-  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/payroll/TestPayrollConfiguration.java b/service/src/test/java/org/apache/fineract/cn/payroll/TestPayrollConfiguration.java
deleted file mode 100644
index d5e41d6..0000000
--- a/service/src/test/java/org/apache/fineract/cn/payroll/TestPayrollConfiguration.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.payroll;
-
-import com.google.common.collect.Lists;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.fineract.cn.accounting.api.v1.domain.Account;
-import org.apache.fineract.cn.customer.api.v1.domain.Customer;
-import org.apache.fineract.cn.payroll.api.v1.EventConstants;
-import org.apache.fineract.cn.payroll.api.v1.domain.PayrollAllocation;
-import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
-import org.apache.fineract.cn.payroll.domain.DomainObjectGenerator;
-import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
-import org.apache.fineract.cn.payroll.service.internal.service.adaptor.CustomerAdaptor;
-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.boot.test.mock.mockito.MockBean;
-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.math.BigDecimal;
-import java.util.Optional;
-
-import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
-import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
-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 TestPayrollConfiguration extends AbstractPayrollTest {
-
-  @Rule
-  public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("src/doc/generated-snippets/test-configurations");
-
-  @Autowired
-  private WebApplicationContext context;
-
-  private MockMvc mockMvc;
-
-  final String path = "/payroll/v1";
-
-  @Before
-  public void setUp(){
-
-    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
-            .apply(documentationConfiguration(this.restDocumentation))
-            .alwaysDo(document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
-            .build();
-  }
-
-  @MockBean
-  private CustomerAdaptor customerAdaptorSpy;
-  @MockBean
-  private AccountingAdaptor accountingAdaptorSpy;
-
-  public TestPayrollConfiguration() {
-    super();
-  }
-
-  @Test
-  public void shouldCreatePayrollDistribution() throws Exception {
-    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
-    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
-    this.prepareMocks(customerIdentifier, payrollConfiguration);
-
-    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
-    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
-
-    try {
-      this.mockMvc.perform(post(path + "/customers/" + customerIdentifier + "/payroll")
-              .accept(MediaType.APPLICATION_JSON_VALUE)
-              .contentType(MediaType.APPLICATION_JSON_VALUE)
-              .content(customerIdentifier))
-              .andExpect(status().isNotFound());
-    } catch (Exception e) { e.printStackTrace(); }
-  }
-
-  @Test
-  public void shouldUpdatePayrollDistribution() throws Exception {
-    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
-    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
-    this.prepareMocks(customerIdentifier, payrollConfiguration);
-
-    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
-    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
-
-    final PayrollAllocation newPayrollAllocation = new PayrollAllocation();
-    payrollConfiguration.setPayrollAllocations(Lists.newArrayList(newPayrollAllocation));
-    newPayrollAllocation.setAccountNumber(RandomStringUtils.randomAlphanumeric(34));
-    newPayrollAllocation.setAmount(BigDecimal.valueOf(15.00D));
-    newPayrollAllocation.setProportional(Boolean.FALSE);
-
-    Mockito
-            .doAnswer(invocation -> Optional.of(new Account()))
-            .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(newPayrollAllocation.getAccountNumber()));
-
-    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
-    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
-
-    Thread.sleep(500L);
-
-    final PayrollConfiguration fetchedPayrollConfiguration =
-            super.testSubject.findPayrollConfiguration(customerIdentifier);
-
-    Assert.assertNotNull(fetchedPayrollConfiguration.getLastModifiedBy());
-    Assert.assertNotNull(fetchedPayrollConfiguration.getLastModifiedOn());
-    Assert.assertEquals(1, fetchedPayrollConfiguration.getPayrollAllocations().size());
-
-    final Optional<PayrollAllocation> optionalPayrollAllocation =
-            fetchedPayrollConfiguration.getPayrollAllocations().stream().findFirst();
-
-    Assert.assertTrue(optionalPayrollAllocation.isPresent());
-
-    this.comparePayrollAllocations(newPayrollAllocation, optionalPayrollAllocation.get());
-
-    try {
-      this.mockMvc.perform(put(path + "/customers/" + customerIdentifier + "/payroll/" + payrollConfiguration.toString())
-              .accept(MediaType.APPLICATION_JSON_VALUE)
-              .contentType(MediaType.APPLICATION_JSON))
-              .andExpect(status().is4xxClientError());
-    } catch ( Exception E) { E.printStackTrace(); }
-  }
-
-  private void prepareMocks(final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
-    Mockito
-            .doAnswer(invocation -> Optional.of(new Customer()))
-            .when(this.customerAdaptorSpy).findCustomer(Matchers.eq(customerIdentifier));
-
-    Mockito
-            .doAnswer(invocation -> Optional.of(new Account()))
-            .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollConfiguration.getMainAccountNumber()));
-
-    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation ->
-            Mockito
-                    .doAnswer(invocation -> Optional.of(new Account()))
-                    .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()))
-    );
-  }
-
-  private void comparePayrollAllocations(final PayrollAllocation expected, final PayrollAllocation actual) {
-    Assert.assertEquals(expected.getAccountNumber(), actual.getAccountNumber());
-    Assert.assertTrue(expected.getAmount().compareTo(actual.getAmount()) == 0);
-    Assert.assertEquals(expected.getProportional(), actual.getProportional());
-  }
-}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/TestPayrollDistribution.java b/service/src/test/java/org/apache/fineract/cn/payroll/TestPayrollDistribution.java
deleted file mode 100644
index 68c2991..0000000
--- a/service/src/test/java/org/apache/fineract/cn/payroll/TestPayrollDistribution.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * 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.payroll;
-
-import com.google.common.collect.Lists;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.fineract.cn.accounting.api.v1.domain.Account;
-import org.apache.fineract.cn.customer.api.v1.domain.Customer;
-import org.apache.fineract.cn.payroll.api.v1.EventConstants;
-import org.apache.fineract.cn.payroll.api.v1.client.PayrollPaymentValidationException;
-import org.apache.fineract.cn.payroll.api.v1.domain.*;
-import org.apache.fineract.cn.payroll.domain.DomainObjectGenerator;
-import org.apache.fineract.cn.payroll.service.internal.repository.PayrollCollectionEntity;
-import org.apache.fineract.cn.payroll.service.internal.service.adaptor.AccountingAdaptor;
-import org.apache.fineract.cn.payroll.service.internal.service.adaptor.CustomerAdaptor;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Matchers;
-import org.mockito.Mockito;
-import org.springframework.boot.test.mock.mockito.MockBean;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Optional;
-
-public class TestPayrollDistribution extends AbstractPayrollTest {
-
-  @MockBean
-  private CustomerAdaptor customerAdaptorSpy;
-  @MockBean
-  private AccountingAdaptor accountingAdaptorSpy;
-
-  public TestPayrollDistribution() {
-    super();
-  }
-
-  @Test
-  public void shouldDistributePayments() throws Exception {
-    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
-    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
-    this.prepareMocks(customerIdentifier, payrollConfiguration);
-
-    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
-    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
-
-    final PayrollCollectionSheet payrollCollectionSheet = new PayrollCollectionSheet();
-    payrollCollectionSheet.setSourceAccountNumber(RandomStringUtils.randomAlphanumeric(34));
-    final PayrollPayment payrollPayment = new PayrollPayment();
-    payrollPayment.setCustomerIdentifier(customerIdentifier);
-    payrollPayment.setEmployer("ACME, Inc.");
-    payrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
-    payrollCollectionSheet.setPayrollPayments(Lists.newArrayList(payrollPayment));
-
-    final Account sourceAccount = new Account();
-    sourceAccount.setState(Account.State.OPEN.name());
-    Mockito
-        .doAnswer(invocation -> Optional.of(sourceAccount))
-        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
-
-    Mockito
-        .doAnswer(invocation -> Optional.empty())
-        .when(this.accountingAdaptorSpy).postPayrollPayment(
-        Matchers.any(PayrollCollectionEntity.class),
-        Matchers.refEq(payrollPayment),
-        Matchers.any(PayrollConfiguration.class)
-    );
-
-    super.testSubject.distribute(payrollCollectionSheet);
-    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_DISTRIBUTION, payrollCollectionSheet.getSourceAccountNumber()));
-
-    final List<PayrollCollectionHistory> payrollCollectionHistories = super.testSubject.fetchDistributionHistory();
-    Assert.assertEquals(1, payrollCollectionHistories.size());
-
-    final PayrollCollectionHistory payrollCollectionHistory = payrollCollectionHistories.get(0);
-    final PayrollPaymentPage payrollPaymentPage =
-        super.testSubject.fetchPayments(payrollCollectionHistory.getIdentifier(), 0, 10, null, null);
-    Assert.assertEquals(Long.valueOf(1L), payrollPaymentPage.getTotalElements());
-
-    final PayrollPayment fetchedPayrollPayment = payrollPaymentPage.getPayrollPayments().get(0);
-    Assert.assertTrue(fetchedPayrollPayment.getProcessed());
-  }
-
-  @Test(expected = PayrollPaymentValidationException.class)
-  public void shouldNotDistributePaymentsAllocatedAccountClosed() throws Exception {
-    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
-    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
-    this.prepareMocks(customerIdentifier, payrollConfiguration);
-
-    final PayrollAllocation invalidPayrollAllocation = new PayrollAllocation();
-    invalidPayrollAllocation.setAccountNumber(RandomStringUtils.randomAlphanumeric(34));
-    invalidPayrollAllocation.setProportional(Boolean.FALSE);
-    invalidPayrollAllocation.setAmount(BigDecimal.valueOf(200.00D));
-    payrollConfiguration.getPayrollAllocations().add(invalidPayrollAllocation);
-
-    final Account invalidPayrollAccount = new Account();
-    invalidPayrollAccount.setState(Account.State.CLOSED.name());
-    Mockito
-        .doAnswer(invocation -> Optional.of(invalidPayrollAccount))
-        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(invalidPayrollAllocation.getAccountNumber()));
-
-    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
-    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
-
-    final PayrollCollectionSheet payrollCollectionSheet = new PayrollCollectionSheet();
-    payrollCollectionSheet.setSourceAccountNumber(RandomStringUtils.randomAlphanumeric(34));
-    final PayrollPayment payrollPayment = new PayrollPayment();
-    payrollPayment.setCustomerIdentifier(customerIdentifier);
-    payrollPayment.setEmployer("ACME, Inc.");
-    payrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
-    payrollCollectionSheet.setPayrollPayments(Lists.newArrayList(payrollPayment));
-
-    final Account sourceAccount = new Account();
-    sourceAccount.setState(Account.State.OPEN.name());
-    Mockito
-        .doAnswer(invocation -> Optional.of(sourceAccount))
-        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
-
-    Mockito
-        .doAnswer(invocation -> Optional.empty())
-        .when(this.accountingAdaptorSpy).postPayrollPayment(
-        Matchers.any(PayrollCollectionEntity.class),
-        Matchers.refEq(payrollPayment),
-        Matchers.any(PayrollConfiguration.class)
-    );
-
-    super.testSubject.distribute(payrollCollectionSheet);
-  }
-
-  @Test(expected = PayrollPaymentValidationException.class)
-  public void shouldNotDistributePaymentsSourceAccountClosed() throws Exception {
-    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
-    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
-    this.prepareMocks(customerIdentifier, payrollConfiguration);
-
-    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
-    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
-
-    final PayrollCollectionSheet payrollCollectionSheet = new PayrollCollectionSheet();
-    payrollCollectionSheet.setSourceAccountNumber(RandomStringUtils.randomAlphanumeric(34));
-    final PayrollPayment payrollPayment = new PayrollPayment();
-    payrollPayment.setCustomerIdentifier(customerIdentifier);
-    payrollPayment.setEmployer("ACME, Inc.");
-    payrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
-    payrollCollectionSheet.setPayrollPayments(Lists.newArrayList(payrollPayment));
-
-    final Account sourceAccount = new Account();
-    sourceAccount.setState(Account.State.CLOSED.name());
-    Mockito
-        .doAnswer(invocation -> Optional.of(sourceAccount))
-        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
-
-    Mockito
-        .doAnswer(invocation -> Optional.empty())
-        .when(this.accountingAdaptorSpy).postPayrollPayment(
-        Matchers.any(PayrollCollectionEntity.class),
-        Matchers.refEq(payrollPayment),
-        Matchers.any(PayrollConfiguration.class)
-    );
-
-    super.testSubject.distribute(payrollCollectionSheet);
-  }
-
-  private void prepareMocks(final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
-    Mockito
-        .doAnswer(invocation -> Optional.of(new Customer()))
-        .when(this.customerAdaptorSpy).findCustomer(Matchers.eq(customerIdentifier));
-
-    final Account mainAccount = new Account();
-    mainAccount.setState(Account.State.OPEN.name());
-    Mockito
-        .doAnswer(invocation -> Optional.of(mainAccount))
-        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollConfiguration.getMainAccountNumber()));
-
-    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation -> {
-      final Account allocatedAccount = new Account();
-      allocatedAccount.setState(Account.State.OPEN.name());
-      Mockito
-          .doAnswer(invocation -> Optional.of(allocatedAccount))
-          .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()));
-    });
-  }
-}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/TestSuite.java b/service/src/test/java/org/apache/fineract/cn/payroll/TestSuite.java
deleted file mode 100644
index 5fe0817..0000000
--- a/service/src/test/java/org/apache/fineract/cn/payroll/TestSuite.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.payroll;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
-    TestPayrollConfiguration.class,
-    TestPayrollDistribution.class
-})
-public class TestSuite extends SuiteTestEnvironment {
-}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/domain/DomainObjectGenerator.java b/service/src/test/java/org/apache/fineract/cn/payroll/domain/DomainObjectGenerator.java
deleted file mode 100644
index dc3dbfe..0000000
--- a/service/src/test/java/org/apache/fineract/cn/payroll/domain/DomainObjectGenerator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.payroll.domain;
-
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.fineract.cn.payroll.api.v1.domain.PayrollAllocation;
-import org.apache.fineract.cn.payroll.api.v1.domain.PayrollConfiguration;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-
-public class DomainObjectGenerator {
-
-  private DomainObjectGenerator() {
-    super();
-  }
-
-  public static PayrollConfiguration getPayrollConfiguration() {
-    final PayrollConfiguration payrollConfiguration = new PayrollConfiguration();
-    payrollConfiguration.setMainAccountNumber(RandomStringUtils.randomAlphanumeric(34));
-
-    final ArrayList<PayrollAllocation> payrollAllocations = new ArrayList<>();
-    payrollConfiguration.setPayrollAllocations(payrollAllocations);
-
-    final PayrollAllocation savingsAllocation = new PayrollAllocation();
-    payrollAllocations.add(savingsAllocation);
-    savingsAllocation.setAccountNumber(RandomStringUtils.randomAlphanumeric(34));
-    savingsAllocation.setAmount(BigDecimal.valueOf(5.00D));
-    savingsAllocation.setProportional(Boolean.TRUE);
-
-    return payrollConfiguration;
-  }
-}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/listener/MigrationEventListener.java b/service/src/test/java/org/apache/fineract/cn/payroll/listener/MigrationEventListener.java
deleted file mode 100644
index fc5867b..0000000
--- a/service/src/test/java/org/apache/fineract/cn/payroll/listener/MigrationEventListener.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.payroll.listener;
-
-import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
-import org.apache.fineract.cn.payroll.api.v1.EventConstants;
-import org.apache.fineract.cn.test.listener.EventRecorder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jms.annotation.JmsListener;
-import org.springframework.messaging.handler.annotation.Header;
-import org.springframework.stereotype.Component;
-
-@SuppressWarnings("unused")
-@Component
-public class MigrationEventListener {
-
-  private final EventRecorder eventRecorder;
-
-  @Autowired
-  public MigrationEventListener(@SuppressWarnings("SpringJavaAutowiringInspection") final EventRecorder eventRecorder) {
-    super();
-    this.eventRecorder = eventRecorder;
-  }
-
-  @JmsListener(
-      subscription = EventConstants.DESTINATION,
-      destination = EventConstants.DESTINATION,
-      selector = EventConstants.SELECTOR_INITIALIZE
-  )
-  public void onInitialization(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
-                               final String payload) {
-    this.eventRecorder.event(tenant, EventConstants.INITIALIZE, payload, String.class);
-  }
-}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollConfigurationListener.java b/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollConfigurationListener.java
deleted file mode 100644
index 776112d..0000000
--- a/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollConfigurationListener.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.payroll.listener;
-
-import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
-import org.apache.fineract.cn.payroll.api.v1.EventConstants;
-import org.apache.fineract.cn.payroll.service.ServiceConstants;
-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 PayrollConfigurationListener {
-
-  private final Logger logger;
-  private final EventRecorder eventRecorder;
-
-  @Autowired
-  public PayrollConfigurationListener(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
-                                      final EventRecorder eventRecorder) {
-    super();
-    this.logger = logger;
-    this.eventRecorder = eventRecorder;
-  }
-
-  @JmsListener(
-      subscription = EventConstants.DESTINATION,
-      destination = EventConstants.DESTINATION,
-      selector = EventConstants.SELECTOR_PUT_CONFIGURATION
-  )
-  public void onPutConfiguration(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
-                                 final String payload) {
-    this.logger.info("Payment configuration for customer {} processed.", payload);
-    this.eventRecorder.event(tenant, EventConstants.PUT_CONFIGURATION, payload, String.class);
-  }
-}
diff --git a/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollDistributionListener.java b/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollDistributionListener.java
deleted file mode 100644
index c489f2a..0000000
--- a/service/src/test/java/org/apache/fineract/cn/payroll/listener/PayrollDistributionListener.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.payroll.listener;
-
-import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
-import org.apache.fineract.cn.payroll.api.v1.EventConstants;
-import org.apache.fineract.cn.payroll.service.ServiceConstants;
-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 PayrollDistributionListener {
-
-  private final Logger logger;
-  private final EventRecorder eventRecorder;
-
-  @Autowired
-  public PayrollDistributionListener(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
-                                     final EventRecorder eventRecorder) {
-    super();
-    this.logger = logger;
-    this.eventRecorder = eventRecorder;
-  }
-
-  @JmsListener(
-      subscription = EventConstants.DESTINATION,
-      destination = EventConstants.DESTINATION,
-      selector = EventConstants.SELECTOR_POST_DISTRIBUTION
-  )
-  public void onPostCollection(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
-                               final String payload) {
-    this.logger.info("Payment distribution with source account {0} processed.", payload);
-    this.eventRecorder.event(tenant, EventConstants.POST_DISTRIBUTION, payload, String.class);
-  }
-}


[fineract-cn-payroll] 16/50: Remove dot from version to be consistent Flush payroll allocations to prevent saving of duplicate allocations Set createdBy from entity in mapper

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 4cd0af44bb8cca897f4a74ee28976a7ee80d654b
Author: Mark <ma...@gmail.com>
AuthorDate: Tue Sep 19 14:19:17 2017 +0200

    Remove dot from version to be consistent
    Flush payroll allocations to prevent saving of duplicate allocations
    Set createdBy from entity in mapper
---
 .../service/internal/command/handler/PayrollConfigurationAggregate.java | 2 ++
 .../payroll/service/internal/mapper/PayrollConfigurationMapper.java     | 2 +-
 shared.gradle                                                           | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
index d71fe45..43e954d 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
@@ -73,6 +73,8 @@ public class PayrollConfigurationAggregate {
       payrollConfigurationEntity = optionalPayrollConfiguration.get();
       this.payrollAllocationRepository.deleteByPayrollConfiguration(payrollConfigurationEntity);
 
+      this.payrollAllocationRepository.flush();
+
       payrollConfigurationEntity.setLastModifiedBy(UserContextHolder.checkedGetUser());
       payrollConfigurationEntity.setLastModifiedOn(LocalDateTime.now(Clock.systemUTC()));
     } else {
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
index 140a2e0..69ba999 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollConfigurationMapper.java
@@ -28,7 +28,7 @@ public class PayrollConfigurationMapper {
   public static PayrollConfiguration map(final PayrollConfigurationEntity payrollConfigurationEntity) {
     final PayrollConfiguration payrollConfiguration = new PayrollConfiguration();
     payrollConfiguration.setMainAccountNumber(payrollConfigurationEntity.getMainAccountNumber());
-    payrollConfiguration.setCreatedBy(payrollConfiguration.getCreatedOn());
+    payrollConfiguration.setCreatedBy(payrollConfigurationEntity.getCreatedBy());
     payrollConfiguration.setCreatedOn(DateConverter.toIsoString(payrollConfigurationEntity.getCreatedOn()));
     if (payrollConfigurationEntity.getLastModifiedBy() != null) {
       payrollConfiguration.setLastModifiedBy(payrollConfigurationEntity.getLastModifiedBy());
diff --git a/shared.gradle b/shared.gradle
index 831fede..ac8c7ea 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -1,5 +1,5 @@
 group 'io.mifos.payroll'
-version '0.1.0.BUILD-SNAPSHOT'
+version '0.1.0-BUILD-SNAPSHOT'
 
 ext.versions = [
         frameworkapi : '0.1.0-BUILD-SNAPSHOT',


[fineract-cn-payroll] 48/50: Adding rat report to After Failure procedure

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 3b540cc6f406fdda6820826b759e1d53688cc908
Author: ebenezergraham <eg...@alustudent.com>
AuthorDate: Wed May 29 18:55:43 2019 +0400

    Adding rat report to After Failure procedure
---
 .travis.yml   | 3 +++
 shared.gradle | 1 +
 2 files changed, 4 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 8abfb4f..80647d1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -28,3 +28,6 @@ env:
     - ARTIFACTORY_URL=https://mifos.jfrog.io/mifos
     - ARTIFACTORY_USER=travis-ci
     - secure: "CEwvv6FRZQvFB2PO7HE0rvjQB2nvGvbE7uLzSeBJDTLc3KygcokOlaDBBolpvHUvydLG7RTQwLKLZv4C5E0aSgIFyszcDlPFOn9638GaLqmdhT41ihUKlmMkv6xAbQhq2cCEoIy8HWrcnOg6e5pj4FXlfKDRI/GNDMV+x0GblW0UoYSSyMb45SWGc0PJxa5vPYaukGnNQoVfqcynE5rHqvpbaBBbXgidQsLsZRp/vukcsblIpo04N5X+mjoQVGNCsgng/Vt5p/B/VFKC8l6kxKIq1eIDe+wjdotfBw9krXjKWZVq/whDvGvCHBdwCM5rGrLUBN0fJ2qf01loo05t57s0YcBxtAZtlxhHppW7TW2hv7lH+HoN+pNEFj7fnSFtldCvwqJwlqWBOFAQhLVNPajZQRwrcU6RDnPPeUEvOCvUveSfSecvlsJ3ykbA6OG1Xalc7y+VRQdthxuNzI0TA6hrd8/lz [...]
+after_failure:
+  - ./gradlew rat
+  - cat api/build/reports/rat/rat-report.txt
diff --git a/shared.gradle b/shared.gradle
index f5b0848..be05e13 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -114,4 +114,5 @@ rat {
             "gradlew.bat",
             "README.md"
     ]
+    plainOutput = true
 }
\ No newline at end of file


[fineract-cn-payroll] 22/50: added account validation before initializing payroll transaction

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 23bd6e3446df127f93d248987ec864eff7215c94
Author: mgeiss <mg...@mifos.org>
AuthorDate: Fri Oct 6 16:22:07 2017 +0200

    added account validation before initializing payroll transaction
---
 .../payroll/api/v1/client/PayrollManager.java      |   3 +-
 .../io/mifos/payroll/TestPayrollDistribution.java  | 111 ++++++++++++++++++---
 .../rest/PayrollDistributionRestController.java    |  35 +++++--
 3 files changed, 128 insertions(+), 21 deletions(-)

diff --git a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
index 5c232c0..d9235cf 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/client/PayrollManager.java
@@ -69,7 +69,8 @@ public interface PayrollManager {
       consumes = MediaType.APPLICATION_JSON_VALUE
   )
   @ThrowsExceptions({
-      @ThrowsException(status = HttpStatus.BAD_REQUEST, exception = PayrollPaymentValidationException.class)
+      @ThrowsException(status = HttpStatus.BAD_REQUEST, exception = PayrollPaymentValidationException.class),
+      @ThrowsException(status = HttpStatus.CONFLICT, exception = PayrollPaymentValidationException.class)
   })
   void distribute(@RequestBody @Valid final PayrollCollectionSheet payrollCollectionSheet);
 
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java b/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
index 661b586..cca752c 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
+++ b/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
@@ -19,6 +19,8 @@ import com.google.common.collect.Lists;
 import io.mifos.accounting.api.v1.domain.Account;
 import io.mifos.customer.api.v1.domain.Customer;
 import io.mifos.payroll.api.v1.EventConstants;
+import io.mifos.payroll.api.v1.client.PayrollPaymentValidationException;
+import io.mifos.payroll.api.v1.domain.PayrollAllocation;
 import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
 import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
 import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
@@ -67,17 +69,19 @@ public class TestPayrollDistribution extends AbstractPayrollTest {
     payrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
     payrollCollectionSheet.setPayrollPayments(Lists.newArrayList(payrollPayment));
 
+    final Account sourceAccount = new Account();
+    sourceAccount.setState(Account.State.OPEN.name());
     Mockito
-        .doAnswer(invocation -> Optional.of(new Account()))
+        .doAnswer(invocation -> Optional.of(sourceAccount))
         .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
 
     Mockito
         .doAnswer(invocation -> Optional.empty())
         .when(this.accountingAdaptorSpy).postPayrollPayment(
-            Matchers.any(PayrollCollectionEntity.class),
-            Matchers.refEq(payrollPayment),
-            Matchers.any(PayrollConfiguration.class)
-        );
+        Matchers.any(PayrollCollectionEntity.class),
+        Matchers.refEq(payrollPayment),
+        Matchers.any(PayrollConfiguration.class)
+    );
 
     super.testSubject.distribute(payrollCollectionSheet);
     Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_DISTRIBUTION, payrollCollectionSheet.getSourceAccountNumber()));
@@ -94,20 +98,103 @@ public class TestPayrollDistribution extends AbstractPayrollTest {
     Assert.assertTrue(fetchedPayrollPayment.getProcessed());
   }
 
+  @Test(expected = PayrollPaymentValidationException.class)
+  public void shouldNotDistributePaymentsAllocatedAccountClosed() throws Exception {
+    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    this.prepareMocks(customerIdentifier, payrollConfiguration);
+
+    final PayrollAllocation invalidPayrollAllocation = new PayrollAllocation();
+    invalidPayrollAllocation.setAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    invalidPayrollAllocation.setProportional(Boolean.FALSE);
+    invalidPayrollAllocation.setAmount(BigDecimal.valueOf(200.00D));
+    payrollConfiguration.getPayrollAllocations().add(invalidPayrollAllocation);
+
+    final Account invalidPayrollAccount = new Account();
+    invalidPayrollAccount.setState(Account.State.CLOSED.name());
+    Mockito
+        .doAnswer(invocation -> Optional.of(invalidPayrollAccount))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(invalidPayrollAllocation.getAccountNumber()));
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    final PayrollCollectionSheet payrollCollectionSheet = new PayrollCollectionSheet();
+    payrollCollectionSheet.setSourceAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    final PayrollPayment payrollPayment = new PayrollPayment();
+    payrollPayment.setCustomerIdentifier(customerIdentifier);
+    payrollPayment.setEmployer("ACME, Inc.");
+    payrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
+    payrollCollectionSheet.setPayrollPayments(Lists.newArrayList(payrollPayment));
+
+    final Account sourceAccount = new Account();
+    sourceAccount.setState(Account.State.OPEN.name());
+    Mockito
+        .doAnswer(invocation -> Optional.of(sourceAccount))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
+
+    Mockito
+        .doAnswer(invocation -> Optional.empty())
+        .when(this.accountingAdaptorSpy).postPayrollPayment(
+        Matchers.any(PayrollCollectionEntity.class),
+        Matchers.refEq(payrollPayment),
+        Matchers.any(PayrollConfiguration.class)
+    );
+
+    super.testSubject.distribute(payrollCollectionSheet);
+  }
+
+  @Test(expected = PayrollPaymentValidationException.class)
+  public void shouldNotDistributePaymentsSourceAccountClosed() throws Exception {
+    final String customerIdentifier = RandomStringUtils.randomAlphanumeric(32);
+    final PayrollConfiguration payrollConfiguration = DomainObjectGenerator.getPayrollConfiguration();
+    this.prepareMocks(customerIdentifier, payrollConfiguration);
+
+    super.testSubject.setPayrollConfiguration(customerIdentifier, payrollConfiguration);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
+
+    final PayrollCollectionSheet payrollCollectionSheet = new PayrollCollectionSheet();
+    payrollCollectionSheet.setSourceAccountNumber(RandomStringUtils.randomAlphanumeric(34));
+    final PayrollPayment payrollPayment = new PayrollPayment();
+    payrollPayment.setCustomerIdentifier(customerIdentifier);
+    payrollPayment.setEmployer("ACME, Inc.");
+    payrollPayment.setSalary(BigDecimal.valueOf(1234.56D));
+    payrollCollectionSheet.setPayrollPayments(Lists.newArrayList(payrollPayment));
+
+    final Account sourceAccount = new Account();
+    sourceAccount.setState(Account.State.CLOSED.name());
+    Mockito
+        .doAnswer(invocation -> Optional.of(sourceAccount))
+        .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
+
+    Mockito
+        .doAnswer(invocation -> Optional.empty())
+        .when(this.accountingAdaptorSpy).postPayrollPayment(
+        Matchers.any(PayrollCollectionEntity.class),
+        Matchers.refEq(payrollPayment),
+        Matchers.any(PayrollConfiguration.class)
+    );
+
+    super.testSubject.distribute(payrollCollectionSheet);
+  }
+
   private void prepareMocks(final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
     Mockito
         .doAnswer(invocation -> Optional.of(new Customer()))
         .when(this.customerAdaptorSpy).findCustomer(Matchers.eq(customerIdentifier));
 
+    final Account mainAccount = new Account();
+    mainAccount.setState(Account.State.OPEN.name());
     Mockito
-        .doAnswer(invocation -> Optional.of(new Account()))
+        .doAnswer(invocation -> Optional.of(mainAccount))
         .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollConfiguration.getMainAccountNumber()));
 
-    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation ->
-        Mockito
-            .doAnswer(invocation -> Optional.of(new Account()))
-            .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()))
-    );
+    payrollConfiguration.getPayrollAllocations().forEach(payrollAllocation -> {
+      final Account allocatedAccount = new Account();
+      allocatedAccount.setState(Account.State.OPEN.name());
+      Mockito
+          .doAnswer(invocation -> Optional.of(allocatedAccount))
+          .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollAllocation.getAccountNumber()));
+    });
   }
-
 }
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
index 7a2a8ea..681c48f 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
@@ -15,6 +15,7 @@
  */
 package io.mifos.payroll.service.rest;
 
+import io.mifos.accounting.api.v1.domain.Account;
 import io.mifos.anubis.annotation.AcceptedTokenType;
 import io.mifos.anubis.annotation.Permittable;
 import io.mifos.anubis.annotation.Permittables;
@@ -23,11 +24,13 @@ import io.mifos.core.lang.ServiceException;
 import io.mifos.payroll.api.v1.PermittableGroupIds;
 import io.mifos.payroll.api.v1.domain.PayrollCollectionHistory;
 import io.mifos.payroll.api.v1.domain.PayrollCollectionSheet;
+import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
 import io.mifos.payroll.service.ServiceConstants;
 import io.mifos.payroll.service.internal.command.DistributePayrollCommand;
 import io.mifos.payroll.service.internal.service.PayrollConfigurationService;
 import io.mifos.payroll.service.internal.service.PayrollDistributionService;
+import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
 import io.mifos.payroll.service.rest.util.PageableBuilder;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -53,17 +56,20 @@ public class PayrollDistributionRestController {
   private final CommandGateway commandGateway;
   private final PayrollDistributionService payrollDistributionService;
   private final PayrollConfigurationService payrollConfigurationService;
+  private final AccountingAdaptor accountingAdaptor;
 
   @Autowired
   public PayrollDistributionRestController(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
                                            final CommandGateway commandGateway,
                                            final PayrollDistributionService payrollDistributionService,
-                                           final PayrollConfigurationService payrollConfigurationService) {
+                                           final PayrollConfigurationService payrollConfigurationService,
+                                           final AccountingAdaptor accountingAdaptor) {
     super();
     this.logger = logger;
     this.commandGateway = commandGateway;
     this.payrollDistributionService = payrollDistributionService;
     this.payrollConfigurationService = payrollConfigurationService;
+    this.accountingAdaptor = accountingAdaptor;
   }
 
   @Permittables({
@@ -81,14 +87,17 @@ public class PayrollDistributionRestController {
   @ResponseBody
   public ResponseEntity<Void> distribute(@RequestBody @Valid final PayrollCollectionSheet payrollCollectionSheet) {
 
-    this.payrollConfigurationService.findAccount(payrollCollectionSheet.getSourceAccountNumber())
-        .orElseThrow(() -> ServiceException.notFound("Account {0} not available.", payrollCollectionSheet.getSourceAccountNumber()));
+    this.verifyAccount(payrollCollectionSheet.getSourceAccountNumber());
+    payrollCollectionSheet.getPayrollPayments()
+        .forEach(payrollPayment -> {
+          final PayrollConfiguration payrollConfiguration =
+              this.payrollConfigurationService.findPayrollConfiguration(payrollPayment.getCustomerIdentifier())
+                  .orElseThrow(() -> ServiceException.conflict("Payroll configuration for certain customers not available."));
 
-    if (payrollCollectionSheet.getPayrollPayments()
-        .stream().anyMatch(payrollPayment ->
-              !this.payrollConfigurationService.findPayrollConfiguration(payrollPayment.getCustomerIdentifier()).isPresent())) {
-      throw ServiceException.conflict("Payroll configuration for certain customers not available.");
-    }
+          this.verifyAccount(payrollConfiguration.getMainAccountNumber());
+          payrollConfiguration.getPayrollAllocations()
+              .forEach(payrollAllocation -> this.verifyAccount(payrollAllocation.getAccountNumber()));
+        });
 
     this.commandGateway.process(new DistributePayrollCommand(payrollCollectionSheet));
 
@@ -138,4 +147,14 @@ public class PayrollDistributionRestController {
     return ResponseEntity.ok(this.payrollDistributionService
         .fetchPayments(identifier, PageableBuilder.create(pageIndex, size, sortColumn, sortDirection)));
   }
+
+  private void verifyAccount(final String accountIdentifier) {
+    final Account account = this.accountingAdaptor.findAccount(accountIdentifier).orElseThrow(
+        () -> ServiceException.conflict("Account {0} not found.")
+    );
+
+    if (!account.getState().equals(Account.State.OPEN.name())) {
+      throw ServiceException.conflict("Account {0} must be open.", accountIdentifier);
+    }
+  }
 }


[fineract-cn-payroll] 34/50: Merge pull request #3 from myrle-krantz/develop

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit b1773fe45576098c8b711a534ff48ffd1ed87836
Merge: 63d995f 025fb9e
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Apr 9 20:32:55 2018 +0200

    Merge pull request #3 from myrle-krantz/develop
    
    Adding rat checks.

 api/build.gradle               | 18 ++++++++++++++++++
 api/settings.gradle            | 17 +++++++++++++++++
 build.gradle                   | 24 ++++++++++++++++++++++++
 component-test/build.gradle    | 18 ++++++++++++++++++
 component-test/settings.gradle | 17 +++++++++++++++++
 service/build.gradle           | 18 ++++++++++++++++++
 service/settings.gradle        | 17 +++++++++++++++++
 settings.gradle                | 17 +++++++++++++++++
 shared.gradle                  | 30 ++++++++++++++++++++++++++++++
 9 files changed, 176 insertions(+)


[fineract-cn-payroll] 28/50: updating artifact ids to apache fineract from mifos io

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 50d905ba6d47a1162d2ed06b8a0e78b6e5304d08
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Feb 26 18:05:50 2018 +0100

    updating artifact ids to apache fineract from mifos io
---
 api/build.gradle            |  4 ++--
 build.gradle                |  2 +-
 component-test/build.gradle | 12 ++++++------
 service/build.gradle        | 18 +++++++++---------
 shared.gradle               |  4 ++--
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/api/build.gradle b/api/build.gradle
index 17c6648..1ed9d2b 100644
--- a/api/build.gradle
+++ b/api/build.gradle
@@ -17,13 +17,13 @@ apply from: '../shared.gradle'
 dependencies {
     compile(
             [group: 'org.springframework.cloud', name: 'spring-cloud-starter-feign'],
-            [group: 'io.mifos.core', name: 'api', version: versions.frameworkapi],
+            [group: 'org.apache.fineract.cn', name: 'api', version: versions.frameworkapi],
             [group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator],
             [group: 'org.hibernate', name: 'hibernate-validator-annotation-processor', version: versions.validator]
     )
 
     testCompile(
-            [group: 'io.mifos.core', name: 'test', version: versions.frameworktest],
+            [group: 'org.apache.fineract.cn', name: 'test', version: versions.frameworktest],
     )
 }
 
diff --git a/build.gradle b/build.gradle
index b30bd55..b82a3b2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,4 +1,4 @@
-group 'io.mifos'
+group 'org.apache.fineract.cn'
 
 task publishApiToMavenLocal {
     dependsOn gradle.includedBuild('api').task(':publishToMavenLocal')
diff --git a/component-test/build.gradle b/component-test/build.gradle
index 4e0cc53..83583a1 100644
--- a/component-test/build.gradle
+++ b/component-test/build.gradle
@@ -19,12 +19,12 @@ apply from: '../shared.gradle'
 
 dependencies {
     compile(
-            [group: 'io.mifos.payroll', name: 'api', version: project.version],
-            [group: 'io.mifos.payroll', name: 'service', version: project.version],
-            [group: 'io.mifos.anubis', name: 'test', version: versions.frameworkanubis],
-            [group: 'io.mifos.core', name: 'api', version: versions.frameworkapi],
-            [group: 'io.mifos.core', name: 'test', version: versions.frameworktest],
-            [group: 'io.mifos.core', name: 'lang', version: versions.frameworklang],
+            [group: 'org.apache.fineract.cn.payroll', name: 'api', version: project.version],
+            [group: 'org.apache.fineract.cn.payroll', name: 'service', version: project.version],
+            [group: 'org.apache.fineract.cn.anubis', name: 'test', version: versions.frameworkanubis],
+            [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', name: 'lang', version: versions.frameworklang],
             [group: 'org.springframework.boot', name: 'spring-boot-starter-test']
     )
 }
diff --git a/service/build.gradle b/service/build.gradle
index 65e1431..f90732b 100644
--- a/service/build.gradle
+++ b/service/build.gradle
@@ -30,16 +30,16 @@ dependencies {
             [group: 'org.springframework.cloud', name: 'spring-cloud-starter-config'],
             [group: 'org.springframework.cloud', name: 'spring-cloud-starter-eureka'],
             [group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'],
-            [group: 'io.mifos.payroll', name: 'api', version: project.version],
-            [group: 'io.mifos.accounting', name: 'api', version: versions.frameworkaccounting],
-            [group: 'io.mifos.customer', name: 'api', version: versions.frameworkcustomer],
-            [group: 'io.mifos.anubis', name: 'library', version: versions.frameworkanubis],
+            [group: 'org.apache.fineract.cn.payroll', name: 'api', version: project.version],
+            [group: 'org.apache.fineract.cn.accounting', name: 'api', version: versions.frameworkaccounting],
+            [group: 'org.apache.fineract.cn.customer', name: 'api', version: versions.frameworkcustomer],
+            [group: 'org.apache.fineract.cn.anubis', name: 'library', version: versions.frameworkanubis],
             [group: 'com.google.code.gson', name: 'gson'],
-            [group: 'io.mifos.core', name: 'lang', version: versions.frameworklang],
-            [group: 'io.mifos.core', name: 'async', version: versions.frameworkasync],
-            [group: 'io.mifos.core', name: 'cassandra', version: versions.frameworkcassandra],
-            [group: 'io.mifos.core', name: 'mariadb', version: versions.frameworkmariadb],
-            [group: 'io.mifos.core', name: 'command', version: versions.frameworkcommand],
+            [group: 'org.apache.fineract.cn', name: 'lang', version: versions.frameworklang],
+            [group: 'org.apache.fineract.cn', name: 'async', version: versions.frameworkasync],
+            [group: 'org.apache.fineract.cn', name: 'cassandra', version: versions.frameworkcassandra],
+            [group: 'org.apache.fineract.cn', name: 'mariadb', version: versions.frameworkmariadb],
+            [group: 'org.apache.fineract.cn', name: 'command', version: versions.frameworkcommand],
             [group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator]
     )
 }
diff --git a/shared.gradle b/shared.gradle
index ac8c7ea..16fe692 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -1,4 +1,4 @@
-group 'io.mifos.payroll'
+group 'org.apache.fineract.cn.payroll'
 version '0.1.0-BUILD-SNAPSHOT'
 
 ext.versions = [
@@ -69,4 +69,4 @@ license {
     }
     ext.year = Calendar.getInstance().get(Calendar.YEAR)
     ext.name = 'The Mifos Initiative'
-}
\ No newline at end of file
+}


[fineract-cn-payroll] 24/50: retrofitted percentage calculation for payroll distribution

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit f4bea51b1a89d70a36d77649b74c3f5baac3513a
Author: mgeiss <mg...@mifos.org>
AuthorDate: Tue Oct 10 11:15:15 2017 +0200

    retrofitted percentage calculation for payroll distribution
---
 .../service/internal/service/adaptor/AccountingAdaptor.java        | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
index 14aa326..f7c549b 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
@@ -71,7 +71,8 @@ public class AccountingAdaptor {
                                  final PayrollPayment payrollPayment,
                                  final PayrollConfiguration payrollConfiguration) {
 
-    final MathContext mathContext = new MathContext(2, RoundingMode.HALF_EVEN);
+    final MathContext mathContextAmount = new MathContext(2, RoundingMode.HALF_EVEN);
+    final MathContext mathContextPercentage = new MathContext(5, RoundingMode.HALF_EVEN);
 
     final JournalEntry journalEntry = new JournalEntry();
     journalEntry.setTransactionIdentifier(UUID.randomUUID().toString());
@@ -95,8 +96,8 @@ public class AccountingAdaptor {
         allocationCreditor.setAmount(payrollAllocation.getAmount().toString());
       } else {
         final BigDecimal value = payrollPayment.getSalary().multiply(
-            payrollAllocation.getAmount().divide(BigDecimal.valueOf(100.00D), mathContext)
-        ).round(mathContext);
+            payrollAllocation.getAmount().divide(BigDecimal.valueOf(100.00D), mathContextPercentage)
+        ).round(mathContextAmount);
         allocationCreditor.setAmount(value.toString());
       }
       creditors.add(allocationCreditor);


[fineract-cn-payroll] 18/50: added validation for accounts and customers

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit d04212776bf9840307dc04c170312ceb2eb738ae
Author: mgeiss <mg...@mifos.org>
AuthorDate: Wed Sep 20 10:47:12 2017 +0200

    added validation for accounts and customers
---
 .../api/v1/domain/PayrollCollectionSheet.java      |  4 +--
 .../payroll/api/v1/domain/PayrollPayment.java      | 18 +++++++++++++
 .../io/mifos/payroll/TestPayrollDistribution.java  | 12 +++++++++
 .../handler/PayrollConfigurationAggregate.java     |  1 -
 .../handler/PayrollDistributionAggregate.java      | 25 ++++++++++-------
 .../internal/mapper/PayrollPaymentMapper.java      |  2 ++
 .../internal/repository/PayrollPaymentEntity.java  | 20 ++++++++++++++
 .../service/adaptor/AccountingAdaptor.java         | 31 ++++++++++++++++------
 .../internal/service/adaptor/CustomerAdaptor.java  |  7 +++--
 .../rest/PayrollConfigurationRestController.java   | 26 +++++++++++-------
 .../rest/PayrollDistributionRestController.java    | 13 +++------
 .../V2__add_distribution_processing_behavior.sql   | 18 +++++++++++++
 12 files changed, 137 insertions(+), 40 deletions(-)

diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
index 99f2f78..043ca02 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollCollectionSheet.java
@@ -16,16 +16,16 @@
 package io.mifos.payroll.api.v1.domain;
 
 import io.mifos.core.lang.validation.constraints.ValidIdentifier;
+import org.hibernate.validator.constraints.NotEmpty;
 
 import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
 import java.util.List;
 
 public class PayrollCollectionSheet {
 
   @ValidIdentifier(maxLength = 34)
   private String sourceAccountNumber;
-  @NotNull
+  @NotEmpty
   @Valid
   private List<PayrollPayment> payrollPayments;
 
diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
index 50daa4b..dbee945 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollPayment.java
@@ -32,6 +32,8 @@ public class PayrollPayment {
   @DecimalMin("0.001")
   @DecimalMax("9999999999.99999")
   private BigDecimal salary;
+  private Boolean processed;
+  private String message;
 
   public PayrollPayment() {
     super();
@@ -60,4 +62,20 @@ public class PayrollPayment {
   public void setSalary(final BigDecimal salary) {
     this.salary = salary;
   }
+
+  public Boolean getProcessed() {
+    return this.processed;
+  }
+
+  public void setProcessed(final Boolean processed) {
+    this.processed = processed;
+  }
+
+  public String getMessage() {
+    return this.message;
+  }
+
+  public void setMessage(final String message) {
+    this.message = message;
+  }
 }
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java b/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
index 0bcae44..661b586 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
+++ b/component-test/src/main/java/io/mifos/payroll/TestPayrollDistribution.java
@@ -25,6 +25,7 @@ import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.api.v1.domain.PayrollPayment;
 import io.mifos.payroll.api.v1.domain.PayrollPaymentPage;
 import io.mifos.payroll.domain.DomainObjectGenerator;
+import io.mifos.payroll.service.internal.repository.PayrollCollectionEntity;
 import io.mifos.payroll.service.internal.service.adaptor.AccountingAdaptor;
 import io.mifos.payroll.service.internal.service.adaptor.CustomerAdaptor;
 import org.apache.commons.lang3.RandomStringUtils;
@@ -70,6 +71,14 @@ public class TestPayrollDistribution extends AbstractPayrollTest {
         .doAnswer(invocation -> Optional.of(new Account()))
         .when(this.accountingAdaptorSpy).findAccount(Matchers.eq(payrollCollectionSheet.getSourceAccountNumber()));
 
+    Mockito
+        .doAnswer(invocation -> Optional.empty())
+        .when(this.accountingAdaptorSpy).postPayrollPayment(
+            Matchers.any(PayrollCollectionEntity.class),
+            Matchers.refEq(payrollPayment),
+            Matchers.any(PayrollConfiguration.class)
+        );
+
     super.testSubject.distribute(payrollCollectionSheet);
     Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_DISTRIBUTION, payrollCollectionSheet.getSourceAccountNumber()));
 
@@ -80,6 +89,9 @@ public class TestPayrollDistribution extends AbstractPayrollTest {
     final PayrollPaymentPage payrollPaymentPage =
         super.testSubject.fetchPayments(payrollCollectionHistory.getIdentifier(), 0, 10, null, null);
     Assert.assertEquals(Long.valueOf(1L), payrollPaymentPage.getTotalElements());
+
+    final PayrollPayment fetchedPayrollPayment = payrollPaymentPage.getPayrollPayments().get(0);
+    Assert.assertTrue(fetchedPayrollPayment.getProcessed());
   }
 
   private void prepareMocks(final String customerIdentifier, final PayrollConfiguration payrollConfiguration) {
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
index 43e954d..b5383bd 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollConfigurationAggregate.java
@@ -72,7 +72,6 @@ public class PayrollConfigurationAggregate {
     if (optionalPayrollConfiguration.isPresent()) {
       payrollConfigurationEntity = optionalPayrollConfiguration.get();
       this.payrollAllocationRepository.deleteByPayrollConfiguration(payrollConfigurationEntity);
-
       this.payrollAllocationRepository.flush();
 
       payrollConfigurationEntity.setLastModifiedBy(UserContextHolder.checkedGetUser());
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
index 86f4aae..93f9596 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/command/handler/PayrollDistributionAggregate.java
@@ -37,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.time.Clock;
 import java.time.LocalDateTime;
+import java.util.Optional;
 
 @Aggregate
 public class PayrollDistributionAggregate {
@@ -79,16 +80,22 @@ public class PayrollDistributionAggregate {
         this.payrollConfigurationService
             .findPayrollConfiguration(payrollPayment.getCustomerIdentifier())
             .ifPresent(payrollConfiguration -> {
-          final PayrollPaymentEntity payrollPaymentEntity = new PayrollPaymentEntity();
-          payrollPaymentEntity.setPayrollCollection(savedPayrollCollectionEntity);
-          payrollPaymentEntity.setCustomerIdentifier(payrollPayment.getCustomerIdentifier());
-          payrollPaymentEntity.setEmployer(payrollPayment.getEmployer());
-          payrollPaymentEntity.setSalary(payrollPayment.getSalary());
+              final PayrollPaymentEntity payrollPaymentEntity = new PayrollPaymentEntity();
+              payrollPaymentEntity.setPayrollCollection(savedPayrollCollectionEntity);
+              payrollPaymentEntity.setCustomerIdentifier(payrollPayment.getCustomerIdentifier());
+              payrollPaymentEntity.setEmployer(payrollPayment.getEmployer());
+              payrollPaymentEntity.setSalary(payrollPayment.getSalary());
 
-          this.payrollPaymentRepository.save(payrollPaymentEntity);
-
-          this.accountingAdaptor.postPayrollPayment(savedPayrollCollectionEntity, payrollPayment, payrollConfiguration);
-        })
+              final Optional<String> optionalErrorMessage =
+                  this.accountingAdaptor.postPayrollPayment(savedPayrollCollectionEntity, payrollPayment, payrollConfiguration);
+              if (optionalErrorMessage.isPresent()) {
+                payrollPaymentEntity.setMessage(optionalErrorMessage.get());
+                payrollPaymentEntity.setProcessed(Boolean.FALSE);
+              } else {
+                payrollPaymentEntity.setProcessed(Boolean.TRUE);
+              }
+              this.payrollPaymentRepository.save(payrollPaymentEntity);
+            })
     );
 
     return payrollCollectionSheet.getSourceAccountNumber();
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java
index fd7538a..738d8ed 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/mapper/PayrollPaymentMapper.java
@@ -29,6 +29,8 @@ public class PayrollPaymentMapper {
     payrollPayment.setCustomerIdentifier(payrollPaymentEntity.getCustomerIdentifier());
     payrollPayment.setEmployer(payrollPaymentEntity.getEmployer());
     payrollPayment.setSalary(payrollPaymentEntity.getSalary());
+    payrollPayment.setProcessed(payrollPaymentEntity.getProcessed());
+    payrollPayment.setMessage(payrollPaymentEntity.getMessage());
     return payrollPayment;
   }
 }
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java
index 3b782ed..c04dc8d 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/repository/PayrollPaymentEntity.java
@@ -42,6 +42,10 @@ public class PayrollPaymentEntity {
   private String employer;
   @Column(name = "salary", nullable = false, precision = 15, scale = 5)
   private BigDecimal salary;
+  @Column(name = "processed", nullable = false)
+  private Boolean processed;
+  @Column(name = "message", nullable = true)
+  private String message;
 
   public PayrollPaymentEntity() {
     super();
@@ -86,4 +90,20 @@ public class PayrollPaymentEntity {
   public void setSalary(final BigDecimal salary) {
     this.salary = salary;
   }
+
+  public Boolean getProcessed() {
+    return this.processed;
+  }
+
+  public void setProcessed(final Boolean processed) {
+    this.processed = processed;
+  }
+
+  public String getMessage() {
+    return this.message;
+  }
+
+  public void setMessage(final String message) {
+    this.message = message;
+  }
 }
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
index 41f19df..14aa326 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/AccountingAdaptor.java
@@ -57,14 +57,17 @@ public class AccountingAdaptor {
 
   public Optional<Account> findAccount(final String accountIdentifier) {
     try {
-      return Optional.of(this.ledgerManager.findAccount(accountIdentifier));
+      final Account account = this.ledgerManager.findAccount(accountIdentifier);
+      if (account.getState().equals(Account.State.OPEN.name())) {
+        return Optional.of(account);
+      }
     } catch (final AccountNotFoundException anfex) {
       this.logger.warn("Account {} not found.", accountIdentifier);
-      return Optional.empty();
     }
+    return Optional.empty();
   }
 
-  public void postPayrollPayment(final PayrollCollectionEntity payrollCollectionEntity,
+  public Optional<String> postPayrollPayment(final PayrollCollectionEntity payrollCollectionEntity,
                                  final PayrollPayment payrollPayment,
                                  final PayrollConfiguration payrollConfiguration) {
 
@@ -102,11 +105,23 @@ public class AccountingAdaptor {
     final BigDecimal currentCreditorSum =
         BigDecimal.valueOf(creditors.stream().mapToDouble(value -> Double.valueOf(value.getAmount())).sum());
 
-    final Creditor mainCreditor = new Creditor();
-    mainCreditor.setAccountNumber(payrollConfiguration.getMainAccountNumber());
-    mainCreditor.setAmount(payrollPayment.getSalary().subtract(currentCreditorSum).toString());
-    creditors.add(mainCreditor);
+    final int comparedValue = currentCreditorSum.compareTo(payrollPayment.getSalary());
+    if (comparedValue > 0) {
+      return Optional.of("Allocated amount would exceed posted salary.");
+    }
+    if (comparedValue < 0) {
+      final Creditor mainCreditor = new Creditor();
+      mainCreditor.setAccountNumber(payrollConfiguration.getMainAccountNumber());
+      mainCreditor.setAmount(payrollPayment.getSalary().subtract(currentCreditorSum).toString());
+      creditors.add(mainCreditor);
+    }
 
-    this.ledgerManager.createJournalEntry(journalEntry);
+    try {
+      this.ledgerManager.createJournalEntry(journalEntry);
+      return Optional.empty();
+    } catch (final Throwable th) {
+      this.logger.warn("Could not process journal entry for customer {}.", payrollPayment.getCustomerIdentifier(), th);
+      return Optional.of("Error while processing journal entry.");
+    }
   }
 }
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
index 9fd9d0c..dde236f 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/adaptor/CustomerAdaptor.java
@@ -42,10 +42,13 @@ public class CustomerAdaptor {
 
   public Optional<Customer> findCustomer(final String customerIdentifier) {
     try {
-      return Optional.of(this.customerManager.findCustomer(customerIdentifier));
+      final Customer customer = this.customerManager.findCustomer(customerIdentifier);
+      if (customer.getCurrentState().equals(Customer.State.ACTIVE.name())) {
+        return Optional.of(customer);
+      }
     } catch (final CustomerNotFoundException cnfex) {
       this.logger.warn("Customer {} not found.", customerIdentifier);
-      return Optional.empty();
     }
+    return Optional.empty();
   }
 }
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
index 100319d..70e3221 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
@@ -21,6 +21,7 @@ import io.mifos.anubis.annotation.Permittables;
 import io.mifos.core.command.gateway.CommandGateway;
 import io.mifos.core.lang.ServiceException;
 import io.mifos.payroll.api.v1.PermittableGroupIds;
+import io.mifos.payroll.api.v1.domain.PayrollAllocation;
 import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.service.ServiceConstants;
 import io.mifos.payroll.service.internal.command.PutPayrollConfigurationCommand;
@@ -38,6 +39,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.Set;
 
 @RestController
 @RequestMapping("/customers/{identifier}/payroll")
@@ -73,19 +75,25 @@ public class PayrollConfigurationRestController {
   public ResponseEntity<Void> setPayrollConfiguration(@PathVariable(value = "identifier") final String customerIdentifier,
                                                      @RequestBody @Valid final PayrollConfiguration payrollConfiguration) {
     this.payrollConfigurationService.findCustomer(customerIdentifier)
-        .orElseThrow(() -> ServiceException.notFound("Customer {0} not found.", customerIdentifier)
+        .orElseThrow(() -> ServiceException.notFound("Customer {0} not available.", customerIdentifier)
     );
 
     this.payrollConfigurationService.findAccount(payrollConfiguration.getMainAccountNumber())
-        .orElseThrow(() -> ServiceException.notFound("Main account {0} not found.", payrollConfiguration.getMainAccountNumber()));
+        .orElseThrow(() -> ServiceException.notFound("Main account {0} not available.", payrollConfiguration.getMainAccountNumber()));
 
-    if (payrollConfiguration.getPayrollAllocations() != null
-        && payrollConfiguration.getPayrollAllocations()
-        .stream()
-        .filter(payrollAllocation ->
-          !this.payrollConfigurationService.findAccount(payrollAllocation.getAccountNumber()).isPresent()
-        ).count() > 0L) {
-      throw ServiceException.notFound("Certain allocated accounts not found.");
+    if (payrollConfiguration.getPayrollAllocations() != null) {
+
+      final Set<PayrollAllocation> payrollAllocations = payrollConfiguration.getPayrollAllocations();
+
+      if (payrollAllocations.stream().anyMatch(payrollAllocation ->
+          payrollAllocation.getAccountNumber().equals(payrollConfiguration.getMainAccountNumber()))) {
+        throw ServiceException.conflict("Main account should not be used in allocations.");
+      }
+
+      if (payrollAllocations.stream().anyMatch(payrollAllocation ->
+          !this.payrollConfigurationService.findAccount(payrollAllocation.getAccountNumber()).isPresent())) {
+        throw ServiceException.notFound("Certain allocated accounts not available.");
+      }
     }
 
     this.commandGateway.process(new PutPayrollConfigurationCommand(customerIdentifier, payrollConfiguration));
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
index 86d3203..7a2a8ea 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/PayrollDistributionRestController.java
@@ -82,17 +82,12 @@ public class PayrollDistributionRestController {
   public ResponseEntity<Void> distribute(@RequestBody @Valid final PayrollCollectionSheet payrollCollectionSheet) {
 
     this.payrollConfigurationService.findAccount(payrollCollectionSheet.getSourceAccountNumber())
-        .orElseThrow(() -> ServiceException.notFound("Account {0} not found.", payrollCollectionSheet.getSourceAccountNumber()));
+        .orElseThrow(() -> ServiceException.notFound("Account {0} not available.", payrollCollectionSheet.getSourceAccountNumber()));
 
     if (payrollCollectionSheet.getPayrollPayments()
-        .stream()
-        .filter(
-            payrollPayment -> !this.payrollConfigurationService
-                .findPayrollConfiguration(payrollPayment.getCustomerIdentifier())
-                .isPresent()
-        )
-        .count() > 0L) {
-      throw ServiceException.conflict("Missing payroll configuration for certain customers.");
+        .stream().anyMatch(payrollPayment ->
+              !this.payrollConfigurationService.findPayrollConfiguration(payrollPayment.getCustomerIdentifier()).isPresent())) {
+      throw ServiceException.conflict("Payroll configuration for certain customers not available.");
     }
 
     this.commandGateway.process(new DistributePayrollCommand(payrollCollectionSheet));
diff --git a/service/src/main/resources/db/migrations/mariadb/V2__add_distribution_processing_behavior.sql b/service/src/main/resources/db/migrations/mariadb/V2__add_distribution_processing_behavior.sql
new file mode 100644
index 0000000..c7d1ab3
--- /dev/null
+++ b/service/src/main/resources/db/migrations/mariadb/V2__add_distribution_processing_behavior.sql
@@ -0,0 +1,18 @@
+--
+-- Copyright 2017 The Mifos Initiative.
+--
+-- Licensed 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.
+--
+
+ALTER TABLE meketre_payroll_payments ADD processed BOOLEAN NOT NULL;
+ALTER TABLE meketre_payroll_payments ADD message VARCHAR(256) NULL;
\ No newline at end of file


[fineract-cn-payroll] 26/50: fix for ATEN-480

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-payroll.git

commit 91bdfbf93ca07a6c20d6055487668f2a33ee4673
Author: mgeiss <mg...@mifos.org>
AuthorDate: Wed Oct 11 08:38:44 2017 +0200

    fix for ATEN-480
---
 .../io/mifos/payroll/api/v1/domain/PayrollConfiguration.java   | 10 +++++-----
 .../main/java/io/mifos/payroll/TestPayrollConfiguration.java   |  4 ++--
 .../java/io/mifos/payroll/domain/DomainObjectGenerator.java    |  4 ++--
 .../service/internal/service/PayrollConfigurationService.java  |  5 ++++-
 .../service/rest/PayrollConfigurationRestController.java       |  4 ++--
 5 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
index 5375a9a..ee4319f 100644
--- a/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
+++ b/api/src/main/java/io/mifos/payroll/api/v1/domain/PayrollConfiguration.java
@@ -18,15 +18,15 @@ package io.mifos.payroll.api.v1.domain;
 import io.mifos.core.lang.validation.constraints.ValidIdentifier;
 
 import javax.validation.Valid;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.List;
 
 public class PayrollConfiguration {
 
   @ValidIdentifier(maxLength = 34)
   private String mainAccountNumber;
   @Valid
-  private Set<PayrollAllocation> payrollAllocations = new HashSet<>();
+  private List<PayrollAllocation> payrollAllocations = new ArrayList<>();
   private String createdBy;
   private String createdOn;
   private String lastModifiedBy;
@@ -44,11 +44,11 @@ public class PayrollConfiguration {
     this.mainAccountNumber = mainAccountNumber;
   }
 
-  public Set<PayrollAllocation> getPayrollAllocations() {
+  public List<PayrollAllocation> getPayrollAllocations() {
     return this.payrollAllocations;
   }
 
-  public void setPayrollAllocations(final Set<PayrollAllocation> payrollAllocations) {
+  public void setPayrollAllocations(final List<PayrollAllocation> payrollAllocations) {
     this.payrollAllocations = payrollAllocations;
   }
 
diff --git a/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java b/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
index f2db0c4..3f7d8df 100644
--- a/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
+++ b/component-test/src/main/java/io/mifos/payroll/TestPayrollConfiguration.java
@@ -15,7 +15,7 @@
  */
 package io.mifos.payroll;
 
-import com.google.common.collect.Sets;
+import com.google.common.collect.Lists;
 import io.mifos.accounting.api.v1.domain.Account;
 import io.mifos.customer.api.v1.domain.Customer;
 import io.mifos.payroll.api.v1.EventConstants;
@@ -65,7 +65,7 @@ public class TestPayrollConfiguration extends AbstractPayrollTest {
     Assert.assertTrue(super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customerIdentifier));
 
     final PayrollAllocation newPayrollAllocation = new PayrollAllocation();
-    payrollConfiguration.setPayrollAllocations(Sets.newHashSet(newPayrollAllocation));
+    payrollConfiguration.setPayrollAllocations(Lists.newArrayList(newPayrollAllocation));
     newPayrollAllocation.setAccountNumber(RandomStringUtils.randomAlphanumeric(34));
     newPayrollAllocation.setAmount(BigDecimal.valueOf(15.00D));
     newPayrollAllocation.setProportional(Boolean.FALSE);
diff --git a/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java b/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java
index 389cde2..695b7df 100644
--- a/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java
+++ b/component-test/src/main/java/io/mifos/payroll/domain/DomainObjectGenerator.java
@@ -20,7 +20,7 @@ import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import org.apache.commons.lang3.RandomStringUtils;
 
 import java.math.BigDecimal;
-import java.util.HashSet;
+import java.util.ArrayList;
 
 public class DomainObjectGenerator {
 
@@ -32,7 +32,7 @@ public class DomainObjectGenerator {
     final PayrollConfiguration payrollConfiguration = new PayrollConfiguration();
     payrollConfiguration.setMainAccountNumber(RandomStringUtils.randomAlphanumeric(34));
 
-    final HashSet<PayrollAllocation> payrollAllocations = new HashSet<>();
+    final ArrayList<PayrollAllocation> payrollAllocations = new ArrayList<>();
     payrollConfiguration.setPayrollAllocations(payrollAllocations);
 
     final PayrollAllocation savingsAllocation = new PayrollAllocation();
diff --git a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
index eefeca3..34572dd 100644
--- a/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
+++ b/service/src/main/java/io/mifos/payroll/service/internal/service/PayrollConfigurationService.java
@@ -17,6 +17,7 @@ package io.mifos.payroll.service.internal.service;
 
 import io.mifos.accounting.api.v1.domain.Account;
 import io.mifos.customer.api.v1.domain.Customer;
+import io.mifos.payroll.api.v1.domain.PayrollAllocation;
 import io.mifos.payroll.api.v1.domain.PayrollConfiguration;
 import io.mifos.payroll.service.ServiceConstants;
 import io.mifos.payroll.service.internal.mapper.PayrollAllocationMapper;
@@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
+import java.util.Comparator;
 import java.util.Optional;
 import java.util.stream.Collectors;
 
@@ -74,7 +76,8 @@ public class PayrollConfigurationService {
               this.payrollAllocationRepository.findByPayrollConfiguration(payrollConfigurationEntity)
                   .stream()
                   .map(PayrollAllocationMapper::map)
-              .collect(Collectors.toSet())
+                  .sorted(Comparator.comparing(PayrollAllocation::getAccountNumber))
+              .collect(Collectors.toList())
           );
 
           return payrollConfiguration;
diff --git a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java b/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
index 70e3221..c8849a2 100644
--- a/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
+++ b/service/src/main/java/io/mifos/payroll/service/rest/PayrollConfigurationRestController.java
@@ -39,7 +39,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
-import java.util.Set;
+import java.util.List;
 
 @RestController
 @RequestMapping("/customers/{identifier}/payroll")
@@ -83,7 +83,7 @@ public class PayrollConfigurationRestController {
 
     if (payrollConfiguration.getPayrollAllocations() != null) {
 
-      final Set<PayrollAllocation> payrollAllocations = payrollConfiguration.getPayrollAllocations();
+      final List<PayrollAllocation> payrollAllocations = payrollConfiguration.getPayrollAllocations();
 
       if (payrollAllocations.stream().anyMatch(payrollAllocation ->
           payrollAllocation.getAccountNumber().equals(payrollConfiguration.getMainAccountNumber()))) {