129 $requestUrl = $this->
getEndpoint() .
'?' . http_build_query($data);
142 $httpResponse = $this->httpClient->request(
146 'Accept' =>
'application/json',
147 'Authorization' =>
'Bearer ' . $this->
getToken(),
148 'Content-type' =>
'application/json',
153 $body = (string) $httpResponse->getBody()->getContents();
154 $jsonToArrayResponse = !empty($body) ? json_decode($body,
true) : array();
155 return $this->response = $this->
createResponse($jsonToArrayResponse, $httpResponse->getStatusCode());
156 }
catch (\Exception $e) {
157 throw new InvalidResponseException(
158 'Error communicating with payment gateway: ' . $e->getMessage(),
174 public function toJSON($data, $options = 0)
179 if (version_compare(phpversion(),
'5.4.0',
'>=') ===
true) {
180 return json_encode($data, $options | 64);
182 return str_replace(
'\\/',
'/',
json_encode($data, $options));
187 return $this->response =
new RestResponse($this, $data, $statusCode);