[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 namespace Balanced; 4 5 use Balanced\Resource; 6 use \RESTful\URISpec; 7 8 /** 9 * Represents an account card. 10 * 11 * You can create these via Balanced\Marketplace::cards::create or 12 * Balanced\Marketplace::createCard. Associate them with a buyer or merchant 13 * one creation via Marketplace::createBuyer or 14 * Balanced\Marketplace::createMerchant and with an existing buyer or merchant 15 * use Balanced\Account::addCard. 16 * 17 * <code> 18 * $marketplace = \Balanced\Marketplace::mine(); 19 * 20 * $card = $marketplace->cards->create(array( 21 * 'name' => 'name', 22 * 'account_number' => '11223344', 23 * 'bank_code' => '1313123' 24 * )); 25 * 26 * $account = $marketplace 27 * ->accounts 28 * ->query() 29 * ->filter(Account::f->email_address->eq('[email protected]')) 30 * ->one(); 31 * $account->addCard($card->uri); 32 * </code> 33 */ 34 class Card extends Resource 35 { 36 protected static $_uri_spec = null; 37 38 public static function init() 39 { 40 self::$_uri_spec = new URISpec('cards', 'id', '/v1'); 41 self::$_registry->add(get_called_class()); 42 } 43 44 public function debit( 45 $amount, 46 $appears_on_statement_as = null, 47 $description = null, 48 $meta = null, 49 $source = null) 50 { 51 if ($this->account == null) { 52 throw new \UnexpectedValueException('Card is not associated with an account.'); 53 } 54 return $this->account->debit( 55 $amount, 56 $appears_on_statement_as, 57 $description, 58 $meta, 59 $this->uri); 60 } 61 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |