/** * @return string The instance URL for this resource. It needs to be special * cased because it doesn't fit into the standard resource pattern. */ public function instanceUrl() { $id = $this['id']; if (!$id) { $msg = "Could not determine which URL to request: {$class} instance " . "has invalid ID: {$id}"; throw new M2_Stripe_InvalidRequestError($msg, null); } if (isset($this['customer'])) { $parent = $this['customer']; $base = self::classUrl('M2_Stripe_Customer'); } else { if (isset($this['recipient'])) { $parent = $this['recipient']; $base = self::classUrl('M2_Stripe_Recipient'); } else { return null; } } $parent = M2_Stripe_ApiRequestor::utf8($parent); $class = get_class($this); $id = M2_Stripe_ApiRequestor::utf8($id); $parentExtn = urlencode($parent); $extn = urlencode($id); return "{$base}/{$parentExtn}/cards/{$extn}"; }
public function retrieve($id, $params = null) { $requestor = new M2_Stripe_ApiRequestor($this->_apiKey); $base = $this['url']; $id = M2_Stripe_ApiRequestor::utf8($id); $extn = urlencode($id); list($response, $apiKey) = $requestor->request('get', "{$base}/{$extn}", $params); return M2_Stripe_Util::convertToStripeObject($response, $apiKey); }
/** * @returns string The full API URL for this API resource. */ public function instanceUrl() { $id = $this['id']; $class = get_class($this); if ($id === null) { $message = "Could not determine which URL to request: " . "{$class} instance has invalid ID: {$id}"; throw new M2_Stripe_InvalidRequestError($message, null); } $id = M2_Stripe_ApiRequestor::utf8($id); $base = $this->_lsb('classUrl', $class); $extn = urlencode($id); return "{$base}/{$extn}"; }
/** * @return string The API URL for this Stripe refund. */ public function instanceUrl() { $id = $this['id']; $charge = $this['charge']; if (!$id) { throw new M2_Stripe_InvalidRequestError("Could not determine which URL to request: " . "class instance has invalid ID: {$id}", null); } $id = M2_Stripe_ApiRequestor::utf8($id); $charge = M2_Stripe_ApiRequestor::utf8($charge); $base = self::classUrl('M2_Stripe_Charge'); $chargeExtn = urlencode($charge); $extn = urlencode($id); return "{$base}/{$chargeExtn}/refunds/{$extn}"; }
/** * @return string The API URL for this Stripe subscription. */ public function instanceUrl() { $id = $this['id']; $customer = $this['customer']; $class = get_class($this); if (!$id) { throw new M2_Stripe_InvalidRequestError("Could not determine which URL to request: " . "class instance has invalid ID: {$id}", null); } $id = M2_Stripe_ApiRequestor::utf8($id); $customer = M2_Stripe_ApiRequestor::utf8($customer); $base = self::classUrl('M2_Stripe_Customer'); $customerExtn = urlencode($customer); $extn = urlencode($id); return "{$base}/{$customerExtn}/subscriptions/{$extn}"; }