protected function _apiRequest($request)
 {
     // log the request
     $this->_adyenLogger->info('The request to adyen: ' . print_r($request, true));
     $webserviceUsername = $this->_adyenHelper->getWsUsername();
     $webservicePassword = $this->_adyenHelper->getWsPassword();
     $url = $this->_adyenHelper->getWsUrl();
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_HEADER, false);
     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
     curl_setopt($ch, CURLOPT_USERPWD, $webserviceUsername . ":" . $webservicePassword);
     curl_setopt($ch, CURLOPT_POST, count($request));
     curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($request));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $results = curl_exec($ch);
     $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     if ($httpStatus != 200) {
         throw new \Magento\Framework\Exception\LocalizedException(__('HTTP Status code' . $httpStatus . " " . $webserviceUsername . ":" . $webservicePassword));
     }
     if ($results === false) {
         throw new \Magento\Framework\Exception\LocalizedException(__('HTTP Status code' . $results));
     }
     parse_str($results, $resultArr);
     curl_close($ch);
     // log the result
     $this->_adyenLogger->info('The response to adyen: ' . print_r($resultArr, true));
     return $resultArr;
 }