Skip to content

Commit

Permalink
OptOutsService get only my account
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetanV authored Mar 14, 2019
1 parent 7aed6ad commit bcf1960
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/Esendex/OptOutsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,44 @@ public function get($pageNumber = null, $pageSize = null)

return $this->parser->parseMultipleResult($xmlResult);
}

/**
* @param string $pageNumber
* @param string $pageSize
* @return array
*/
public function getMyAccountReference($pageNumber = null, $pageSize = null)
{
if($pageNumber == null)
{
$pageNumber = 1;
}
if($pageSize == null)
{
$pageSize = 15;
}

$startIndex = ($pageNumber-1)*$pageSize;

$uri = Http\UriBuilder::serviceUri(
self::SERVICE_VERSION,
self::SERVICE,
null,
$this->httpClient->isSecure()
);

$query = array();
$query["startIndex"] = $startIndex;
$query["count"] = $pageSize;
$query["accountreference"] = $this->authentication->accountReference();
$uri .= "?" . Http\UriBuilder::buildQuery($query);

$xmlResult = $this->httpClient->get(
$uri,
$this->authentication
);

return $this->parser->parseMultipleResult($xmlResult);
}

}

0 comments on commit bcf1960

Please sign in to comment.