/**
  * @param string $url
  * @param ResponseInterface $response
  * @return array|stdClass
  *
  * @throws ApiErrorException
  */
 public static function processResult(string $url, ResponseInterface $response)
 {
     $body = $response->getBody()->getContents();
     $body = Tools::jsonNumbersToString($body);
     $result = Json::decode($body);
     self::checkErrors($result, $url);
     return $result;
 }