本文整理汇总了PHP中Customer::classUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::classUrl方法的具体用法?PHP Customer::classUrl怎么用?PHP Customer::classUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::classUrl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instanceUrl
/**
* @return null|string The instance URL for this resource. It needs to be special
* cased because it doesn't fit into the standard resource pattern.
*
* @throws Error\InvalidRequest
*/
public function instanceUrl()
{
$id = $this['id'];
if (!$id) {
$class = get_class($this);
$msg = "Could not determine which URL to request: {$class} instance " . "has invalid ID: {$id}";
throw new Error\InvalidRequest($msg, null);
}
if ($this['customer']) {
$parent = $this['customer'];
$base = Customer::classUrl();
$path = 'sources';
} elseif ($this['account']) {
$parent = $this['account'];
$base = Account::classUrl();
$path = 'external_accounts';
} elseif ($this['recipient']) {
$parent = $this['recipient'];
$base = Recipient::classUrl();
$path = 'cards';
} else {
return;
}
$parent = Util\Util::utf8($parent);
$id = Util\Util::utf8($id);
$parentExtn = urlencode($parent);
$extn = urlencode($id);
return "{$base}/{$parentExtn}/{$path}/{$extn}";
}
示例2: testVerify
public function testVerify()
{
self::authorizeFromEnv();
$bankAccountToken = Token::create(array('bank_account' => array('country' => 'US', 'routing_number' => '110000000', 'account_number' => '000123456789', 'name' => 'Jane Austen', 'account_holder_type' => 'company')));
$customer = Customer::create();
$externalAccount = $customer->sources->create(array('bank_account' => $bankAccountToken->id));
$verifiedAccount = $externalAccount->verify(array('amounts' => array(32, 45)), null);
$base = Customer::classUrl();
$parentExtn = $externalAccount['customer'];
$extn = $externalAccount['id'];
$this->assertEquals("{$base}/{$parentExtn}/sources/{$extn}", $externalAccount->instanceUrl());
}
示例3: instanceUrl
/**
* @return string The API URL for this Stripe subscription.
*/
public function instanceUrl()
{
$id = $this['id'];
$customer = $this['customer'];
if (!$id) {
throw new Error\InvalidRequest("Could not determine which URL to request: " . "class instance has invalid ID: {$id}", null);
}
$id = Util\Util::utf8($id);
$customer = Util\Util::utf8($customer);
$base = Customer::classUrl();
$customerExtn = urlencode($customer);
$extn = urlencode($id);
return "{$base}/{$customerExtn}/subscriptions/{$extn}";
}
示例4: testUpdateWithCustomer
public function testUpdateWithCustomer()
{
self::authorizeFromEnv();
$receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com");
$customer = Customer::create(array("source" => $receiver->id));
$receiver = BitcoinReceiver::retrieve($receiver->id);
$receiver->description = "a new description";
$receiver->save();
$base = Customer::classUrl();
$parentExtn = $receiver['customer'];
$extn = $receiver['id'];
$this->assertEquals("{$base}/{$parentExtn}/sources/{$extn}", $receiver->instanceUrl());
$updatedReceiver = BitcoinReceiver::retrieve($receiver->id);
$this->assertEquals($receiver["description"], $updatedReceiver["description"]);
}
示例5: instanceUrl
/**
* @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) {
$class = get_class($this);
$msg = "Could not determine which URL to request: {$class} instance " . "has invalid ID: {$id}";
throw new Error\InvalidRequest($msg, null);
}
$id = ApiRequestor::utf8($id);
$extn = urlencode($id);
if (!$this['customer']) {
$base = BitcoinReceiver::classUrl();
return "{$base}/{$extn}";
} else {
$base = Customer::classUrl();
$parent = ApiRequestor::utf8($this['customer']);
$parentExtn = urlencode($parent);
return "{$base}/{$parentExtn}/sources/{$extn}";
}
}
示例6: instanceUrl
/**
* @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) {
$class = get_class($this);
$msg = "Could not determine which URL to request: {$class} instance " . "has invalid ID: {$id}";
throw new Error\InvalidRequest($msg, null);
}
if (isset($this['customer'])) {
$parent = $this['customer'];
$base = Customer::classUrl();
} elseif (isset($this['recipient'])) {
$parent = $this['recipient'];
$base = Recipient::classUrl();
} else {
return null;
}
$parent = ApiRequestor::utf8($parent);
$id = ApiRequestor::utf8($id);
$parentExtn = urlencode($parent);
$extn = urlencode($id);
return "{$base}/{$parentExtn}/cards/{$extn}";
}