Example #1
0
 /**
  * Get code sent by from Transferuj SMS widget.
  * Validate code by sending cURL to Transferuj server.
  *
  * @return bool
  *
  * @throws TException
  */
 public function verifyCode()
 {
     $codeToCheck = Util::post('tfCodeToCheck', 'string');
     $hash = Util::post('tfHash', 'string');
     if ($codeToCheck === false || $hash === false) {
         throw new TException('Invalid input data');
     }
     $postData = array('tfCodeToCheck' => $codeToCheck, 'tfHash' => $hash);
     $response = Curl::doCurlRequest($this->secureURL, $postData);
     $data = explode("\n", $response);
     $status = (int) $data[0];
     $lifetime = rtrim($data[1]);
     if ($status === 1) {
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 /**
  * Execute post request to card API
  *
  * @param string $url url
  * @param array $params
  *
  * @return bool|mixed
  */
 private function postRequest($url, $params = array())
 {
     $curlRes = Curl::doCurlRequest($url, $params);
     return json_decode($curlRes, true);
 }
Example #3
0
 /**
  * Send API request
  *
  * @param string $method method name
  * @param array $postData post data
  *
  * @return mixed
  */
 protected function request($method, $postData)
 {
     $url = $this->apiUrl . $this->partnerUniqueAddress . '/' . $method;
     return Curl::doCurlRequest($url, $postData);
 }
Example #4
0
 /**
  * Execute request to Transferuj transaction API
  *
  * @param string $url    url
  * @param array  $params post params
  *
  * @return bool|mixed
  */
 private function requests($url, $params)
 {
     $params['api_password'] = $this->apiPass;
     return Curl::doCurlRequest($url, $params);
 }