GFPaystationReturnResult

Paystation Return (URL) result.

Defined (1)

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

/class.GFPaystationReturnResult.php  
  1. class GFPaystationReturnResult { 
  2.  
  3. public $transactionId; // ti. 
  4. public $errorCode; // ec. 
  5. public $errorMessage; // em. 
  6. public $merchantSession; // ms. 
  7. public $amount; // am (is an integer). 
  8. public $futurePayToken; // futurepaytoken. 
  9.  
  10. public $isValid; 
  11.  
  12. /** 
  13. * The constructor takes the result and then extracts the info and populates the properties of the class. 
  14. * @param string $result; 
  15. */ 
  16. public function __construct($result) { 
  17.  
  18. // The result is simply the query string, we need to decode in to an array. 
  19. parse_str($result, $params); 
  20.  
  21. if ($params) 
  22. // Check it contains expected paystation items, it not then it is not a valid paystation response. 
  23. if ((isset($params['ti'])) && (isset($params['ec'])) && (isset($params['em'])) && (isset($params['ms']))) { 
  24. $this->transactionId = $params['ti']; 
  25. $this->errorCode = $params['ec']; 
  26. $this->errorMessage = $params['em']; 
  27. $this->merchantSession = $params['ms']; 
  28. $this->amount = isset($params['am']) ? $params['am'] : null; 
  29. $this->futurePayToken = isset($params['futurepaytoken']) ? $params['futurepaytoken'] : null; 
  30.  
  31. $this->isValid = true; 
  32. else { 
  33. $this->isValid = false;