Add payroll service
diff --git a/build.gradle b/build.gradle
index 1d5ef2a..da39c3e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -33,6 +33,7 @@
         mifosteller             : '0.1.0-BUILD-SNAPSHOT',
         mifosreporting          : '0.1.0-BUILD-SNAPSHOT',
         kuelapcheques           : '0.1.0-BUILD-SNAPSHOT',
+        mifospayroll            : '0.1.0-BUILD-SNAPSHOT',
         frameworkapi            : '0.1.0-BUILD-SNAPSHOT',
         frameworklang           : '0.1.0-BUILD-SNAPSHOT',
         frameworktest           : '0.1.0-BUILD-SNAPSHOT',
@@ -88,6 +89,7 @@
             [group: 'io.mifos.teller', name: 'api', version: versions.mifosteller],
             [group: 'io.mifos.reporting', name: 'api', version: versions.mifosreporting],
             [group: 'io.mifos.cheques', name: 'api', version: versions.kuelapcheques],
+            [group: 'io.mifos.payroll', name: 'api', version: versions.mifospayroll],
 
             [group: 'io.mifos.anubis', name: 'api', version: versions.frameworkanubis],
             [group: 'io.mifos.anubis', name: 'test', version: versions.frameworkanubis],
diff --git a/scripts/Unix/initial-setup.sh b/scripts/Unix/initial-setup.sh
index 2a66e0c..680afaa 100755
--- a/scripts/Unix/initial-setup.sh
+++ b/scripts/Unix/initial-setup.sh
@@ -251,6 +251,16 @@
 
 cd ..
 
+# REM initialize payroll
+git clone 'https://github.com/'$githubAccount'/payroll.git'
+cd payroll
+git remote add upstream https://github.com/mifosio/payroll.git
+git checkout develop
+chmod +x gradlew
+./gradlew publishToMavenLocal
+
+cd ..
+
 mkdir integration-tests
 cd integration-tests
 
diff --git a/scripts/Unix/pull-all.sh b/scripts/Unix/pull-all.sh
index 888884e..e28fc17 100644
--- a/scripts/Unix/pull-all.sh
+++ b/scripts/Unix/pull-all.sh
@@ -217,6 +217,15 @@
 git push origin develop 
 cd ..
 
+# REM pull payroll
+cd payroll
+git checkout develop
+git pull upstream develop
+chmod +x gradlew
+./gradlew publishToMavenLocal
+git push origin develop
+cd ..
+
 cd integration-tests
 
 # REM pull service-starter
diff --git a/scripts/windows/initial-setup.bat b/scripts/windows/initial-setup.bat
index 3d1c727..70ef91b 100644
--- a/scripts/windows/initial-setup.bat
+++ b/scripts/windows/initial-setup.bat
@@ -230,6 +230,15 @@
 TIMEOUT /T 5
 cd ..
 
+REM initialze payroll
+git clone https://github.com/%githubAccount%/payroll.git
+cd payroll
+git remote add upstream https://github.com/mifosio/payroll.git
+git checkout develop
+CALL gradlew publishToMavenLocal
+TIMEOUT /T 5
+cd ..
+
 mkdir integration-tests
 cd integration-tests
 
diff --git a/scripts/windows/pull-all.bat b/scripts/windows/pull-all.bat
index d6475a5..f2597b6 100644
--- a/scripts/windows/pull-all.bat
+++ b/scripts/windows/pull-all.bat
@@ -215,6 +215,15 @@
 TIMEOUT /T 5
 cd ..
 
+REM pull payroll
+cd payroll
+git checkout develop
+git pull upstream develop
+CALL gradlew publishToMavenLocal
+git push origin develop
+TIMEOUT /T 5
+cd ..
+
 cd integration-tests
 
 REM pull service-starter
diff --git a/src/main/java/io/mifos/dev/ServiceRunner.java b/src/main/java/io/mifos/dev/ServiceRunner.java
index 32a7b67..5e60a42 100644
--- a/src/main/java/io/mifos/dev/ServiceRunner.java
+++ b/src/main/java/io/mifos/dev/ServiceRunner.java
@@ -48,6 +48,7 @@
 import io.mifos.identity.api.v1.events.ApplicationSignatureEvent;
 import io.mifos.identity.api.v1.events.EventConstants;
 import io.mifos.office.api.v1.client.OrganizationManager;
+import io.mifos.payroll.api.v1.client.PayrollManager;
 import io.mifos.portfolio.api.v1.client.PortfolioManager;
 import io.mifos.provisioner.api.v1.client.Provisioner;
 import io.mifos.provisioner.api.v1.domain.*;
@@ -104,6 +105,7 @@
   private static Microservice<TellerManager> tellerManager;
   private static Microservice<ReportManager> reportManager;
   private static Microservice<ChequeManager> chequeManager;
+  private static Microservice<PayrollManager> payrollManager;
 
 
   private static DB embeddedMariaDb;
@@ -226,10 +228,14 @@
 
     ServiceRunner.chequeManager = new Microservice<>(ChequeManager.class, "cheques", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
     startService(generalProperties, ServiceRunner.chequeManager);
+
+    ServiceRunner.payrollManager = new Microservice<>(PayrollManager.class, "payroll", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
+    startService(generalProperties, ServiceRunner.payrollManager);
   }
 
   @After
   public void tearDown() throws Exception {
+    ServiceRunner.payrollManager.kill();
     ServiceRunner.chequeManager.kill();
     ServiceRunner.reportManager.kill();
     ServiceRunner.tellerManager.kill();
@@ -269,6 +275,7 @@
     System.out.println("Teller Service: " + ServiceRunner.tellerManager.getProcessEnvironment().serverURI());
     System.out.println("Reporting Service: " + ServiceRunner.reportManager.getProcessEnvironment().serverURI());
     System.out.println("Cheque Service: " + ServiceRunner.chequeManager.getProcessEnvironment().serverURI());
+    System.out.println("Payroll Service: " + ServiceRunner.payrollManager.getProcessEnvironment().serverURI());
 
     boolean run = true;
 
@@ -330,7 +337,8 @@
             ApplicationBuilder.create(ServiceRunner.depositAccountManager.name(), ServiceRunner.depositAccountManager.uri()),
             ApplicationBuilder.create(ServiceRunner.tellerManager.name(), ServiceRunner.tellerManager.uri()),
             ApplicationBuilder.create(ServiceRunner.reportManager.name(), ServiceRunner.reportManager.uri()),
-            ApplicationBuilder.create(ServiceRunner.chequeManager.name(), ServiceRunner.chequeManager.uri())
+            ApplicationBuilder.create(ServiceRunner.chequeManager.name(), ServiceRunner.chequeManager.uri()),
+            ApplicationBuilder.create(ServiceRunner.payrollManager.name(), ServiceRunner.payrollManager.uri())
     );
 
     final List<Tenant> tenantsToCreate = Arrays.asList(
@@ -431,6 +439,8 @@
 
       provisionApp(tenant, ServiceRunner.chequeManager, io.mifos.cheque.api.v1.EventConstants.INITIALIZE);
 
+      provisionApp(tenant, ServiceRunner.payrollManager, io.mifos.payroll.api.v1.EventConstants.INITIALIZE);
+
       final UserWithPassword orgAdminUserPassword = createOrgAdminRoleAndUser(tenantAdminPassword.getAdminPassword());
 
       createChartOfAccounts(orgAdminUserPassword);
diff --git a/src/main/java/io/mifos/dev/listener/PayrollListener.java b/src/main/java/io/mifos/dev/listener/PayrollListener.java
new file mode 100644
index 0000000..a9174b5
--- /dev/null
+++ b/src/main/java/io/mifos/dev/listener/PayrollListener.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016 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.dev.listener;
+
+import io.mifos.core.lang.config.TenantHeaderFilter;
+import io.mifos.core.test.listener.EventRecorder;
+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;
+import org.springframework.stereotype.Component;
+
+@SuppressWarnings("unused")
+@Component
+public class PayrollListener {
+  private final EventRecorder eventRecorder;
+
+  @Autowired
+  public PayrollListener(final EventRecorder eventRecorder) {
+    this.eventRecorder = eventRecorder;
+  }
+
+  @JmsListener(
+          subscription = EventConstants.DESTINATION,
+          destination = EventConstants.DESTINATION,
+          selector = EventConstants.SELECTOR_INITIALIZE
+  )
+  public void onInitialized(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+                            final String payload) {
+    this.eventRecorder.event(tenant, EventConstants.INITIALIZE, payload, String.class);
+  }
+}