private function _request($method, $url, $params) { if (!class_exists('Openpay')) { throw new OpenpayApiError("Library install error, there are some missing classes"); } OpenpayConsole::trace('OpenpayApiConnector @_request'); $myId = Openpay::getId(); if (!$myId) { throw new OpenpayApiAuthError("Empty or no Merchant ID provided"); } else { if (!preg_match('/^[a-z0-9]{20}$/i', $myId)) { throw new OpenpayApiAuthError("Invalid Merchant ID '" . $myId . "'"); } } $myApiKey = Openpay::getApiKey(); if (!$myApiKey) { throw new OpenpayApiAuthError("Empty or no Private Key provided"); } else { if (!preg_match('/^sk_[a-z0-9]{32}$/i', $myApiKey)) { throw new OpenpayApiAuthError("Invalid Private Key '" . $myApiKey . "'"); } } $absUrl = Openpay::getEndpointUrl(); if (!$absUrl) { throw new OpenpayApiConnectionError("No API endpoint set"); } $absUrl .= '/' . $myId . $url; //$params = self::_encodeObjects($params); $headers = array('User-Agent: OpenpayPhp/v1'); list($rbody, $rcode) = $this->_curlRequest($method, $absUrl, $headers, $params, $myApiKey); return $this->interpretResponse($rbody, $rcode); }