Skip to content

Commit

Permalink
Add getSaleLines method
Browse files Browse the repository at this point in the history
  • Loading branch information
kangaroo-val committed Feb 22, 2018
1 parent fd779e7 commit 6ee9f63
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
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.22",
"version": "2.0.23",
"authors": [
{
"name": "Valentin Ursuleac",
Expand Down
19 changes: 18 additions & 1 deletion src/Provider/MerchantOS.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public function getSales($params = [])

/**
* @param int $saleId
* @param int $limit
* @param array $params
* @return mixed
*/
public function getSaleSaleLines($saleId, $params = [])
Expand All @@ -323,6 +323,23 @@ public function getSaleSaleLines($saleId, $params = [])
return [];
}

/**
* @param array $params
* @return mixed
*/
public function getSaleLines($params = [])
{
$response = $this->makeAPICall('Account.SaleLine', 'GET', null, $params, null);

if (isset($response['SaleLine']) && $this->itemsCount($response) == 1) {
return [$response['SaleLine']];
} elseif (isset($response['SaleLine']) && $this->itemsCount($response) > 1) {
return $response['SaleLine'];
}

return [];
}

/**
* @param int $saleId
* @param int $limit
Expand Down

0 comments on commit 6ee9f63

Please sign in to comment.