Skip to content

Commit

Permalink
Merge pull request #114 from balanced/acounts_settlements_scenarios
Browse files Browse the repository at this point in the history
Acounts settlements scenarios
  • Loading branch information
remear committed Dec 19, 2014
2 parents f002069 + 0d5ea42 commit 8a973b6
Show file tree
Hide file tree
Showing 169 changed files with 573 additions and 249 deletions.
1 change: 1 addition & 0 deletions scenarios/account_credit/definition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Balanced\Account->credits->create()
20 changes: 20 additions & 0 deletions scenarios/account_credit/executable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$payable_account = Balanced\Account::get("");
$payable_account->credits->create(array(
"amount" => "1000",
"appears_on_statement_as" => "ThingsCo",
"description" => "A simple credit",
"meta" => "Array",
"order" => "/orders/OR2JfBYxYlDAF3L48u9DtIEU",
));

?>
25 changes: 25 additions & 0 deletions scenarios/account_credit/php.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
%if mode == 'definition':
Balanced\Account->credits->create()

% else:
<?php

require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$payable_account = Balanced\Account::get("");
$payable_account->credits->create(array(
"amount" => "1000",
"appears_on_statement_as" => "ThingsCo",
"description" => "A simple credit",
"meta" => "Array",
"order" => "/orders/OR2JfBYxYlDAF3L48u9DtIEU",
));

?>
%endif
6 changes: 6 additions & 0 deletions scenarios/account_credit/request.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$payable_account = Balanced\Account::get("{{ request.href }}");
$payable_account->credits->create(array(
{% for k, v in request.payload %}
"{{ k }}" => "{{ v }}",
{% endfor %}
));
1 change: 1 addition & 0 deletions scenarios/account_list/definition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Balanced\Marketplace::mine()->accounts
14 changes: 14 additions & 0 deletions scenarios/account_list/executable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$marketplace = Balanced\Marketplace::mine();
$accounts = $marketplace->accounts->query()->all();

?>
19 changes: 19 additions & 0 deletions scenarios/account_list/php.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
%if mode == 'definition':
Balanced\Marketplace::mine()->accounts

% else:
<?php

require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$marketplace = Balanced\Marketplace::mine();
$accounts = $marketplace->accounts->query()->all();

?>
%endif
2 changes: 2 additions & 0 deletions scenarios/account_list/request.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$marketplace = Balanced\Marketplace::mine();
$accounts = $marketplace->accounts->query()->all();
1 change: 1 addition & 0 deletions scenarios/account_list_customer/definition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Balanced\Customers->accounts->query()
14 changes: 14 additions & 0 deletions scenarios/account_list_customer/executable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$customer = Balanced\Customer::get("/customers/CU2DRnwOXfbxBlKb5CUWwWJi");
$accounts = customer->accounts->query()->all();

?>
19 changes: 19 additions & 0 deletions scenarios/account_list_customer/php.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
%if mode == 'definition':
Balanced\Customers->accounts->query()

% else:
<?php

require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$customer = Balanced\Customer::get("/customers/CU2DRnwOXfbxBlKb5CUWwWJi");
$accounts = customer->accounts->query()->all();

?>
%endif
2 changes: 2 additions & 0 deletions scenarios/account_list_customer/request.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$customer = Balanced\Customer::get("{{request.customer_href}}");
$accounts = customer->accounts->query()->all();
1 change: 1 addition & 0 deletions scenarios/account_show/definition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Balanced\Account::get
13 changes: 13 additions & 0 deletions scenarios/account_show/executable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$account = Balanced\Account::get("/accounts/AT2t2NS6otEMnPT0jVuRAE6Y");

?>
18 changes: 18 additions & 0 deletions scenarios/account_show/php.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%if mode == 'definition':
Balanced\Account::get

% else:
<?php

require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$account = Balanced\Account::get("/accounts/AT2t2NS6otEMnPT0jVuRAE6Y");

?>
%endif
1 change: 1 addition & 0 deletions scenarios/account_show/request.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$account = Balanced\Account::get("{{ request.uri }}");
2 changes: 1 addition & 1 deletion scenarios/api_key_create/executable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$key = new Balanced\APIKey();
$key->save();
Expand Down
2 changes: 1 addition & 1 deletion scenarios/api_key_create/php.mako
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$key = new Balanced\APIKey();
$key->save();
Expand Down
4 changes: 2 additions & 2 deletions scenarios/api_key_delete/executable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$api_key = Balanced\APIKey::get("/api_keys/AKJnLWedoBhUHpdhoGEOPew");
$api_key = Balanced\APIKey::get("/api_keys/AK2Phglc8FZEbSJWy3H7UeB7");
$api_key->unstore();

?>
4 changes: 2 additions & 2 deletions scenarios/api_key_delete/php.mako
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$api_key = Balanced\APIKey::get("/api_keys/AKJnLWedoBhUHpdhoGEOPew");
$api_key = Balanced\APIKey::get("/api_keys/AK2Phglc8FZEbSJWy3H7UeB7");
$api_key->unstore();

?>
Expand Down
2 changes: 1 addition & 1 deletion scenarios/api_key_list/executable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

Balanced\APIKey->query()->all();

Expand Down
2 changes: 1 addition & 1 deletion scenarios/api_key_list/php.mako
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

Balanced\APIKey->query()->all();

