tpayPaymentSMS

Class PaymentSMS.

Defined (1)

The class is defined in the following location(s).

/includes/lib/src/_class_tpay/paymentSms.php  
  1. class PaymentSMS 
  2. /** 
  3. * Url to verify SMS code 
  4. * @var string 
  5. */ 
  6. private $secureURL = 'http://sms.tpay.com/widget/verifyCode.php'; 
  7.  
  8. /** 
  9. * PaymentSMS class constructor 
  10. */ 
  11. public function __construct() 
  12. require_once(dirname(__FILE__) . '/util.php'); 
  13. Util::checkVersionPHP(); 
  14. Util::loadClass('curl'); 
  15.  
  16. /** 
  17. * Get code sent by from tpay SMS widget. 
  18. * Validate code by sending cURL to tpay server. 
  19. * @return bool 
  20. * @throws TException 
  21. */ 
  22. public function verifyCode() 
  23. $codeToCheck = Util::post('tfCodeToCheck', 'string'); 
  24. $hash = Util::post('tfHash', 'string'); 
  25.  
  26. if ($codeToCheck === false || $hash === false) { 
  27. throw new TException('Invalid input data'); 
  28.  
  29. $postData = array( 
  30. 'tfCodeToCheck' => $codeToCheck,  
  31. 'tfHash' => $hash,  
  32. ); 
  33. $response = Curl::doCurlRequest($this->secureURL, $postData); 
  34.  
  35. $data = explode("\n", $response); 
  36.  
  37. $status = (int)$data[0]; 
  38.  
  39. return (bool)$status;