當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Customer::classUrl方法代碼示例

本文整理匯總了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}";
 }
開發者ID:xavismeh,項目名稱:stripe-php,代碼行數:35,代碼來源:ExternalAccount.php

示例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());
 }
開發者ID:BenComicGraphics,項目名稱:stripe-php,代碼行數:12,代碼來源:ExternalAccountTest.php

示例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}";
 }
開發者ID:Enflick,項目名稱:stripe-php,代碼行數:17,代碼來源:Subscription.php

示例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"]);
 }
開發者ID:cso4tb,項目名稱:Auxum-,代碼行數:15,代碼來源:BitcoinReceiverTest.php

示例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}";
     }
 }
開發者ID:alirezism,項目名稱:restrict-content-pro,代碼行數:24,代碼來源:BitcoinReceiver.php

示例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}";
 }
開發者ID:alirezism,項目名稱:restrict-content-pro,代碼行數:27,代碼來源:Card.php


注:本文中的Customer::classUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。