/** * Ask CloudSearch server to send us a new secret key * * @return void */ public function requestSecretKey() { $apiKey = Config::getInstance()->QSL->CloudSearch->api_key; $requestUrl = 'http://' . static::CLOUD_SEARCH_DOMAIN . static::CLOUD_SEARCH_REQUEST_SECRET_KEY_URL; $request = new Request($requestUrl); $request->body = array('apiKey' => $apiKey); $request->sendRequest(); }
/** * Prepare request * * @param \XLite\Core\HTTP\Request $request Request * @param string $type Request type * @param array $params Request params * * @return \XLite\Core\HTTP\Request */ protected function prepareRequest($request, $type, $params) { if ('api' === $this->getSetting('api_type') && 'certificate' === $this->getSetting('auth_method')) { $request->setAdditionalOption(\CURLOPT_SSLCERT, $this->getSetting('certificate')); } return parent::prepareRequest($request, $type, $params); }
public function setContentType($value) { $this->request->setHeader('Content-Type', $value); }
/** * Prepare request object * * @param \XLite\Core\HTTP\Request $request Request object * @param array $params Request params * * @return \XLite\Core\HTTP\Request */ protected function prepareMerchantCredentialsRequest($request, $params) { $request->verb = 'GET'; $accessToken = $this->getAccessToken(static::CLIENT_ID, static::CLIENT_SECRET); if (is_array($accessToken) && $accessToken['access_token']) { $request->setHeader('Authorization', sprintf('Bearer %s', $accessToken['access_token'])); } return $request; }
/** * Prepare request * * @param \XLite\Core\HTTP\Request $request Request * @param string $type Request type * @param array $params Request params * * @return \XLite\Core\HTTP\Request */ protected function prepareRequest($request, $type, $params) { $request->setHeader('Accept', 'application/json'); $request->setHeader('Accept-Language', 'en_US'); $request->setHeader('Content-Type', 'application/x-www-form-urlencoded'); $authorization = base64_encode(sprintf('%s:%s', \Xlite\Core\Config::getInstance()->CDev->Paypal->loginClientId, \Xlite\Core\Config::getInstance()->CDev->Paypal->loginClientSecret)); $request->setHeader('Authorization', sprintf('Basic %s', $authorization)); return parent::prepareRequest($request, $type, $params); }