当前位置: 首页>>代码示例>>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;未经允许,请勿转载。