From 3e388f7bc4b928eb0ff6541fdb96e61617ea4910 Mon Sep 17 00:00:00 2001
From: Andy Summers <andrew.summers@wisc.edu>
Date: Fri, 19 May 2017 14:57:53 -0500
Subject: [PATCH] Add `ExternalCustomerService` for external (e.g. parent)
 customers

---
 composer.json                                 |   2 +-
 .../external_customer/ExternalCustomer.php    | 179 +++++++++++++++
 .../ExternalCustomerInputParametersMapper.php |  39 ++++
 .../ExternalCustomerService.php               |  17 ++
 .../ExternalCustomerServiceResponse.php       |  52 +++++
 .../MockExternalCustomerService.php           |  39 ++++
 .../SoapExternalCustomerService.php           |  61 +++++
 .../DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service.php |  46 ++++
 .../generated/InputParameters.php             | 214 ++++++++++++++++++
 .../generated/OutputParameters.php            |  89 ++++++++
 .../external_customer/generated/SOAHeader.php | 139 ++++++++++++
 .../external_customer/generated/autoload.php  |  21 ++
 .../doit_soa_external_customer_v2.xml         |   1 +
 .../MockExternalCustomerServiceTest.php       |  36 +++
 .../SoapExternalCustomerIT.php                |  34 +++
 15 files changed, 968 insertions(+), 1 deletion(-)
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/ExternalCustomer.php
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerInputParametersMapper.php
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerService.php
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerServiceResponse.php
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/MockExternalCustomerService.php
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/SoapExternalCustomerService.php
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/generated/DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service.php
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/generated/InputParameters.php
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/generated/OutputParameters.php
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/generated/SOAHeader.php
 create mode 100644 src/main/edu/wisc/services/cbs/external_customer/generated/autoload.php
 create mode 100644 src/main/resources/doit_soa_external_customer_v2.xml
 create mode 100644 src/test/edu/wisc/services/cbs/external_customer/MockExternalCustomerServiceTest.php
 create mode 100644 src/test/edu/wisc/services/cbs/external_customer/SoapExternalCustomerIT.php

