Simplify_Event

Copyright (c) 2013 - 2015 MasterCard International Incorporated All rights reserved.

Defined (1)

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

/includes/gateways/simplify-commerce/includes/Simplify/Event.php  
  1. class Simplify_Event extends Simplify_Object { 
  2.  
  3. /** 
  4. * Creates an Event object 
  5. * @param array $hash A map of parameters; valid keys are: 
  6. * <dt><code>paylod</code></dt> <dd>The raw JWS payload. </dd> <strong>required</strong> 
  7. * <dt><code>url</code></dt> <dd>The URL for the webhook. If present it must match the URL registered for the webhook.</dd> 
  8. * @param $authentication Object that contains the API public and private keys. If null the values of the static 
  9. * Simplify::$publicKey and Simplify::$privateKey will be used. 
  10. * @return Payments_Event an Event object. 
  11. * @throws InvalidArgumentException 
  12. */ 
  13. static public function createEvent($hash, $authentication = null) { 
  14.  
  15. $args = func_get_args(); 
  16. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2); 
  17.  
  18. $paymentsApi = new Simplify_PaymentsApi(); 
  19.  
  20. $jsonObject = $paymentsApi->jwsDecode($hash, $authentication); 
  21.  
  22. if ($jsonObject['event'] == null) { 
  23. throw new InvalidArgumentException("Incorect data in webhook event"); 
  24.  
  25. return $paymentsApi->convertFromHashToObject($jsonObject['event'], self::getClazz()); 
  26.  
  27. /** 
  28. * @ignore 
  29. */ 
  30. static public function getClazz() { 
  31. return "Event";