[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/externals/balanced-php/src/Balanced/ -> Merchant.php (source)

   1  <?php
   2  
   3  namespace Balanced;
   4  
   5  use Balanced\Resource;
   6  use \RESTful\URISpec;
   7  
   8  /**
   9   * Represents a merchant identity.
  10   * 
  11   * These are optionally created and associated with an account via
  12   * \Balanced\Marketplace::createMerchant which establishes a merchant account
  13   * on a marketplace.
  14   * 
  15   * In some cases a merchant may need to be redirected to create a identity (e.g. the
  16   * information provided cannot be verified, more information is needed, etc). That
  17   * redirected signup results in a merchant_uri which is then associated with an
  18   * account on the marketplace via \Balanced\Marketplace::createMerchant.
  19   * 
  20   * @see \Balanced\Marketplace
  21   */
  22  class Merchant extends Resource
  23  {
  24      protected static $_uri_spec = null;
  25  
  26      public static function init()
  27      {
  28          self::$_uri_spec = new URISpec('merchants', 'id', '/v1');
  29          self::$_registry->add(get_called_class());
  30      }
  31  
  32      /**
  33       * Return the merchant identity associated with the current
  34       * Balanced\Settings::$api_key. If you are not authenticated (i.e. 
  35       * ) then Balanced\Exceptions\NoResult
  36       * will be thrown.
  37       * 
  38       * <code>
  39       * $merchant = \Balanced\Merchant::me();
  40       * $owner_account = \Balanced\Marketplace::mine()->owner_account;
  41       * assert($merchant->id == $owner_account->merchant->id);
  42       * </code>
  43       *
  44       * @throws \RESTful\Exceptions\NoResultFound
  45       * @return \Balanced\Merchant
  46       */
  47      public static function me()
  48      {
  49          return self::query()->one();
  50      }
  51  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1