/** * Updates an Simplify_Invoice object. * * The properties that can be updated: * <dl style="padding-left:10px;"> * <dt><tt>status</tt></dt> <dd>New status of the invoice. [valid values: PAID] <strong>required </strong></dd></dl> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @return Invoice a Invoice object. */ public function updateInvoice($authentication = null) { $args = func_get_args(); $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1); $object = Simplify_PaymentsApi::updateObject($this, $authentication); return $object; }
/** * Retrieve a Simplify_Refund object from the API * * @param string id the id of the Refund object to retrieve * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> * @return Refund a Refund object */ public static function findRefund($id, $authentication = null) { $args = func_get_args(); $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2); $val = new Simplify_Refund(); $val->id = $id; $obj = Simplify_PaymentsApi::findObject($val, $authentication); return $obj; }
/** * 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()); }
/** * <p>Revokes a token from further use. * @param $authentication - Authentication information to access the API. If not value is passed the global key Simplify::$publicKey and Simplify::$privateKey are used * @return Simplify_AccessToken * @throws InvalidArgumentException */ public function revoke($authentication = null) { $args = func_get_args(); $access_token = $this->access_token; if (empty($access_token)) { throw new InvalidArgumentException('Cannot revoke access token; access token is invalid'); } $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2); $props = 'token=' . $access_token . ''; Simplify_AccessToken::sendRequest($props, "revoke", $authentication); $this->access_token = null; $this->refresh_token = null; $this->redirect_uri = null; return $this; }