Esempio n. 1
0
 /**
  * Creates an Event object
  * @param     array $hash A map of parameters; valid keys are:
  *     <dt><code>paylod</code></dt>    <dd>The raw JWS payload. </dd> <strong>required</strong>
  *     <dt><code>url</code></dt>    <dd>The URL for the webhook.  If present it must match the URL registered for the webhook.</dd>
  * @param     string $publicKey Public key. If null, the value of static Simplify::$publicKey will be used
  * @param     string $privateKey Private key. If null, the value of static Simplify::$privateKey will be used
  * @return    Payments_Event an Event object.
  */
 public static function createEvent($hash, $publicKey = null, $privateKey = null)
 {
     $paymentsApi = new Simplify_PaymentsApi();
     $jsonObject = $paymentsApi->jwsDecode($hash, $publicKey, $privateKey);
     if ($jsonObject['event'] == null) {
         throw new InvalidArgumentException("Incorect data in webhook event");
     }
     return $paymentsApi->convertFromHashToObject($jsonObject['event'], self::getClazz());
 }
Esempio n. 2
0
 /**
  * Creates an Event object
  * @param     array $hash A map of parameters; valid keys are:
  *     <dt><code>paylod</code></dt>    <dd>The raw JWS payload. </dd> <strong>required</strong>
  *     <dt><code>url</code></dt>    <dd>The URL for the webhook.  If present it must match the URL registered for the webhook.</dd>
  * @param  $authentication Object that contains the API public and private keys.  If null the values of the static
  *         Simplify::$publicKey and Simplify::$privateKey will be used.
  * @return Payments_Event an Event object.
  * @throws InvalidArgumentException
  */
 public static function createEvent($hash, $authentication = null)
 {
     $args = func_get_args();
     $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
     $paymentsApi = new Simplify_PaymentsApi();
     $jsonObject = $paymentsApi->jwsDecode($hash, $authentication);
     if ($jsonObject['event'] == null) {
         throw new InvalidArgumentException("Incorect data in webhook event");
     }
     return $paymentsApi->convertFromHashToObject($jsonObject['event'], self::getClazz());
 }
Esempio n. 3
0
 /**
  * @ignore
  */
 public static function listObject($object, $criteria = null, $authentication = null)
 {
     if ($criteria != null) {
         if (isset($criteria['max'])) {
             $object->max = $criteria['max'];
         }
         if (isset($criteria['offset'])) {
             $object->offset = $criteria['offset'];
         }
         if (isset($criteria['sorting'])) {
             $object->sorting = $criteria['sorting'];
         }
         if (isset($criteria['filter'])) {
             $object->filter = $criteria['filter'];
         }
     }
     $paymentsApi = new Simplify_PaymentsApi();
     $jsonObject = $paymentsApi->execute("list", $object, $authentication);
     $ret = new Simplify_ResourceList();
     if (array_key_exists('list', $jsonObject) & is_array($jsonObject['list'])) {
         foreach ($jsonObject['list'] as $obj) {
             array_push($ret->list, $paymentsApi->convertFromHashToObject($obj, $object->getClazz()));
         }
         $ret->total = $jsonObject['total'];
     }
     return $ret;
 }