Пример #1
0
 /**
  * @param string $method
  * @param array $params
  */
 protected function setPayload($method, array $params)
 {
     if ('POST' === $method) {
         $this->request->setPayload($this->httpClient->buildQuery($params));
     } elseif ('PUT' === $method && 'PATCH' === $method) {
         $this->request->setPayload(json_encode($params));
     }
 }
Пример #2
0
 /**
  * @return Response
  */
 public function requestAccessToken()
 {
     $this->prepareRequest();
     $this->request->setUri($this->configuration->getBaseUri() . self::TOKEN_ENDPOINT);
     $this->request->setMethod('POST');
     $payload = $this->httpClient->buildQuery(array('client_id' => $this->configuration->getClientId(), 'client_secret' => $this->configuration->getClientSecret(), 'grant_type' => $this->configuration->getGrantType(), 'username' => $this->configuration->getUsername(), 'password' => $this->configuration->getPassword(), 'company' => $this->configuration->getCompany()));
     $this->request->setPayload($payload);
     return $this->httpClient->send($this->request);
 }