/** * Get a transaction policies * * @return Array of transaction policies * @throws TiketException */ public function getTransactionPolicies() { $params = ['verify' => false, 'query' => ['output' => Config::get('response.format')]]; $baseUrl = sprintf(Config::get('endpoints.base_url'), Config::get('settings.api')) . Config::get('endpoints.general_transaction_policies'); try { $response = parent::send('GET', $baseUrl, $params); } catch (TiketException $e) { throw parent::convertException($e); } return $response; }
/** * Obtain access token * @param string $apiKey * @return string * @throws AuthException */ public function getToken() { $params = ['verify' => false, 'query' => ['method' => 'getToken', 'secretkey' => $this->apiKey, 'output' => Config::get('response.format')]]; $baseUrl = sprintf(Config::get('endpoints.base_url'), Config::get('settings.api')) . Config::get('endpoints.get_token'); try { $response = $this->client->request('GET', $baseUrl, $params); $body = $response->getBody(); } catch (ClientException $e) { throw $this->convertException($e); } return $body->getContents(); }
/** * Helper function to return required headers for making an HTTP request with Tiket.com * @return array - authorization headers */ private static function getHeaders() { return ['twh' => Config::get('settings.user_agent')]; }