Skip to content

Commit

Permalink
Searching for sales
Browse files Browse the repository at this point in the history
  • Loading branch information
ursuleacv committed Apr 12, 2016
1 parent 39f270b commit 0b784ce
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 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.2",
"version": "2.0.3",
"authors": [
{
"name": "Valentin Ursuleac",
Expand Down
28 changes: 24 additions & 4 deletions src/Provider/MerchantOS.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class MerchantOS extends Lightspeed
*/
protected $accountId;

/**
* @var string
*/
protected $userAgent = 'MerchantOS';

/**
Expand All @@ -37,6 +40,9 @@ public function __construct(AccessToken $token, $accountId)
$this->accountId = $accountId;
}

/**
* @param $agent
*/
public function setUserAgent($agent)
{
$this->userAgent = $agent;
Expand Down Expand Up @@ -148,11 +154,8 @@ public function getSales($params = [])
* @param int $limit
* @return mixed
*/
public function getSaleLine($saleId, $extra = [])
public function getSaleSaleLines($saleId, $params = [])
{
$params = [];

$params = array_merge($params, $extra);
$response = $this->makeAPICall('Account.Sale' . '/' . $saleId . '/SaleLine', 'GET', null, $params, null);

if (isset($response['SaleLine']) && $this->itemsCount($response) == 1) {
Expand All @@ -164,6 +167,23 @@ public function getSaleLine($saleId, $extra = [])
return [];
}

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

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

return [];
}

/**
* @param $saleId
* @return mixed
Expand Down

0 comments on commit 0b784ce

Please sign in to comment.