diff --git a/composer.json b/composer.json
index cfc89fd..c5495df 100755
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
 {
   "name": "adi-ia/cbs-techstore-client-php",
   "description": "A PHP client used to connect with the CBS API and perform requests",
-  "version": "6.0.0",
+  "version": "6.1.0",
   "license": "Apache-2.0",
   "homepage": "https://wiki.doit.wisc.edu/confluence/display/ADIIA/CBS",
   "authors": [
diff --git a/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomer.php b/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomer.php
new file mode 100644
index 0000000..9652e6b
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomer.php
@@ -0,0 +1,179 @@
+<?php
+
+namespace edu\wisc\services\cbs\external_customer;
+
+/**
+ * ExternalCustomer represents an external customer, for example, a Parent
+ */
+class ExternalCustomer
+{
+
+    /** @var string */
+    private $customerType;
+
+    /** @var string */
+    private $customerIdentifier;
+
+    /** @var string */
+    private $firstName;
+
+    /** @var string */
+    private $lastName;
+
+    /** @var string */
+    private $email;
+
+    /** @var string */
+    private $phone;
+
+    /** @var string */
+    private $reference;
+
+    /** @var string */
+    private $testMode;
+
+    /**
+     * @return string
+     */
+    public function getCustomerType()
+    {
+        return $this->customerType;
+    }
+
+    /**
+     * @param string $customerType
+     * @return ExternalCustomer
+     */
+    public function setCustomerType($customerType)
+    {
+        $this->customerType = $customerType;
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCustomerIdentifier()
+    {
+        return $this->customerIdentifier;
+    }
+
+    /**
+     * @param string $customerIdentifier
+     * @return ExternalCustomer
+     */
+    public function setCustomerIdentifier($customerIdentifier)
+    {
+        $this->customerIdentifier = $customerIdentifier;
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getFirstName()
+    {
+        return $this->firstName;
+    }
+
+    /**
+     * @param string $firstName
+     * @return ExternalCustomer
+     */
+    public function setFirstName($firstName)
+    {
+        $this->firstName = $firstName;
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getLastName()
+    {
+        return $this->lastName;
+    }
+
+    /**
+     * @param string $lastName
+     * @return ExternalCustomer
+     */
+    public function setLastName($lastName)
+    {
+        $this->lastName = $lastName;
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getEmail()
+    {
+        return $this->email;
+    }
+
+    /**
+     * @param string $email
+     * @return ExternalCustomer
+     */
+    public function setEmail($email)
+    {
+        $this->email = $email;
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getPhone()
+    {
+        return $this->phone;
+    }
+
+    /**
+     * @param string $phone
+     * @return ExternalCustomer
+     */
+    public function setPhone($phone)
+    {
+        $this->phone = $phone;
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getReference()
+    {
+        return $this->reference;
+    }
+
+    /**
+     * @param string $reference
+     * @return ExternalCustomer
+     */
+    public function setReference($reference)
+    {
+        $this->reference = $reference;
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getTestMode()
+    {
+        return $this->testMode;
+    }
+
+    /**
+     * @param string $testMode
+     * @return ExternalCustomer
+     */
+    public function setTestMode($testMode)
+    {
+        $this->testMode = $testMode;
+        return $this;
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerInputParametersMapper.php b/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerInputParametersMapper.php
new file mode 100644
index 0000000..0ae98e6
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerInputParametersMapper.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace edu\wisc\services\cbs\external_customer;
+
+use edu\wisc\services\cbs\external_customer\generated\InputParameters;
+
+/**
+ * Maps an {@link ExternalCustomer} to an {@link InputParameters}
+ */
+class ExternalCustomerInputParametersMapper
+{
+
+    /**
+     * Maps an {@link ExternalCustomer} to {@link InputParameters}
+     * @param ExternalCustomer $customer
+     * @return InputParameters
+     */
+    public static function toInputParameters(ExternalCustomer $customer)
+    {
+        return (new InputParameters(
+            '',
+            '',
+            '',
+            '',
+            '',
+            '',
+            '',
+            ''
+        ))
+            ->setP_CUSTOMER_TYPE($customer->getCustomerType())
+            ->setP_CUSTOMER_IDENTIFIER($customer->getCustomerIdentifier())
+            ->setP_FIRST_NAME($customer->getFirstName())
+            ->setP_LAST_NAME($customer->getLastName())
+            ->setP_PHONE($customer->getPhone())
+            ->setP_REFERENCE($customer->getReference())
+            ->setP_TEST_MODE($customer->getTestMode());
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerService.php b/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerService.php
new file mode 100644
index 0000000..1f45a8f
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerService.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace edu\wisc\services\cbs\external_customer;
+
+/**
+ * Service intended to create external customers (e.g. Parents) in CBS
+ */
+interface ExternalCustomerService
+{
+
+    /**
+     * @param ExternalCustomer $customer
+     * @return mixed
+     */
+    public function createCustomer(ExternalCustomer $customer);
+
+}
\ No newline at end of file
diff --git a/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerServiceResponse.php b/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerServiceResponse.php
new file mode 100644
index 0000000..9111e2d
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/ExternalCustomerServiceResponse.php
@@ -0,0 +1,52 @@
+<?php
+
+namespace edu\wisc\services\cbs\external_customer;
+
+use edu\wisc\services\cbs\common\AbstractServiceResponse;
+
+/**
+ * Represents a response from a {@link ExternalCustomerService}
+ */
+class ExternalCustomerServiceResponse extends AbstractServiceResponse
+{
+
+    /** @var string */
+    private $customerNumber;
+
+    /** @var string */
+    private $status;
+
+    /** @var string */
+    private $resultMessage;
+
+    public function __construct($status, $resultMessage, $customerNumber)
+    {
+        parent::__construct($status, $resultMessage);
+        $this->customerNumber = $customerNumber;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCustomerNumber()
+    {
+        return $this->customerNumber;
+    }
+
+    /**
+     * @return string
+     */
+    public function getStatus()
+    {
+        return $this->status;
+    }
+
+    /**
+     * @return string
+     */
+    public function getResultMessage()
+    {
+        return $this->resultMessage;
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/edu/wisc/services/cbs/external_customer/MockExternalCustomerService.php b/src/main/edu/wisc/services/cbs/external_customer/MockExternalCustomerService.php
new file mode 100644
index 0000000..3e7fb05
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/MockExternalCustomerService.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace edu\wisc\services\cbs\external_customer;
+
+/**
+ * Mock implementation of {@link ExternalCustomerService}
+ */
+class MockExternalCustomerService implements ExternalCustomerService
+{
+
+    /** @var ExternalCustomerServiceResponse */
+    private $response;
+
+    /**
+     * MockExternalCustomerService constructor.
+     * @param ExternalCustomerServiceResponse|null $response
+     */
+    public function __construct(ExternalCustomerServiceResponse $response = null)
+    {
+        if ($response !== null) {
+            $this->response = $response;
+        } else {
+            $this->response = new ExternalCustomerServiceResponse(
+                true,
+                'MockExternalCustomerServiceResponse',
+                '123456789'
+            );
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function createCustomer(ExternalCustomer $customer)
+    {
+        return $this->response;
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/edu/wisc/services/cbs/external_customer/SoapExternalCustomerService.php b/src/main/edu/wisc/services/cbs/external_customer/SoapExternalCustomerService.php
new file mode 100644
index 0000000..51440a4
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/SoapExternalCustomerService.php
@@ -0,0 +1,61 @@
+<?php
+
+namespace edu\wisc\services\cbs\external_customer;
+
+use edu\wisc\services\cbs\api\SoapService;
+use edu\wisc\services\cbs\common\WssSoapHeaderBuilder;
+use edu\wisc\services\cbs\external_customer\generated\DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service;
+
+/**
+ * SOAP backed implementation of {@link ExternalCustomerService}
+ */
+class SoapExternalCustomerService implements SoapService, ExternalCustomerService
+{
+
+    /** URL for QA WSDL */
+    const CBQA12 = 'http://pegasus.doit.wisc.edu:8018/webservices/SOAProvider/plsql/doit_soa_external_customer_v2/?wsdl';
+    /** URL for DV WSDL */
+    const CBDV12 = 'http://pegasus.doit.wisc.edu:8016/webservices/SOAProvider/plsql/doit_soa_external_customer_v2/?wsdl';
+
+    /** @var DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service */
+    private $soapClient;
+
+    /**
+     * {@inheritdoc}
+     */
+    public function __construct($username, $password, $wsdlPath = null, \SoapClient $externalCustomerSoapClient = null)
+    {
+        if ($externalCustomerSoapClient !== null) {
+            $this->soapClient = $externalCustomerSoapClient;
+            return;
+        } else if ($wsdlPath !== null) {
+            $this->soapClient = new DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service(
+                [],
+                $wsdlPath
+            );
+            $this->soapClient->__setSoapHeaders(WssSoapHeaderBuilder::buildUsernameToken($username, $password));
+        } else {
+            $this->soapClient = new DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service(
+                [],
+                __DIR__ . '/../../../../../resources/doit_soa_external_customer_v2.xml'
+            );
+            $this->soapClient->__setSoapHeaders(WssSoapHeaderBuilder::buildUsernameToken($username, $password));
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function createCustomer(ExternalCustomer $customer)
+    {
+        $outputParameters = $this->soapClient->CREATE_CUSTOMER(
+            ExternalCustomerInputParametersMapper::toInputParameters($customer)
+        );
+        return new ExternalCustomerServiceResponse(
+            strcasecmp($outputParameters->getP_STATUS(), 'SUCCESS') === 0,
+            $outputParameters->getP_RESULT_MESSAGE(),
+            $outputParameters->getP_CUSTOMER_NUMBER()
+        );
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/edu/wisc/services/cbs/external_customer/generated/DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service.php b/src/main/edu/wisc/services/cbs/external_customer/generated/DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service.php
new file mode 100644
index 0000000..229e71e
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/generated/DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service.php
@@ -0,0 +1,46 @@
+<?php
+
+namespace edu\wisc\services\cbs\external_customer\generated;
+
+class DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service extends \SoapClient
+{
+
+    /**
+     * @var array $classmap The defined classes
+     */
+    private static $classmap = array (
+      'InputParameters' => 'edu\\wisc\\services\\cbs\\external_customer\\generated\\InputParameters',
+      'OutputParameters' => 'edu\\wisc\\services\\cbs\\external_customer\\generated\\OutputParameters',
+      'SOAHeader' => 'edu\\wisc\\services\\cbs\\external_customer\\generated\\SOAHeader',
+    );
+
+    /**
+     * @param array $options A array of config values
+     * @param string $wsdl The wsdl file to use
+     */
+    public function __construct(array $options = array(), $wsdl = null)
+    {
+      foreach (self::$classmap as $key => $value) {
+        if (!isset($options['classmap'][$key])) {
+          $options['classmap'][$key] = $value;
+        }
+      }
+      $options = array_merge(array (
+      'features' => 1,
+    ), $options);
+      if (!$wsdl) {
+        $wsdl = 'src/main/resources/doit_soa_external_customer_v2.xml';
+      }
+      parent::__construct($wsdl, $options);
+    }
+
+    /**
+     * @param InputParameters $body
+     * @return OutputParameters
+     */
+    public function CREATE_CUSTOMER(InputParameters $body)
+    {
+      return $this->__soapCall('CREATE_CUSTOMER', array($body));
+    }
+
+}
diff --git a/src/main/edu/wisc/services/cbs/external_customer/generated/InputParameters.php b/src/main/edu/wisc/services/cbs/external_customer/generated/InputParameters.php
new file mode 100644
index 0000000..12f0f5b
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/generated/InputParameters.php
@@ -0,0 +1,214 @@
+<?php
+
+namespace edu\wisc\services\cbs\external_customer\generated;
+
+class InputParameters
+{
+
+    /**
+     * @var string $P_CUSTOMER_TYPE
+     */
+    protected $P_CUSTOMER_TYPE = null;
+
+    /**
+     * @var string $P_CUSTOMER_IDENTIFIER
+     */
+    protected $P_CUSTOMER_IDENTIFIER = null;
+
+    /**
+     * @var string $P_FIRST_NAME
+     */
+    protected $P_FIRST_NAME = null;
+
+    /**
+     * @var string $P_LAST_NAME
+     */
+    protected $P_LAST_NAME = null;
+
+    /**
+     * @var string $P_EMAIL
+     */
+    protected $P_EMAIL = null;
+
+    /**
+     * @var string $P_PHONE
+     */
+    protected $P_PHONE = null;
+
+    /**
+     * @var string $P_REFERENCE
+     */
+    protected $P_REFERENCE = null;
+
+    /**
+     * @var string $P_TEST_MODE
+     */
+    protected $P_TEST_MODE = null;
+
+    /**
+     * @param string $P_CUSTOMER_TYPE
+     * @param string $P_CUSTOMER_IDENTIFIER
+     * @param string $P_FIRST_NAME
+     * @param string $P_LAST_NAME
+     * @param string $P_EMAIL
+     * @param string $P_PHONE
+     * @param string $P_REFERENCE
+     * @param string $P_TEST_MODE
+     */
+    public function __construct($P_CUSTOMER_TYPE, $P_CUSTOMER_IDENTIFIER, $P_FIRST_NAME, $P_LAST_NAME, $P_EMAIL, $P_PHONE, $P_REFERENCE, $P_TEST_MODE)
+    {
+      $this->P_CUSTOMER_TYPE = $P_CUSTOMER_TYPE;
+      $this->P_CUSTOMER_IDENTIFIER = $P_CUSTOMER_IDENTIFIER;
+      $this->P_FIRST_NAME = $P_FIRST_NAME;
+      $this->P_LAST_NAME = $P_LAST_NAME;
+      $this->P_EMAIL = $P_EMAIL;
+      $this->P_PHONE = $P_PHONE;
+      $this->P_REFERENCE = $P_REFERENCE;
+      $this->P_TEST_MODE = $P_TEST_MODE;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_CUSTOMER_TYPE()
+    {
+      return $this->P_CUSTOMER_TYPE;
+    }
+
+    /**
+     * @param string $P_CUSTOMER_TYPE
+     * @return \edu\wisc\services\cbs\external_customer\generated\InputParameters
+     */
+    public function setP_CUSTOMER_TYPE($P_CUSTOMER_TYPE)
+    {
+      $this->P_CUSTOMER_TYPE = $P_CUSTOMER_TYPE;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_CUSTOMER_IDENTIFIER()
+    {
+      return $this->P_CUSTOMER_IDENTIFIER;
+    }
+
+    /**
+     * @param string $P_CUSTOMER_IDENTIFIER
+     * @return \edu\wisc\services\cbs\external_customer\generated\InputParameters
+     */
+    public function setP_CUSTOMER_IDENTIFIER($P_CUSTOMER_IDENTIFIER)
+    {
+      $this->P_CUSTOMER_IDENTIFIER = $P_CUSTOMER_IDENTIFIER;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_FIRST_NAME()
+    {
+      return $this->P_FIRST_NAME;
+    }
+
+    /**
+     * @param string $P_FIRST_NAME
+     * @return \edu\wisc\services\cbs\external_customer\generated\InputParameters
+     */
+    public function setP_FIRST_NAME($P_FIRST_NAME)
+    {
+      $this->P_FIRST_NAME = $P_FIRST_NAME;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_LAST_NAME()
+    {
+      return $this->P_LAST_NAME;
+    }
+
+    /**
+     * @param string $P_LAST_NAME
+     * @return \edu\wisc\services\cbs\external_customer\generated\InputParameters
+     */
+    public function setP_LAST_NAME($P_LAST_NAME)
+    {
+      $this->P_LAST_NAME = $P_LAST_NAME;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_EMAIL()
+    {
+      return $this->P_EMAIL;
+    }
+
+    /**
+     * @param string $P_EMAIL
+     * @return \edu\wisc\services\cbs\external_customer\generated\InputParameters
+     */
+    public function setP_EMAIL($P_EMAIL)
+    {
+      $this->P_EMAIL = $P_EMAIL;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_PHONE()
+    {
+      return $this->P_PHONE;
+    }
+
+    /**
+     * @param string $P_PHONE
+     * @return \edu\wisc\services\cbs\external_customer\generated\InputParameters
+     */
+    public function setP_PHONE($P_PHONE)
+    {
+      $this->P_PHONE = $P_PHONE;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_REFERENCE()
+    {
+      return $this->P_REFERENCE;
+    }
+
+    /**
+     * @param string $P_REFERENCE
+     * @return \edu\wisc\services\cbs\external_customer\generated\InputParameters
+     */
+    public function setP_REFERENCE($P_REFERENCE)
+    {
+      $this->P_REFERENCE = $P_REFERENCE;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_TEST_MODE()
+    {
+      return $this->P_TEST_MODE;
+    }
+
+    /**
+     * @param string $P_TEST_MODE
+     * @return \edu\wisc\services\cbs\external_customer\generated\InputParameters
+     */
+    public function setP_TEST_MODE($P_TEST_MODE)
+    {
+      $this->P_TEST_MODE = $P_TEST_MODE;
+      return $this;
+    }
+
+}
diff --git a/src/main/edu/wisc/services/cbs/external_customer/generated/OutputParameters.php b/src/main/edu/wisc/services/cbs/external_customer/generated/OutputParameters.php
new file mode 100644
index 0000000..b5de363
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/generated/OutputParameters.php
@@ -0,0 +1,89 @@
+<?php
+
+namespace edu\wisc\services\cbs\external_customer\generated;
+
+class OutputParameters
+{
+
+    /**
+     * @var string $P_CUSTOMER_NUMBER
+     */
+    protected $P_CUSTOMER_NUMBER = null;
+
+    /**
+     * @var string $P_STATUS
+     */
+    protected $P_STATUS = null;
+
+    /**
+     * @var string $P_RESULT_MESSAGE
+     */
+    protected $P_RESULT_MESSAGE = null;
+
+    /**
+     * @param string $P_CUSTOMER_NUMBER
+     * @param string $P_STATUS
+     * @param string $P_RESULT_MESSAGE
+     */
+    public function __construct($P_CUSTOMER_NUMBER, $P_STATUS, $P_RESULT_MESSAGE)
+    {
+      $this->P_CUSTOMER_NUMBER = $P_CUSTOMER_NUMBER;
+      $this->P_STATUS = $P_STATUS;
+      $this->P_RESULT_MESSAGE = $P_RESULT_MESSAGE;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_CUSTOMER_NUMBER()
+    {
+      return $this->P_CUSTOMER_NUMBER;
+    }
+
+    /**
+     * @param string $P_CUSTOMER_NUMBER
+     * @return \edu\wisc\services\cbs\external_customer\generated\OutputParameters
+     */
+    public function setP_CUSTOMER_NUMBER($P_CUSTOMER_NUMBER)
+    {
+      $this->P_CUSTOMER_NUMBER = $P_CUSTOMER_NUMBER;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_STATUS()
+    {
+      return $this->P_STATUS;
+    }
+
+    /**
+     * @param string $P_STATUS
+     * @return \edu\wisc\services\cbs\external_customer\generated\OutputParameters
+     */
+    public function setP_STATUS($P_STATUS)
+    {
+      $this->P_STATUS = $P_STATUS;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getP_RESULT_MESSAGE()
+    {
+      return $this->P_RESULT_MESSAGE;
+    }
+
+    /**
+     * @param string $P_RESULT_MESSAGE
+     * @return \edu\wisc\services\cbs\external_customer\generated\OutputParameters
+     */
+    public function setP_RESULT_MESSAGE($P_RESULT_MESSAGE)
+    {
+      $this->P_RESULT_MESSAGE = $P_RESULT_MESSAGE;
+      return $this;
+    }
+
+}
diff --git a/src/main/edu/wisc/services/cbs/external_customer/generated/SOAHeader.php b/src/main/edu/wisc/services/cbs/external_customer/generated/SOAHeader.php
new file mode 100644
index 0000000..2bd9b14
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/generated/SOAHeader.php
@@ -0,0 +1,139 @@
+<?php
+
+namespace edu\wisc\services\cbs\external_customer\generated;
+
+class SOAHeader
+{
+
+    /**
+     * @var string $Responsibility
+     */
+    protected $Responsibility = null;
+
+    /**
+     * @var string $RespApplication
+     */
+    protected $RespApplication = null;
+
+    /**
+     * @var string $SecurityGroup
+     */
+    protected $SecurityGroup = null;
+
+    /**
+     * @var string $NLSLanguage
+     */
+    protected $NLSLanguage = null;
+
+    /**
+     * @var string $Org_Id
+     */
+    protected $Org_Id = null;
+
+    /**
+     * @param string $Responsibility
+     * @param string $RespApplication
+     * @param string $SecurityGroup
+     * @param string $NLSLanguage
+     * @param string $Org_Id
+     */
+    public function __construct($Responsibility, $RespApplication, $SecurityGroup, $NLSLanguage, $Org_Id)
+    {
+      $this->Responsibility = $Responsibility;
+      $this->RespApplication = $RespApplication;
+      $this->SecurityGroup = $SecurityGroup;
+      $this->NLSLanguage = $NLSLanguage;
+      $this->Org_Id = $Org_Id;
+    }
+
+    /**
+     * @return string
+     */
+    public function getResponsibility()
+    {
+      return $this->Responsibility;
+    }
+
+    /**
+     * @param string $Responsibility
+     * @return \edu\wisc\services\cbs\external_customer\generated\SOAHeader
+     */
+    public function setResponsibility($Responsibility)
+    {
+      $this->Responsibility = $Responsibility;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRespApplication()
+    {
+      return $this->RespApplication;
+    }
+
+    /**
+     * @param string $RespApplication
+     * @return \edu\wisc\services\cbs\external_customer\generated\SOAHeader
+     */
+    public function setRespApplication($RespApplication)
+    {
+      $this->RespApplication = $RespApplication;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getSecurityGroup()
+    {
+      return $this->SecurityGroup;
+    }
+
+    /**
+     * @param string $SecurityGroup
+     * @return \edu\wisc\services\cbs\external_customer\generated\SOAHeader
+     */
+    public function setSecurityGroup($SecurityGroup)
+    {
+      $this->SecurityGroup = $SecurityGroup;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getNLSLanguage()
+    {
+      return $this->NLSLanguage;
+    }
+
+    /**
+     * @param string $NLSLanguage
+     * @return \edu\wisc\services\cbs\external_customer\generated\SOAHeader
+     */
+    public function setNLSLanguage($NLSLanguage)
+    {
+      $this->NLSLanguage = $NLSLanguage;
+      return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getOrg_Id()
+    {
+      return $this->Org_Id;
+    }
+
+    /**
+     * @param string $Org_Id
+     * @return \edu\wisc\services\cbs\external_customer\generated\SOAHeader
+     */
+    public function setOrg_Id($Org_Id)
+    {
+      $this->Org_Id = $Org_Id;
+      return $this;
+    }
+
+}
diff --git a/src/main/edu/wisc/services/cbs/external_customer/generated/autoload.php b/src/main/edu/wisc/services/cbs/external_customer/generated/autoload.php
new file mode 100644
index 0000000..677fa56
--- /dev/null
+++ b/src/main/edu/wisc/services/cbs/external_customer/generated/autoload.php
@@ -0,0 +1,21 @@
+<?php
+
+
+ function autoload_d7fc76be4a5fe70046e6a183474348b6($class)
+{
+    $classes = array(
+        'edu\wisc\services\cbs\external_customer\generated\DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service' => __DIR__ .'/DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service.php',
+        'edu\wisc\services\cbs\external_customer\generated\InputParameters' => __DIR__ .'/InputParameters.php',
+        'edu\wisc\services\cbs\external_customer\generated\OutputParameters' => __DIR__ .'/OutputParameters.php',
+        'edu\wisc\services\cbs\external_customer\generated\SOAHeader' => __DIR__ .'/SOAHeader.php'
+    );
+    if (!empty($classes[$class])) {
+        include $classes[$class];
+    };
+}
+
+spl_autoload_register('autoload_d7fc76be4a5fe70046e6a183474348b6');
+
+// Do nothing. The rest is just leftovers from the code generation.
+{
+}
diff --git a/src/main/resources/doit_soa_external_customer_v2.xml b/src/main/resources/doit_soa_external_customer_v2.xml
new file mode 100644
index 0000000..016d4c1
--- /dev/null
+++ b/src/main/resources/doit_soa_external_customer_v2.xml
@@ -0,0 +1 @@
+<?xml version = '1.0' encoding = 'UTF-8'?><definitions name="DOIT_SOA_EXTERNAL_CUSTOMER_V2" targetNamespace="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/doit_soa_external_customer_v2/" xmlns:tns="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/doit_soa_external_customer_v2/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns1="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/doit_soa_external_customer_v2/create_customer/">   <types>      <schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/doit_soa_external_customer_v2/create_customer/">         <include schemaLocation="http://pegasus.doit.wisc.edu:8018/webservices/SOAProvider/plsql/doit_soa_external_customer_v2/APPS_DOIT_SOA_EXTERNAL_CUSTOMER_V2_CREATE_CUSTOMER.xsd"/>      </schema>      <schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/doit_soa_external_customer_v2/">         <element name="SOAHeader">            <complexType>               <sequence>                  <element name="Responsibility" minOccurs="0" type="string"/>                  <element name="RespApplication" minOccurs="0" type="string"/>                  <element name="SecurityGroup" minOccurs="0" type="string"/>                  <element name="NLSLanguage" minOccurs="0" type="string"/>                  <element name="Org_Id" minOccurs="0" type="string"/>               </sequence>            </complexType>         </element>      </schema>   </types>   <message name="CREATE_CUSTOMER_Input_Msg">      <part name="header" element="tns:SOAHeader"/>      <part name="body" element="tns1:InputParameters"/>   </message>   <message name="CREATE_CUSTOMER_Output_Msg">      <part name="body" element="tns1:OutputParameters"/>   </message>   <portType name="DOIT_SOA_EXTERNAL_CUSTOMER_V2_PortType">      <operation name="CREATE_CUSTOMER">         <input message="tns:CREATE_CUSTOMER_Input_Msg"/>         <output message="tns:CREATE_CUSTOMER_Output_Msg"/>      </operation>   </portType>   <binding name="DOIT_SOA_EXTERNAL_CUSTOMER_V2_Binding" type="tns:DOIT_SOA_EXTERNAL_CUSTOMER_V2_PortType">      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>      <operation name="CREATE_CUSTOMER">         <soap:operation soapAction="http://pegasus.doit.wisc.edu:8018/webservices/SOAProvider/plsql/doit_soa_external_customer_v2/"/>         <input>            <soap:header message="tns:CREATE_CUSTOMER_Input_Msg" part="header" use="literal"/>            <soap:body parts="body" use="literal"/>         </input>         <output>            <soap:body use="literal"/>         </output>      </operation>   </binding>   <service name="DOIT_SOA_EXTERNAL_CUSTOMER_V2_Service">      <port name="DOIT_SOA_EXTERNAL_CUSTOMER_V2_Port" binding="tns:DOIT_SOA_EXTERNAL_CUSTOMER_V2_Binding">         <soap:address location="http://pegasus.doit.wisc.edu:8018/webservices/SOAProvider/plsql/doit_soa_external_customer_v2/"/>      </port>   </service></definitions>
\ No newline at end of file
diff --git a/src/test/edu/wisc/services/cbs/external_customer/MockExternalCustomerServiceTest.php b/src/test/edu/wisc/services/cbs/external_customer/MockExternalCustomerServiceTest.php
new file mode 100644
index 0000000..401e530
--- /dev/null
+++ b/src/test/edu/wisc/services/cbs/external_customer/MockExternalCustomerServiceTest.php
@@ -0,0 +1,36 @@
+<?php
+
+use edu\wisc\services\cbs\external_customer\ExternalCustomer;
+use edu\wisc\services\cbs\external_customer\ExternalCustomerServiceResponse;
+use edu\wisc\services\cbs\external_customer\MockExternalCustomerService;
+
+/**
+ * Tests for {@link MockExternalCustomerService}
+ */
+class MockExternalCustomerServiceTest extends PHPUnit_Framework_TestCase
+{
+
+    /** @test */
+    public function alwaysSucceedsByDefault()
+    {
+        $client = new MockExternalCustomerService();
+        $customer = new ExternalCustomer();
+        $response = $client->createCustomer($customer);
+        static::assertTrue($response->isSuccess());
+    }
+
+    /** @test */
+    public function returnsCustomResponse()
+    {
+        $mockResponse = new ExternalCustomerServiceResponse(
+            true,
+            "Custom External Customer Service Response",
+            '123456789'
+        );
+        $client = new MockExternalCustomerService($mockResponse);
+        $customer = new ExternalCustomer();
+        $response = $client->createCustomer($customer);
+        static::assertEquals($mockResponse, $response);
+    }
+
+}
\ No newline at end of file
diff --git a/src/test/edu/wisc/services/cbs/external_customer/SoapExternalCustomerIT.php b/src/test/edu/wisc/services/cbs/external_customer/SoapExternalCustomerIT.php
new file mode 100644
index 0000000..bb57fb0
--- /dev/null
+++ b/src/test/edu/wisc/services/cbs/external_customer/SoapExternalCustomerIT.php
@@ -0,0 +1,34 @@
+<?php
+
+use edu\wisc\services\cbs\IntegrationTestCase;
+use edu\wisc\services\cbs\external_customer\SoapExternalCustomerService;
+
+class SoapExternalCustomerIT extends IntegrationTestCase
+{
+
+    /**
+     * @test
+     */
+    public function createsClientWithOnlyUsernameAndPassword()
+    {
+        $soapExternalCustomerService = new SoapExternalCustomerService(
+            static::$itData['cbs.username'],
+            static::$itData['cbs.password']
+        );
+        static::assertNotNull($soapExternalCustomerService);
+    }
+
+    /**
+     * @test
+     */
+    public function createsClientWithWsdl()
+    {
+        $soapExternalCustomerService = new SoapExternalCustomerService(
+            static::$itData['cbs.username'],
+            static::$itData['cbs.password'],
+            SoapExternalCustomerService::CBQA12
+        );
+        static::assertNotNull($soapExternalCustomerService);
+    }
+
+}
\ No newline at end of file
-- 
GitLab