Expand Down
4 changes: 2 additions & 2 deletions scenarios/api_key_show/executable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

Balanced\APIKey::get("/api_keys/AKJnLWedoBhUHpdhoGEOPew")
Balanced\APIKey::get("/api_keys/AK2Phglc8FZEbSJWy3H7UeB7")

?>
4 changes: 2 additions & 2 deletions scenarios/api_key_show/php.mako
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

Balanced\APIKey::get("/api_keys/AKJnLWedoBhUHpdhoGEOPew")
Balanced\APIKey::get("/api_keys/AK2Phglc8FZEbSJWy3H7UeB7")

?>
%endif
6 changes: 3 additions & 3 deletions scenarios/bank_account_associate_to_customer/executable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$bank_account = Balanced\BankAccount::get("/bank_accounts/BA2gul8YMjFWnFk0fFHXwX6g");
$bank_account->associateToCustomer("/customers/CU2718cI8PkMdFyPjboZLZfn");
$bank_account = Balanced\BankAccount::get("/bank_accounts/BA3uzbngfVXy1SGg25Et7iKY");
$bank_account->associateToCustomer("/customers/CU2DRnwOXfbxBlKb5CUWwWJi");

?>
6 changes: 3 additions & 3 deletions scenarios/bank_account_associate_to_customer/php.mako
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$bank_account = Balanced\BankAccount::get("/bank_accounts/BA2gul8YMjFWnFk0fFHXwX6g");
$bank_account->associateToCustomer("/customers/CU2718cI8PkMdFyPjboZLZfn");
$bank_account = Balanced\BankAccount::get("/bank_accounts/BA3uzbngfVXy1SGg25Et7iKY");
$bank_account->associateToCustomer("/customers/CU2DRnwOXfbxBlKb5CUWwWJi");

?>
%endif
2 changes: 1 addition & 1 deletion scenarios/bank_account_create/executable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$marketplace = \Balanced\Marketplace::mine();
$bank_account = $marketplace->bank_accounts->create(array(
Expand Down
2 changes: 1 addition & 1 deletion scenarios/bank_account_create/php.mako
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$marketplace = \Balanced\Marketplace::mine();
$bank_account = $marketplace->bank_accounts->create(array(
Expand Down
4 changes: 2 additions & 2 deletions scenarios/bank_account_credit/executable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$bank_account = Balanced\BankAccount::get("/bank_accounts/BA2gul8YMjFWnFk0fFHXwX6g");
$bank_account = Balanced\BankAccount::get("/bank_accounts/BA3uzbngfVXy1SGg25Et7iKY");
$bank_account->credits->create(array(
"amount" => "5000",
));
Expand Down
4 changes: 2 additions & 2 deletions scenarios/bank_account_credit/php.mako
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$bank_account = Balanced\BankAccount::get("/bank_accounts/BA2gul8YMjFWnFk0fFHXwX6g");
$bank_account = Balanced\BankAccount::get("/bank_accounts/BA3uzbngfVXy1SGg25Et7iKY");
$bank_account->credits->create(array(
"amount" => "5000",
));
Expand Down
6 changes: 3 additions & 3 deletions scenarios/bank_account_debit_order/executable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$order = Balanced\Order::get("/orders/OR5sl2RJVnbwEf45nq5eATdz");
$bank_account = Balanced\BankAccount::get("/bank_accounts/BA17zYxBNrmg9isvicjz9Ae4");
$order = Balanced\Order::get("/orders/OR2JfBYxYlDAF3L48u9DtIEU");
$bank_account = Balanced\BankAccount::get("/bank_accounts/BA305R4Vwumo1KjT9kwVrdfT");
$order->debitFrom(
$bank_account,
"5000"
Expand Down
6 changes: 3 additions & 3 deletions scenarios/bank_account_debit_order/php.mako
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$order = Balanced\Order::get("/orders/OR5sl2RJVnbwEf45nq5eATdz");
$bank_account = Balanced\BankAccount::get("/bank_accounts/BA17zYxBNrmg9isvicjz9Ae4");
$order = Balanced\Order::get("/orders/OR2JfBYxYlDAF3L48u9DtIEU");
$bank_account = Balanced\BankAccount::get("/bank_accounts/BA305R4Vwumo1KjT9kwVrdfT");
$order->debitFrom(
$bank_account,
"5000"
Expand Down
4 changes: 2 additions & 2 deletions scenarios/bank_account_delete/executable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$bank_account = Balanced\BankAccount::get("/bank_accounts/BA1D19WqGc3j78IAhFIkasQd");
$bank_account = Balanced\BankAccount::get("/bank_accounts/BA3gt4RLskm2w09aXHPDaCb3");
$bank_account->unstore();

?>
4 changes: 2 additions & 2 deletions scenarios/bank_account_delete/php.mako
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";
Balanced\Settings::$api_key = "ak-test-1xLFE6RLC1W3P4ePiQDI4UVpRwtKcdfqL";

$bank_account = Balanced\BankAccount::get("/bank_accounts/BA1D19WqGc3j78IAhFIkasQd");
$bank_account = Balanced\BankAccount::get("/bank_accounts/BA3gt4RLskm2w09aXHPDaCb3");
$bank_account->unstore();

?>
Expand Down
Loading

0 comments on commit 8a973b6

Please sign in to comment.