[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <? 2 require('vendor/autoload.php'); 3 4 Httpful\Bootstrap::init(); 5 RESTful\Bootstrap::init(); 6 Balanced\Bootstrap::init(); 7 8 $key = new Balanced\APIKey(); 9 $key->save(); 10 Balanced\Settings::$api_key = $key->secret; 11 $marketplace = new Balanced\Marketplace(); 12 $marketplace->save(); 13 14 $card = $marketplace->cards->create(array( 15 "card_number" => "5105105105105100", 16 "expiration_month" => "12", 17 "expiration_year" => "2015" 18 )); 19 20 $buyer = $marketplace->createBuyer("[email protected]", $card->uri); 21 22 $debit = $buyer->debit(1500); 23 $debit->refund(100); 24 $debit->refund(100); 25 $debit->refund(100); 26 27 echo $debit->refunds->total() . " refunds" . "\n"; 28 29 $total = 0; 30 31 foreach ($debit->refunds as $r) { 32 $total += $r->amount; 33 print "refund = " . $r->amount . "\n"; 34 } 35 36 print $total . "\n"; 37 38 # bigger pagination example 39 40 print "Create 60 **buyer** with cards accounts\n"; 41 42 for ($i = 0; $i < 60; $i++) { 43 $card = $marketplace->cards->create(array( 44 "card_number" => "5105105105105100", 45 "expiration_month" => "12", 46 "expiration_year" => "2015" 47 )); 48 $buyer = $marketplace->createBuyer("buyer" . $i . "@example.org", $card->uri); 49 print '.'; 50 } 51 52 print "\n"; 53 54 $cards = $marketplace->cards; 55 56 print $cards->total() . " cards in Marketplace\n"; 57 58 foreach ($cards as $c) { 59 print "card " . $c->uri . "\n"; 60 } 61 62 # let's iterate through cards for just a single account 63 64 foreach ($buyer->cards as $c) { 65 print "buyer's card " . $c->uri . "\n"; 66 } 67 68 print "and there you have it :)\n"; 69 70 71 ?>
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 |