public static function submit($url, $params)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, 1);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
     if (defined('__GIROSOLUTION_SDK_CERT__')) {
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
         curl_setopt($ch, CURLOPT_CAINFO, str_replace('\\', '/', __GIROSOLUTION_SDK_CERT__));
     }
     // if(defined('__GIROSOLUTION_SDK_SSL_VERIFY_OFF__') && __GIROSOLUTION_SDK_SSL_VERIFY_OFF__) {
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     // }
     if (__GIROCHECKOUT_SDK_DEBUG__) {
         curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
     }
     $result = curl_exec($ch);
     if (__GIROCHECKOUT_SDK_DEBUG__) {
         GiroCheckout_SDK_Debug_helper::getInstance()->logRequest(curl_getinfo($ch), $params);
     }
     if (__GIROCHECKOUT_SDK_DEBUG__) {
         GiroCheckout_SDK_Debug_helper::getInstance()->logReply($result, curl_error($ch));
     }
     if ($result === false) {
         throw new Exception('cURL: submit failed.');
     }
     curl_close($ch);
     return self::getHeaderAndBody($result);
 }
 public function __construct($message = null, $code = 0)
 {
     if (__GIROCHECKOUT_SDK_DEBUG__) {
         GiroCheckout_SDK_Debug_helper::getInstance()->LogException($message);
     }
     parent::__construct($message, $code);
 }
 /**
  * Submits the request to the GiroCheckout API by using the given request method. Uses all given and needed
  * params in the correct order.
  *
  * @return boolean
  */
 public function submit()
 {
     $header = array();
     $body = '';
     if (__GIROCHECKOUT_SDK_DEBUG__) {
         GiroCheckout_SDK_Debug_helper::getInstance()->logParamsSet($this->params);
     }
     try {
         $submitParams = $this->requestMethod->getSubmitParams($this->params);
         if ($this->requestMethod->needsHash()) {
             $submitParams['hash'] = GiroCheckout_SDK_Hash_helper::getHMACMD5Hash($this->secret, $submitParams);
         }
         $submitParams['sourceId'] = $this->getHostSourceId() . ';' . __GIROCHECKOUT_SDK_VERSION__ . ';';
         if (isset($this->params['sourceId'])) {
             $submitParams['sourceId'] .= $this->params['sourceId'];
         } else {
             $submitParams['sourceId'] .= ';';
         }
         list($header, $body) = GiroCheckout_SDK_Curl_helper::submit($this->requestMethod->getRequestURL(), $submitParams);
         $response = GiroCheckout_SDK_curl_helper::getJSONResponseToArray($body);
         if ($response['rc'] == 5000 || $response['rc'] == 5001) {
             throw new GiroCheckout_SDK_Exception_helper('authentication failure');
         } elseif (!isset($header['hash'])) {
             throw new GiroCheckout_SDK_Exception_helper('hash in response is missing');
         } elseif (isset($header['hash']) && $header['hash'] !== GiroCheckout_SDK_Hash_helper::getHMACMD5HashString($this->secret, $body)) {
             throw new GiroCheckout_SDK_Exception_helper('hash mismatch in response');
         } else {
             $this->response = $this->requestMethod->checkResponse($response);
             if (__GIROCHECKOUT_SDK_DEBUG__) {
                 GiroCheckout_SDK_Debug_helper::getInstance()->logReplyParams($this->response);
             }
         }
     } catch (Exception $e) {
         throw new GiroCheckout_SDK_Exception_helper('Failure: ' . $e->getMessage() . "\n" . implode("\r\n", $header) . $body);
     }
     return TRUE;
 }
 public function sendOtherStatus()
 {
     if (__GIROCHECKOUT_SDK_DEBUG__) {
         GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationInput('sendOtherStatus');
     }
     header('HTTP/1.1 404 Not Found');
 }