From a924223f3b5b8ef480a76561010fb508b27b17f8 Mon Sep 17 00:00:00 2001 From: Valentin Date: Sat, 2 Mar 2019 09:16:34 -0500 Subject: [PATCH] Create customer --- composer.json | 2 +- src/Provider/MerchantOS.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 802ab84..b606612 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "ursuleacv/oauth2-lightspeed", "description": "LightSpeed OAuth 2.0 Client Provider for The PHP League OAuth2-Client", "license": "MIT", - "version": "2.0.26", + "version": "2.0.27", "authors": [ { "name": "Valentin Ursuleac", diff --git a/src/Provider/MerchantOS.php b/src/Provider/MerchantOS.php index bd967ee..5b7a2aa 100644 --- a/src/Provider/MerchantOS.php +++ b/src/Provider/MerchantOS.php @@ -508,6 +508,24 @@ public function getCustomers($params) return []; } + /** + * @param array $data + * @return mixed + */ + public function createCustomer($data) + { + $response = $this->makeAPICall('Account.Customer', 'POST', null, [], $data); + + //validate the response + if (isset($response['Customer']) && $this->itemsCount($response) == 1) { + return $response['Customer']; + } elseif (isset($response['Customer']) && $this->itemsCount($response) > 1) { + return $response['Customer']; + } + + return []; + } + /** * @param int $customerId * @param array $data