protected function call($method, $data, $options = null)
 {
     $soapClient = $this->client;
     if (is_object($data[0])) {
         $data[0]->version = $this->version;
     }
     if ($this->isDebug) {
         MonetaSdkUtils::addToLog("soapCall method: {$method}\n");
         MonetaSdkUtils::addToLog("soapCall data:\n" . print_r($data, true));
     }
     $result = $soapClient->__soapCall($method, $data, $options, $this->inputHeaders, $this->outputHeaders);
     return $result;
 }
 /**
  * @param $method
  * @param $data
  * @param $options
  * @return array|mixed|null|object
  */
 private function jsonCall($method, $data, $options)
 {
     $data = json_decode(json_encode($data), true);
     if (!is_array($data) || !count($data)) {
         $data = array();
     }
     $inputData = array();
     foreach ($data as $itemKey => $itemVal) {
         if ($itemKey == "0") {
             $itemKey = "value";
         }
         if (!is_array($itemVal) || !count($itemVal)) {
             if (!empty($itemVal)) {
                 $inputData[$itemKey] = $itemVal;
             }
         } else {
             foreach ($itemVal as $requestBodyKey => $requestBodyVal) {
                 if (!empty($requestBodyVal)) {
                     $inputData[$requestBodyKey] = $requestBodyVal;
                 }
             }
         }
     }
     // no need to send version via json connector
     // $bodyData = array("{$method}Request" => array_merge(array("version" => $this->version), $inputData));
     // some methods needs special argument values defined
     if ($method == 'GetOperationDetailsById') {
         $inputData = $inputData['value'];
     }
     $bodyData = array("{$method}Request" => $inputData);
     // authorization data
     if (!$this->cert) {
         $requestData = array("Envelope" => array("Header" => array("Security" => array("UsernameToken" => array("Username" => $this->username, "Password" => $this->password))), "Body" => $bodyData));
     } else {
         $requestData = array("Envelope" => array("Body" => $bodyData));
     }
     if ($this->isDebug) {
         MonetaSdkUtils::addToLog("jsonCall request:\n" . print_r($requestData, true));
     }
     $requestData = json_encode($requestData);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $this->jsonConnectionUrl);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json;charset=UTF-8'));
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $requestData);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     if ($this->cert) {
         curl_setopt($ch, CURLOPT_SSLCERT, $this->cert);
     }
     $response = curl_exec($ch);
     curl_close($ch);
     if ($this->isDebug) {
         MonetaSdkUtils::addToLog("jsonCall curl response:\n{$response}");
     }
     $response = @json_decode($response, true);
     if (isset($response['Envelope']['Body'][$method . 'Response'])) {
         $result = $response['Envelope']['Body'][$method . 'Response'];
     } else {
         $result = $response;
     }
     return $result;
 }
 /**
  * @param $inputData
  * @param $params
  * @return bool
  * @throws MonetaSdkException
  */
 private function checkParamsInArray($inputData, $params)
 {
     $result = true;
     if (!count($params) || !is_array($params)) {
         $result = false;
     }
     foreach ($params as $param) {
         if (!MonetaSdkUtils::getValueFromArray($param, $inputData)) {
             $result = false;
         }
     }
     return $result;
 }
 /**
  * processCookieRedirect
  */
 private function processCookieRedirect()
 {
     $redirectUrl = MonetaSdkUtils::getSdkCookie('redirect');
     if (!$redirectUrl) {
         $redirectUrl = "/";
     }
     $this->pvtRedirectAfterForm($redirectUrl);
 }