diff --git a/externals/balanced-php/.gitignore b/externals/balanced-php/.gitignore deleted file mode 100644 index dc4e206783..0000000000 --- a/externals/balanced-php/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -# composer -.buildpath -composer.lock -composer.phar -vendor -*~ -*# -# phar -*.phar - -# eclipse-pdt -.settings -.project -*.iml diff --git a/externals/balanced-php/.travis.yml b/externals/balanced-php/.travis.yml deleted file mode 100644 index 9448540876..0000000000 --- a/externals/balanced-php/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: php -before_script: - - curl -s http://getcomposer.org/installer | php - - php composer.phar install -script: phpunit --bootstrap vendor/autoload.php --exclude-group suite tests/ -php: - - 5.3 - - 5.4 diff --git a/externals/balanced-php/LICENSE b/externals/balanced-php/LICENSE deleted file mode 100644 index 5e0cd0dff2..0000000000 --- a/externals/balanced-php/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012 Balanced - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/externals/balanced-php/README.md b/externals/balanced-php/README.md deleted file mode 100644 index 8da0373331..0000000000 --- a/externals/balanced-php/README.md +++ /dev/null @@ -1,156 +0,0 @@ -# Balanced - -Online Marketplace Payments - -[![Build Status](https://secure.travis-ci.org/balanced/balanced-php.png)](http://travis-ci.org/balanced/balanced-php) - -The design of this library was heavily influenced by [Httpful](https://github.com/nategood/httpful). - -## Requirements - -- [PHP](http://www.php.net) >= 5.3 **with** [cURL](http://www.php.net/manual/en/curl.installation.php) -- [RESTful](https://github.com/bninja/restful) >= 0.1 -- [Httpful](https://github.com/nategood/httpful) >= 0.1 - -## Issues - -Please use appropriately tagged github [issues](https://github.com/balanced/balanced-php/issues) to request features or report bugs. - -## Installation - -You can install using [composer](#composer), a [phar](#phar) package or from [source](#source). Note that Balanced is [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) compliant: - -### Composer - -If you don't have Composer [install](http://getcomposer.org/doc/00-intro.md#installation) it: - - $ curl -s https://getcomposer.org/installer | php - -Add this to your `composer.json`: - - { - "require": { - "balanced/balanced": "*" - } - } - -Refresh your dependencies: - - $ php composer.phar update - - -Then make sure to `require` the autoloader and initialize all: - - composer.json - - php composer.phar install - - curl https://raw.github.com/balanced/balanced-php/master/example/example.php > example.php - - php example.php - - curl https://raw.github.com/balanced/balanced-php/master/example/buyer-example.php > buyer-example.php - - php -S 127.0.0.1:9321 buyer-example.php - # now open a browser and go to http://127.0.0.1:9321/ to view how to tokenize cards and add to a buyer - -## Usage - -See https://www.balancedpayments.com/docs/overview?language=php for tutorials and documentation. - -## Testing - - $ phpunit --bootstrap vendor/autoload.php tests/ - -Or if you'd like to skip network calls: - - $ phpunit --exclude-group suite --bootstrap vendor/autoload.php tests/ - -## Publishing - -1. Ensure that **all** [tests](#testing) pass -2. Increment minor `VERSION` in `src/Balanced/Settings` and `composer.json` (`git commit -am 'v{VERSION} release'`) -3. Tag it (`git tag -a v{VERSION} -m 'v{VERSION} release'`) -4. Push the tag (`git push --tag`) -5. [Packagist](http://packagist.org/packages/balanced/balanced) will see the new tag and take it from there -6. Build (`build-phar`) and upload a [phar](http://php.net/manual/en/book.phar.php) file - -## Contributing - -1. Fork it -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Write your code **and [tests](#testing)** -4. Ensure all tests still pass (`phpunit --bootstrap vendor/autoload.php tests/`) -5. Commit your changes (`git commit -am 'Add some feature'`) -6. Push to the branch (`git push origin my-new-feature`) -7. Create new pull request - -## Contributors - -* [Jacob Rus](https://github.com/jrus) -* [Leon Smith](https://github.com/leonsmith) -* [Matt Drollette](https://github.com/MDrollette) -* [You](https://github.com/balanced/balanced-php/issues)! diff --git a/externals/balanced-php/bootstrap.php b/externals/balanced-php/bootstrap.php deleted file mode 100644 index cb127980a2..0000000000 --- a/externals/balanced-php/bootstrap.php +++ /dev/null @@ -1,4 +0,0 @@ -setStub($stub); -exit_unless($phar, "Unable to create a phar. Make sure you have phar.readonly=0 set in your ini file."); -$phar->buildFromDirectory(dirname($source_dir)); -echo "[ OK ]\n"; - -echo "Renaming Phar... "; -$phar_versioned_name = 'balanced-' . \Balanced\Settings::VERSION . '.phar'; -$phar_versioned_path = $base_dir . '/' . $phar_versioned_name; -rename($phar_path, $phar_versioned_path); -echo "[ OK ]\n"; \ No newline at end of file diff --git a/externals/balanced-php/composer.json b/externals/balanced-php/composer.json deleted file mode 100644 index 9cb9660b3b..0000000000 --- a/externals/balanced-php/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "balanced/balanced", - "description": "Client for Balanced API", - "homepage": "http://github.com/balanced/balanced-php", - "license": "MIT", - "keywords": ["payments", "api"], - "version": "0.7.1", - "authors": [ - { - "name": "Balanced", - "email": "dev@balancedpayments.com", - "homepage": "http://www.balancedpayments.com" - } - ], - "require": { - "nategood/httpful": "*", - "bninja/restful": "*" - }, - "autoload": { - "psr-0": { - "Balanced": "src/" - } - } -} diff --git a/externals/balanced-php/example/bank-account-debits.php b/externals/balanced-php/example/bank-account-debits.php deleted file mode 100644 index 0149e58d23..0000000000 --- a/externals/balanced-php/example/bank-account-debits.php +++ /dev/null @@ -1,54 +0,0 @@ -save(); -Balanced\Settings::$api_key = $key->secret; -$marketplace = new Balanced\Marketplace(); -$marketplace->save(); - -// create a bank account -$bank_account = $marketplace->createBankAccount("Jack Q Merchant", - "123123123", - "123123123" -); -$buyer = $marketplace->createAccount("buyer@example.org"); -$buyer->addBankAccount($bank_account); - -print("you can't debit from a bank account until you verify it\n"); -try { - $buyer->debit(100); -} catch (Exception $e) { - printf("Debit failed, %s\n", $e->getMessage()); -} - -// authenticate -$verification = $bank_account->verify(); - -try { - $verification->confirm(1, 2); -} catch (Balanced\Errors\BankAccountVerificationFailure $e) { - printf('Authentication error , %s\n', $e->getMessage()); - print("PROTIP: for TEST bank accounts the valid amount is always 1 and 1\n"); - -} - -$verification->confirm(1, 1); - -$debit = $buyer->debit(100); -printf("debited the bank account %s for %d cents\n", - $debit->source->uri, - $debit->amount -); -print("and there you have it"); - -?> diff --git a/externals/balanced-php/example/buyer-example.php b/externals/balanced-php/example/buyer-example.php deleted file mode 100644 index 20b38ef5ca..0000000000 --- a/externals/balanced-php/example/buyer-example.php +++ /dev/null @@ -1,157 +0,0 @@ -uri; - return; - } catch (Balanced\Errors\Error $e) { - echo $e->getMessage(); - return; - } - } -} - -function create_buyer($email_address, $card_uri) { - $marketplace = Balanced\Marketplace::mine(); - try { - # new buyer - $buyer = $marketplace->createBuyer( - $email_address, - $card_uri); - } - catch (Balanced\Errors\DuplicateAccountEmailAddress $e) { - # oops, account for $email_address already exists so just add the card - $buyer = Balanced\Account::get($e->extras->account_uri); - $buyer->addCard($card_uri); - } - return $buyer; -} - -?> - -
- - - - -
- * \Balanced\Settings::$api_key = 'my-api-key-secret';
- *
- *
- * You can later add another api key if you'd like to rotate or expire old
- * ones:
- *
- *
- * $api_key = new \Balanced\APIKey();
- * $api_key = api_key->save();
- * $new_secret = $api_key->secret;
- * print $new_secret;
- *
- * \Balanced\Settings::$api_key = $new_secret;
- *
- * \Balanced\APIKey::query()
- * ->sort(\Balanced\APIKey::f->created_at->desc())
- * ->first()
- * ->delete();
- *
- */
-class APIKey extends Resource
-{
- protected static $_uri_spec = null;
-
- public static function init()
- {
- self::$_uri_spec = new URISpec('api_keys', 'id', '/v1');
- self::$_registry->add(get_called_class());
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Account.php b/externals/balanced-php/src/Balanced/Account.php
deleted file mode 100644
index d09f89e044..0000000000
--- a/externals/balanced-php/src/Balanced/Account.php
+++ /dev/null
@@ -1,217 +0,0 @@
-createBuyer or
- * Balanced\Marketplace->createMerchant.
- *
- *
- * $marketplace = \Balanced\Marketplace::mine();
- *
- * $card = $marketplace->cards->create(array(
- * 'street_address' => $street_address,
- * 'city' => 'Jollywood',
- * 'region' => 'CA',
- * 'postal_code' => '90210',
- * 'name' => 'Captain Chunk',
- * 'card_number' => '4111111111111111',
- * 'expiration_month' => 7,
- * 'expiration_year' => 2015
- * ));
- *
- * $buyer = $marketplace->createBuyer(
- * 'buyer@example.com',
- * $card->uri,
- * array(
- * 'my_id' => '1212121',
- * )
- * );
- *
- *
- * @see Balanced\Marketplace->createBuyer
- * @see Balanced\Marketplace->createMerchant
- */
-class Account extends Resource
-{
- protected static $_uri_spec = null;
-
- public static function init()
- {
- self::$_uri_spec = new URISpec('accounts', 'id');
- self::$_registry->add(get_called_class());
- }
-
- /**
- * Credit the account.
- *
- * @param int amount Amount to credit the account in USD pennies.
- * @param string description Optional description of the credit.
- * @param array[string]string meta Optional metadata to associate with the credit.
- * @param mixed destination Optional URI of a funding destination (i.e. \Balanced\BankAccount) associated with this account to credit. If not specified the funding destination most recently added to the account is used.
- * @param string appears_on_statement_as Optional description of the credit as it will appears on the customer's billing statement.
- *
- * @return \Balanced\Credit
- */
- public function credit(
- $amount,
- $description = null,
- $meta = null,
- $destination = null,
- $appears_on_statement_as = null)
- {
- if ($destination == null)
- $destination_uri = null;
- else
- $destination_uri = is_string($destination) ? $destination : $destination->uri;
- return $this->credits->create(array(
- 'amount' => $amount,
- 'description' => $description,
- 'meta' => $meta,
- 'destination_uri' => $destination_uri,
- 'appears_on_statement_as' => $appears_on_statement_as
- ));
- }
-
- /**
- * Debit the account.
- *
- * @param int amount Amount to debit the account in USD pennies.
- * @param string appears_on_statement_as Optional description of the debit as it will appears on the customer's billing statement.
- * @param string description Optional description of the debit.
- * @param array[string]string meta Optional metadata to associate with the debit.
- * @param mixed Optional funding source (i.e. \Balanced\Card) or URI of a funding source associated with this account to debit. If not specified the funding source most recently added to the account is used.
- *
- * @return \Balanced\Debit
- */
- public function debit(
- $amount,
- $appears_on_statement_as = null,
- $description = null,
- $meta = null,
- $source = null,
- $on_behalf_of = null)
- {
- if ($source == null) {
- $source_uri = null;
- } else if (is_string($source)) {
- $source_uri = $source;
- } else {
- $source_uri = $source->uri;
- }
-
- if ($on_behalf_of == null) {
- $on_behalf_of_uri = null;
- } else if (is_string($on_behalf_of)) {
- $on_behalf_of_uri = $on_behalf_of;
- } else {
- $on_behalf_of_uri = $on_behalf_of->uri;
- }
-
- if (isset($this->uri) && $on_behalf_of_uri == $this->uri)
- throw new \InvalidArgumentException(
- 'The on_behalf_of parameter MAY NOT be the same account as the account you are debiting!'
- );
-
- return $this->debits->create(array(
- 'amount' => $amount,
- 'description' => $description,
- 'meta' => $meta,
- 'source_uri' => $source_uri,
- 'on_behalf_of_uri' => $on_behalf_of_uri,
- 'appears_on_statement_as' => $appears_on_statement_as
- ));
- }
-
- /**
- * Create a hold (i.e. a guaranteed pending debit) for account funds. You
- * can later capture or void. A hold is associated with a account funding
- * source (i.e. \Balanced\Card). If you don't specify the source then the
- * current primary funding source for the account is used.
- *
- * @param int amount Amount of the hold in USD pennies.
- * @param string Optional description Description of the hold.
- * @param string Optional URI referencing the card to use for the hold.
- * @param array[string]string meta Optional metadata to associate with the hold.
- *
- * @return \Balanced\Hold
- */
- public function hold(
- $amount,
- $description = null,
- $source_uri = null,
- $meta = null)
- {
- return $this->holds->create(array(
- 'amount' => $amount,
- 'description' => $description,
- 'source_uri' => $source_uri,
- 'meta' => $meta
- ));
- }
-
- /**
- * Creates or associates a created card with the account. The default
- * funding source for the account will be this card.
- *
- * @see \Balanced\Marketplace->createCard
- *
- * @param mixed card \Balanced\Card or URI referencing a card to associate with the account. Alternatively it can be an associative array describing a card to create and associate with the account.
- *
- * @return \Balanced\Account
- */
- public function addCard($card)
- {
- if (is_string($card))
- $this->card_uri = $card;
- else if (is_array($card))
- $this->card = $card;
- else
- $this->card_uri = $card->uri;
- return $this->save();
- }
-
- /**
- * Creates or associates a created bank account with the account. The
- * new default funding destination for the account will be this bank account.
- *
- * @see \Balanced\Marketplace->createBankAccount
- *
- * @param mixed bank_account \Balanced\BankAccount or URI for a bank account to associate with the account. Alternatively it can be an associative array describing a bank account to create and associate with the account.
- *
- * @return \Balanced\Account
- */
- public function addBankAccount($bank_account)
- {
- if (is_string($bank_account))
- $this->bank_account_uri = $bank_account;
- else if (is_array($bank_account))
- $this->bank_account = $bank_account;
- else
- $this->bank_account_uri = $bank_account->uri;
- return $this->save();
- }
-
- /**
- * Promotes a role-less or buyer account to a merchant.
- *
- * @see Balanced\Marketplace::createMerchant
- *
- * @param mixed merchant Associative array describing the merchants identity or a URI referencing a created merchant.
- *
- * @return \Balanced\Account
- */
- public function promoteToMerchant($merchant)
- {
- if (is_string($merchant))
- $this->merchant_uri = $merchant;
- else
- $this->merchant = $merchant;
- return $this->save();
- }
-}
diff --git a/externals/balanced-php/src/Balanced/BankAccount.php b/externals/balanced-php/src/Balanced/BankAccount.php
deleted file mode 100644
index 3d920c6308..0000000000
--- a/externals/balanced-php/src/Balanced/BankAccount.php
+++ /dev/null
@@ -1,127 +0,0 @@
-
- * $marketplace = \Balanced\Marketplace::mine();
- *
- * $bank_account = $marketplace->bank_accounts->create(array(
- * 'name' => 'name',
- * 'account_number' => '11223344',
- * 'bank_code' => '1313123',
- * ));
- *
- * $account = $marketplace
- * ->accounts
- * ->query()
- * ->filter(Account::f->email_address->eq('merchant@example.com'))
- * ->one();
- * $account->addBankAccount($bank_account->uri);
- *
- */
-class BankAccount extends Resource
-{
- protected static $_uri_spec = null;
-
- public static function init()
- {
- self::$_uri_spec = new URISpec('bank_accounts', 'id', '/v1');
- self::$_registry->add(get_called_class());
- }
-
- /**
- * Credit a bank account.
- *
- * @param int amount Amount to credit in USD pennies.
- * @param string description Optional description of the credit.
- * @param string appears_on_statement_as Optional description of the credit as it will appears on the customer's billing statement.
- *
- * @return \Balanced\Credit
- *
- *
- * $bank_account = new \Balanced\BankAccount(array(
- * 'account_number' => '12341234',
- * 'name' => 'Fit Finlay',
- * 'bank_code' => '325182797',
- * 'type' => 'checking',
- * ));
- *
- * $credit = $bank_account->credit(123, 'something descriptive');
- *
- */
- public function credit(
- $amount,
- $description = null,
- $meta = null,
- $appears_on_statement_as = null)
- {
- if (!property_exists($this, 'account') || $this->account == null) {
- $credit = $this->credits->create(array(
- 'amount' => $amount,
- 'description' => $description,
- ));
- } else {
- $credit = $this->account->credit(
- $amount,
- $description,
- $meta,
- $this->uri,
- $appears_on_statement_as
- );
- }
- return $credit;
- }
-
- public function verify()
- {
- $response = self::getClient()->post(
- $this->verifications_uri, null
- );
- $verification = new BankAccountVerification();
- $verification->_objectify($response->body);
- return $verification;
- }
-}
-
-/**
- * Represents an verification for a bank account which is a pre-requisite if
- * you want to create debits using the associated bank account. The side-effect
- * of creating a verification is that 2 random amounts will be deposited into
- * the account which must then be confirmed via the confirm method to ensure
- * that you have access to the bank account in question.
- *
- * You can create these via Balanced\Marketplace::bank_accounts::verify.
- *
- *
- * $marketplace = \Balanced\Marketplace::mine();
- *
- * $bank_account = $marketplace->bank_accounts->create(array(
- * 'name' => 'name',
- * 'account_number' => '11223344',
- * 'bank_code' => '1313123',
- * ));
- *
- * $verification = $bank_account->verify();
- *
- */
-class BankAccountVerification extends Resource {
-
- public function confirm($amount1, $amount2) {
- $this->amount_1 = $amount1;
- $this->amount_2 = $amount2;
- $this->save();
- return $this;
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Bootstrap.php b/externals/balanced-php/src/Balanced/Bootstrap.php
deleted file mode 100644
index 7fed7b7025..0000000000
--- a/externals/balanced-php/src/Balanced/Bootstrap.php
+++ /dev/null
@@ -1,79 +0,0 @@
-createCallback.
- *
- */
-class Callback extends Resource
-{
- protected static $_uri_spec = null;
-
- public static function init()
- {
- self::$_uri_spec = new URISpec('callbacks', 'id');
- self::$_registry->add(get_called_class());
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Card.php b/externals/balanced-php/src/Balanced/Card.php
deleted file mode 100644
index 57351ee185..0000000000
--- a/externals/balanced-php/src/Balanced/Card.php
+++ /dev/null
@@ -1,61 +0,0 @@
-
- * $marketplace = \Balanced\Marketplace::mine();
- *
- * $card = $marketplace->cards->create(array(
- * 'name' => 'name',
- * 'account_number' => '11223344',
- * 'bank_code' => '1313123'
- * ));
- *
- * $account = $marketplace
- * ->accounts
- * ->query()
- * ->filter(Account::f->email_address->eq('buyer@example.com'))
- * ->one();
- * $account->addCard($card->uri);
- *
- */
-class Card extends Resource
-{
- protected static $_uri_spec = null;
-
- public static function init()
- {
- self::$_uri_spec = new URISpec('cards', 'id', '/v1');
- self::$_registry->add(get_called_class());
- }
-
- public function debit(
- $amount,
- $appears_on_statement_as = null,
- $description = null,
- $meta = null,
- $source = null)
- {
- if ($this->account == null) {
- throw new \UnexpectedValueException('Card is not associated with an account.');
- }
- return $this->account->debit(
- $amount,
- $appears_on_statement_as,
- $description,
- $meta,
- $this->uri);
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Credit.php b/externals/balanced-php/src/Balanced/Credit.php
deleted file mode 100644
index 67d97d1bd0..0000000000
--- a/externals/balanced-php/src/Balanced/Credit.php
+++ /dev/null
@@ -1,75 +0,0 @@
-
- * $marketplace = \Balanced\Marketplace::mine();
- *
- * $account = $marketplace
- * ->accounts
- * ->query()
- * ->filter(Account::f->email_address->eq('merchant@example.com'))
- * ->one();
- *
- * $credit = $account->credit(
- * 100,
- * 'how it '
- * array(
- * 'my_id': '112233'
- * )
- * );
- *
- */
-class Credit extends Resource
-{
- protected static $_uri_spec = null;
-
- public static function init()
- {
- self::$_uri_spec = new URISpec('credits', 'id', '/v1');
- self::$_registry->add(get_called_class());
- }
-
- /**
- * Credit an unstored bank account.
- *
- * @param int amount Amount to credit in USD pennies.
- * @param string description Optional description of the credit.
- * @param mixed bank_account Associative array describing a bank account to credit. The bank account will *not* be stored.
- *
- * @return \Balanced\Credit
- *
- *
- * $credit = \Balanced\Credit::bankAccount(
- * 123,
- * array(
- * 'account_number' => '12341234',
- * 'name' => 'Fit Finlay',
- * 'bank_code' => '325182797',
- * 'type' => 'checking',
- * ),
- * 'something descriptive');
- *
- */
- public static function bankAccount(
- $amount,
- $bank_account,
- $description = null)
- {
- $credit = new Credit(array(
- 'amount' => $amount,
- 'bank_account' => $bank_account,
- 'description' => $description
- ));
- $credit->save();
- return $credit;
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Debit.php b/externals/balanced-php/src/Balanced/Debit.php
deleted file mode 100644
index d1e87e4f65..0000000000
--- a/externals/balanced-php/src/Balanced/Debit.php
+++ /dev/null
@@ -1,64 +0,0 @@
-
- * $marketplace = \Balanced\Marketplace::mine();
- *
- * $account = $marketplace
- * ->accounts
- * ->query()
- * ->filter(Account::f->email_address->eq('buyer@example.com'))
- * ->one();
- *
- * $debit = $account->debit(
- * 100,
- * 'how it appears on the statement',
- * 'a description',
- * array(
- * 'my_id': '443322'
- * )
- * );
- *
- */
-class Debit extends Resource
-{
- protected static $_uri_spec = null;
-
- public static function init()
- {
- self::$_uri_spec = new URISpec('debits', 'id');
- self::$_registry->add(get_called_class());
- }
-
- /**
- * Create a refund for this debit. You can create multiple refunds for a
- * debit but the total amount of the refunds must be less than the debit
- * amount.
- *
- * @param int amount Optional amount of the refund in USD pennies. If unspecified then the full debit amount is used.
- * @param string description Optional description of the refund.
- * @param array[string]string meta Optional metadata to associate with the refund.
- *
- * @return \Balanced\Refund
- */
- public function refund(
- $amount = null,
- $description = null,
- $meta = null)
- {
- return $this->refunds->create(array(
- 'amount' => $amount,
- 'description' => $description,
- 'meta' => $meta
- ));
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Errors.php b/externals/balanced-php/src/Balanced/Errors.php
deleted file mode 100644
index 363bd84f97..0000000000
--- a/externals/balanced-php/src/Balanced/Errors.php
+++ /dev/null
@@ -1,135 +0,0 @@
-add(get_called_class());
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Hold.php b/externals/balanced-php/src/Balanced/Hold.php
deleted file mode 100644
index ce286b8346..0000000000
--- a/externals/balanced-php/src/Balanced/Hold.php
+++ /dev/null
@@ -1,77 +0,0 @@
-
- * $marketplace = \Balanced\Marketplace::mine();
- *
- * $account = $marketplace
- * ->accounts
- * ->query()
- * ->filter(Account::f->email_address->eq('buyer@example.com'))
- * ->one();
- *
- * $hold = $account->hold(
- * 100,
- * 'a description',
- * null,
- * array(
- * 'my_id': '1293712837'
- * )
- * );
- *
- * $debit = $hold->capture();
- *
- */
-class Hold extends Resource
-{
- protected static $_uri_spec = null;
-
- public static function init()
- {
- self::$_uri_spec = new URISpec('holds', 'id');
- self::$_registry->add(get_called_class());
- }
-
- /**
- ** Voids a pending hold. This releases the held funds. Once voided a hold
- * is not longer pending can cannot be re-captured or re-voided.
- *
- * @return \Balanced\Hold
- */
- public function void()
- {
- $this->is_void = true;
- return $this->save();
- }
-
- /**
- * Captures a pending hold. This results in a debit. Once captured a hold
- * is not longer pending can cannot be re-captured or re-voided.
- *
- * @param int amount Optional Portion of the pending hold to capture. If not specified the full amount associated with the hold is captured.
- *
- * @return \Balanced\Debit
- */
- public function capture($amount = null)
- {
- $this->debit = $this->account->debits->create(array(
- 'hold_uri' => $this->uri,
- 'amount' => $amount,
- ));
- return $this->debit;
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Marketplace.php b/externals/balanced-php/src/Balanced/Marketplace.php
deleted file mode 100644
index bf31353374..0000000000
--- a/externals/balanced-php/src/Balanced/Marketplace.php
+++ /dev/null
@@ -1,325 +0,0 @@
-
- * $api_key = new \Balanced\APIKey();
- * $api_key->save();
- * $secret = $api_key->secret // better save this somewhere
- * print $secret;
- * \Balanced\Settings::$api_key = $secret;
- *
- * $marketplace = new \Balanced\Marketplace();
- * $marketplace->save();
- * var_dump($marketplace);
- *
- *
- * Each api key is uniquely associated with an api key so once you've created a
- * marketplace:
- *
- *
- * \Balanced\Settings::$api_key = $secret;
- * $marketplace = \Balanced\Marketplace::mine(); // this is the marketplace associated with $secret
- *
- */
-class Marketplace extends Resource
-{
- protected static $_uri_spec = null;
-
- public static function init()
- {
- self::$_uri_spec = new URISpec('marketplaces', 'id', '/v1');
- self::$_registry->add(get_called_class());
- }
-
- /**
- * Get the marketplace associated with the currently configured
- * \Balanced\Settings::$api_key.
- *
- * @throws \RESTful\Exceptions\NoResultFound
- * @return \Balanced\Marketplace
- */
- public static function mine()
- {
- return self::query()->one();
- }
-
- /**
- * Create a card. These can later be associated with an account using
- * \Balanced\Account->addCard or \Balanced\Marketplace->createBuyer.
- *
- * @param string street_address Street address. Use null if there is no address for the card.
- * @param string city City. Use null if there is no address for the card.
- * @param string postal_code Postal code. Use null if there is no address for the card.
- * @param string name Name as it appears on the card.
- * @param string card_number Card number.
- * @param string security_code Card security code. Use null if it is no available.
- * @param int expiration_month Expiration month.
- * @param int expiration_year Expiration year.
- *
- * @return \Balanced\Card
- */
- public function createCard(
- $street_address,
- $city,
- $region,
- $postal_code,
- $name,
- $card_number,
- $security_code,
- $expiration_month,
- $expiration_year)
- {
- if ($region != null && strlen($region) > 0) {
- trigger_error("The region parameter will be deprecated in the next minor version of balanced-php", E_USER_NOTICE);
- }
-
- return $this->cards->create(array(
- 'street_address' => $street_address,
- 'city' => $city,
- 'region' => $region,
- 'postal_code' => $postal_code,
- 'name' => $name,
- 'card_number' => $card_number,
- 'security_code' => $security_code,
- 'expiration_month' => $expiration_month,
- 'expiration_year' => $expiration_year
- ));
- }
-
- /**
- * Create a bank account. These can later be associated with an account
- * using \Balanced\Account->addBankAccount.
- *
- * @param string name Name of the account holder.
- * @param string account_number Account number.
- * @param string routing_number Bank code or routing number.
- * @param string type checking or savings
- * @param array meta Single level mapping from string keys to string values.
- *
- * @return \Balanced\BankAccount
- */
- public function createBankAccount(
- $name,
- $account_number,
- $routing_number,
- $type,
- $meta = null
- )
- {
- return $this->bank_accounts->create(array(
- 'name' => $name,
- 'account_number' => $account_number,
- 'routing_number' => $routing_number,
- 'type' => $type,
- 'meta' => $meta
- ));
- }
-
- /**
- * Create a role-less account. You can later turn this into a buyer by
- * adding a funding source (e.g a card) or a merchant using
- * \Balanced\Account->promoteToMerchant.
- *
- * @param string email_address Optional email address. There can only be one account with this email address.
- * @param array[string]string meta Optional metadata to associate with the account.
- *
- * @return \Balanced\Account
- */
- public function createAccount($email_address = null, $meta = null)
- {
- return $this->accounts->create(array(
- 'email_address' => $email_address,
- 'meta' => $meta,
- ));
- }
-
- /**
- * Find or create a role-less account by email address. You can later turn
- * this into a buyer by adding a funding source (e.g a card) or a merchant
- * using \Balanced\Account->promoteToMerchant.
- *
- * @param string email_address Email address. There can only be one account with this email address.
- *
- * @return \Balanced\Account
- */
- function findOrCreateAccountByEmailAddress($email_address)
- {
- $marketplace = Marketplace::mine();
- try {
- $account = $this->accounts->create(array(
- 'email_address' => $email_address
- ));
- }
- catch (Errors\DuplicateAccountEmailAddress $e) {
- $account = Account::get($e->extras->account_uri);
- }
- return $account;
- }
-
- /**
- * Create a buyer account.
- *
- * @param string email_address Optional email address. There can only be one account with this email address.
- * @param string card_uri URI referencing a card to associate with the account.
- * @param array[string]string meta Optional metadata to associate with the account.
- * @param string name Optional name of the account.
- *
- * @return \Balanced\Account
- */
- public function createBuyer($email_address, $card_uri, $meta = null, $name = null)
- {
- return $this->accounts->create(array(
- 'email_address' => $email_address,
- 'card_uri' => $card_uri,
- 'meta' => $meta,
- 'name' => $name
- ));
- }
-
- /**
- * Create a merchant account.
- *
- * Unlike buyers the identity of a merchant must be established before
- * the account can function as a merchant (i.e. be credited). A merchant
- * can be either a person or a business. Either way that information is
- * represented as an associative array and passed as the merchant parameter
- * when creating the merchant account.
- *
- * For a person the array looks like this:
- *
- *
- * array(
- * 'type' => 'person',
- * 'name' => 'William James',
- * 'tax_id' => '393-48-3992',
- * 'street_address' => '167 West 74th Street',
- * 'postal_code' => '10023',
- * 'dob' => '1842-01-01',
- * 'phone_number' => '+16505551234',
- * 'country_code' => 'USA'
- * )
- *
- *
- * For a business the array looks like this:
- *
- *
- * array(
- * 'type' => 'business',
- * 'name' => 'Levain Bakery',
- * 'tax_id' => '253912384',
- * 'street_address' => '167 West 74th Street',
- * 'postal_code' => '10023',
- * 'phone_number' => '+16505551234',
- * 'country_code' => 'USA',
- * 'person' => array(
- * 'name' => 'William James',
- * 'tax_id' => '393483992',
- * 'street_address' => '167 West 74th Street',
- * 'postal_code' => '10023',
- * 'dob' => '1842-01-01',
- * 'phone_number' => '+16505551234',
- * 'country_code' => 'USA',
- * )
- * )
- *
- *
- * In some cases the identity of the merchant, person or business, cannot
- * be verified in which case a \Balanced\Exceptions\HTTPError is thrown:
- *
- *
- * $identity = array(
- * 'type' => 'business',
- * 'name' => 'Levain Bakery',
- * 'tax_id' => '253912384',
- * 'street_address' => '167 West 74th Street',
- * 'postal_code' => '10023',
- * 'phone_number' => '+16505551234',
- * 'country_code' => 'USA',
- * 'person' => array(
- * 'name' => 'William James',
- * 'tax_id' => '393483992',
- * 'street_address' => '167 West 74th Street',
- * 'postal_code' => '10023',
- * 'dob' => '1842-01-01',
- * 'phone_number' => '+16505551234',
- * 'country_code' => 'USA',
- * ),
- * );
- *
- * try {
- * $merchant = \Balanced\Marketplace::mine()->createMerchant(
- * 'merchant@example.com',
- * $identity,
- * );
- * catch (\Balanced\Exceptions\HTTPError $e) {
- * if ($e->code != 300) {
- * throw $e;
- * }
- * print e->response->header['Location'] // this is where merchant must signup
- * }
- *
- *
- * Once the merchant has completed signup you can use the resulting URI to
- * create an account for them on your marketplace:
- *
- *
- * $merchant = self::$marketplace->createMerchant(
- * 'merchant@example.com',
- * null,
- * null,
- * $merchant_uri
- * );
- *
- *
- * @param string email_address Optional email address. There can only be one account with this email address.
- * @param array[string]mixed merchant Associative array describing the merchants identity.
- * @param string $bank_account_uri Optional URI referencing a bank account to associate with this account.
- * @param string $merchant_uri URI of a merchant created via the redirection sign-up flow.
- * @param string $name Optional name of the merchant.
- * @param array[string]string meta Optional metadata to associate with the account.
- *
- * @return \Balanced\Account
- */
- public function createMerchant(
- $email_address = null,
- $merchant = null,
- $bank_account_uri = null,
- $merchant_uri = null,
- $name = null,
- $meta = null)
- {
- return $this->accounts->create(array(
- 'email_address' => $email_address,
- 'merchant' => $merchant,
- 'merchant_uri' => $merchant_uri,
- 'bank_account_uri' => $bank_account_uri,
- 'name' => $name,
- 'meta' => $meta,
- ));
- }
-
- /*
- * Create a callback.
- *
- * @param string url URL of callback.
- */
- public function createCallback(
- $url
- )
- {
- return $this->callbacks->create(array(
- 'url' => $url
- ));
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Merchant.php b/externals/balanced-php/src/Balanced/Merchant.php
deleted file mode 100644
index 7848215bea..0000000000
--- a/externals/balanced-php/src/Balanced/Merchant.php
+++ /dev/null
@@ -1,51 +0,0 @@
-add(get_called_class());
- }
-
- /**
- * Return the merchant identity associated with the current
- * Balanced\Settings::$api_key. If you are not authenticated (i.e.
- * ) then Balanced\Exceptions\NoResult
- * will be thrown.
- *
- *
- * $merchant = \Balanced\Merchant::me();
- * $owner_account = \Balanced\Marketplace::mine()->owner_account;
- * assert($merchant->id == $owner_account->merchant->id);
- *
- *
- * @throws \RESTful\Exceptions\NoResultFound
- * @return \Balanced\Merchant
- */
- public static function me()
- {
- return self::query()->one();
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Refund.php b/externals/balanced-php/src/Balanced/Refund.php
deleted file mode 100644
index e4e1c033fb..0000000000
--- a/externals/balanced-php/src/Balanced/Refund.php
+++ /dev/null
@@ -1,50 +0,0 @@
-
- * $marketplace = \Balanced\Marketplace::mine();
- *
- * $account = $marketplace
- * ->accounts
- * ->query()
- * ->filter(Account::f->email_address->eq('buyer@example.com'))
- * ->one();
- *
- * $debit = $account->debit(
- * 100,
- * 'how it appears on the statement',
- * 'a description',
- * array(
- * 'my_id': '443322'
- * )
- * );
- *
- * $debit->refund(
- * 99,
- * 'some description',
- * array(
- * 'my_id': '123123'
- * )
- * );
- *
- */
-class Refund extends Resource
-{
- protected static $_uri_spec = null;
-
- public static function init()
- {
- self::$_uri_spec = new URISpec('refunds', 'id');
- self::$_registry->add(get_called_class());
- }
-}
-
diff --git a/externals/balanced-php/src/Balanced/Resource.php b/externals/balanced-php/src/Balanced/Resource.php
deleted file mode 100644
index 0cbc304516..0000000000
--- a/externals/balanced-php/src/Balanced/Resource.php
+++ /dev/null
@@ -1,48 +0,0 @@
-body, 'category_code') &&
- array_key_exists($response->body->category_code, Error::$codes))
- $error = new Error::$codes[$response->body->category_code]($response);
- else
- $error = new HTTPError($response);
- return $error;
- }
-
- public static function getClient()
- {
- $class = get_called_class();
- return $class::$_client;
- }
-
- public static function getRegistry()
- {
- $class = get_called_class();
- return $class::$_registry;
- }
-
- public static function getURISpec()
- {
- $class = get_called_class();
- return $class::$_uri_spec;
- }
-}
diff --git a/externals/balanced-php/src/Balanced/Settings.php b/externals/balanced-php/src/Balanced/Settings.php
deleted file mode 100644
index e4fc3a9ab3..0000000000
--- a/externals/balanced-php/src/Balanced/Settings.php
+++ /dev/null
@@ -1,43 +0,0 @@
-
- * \Balanced\Settngs::api_key = 'my-api-key-secret';
- *
- *
- * or all at once:
- *
- *
- * \Balanced\Settngs::configure(
- * 'https://api.balancedpayments.com',
- * 'my-api-key-secret'
- * );
- *
- */
-class Settings
-{
- const VERSION = '0.7.1';
-
- public static $url_root = 'https://api.balancedpayments.com',
- $api_key = null,
- $agent = 'balanced-php',
- $version = Settings::VERSION;
-
- /**
- * Configure all settings.
- *
- * @param string url_root The root (schema://hostname[:port]) to use when constructing api URLs.
- * @param string api_key The api key secret to use for authenticating when talking to the api. If null then api usage is limited to uauthenticated endpoints.
- */
- public static function configure($url_root, $api_key)
- {
- self::$url_root= $url_root;
- self::$api_key = $api_key;
- }
-}
diff --git a/externals/balanced-php/tests/Balanced/ResourceTest.php b/externals/balanced-php/tests/Balanced/ResourceTest.php
deleted file mode 100644
index 4888934f12..0000000000
--- a/externals/balanced-php/tests/Balanced/ResourceTest.php
+++ /dev/null
@@ -1,614 +0,0 @@
-expectOutputString('');
- $result = Resource::getRegistry()->match('/v1/api_keys');
- return;
- $expected = array(
- 'collection' => true,
- 'class' => 'Balanced\APIKey',
- );
- $this->assertEquals($expected, $result);
- $result = Resource::getRegistry()->match('/v1/api_keys/1234');
- $expected = array(
- 'collection' => false,
- 'class' => 'Balanced\APIKey',
- 'ids' => array('id' => '1234'),
- );
- $this->assertEquals($expected, $result);
- }
-}
-
-class MarketplaceTest extends \PHPUnit_Framework_TestCase
-{
- function testRegistry()
- {
- $result = Resource::getRegistry()->match('/v1/marketplaces');
- $expected = array(
- 'collection' => true,
- 'class' => 'Balanced\Marketplace',
- );
- $this->assertEquals($expected, $result);
- $result = Resource::getRegistry()->match('/v1/marketplaces/1122');
- $expected = array(
- 'collection' => false,
- 'class' => 'Balanced\Marketplace',
- 'ids' => array('id' => '1122'),
- );
- $this->assertEquals($expected, $result);
- }
-
- function testCreateCard()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Card', 'some/uri', null)
- );
-
- $collection->expects($this->once())
- ->method('create')
- ->with(array(
- 'street_address' => '123 Fake Street',
- 'city' => 'Jollywood',
- 'region' => '',
- 'postal_code' => '90210',
- 'name' => 'khalkhalash',
- 'card_number' => '4112344112344113',
- 'security_code' => '123',
- 'expiration_month' => 12,
- 'expiration_year' => 2013,
- ));
-
- $marketplace = new Marketplace(array('cards' => $collection));
- $marketplace->createCard(
- '123 Fake Street',
- 'Jollywood',
- '',
- '90210',
- 'khalkhalash',
- '4112344112344113',
- '123',
- 12,
- 2013);
- }
-
- function testCreateBankAccount()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\BankAccount', 'some/uri', null)
- );
-
- $collection->expects($this->once())
- ->method('create')
- ->with(array(
- 'name' => 'Homer Jay',
- 'account_number' => '112233a',
- 'routing_number' => '121042882',
- 'type' => 'savings',
- 'meta' => null
- ));
-
- $marketplace = new Marketplace(array('bank_accounts' => $collection));
- $marketplace->createBankAccount(
- 'Homer Jay',
- '112233a',
- '121042882',
- 'savings');
- }
-
- function testCreateAccount()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Account', 'some/uri', null)
- );
-
- $collection->expects($this->once())
- ->method('create')
- ->with(array(
- 'email_address' => 'role-less@example.com',
- 'meta' => array('test#' => 'test_d')
- ));
-
- $marketplace = new Marketplace(array('accounts' => $collection));
- $marketplace->createAccount(
- 'role-less@example.com',
- array('test#' => 'test_d')
- );
- }
-
- function testCreateBuyer()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Account', 'some/uri', null)
- );
-
- $collection->expects($this->once())
- ->method('create')
- ->with(array(
- 'email_address' => 'buyer@example.com',
- 'card_uri' => '/some/card/uri',
- 'meta' => array('test#' => 'test_d'),
- 'name' => 'Buy Er'
- ));
-
- $marketplace = new Marketplace(array('accounts' => $collection));
- $marketplace->createBuyer(
- 'buyer@example.com',
- '/some/card/uri',
- array('test#' => 'test_d'),
- 'Buy Er'
- );
- }
-}
-
-class AccountTest extends \PHPUnit_Framework_TestCase
-{
- function testRegistry()
- {
- $result = Resource::getRegistry()->match('/v1/accounts');
- $expected = array(
- 'collection' => true,
- 'class' => 'Balanced\Account',
- );
- $this->assertEquals($expected, $result);
- $result = Resource::getRegistry()->match('/v1/accounts/0099');
- $expected = array(
- 'collection' => false,
- 'class' => 'Balanced\Account',
- 'ids' => array('id' => '0099'),
- );
- $this->assertEquals($expected, $result);
- }
-
- function testCredit()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Credit', 'some/uri', null)
- );
-
- $collection
- ->expects($this->once())
- ->method('create')
- ->with(array(
- 'amount' => 101,
- 'description' => 'something sweet',
- 'meta' => null,
- 'destination_uri' => null,
- 'appears_on_statement_as' => null
- ));
-
- $account = new Account(array('credits' => $collection));
- $account->credit(101, 'something sweet');
- }
-
- function testDebit()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Debit', 'some/uri', null)
- );
-
- $collection
- ->expects($this->once())
- ->method('create')
- ->with(array(
- 'amount' => 9911,
- 'description' => 'something tangy',
- 'appears_on_statement_as' => 'BAL*TANG',
- 'meta' => null,
- 'source_uri' => null,
- 'on_behalf_of_uri' => null,
- ));
-
- $account = new Account(array('debits' => $collection));
- $account->debit(9911, 'BAL*TANG', 'something tangy');
- }
-
- function testHold()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Hold', 'some/uri', null)
- );
-
- $collection
- ->expects($this->once())
- ->method('create')
- ->with(array(
- 'amount' => 1243,
- 'description' => 'something crispy',
- 'source_uri' => '/some/card/uri',
- 'meta' => array('test#' => 'test_d')
- ));
-
- $account = new Account(array('holds' => $collection));
- $account->hold(
- 1243,
- 'something crispy',
- '/some/card/uri',
- array('test#' => 'test_d')
- );
- }
-
- function testAddCard()
- {
- $account = $this->getMock(
- '\Balanced\Account',
- array('save')
- );
-
- $account
- ->expects($this->once())
- ->method('save')
- ->with();
-
- $account->addCard('/my/new/card/121212');
- $this->assertEquals($account->card_uri, '/my/new/card/121212');
- }
-
- function testAddBankAccount()
- {
- $account = $this->getMock(
- '\Balanced\Account',
- array('save')
- );
-
- $account
- ->expects($this->once())
- ->method('save')
- ->with();
-
- $account->addBankAccount('/my/new/bank_account/121212');
- $this->assertEquals($account->bank_account_uri, '/my/new/bank_account/121212');
- }
-
- function testPromotToMerchant()
- {
- $account = $this->getMock(
- '\Balanced\Account',
- array('save')
- );
-
- $account
- ->expects($this->once())
- ->method('save')
- ->with();
-
- $merchant = array(
- 'type' => 'person',
- 'name' => 'William James',
- 'tax_id' => '393-48-3992',
- 'street_address' => '167 West 74th Street',
- 'postal_code' => '10023',
- 'dob' => '1842-01-01',
- 'phone_number' => '+16505551234',
- 'country_code' => 'USA'
- );
-
- $account->promoteToMerchant($merchant);
- $this->assertEquals($account->merchant, $merchant);
- }
-}
-
-class HoldTest extends \PHPUnit_Framework_TestCase
-{
- function testRegistry()
- {
- $result = Resource::getRegistry()->match('/v1/holds');
- $expected = array(
- 'collection' => true,
- 'class' => 'Balanced\Hold',
- );
- $this->assertEquals($expected, $result);
- $result = Resource::getRegistry()->match('/v1/holds/112233');
- $expected = array(
- 'collection' => false,
- 'class' => 'Balanced\Hold',
- 'ids' => array('id' => '112233'),
- );
- $this->assertEquals($expected, $result);
- }
-
- function testVoid()
- {
- $hold = $this->getMock(
- '\Balanced\Hold',
- array('save')
- );
-
- $hold
- ->expects($this->once())
- ->method('save')
- ->with();
-
- $hold->void();
- $this->assertTrue($hold->is_void);
- }
-
- function testCapture()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Debit', 'some/uri', null)
- );
-
- $collection
- ->expects($this->once())
- ->method('create')
- ->with(array(
- 'hold_uri' => 'some/hold/uri',
- 'amount' => 2211,
- ));
-
- $account = new Account(array('debits' => $collection));
-
- $hold = new Hold(array('uri' => 'some/hold/uri', 'account' => $account));
-
- $hold->capture(2211);
- }
-}
-
-class CreditTest extends \PHPUnit_Framework_TestCase
-{
- function testRegistry()
- {
- $result = Resource::getRegistry()->match('/v1/credits');
- $expected = array(
- 'collection' => true,
- 'class' => 'Balanced\Credit',
- );
- $this->assertEquals($expected, $result);
- $result = Resource::getRegistry()->match('/v1/credits/9988');
- $expected = array(
- 'collection' => false,
- 'class' => 'Balanced\Credit',
- 'ids' => array('id' => '9988'),
- );
- $this->assertEquals($expected, $result);
- }
-}
-
-class DebitTest extends \PHPUnit_Framework_TestCase
-{
- function testRegistry()
- {
- $result = Resource::getRegistry()->match('/v1/debits');
- $expected = array(
- 'collection' => true,
- 'class' => 'Balanced\Debit',
- );
- $this->assertEquals($expected, $result);
- $result = Resource::getRegistry()->match('/v1/debits/4545');
- $expected = array(
- 'collection' => false,
- 'class' => 'Balanced\Debit',
- 'ids' => array('id' => '4545'),
- );
- $this->assertEquals($expected, $result);
- }
-
- function testRefund()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Refund', 'some/uri', null)
- );
-
- $collection
- ->expects($this->once())
- ->method('create')
- ->with(array(
- 'amount' => 5645,
- 'description' => null,
- 'meta' => array('test#' => 'test_d')
- ));
-
- $debit = new Debit(array('refunds' => $collection));
-
- $debit->refund(5645, null, array('test#' => 'test_d'));
- }
-}
-
-class RefundTest extends \PHPUnit_Framework_TestCase
-{
- function testRegistry()
- {
- $result = Resource::getRegistry()->match('/v1/refunds');
- $expected = array(
- 'collection' => true,
- 'class' => 'Balanced\Refund',
- );
- $this->assertEquals($expected, $result);
- $result = Resource::getRegistry()->match('/v1/refunds/1287');
- $expected = array(
- 'collection' => false,
- 'class' => 'Balanced\Refund',
- 'ids' => array('id' => '1287'),
- );
- $this->assertEquals($expected, $result);
- }
-}
-
-class BankAccountTest extends \PHPUnit_Framework_TestCase
-{
- function testRegistry()
- {
- $result = Resource::getRegistry()->match('/v1/bank_accounts');
- $expected = array(
- 'collection' => true,
- 'class' => 'Balanced\BankAccount',
- );
- $this->assertEquals($expected, $result);
- $result = Resource::getRegistry()->match('/v1/bank_accounts/887766');
- $expected = array(
- 'collection' => false,
- 'class' => 'Balanced\BankAccount',
- 'ids' => array('id' => '887766'),
- );
- $this->assertEquals($expected, $result);
- }
-
- function testCreditAccount()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Credit', 'some/uri', null)
- );
-
- $collection
- ->expects($this->once())
- ->method('create')
- ->with(array(
- 'amount' => 101,
- 'description' => 'something super sweet',
- 'meta' => null,
- 'destination_uri' => '/some/other/uri',
- 'appears_on_statement_as' => null
- ));
-
- $account = new Account(array('credits' => $collection));
- $bank_account = new BankAccount(array('uri' => '/some/other/uri', 'account' => $account));
-
- $bank_account->credit(101, 'something super sweet');
- }
-
- function testCreditAccountless()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Credit', 'some/uri', null)
- );
-
- $collection
- ->expects($this->once())
- ->method('create')
- ->with(array(
- 'amount' => 101,
- 'description' => 'something super sweet',
- ));
- $bank_account = new BankAccount(array(
- 'uri' => '/some/other/uri',
- 'account' => null,
- 'credits' => $collection,
- ));
-
- $bank_account->credit(101, 'something super sweet');
- }
-}
-
-class CardTest extends \PHPUnit_Framework_TestCase
-{
- function testRegistry()
- {
- $result = Resource::getRegistry()->match('/v1/cards');
- $expected = array(
- 'collection' => true,
- 'class' => 'Balanced\Card',
- );
- $this->assertEquals($expected, $result);
- $result = Resource::getRegistry()->match('/v1/cards/136asd6713');
- $expected = array(
- 'collection' => false,
- 'class' => 'Balanced\Card',
- 'ids' => array('id' => '136asd6713'),
- );
- $this->assertEquals($expected, $result);
- }
-
- function testDebit()
- {
- $collection = $this->getMock(
- '\RESTful\Collection',
- array('create'),
- array('\Balanced\Debit', 'some/uri', null)
- );
-
- $account = new Account(array('debits' => $collection));
- $card = new Card(array('uri' => '/some/uri', 'account' => $account ));
-
- $collection
- ->expects($this->once())
- ->method('create')
- ->with(array(
- 'amount' => 9911,
- 'description' => 'something tangy',
- 'appears_on_statement_as' => 'BAL*TANG',
- 'meta' => null,
- 'source_uri' => '/some/uri',
- 'on_behalf_of_uri' => null,
- ));
-
- $card->debit(9911, 'BAL*TANG', 'something tangy');
- }
-
- /**
- * @expectedException \UnexpectedValueException
- */
- function testNotAssociatedDebit()
- {
- $card = new Card(array('uri' => '/some/uri', 'account' => null ));
- $card->debit(9911, 'BAL*TANG', 'something tangy');
- }
-}
-
-
-class MerchantTest extends \PHPUnit_Framework_TestCase
-{
- function testRegistry()
- {
- $result = Resource::getRegistry()->match('/v1/merchants');
- $expected = array(
- 'collection' => true,
- 'class' => 'Balanced\Merchant',
- );
- $this->assertEquals($expected, $result);
- $result = Resource::getRegistry()->match('/v1/merchants/136asd6713');
- $expected = array(
- 'collection' => false,
- 'class' => 'Balanced\Merchant',
- 'ids' => array('id' => '136asd6713'),
- );
- $this->assertEquals($expected, $result);
- }
-}
diff --git a/externals/balanced-php/tests/Balanced/SuiteTest.php b/externals/balanced-php/tests/Balanced/SuiteTest.php
deleted file mode 100644
index 9c324b912d..0000000000
--- a/externals/balanced-php/tests/Balanced/SuiteTest.php
+++ /dev/null
@@ -1,798 +0,0 @@
-
- *