Skip to content

Commit

Permalink
Create customer
Browse files Browse the repository at this point in the history
  • Loading branch information
kangaroo-val committed Mar 2, 2019
1 parent 3f08f8f commit a924223
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 18 additions & 0 deletions src/Provider/MerchantOS.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a924223

Please sign in to comment.