示例#1
0
 public function __construct(array $options = null)
 {
     $this->config = Config::options($options);
     $composerData = json_decode(file_get_contents(__DIR__ . '/../../composer.json'), true);
     $partner_token = isset($options['partner_token']) ? $options['partner_token'] : "";
     $this->client = new Client(['debug' => $this->config['debug'], 'base_url' => $this->config['baseUri'], 'headers' => ['Content-Type' => 'application/json', 'api-sdk' => 'opencart-0.3.1', 'partner-token' => $partner_token]]);
 }
示例#2
0
 public function authorize()
 {
     $endpoints = Config::get('ENDPOINTS');
     $requestOptions = ['auth' => [$this->clientId, $this->clientSecret], 'json' => ['grant_type' => 'client_credentials']];
     $response = $this->request->send($endpoints['authorize']['method'], $endpoints['authorize']['route'], $requestOptions);
     $this->accessToken = $response['access_token'];
     $this->expires = time() + $response['expires_in'];
     $this->tokenType = $response['token_type'];
 }
示例#3
0
 public function __construct($options, $requester = null)
 {
     $this->requester = $requester;
     if (!$this->requester) {
         $this->requester = new ApiRequest($options);
     }
     $this->endpoints = Config::get('ENDPOINTS');
     $this->map();
 }
示例#4
0
 public function __construct(array $options = null)
 {
     $this->config = Config::options($options);
     $composerData = json_decode(file_get_contents(__DIR__ . '/../../composer.json'), true);
     $this->client = new Client(['debug' => $this->config['debug'], 'base_uri' => $this->config['baseUri'], 'headers' => ['Content-Type' => 'application/json', 'api-sdk' => 'php-' . $composerData['version']]]);
 }
示例#5
0
 public function __construct(array $options = null)
 {
     $this->config = Config::options($options);
     $this->client = new Client(['debug' => $this->config['debug'], 'base_uri' => $this->config['baseUri'], 'headers' => ['Content-Type' => 'application/json']]);
 }