From 360bcd81eb34fdfa5afff55a342eee755354b401 Mon Sep 17 00:00:00 2001 From: arzynik Date: Fri, 12 Jul 2013 11:00:26 -0700 Subject: [PATCH] added stripe and balanced tests --- include/config/config.xml | 3 +- .../default/cockpit/tests/svb/balanced.php | 37 ++++++++++ .../default/cockpit/tests/svb/index.php | 9 +++ .../default/cockpit/tests/svb/stripe.php | 30 ++++++++ .../default/cockpit/tests/svb/balanced.phtml | 69 +++++++++++++++++++ .../default/cockpit/tests/svb/stripe.phtml | 61 ++++++++++++++++ 6 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 include/controllers/default/cockpit/tests/svb/balanced.php create mode 100644 include/controllers/default/cockpit/tests/svb/index.php create mode 100644 include/controllers/default/cockpit/tests/svb/stripe.php create mode 100644 include/views/default/cockpit/tests/svb/balanced.phtml create mode 100644 include/views/default/cockpit/tests/svb/stripe.phtml diff --git a/include/config/config.xml b/include/config/config.xml index d1573e8fb..0d99b5643 100755 --- a/include/config/config.xml +++ b/include/config/config.xml @@ -117,7 +117,8 @@ ***REMOVED*** - 9d5c3d58fc5e11e1aa05026ba7c1aba6 + ***REMOVED*** + /v1/marketplaces/***REMOVED*** _KEY_ diff --git a/include/controllers/default/cockpit/tests/svb/balanced.php b/include/controllers/default/cockpit/tests/svb/balanced.php new file mode 100644 index 000000000..d98f3c657 --- /dev/null +++ b/include/controllers/default/cockpit/tests/svb/balanced.php @@ -0,0 +1,37 @@ +balanced->{$env}->secret; + $b = Balanced\Marketplace::mine(); + + $account = $b->createBuyer( + 'session-'.rand(1000,100000000).'@_DOMAIN_', + $_REQUEST['card'], + [ + 'name' => 'UNIT TEST NAME', + 'phone' => '4150000000', + 'address' => '' + ] + ); + $account->addCard($_REQUEST['card']); + + $charge = $account->debit(100, 'Crunchbutton', 'UNIT TEST'); + if ($charge->status == 'succeeded') { + echo json_encode(['id' => $charge->id]); + } + + break; + + default: + c::view()->display('tests/svb/balanced', false); + break; + } + + exit; + } +} \ No newline at end of file diff --git a/include/controllers/default/cockpit/tests/svb/index.php b/include/controllers/default/cockpit/tests/svb/index.php new file mode 100644 index 000000000..030ddfd28 --- /dev/null +++ b/include/controllers/default/cockpit/tests/svb/index.php @@ -0,0 +1,9 @@ +useFilter(false); + c::view()->display('tests/svb', false); + exit; + } +} \ No newline at end of file diff --git a/include/controllers/default/cockpit/tests/svb/stripe.php b/include/controllers/default/cockpit/tests/svb/stripe.php new file mode 100644 index 000000000..99e6d403d --- /dev/null +++ b/include/controllers/default/cockpit/tests/svb/stripe.php @@ -0,0 +1,30 @@ +stripe->{$env}->secret); + $charge = Stripe_Charge::create([ + 'amount' => 100, + 'currency' => 'usd', + 'card' => $_REQUEST['card'], + 'description' => 'Unit test charge' + ]); + + if ($charge->paid) { + echo json_encode(['id' => $charge->id]); + } + + break; + + default: + c::view()->display('tests/svb/stripe', false); + break; + } + + exit; + } +} \ No newline at end of file diff --git a/include/views/default/cockpit/tests/svb/balanced.phtml b/include/views/default/cockpit/tests/svb/balanced.phtml new file mode 100644 index 000000000..25aae5610 --- /dev/null +++ b/include/views/default/cockpit/tests/svb/balanced.phtml @@ -0,0 +1,69 @@ + + + + + + +
+ + + \ No newline at end of file diff --git a/include/views/default/cockpit/tests/svb/stripe.phtml b/include/views/default/cockpit/tests/svb/stripe.phtml new file mode 100644 index 000000000..425a36ab1 --- /dev/null +++ b/include/views/default/cockpit/tests/svb/stripe.phtml @@ -0,0 +1,61 @@ + + + + + + +
+ + + \ No newline at end of file