1 | <?php |
||
10 | class Client |
||
11 | { |
||
12 | protected $config = null; |
||
13 | |||
14 | protected $soapClient = null; |
||
15 | |||
16 | protected $allegroSessionHandle = null; |
||
17 | |||
18 | protected $allegroUserId = null; |
||
19 | |||
20 | protected $localVersionKey = null; |
||
21 | |||
22 | 22 | public function __construct(Config $config, SoapClient $soapClient) |
|
23 | { |
||
24 | 22 | $this->config = $config; |
|
25 | 22 | $this->soapClient = $soapClient; |
|
26 | 22 | } |
|
27 | |||
28 | |||
29 | 7 | protected function getLocalVersionKey() |
|
30 | { |
||
31 | 7 | if (is_null($this->localVersionKey)) { |
|
32 | 7 | $response = $this->soapClient->doQuerySysStatus([ |
|
33 | 7 | 'sysvar' => Sysvars::SYSVAR_CATEGORY_TREE, |
|
34 | 7 | 'countryId' => $this->config->getCountryCode(), |
|
35 | 7 | 'webapiKey' => $this->config->getApiKey(), |
|
36 | 7 | ]); |
|
37 | |||
38 | 7 | if (!isset($response->verKey)) { |
|
39 | 1 | throw new Exception("Invalid WebAPI doQuerySysStatus() response: " . print_r($response, 1)); |
|
40 | } |
||
41 | |||
42 | 6 | $this->localVersionKey = $response->verKey; |
|
43 | 6 | } |
|
44 | |||
45 | 6 | return $this->localVersionKey; |
|
46 | } |
||
47 | |||
48 | 7 | protected function getWebApiRequest($data) |
|
63 | |||
64 | 7 | public function login() |
|
87 | |||
88 | |||
89 | 4 | public function __call($name, $args) |
|
105 | } |
||
106 |