From 2aa1449888c62cf1923fef34ba387a408aafc3b1 Mon Sep 17 00:00:00 2001
From: Crankshaft Robot
Date: Fri, 30 Oct 2015 12:57:04 +0000
Subject: [PATCH] Crankshaft[BU00000277JXGK] Client - PHP @ 2015-10-30 12:57:04
+0000
---
README.md | 158 +-
circle.yml | 26 +-
composer.json | 13 +-
composer.lock | 3975 +++++++++++++++++
demo/cli_creditors.php | 39 -
demo/demo.php | 14 -
lib/Client.php | 281 ++
lib/Core/ApiClient.php | 102 +
lib/Core/ApiResponse.php | 32 +
lib/Core/Exception/ApiConnectionException.php | 8 +
lib/Core/Exception/ApiException.php | 90 +
.../Exception/GoCardlessInternalException.php | 8 +
lib/Core/Exception/GoCardlessProException.php | 7 +
.../Exception/InvalidApiUsageException.php | 8 +
lib/Core/Exception/InvalidStateException.php | 7 +
.../Exception/MalformedResponseException.php | 20 +
.../Exception/ValidationFailedException.php | 11 +
lib/Core/ListResponse.php | 40 +
lib/Core/Paginator.php | 146 +
lib/Core/Util.php | 81 +
lib/Environment.php | 19 +
.../Core/Error/GoCardlessError.php | 110 -
lib/GoCardlessPro/Core/Error/HttpError.php | 49 -
.../Core/Error/InvalidApiUsageError.php | 14 -
.../Core/Error/InvalidStateError.php | 14 -
.../Core/Error/ValidationFailedError.php | 14 -
lib/GoCardlessPro/Core/ListResponse.php | 69 -
lib/GoCardlessPro/Core/Paginator.php | 209 -
lib/GoCardlessPro/Core/Response.php | 179 -
lib/GoCardlessPro/Environment.php | 15 -
.../Resources/BankDetailsLookup.php | 75 -
lib/GoCardlessPro/Resources/Base.php | 45 -
lib/GoCardlessPro/Resources/Creditor.php | 195 -
.../Resources/CreditorBankAccount.php | 190 -
lib/GoCardlessPro/Resources/Customer.php | 279 --
.../Resources/CustomerBankAccount.php | 189 -
lib/GoCardlessPro/Resources/Event.php | 145 -
lib/GoCardlessPro/Resources/Mandate.php | 172 -
lib/GoCardlessPro/Resources/MandatePdf.php | 63 -
lib/GoCardlessPro/Resources/Payment.php | 220 -
lib/GoCardlessPro/Resources/Payout.php | 141 -
lib/GoCardlessPro/Resources/RedirectFlow.php | 181 -
lib/GoCardlessPro/Resources/Refund.php | 146 -
lib/GoCardlessPro/Resources/Subscription.php | 364 --
.../Resources/Wrapper/NestedArray.php | 73 -
.../Resources/Wrapper/NestedObject.php | 75 -
.../Services/BankDetailsLookupsService.php | 68 -
lib/GoCardlessPro/Services/Base.php | 91 -
.../Services/CreditorBankAccountsService.php | 172 -
.../Services/CreditorsService.php | 164 -
.../Services/CustomerBankAccountsService.php | 214 -
.../Services/CustomersService.php | 164 -
lib/GoCardlessPro/Services/EventsService.php | 112 -
.../Services/MandatePdfsService.php | 78 -
.../Services/MandatesService.php | 229 -
.../Services/PaymentsService.php | 235 -
lib/GoCardlessPro/Services/PayoutsService.php | 116 -
.../Services/RedirectFlowsService.php | 158 -
lib/GoCardlessPro/Services/RefundsService.php | 185 -
.../Services/SubscriptionsService.php | 252 --
lib/Resources/BankDetailsLookup.php | 39 +
lib/Resources/BaseResource.php | 67 +
lib/Resources/Creditor.php | 88 +
lib/Resources/CreditorBankAccount.php | 88 +
lib/Resources/Customer.php | 131 +
lib/Resources/CustomerBankAccount.php | 87 +
lib/Resources/Event.php | 73 +
lib/Resources/Mandate.php | 91 +
lib/Resources/MandatePdf.php | 34 +
lib/Resources/Payment.php | 113 +
lib/Resources/Payout.php | 69 +
lib/Resources/RedirectFlow.php | 74 +
lib/Resources/Refund.php | 67 +
lib/Resources/Subscription.php | 149 +
lib/Services/BankDetailsLookupsService.php | 47 +
lib/Services/BaseService.php | 89 +
lib/Services/CreditorBankAccountsService.php | 137 +
lib/Services/CreditorsService.php | 137 +
lib/Services/CustomerBankAccountsService.php | 166 +
lib/Services/CustomersService.php | 137 +
lib/Services/EventsService.php | 86 +
lib/Services/MandatePdfsService.php | 47 +
lib/Services/MandatesService.php | 195 +
lib/Services/PaymentsService.php | 195 +
lib/Services/PayoutsService.php | 86 +
lib/Services/RedirectFlowsService.php | 103 +
lib/Services/RefundsService.php | 137 +
lib/Services/SubscriptionsService.php | 166 +
lib/loader.php | 47 +-
.../Client.php | 35 +-
.../Core/CurlWrapper.php | 59 +-
.../Core/HttpClient.php | 30 +-
.../Core/Request.php | 30 +-
phpcs-ruleset.xml | 12 +-
phpunit.xml | 2 +-
tests/ClientTest.php | 31 +
tests/Core/ApiClientTest.php | 50 +
tests/Core/Exceptions/ApiExceptionTest.php | 53 +
.../Core/Exceptions/ExceptionMessagesTest.php | 53 +
tests/Core/ListResponseTest.php | 57 +
tests/Core/Mocks/MockResource.php | 16 +
tests/Core/Mocks/MockService.php | 30 +
tests/Core/Mocks/ResourceHolder.php | 11 +
tests/Core/PaginatorTest.php | 69 +
tests/GoCardlessPro/ClientTest.php | 45 -
tests/GoCardlessPro/Core/CurlWrapperTest.php | 73 -
.../Core/Error/GoCardlessErrorTest.php | 161 -
.../GoCardlessPro/Core/Helpers/CurlMocks.php | 37 -
.../Core/Helpers/OpenCurlWrapper.php | 19 -
.../Core/Helpers/StaticStorage.php | 72 -
tests/GoCardlessPro/Core/HttpClientTest.php | 94 -
tests/GoCardlessPro/Core/ListResponseTest.php | 47 -
.../Core/Mocks/ResourceHolder.php | 16 -
.../GoCardlessPro/Core/Mocks/TestResource.php | 32 -
tests/GoCardlessPro/Core/PaginatorTest.php | 94 -
tests/GoCardlessPro/Core/RequestTest.php | 52 -
.../BankDetailsLookupIntegrationTest.php | 42 -
.../CreditorBankAccountIntegrationTest.php | 143 -
.../Integration/CreditorIntegrationTest.php | 147 -
.../CustomerBankAccountIntegrationTest.php | 171 -
.../Integration/CustomerIntegrationTest.php | 167 -
.../Integration/EventIntegrationTest.php | 81 -
.../Integration/IntegrationTestBase.php | 71 -
.../Integration/MandateIntegrationTest.php | 187 -
.../Integration/MandatePdfIntegrationTest.php | 41 -
.../Integration/PaymentIntegrationTest.php | 205 -
.../Integration/PayoutIntegrationTest.php | 81 -
.../RedirectFlowIntegrationTest.php | 99 -
.../Integration/RefundIntegrationTest.php | 131 -
.../SubscriptionIntegrationTest.php | 206 -
.../GoCardlessPro/Resources/ResourceTest.php | 59 -
.../Resources/Wrapper/NestedArrayTest.php | 43 -
.../Resources/Wrapper/NestedObjectTest.php | 30 -
tests/GoCardlessPro/Services/BaseTest.php | 94 -
.../GoCardlessPro/Services/Mocks/BaseImpl.php | 25 -
tests/GoCardlessPro/fixtures/creditors.json | 27 -
tests/GoCardlessPro/fixtures/customers.json | 27 -
.../BankDetailsLookupsIntegrationTest.php | 35 +
.../CreditorBankAccountsIntegrationTest.php | 127 +
.../Integration/CreditorsIntegrationTest.php | 131 +
.../CustomerBankAccountsIntegrationTest.php | 152 +
.../Integration/CustomersIntegrationTest.php | 151 +
tests/Integration/EventsIntegrationTest.php | 71 +
tests/Integration/IntegrationTestBase.php | 47 +
.../MandatePdfsIntegrationTest.php | 34 +
tests/Integration/MandatesIntegrationTest.php | 165 +
tests/Integration/PaymentsIntegrationTest.php | 183 +
tests/Integration/PayoutsIntegrationTest.php | 71 +
.../RedirectFlowsIntegrationTest.php | 86 +
tests/Integration/RefundsIntegrationTest.php | 115 +
.../SubscriptionsIntegrationTest.php | 187 +
tests/Resources/ResourceTest.php | 53 +
.../fixtures/bank_details_lookups.json | 0
.../fixtures/creditor_bank_accounts.json | 6 +-
tests/fixtures/creditors.json | 27 +
.../fixtures/customer_bank_accounts.json | 6 +-
tests/fixtures/customers.json | 27 +
.../{GoCardlessPro => }/fixtures/events.json | 2 +-
tests/fixtures/gocardless_error.json | 9 +
tests/fixtures/invalid_api_usage_error.json | 14 +
tests/fixtures/invalid_state_error.json | 15 +
.../fixtures/mandate_pdfs.json | 0
.../fixtures/mandates.json | 6 +-
.../fixtures/payments.json | 8 +-
.../{GoCardlessPro => }/fixtures/payouts.json | 2 +-
.../fixtures/redirect_flows.json | 0
.../{GoCardlessPro => }/fixtures/refunds.json | 6 +-
.../fixtures/subscriptions.json | 10 +-
tests/fixtures/validation_failed_error.json | 18 +
tests/loader.php | 60 +-
170 files changed, 10083 insertions(+), 8592 deletions(-)
create mode 100644 composer.lock
delete mode 100644 demo/cli_creditors.php
delete mode 100644 demo/demo.php
create mode 100644 lib/Client.php
create mode 100644 lib/Core/ApiClient.php
create mode 100644 lib/Core/ApiResponse.php
create mode 100644 lib/Core/Exception/ApiConnectionException.php
create mode 100644 lib/Core/Exception/ApiException.php
create mode 100644 lib/Core/Exception/GoCardlessInternalException.php
create mode 100644 lib/Core/Exception/GoCardlessProException.php
create mode 100644 lib/Core/Exception/InvalidApiUsageException.php
create mode 100644 lib/Core/Exception/InvalidStateException.php
create mode 100644 lib/Core/Exception/MalformedResponseException.php
create mode 100644 lib/Core/Exception/ValidationFailedException.php
create mode 100644 lib/Core/ListResponse.php
create mode 100644 lib/Core/Paginator.php
create mode 100644 lib/Core/Util.php
create mode 100644 lib/Environment.php
delete mode 100644 lib/GoCardlessPro/Core/Error/GoCardlessError.php
delete mode 100644 lib/GoCardlessPro/Core/Error/HttpError.php
delete mode 100644 lib/GoCardlessPro/Core/Error/InvalidApiUsageError.php
delete mode 100644 lib/GoCardlessPro/Core/Error/InvalidStateError.php
delete mode 100644 lib/GoCardlessPro/Core/Error/ValidationFailedError.php
delete mode 100644 lib/GoCardlessPro/Core/ListResponse.php
delete mode 100644 lib/GoCardlessPro/Core/Paginator.php
delete mode 100644 lib/GoCardlessPro/Core/Response.php
delete mode 100644 lib/GoCardlessPro/Environment.php
delete mode 100644 lib/GoCardlessPro/Resources/BankDetailsLookup.php
delete mode 100644 lib/GoCardlessPro/Resources/Base.php
delete mode 100644 lib/GoCardlessPro/Resources/Creditor.php
delete mode 100644 lib/GoCardlessPro/Resources/CreditorBankAccount.php
delete mode 100644 lib/GoCardlessPro/Resources/Customer.php
delete mode 100644 lib/GoCardlessPro/Resources/CustomerBankAccount.php
delete mode 100644 lib/GoCardlessPro/Resources/Event.php
delete mode 100644 lib/GoCardlessPro/Resources/Mandate.php
delete mode 100644 lib/GoCardlessPro/Resources/MandatePdf.php
delete mode 100644 lib/GoCardlessPro/Resources/Payment.php
delete mode 100644 lib/GoCardlessPro/Resources/Payout.php
delete mode 100644 lib/GoCardlessPro/Resources/RedirectFlow.php
delete mode 100644 lib/GoCardlessPro/Resources/Refund.php
delete mode 100644 lib/GoCardlessPro/Resources/Subscription.php
delete mode 100644 lib/GoCardlessPro/Resources/Wrapper/NestedArray.php
delete mode 100644 lib/GoCardlessPro/Resources/Wrapper/NestedObject.php
delete mode 100644 lib/GoCardlessPro/Services/BankDetailsLookupsService.php
delete mode 100644 lib/GoCardlessPro/Services/Base.php
delete mode 100644 lib/GoCardlessPro/Services/CreditorBankAccountsService.php
delete mode 100644 lib/GoCardlessPro/Services/CreditorsService.php
delete mode 100644 lib/GoCardlessPro/Services/CustomerBankAccountsService.php
delete mode 100644 lib/GoCardlessPro/Services/CustomersService.php
delete mode 100644 lib/GoCardlessPro/Services/EventsService.php
delete mode 100644 lib/GoCardlessPro/Services/MandatePdfsService.php
delete mode 100644 lib/GoCardlessPro/Services/MandatesService.php
delete mode 100644 lib/GoCardlessPro/Services/PaymentsService.php
delete mode 100644 lib/GoCardlessPro/Services/PayoutsService.php
delete mode 100644 lib/GoCardlessPro/Services/RedirectFlowsService.php
delete mode 100644 lib/GoCardlessPro/Services/RefundsService.php
delete mode 100644 lib/GoCardlessPro/Services/SubscriptionsService.php
create mode 100644 lib/Resources/BankDetailsLookup.php
create mode 100644 lib/Resources/BaseResource.php
create mode 100644 lib/Resources/Creditor.php
create mode 100644 lib/Resources/CreditorBankAccount.php
create mode 100644 lib/Resources/Customer.php
create mode 100644 lib/Resources/CustomerBankAccount.php
create mode 100644 lib/Resources/Event.php
create mode 100644 lib/Resources/Mandate.php
create mode 100644 lib/Resources/MandatePdf.php
create mode 100644 lib/Resources/Payment.php
create mode 100644 lib/Resources/Payout.php
create mode 100644 lib/Resources/RedirectFlow.php
create mode 100644 lib/Resources/Refund.php
create mode 100644 lib/Resources/Subscription.php
create mode 100644 lib/Services/BankDetailsLookupsService.php
create mode 100644 lib/Services/BaseService.php
create mode 100644 lib/Services/CreditorBankAccountsService.php
create mode 100644 lib/Services/CreditorsService.php
create mode 100644 lib/Services/CustomerBankAccountsService.php
create mode 100644 lib/Services/CustomersService.php
create mode 100644 lib/Services/EventsService.php
create mode 100644 lib/Services/MandatePdfsService.php
create mode 100644 lib/Services/MandatesService.php
create mode 100644 lib/Services/PaymentsService.php
create mode 100644 lib/Services/PayoutsService.php
create mode 100644 lib/Services/RedirectFlowsService.php
create mode 100644 lib/Services/RefundsService.php
create mode 100644 lib/Services/SubscriptionsService.php
rename lib/{GoCardlessPro => package_path}/Client.php (98%)
rename lib/{GoCardlessPro => package_path}/Core/CurlWrapper.php (88%)
rename lib/{GoCardlessPro => package_path}/Core/HttpClient.php (84%)
rename lib/{GoCardlessPro => package_path}/Core/Request.php (81%)
create mode 100644 tests/ClientTest.php
create mode 100644 tests/Core/ApiClientTest.php
create mode 100644 tests/Core/Exceptions/ApiExceptionTest.php
create mode 100644 tests/Core/Exceptions/ExceptionMessagesTest.php
create mode 100644 tests/Core/ListResponseTest.php
create mode 100644 tests/Core/Mocks/MockResource.php
create mode 100644 tests/Core/Mocks/MockService.php
create mode 100644 tests/Core/Mocks/ResourceHolder.php
create mode 100644 tests/Core/PaginatorTest.php
delete mode 100644 tests/GoCardlessPro/ClientTest.php
delete mode 100644 tests/GoCardlessPro/Core/CurlWrapperTest.php
delete mode 100644 tests/GoCardlessPro/Core/Error/GoCardlessErrorTest.php
delete mode 100644 tests/GoCardlessPro/Core/Helpers/CurlMocks.php
delete mode 100644 tests/GoCardlessPro/Core/Helpers/OpenCurlWrapper.php
delete mode 100644 tests/GoCardlessPro/Core/Helpers/StaticStorage.php
delete mode 100644 tests/GoCardlessPro/Core/HttpClientTest.php
delete mode 100644 tests/GoCardlessPro/Core/ListResponseTest.php
delete mode 100644 tests/GoCardlessPro/Core/Mocks/ResourceHolder.php
delete mode 100644 tests/GoCardlessPro/Core/Mocks/TestResource.php
delete mode 100644 tests/GoCardlessPro/Core/PaginatorTest.php
delete mode 100644 tests/GoCardlessPro/Core/RequestTest.php
delete mode 100644 tests/GoCardlessPro/Integration/BankDetailsLookupIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/CreditorBankAccountIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/CreditorIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/CustomerBankAccountIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/CustomerIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/EventIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/IntegrationTestBase.php
delete mode 100644 tests/GoCardlessPro/Integration/MandateIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/MandatePdfIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/PaymentIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/PayoutIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/RedirectFlowIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/RefundIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Integration/SubscriptionIntegrationTest.php
delete mode 100644 tests/GoCardlessPro/Resources/ResourceTest.php
delete mode 100644 tests/GoCardlessPro/Resources/Wrapper/NestedArrayTest.php
delete mode 100644 tests/GoCardlessPro/Resources/Wrapper/NestedObjectTest.php
delete mode 100644 tests/GoCardlessPro/Services/BaseTest.php
delete mode 100644 tests/GoCardlessPro/Services/Mocks/BaseImpl.php
delete mode 100644 tests/GoCardlessPro/fixtures/creditors.json
delete mode 100644 tests/GoCardlessPro/fixtures/customers.json
create mode 100644 tests/Integration/BankDetailsLookupsIntegrationTest.php
create mode 100644 tests/Integration/CreditorBankAccountsIntegrationTest.php
create mode 100644 tests/Integration/CreditorsIntegrationTest.php
create mode 100644 tests/Integration/CustomerBankAccountsIntegrationTest.php
create mode 100644 tests/Integration/CustomersIntegrationTest.php
create mode 100644 tests/Integration/EventsIntegrationTest.php
create mode 100644 tests/Integration/IntegrationTestBase.php
create mode 100644 tests/Integration/MandatePdfsIntegrationTest.php
create mode 100644 tests/Integration/MandatesIntegrationTest.php
create mode 100644 tests/Integration/PaymentsIntegrationTest.php
create mode 100644 tests/Integration/PayoutsIntegrationTest.php
create mode 100644 tests/Integration/RedirectFlowsIntegrationTest.php
create mode 100644 tests/Integration/RefundsIntegrationTest.php
create mode 100644 tests/Integration/SubscriptionsIntegrationTest.php
create mode 100644 tests/Resources/ResourceTest.php
rename tests/{GoCardlessPro => }/fixtures/bank_details_lookups.json (100%)
rename tests/{GoCardlessPro => }/fixtures/creditor_bank_accounts.json (91%)
create mode 100644 tests/fixtures/creditors.json
rename tests/{GoCardlessPro => }/fixtures/customer_bank_accounts.json (80%)
create mode 100644 tests/fixtures/customers.json
rename tests/{GoCardlessPro => }/fixtures/events.json (94%)
create mode 100644 tests/fixtures/gocardless_error.json
create mode 100644 tests/fixtures/invalid_api_usage_error.json
create mode 100644 tests/fixtures/invalid_state_error.json
rename tests/{GoCardlessPro => }/fixtures/mandate_pdfs.json (100%)
rename tests/{GoCardlessPro => }/fixtures/mandates.json (74%)
rename tests/{GoCardlessPro => }/fixtures/payments.json (65%)
rename tests/{GoCardlessPro => }/fixtures/payouts.json (93%)
rename tests/{GoCardlessPro => }/fixtures/redirect_flows.json (100%)
rename tests/{GoCardlessPro => }/fixtures/refunds.json (82%)
rename tests/{GoCardlessPro => }/fixtures/subscriptions.json (53%)
create mode 100644 tests/fixtures/validation_failed_error.json
diff --git a/README.md b/README.md
index 2332802e..7736cde0 100644
--- a/README.md
+++ b/README.md
@@ -1,57 +1,38 @@
-# PHP Client for GoCardless Pro API
+# GoCardless Pro PHP client library
-- [PHP Doc API Doc](http://gocardless.github.io/gocardless-pro-php/)
-- [GoCardless Pro API Docs](https://developer.gocardless.com/pro/)
-- [Composer Package](https://packagist.org/packages/gocardless/gocardless-pro-php)
+A PHP client for interacting with the GoCardless Pro API.
-### Installation
-
-The files you need to use the client library are in the `/lib` folder.
+- [API Documentation](https://developer.gocardless.com/pro/2015-07-06)
+- [Composer Package](https://packagist.org/packages/gocardless/gocardless-pro)
-To load the library, you only need to require the `lib/loader.php` file. If you're using [Composer](https://getcomposer.org/), you should rely on Composer's autoload functionality.
+### Installation
-#### Install from source
+The recommended way to install `gocardless-pro` is using [Composer](https://getcomposer.org/).
-```console
-$ git clone git://github.com/gocardless/gocardless-pro-php.git
+```bash
+# Install Composer
+curl -sS https://getcomposer.org/installer | php
```
-#### Installing from the tarball
-
-```console
-$ curl -L https://github.com/gocardless/gocardless-pro-php/tarball/master | tar xzv
+Next, run the Composer command to install the latest stable version of `gocardless-pro`.
+```bash
+php composer.phar require gocardless/gocardless-pro-php
```
-#### Installing from the zip
-
-[Click here](https://github.com/gocardless/gocardless-pro-php/zipball/master)
-to download the zip file.
-
-#### Installing with Composer
-
-Add this repository to the contents of your `composer.json`:
-
-```javascript
-{
- "require": {
- "gocardless/gocardless-pro-php": "0.3.1"
- }
-}
+After installing, you need to require Composer's autoloader:
+```php
+require 'vendor/autoload.php';
```
-## Usage Examples
+### Initialising A Client
-- Where a request returns a single resource, the client will return an response object with getters matching the resource's attributes and an attached raw response, retrivable with the `response()` method.
-- Where a request returns multiple resources, the client will return a read-only `ListResponse` object with a method `records()` to return the retrieved records as an array.
-- In case of non-JSON responses (PDFs, etc.), the library will return the raw response.
-- To access data elements, use getter methods (as opposed to properties)
-matching the keys in the JSON response - see the [GoCardless Pro API Docs](https://developer.gocardless.com/pro/) for details.
-
-### Client Initialisation
+Create a `GoCardlessPro\Client` instance, providing your access token and the environment you want to use.
+We strongly advise storing your access token as an environment variable, rather than directly in your code. you can easily load the environment variables from a `.env` file by using something like [phpdotenv](https://github.com/vlucas/phpdotenv), though keep it out of version control!
```php
+$access_token = getenv('GC_ACCESS_TOKEN');
$client = new \GoCardlessPro\Client(array(
- 'access_token' => 'YOUR API TOKEN',
+ 'access_token' => $access_token,
'environment' => \GoCardlessPro\Environment::SANDBOX
));
```
@@ -60,78 +41,101 @@ Your `access_token` can be found under the "Developer" tab in your GoCardless da
The environment can either be `\GoCardlessPro\Environment::SANDBOX` or `\GoCardlessPro\Environment::PRODUCTION`, depending on whether you want to use the sandbox or production API.
-From the client object, resource objects can be accessed for each type of resource which can then be used to fetch or manipulate the resource's members. The available resources can be found in the [PHP library docs](http://gocardless.github.io/gocardless-pro-php/classes/GoCardless.Client.html).
+For full documentation, see our [API docs](https://developer.gocardless.com/pro/2015-07-06).
### GET requests
-Simple requests can be made like this, returning an iterable `ListResponse`:
+You can make a request to get a list of resources using the `list` method.
```php
-$client->resource()->list();
+$client->customers()->list();
```
-In the above example, replace `resource()` with the name of a resource (for example `customers()` to fetch a list of your customers) which returns a resource object.
+*Note: This README will use customers throughout but each of the resources in the API is available in this library.*
-If you need to pass any options, the last argument (or only argument, whether there are no requried options) to `list()` is an array of options:
+If you need to pass any options, the last (or only, in the absence of URL params) argument to `list()` is an array of URL parameters:
+```php
+$customers = $client->customers()->list(['params' => ['limit' => 400]]);
```
-$resources = $client->resource()->list(array('limit' => 400));
-echo count($resources->records());
-foreach ($resources->records() as $resource) {
- echo $resource->property_name();
+
+A call to `list()` returns an instance of `ListResponse`. You can use it's `records` attribute to iterate through the results.
+
+```php
+echo count($customers->records);
+foreach ($customers->records as $resource) {
+ echo $resource->given_name;
}
```
-Where URL parameters are required, the method signature will include those required arguments:
+In the case where a URL parameter is needed, the method signature will contain the required arguments:
+```php
+$customer = $client->customers()->get($customer_id);
+echo $customer->given_name;
```
-$customer = $client->customers()->get('CUXXXX');
-echo $customer->given_name();
+As with list, the last argument can be an options array, with any URL parameters given:
+
+```php
+$client->customers.get(customers_id, ['params' => ['some_flag' => true]]);
```
+Both individual resource and ListResponse instances have an `api_response` attribute, which lets you access the following properties of the request:
+
+- `status`
+- `headers`
+- `body`
+
### POST/PUT Requests
-Resource objects also have `create()` and `update()` methods for manipulating the resource's members. Provide a body for your request by passing it in as the first argument.
-**You do not need to add the enclosing key.**
+For POST and PUT requests, you need to provide a body for your request by passing it in as the first argument.
```php
-try {
- $client->customer()->create(array(
- "invalid_name" => "Pete",
- ));
-} catch (\GoCardlessPro\Core\Error\GoCardlessError $e) {
- // Server validation failed / record couldn't be created.
- echo $e->documentation_url();
- echo count($e->errors());
- // => $e is an ValidationFailedError.
-} catch (\GoCardlessPro\Core\Error\HttpError $e) {
- echo $e;
-}
+$client->customer()->create([
+ 'params' => ["given_name" => "Pete", "family_name" => "Hamilton"]
+]);
```
-This returns a response object representing the newly-created resource.
-
-As with GET requests, if URL parameters are required, they come first:
+As with GET requests, if any parameters are required, these come first:
```php
-$client->resource()->update('RSIDXXXXX', array('key' => 'value'));
+$client->customer()->update($customer_id, [...]);
```
-### Handling failures
+### Handling Failures
+
+When the API returns an error, the library will return a corresponding subclass of `ApiException`, one of:
-When the API returns an error, the library will return a `\GoCardlessPro\Core\Error\GoCardlessError`-based error - this may be a `GoCardlessError` or one of its subclasses, `InvalidApiUsageError`, `InvalidStateError`, and `ValidationFailedError` if appropriate.
+- `GoCardlessProException`
+- `InvalidApiUsageException`
+- `InvalidStateException`
+- `ValidationFailedException`
-You can access the raw API error (unenveloped) via the `error()` method on the returned error, and a list of all the errors via the `errors()` method. By default the error's message will contain the error message from the API, plus a link to the documentation if available.
+These types of error are all covered in the [API documentation](https://developer.gocardless.com/pro/#overview-errors).
-If the error is an HTTP transport layer error (e.g. cannot connect, empty response from server, etc.), the client will throw an `HttpError` based on the Curl error.
+If the error is an HTTP transport layer error (e.g. cannot connect, empty response from server, etc.), the client will throw an `ApiConnectionException`. If it can't parse the response from GoCardless, it will throw a `MalformedResponseException
+
+```php
+try {
+ $client->customer()->create(array(
+ "params" => array("invalid_name" => "Pete")
+ ));
+} catch (\GoCardlessPro\Core\Exception\ApiException $e) {
+ // Api request failed / record couldn't be created.
+} catch (\GoCardlessPro\Core\Exception\MalformedResponseException $e) {
+ // Unexpected non-JSON response
+} catch (\GoCardlessPro\Core\Exception\ApiConnectionException $e) {
+ // Network error
+}
+```
## Supporting PHP < 5.3.3
-This client library only supports PHP >= 5.3.3 out of the box due to its extensive
-use of OOP operators and namespaces.
+This client library only supports PHP >= 5.3.3.
## Contributing
-This client is auto-generated. If there's a bug it's likely with the
-[Crank](https://github.com/gocardless/crank) template or Crank itself. Bugs should be reported on those repositories.
+This client is auto-generated from Crank, a toolchain that we hope to soon open source.
+Issues should for now be reported on this repository.
+**Please do not modify the source code yourself, your changes will be overriden!**
diff --git a/circle.yml b/circle.yml
index 661fded2..489f269b 100644
--- a/circle.yml
+++ b/circle.yml
@@ -1,24 +1,6 @@
-dependencies:
- cache_directories:
- - vendor/
-
machine:
php:
- version: 5.4.5
-
-deployment:
- git:
- branch: dev
- commands:
- - make docs
- - git config user.name "Circle CI"
- - git config user.email "robot+circleci@gocardless.com"
- - rm -rf ./tests ./vendor
- - rm -f composer.json composer.lock docs/api/.htaccess
- - git checkout gh-pages
- - cp -r docs/api/* .
- - rm -rf docs/
- - touch .nojekyll
- - git add .
- - git commit -m "[ci skip] Generate PHP Doc"
- - git push origin gh-pages
+ version: 5.5.0
+dependencies:
+ override:
+ - composer install --prefer-source --no-interaction
diff --git a/composer.json b/composer.json
index ac06d3ad..bdb31ce5 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,7 @@
{
- "name": "gocardless/gocardless-pro-php",
+ "name": "gocardless/gocardless-pro",
"description": "GoCardless Pro PHP Client Library",
+ "version": "0.9.0",
"keywords": [
"gocardless",
"direct debit",
@@ -15,21 +16,21 @@
}
],
"require": {
- "php": ">=5.3.3",
+ "php": ">=5.5",
"ext-curl": "*",
"ext-json": "*",
- "ext-mbstring": "*"
+ "ext-mbstring": "*",
+ "guzzlehttp/guzzle": "^6.0"
},
"require-dev": {
- "phpunit/phpunit": "~4.5",
+ "phpunit/phpunit": "~4.8",
"satooshi/php-coveralls": "~0.6.1",
"squizlabs/php_codesniffer": "~2.0",
"phpdocumentor/phpdocumentor": "2.*"
},
- "version": "0.3.1",
"autoload": {
"psr-4": {
- "GoCardlessPro\\" : "lib/GoCardlessPro"
+ "GoCardlessPro\\" : "lib/"
}
},
"autoload-dev": {
diff --git a/composer.lock b/composer.lock
new file mode 100644
index 00000000..f4c4c0f9
--- /dev/null
+++ b/composer.lock
@@ -0,0 +1,3975 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "This file is @generated automatically"
+ ],
+ "hash": "b38e52d17a68c311759cfd5c39812a29",
+ "packages": [
+ {
+ "name": "guzzlehttp/guzzle",
+ "version": "6.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/guzzle.git",
+ "reference": "66fd14b4d0b8f2389eaf37c5458608c7cb793a81"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/66fd14b4d0b8f2389eaf37c5458608c7cb793a81",
+ "reference": "66fd14b4d0b8f2389eaf37c5458608c7cb793a81",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/promises": "~1.0",
+ "guzzlehttp/psr7": "~1.1",
+ "php": ">=5.5.0"
+ },
+ "require-dev": {
+ "ext-curl": "*",
+ "phpunit/phpunit": "~4.0",
+ "psr/log": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "6.1-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/functions_include.php"
+ ],
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Guzzle is a PHP HTTP client library",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "client",
+ "curl",
+ "framework",
+ "http",
+ "http client",
+ "rest",
+ "web service"
+ ],
+ "time": "2015-09-08 17:36:26"
+ },
+ {
+ "name": "guzzlehttp/promises",
+ "version": "1.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/promises.git",
+ "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/b1e1c0d55f8083c71eda2c28c12a228d708294ea",
+ "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Promise\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Guzzle promises library",
+ "keywords": [
+ "promise"
+ ],
+ "time": "2015-10-15 22:28:00"
+ },
+ {
+ "name": "guzzlehttp/psr7",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/psr7.git",
+ "reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
+ "reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0",
+ "psr/http-message": "~1.0"
+ },
+ "provide": {
+ "psr/http-message-implementation": "1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Psr7\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "PSR-7 message implementation",
+ "keywords": [
+ "http",
+ "message",
+ "stream",
+ "uri"
+ ],
+ "time": "2015-08-15 19:32:36"
+ },
+ {
+ "name": "psr/http-message",
+ "version": "1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
+ "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "time": "2015-05-04 20:22:00"
+ }
+ ],
+ "packages-dev": [
+ {
+ "name": "cilex/cilex",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Cilex/Cilex.git",
+ "reference": "7acd965a609a56d0345e8b6071c261fbdb926cb5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Cilex/Cilex/zipball/7acd965a609a56d0345e8b6071c261fbdb926cb5",
+ "reference": "7acd965a609a56d0345e8b6071c261fbdb926cb5",
+ "shasum": ""
+ },
+ "require": {
+ "cilex/console-service-provider": "1.*",
+ "php": ">=5.3.3",
+ "pimple/pimple": "~1.0",
+ "symfony/finder": "~2.1",
+ "symfony/process": "~2.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "3.7.*",
+ "symfony/validator": "~2.1"
+ },
+ "suggest": {
+ "monolog/monolog": ">=1.0.0",
+ "symfony/validator": ">=1.0.0",
+ "symfony/yaml": ">=1.0.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Cilex": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "mike.vanriel@naenius.com"
+ }
+ ],
+ "description": "The PHP micro-framework for Command line tools based on the Symfony2 Components",
+ "homepage": "http://cilex.github.com",
+ "keywords": [
+ "cli",
+ "microframework"
+ ],
+ "time": "2014-03-29 14:03:13"
+ },
+ {
+ "name": "cilex/console-service-provider",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Cilex/console-service-provider.git",
+ "reference": "25ee3d1875243d38e1a3448ff94bdf944f70d24e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Cilex/console-service-provider/zipball/25ee3d1875243d38e1a3448ff94bdf944f70d24e",
+ "reference": "25ee3d1875243d38e1a3448ff94bdf944f70d24e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "pimple/pimple": "1.*@dev",
+ "symfony/console": "~2.1"
+ },
+ "require-dev": {
+ "cilex/cilex": "1.*@dev",
+ "silex/silex": "1.*@dev"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Cilex\\Provider\\Console": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Beau Simensen",
+ "email": "beau@dflydev.com",
+ "homepage": "http://beausimensen.com"
+ },
+ {
+ "name": "Mike van Riel",
+ "email": "mike.vanriel@naenius.com"
+ }
+ ],
+ "description": "Console Service Provider",
+ "keywords": [
+ "cilex",
+ "console",
+ "pimple",
+ "service-provider",
+ "silex"
+ ],
+ "time": "2012-12-19 10:50:58"
+ },
+ {
+ "name": "container-interop/container-interop",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/container-interop/container-interop.git",
+ "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e",
+ "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Interop\\Container\\": "src/Interop/Container/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
+ "time": "2014-12-30 15:22:37"
+ },
+ {
+ "name": "doctrine/annotations",
+ "version": "v1.2.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/annotations.git",
+ "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535",
+ "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/lexer": "1.*",
+ "php": ">=5.3.2"
+ },
+ "require-dev": {
+ "doctrine/cache": "1.*",
+ "phpunit/phpunit": "4.*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Doctrine\\Common\\Annotations\\": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Benjamin Eberlei",
+ "email": "kontakt@beberlei.de"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Jonathan Wage",
+ "email": "jonwage@gmail.com"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Docblock Annotations Parser",
+ "homepage": "http://www.doctrine-project.org",
+ "keywords": [
+ "annotations",
+ "docblock",
+ "parser"
+ ],
+ "time": "2015-08-31 12:32:49"
+ },
+ {
+ "name": "doctrine/instantiator",
+ "version": "1.0.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/instantiator.git",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3,<8.0-DEV"
+ },
+ "require-dev": {
+ "athletic/athletic": "~0.1.8",
+ "ext-pdo": "*",
+ "ext-phar": "*",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.com/"
+ }
+ ],
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+ "homepage": "https://github.com/doctrine/instantiator",
+ "keywords": [
+ "constructor",
+ "instantiate"
+ ],
+ "time": "2015-06-14 21:17:01"
+ },
+ {
+ "name": "doctrine/lexer",
+ "version": "v1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/lexer.git",
+ "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Doctrine\\Common\\Lexer\\": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
+ "homepage": "http://www.doctrine-project.org",
+ "keywords": [
+ "lexer",
+ "parser"
+ ],
+ "time": "2014-09-09 13:34:57"
+ },
+ {
+ "name": "erusev/parsedown",
+ "version": "1.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/erusev/parsedown.git",
+ "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7",
+ "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Parsedown": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Emanuil Rusev",
+ "email": "hello@erusev.com",
+ "homepage": "http://erusev.com"
+ }
+ ],
+ "description": "Parser for Markdown.",
+ "homepage": "http://parsedown.org",
+ "keywords": [
+ "markdown",
+ "parser"
+ ],
+ "time": "2015-10-04 16:44:32"
+ },
+ {
+ "name": "guzzle/guzzle",
+ "version": "v3.9.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/guzzle3.git",
+ "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9",
+ "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9",
+ "shasum": ""
+ },
+ "require": {
+ "ext-curl": "*",
+ "php": ">=5.3.3",
+ "symfony/event-dispatcher": "~2.1"
+ },
+ "replace": {
+ "guzzle/batch": "self.version",
+ "guzzle/cache": "self.version",
+ "guzzle/common": "self.version",
+ "guzzle/http": "self.version",
+ "guzzle/inflection": "self.version",
+ "guzzle/iterator": "self.version",
+ "guzzle/log": "self.version",
+ "guzzle/parser": "self.version",
+ "guzzle/plugin": "self.version",
+ "guzzle/plugin-async": "self.version",
+ "guzzle/plugin-backoff": "self.version",
+ "guzzle/plugin-cache": "self.version",
+ "guzzle/plugin-cookie": "self.version",
+ "guzzle/plugin-curlauth": "self.version",
+ "guzzle/plugin-error-response": "self.version",
+ "guzzle/plugin-history": "self.version",
+ "guzzle/plugin-log": "self.version",
+ "guzzle/plugin-md5": "self.version",
+ "guzzle/plugin-mock": "self.version",
+ "guzzle/plugin-oauth": "self.version",
+ "guzzle/service": "self.version",
+ "guzzle/stream": "self.version"
+ },
+ "require-dev": {
+ "doctrine/cache": "~1.3",
+ "monolog/monolog": "~1.0",
+ "phpunit/phpunit": "3.7.*",
+ "psr/log": "~1.0",
+ "symfony/class-loader": "~2.1",
+ "zendframework/zend-cache": "2.*,<2.3",
+ "zendframework/zend-log": "2.*,<2.3"
+ },
+ "suggest": {
+ "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.9-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Guzzle": "src/",
+ "Guzzle\\Tests": "tests/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "Guzzle Community",
+ "homepage": "https://github.com/guzzle/guzzle/contributors"
+ }
+ ],
+ "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "client",
+ "curl",
+ "framework",
+ "http",
+ "http client",
+ "rest",
+ "web service"
+ ],
+ "time": "2015-03-18 18:23:50"
+ },
+ {
+ "name": "herrera-io/json",
+ "version": "1.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/kherge-abandoned/php-json.git",
+ "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/kherge-abandoned/php-json/zipball/60c696c9370a1e5136816ca557c17f82a6fa83f1",
+ "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "justinrainbow/json-schema": ">=1.0,<2.0-dev",
+ "php": ">=5.3.3",
+ "seld/jsonlint": ">=1.0,<2.0-dev"
+ },
+ "require-dev": {
+ "herrera-io/phpunit-test-case": "1.*",
+ "mikey179/vfsstream": "1.1.0",
+ "phpunit/phpunit": "3.7.*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/lib/json_version.php"
+ ],
+ "psr-0": {
+ "Herrera\\Json": "src/lib"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Kevin Herrera",
+ "email": "kevin@herrera.io",
+ "homepage": "http://kevin.herrera.io"
+ }
+ ],
+ "description": "A library for simplifying JSON linting and validation.",
+ "homepage": "http://herrera-io.github.com/php-json",
+ "keywords": [
+ "json",
+ "lint",
+ "schema",
+ "validate"
+ ],
+ "time": "2013-10-30 16:51:34"
+ },
+ {
+ "name": "herrera-io/phar-update",
+ "version": "1.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/kherge-abandoned/php-phar-update.git",
+ "reference": "00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/kherge-abandoned/php-phar-update/zipball/00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b",
+ "reference": "00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b",
+ "shasum": ""
+ },
+ "require": {
+ "herrera-io/json": "1.*",
+ "kherge/version": "1.*",
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "herrera-io/phpunit-test-case": "1.*",
+ "mikey179/vfsstream": "1.1.0",
+ "phpunit/phpunit": "3.7.*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/lib/constants.php"
+ ],
+ "psr-0": {
+ "Herrera\\Phar\\Update": "src/lib"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Kevin Herrera",
+ "email": "kevin@herrera.io",
+ "homepage": "http://kevin.herrera.io"
+ }
+ ],
+ "description": "A library for self-updating Phars.",
+ "homepage": "http://herrera-io.github.com/php-phar-update",
+ "keywords": [
+ "phar",
+ "update"
+ ],
+ "time": "2013-10-30 17:23:01"
+ },
+ {
+ "name": "jms/metadata",
+ "version": "1.5.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/schmittjoh/metadata.git",
+ "reference": "22b72455559a25777cfd28c4ffda81ff7639f353"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/22b72455559a25777cfd28c4ffda81ff7639f353",
+ "reference": "22b72455559a25777cfd28c4ffda81ff7639f353",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "doctrine/cache": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.5.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Metadata\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache"
+ ],
+ "authors": [
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com",
+ "homepage": "https://github.com/schmittjoh",
+ "role": "Developer of wrapped JMSSerializerBundle"
+ }
+ ],
+ "description": "Class/method/property metadata management in PHP",
+ "keywords": [
+ "annotations",
+ "metadata",
+ "xml",
+ "yaml"
+ ],
+ "time": "2014-07-12 07:13:19"
+ },
+ {
+ "name": "jms/parser-lib",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/schmittjoh/parser-lib.git",
+ "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/schmittjoh/parser-lib/zipball/c509473bc1b4866415627af0e1c6cc8ac97fa51d",
+ "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d",
+ "shasum": ""
+ },
+ "require": {
+ "phpoption/phpoption": ">=0.9,<2.0-dev"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "JMS\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache2"
+ ],
+ "description": "A library for easily creating recursive-descent parsers.",
+ "time": "2012-11-18 18:08:43"
+ },
+ {
+ "name": "jms/serializer",
+ "version": "0.16.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/schmittjoh/serializer.git",
+ "reference": "c8a171357ca92b6706e395c757f334902d430ea9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/c8a171357ca92b6706e395c757f334902d430ea9",
+ "reference": "c8a171357ca92b6706e395c757f334902d430ea9",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/annotations": "1.*",
+ "jms/metadata": "~1.1",
+ "jms/parser-lib": "1.*",
+ "php": ">=5.3.2",
+ "phpcollection/phpcollection": "~0.1"
+ },
+ "require-dev": {
+ "doctrine/orm": "~2.1",
+ "doctrine/phpcr-odm": "~1.0.1",
+ "jackalope/jackalope-doctrine-dbal": "1.0.*",
+ "propel/propel1": "~1.7",
+ "symfony/filesystem": "2.*",
+ "symfony/form": "~2.1",
+ "symfony/translation": "~2.0",
+ "symfony/validator": "~2.0",
+ "symfony/yaml": "2.*",
+ "twig/twig": ">=1.8,<2.0-dev"
+ },
+ "suggest": {
+ "symfony/yaml": "Required if you'd like to serialize data to YAML format."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.15-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "JMS\\Serializer": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache2"
+ ],
+ "authors": [
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com",
+ "homepage": "https://github.com/schmittjoh",
+ "role": "Developer of wrapped JMSSerializerBundle"
+ }
+ ],
+ "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.",
+ "homepage": "http://jmsyst.com/libs/serializer",
+ "keywords": [
+ "deserialization",
+ "jaxb",
+ "json",
+ "serialization",
+ "xml"
+ ],
+ "time": "2014-03-18 08:39:00"
+ },
+ {
+ "name": "justinrainbow/json-schema",
+ "version": "1.5.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/justinrainbow/json-schema.git",
+ "reference": "a4bee9f4b344b66e0a0d96c7afae1e92edf385fe"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/a4bee9f4b344b66e0a0d96c7afae1e92edf385fe",
+ "reference": "a4bee9f4b344b66e0a0d96c7afae1e92edf385fe",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "require-dev": {
+ "json-schema/json-schema-test-suite": "1.1.0",
+ "phpdocumentor/phpdocumentor": "~2",
+ "phpunit/phpunit": "~3.7"
+ },
+ "bin": [
+ "bin/validate-json"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "JsonSchema\\": "src/JsonSchema/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Bruno Prieto Reis",
+ "email": "bruno.p.reis@gmail.com"
+ },
+ {
+ "name": "Justin Rainbow",
+ "email": "justin.rainbow@gmail.com"
+ },
+ {
+ "name": "Igor Wiedler",
+ "email": "igor@wiedler.ch"
+ },
+ {
+ "name": "Robert Schönthal",
+ "email": "seroscho@googlemail.com"
+ }
+ ],
+ "description": "A library to validate a json schema.",
+ "homepage": "https://github.com/justinrainbow/json-schema",
+ "keywords": [
+ "json",
+ "schema"
+ ],
+ "time": "2015-09-08 22:28:04"
+ },
+ {
+ "name": "kherge/version",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/kherge-abandoned/Version.git",
+ "reference": "f07cf83f8ce533be8f93d2893d96d674bbeb7e30"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/kherge-abandoned/Version/zipball/f07cf83f8ce533be8f93d2893d96d674bbeb7e30",
+ "reference": "f07cf83f8ce533be8f93d2893d96d674bbeb7e30",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "KevinGH\\Version": "src/lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Kevin Herrera",
+ "email": "me@kevingh.com"
+ }
+ ],
+ "description": "A parsing and comparison library for semantic versioning.",
+ "homepage": "http://github.com/kherge/Version",
+ "time": "2012-08-16 17:13:03"
+ },
+ {
+ "name": "monolog/monolog",
+ "version": "1.17.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Seldaek/monolog.git",
+ "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bee7f0dc9c3e0b69a6039697533dca1e845c8c24",
+ "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0",
+ "psr/log": "~1.0"
+ },
+ "provide": {
+ "psr/log-implementation": "1.0.0"
+ },
+ "require-dev": {
+ "aws/aws-sdk-php": "^2.4.9",
+ "doctrine/couchdb": "~1.0@dev",
+ "graylog2/gelf-php": "~1.0",
+ "jakub-onderka/php-parallel-lint": "0.9",
+ "php-console/php-console": "^3.1.3",
+ "phpunit/phpunit": "~4.5",
+ "phpunit/phpunit-mock-objects": "2.3.0",
+ "raven/raven": "^0.13",
+ "ruflin/elastica": ">=0.90 <3.0",
+ "swiftmailer/swiftmailer": "~5.3",
+ "videlalvaro/php-amqplib": "~2.4"
+ },
+ "suggest": {
+ "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
+ "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
+ "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
+ "ext-mongo": "Allow sending log messages to a MongoDB server",
+ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
+ "php-console/php-console": "Allow sending log messages to Google Chrome",
+ "raven/raven": "Allow sending log messages to a Sentry server",
+ "rollbar/rollbar": "Allow sending log messages to Rollbar",
+ "ruflin/elastica": "Allow sending log messages to an Elastic Search server",
+ "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.16.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Monolog\\": "src/Monolog"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be"
+ }
+ ],
+ "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
+ "homepage": "http://github.com/Seldaek/monolog",
+ "keywords": [
+ "log",
+ "logging",
+ "psr-3"
+ ],
+ "time": "2015-10-14 12:51:02"
+ },
+ {
+ "name": "nikic/php-parser",
+ "version": "v0.9.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/nikic/PHP-Parser.git",
+ "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ef70767475434bdb3615b43c327e2cae17ef12eb",
+ "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.9-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "PHPParser": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Nikita Popov"
+ }
+ ],
+ "description": "A PHP parser written in PHP",
+ "keywords": [
+ "parser",
+ "php"
+ ],
+ "time": "2014-07-23 18:24:17"
+ },
+ {
+ "name": "phpcollection/phpcollection",
+ "version": "0.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/schmittjoh/php-collection.git",
+ "reference": "b8bf55a0a929ca43b01232b36719f176f86c7e83"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/schmittjoh/php-collection/zipball/b8bf55a0a929ca43b01232b36719f176f86c7e83",
+ "reference": "b8bf55a0a929ca43b01232b36719f176f86c7e83",
+ "shasum": ""
+ },
+ "require": {
+ "phpoption/phpoption": "1.*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "PhpCollection": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache2"
+ ],
+ "authors": [
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com",
+ "homepage": "https://github.com/schmittjoh",
+ "role": "Developer of wrapped JMSSerializerBundle"
+ }
+ ],
+ "description": "General-Purpose Collection Library for PHP",
+ "keywords": [
+ "collection",
+ "list",
+ "map",
+ "sequence",
+ "set"
+ ],
+ "time": "2014-03-11 13:46:42"
+ },
+ {
+ "name": "phpdocumentor/fileset",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/Fileset.git",
+ "reference": "bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/Fileset/zipball/bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0",
+ "reference": "bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "symfony/finder": "~2.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~3.7"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "phpDocumentor": [
+ "src/",
+ "tests/unit/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Fileset component for collecting a set of files given directories and file paths",
+ "homepage": "http://www.phpdoc.org",
+ "keywords": [
+ "files",
+ "fileset",
+ "phpdoc"
+ ],
+ "time": "2013-08-06 21:07:42"
+ },
+ {
+ "name": "phpdocumentor/graphviz",
+ "version": "1.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/GraphViz.git",
+ "reference": "aa243118c8a055fc853c02802e8503c5435862f7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/GraphViz/zipball/aa243118c8a055fc853c02802e8503c5435862f7",
+ "reference": "aa243118c8a055fc853c02802e8503c5435862f7",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~3.7"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "phpDocumentor": [
+ "src/",
+ "tests/unit"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "mike.vanriel@naenius.com"
+ }
+ ],
+ "time": "2014-07-19 06:52:59"
+ },
+ {
+ "name": "phpdocumentor/phpdocumentor",
+ "version": "v2.8.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/phpDocumentor2.git",
+ "reference": "adfb4affa80e8cc0134616f2d2d264dd25c243eb"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/phpDocumentor2/zipball/adfb4affa80e8cc0134616f2d2d264dd25c243eb",
+ "reference": "adfb4affa80e8cc0134616f2d2d264dd25c243eb",
+ "shasum": ""
+ },
+ "require": {
+ "cilex/cilex": "~1.0",
+ "erusev/parsedown": "~1.0",
+ "herrera-io/phar-update": "1.0.3",
+ "jms/serializer": "~0.12",
+ "monolog/monolog": "~1.6",
+ "php": ">=5.3.3",
+ "phpdocumentor/fileset": "~1.0",
+ "phpdocumentor/graphviz": "~1.0",
+ "phpdocumentor/reflection": "~1.0",
+ "phpdocumentor/reflection-docblock": "~2.0",
+ "symfony/config": "~2.3",
+ "symfony/console": "~2.3",
+ "symfony/event-dispatcher": "~2.1",
+ "symfony/process": "~2.0",
+ "symfony/stopwatch": "~2.3",
+ "symfony/validator": "~2.2",
+ "twig/twig": "~1.3",
+ "zendframework/zend-cache": "~2.1",
+ "zendframework/zend-config": "~2.1",
+ "zendframework/zend-filter": "~2.1",
+ "zendframework/zend-i18n": "~2.1",
+ "zendframework/zend-serializer": "~2.1",
+ "zendframework/zend-servicemanager": "~2.1",
+ "zendframework/zend-stdlib": "~2.1",
+ "zetacomponents/document": ">=1.3.1"
+ },
+ "require-dev": {
+ "behat/behat": "~3.0",
+ "mikey179/vfsstream": "~1.2",
+ "mockery/mockery": "~0.9@dev",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~1.4",
+ "symfony/expression-language": "~2.4"
+ },
+ "suggest": {
+ "ext-twig": "Enabling the twig extension improves the generation of twig based templates.",
+ "ext-xslcache": "Enabling the XSLCache extension improves the generation of xml based templates."
+ },
+ "bin": [
+ "bin/phpdoc.php",
+ "bin/phpdoc"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-develop": "2.9-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "phpDocumentor": [
+ "src/",
+ "tests/unit/"
+ ],
+ "Cilex\\Provider": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Documentation Generator for PHP",
+ "homepage": "http://www.phpdoc.org",
+ "keywords": [
+ "api",
+ "application",
+ "dga",
+ "documentation",
+ "phpdoc"
+ ],
+ "time": "2015-07-28 06:36:40"
+ },
+ {
+ "name": "phpdocumentor/reflection",
+ "version": "1.0.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/Reflection.git",
+ "reference": "fc40c3f604ac2287eb5c314174d5109b2c699372"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/Reflection/zipball/fc40c3f604ac2287eb5c314174d5109b2c699372",
+ "reference": "fc40c3f604ac2287eb5c314174d5109b2c699372",
+ "shasum": ""
+ },
+ "require": {
+ "nikic/php-parser": "~0.9.4",
+ "php": ">=5.3.3",
+ "phpdocumentor/reflection-docblock": "~2.0",
+ "psr/log": "~1.0"
+ },
+ "require-dev": {
+ "behat/behat": "~2.4",
+ "mockery/mockery": "~0.8",
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "phpDocumentor": [
+ "src/",
+ "tests/unit/",
+ "tests/mocks/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Reflection library to do Static Analysis for PHP Projects",
+ "homepage": "http://www.phpdoc.org",
+ "keywords": [
+ "phpDocumentor",
+ "phpdoc",
+ "reflection",
+ "static analysis"
+ ],
+ "time": "2014-11-14 11:43:04"
+ },
+ {
+ "name": "phpdocumentor/reflection-docblock",
+ "version": "2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "suggest": {
+ "dflydev/markdown": "~1.0",
+ "erusev/parsedown": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "phpDocumentor": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "mike.vanriel@naenius.com"
+ }
+ ],
+ "time": "2015-02-03 12:10:50"
+ },
+ {
+ "name": "phpoption/phpoption",
+ "version": "1.5.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/schmittjoh/php-option.git",
+ "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/94e644f7d2051a5f0fcf77d81605f152eecff0ed",
+ "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.7.*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "PhpOption\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache2"
+ ],
+ "authors": [
+ {
+ "name": "Johannes M. Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Option Type for PHP",
+ "keywords": [
+ "language",
+ "option",
+ "php",
+ "type"
+ ],
+ "time": "2015-07-25 16:39:46"
+ },
+ {
+ "name": "phpspec/prophecy",
+ "version": "v1.5.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpspec/prophecy.git",
+ "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7",
+ "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "phpdocumentor/reflection-docblock": "~2.0",
+ "sebastian/comparator": "~1.1"
+ },
+ "require-dev": {
+ "phpspec/phpspec": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Prophecy\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Konstantin Kudryashov",
+ "email": "ever.zet@gmail.com",
+ "homepage": "http://everzet.com"
+ },
+ {
+ "name": "Marcello Duarte",
+ "email": "marcello.duarte@gmail.com"
+ }
+ ],
+ "description": "Highly opinionated mocking framework for PHP 5.3+",
+ "homepage": "https://github.com/phpspec/prophecy",
+ "keywords": [
+ "Double",
+ "Dummy",
+ "fake",
+ "mock",
+ "spy",
+ "stub"
+ ],
+ "time": "2015-08-13 10:07:40"
+ },
+ {
+ "name": "phpunit/php-code-coverage",
+ "version": "2.2.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+ "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
+ "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "phpunit/php-file-iterator": "~1.3",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-token-stream": "~1.3",
+ "sebastian/environment": "^1.3.2",
+ "sebastian/version": "~1.0"
+ },
+ "require-dev": {
+ "ext-xdebug": ">=2.1.4",
+ "phpunit/phpunit": "~4"
+ },
+ "suggest": {
+ "ext-dom": "*",
+ "ext-xdebug": ">=2.2.1",
+ "ext-xmlwriter": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
+ "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
+ "keywords": [
+ "coverage",
+ "testing",
+ "xunit"
+ ],
+ "time": "2015-10-06 15:47:00"
+ },
+ {
+ "name": "phpunit/php-file-iterator",
+ "version": "1.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+ "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
+ "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "FilterIterator implementation that filters files based on a list of suffixes.",
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
+ "keywords": [
+ "filesystem",
+ "iterator"
+ ],
+ "time": "2015-06-21 13:08:43"
+ },
+ {
+ "name": "phpunit/php-text-template",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Simple template engine.",
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+ "keywords": [
+ "template"
+ ],
+ "time": "2015-06-21 13:50:34"
+ },
+ {
+ "name": "phpunit/php-timer",
+ "version": "1.0.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
+ "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
+ "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Utility class for timing",
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
+ "keywords": [
+ "timer"
+ ],
+ "time": "2015-06-21 08:01:12"
+ },
+ {
+ "name": "phpunit/php-token-stream",
+ "version": "1.4.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+ "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
+ "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Wrapper around PHP's tokenizer extension.",
+ "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
+ "keywords": [
+ "tokenizer"
+ ],
+ "time": "2015-09-15 10:49:45"
+ },
+ {
+ "name": "phpunit/phpunit",
+ "version": "4.8.14",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
+ "reference": "b4900675926860bef091644849305399b986efa2"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b4900675926860bef091644849305399b986efa2",
+ "reference": "b4900675926860bef091644849305399b986efa2",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-json": "*",
+ "ext-pcre": "*",
+ "ext-reflection": "*",
+ "ext-spl": "*",
+ "php": ">=5.3.3",
+ "phpspec/prophecy": "^1.3.1",
+ "phpunit/php-code-coverage": "~2.1",
+ "phpunit/php-file-iterator": "~1.4",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-timer": ">=1.0.6",
+ "phpunit/phpunit-mock-objects": "~2.3",
+ "sebastian/comparator": "~1.1",
+ "sebastian/diff": "~1.2",
+ "sebastian/environment": "~1.3",
+ "sebastian/exporter": "~1.2",
+ "sebastian/global-state": "~1.0",
+ "sebastian/version": "~1.0",
+ "symfony/yaml": "~2.1|~3.0"
+ },
+ "suggest": {
+ "phpunit/php-invoker": "~1.1"
+ },
+ "bin": [
+ "phpunit"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.8.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "The PHP Unit Testing framework.",
+ "homepage": "https://phpunit.de/",
+ "keywords": [
+ "phpunit",
+ "testing",
+ "xunit"
+ ],
+ "time": "2015-10-17 15:03:30"
+ },
+ {
+ "name": "phpunit/phpunit-mock-objects",
+ "version": "2.3.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
+ "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
+ "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "php": ">=5.3.3",
+ "phpunit/php-text-template": "~1.2",
+ "sebastian/exporter": "~1.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "suggest": {
+ "ext-soap": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Mock Object library for PHPUnit",
+ "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
+ "keywords": [
+ "mock",
+ "xunit"
+ ],
+ "time": "2015-10-02 06:51:40"
+ },
+ {
+ "name": "pimple/pimple",
+ "version": "v1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/silexphp/Pimple.git",
+ "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/silexphp/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d",
+ "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Pimple": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ }
+ ],
+ "description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
+ "homepage": "http://pimple.sensiolabs.org",
+ "keywords": [
+ "container",
+ "dependency injection"
+ ],
+ "time": "2013-11-22 08:30:29"
+ },
+ {
+ "name": "psr/log",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
+ "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Psr\\Log\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "time": "2012-12-21 11:40:51"
+ },
+ {
+ "name": "satooshi/php-coveralls",
+ "version": "v0.6.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/satooshi/php-coveralls.git",
+ "reference": "dd0df95bd37a7cf5c5c50304dfe260ffe4b50760"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/dd0df95bd37a7cf5c5c50304dfe260ffe4b50760",
+ "reference": "dd0df95bd37a7cf5c5c50304dfe260ffe4b50760",
+ "shasum": ""
+ },
+ "require": {
+ "ext-curl": "*",
+ "ext-json": "*",
+ "ext-simplexml": "*",
+ "guzzle/guzzle": ">=3.0",
+ "php": ">=5.3",
+ "psr/log": "1.0.0",
+ "symfony/config": ">=2.0",
+ "symfony/console": ">=2.0",
+ "symfony/stopwatch": ">=2.2",
+ "symfony/yaml": ">=2.0"
+ },
+ "require-dev": {
+ "apigen/apigen": "2.8.*@stable",
+ "pdepend/pdepend": "dev-master",
+ "phpmd/phpmd": "dev-master",
+ "phpunit/php-invoker": ">=1.1.0,<1.2.0",
+ "phpunit/phpunit": "3.7.*@stable",
+ "sebastian/finder-facade": "dev-master",
+ "sebastian/phpcpd": "1.4.*@stable",
+ "squizlabs/php_codesniffer": "1.4.*@stable",
+ "theseer/fdomdocument": "dev-master"
+ },
+ "bin": [
+ "composer/bin/coveralls"
+ ],
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Contrib\\Component": "src/",
+ "Contrib\\Bundle": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Kitamura Satoshi",
+ "email": "with.no.parachute@gmail.com",
+ "homepage": "https://www.facebook.com/satooshi.jp"
+ }
+ ],
+ "description": "PHP client library for Coveralls API",
+ "homepage": "https://github.com/satooshi/php-coveralls",
+ "keywords": [
+ "ci",
+ "coverage",
+ "github",
+ "test"
+ ],
+ "time": "2013-05-04 08:07:33"
+ },
+ {
+ "name": "sebastian/comparator",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/comparator.git",
+ "reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
+ "reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/diff": "~1.2",
+ "sebastian/exporter": "~1.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides the functionality to compare PHP values for equality",
+ "homepage": "http://www.github.com/sebastianbergmann/comparator",
+ "keywords": [
+ "comparator",
+ "compare",
+ "equality"
+ ],
+ "time": "2015-07-26 15:48:44"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "1.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3",
+ "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Kore Nordmann",
+ "email": "mail@kore-nordmann.de"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Diff implementation",
+ "homepage": "http://www.github.com/sebastianbergmann/diff",
+ "keywords": [
+ "diff"
+ ],
+ "time": "2015-02-22 15:13:53"
+ },
+ {
+ "name": "sebastian/environment",
+ "version": "1.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/environment.git",
+ "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44",
+ "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides functionality to handle HHVM/PHP environments",
+ "homepage": "http://www.github.com/sebastianbergmann/environment",
+ "keywords": [
+ "Xdebug",
+ "environment",
+ "hhvm"
+ ],
+ "time": "2015-08-03 06:14:51"
+ },
+ {
+ "name": "sebastian/exporter",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/exporter.git",
+ "reference": "7ae5513327cb536431847bcc0c10edba2701064e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e",
+ "reference": "7ae5513327cb536431847bcc0c10edba2701064e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/recursion-context": "~1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides the functionality to export PHP variables for visualization",
+ "homepage": "http://www.github.com/sebastianbergmann/exporter",
+ "keywords": [
+ "export",
+ "exporter"
+ ],
+ "time": "2015-06-21 07:55:53"
+ },
+ {
+ "name": "sebastian/global-state",
+ "version": "1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/global-state.git",
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "suggest": {
+ "ext-uopz": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Snapshotting of global state",
+ "homepage": "http://www.github.com/sebastianbergmann/global-state",
+ "keywords": [
+ "global state"
+ ],
+ "time": "2015-10-12 03:26:01"
+ },
+ {
+ "name": "sebastian/recursion-context",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
+ "reference": "994d4a811bafe801fb06dccbee797863ba2792ba"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba",
+ "reference": "994d4a811bafe801fb06dccbee797863ba2792ba",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides functionality to recursively process PHP variables",
+ "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "time": "2015-06-21 08:04:50"
+ },
+ {
+ "name": "sebastian/version",
+ "version": "1.0.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+ "homepage": "https://github.com/sebastianbergmann/version",
+ "time": "2015-06-21 13:59:46"
+ },
+ {
+ "name": "seld/jsonlint",
+ "version": "1.3.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Seldaek/jsonlint.git",
+ "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/863ae85c6d3ef60ca49cb12bd051c4a0648c40c4",
+ "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "bin": [
+ "bin/jsonlint"
+ ],
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Seld\\JsonLint\\": "src/Seld/JsonLint/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be"
+ }
+ ],
+ "description": "JSON Linter",
+ "keywords": [
+ "json",
+ "linter",
+ "parser",
+ "validator"
+ ],
+ "time": "2015-01-04 21:18:15"
+ },
+ {
+ "name": "squizlabs/php_codesniffer",
+ "version": "2.3.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
+ "reference": "11a2545c44a5915f883e2e5ec12e14ed345e3ab2"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/11a2545c44a5915f883e2e5ec12e14ed345e3ab2",
+ "reference": "11a2545c44a5915f883e2e5ec12e14ed345e3ab2",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": ">=5.1.2"
+ },
+ "bin": [
+ "scripts/phpcs",
+ "scripts/phpcbf"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "CodeSniffer.php",
+ "CodeSniffer/CLI.php",
+ "CodeSniffer/Exception.php",
+ "CodeSniffer/File.php",
+ "CodeSniffer/Fixer.php",
+ "CodeSniffer/Report.php",
+ "CodeSniffer/Reporting.php",
+ "CodeSniffer/Sniff.php",
+ "CodeSniffer/Tokens.php",
+ "CodeSniffer/Reports/",
+ "CodeSniffer/Tokenizers/",
+ "CodeSniffer/DocGenerators/",
+ "CodeSniffer/Standards/AbstractPatternSniff.php",
+ "CodeSniffer/Standards/AbstractScopeSniff.php",
+ "CodeSniffer/Standards/AbstractVariableSniff.php",
+ "CodeSniffer/Standards/IncorrectPatternException.php",
+ "CodeSniffer/Standards/Generic/Sniffs/",
+ "CodeSniffer/Standards/MySource/Sniffs/",
+ "CodeSniffer/Standards/PEAR/Sniffs/",
+ "CodeSniffer/Standards/PSR1/Sniffs/",
+ "CodeSniffer/Standards/PSR2/Sniffs/",
+ "CodeSniffer/Standards/Squiz/Sniffs/",
+ "CodeSniffer/Standards/Zend/Sniffs/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Greg Sherwood",
+ "role": "lead"
+ }
+ ],
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+ "homepage": "http://www.squizlabs.com/php-codesniffer",
+ "keywords": [
+ "phpcs",
+ "standards"
+ ],
+ "time": "2015-09-09 00:18:50"
+ },
+ {
+ "name": "symfony/config",
+ "version": "v2.7.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/config.git",
+ "reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/config/zipball/9698fdf0a750d6887d5e7729d5cf099765b20e61",
+ "reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9",
+ "symfony/filesystem": "~2.3"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Config\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Config Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-09-21 15:02:29"
+ },
+ {
+ "name": "symfony/console",
+ "version": "v2.7.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/console.git",
+ "reference": "06cb17c013a82f94a3d840682b49425cd00a2161"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/console/zipball/06cb17c013a82f94a3d840682b49425cd00a2161",
+ "reference": "06cb17c013a82f94a3d840682b49425cd00a2161",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/event-dispatcher": "~2.1",
+ "symfony/phpunit-bridge": "~2.7",
+ "symfony/process": "~2.1"
+ },
+ "suggest": {
+ "psr/log": "For using the console logger",
+ "symfony/event-dispatcher": "",
+ "symfony/process": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Console\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Console Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-09-25 08:32:23"
+ },
+ {
+ "name": "symfony/event-dispatcher",
+ "version": "v2.7.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/event-dispatcher.git",
+ "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ae4dcc2a8d3de98bd794167a3ccda1311597c5d9",
+ "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/config": "~2.0,>=2.0.5",
+ "symfony/dependency-injection": "~2.6",
+ "symfony/expression-language": "~2.6",
+ "symfony/phpunit-bridge": "~2.7",
+ "symfony/stopwatch": "~2.3"
+ },
+ "suggest": {
+ "symfony/dependency-injection": "",
+ "symfony/http-kernel": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\EventDispatcher\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony EventDispatcher Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-09-22 13:49:29"
+ },
+ {
+ "name": "symfony/filesystem",
+ "version": "v2.7.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/filesystem.git",
+ "reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/a17f8a17c20e8614c15b8e116e2f4bcde102cfab",
+ "reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Filesystem\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Filesystem Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-09-09 17:42:36"
+ },
+ {
+ "name": "symfony/finder",
+ "version": "v2.7.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/finder.git",
+ "reference": "8262ab605973afbb3ef74b945daabf086f58366f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/8262ab605973afbb3ef74b945daabf086f58366f",
+ "reference": "8262ab605973afbb3ef74b945daabf086f58366f",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Finder\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Finder Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-09-19 19:59:23"
+ },
+ {
+ "name": "symfony/process",
+ "version": "v2.7.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/process.git",
+ "reference": "b27c8e317922cd3cdd3600850273cf6b82b2e8e9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/process/zipball/b27c8e317922cd3cdd3600850273cf6b82b2e8e9",
+ "reference": "b27c8e317922cd3cdd3600850273cf6b82b2e8e9",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Process\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Process Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-09-19 19:59:23"
+ },
+ {
+ "name": "symfony/stopwatch",
+ "version": "v2.7.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/stopwatch.git",
+ "reference": "08dd97b3f22ab9ee658cd16e6758f8c3c404336e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/stopwatch/zipball/08dd97b3f22ab9ee658cd16e6758f8c3c404336e",
+ "reference": "08dd97b3f22ab9ee658cd16e6758f8c3c404336e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Stopwatch\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Stopwatch Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-09-22 13:49:29"
+ },
+ {
+ "name": "symfony/translation",
+ "version": "v2.7.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/translation.git",
+ "reference": "485877661835e188cd78345c6d4eef1290d17571"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/485877661835e188cd78345c6d4eef1290d17571",
+ "reference": "485877661835e188cd78345c6d4eef1290d17571",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "conflict": {
+ "symfony/config": "<2.7"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/config": "~2.7",
+ "symfony/intl": "~2.4",
+ "symfony/phpunit-bridge": "~2.7",
+ "symfony/yaml": "~2.2"
+ },
+ "suggest": {
+ "psr/log": "To use logging capability in translator",
+ "symfony/config": "",
+ "symfony/yaml": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Translation\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Translation Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-09-06 08:36:38"
+ },
+ {
+ "name": "symfony/validator",
+ "version": "v2.7.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/validator.git",
+ "reference": "b359dc71e253ce6eb69eefbd5088032241e7a66f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/validator/zipball/b359dc71e253ce6eb69eefbd5088032241e7a66f",
+ "reference": "b359dc71e253ce6eb69eefbd5088032241e7a66f",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9",
+ "symfony/translation": "~2.4"
+ },
+ "require-dev": {
+ "doctrine/annotations": "~1.0",
+ "doctrine/cache": "~1.0",
+ "egulias/email-validator": "~1.2,>=1.2.1",
+ "symfony/config": "~2.2",
+ "symfony/expression-language": "~2.4",
+ "symfony/http-foundation": "~2.1",
+ "symfony/intl": "~2.4",
+ "symfony/phpunit-bridge": "~2.7",
+ "symfony/property-access": "~2.3",
+ "symfony/yaml": "~2.0,>=2.0.5"
+ },
+ "suggest": {
+ "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.",
+ "doctrine/cache": "For using the default cached annotation reader and metadata cache.",
+ "egulias/email-validator": "Strict (RFC compliant) email validation",
+ "symfony/config": "",
+ "symfony/expression-language": "For using the 2.4 Expression validator",
+ "symfony/http-foundation": "",
+ "symfony/intl": "",
+ "symfony/property-access": "For using the 2.4 Validator API",
+ "symfony/yaml": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Validator\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Validator Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-09-23 11:13:27"
+ },
+ {
+ "name": "symfony/yaml",
+ "version": "v2.7.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/yaml.git",
+ "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770",
+ "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Yaml\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Yaml Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-09-14 14:14:09"
+ },
+ {
+ "name": "twig/twig",
+ "version": "v1.22.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/twigphp/Twig.git",
+ "reference": "ebfc36b7e77b0c1175afe30459cf943010245540"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/ebfc36b7e77b0c1175afe30459cf943010245540",
+ "reference": "ebfc36b7e77b0c1175afe30459cf943010245540",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.2.7"
+ },
+ "require-dev": {
+ "symfony/debug": "~2.7",
+ "symfony/phpunit-bridge": "~2.7"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.22-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Twig_": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com",
+ "homepage": "http://fabien.potencier.org",
+ "role": "Lead Developer"
+ },
+ {
+ "name": "Armin Ronacher",
+ "email": "armin.ronacher@active-4.com",
+ "role": "Project Founder"
+ },
+ {
+ "name": "Twig Team",
+ "homepage": "http://twig.sensiolabs.org/contributors",
+ "role": "Contributors"
+ }
+ ],
+ "description": "Twig, the flexible, fast, and secure template language for PHP",
+ "homepage": "http://twig.sensiolabs.org",
+ "keywords": [
+ "templating"
+ ],
+ "time": "2015-10-13 07:07:02"
+ },
+ {
+ "name": "zendframework/zend-cache",
+ "version": "2.5.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-cache.git",
+ "reference": "7ff9d6b922ae29dbdc53f6a62b471fb6e58565df"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/7ff9d6b922ae29dbdc53f6a62b471fb6e58565df",
+ "reference": "7ff9d6b922ae29dbdc53f6a62b471fb6e58565df",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5",
+ "zendframework/zend-eventmanager": "~2.5",
+ "zendframework/zend-servicemanager": "~2.5",
+ "zendframework/zend-stdlib": "~2.5"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "1.7.*",
+ "phpunit/phpunit": "~4.0",
+ "zendframework/zend-serializer": "~2.5",
+ "zendframework/zend-session": "~2.5"
+ },
+ "suggest": {
+ "ext-apcu": "APCU, to use the APC storage adapter",
+ "ext-dba": "DBA, to use the DBA storage adapter",
+ "ext-memcache": "Memcache >= 2.0.0 to use the Memcache storage adapter",
+ "ext-memcached": "Memcached >= 1.0.0 to use the Memcached storage adapter",
+ "ext-mongo": "Mongo, to use MongoDb storage adapter",
+ "ext-redis": "Redis, to use Redis storage adapter",
+ "ext-wincache": "WinCache, to use the WinCache storage adapter",
+ "ext-xcache": "XCache, to use the XCache storage adapter",
+ "mongofill/mongofill": "Alternative to ext-mongo - a pure PHP implementation designed as a drop in replacement",
+ "zendframework/zend-serializer": "Zend\\Serializer component",
+ "zendframework/zend-session": "Zend\\Session component"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.5-dev",
+ "dev-develop": "2.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\Cache\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "description": "provides a generic way to cache any data",
+ "homepage": "https://github.com/zendframework/zend-cache",
+ "keywords": [
+ "cache",
+ "zf2"
+ ],
+ "time": "2015-09-15 16:09:09"
+ },
+ {
+ "name": "zendframework/zend-config",
+ "version": "2.5.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-config.git",
+ "reference": "ec49b1df1bdd9772df09dc2f612fbfc279bf4c27"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-config/zipball/ec49b1df1bdd9772df09dc2f612fbfc279bf4c27",
+ "reference": "ec49b1df1bdd9772df09dc2f612fbfc279bf4c27",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.23",
+ "zendframework/zend-stdlib": "~2.5"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "1.7.*",
+ "phpunit/phpunit": "~4.0",
+ "zendframework/zend-filter": "~2.5",
+ "zendframework/zend-i18n": "~2.5",
+ "zendframework/zend-json": "~2.5",
+ "zendframework/zend-mvc": "~2.5",
+ "zendframework/zend-servicemanager": "~2.5"
+ },
+ "suggest": {
+ "zendframework/zend-filter": "Zend\\Filter component",
+ "zendframework/zend-i18n": "Zend\\I18n component",
+ "zendframework/zend-json": "Zend\\Json to use the Json reader or writer classes",
+ "zendframework/zend-servicemanager": "Zend\\ServiceManager for use with the Config Factory to retrieve reader and writer instances"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.5-dev",
+ "dev-develop": "2.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\Config\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "description": "provides a nested object property based user interface for accessing this configuration data within application code",
+ "homepage": "https://github.com/zendframework/zend-config",
+ "keywords": [
+ "config",
+ "zf2"
+ ],
+ "time": "2015-06-03 15:32:00"
+ },
+ {
+ "name": "zendframework/zend-eventmanager",
+ "version": "2.5.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-eventmanager.git",
+ "reference": "135af03d07fd048c322259aab6611d2be290475c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/135af03d07fd048c322259aab6611d2be290475c",
+ "reference": "135af03d07fd048c322259aab6611d2be290475c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5",
+ "zendframework/zend-stdlib": "~2.5"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "1.7.*",
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.5-dev",
+ "dev-develop": "2.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\EventManager\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "homepage": "https://github.com/zendframework/zend-eventmanager",
+ "keywords": [
+ "eventmanager",
+ "zf2"
+ ],
+ "time": "2015-07-16 19:00:49"
+ },
+ {
+ "name": "zendframework/zend-filter",
+ "version": "2.5.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-filter.git",
+ "reference": "93e6990a198e6cdd811064083acac4693f4b29ae"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/93e6990a198e6cdd811064083acac4693f4b29ae",
+ "reference": "93e6990a198e6cdd811064083acac4693f4b29ae",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.23",
+ "zendframework/zend-stdlib": "~2.5"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "1.7.*",
+ "phpunit/phpunit": "~4.0",
+ "zendframework/zend-config": "~2.5",
+ "zendframework/zend-crypt": "~2.5",
+ "zendframework/zend-i18n": "~2.5",
+ "zendframework/zend-loader": "~2.5",
+ "zendframework/zend-servicemanager": "~2.5",
+ "zendframework/zend-uri": "~2.5"
+ },
+ "suggest": {
+ "zendframework/zend-crypt": "Zend\\Crypt component",
+ "zendframework/zend-i18n": "Zend\\I18n component",
+ "zendframework/zend-servicemanager": "Zend\\ServiceManager component",
+ "zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.5-dev",
+ "dev-develop": "2.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\Filter\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "description": "provides a set of commonly needed data filters",
+ "homepage": "https://github.com/zendframework/zend-filter",
+ "keywords": [
+ "filter",
+ "zf2"
+ ],
+ "time": "2015-06-03 15:32:01"
+ },
+ {
+ "name": "zendframework/zend-hydrator",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-hydrator.git",
+ "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-hydrator/zipball/f3ed8b833355140350bbed98d8a7b8b66875903f",
+ "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5",
+ "zendframework/zend-stdlib": "^2.5.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "^2.0@dev",
+ "zendframework/zend-eventmanager": "^2.5.1",
+ "zendframework/zend-filter": "^2.5.1",
+ "zendframework/zend-inputfilter": "^2.5.1",
+ "zendframework/zend-serializer": "^2.5.1",
+ "zendframework/zend-servicemanager": "^2.5.1"
+ },
+ "suggest": {
+ "zendframework/zend-eventmanager": "^2.5.1, to support aggregate hydrator usage",
+ "zendframework/zend-filter": "^2.5.1, to support naming strategy hydrator usage",
+ "zendframework/zend-serializer": "^2.5.1, to use the SerializableStrategy",
+ "zendframework/zend-servicemanager": "^2.5.1, to support hydrator plugin manager usage"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev",
+ "dev-develop": "1.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\Hydrator\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "homepage": "https://github.com/zendframework/zend-hydrator",
+ "keywords": [
+ "hydrator",
+ "zf2"
+ ],
+ "time": "2015-09-17 14:06:43"
+ },
+ {
+ "name": "zendframework/zend-i18n",
+ "version": "2.5.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-i18n.git",
+ "reference": "509271eb7947e4aabebfc376104179cffea42696"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/509271eb7947e4aabebfc376104179cffea42696",
+ "reference": "509271eb7947e4aabebfc376104179cffea42696",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.23",
+ "zendframework/zend-stdlib": "~2.5"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "1.7.*",
+ "phpunit/phpunit": "~4.0",
+ "zendframework/zend-cache": "~2.5",
+ "zendframework/zend-config": "~2.5",
+ "zendframework/zend-eventmanager": "~2.5",
+ "zendframework/zend-filter": "~2.5",
+ "zendframework/zend-servicemanager": "~2.5",
+ "zendframework/zend-validator": "~2.5",
+ "zendframework/zend-view": "~2.5"
+ },
+ "suggest": {
+ "ext-intl": "Required for most features of Zend\\I18n; included in default builds of PHP",
+ "zendframework/zend-cache": "Zend\\Cache component",
+ "zendframework/zend-config": "Zend\\Config component",
+ "zendframework/zend-eventmanager": "You should install this package to use the events in the translator",
+ "zendframework/zend-filter": "You should install this package to use the provided filters",
+ "zendframework/zend-resources": "Translation resources",
+ "zendframework/zend-servicemanager": "Zend\\ServiceManager component",
+ "zendframework/zend-validator": "You should install this package to use the provided validators",
+ "zendframework/zend-view": "You should install this package to use the provided view helpers"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.5-dev",
+ "dev-develop": "2.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\I18n\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "homepage": "https://github.com/zendframework/zend-i18n",
+ "keywords": [
+ "i18n",
+ "zf2"
+ ],
+ "time": "2015-06-03 15:32:01"
+ },
+ {
+ "name": "zendframework/zend-json",
+ "version": "2.5.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-json.git",
+ "reference": "4a3add6505fd8618728239d8ce35f182dfbdac02"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-json/zipball/4a3add6505fd8618728239d8ce35f182dfbdac02",
+ "reference": "4a3add6505fd8618728239d8ce35f182dfbdac02",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5",
+ "zendframework/zend-stdlib": "~2.5"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "1.7.*",
+ "phpunit/phpunit": "~4.0",
+ "zendframework/zend-http": "~2.5",
+ "zendframework/zend-server": "~2.5",
+ "zendframework/zendxml": "~1.0"
+ },
+ "suggest": {
+ "zendframework/zend-http": "Zend\\Http component",
+ "zendframework/zend-server": "Zend\\Server component",
+ "zendframework/zendxml": "To support Zend\\Json\\Json::fromXml() usage"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.5-dev",
+ "dev-develop": "2.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\Json\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP",
+ "homepage": "https://github.com/zendframework/zend-json",
+ "keywords": [
+ "json",
+ "zf2"
+ ],
+ "time": "2015-08-05 14:45:17"
+ },
+ {
+ "name": "zendframework/zend-math",
+ "version": "2.5.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-math.git",
+ "reference": "9f02a1ac4d3374d3332c80f9215deec9c71558fc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-math/zipball/9f02a1ac4d3374d3332c80f9215deec9c71558fc",
+ "reference": "9f02a1ac4d3374d3332c80f9215deec9c71558fc",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.23"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "1.7.*",
+ "ircmaxell/random-lib": "~1.1",
+ "phpunit/phpunit": "~4.0",
+ "zendframework/zend-servicemanager": "~2.5"
+ },
+ "suggest": {
+ "ext-bcmath": "If using the bcmath functionality",
+ "ext-gmp": "If using the gmp functionality",
+ "ircmaxell/random-lib": "Fallback random byte generator for Zend\\Math\\Rand if OpenSSL/Mcrypt extensions are unavailable",
+ "zendframework/zend-servicemanager": ">= current version, if using the BigInteger::factory functionality"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.5-dev",
+ "dev-develop": "2.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\Math\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "homepage": "https://github.com/zendframework/zend-math",
+ "keywords": [
+ "math",
+ "zf2"
+ ],
+ "time": "2015-06-03 15:32:02"
+ },
+ {
+ "name": "zendframework/zend-serializer",
+ "version": "2.5.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-serializer.git",
+ "reference": "b7208eb17dc4a4fb3a660b85e6c4af035eeed40c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-serializer/zipball/b7208eb17dc4a4fb3a660b85e6c4af035eeed40c",
+ "reference": "b7208eb17dc4a4fb3a660b85e6c4af035eeed40c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.23",
+ "zendframework/zend-json": "~2.5",
+ "zendframework/zend-math": "~2.5",
+ "zendframework/zend-stdlib": "~2.5"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "1.7.*",
+ "phpunit/phpunit": "~4.0",
+ "zendframework/zend-servicemanager": "~2.5"
+ },
+ "suggest": {
+ "zendframework/zend-servicemanager": "To support plugin manager support"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.5-dev",
+ "dev-develop": "2.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\Serializer\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "description": "provides an adapter based interface to simply generate storable representation of PHP types by different facilities, and recover",
+ "homepage": "https://github.com/zendframework/zend-serializer",
+ "keywords": [
+ "serializer",
+ "zf2"
+ ],
+ "time": "2015-06-03 15:32:02"
+ },
+ {
+ "name": "zendframework/zend-servicemanager",
+ "version": "2.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-servicemanager.git",
+ "reference": "1dc33f23bd0a7f4d8ba743b915fae523d356027a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/1dc33f23bd0a7f4d8ba743b915fae523d356027a",
+ "reference": "1dc33f23bd0a7f4d8ba743b915fae523d356027a",
+ "shasum": ""
+ },
+ "require": {
+ "container-interop/container-interop": "~1.0",
+ "php": ">=5.5"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "1.7.*",
+ "phpunit/phpunit": "~4.0",
+ "zendframework/zend-di": "~2.5",
+ "zendframework/zend-mvc": "~2.5"
+ },
+ "suggest": {
+ "ocramius/proxy-manager": "ProxyManager 0.5.* to handle lazy initialization of services",
+ "zendframework/zend-di": "Zend\\Di component"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.6-dev",
+ "dev-develop": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\ServiceManager\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "homepage": "https://github.com/zendframework/zend-servicemanager",
+ "keywords": [
+ "servicemanager",
+ "zf2"
+ ],
+ "time": "2015-07-23 21:49:08"
+ },
+ {
+ "name": "zendframework/zend-stdlib",
+ "version": "2.7.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-stdlib.git",
+ "reference": "cae029346a33663b998507f94962eb27de060683"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cae029346a33663b998507f94962eb27de060683",
+ "reference": "cae029346a33663b998507f94962eb27de060683",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5",
+ "zendframework/zend-hydrator": "~1.0"
+ },
+ "require-dev": {
+ "athletic/athletic": "~0.1",
+ "fabpot/php-cs-fixer": "1.7.*",
+ "phpunit/phpunit": "~4.0",
+ "zendframework/zend-config": "~2.5",
+ "zendframework/zend-eventmanager": "~2.5",
+ "zendframework/zend-filter": "~2.5",
+ "zendframework/zend-inputfilter": "~2.5",
+ "zendframework/zend-serializer": "~2.5",
+ "zendframework/zend-servicemanager": "~2.5"
+ },
+ "suggest": {
+ "zendframework/zend-eventmanager": "To support aggregate hydrator usage",
+ "zendframework/zend-filter": "To support naming strategy hydrator usage",
+ "zendframework/zend-serializer": "Zend\\Serializer component",
+ "zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev",
+ "dev-develop": "2.8-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\Stdlib\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "homepage": "https://github.com/zendframework/zend-stdlib",
+ "keywords": [
+ "stdlib",
+ "zf2"
+ ],
+ "time": "2015-10-15 15:57:32"
+ },
+ {
+ "name": "zetacomponents/base",
+ "version": "1.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zetacomponents/Base.git",
+ "reference": "f20df24e8de3e48b6b69b2503f917e457281e687"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zetacomponents/Base/zipball/f20df24e8de3e48b6b69b2503f917e457281e687",
+ "reference": "f20df24e8de3e48b6b69b2503f917e457281e687",
+ "shasum": ""
+ },
+ "require-dev": {
+ "zetacomponents/unit-test": "*"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Sergey Alexeev"
+ },
+ {
+ "name": "Sebastian Bergmann"
+ },
+ {
+ "name": "Jan Borsodi"
+ },
+ {
+ "name": "Raymond Bosman"
+ },
+ {
+ "name": "Frederik Holljen"
+ },
+ {
+ "name": "Kore Nordmann"
+ },
+ {
+ "name": "Derick Rethans"
+ },
+ {
+ "name": "Vadym Savchuk"
+ },
+ {
+ "name": "Tobias Schlitt"
+ },
+ {
+ "name": "Alexandru Stanoi"
+ }
+ ],
+ "description": "The Base package provides the basic infrastructure that all packages rely on. Therefore every component relies on this package.",
+ "homepage": "https://github.com/zetacomponents",
+ "time": "2014-09-19 03:28:34"
+ },
+ {
+ "name": "zetacomponents/document",
+ "version": "1.3.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zetacomponents/Document.git",
+ "reference": "688abfde573cf3fe0730f82538fbd7aa9fc95bc8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zetacomponents/Document/zipball/688abfde573cf3fe0730f82538fbd7aa9fc95bc8",
+ "reference": "688abfde573cf3fe0730f82538fbd7aa9fc95bc8",
+ "shasum": ""
+ },
+ "require": {
+ "zetacomponents/base": "*"
+ },
+ "require-dev": {
+ "zetacomponents/unit-test": "dev-master"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann"
+ },
+ {
+ "name": "Kore Nordmann"
+ },
+ {
+ "name": "Derick Rethans"
+ },
+ {
+ "name": "Tobias Schlitt"
+ },
+ {
+ "name": "Alexandru Stanoi"
+ }
+ ],
+ "description": "The Document components provides a general conversion framework for different semantic document markup languages like XHTML, Docbook, RST and similar.",
+ "homepage": "https://github.com/zetacomponents",
+ "time": "2013-12-19 11:40:00"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": {
+ "php": ">=5.5",
+ "ext-curl": "*",
+ "ext-json": "*",
+ "ext-mbstring": "*"
+ },
+ "platform-dev": []
+}
diff --git a/demo/cli_creditors.php b/demo/cli_creditors.php
deleted file mode 100644
index 84266113..00000000
--- a/demo/cli_creditors.php
+++ /dev/null
@@ -1,39 +0,0 @@
- '',
- 'environment' => GoCardlessPro\Environment::SANDBOX
-));
-
-
-function get_input()
-{
- return trim(fgets(STDIN));
-}
-
-$creditors = $client->creditors()->list()->records();
-
-foreach ($creditors as $num => $creditor) {
- echo '[' . $num . '] ' . $creditor->name() . "\n";
-}
-
-echo 'Please select a creditor by number: ';
-
-$num = intval(get_input());
-
-echo($creditors[$num]);
-
-echo "\nNow, type the creditor's new address3: ";
-
-$client->creditors()->update($creditors[$num]->id(), array('address_line3' => get_input()));
-
-echo "\n";
-
-$creditor = $client->creditors()->get($creditors[$num]->id());
-
-echo $creditor;
-
diff --git a/demo/demo.php b/demo/demo.php
deleted file mode 100644
index ab41f35c..00000000
--- a/demo/demo.php
+++ /dev/null
@@ -1,14 +0,0 @@
- '',
- 'environment' => GoCardlessPro\Environment::SANDBOX
-));
-
-$creditors = $client->creditors()->list();
-
-print_r($creditors);
-
-
diff --git a/lib/Client.php b/lib/Client.php
new file mode 100644
index 00000000..1330955e
--- /dev/null
+++ b/lib/Client.php
@@ -0,0 +1,281 @@
+validate_config($config);
+
+ $access_token = $config['access_token'];
+
+ if (isset($config['base_url'])) {
+ $endpoint_url = $config['base_url'];
+ } else if (isset($config['environment'])) {
+ $endpoint_url = $this->getUrlForEnvironment($config['environment']);
+ } else {
+ throw new \InvalidArgumentException("Please specify an environment");
+ }
+
+ if (isset($config['http_client'])) {
+ $http_client = $config['http_client'];
+ } else {
+ $http_client = new \GuzzleHttp\Client(
+ [
+ 'base_uri' => $endpoint_url,
+ 'headers' => array(
+ 'GoCardless-Version' => '2015-07-06',
+ 'Accept' => 'application/json',
+ 'Content-Type' => 'application/json',
+ 'Authorization' => "Bearer " . $access_token,
+ 'User-Agent' => $this->getUserAgent()
+ ),
+ 'http_errors' => false
+ ]
+ );
+ }
+
+ $this->api_client = new \GoCardlessPro\Core\ApiClient($http_client);
+ }
+
+
+ /**
+ * Service for interacting with bank details lookups
+ * @return Services\BankDetailsLookupsService
+ */
+ public function bankDetailsLookups()
+ {
+ if (!isset($this->bank_details_lookups)) {
+ $this->bank_details_lookups = new Services\BankDetailsLookupsService($this->api_client);
+ }
+
+ return $this->bank_details_lookups;
+ }
+
+ /**
+ * Service for interacting with creditors
+ * @return Services\CreditorsService
+ */
+ public function creditors()
+ {
+ if (!isset($this->creditors)) {
+ $this->creditors = new Services\CreditorsService($this->api_client);
+ }
+
+ return $this->creditors;
+ }
+
+ /**
+ * Service for interacting with creditor bank accounts
+ * @return Services\CreditorBankAccountsService
+ */
+ public function creditorBankAccounts()
+ {
+ if (!isset($this->creditor_bank_accounts)) {
+ $this->creditor_bank_accounts = new Services\CreditorBankAccountsService($this->api_client);
+ }
+
+ return $this->creditor_bank_accounts;
+ }
+
+ /**
+ * Service for interacting with customers
+ * @return Services\CustomersService
+ */
+ public function customers()
+ {
+ if (!isset($this->customers)) {
+ $this->customers = new Services\CustomersService($this->api_client);
+ }
+
+ return $this->customers;
+ }
+
+ /**
+ * Service for interacting with customer bank accounts
+ * @return Services\CustomerBankAccountsService
+ */
+ public function customerBankAccounts()
+ {
+ if (!isset($this->customer_bank_accounts)) {
+ $this->customer_bank_accounts = new Services\CustomerBankAccountsService($this->api_client);
+ }
+
+ return $this->customer_bank_accounts;
+ }
+
+ /**
+ * Service for interacting with events
+ * @return Services\EventsService
+ */
+ public function events()
+ {
+ if (!isset($this->events)) {
+ $this->events = new Services\EventsService($this->api_client);
+ }
+
+ return $this->events;
+ }
+
+ /**
+ * Service for interacting with mandates
+ * @return Services\MandatesService
+ */
+ public function mandates()
+ {
+ if (!isset($this->mandates)) {
+ $this->mandates = new Services\MandatesService($this->api_client);
+ }
+
+ return $this->mandates;
+ }
+
+ /**
+ * Service for interacting with mandate pdfs
+ * @return Services\MandatePdfsService
+ */
+ public function mandatePdfs()
+ {
+ if (!isset($this->mandate_pdfs)) {
+ $this->mandate_pdfs = new Services\MandatePdfsService($this->api_client);
+ }
+
+ return $this->mandate_pdfs;
+ }
+
+ /**
+ * Service for interacting with payments
+ * @return Services\PaymentsService
+ */
+ public function payments()
+ {
+ if (!isset($this->payments)) {
+ $this->payments = new Services\PaymentsService($this->api_client);
+ }
+
+ return $this->payments;
+ }
+
+ /**
+ * Service for interacting with payouts
+ * @return Services\PayoutsService
+ */
+ public function payouts()
+ {
+ if (!isset($this->payouts)) {
+ $this->payouts = new Services\PayoutsService($this->api_client);
+ }
+
+ return $this->payouts;
+ }
+
+ /**
+ * Service for interacting with redirect flows
+ * @return Services\RedirectFlowsService
+ */
+ public function redirectFlows()
+ {
+ if (!isset($this->redirect_flows)) {
+ $this->redirect_flows = new Services\RedirectFlowsService($this->api_client);
+ }
+
+ return $this->redirect_flows;
+ }
+
+ /**
+ * Service for interacting with refunds
+ * @return Services\RefundsService
+ */
+ public function refunds()
+ {
+ if (!isset($this->refunds)) {
+ $this->refunds = new Services\RefundsService($this->api_client);
+ }
+
+ return $this->refunds;
+ }
+
+ /**
+ * Service for interacting with subscriptions
+ * @return Services\SubscriptionsService
+ */
+ public function subscriptions()
+ {
+ if (!isset($this->subscriptions)) {
+ $this->subscriptions = new Services\SubscriptionsService($this->api_client);
+ }
+
+ return $this->subscriptions;
+ }
+
+ private function getUrlForEnvironment($environment)
+ {
+ $environment_urls = array(
+ "live" => "https://api.gocardless.com/",
+ "sandbox" => "https://api-sandbox.gocardless.com/"
+ );
+
+ if(!array_key_exists($environment, $environment_urls)) {
+ throw new \InvalidArgumentException("$environment is not a valid environment, please use one of " . implode(array_keys($environment_urls), ", "));
+ }
+
+ return $environment_urls[$environment];
+ }
+
+ /**
+ * Ensures a config is valid and sets defaults where required
+ *
+ * @param array[string]mixed $config the client configuration options
+ */
+ private function validate_config($config)
+ {
+ $required_option_keys = array('access_token', 'environment');
+
+ foreach ($required_option_keys as $required_option_key) {
+ if (!isset($config[$required_option_key])) {
+ throw new \Exception('Missing required option `' . $required_option_key . '`.');
+ }
+
+ if (!is_string($config[$required_option_key])) {
+ throw new \Exception('Option `'. $required_option_key .'` can only be a string.');
+ }
+ }
+ }
+
+ /**
+ * Gets the client's user agent for API calls
+ *
+ * @return string
+ */
+ private function getUserAgent()
+ {
+ $curlinfo = curl_version();
+ $uagent = array();
+ $uagent[] = 'gocardless-pro-php/0.9.0';
+ $uagent[] = 'schema-version/2015-07-06';
+ $uagent[] = 'GuzzleHttp/' . \GuzzleHttp\Client::VERSION;
+ $uagent[] = 'php/' . phpversion();
+ if (extension_loaded('curl') && function_exists('curl_version')) {
+ $uagent[] = 'curl/' . \curl_version()['version'];
+ $uagent[] = 'curl/' . \curl_version()['host'];
+ }
+ return implode(' ', $uagent);
+ }
+}
diff --git a/lib/Core/ApiClient.php b/lib/Core/ApiClient.php
new file mode 100644
index 00000000..afae2b90
--- /dev/null
+++ b/lib/Core/ApiClient.php
@@ -0,0 +1,102 @@
+http_client = $http_client;
+ }
+
+ /**
+ * Make a GET request to the API
+ *
+ * @param string $path The relative path for the API request. e.g. /records
+ * @param array $params Any query params to send with the request
+ *
+ * @return array The raw response
+ */
+ public function get($path, $params = array())
+ {
+ $response = $this->http_client->request('GET', $path, $params);
+ $this->handleErrors($response);
+ return $response;
+ }
+
+ /**
+ * Make a PUT request to the API
+ *
+ * @param string $path The relative path for the API request. e.g. /records
+ * @param array $params Body of the request, will be serialized to JSON
+ *
+ * @return array The raw response
+ */
+ public function put($path, $params)
+ {
+ $response = $this->http_client->request('PUT', $path, $params);
+ $this->handleErrors($response);
+ return $response;
+ }
+
+ /**
+ * Make a POST request to the API
+ *
+ * @param string $path The relative path for the API request. e.g. /records
+ * @param array $params Body of the request, will be serialized to JSON
+ *
+ * @return array The raw response
+ */
+ public function post($path, $params)
+ {
+ $response = $this->http_client->request('POST', $path, $params);
+ $this->handleErrors($response);
+ return $response;
+ }
+
+ /**
+ * Handle any errors in the API response
+ *
+ * If the response doesn't contain JSON, we will fail to decode and throw a
+ * MalFormedResponseException.
+ *
+ * If the response is JSON, but the status code is >= 400, then we return
+ * the appropriate error depending on the code
+ *
+ * @param GuzzleHttp\Psr7\Response $response The raw API response
+ */
+ private function handleErrors($response)
+ {
+ $json = json_decode($response->getBody());
+
+ if ($json === null) {
+ $msg = "Malformed response received from server";
+ throw new Exception\MalformedResponseException($msg, $response);
+ }
+
+ if ($response->getStatusCode() < 400) {
+ return null;
+ }
+
+ $error = $json->error;
+ $exception_class = (string) ApiException::getErrorForType($error->type);
+ $exception_class = 'GoCardlessPro\\Core\\Exception\\' . $exception_class;
+ throw new $exception_class($error);
+ }
+}
diff --git a/lib/Core/ApiResponse.php b/lib/Core/ApiResponse.php
new file mode 100644
index 00000000..7b7efb3b
--- /dev/null
+++ b/lib/Core/ApiResponse.php
@@ -0,0 +1,32 @@
+headers = $response->getHeaders();
+ $this->status_code = $response->getStatusCode();
+ $this->body = json_decode($response->getBody());
+ }
+}
diff --git a/lib/Core/Exception/ApiConnectionException.php b/lib/Core/Exception/ApiConnectionException.php
new file mode 100644
index 00000000..a0e5c5d6
--- /dev/null
+++ b/lib/Core/Exception/ApiConnectionException.php
@@ -0,0 +1,8 @@
+api_error = $error;
+ parent::__construct($this->getErrorMessage(), $this->api_error->code);
+ }
+
+ /**
+ * Factory for GoCardlessPro and it's subclasses.
+ * @return InvalidApiUsageException|InvalidStateException|ValidationFailedException
+ */
+ public static function getErrorForType($error_type)
+ {
+ switch($error_type) {
+ case 'invalid_api_usage':
+ return 'InvalidApiUsageException';
+ case 'invalid_state':
+ return 'InvalidStateException';
+ case 'validation_failed':
+ return 'ValidationFailedException';
+ }
+
+ throw new GoCardlessProException('Invalid error type ' . $error_type);
+ }
+
+ public function getType()
+ {
+ return $this->api_error->type;
+ }
+
+ public function getErrors()
+ {
+ if (property_exists($this->api_error, 'errors')) {
+ return $this->api_error->errors;
+ }
+
+ return array();
+ }
+
+ public function getDocumentationUrl()
+ {
+ return $this->api_error->documentation_url;
+ }
+
+ public function getRequestId()
+ {
+ return $this->api_error->request_id;
+ }
+
+ protected function getErrorMessage()
+ {
+ if (!is_array($this->getErrors())) {
+ return $this->api_error->message;
+ }
+
+ $error_messages = array_map(array($this, 'extractErrorMessage'), $this->getErrors());
+ $error_messages = array_filter(
+ $error_messages,
+ function ($m) {
+ return $m != $this->api_error->message;
+ }
+ );
+
+ if (count($error_messages) > 0) {
+ return $this->api_error->message . ' (' . implode($error_messages, ", ") . ')';
+ } else {
+ return $this->api_error->message;
+ }
+ }
+
+ protected function extractErrorMessage($error)
+ {
+ return $error->message;
+ }
+
+}
diff --git a/lib/Core/Exception/GoCardlessInternalException.php b/lib/Core/Exception/GoCardlessInternalException.php
new file mode 100644
index 00000000..978bed3a
--- /dev/null
+++ b/lib/Core/Exception/GoCardlessInternalException.php
@@ -0,0 +1,8 @@
+response = $response;
+ parent::__construct($message);
+ }
+
+
+ public function response()
+ {
+ $this->response;
+ }
+};
diff --git a/lib/Core/Exception/ValidationFailedException.php b/lib/Core/Exception/ValidationFailedException.php
new file mode 100644
index 00000000..e131468e
--- /dev/null
+++ b/lib/Core/Exception/ValidationFailedException.php
@@ -0,0 +1,11 @@
+field . ' ' . $error->message;
+ }
+};
diff --git a/lib/Core/ListResponse.php b/lib/Core/ListResponse.php
new file mode 100644
index 00000000..112fe1dc
--- /dev/null
+++ b/lib/Core/ListResponse.php
@@ -0,0 +1,40 @@
+api_response = $api_response;
+ $this->before = $this->api_response->body->meta->cursors->before;
+ $this->after = $this->api_response->body->meta->cursors->after;
+
+ foreach ($unenveloped_body as $item) {
+ $this->records[] = new $model_class($item);
+ }
+ }
+}
diff --git a/lib/Core/Paginator.php b/lib/Core/Paginator.php
new file mode 100644
index 00000000..c07425d7
--- /dev/null
+++ b/lib/Core/Paginator.php
@@ -0,0 +1,146 @@
+service = $service;
+ $this->options = $options;
+
+ if(isset($options['params']) && isset($options['params']['limit'])) {
+ $this->options['params']['limit'] = min($options['params']['limit'], self::HARD_RECORD_LIMIT);
+ } else {
+ $this->options['params']['limit'] = self::HARD_RECORD_LIMIT;
+ }
+ }
+
+ /**
+ * Rewind to the first page for foreach iterators
+ */
+ public function rewind()
+ {
+ $this->current_position = 0;
+ $this->current_page_position = 0;
+ $this->current_response = $this->initial_response();
+ }
+
+ /**
+ * Get the current element for foreach iterators
+ *
+ * @return \GoCardlessPro\Resources\BaseResource
+ */
+ public function current()
+ {
+ return $this->current_records()[$this->key()];
+ }
+
+ /**
+ * Gets the current iteration key
+ *
+ * @return int
+ */
+ public function key()
+ {
+ return $this->current_position - $this->current_page_position;
+ }
+
+ /**
+ * Increments the current index of the iterator and fetches the next
+ * page if required
+ */
+ public function next()
+ {
+ ++$this->current_position;
+
+ if(!$this->valid()) {
+ $this->current_response = $this->next_response();
+ $this->current_page_position = $this->current_position;
+ }
+ }
+
+ /**
+ * Returns whether the current position is valid
+ *
+ * @return bool
+ */
+ public function valid()
+ {
+ return !is_null($this->current_response) &&
+ array_key_exists($this->key(), $this->current_records());
+ }
+
+ /**
+ * Fetch the first page of results
+ *
+ * @return ListResponse
+ */
+ private function initial_response()
+ {
+ $options = $this->options;
+ $options['params']['after'] = null;
+ return $this->service->list($options);
+ }
+
+ /**
+ * Fetches the next page of results (based on the current page)
+ *
+ * @return ListResponse
+ */
+ private function next_response()
+ {
+ $options = $this->options;
+ $options['params']['after'] = $this->current_response->after;
+ if (empty($options['params']['after'])) {
+ return null;
+ }
+
+ return $this->service->list($options);
+ }
+
+ /**
+ * Returns the current response array
+ *
+ * @return \GoCardlessPro\Resources\BaseResource[]
+ */
+ private function current_records()
+ {
+ return $this->current_response->records;
+ }
+
+}
diff --git a/lib/Core/Util.php b/lib/Core/Util.php
new file mode 100644
index 00000000..fa20859f
--- /dev/null
+++ b/lib/Core/Util.php
@@ -0,0 +1,81 @@
+ $v) {
+ if (is_null($v)) {
+ continue;
+ }
+
+ if ($prefix && $k && !is_int($k)) {
+ $k = $prefix."[".$k."]";
+ } elseif ($prefix) {
+ $k = $prefix."[]";
+ }
+
+ if (is_array($v)) {
+ $enc = self::encode($v, $k);
+ if ($enc) {
+ $r[] = $enc;
+ }
+ } else {
+ $r[] = urlencode($k)."=".urlencode($v);
+ }
+ }
+
+ return implode("&", $r);
+ }
+
+ /**
+ * Replace URL tokens with the substitution mapping to generate urls.
+ *
+ * For example:
+ *
+ * subUrl("/stats_for/:id", array("id" => "foo")) => "/stats_for/foo"
+ *
+ * @param string $url Url to substitute
+ * @param array $substitutions Substitutions to make
+ *
+ * @return string the generated URL
+ */
+ public static function subUrl($url, $substitutions)
+ {
+ foreach ($substitutions as $substitution_key => $substitution_value) {
+ if (!is_string($substitution_value)) {
+ $error_type = ' needs to be a string, not a '.gettype($substitution_value).'.';
+ throw new \Exception('URL value for ' . $substitution_key . $error_type);
+ }
+ $url = str_replace(':' . $substitution_key, $substitution_value, $url);
+ }
+ return $url;
+ }
+
+}
diff --git a/lib/Environment.php b/lib/Environment.php
new file mode 100644
index 00000000..7f015341
--- /dev/null
+++ b/lib/Environment.php
@@ -0,0 +1,19 @@
+error = $error;
- $this->http_status = $http_status;
-
- if (is_object($error)) {
- $message = $error->error->message;
- if ($error->error->documentation_url) {
- $message .= (', see ' . $error->error->documentation_url);
- }
- } else {
- $message = (string)$error;
- }
- parent::__construct($message);
- }
-
- /**
- * Ensures a given property exists on the error object.
- */
- private static function hasErrorObjectWith($error, $prop) {
- return (is_object($error) && isset($error->error)
- && is_object($error->error) && isset($error->error->{$prop}));
- }
-
- /**
- * Factory for GoCardlessError and it's subclasses.
- * @return GoCardlessError|InvalidApiUsageError|InvalidStateError|ValidationFailedError
- */
- public static function makeApiError($error, $status)
- {
- if (self::hasErrorObjectWith($error, 'type')) {
- switch ($error->error->type) {
- case 'invalid_api_usage':
- return new InvalidApiUsageError($error, $status);
-
- case 'invalid_state':
- return new InvalidStateError($error, $status);
-
- case 'validation_failed':
- return new ValidationFailedError($error, $status);
- }
- }
- return new GoCardlessError($error, $status);
- }
-
- /** @see GoCardlessError::$error */
- public function error()
- {
- return new \GoCardlessPro\Resources\Wrapper\NestedObject('error', $this->error->error);
- }
-
- /**
- * Get all http errors (includes a list of objects with a required
- * reason and message, and optional links properties).
- *
- * @return array[mixed] List of validation errors from the api
- * @see https://developer.gocardless.com/pro/#errors-invalid-api-usage-errors
- */
- public function errors()
- {
- return new \GoCardlessPro\Resources\Wrapper\NestedArray('errors', $this->error->error->errors);
- }
-
- /**
- * Gets the error's documentation url if it exists.
- *
- * @return string|null
- */
- public function documentation_url()
- {
- if (self::hasErrorObjectWith($this->error, 'documentation_url')) {
- return $this->error->error->documentation_url;
- }
- return null;
- }
-
- /**
- * Gets the server's http status.
- *
- * @see GoCardlessError::$http_status
- * @return int
- */
- public function http_status()
- {
- return $this->http_status;
- }
-}
diff --git a/lib/GoCardlessPro/Core/Error/HttpError.php b/lib/GoCardlessPro/Core/Error/HttpError.php
deleted file mode 100644
index ee0faee2..00000000
--- a/lib/GoCardlessPro/Core/Error/HttpError.php
+++ /dev/null
@@ -1,49 +0,0 @@
-number = $curl_error_number;
- $this->description = $description;
- parent::__construct($description . ' (' . $curl_error_number . ')');
- }
-
- /**
- * The curl error number.
- *
- * @see HttpError::$number
- * @return int
- */
- public function number()
- {
- return $this->curl_error_number;
- }
- /**
- * The curl error description.
- *
- * @see HttpError::$description
- * @return string
- */
- public function description()
- {
- return $this->description;
- }
-}
diff --git a/lib/GoCardlessPro/Core/Error/InvalidApiUsageError.php b/lib/GoCardlessPro/Core/Error/InvalidApiUsageError.php
deleted file mode 100644
index 37c267aa..00000000
--- a/lib/GoCardlessPro/Core/Error/InvalidApiUsageError.php
+++ /dev/null
@@ -1,14 +0,0 @@
-modelClass = $modelClass;
- $this->response = $response;
- foreach ($response->response() as $item) {
- $this->models[] = new $modelClass($item);
- }
- }
-
- /**
- * HTTP response information
- *
- * @return Response
- */
- public function response()
- {
- return $this->response;
- }
-
- /**
- * Gets an array of resources in the list
- *
- * @return array
- */
- public function records()
- {
- return $this->models;
- }
-
- /**
- * Accessor to the response's meta object in a NestedObject wrapper
- *
- * @return \GoCardlessPro\Resources\Wrapper\NestedObject
- */
- public function meta()
- {
- return $this->response->meta();
- }
-}
diff --git a/lib/GoCardlessPro/Core/Paginator.php b/lib/GoCardlessPro/Core/Paginator.php
deleted file mode 100644
index ec6a90b4..00000000
--- a/lib/GoCardlessPro/Core/Paginator.php
+++ /dev/null
@@ -1,209 +0,0 @@
-parent = $parent;
- $this->options = $options;
- $this->headers = $headers;
- $this->max_results = min($max_results, self::HARD_RECORD_LIMIT);
- $this->results_count = 0;
- $this->initial_response = $response;
- $this->current_response = $response;
- $this->current_position = 0;
- $this->page_start = 0;
- $this->update_ids($response);
- }
-
- /**
- * Reset current page to response
- * @param Response $response Response object to set to current page
- */
- private function update_ids($response)
- {
- $this->results_count = 0;
- $this->current_response = $response;
- $this->page_start = $this->current_position;
- if (!empty($response)) {
- $this->meta = $response->meta();
- }
- $this->results_count += count($response->records());
- }
-
- /**
- * Rewind to the first page for foreach iterators
- */
- public function rewind()
- {
- $this->current_position = 0;
- $this->update_ids($this->initial_response);
- }
-
- /**
- * Get the current element for foreach iterators
- * @return Response
- */
- public function current()
- {
- $records = $this->current_records();
- return $records[$this->key()];
- }
-
- /**
- * Gets the current iteration key
- * return string
- */
- public function key()
- {
- return $this->current_position - $this->page_start;
- }
-
- /**
- * Gets the next element in the iterator
- */
- public function next()
- {
- $this->current_position++;
- $this->needs_next_page();
- }
-
- /**
- * Internal function to determine if loading the next page is necessary.
- */
- private function needs_next_page()
- {
- $records = $this->current_records();
- if (!isset($records[$this->key()])) {
- $this->next_page();
- }
- }
-
- /**
- * Gets the current page of items.
- * @return ListResponse
- */
- public function items()
- {
- return $this->current_response;
- }
-
- /**
- * Fetches the previous page.
- * @return bool (true on success)
- */
- public function previous_page()
- {
- if ($this->results_count > $this->max_results) {
- $this->current_response = array();
- return false;
- }
- $options = $this->options;
- $options['before'] = $this->meta->cursors()->before();
- if (empty($options['before'])) {
- $this->current_response = array();
- return false;
- }
- return $this->get_server_response($options);
- }
-
- /**
- * Fetches the next page
- * @return bool (true on success)
- */
- public function next_page()
- {
- if ($this->results_count > $this->max_results) {
- $this->current_response = array();
- return false;
- }
- $options = $this->options;
- $options['after'] = $this->meta->cursors()->after();
- if (empty($options['after'])) {
- $this->current_response = array();
- return false;
- }
- return $this->get_server_response($options);
- }
-
- /**
- * Helper function to get server responses from the webservice.
- *
- * @param $options array[string]string Set of options to pass to request
- * @return bool
- */
- private function get_server_response($options)
- {
- $this->current_response = $this->parent->list($options, $this->headers);
- if (count($this->current_response) > 0) {
- $this->update_ids($this->current_response);
- }
- $this->update_ids($this->current_response);
- return true;
- }
-
- /**
- * Returns the current response array
- * @return array
- */
- public function current_records()
- {
- return !empty($this->current_response) ? $this->current_response->records() : array();
- }
-
- /**
- * Returns if the current page is a valid page (called by foreach)
- * @return bool
- */
- public function valid()
- {
- if ($this->results_count > $this->max_results) {
- return false;
- }
- $current_records = $this->current_records();
- return !empty($current_records) || isset($current_records[$this->key()]);
- }
-}
diff --git a/lib/GoCardlessPro/Core/Response.php b/lib/GoCardlessPro/Core/Response.php
deleted file mode 100644
index a4469d2c..00000000
--- a/lib/GoCardlessPro/Core/Response.php
+++ /dev/null
@@ -1,179 +0,0 @@
-body = $body;
- $this->content_type = $content_type;
- $this->status = $status;
-
- // Downcase header keys for consistency.
- foreach ($headers as $key => $value) {
- $this->headers[strtolower($key)] = $value;
- }
-
- if ($this->is_error()) {
- $this->handle_error();
- }
- }
-
- /**
- * If there is an error in the http headers, decode the json body into an
- * error object and throw it.
- * @throws Error\GoCardlessError
- */
- public function handle_error()
- {
- $error = $this->is_json() ? $this->json_body() : $this->raw_body();
- throw Error\GoCardlessError::makeApiError($error, $this->status());
- }
-
- /**
- * Sets the unwrap json value. Required for json responses.
- * @param string $key the unwrap key.
- */
- public function set_unwrap_json($key)
- {
- $this->unwrap_json = $key;
- }
-
- /**
- * Gets the response content-type
- * @return string
- */
- public function content_type()
- {
- return $this->content_type;
- }
-
- /**
- * Gets all the HTTP headers with lowercased keys
- * @return array[string]string
- */
- public function headers()
- {
- return $this->headers;
- }
-
- /**
- * Get a single HTTP header (case-insensitive)
- * @return string
- */
- public function header($name)
- {
- $key = strtolower($name);
- if (isset($this->headers[$key])) {
- return $this->headers[$key];
- }
- return null;
- }
-
- /**
- * Get the HTTP status of the response
- * @return int
- */
- public function status()
- {
- return $this->status;
- }
-
- /**
- * Returns either the full decoded json body or the raw body of the reponse.
- */
- public function body()
- {
- return ($this->is_json() ? $this->json_body() : $this->raw_body());
- }
-
- /**
- * Checks the content_type to see if the response is json.
- * @return bool
- */
- public function is_json()
- {
- return (strpos($this->content_type, 'application/json') === 0);
- }
-
- /**
- * Checks if this response is an error response
- * @return bool
- */
- public function is_error()
- {
- return ($this->status >= 400);
- }
-
- /**
- * Get the unwrapped json body response, only works for json responses.
- */
- public function response()
- {
- if (!isset($this->unwrap_json)) {
- throw new \Exception("UnwrapJSON needs to be set before getting response body");
- }
- return $this->json_body()->{$this->unwrap_json};
- }
-
- /**
- * Gets the meta information in wrapped json responses
- * @return stdClass
- */
- public function meta()
- {
- return new \GoCardlessPro\Resources\Wrapper\NestedObject('meta', $this->json_body()->meta);
- }
-
- /**
- * Gets the limit in json body responses.
- * @return int
- */
- public function limit()
- {
- return $this->json_body()->meta->limit;
- }
-
- /**
- * Returns the decoded full json body
- * @return stdClass
- */
- public function json_body()
- {
- if (!isset($this->json_body_data)) {
- $this->json_body_data = json_decode($this->body, false);
- }
- return $this->json_body_data;
- }
-
- /**
- * Gets the raw body string in all cases.
- * @return string
- */
- public function raw_body()
- {
- return $this->body;
- }
-}
diff --git a/lib/GoCardlessPro/Environment.php b/lib/GoCardlessPro/Environment.php
deleted file mode 100644
index 5835cdd4..00000000
--- a/lib/GoCardlessPro/Environment.php
+++ /dev/null
@@ -1,15 +0,0 @@
-data, $field)) {
- return null;
- }
- return new Wrapper\NestedArray($field, $this->data->{$field});
-
- }
-
- /**
- * The name of the bank with which the account is held (if available).
- *
- * @return string
- */
- public function bank_name()
- {
- $field = 'bank_name';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * ISO 9362 SWIFT BIC of the bank with which the account is held.
- *
- * @return string
- */
- public function bic()
- {
- $field = 'bic';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'BankDetailsLookup Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Base.php b/lib/GoCardlessPro/Resources/Base.php
deleted file mode 100644
index 3dec73c6..00000000
--- a/lib/GoCardlessPro/Resources/Base.php
+++ /dev/null
@@ -1,45 +0,0 @@
-response = $response;
- $this->data = $data;
- }
-
- /**
- * Get the response object.
- * @uses Base::$response
- * @return \GoCardlessPro\Core\Response
- */
- public function response()
- {
- return $this->response;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Creditor.php b/lib/GoCardlessPro/Resources/Creditor.php
deleted file mode 100644
index 18a919da..00000000
--- a/lib/GoCardlessPro/Resources/Creditor.php
+++ /dev/null
@@ -1,195 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The second line of the creditor's address.
- *
- * @return string
- */
- public function address_line2()
- {
- $field = 'address_line2';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The third line of the creditor's address.
- *
- * @return string
- */
- public function address_line3()
- {
- $field = 'address_line3';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The city of the creditor's address.
- *
- * @return string
- */
- public function city()
- {
- $field = 'city';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO
- * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
- * alpha-2 code.
- *
- * @return string
- */
- public function country_code()
- {
- $field = 'country_code';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Fixed [timestamp](#overview-time-zones-dates), recording when this
- * resource was created.
- *
- * @return string
- */
- public function created_at()
- {
- $field = 'created_at';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique identifier, beginning with "CR".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Referenced objects. Key values to stdClasses returned.
- *
- * @return Wrapper\NestedObject
- */
- public function links()
- {
- $field = 'links';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * The creditor's name.
- *
- * @return string
- */
- public function name()
- {
- $field = 'name';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The creditor's postal code.
- *
- * @return string
- */
- public function postal_code()
- {
- $field = 'postal_code';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The creditor's address region, county or department.
- *
- * @return string
- */
- public function region()
- {
- $field = 'region';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'Creditor Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/CreditorBankAccount.php b/lib/GoCardlessPro/Resources/CreditorBankAccount.php
deleted file mode 100644
index b1d4be28..00000000
--- a/lib/GoCardlessPro/Resources/CreditorBankAccount.php
+++ /dev/null
@@ -1,190 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Last two digits of account number.
- *
- * @return string
- */
- public function account_number_ending()
- {
- $field = 'account_number_ending';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Name of bank, taken from the bank details.
- *
- * @return string
- */
- public function bank_name()
- {
- $field = 'bank_name';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO
- * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
- * alpha-2 code. Defaults to the country code of the `iban` if supplied,
- * otherwise is required.
- *
- * @return string
- */
- public function country_code()
- {
- $field = 'country_code';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Fixed [timestamp](#overview-time-zones-dates), recording when this
- * resource was created.
- *
- * @return string
- */
- public function created_at()
- {
- $field = 'created_at';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
- * code, defaults to national currency of `country_code`.
- *
- * @return string
- */
- public function currency()
- {
- $field = 'currency';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Boolean value showing whether the bank account is enabled or disabled.
- *
- * @return bool
- */
- public function enabled()
- {
- $field = 'enabled';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique identifier, beginning with "BA".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Referenced objects. Key values to stdClasses returned.
- *
- * @return Wrapper\NestedObject
- */
- public function links()
- {
- $field = 'links';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * Key-value store of custom data. Up to 3 keys are permitted, with key names
- * up to 50 characters and values up to 200 characters.
- *
- * @return Wrapper\NestedObject
- */
- public function metadata()
- {
- $field = 'metadata';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'CreditorBankAccount Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Customer.php b/lib/GoCardlessPro/Resources/Customer.php
deleted file mode 100644
index 2c85e743..00000000
--- a/lib/GoCardlessPro/Resources/Customer.php
+++ /dev/null
@@ -1,279 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The second line of the customer's address.
- *
- * @return string
- */
- public function address_line2()
- {
- $field = 'address_line2';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The third line of the customer's address.
- *
- * @return string
- */
- public function address_line3()
- {
- $field = 'address_line3';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The city of the customer's address.
- *
- * @return string
- */
- public function city()
- {
- $field = 'city';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Customer's company name. Required unless a `given_name` and `family_name`
- * are provided.
- *
- * @return string
- */
- public function company_name()
- {
- $field = 'company_name';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO
- * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
- * alpha-2 code.
- *
- * @return string
- */
- public function country_code()
- {
- $field = 'country_code';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Fixed [timestamp](#overview-time-zones-dates), recording when this
- * resource was created.
- *
- * @return string
- */
- public function created_at()
- {
- $field = 'created_at';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Customer's email address.
- *
- * @return string
- */
- public function email()
- {
- $field = 'email';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Customer's surname. Required unless a `company_name` is provided.
- *
- * @return string
- */
- public function family_name()
- {
- $field = 'family_name';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Customer's first name. Required unless a `company_name` is provided.
- *
- * @return string
- */
- public function given_name()
- {
- $field = 'given_name';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique identifier, beginning with "CU".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code.
- * Used as the language for notification emails sent by GoCardless if your
- * organisation does not send its own (see [compliance
- * requirements](#appendix-compliance-requirements)). Currently only "en",
- * "fr", "de", "pt", "es", "it", "nl" are supported. If this is not provided,
- * the language will be chosen based on the `country_code` (if supplied) or
- * default to "en".
- *
- * @return string
- */
- public function language()
- {
- $field = 'language';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Key-value store of custom data. Up to 3 keys are permitted, with key names
- * up to 50 characters and values up to 200 characters.
- *
- * @return Wrapper\NestedObject
- */
- public function metadata()
- {
- $field = 'metadata';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * The customer's postal code.
- *
- * @return string
- */
- public function postal_code()
- {
- $field = 'postal_code';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The customer's address region, county or department.
- *
- * @return string
- */
- public function region()
- {
- $field = 'region';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * For Swedish customers only. The civic/company number (personnummer,
- * samordningsnummer, or organisationsnummer) of the customer. Must be
- * supplied if the customer's bank account is denominated in Swedish krona
- * (SEK). This field cannot be changed once it has been set. Beta: this field is only used for
- * Autogiro, which is currently in beta.
- *
- * @return string
- */
- public function swedish_identity_number()
- {
- $field = 'swedish_identity_number';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'Customer Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/CustomerBankAccount.php b/lib/GoCardlessPro/Resources/CustomerBankAccount.php
deleted file mode 100644
index dcee28e6..00000000
--- a/lib/GoCardlessPro/Resources/CustomerBankAccount.php
+++ /dev/null
@@ -1,189 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Last two digits of account number.
- *
- * @return string
- */
- public function account_number_ending()
- {
- $field = 'account_number_ending';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Name of bank, taken from the bank details.
- *
- * @return string
- */
- public function bank_name()
- {
- $field = 'bank_name';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO
- * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
- * alpha-2 code. Defaults to the country code of the `iban` if supplied,
- * otherwise is required.
- *
- * @return string
- */
- public function country_code()
- {
- $field = 'country_code';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Fixed [timestamp](#overview-time-zones-dates), recording when this
- * resource was created.
- *
- * @return string
- */
- public function created_at()
- {
- $field = 'created_at';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
- * code, defaults to national currency of `country_code`.
- *
- * @return string
- */
- public function currency()
- {
- $field = 'currency';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Boolean value showing whether the bank account is enabled or disabled.
- *
- * @return bool
- */
- public function enabled()
- {
- $field = 'enabled';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique identifier, beginning with "BA".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Referenced objects. Key values to stdClasses returned.
- *
- * @return Wrapper\NestedObject
- */
- public function links()
- {
- $field = 'links';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * Key-value store of custom data. Up to 3 keys are permitted, with key names
- * up to 50 characters and values up to 200 characters.
- *
- * @return Wrapper\NestedObject
- */
- public function metadata()
- {
- $field = 'metadata';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'CustomerBankAccount Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Event.php b/lib/GoCardlessPro/Resources/Event.php
deleted file mode 100644
index b70a5beb..00000000
--- a/lib/GoCardlessPro/Resources/Event.php
+++ /dev/null
@@ -1,145 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Fixed [timestamp](#overview-time-zones-dates), recording when this
- * resource was created.
- *
- * @return string
- */
- public function created_at()
- {
- $field = 'created_at';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- *
- *
- * @return Wrapper\NestedObject
- */
- public function details()
- {
- $field = 'details';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * Unique identifier, beginning with "EV".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Referenced objects. Key values to stdClasses returned.
- *
- * @return Wrapper\NestedObject
- */
- public function links()
- {
- $field = 'links';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * If the `details[origin]` is `api`, this will contain any metadata you
- * specified when triggering this event. In other cases it will be an empty
- * object.
- *
- * @return Wrapper\NestedObject
- */
- public function metadata()
- {
- $field = 'metadata';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * The resource type for this event. One of:
- *
- *
- * - `payments`
- * - `mandates`
- * - `payouts`
-
- * * - `refunds`
- * - `subscriptions`
- *
- * [payments mandates payouts refunds subscriptions]
- * @return string
- */
- public function resource_type()
- {
- $field = 'resource_type';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'Event Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Mandate.php b/lib/GoCardlessPro/Resources/Mandate.php
deleted file mode 100644
index 167fa13c..00000000
--- a/lib/GoCardlessPro/Resources/Mandate.php
+++ /dev/null
@@ -1,172 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique identifier, beginning with "MD".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Referenced objects. Key values to stdClasses returned.
- *
- * @return Wrapper\NestedObject
- */
- public function links()
- {
- $field = 'links';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * Key-value store of custom data. Up to 3 keys are permitted, with key names
- * up to 50 characters and values up to 200 characters.
- *
- * @return Wrapper\NestedObject
- */
- public function metadata()
- {
- $field = 'metadata';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * The earliest date a newly created payment for this mandate could be
- * charged.
- *
- * @return string
- */
- public function next_possible_charge_date()
- {
- $field = 'next_possible_charge_date';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique reference. Different schemes have different length and [character
- * set](#character-sets) requirements. GoCardless will generate a unique
- * reference satisfying the different scheme requirements if this field is
- * left blank.
- *
- * @return string
- */
- public function reference()
- {
- $field = 'reference';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Direct Debit scheme to which this mandate
- * and associated payments are submitted. Can be supplied or automatically
- * detected from the customer's bank account. Currently only "autogiro",
- * "bacs", "sepa_core", and "sepa_cor1" are supported.
- *
- * @return string
- */
- public function scheme()
- {
- $field = 'scheme';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * One of:
- *
- * - `pending_submission`: the mandate has not yet
- * been submitted to the customer's bank
- * - `submitted`: the
- * mandate has been submitted to the customer's bank but has not been
- * processed yet
- * - `active`: the mandate has been successfully
- * set up by the customer's bank
- * - `failed`: the mandate could
- * not be created
- * - `cancelled`: the mandate has been
- * cancelled
- * - `expired`: the mandate has expired due to
- * dormancy
- *
- * [pending_submission submitted active failed cancelled expired]
- * @return string
- */
- public function status()
- {
- $field = 'status';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'Mandate Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/MandatePdf.php b/lib/GoCardlessPro/Resources/MandatePdf.php
deleted file mode 100644
index f57b90ba..00000000
--- a/lib/GoCardlessPro/Resources/MandatePdf.php
+++ /dev/null
@@ -1,63 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The URL at which this mandate PDF can be viewed until it expires at the
- * date and time specified by `expires_at`. You should not store this URL or
- * rely on its structure remaining the same.
- *
- * @return string
- */
- public function url()
- {
- $field = 'url';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'MandatePdf Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Payment.php b/lib/GoCardlessPro/Resources/Payment.php
deleted file mode 100644
index ff4b8d11..00000000
--- a/lib/GoCardlessPro/Resources/Payment.php
+++ /dev/null
@@ -1,220 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Amount [refunded](#core-endpoints-refunds) in pence/cents/öre.
- *
- * @return int
- */
- public function amount_refunded()
- {
- $field = 'amount_refunded';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * A future date on which the payment should be collected. If not specified,
- * the payment will be collected as soon as possible. This must be on or
- * after the [mandate](#core-endpoints-mandates)'s
- * `next_possible_charge_date`, and will be rolled-forwards by GoCardless if
- * it is not a working day.
- *
- * @return string
- */
- public function charge_date()
- {
- $field = 'charge_date';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Fixed [timestamp](#overview-time-zones-dates), recording when this
- * resource was created.
- *
- * @return string
- */
- public function created_at()
- {
- $field = 'created_at';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
- * code, currently only "GBP", "EUR", and "SEK" are supported.
- *
- * @return string
- */
- public function currency()
- {
- $field = 'currency';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * A human readable description of the payment.
- *
- * @return string
- */
- public function description()
- {
- $field = 'description';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique identifier, beginning with "PM".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Referenced objects. Key values to stdClasses returned.
- *
- * @return Wrapper\NestedObject
- */
- public function links()
- {
- $field = 'links';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * Key-value store of custom data. Up to 3 keys are permitted, with key names
- * up to 50 characters and values up to 200 characters.
- *
- * @return Wrapper\NestedObject
- */
- public function metadata()
- {
- $field = 'metadata';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * An optional payment reference that will appear on your customer's bank
- * statement. For Bacs payments this can be up to 10 characters, for SEPA
- * payments the limit is 140 characters, and for Autogiro payments the limit
- * is 11 characters.
- *
- * @return string
- */
- public function reference()
- {
- $field = 'reference';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * One of:
- *
- * - `pending_submission`: the payment has been
- * created, but not yet submitted to the banks
- * - `submitted`:
- * the payment has been submitted to the banks
- * - `confirmed`:
- * the payment has been confirmed as collected
- * - `failed`: the
- * payment failed to be processed. Note that payments can fail after being
- * confirmed, if the failure message is sent late by the banks.
- *
- * - `charged_back`: the payment has been charged back
- *
- * - `paid_out`: the payment has been included in a
- * [payout](#core-endpoints-payouts)
- * - `cancelled`: the payment
- * has been cancelled
- *
- * [pending_submission submitted confirmed failed charged_back paid_out cancelled]
- * @return string
- */
- public function status()
- {
- $field = 'status';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'Payment Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Payout.php b/lib/GoCardlessPro/Resources/Payout.php
deleted file mode 100644
index d056552b..00000000
--- a/lib/GoCardlessPro/Resources/Payout.php
+++ /dev/null
@@ -1,141 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Fixed [timestamp](#overview-time-zones-dates), recording when this
- * resource was created.
- *
- * @return string
- */
- public function created_at()
- {
- $field = 'created_at';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
- * code.
- *
- * @return string
- */
- public function currency()
- {
- $field = 'currency';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique identifier, beginning with "PO".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Referenced objects. Key values to stdClasses returned.
- *
- * @return Wrapper\NestedObject
- */
- public function links()
- {
- $field = 'links';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * Reference which appears on the creditor's bank statement.
- *
- * @return string
- */
- public function reference()
- {
- $field = 'reference';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * One of:
- *
- * - `pending`: the payout has been created, but
- * not yet sent to the banks
- * - `paid`: the payout has been sent
- * to the banks
- *
- * [pending paid]
- * @return string
- */
- public function status()
- {
- $field = 'status';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'Payout Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/RedirectFlow.php b/lib/GoCardlessPro/Resources/RedirectFlow.php
deleted file mode 100644
index 4f7133cb..00000000
--- a/lib/GoCardlessPro/Resources/RedirectFlow.php
+++ /dev/null
@@ -1,181 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * A description of the item the customer is paying for. This will be shown
- * on the hosted payment pages.
- *
- * @return string
- */
- public function description()
- {
- $field = 'description';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique identifier, beginning with "RE".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Referenced objects. Key values to stdClasses returned.
- *
- * @return Wrapper\NestedObject
- */
- public function links()
- {
- $field = 'links';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * The URL of the hosted payment pages for this redirect flow. This is the
- * URL you should redirect your customer to.
- *
- * @return string
- */
- public function redirect_url()
- {
- $field = 'redirect_url';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The Direct Debit scheme of the mandate. If specified, the payment pages
- * will only allow the set-up of a mandate for the specified scheme.
- * [autogiro bacs sepa_core sepa_cor1 ]
- * @return string
- */
- public function scheme()
- {
- $field = 'scheme';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The customer's session ID must be provided when the redirect flow is set
- * up and again when it is completed. This allows integrators to ensure that
- * the user who was originally sent to the GoCardless payment pages is the
- * one who has completed them.
- *
- * @return string
- */
- public function session_token()
- {
- $field = 'session_token';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The URL to redirect to upon successful mandate setup.
- *
- * @return string
- */
- public function success_redirect_url()
- {
- $field = 'success_redirect_url';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'RedirectFlow Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Refund.php b/lib/GoCardlessPro/Resources/Refund.php
deleted file mode 100644
index 872fab0a..00000000
--- a/lib/GoCardlessPro/Resources/Refund.php
+++ /dev/null
@@ -1,146 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Fixed [timestamp](#overview-time-zones-dates), recording when this
- * resource was created.
- *
- * @return string
- */
- public function created_at()
- {
- $field = 'created_at';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
- * code. This is set to the currency of the refund's
- * [payment](#core-endpoints-payments).
- *
- * @return string
- */
- public function currency()
- {
- $field = 'currency';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique identifier, beginning with "RF".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Referenced objects. Key values to stdClasses returned.
- *
- * @return Wrapper\NestedObject
- */
- public function links()
- {
- $field = 'links';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * Key-value store of custom data. Up to 3 keys are permitted, with key names
- * up to 50 characters and values up to 200 characters.
- *
- * @return Wrapper\NestedObject
- */
- public function metadata()
- {
- $field = 'metadata';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * An optional refund reference, displayed on your customer's bank statement.
- * This can be up to 18 characters long for Bacs payments, 140 characters for
- * SEPA payments, or 25 characters for Autogiro payments.
- *
- * @return string
- */
- public function reference()
- {
- $field = 'reference';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'Refund Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Subscription.php b/lib/GoCardlessPro/Resources/Subscription.php
deleted file mode 100644
index 664ddc41..00000000
--- a/lib/GoCardlessPro/Resources/Subscription.php
+++ /dev/null
@@ -1,364 +0,0 @@
-data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * An alternative way to set `end_date`. The total number of payments that
- * should be taken by this subscription. This will set `end_date`
- * automatically.
- *
- * @return int
- */
- public function count()
- {
- $field = 'count';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Fixed [timestamp](#overview-time-zones-dates), recording when this
- * resource was created.
- *
- * @return string
- */
- public function created_at()
- {
- $field = 'created_at';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code. Currently
- * only `GBP` and `EUR` are supported.
- *
- * @return string
- */
- public function currency()
- {
- $field = 'currency';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * As per RFC 2445. The day of the month to charge customers on. `1`-`28` or
- * `-1` to indicate the last day of the month.
- *
- * @return int
- */
- public function day_of_month()
- {
- $field = 'day_of_month';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Date after which no further payments should be charged. If a payment falls
- * on this date, it **will not** be charged. If blank, the subscription will
- * continue forever. Alternatively, `count` can be set to achieve a specific
- * number of payments.
- *
- * @return string
- */
- public function end_date()
- {
- $field = 'end_date';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Unique identifier, beginning with "SB".
- *
- * @return string
- */
- public function id()
- {
- $field = 'id';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Number of `interval_units` between customer charge dates. Must result in
- * at least one charge date per year. Defaults to `1`.
- *
- * @return int
- */
- public function interval()
- {
- $field = 'interval';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The unit of time between customer charge dates. One of `weekly`, `monthly`
- * or `yearly`.
- * [weekly monthly yearly]
- * @return string
- */
- public function interval_unit()
- {
- $field = 'interval_unit';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Referenced objects. Key values to stdClasses returned.
- *
- * @return Wrapper\NestedObject
- */
- public function links()
- {
- $field = 'links';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * Key-value store of custom data. Up to 3 keys are permitted, with key names
- * up to 50 characters and values up to 200 characters.
- *
- * @return Wrapper\NestedObject
- */
- public function metadata()
- {
- $field = 'metadata';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedObject($field, $this->data->{$field});
-
- }
-
- /**
- * Name of the month on which to charge a customer. Must be lowercase.
- * [january february march april may june july august september october november december ]
- * @return string
- */
- public function month()
- {
- $field = 'month';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Optional name for the subscription. This will be set as the description on
- * each payment created. Must not exceed 255 characters.
- *
- * @return string
- */
- public function name()
- {
- $field = 'name';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * An optional payment reference. This will be set as the reference on each
- * payment created and will appear on your customer's bank statement. See the
- * documentation for the [create payment
- * endpoint](#payments-create-a-payment) for more details.
- *
- * @return string
- */
- public function payment_reference()
- {
- $field = 'payment_reference';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * The date on which the first payment should be charged. Must be within one
- * year of creation and on or after the [mandate](#core-endpoints-mandates)'s
- * `next_possible_charge_date`. When blank, this will be set as the mandate's
- * `next_possible_charge_date`.
- *
- * @return string
- */
- public function start_date()
- {
- $field = 'start_date';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * One of:
- *
- * - `active`: the subscription is currently
- * active and will continue to create payments
- * - `finished`: all
- * of the payments scheduled for creation under this subscription have been
- * created
- * - `cancelled`: the subscription has been cancelled
- * and will no longer create payments
- *
- *
- * @return string
- */
- public function status()
- {
- $field = 'status';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return $this->data->{$field};
- }
-
- /**
- * Up to 10 upcoming payments with the amount, in pence, and charge date for
- * each.
- *
- * @return Wrapper\NestedArray
- */
- public function upcoming_payments()
- {
- $field = 'upcoming_payments';
- if (!property_exists($this->data, $field)) {
- return null;
- }
- return new Wrapper\NestedArray($field, $this->data->{$field});
-
- }
-
-
- /**
- * Returns a string representation of the project.
- *
- * @return string
- */
- public function __toString()
- {
- $ret = 'Subscription Class (';
- $ret .= print_r($this->data, true);
- return $ret;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Wrapper/NestedArray.php b/lib/GoCardlessPro/Resources/Wrapper/NestedArray.php
deleted file mode 100644
index a9009a0d..00000000
--- a/lib/GoCardlessPro/Resources/Wrapper/NestedArray.php
+++ /dev/null
@@ -1,73 +0,0 @@
- $data_element) {
- if (is_array($data_element)) {
- $data[$key] = new NestedArray($name, $data_element);
- } elseif (is_object($data_element)) {
- $data[$key] = new NestedObject($name, $data_element);
- }
- }
- $this->name = $name;
- $this->data = $data;
- parent::__construct($this->data);
- }
-
- /**
- * Returns a string representation of the data contained within the getter method.
- * @return string
- */
- public function __toString()
- {
- return $this->name . ' ' . print_r($this->data, true);
- }
-
- /**
- * Get all this object's keys
- *
- * @return mixed[]
- */
- public function keys()
- {
- return get_object_vars($this->data);
- }
-
- public function raw()
- {
- $arrayOut = $this->data;
- foreach ($arrayOut as $key => $data_element) {
- if (is_object($data_element) && (($data_element instanceof NestedArray) || ($data_element instanceof NestedObject))) {
- $arrayOut[$key] = $data_element->raw();
- } else {
- $arrayOut[$key] = $data_element;
- }
- }
- return $arrayOut;
- }
-}
diff --git a/lib/GoCardlessPro/Resources/Wrapper/NestedObject.php b/lib/GoCardlessPro/Resources/Wrapper/NestedObject.php
deleted file mode 100644
index 61b2ea56..00000000
--- a/lib/GoCardlessPro/Resources/Wrapper/NestedObject.php
+++ /dev/null
@@ -1,75 +0,0 @@
-name = $name;
- $this->data = $data;
- }
-
- /**
- * If the data exists matching this method, return it's value otherwise, return false
- * If the data is a nested object, return a new NestedObject class to wrap that data predictably.
- * @return NestedObject|mixed|false
- */
- public function __call($name, $arguments)
- {
- if (count($arguments) === 0 && property_exists($this->data, $name)) {
- $value = $this->data->{$name};
- if (is_object($value)) {
- return new NestedObject($name, $value);
- } else {
- return $value;
- }
- }
- return false;
- }
-
- /**
- * Returns a string representation of the data contained within the getter method.
- * @return string
- */
- public function __toString()
- {
- return $this->name . ' ' . print_r($this->data, true);
- }
-
- /**
- * Get all this object's keys
- *
- * @return mixed[]
- */
- public function keys()
- {
- return get_object_vars($this->data);
- }
-
- public function raw()
- {
- return $this->data;
- }
-}
diff --git a/lib/GoCardlessPro/Services/BankDetailsLookupsService.php b/lib/GoCardlessPro/Services/BankDetailsLookupsService.php
deleted file mode 100644
index fe14bae5..00000000
--- a/lib/GoCardlessPro/Services/BankDetailsLookupsService.php
+++ /dev/null
@@ -1,68 +0,0 @@
-make_request('create', 'post', '/bank_details_lookups', $params, $headers);
- }
-
-
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\BankDetailsLookup';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'bank_details_lookups';
- }
-}
diff --git a/lib/GoCardlessPro/Services/Base.php b/lib/GoCardlessPro/Services/Base.php
deleted file mode 100644
index f92ce05d..00000000
--- a/lib/GoCardlessPro/Services/Base.php
+++ /dev/null
@@ -1,91 +0,0 @@
-client = $client;
- }
-
- /**
- * Function to make a http request and return the appropriate response object.
- * @param string $method The HTTP request method
- * @param string $uri The relative uri to call in the api.
- * @param array[string]string The array of uri parameters (GET/DELETE requests)
- * or json body (POST/PUT) to send.
- * @uses Base::$client to make the HTTP Request
- * @return \GoCardlessPro\Resources\Base|\GoCardlessPro\Core\ListResponse
- */
- protected function make_request($action, $method, $uri, $opts, $headers)
- {
- $req = $this->client->make_request($this->envelopeKey());
- $response = $req->run($action, $method, $uri, $opts, $headers);
- $resourceClass = $this->resourceClass();
- if (is_array($response->response())) {
- return new \GoCardlessPro\Core\ListResponse($resourceClass, $response);
- } else {
- return new $resourceClass($response->response(), $response);
- }
- }
-
- /**
- * The envelope key to unenvelope and envelope requests to the API.
- * @return string
- */
- abstract protected function envelopeKey();
-
- /**
- * The classname of the returned resource, used to resolve decoding JSON responses.
- * @return string
- */
- abstract protected function resourceClass();
-
- /**
- * Handles functions in the API that are normally PHP reserved words.
- */
- public function __call($name, $args)
- {
- $attemptName = 'do_' . $name;
- if (method_exists($this, $attemptName)) {
- return call_user_func_array(array($this, $attemptName), $args);
- }
- return false;
- }
-
- /**
- * sub_url replaces colon tokens with the array->value associations
- * in the subs array to generate urls.
- * @param string $url Url to substitute
- * @param array[string]string $subs Substitutions to make
- * @return string
- */
- public static function sub_url($url, $subs)
- {
- foreach ($subs as $sub_key => $sub_val) {
- if (!is_string($sub_val)) {
- $error_type = ' needs to be a string, not a '.gettype($sub_val).'.';
- throw new \Exception('URL value for ' . $sub_key . $error_type);
- }
- $url = str_replace(':' . $sub_key, $sub_val, $url);
- }
- return $url;
- }
-}
diff --git a/lib/GoCardlessPro/Services/CreditorBankAccountsService.php b/lib/GoCardlessPro/Services/CreditorBankAccountsService.php
deleted file mode 100644
index 78c66186..00000000
--- a/lib/GoCardlessPro/Services/CreditorBankAccountsService.php
+++ /dev/null
@@ -1,172 +0,0 @@
-make_request('create', 'post', '/creditor_bank_accounts', $params, $headers);
- }
-
- /**
- * List creditor bank accounts
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * creditor bank accounts.
- *
- * Example URL: /creditor_bank_accounts
- *
- *
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\ListResponse
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function do_list($params = array(), $headers = array())
- {
- return $this->make_request('list', 'get', '/creditor_bank_accounts', $params, $headers);
- }
-
- /**
- * Get a single creditor bank account
- *
- * Retrieves the details of an existing creditor bank account.
- *
- * Example URL: /creditor_bank_accounts/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "BA".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return CreditorBankAccount
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/creditor_bank_accounts/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
- /**
- * Disable a creditor bank account
- *
- * Immediately disables the bank account, no money can be paid out to a
- * disabled account.
- *
- * This will return a `disable_failed`
- * error if the bank account has already been disabled.
- *
- * A
- * disabled bank account can be re-enabled by creating a new bank account
- * resource with the same details.
- *
- * Example URL: /creditor_bank_accounts/:identity/actions/disable
- *
- *
- * @param string $identity Unique identifier, beginning with "BA".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return CreditorBankAccount
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function disable($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/creditor_bank_accounts/:identity/actions/disable', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('disable', 'post', $path, $params, $headers);
- }
-
-
-
- /**
- * List creditor bank accounts
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * creditor bank accounts.
- *
- * Example URL: /creditor_bank_accounts
- *
- * @param int $list_max The maximum number of records to return while paginating.
- * @param string[mixed] $params POST/URL parameters for the argument. Automatically wrapped.
- * @param string[string] $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\Paginator
- **/
- public function all($list_max, $params = array(), $headers = array())
- {
- return new \GoCardlessPro\Core\Paginator($this, $list_max, $this->do_list($params), $params, $headers);
- }
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\CreditorBankAccount';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'creditor_bank_accounts';
- }
-}
diff --git a/lib/GoCardlessPro/Services/CreditorsService.php b/lib/GoCardlessPro/Services/CreditorsService.php
deleted file mode 100644
index 5aadd34d..00000000
--- a/lib/GoCardlessPro/Services/CreditorsService.php
+++ /dev/null
@@ -1,164 +0,0 @@
-make_request('create', 'post', '/creditors', $params, $headers);
- }
-
- /**
- * List creditors
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * creditors.
- *
- * Example URL: /creditors
- *
- *
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\ListResponse
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function do_list($params = array(), $headers = array())
- {
- return $this->make_request('list', 'get', '/creditors', $params, $headers);
- }
-
- /**
- * Get a single creditor
- *
- * Retrieves the details of an existing creditor.
- *
- * Example URL: /creditors/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "CR".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Creditor
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/creditors/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
- /**
- * Update a creditor
- *
- * Updates a creditor object. Supports all of the fields supported when
- * creating a creditor.
- *
- * Example URL: /creditors/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "CR".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Creditor
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function update($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/creditors/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('update', 'put', $path, $params, $headers);
- }
-
-
-
- /**
- * List creditors
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * creditors.
- *
- * Example URL: /creditors
- *
- * @param int $list_max The maximum number of records to return while paginating.
- * @param string[mixed] $params POST/URL parameters for the argument. Automatically wrapped.
- * @param string[string] $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\Paginator
- **/
- public function all($list_max, $params = array(), $headers = array())
- {
- return new \GoCardlessPro\Core\Paginator($this, $list_max, $this->do_list($params), $params, $headers);
- }
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\Creditor';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'creditors';
- }
-}
diff --git a/lib/GoCardlessPro/Services/CustomerBankAccountsService.php b/lib/GoCardlessPro/Services/CustomerBankAccountsService.php
deleted file mode 100644
index 1c4a454d..00000000
--- a/lib/GoCardlessPro/Services/CustomerBankAccountsService.php
+++ /dev/null
@@ -1,214 +0,0 @@
-make_request('create', 'post', '/customer_bank_accounts', $params, $headers);
- }
-
- /**
- * List customer bank accounts
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * bank accounts.
- *
- * Example URL: /customer_bank_accounts
- *
- *
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\ListResponse
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function do_list($params = array(), $headers = array())
- {
- return $this->make_request('list', 'get', '/customer_bank_accounts', $params, $headers);
- }
-
- /**
- * Get a single customer bank account
- *
- * Retrieves the details of an existing bank account.
- *
- * Example URL: /customer_bank_accounts/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "BA".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return CustomerBankAccount
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/customer_bank_accounts/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
- /**
- * Update a customer bank account
- *
- * Updates a customer bank account object. Only the metadata parameter is
- * allowed.
- *
- * Example URL: /customer_bank_accounts/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "BA".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return CustomerBankAccount
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function update($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/customer_bank_accounts/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('update', 'put', $path, $params, $headers);
- }
-
- /**
- * Disable a customer bank account
- *
- * Immediately cancels all associated mandates and cancellable payments.
-
- * *
- * This will return a `disable_failed` error if the bank account
- * has already been disabled.
- *
- * A disabled bank account can be
- * re-enabled by creating a new bank account resource with the same details.
- *
- * Example URL: /customer_bank_accounts/:identity/actions/disable
- *
- *
- * @param string $identity Unique identifier, beginning with "BA".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return CustomerBankAccount
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function disable($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/customer_bank_accounts/:identity/actions/disable', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('disable', 'post', $path, $params, $headers);
- }
-
-
-
- /**
- * List customer bank accounts
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * bank accounts.
- *
- * Example URL: /customer_bank_accounts
- *
- * @param int $list_max The maximum number of records to return while paginating.
- * @param string[mixed] $params POST/URL parameters for the argument. Automatically wrapped.
- * @param string[string] $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\Paginator
- **/
- public function all($list_max, $params = array(), $headers = array())
- {
- return new \GoCardlessPro\Core\Paginator($this, $list_max, $this->do_list($params), $params, $headers);
- }
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\CustomerBankAccount';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'customer_bank_accounts';
- }
-}
diff --git a/lib/GoCardlessPro/Services/CustomersService.php b/lib/GoCardlessPro/Services/CustomersService.php
deleted file mode 100644
index ce3dee30..00000000
--- a/lib/GoCardlessPro/Services/CustomersService.php
+++ /dev/null
@@ -1,164 +0,0 @@
-make_request('create', 'post', '/customers', $params, $headers);
- }
-
- /**
- * List customers
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * customers.
- *
- * Example URL: /customers
- *
- *
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\ListResponse
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function do_list($params = array(), $headers = array())
- {
- return $this->make_request('list', 'get', '/customers', $params, $headers);
- }
-
- /**
- * Get a single customer
- *
- * Retrieves the details of an existing customer.
- *
- * Example URL: /customers/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "CU".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Customer
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/customers/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
- /**
- * Update a customer
- *
- * Updates a customer object. Supports all of the fields supported when
- * creating a customer.
- *
- * Example URL: /customers/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "CU".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Customer
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function update($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/customers/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('update', 'put', $path, $params, $headers);
- }
-
-
-
- /**
- * List customers
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * customers.
- *
- * Example URL: /customers
- *
- * @param int $list_max The maximum number of records to return while paginating.
- * @param string[mixed] $params POST/URL parameters for the argument. Automatically wrapped.
- * @param string[string] $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\Paginator
- **/
- public function all($list_max, $params = array(), $headers = array())
- {
- return new \GoCardlessPro\Core\Paginator($this, $list_max, $this->do_list($params), $params, $headers);
- }
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\Customer';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'customers';
- }
-}
diff --git a/lib/GoCardlessPro/Services/EventsService.php b/lib/GoCardlessPro/Services/EventsService.php
deleted file mode 100644
index 3ed1d9cd..00000000
--- a/lib/GoCardlessPro/Services/EventsService.php
+++ /dev/null
@@ -1,112 +0,0 @@
-make_request('list', 'get', '/events', $params, $headers);
- }
-
- /**
- * Get a single event
- *
- * Retrieves the details of a single event.
- *
- * Example URL: /events/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "EV".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Event
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/events/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
-
-
- /**
- * List events
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * events.
- *
- * Example URL: /events
- *
- * @param int $list_max The maximum number of records to return while paginating.
- * @param string[mixed] $params POST/URL parameters for the argument. Automatically wrapped.
- * @param string[string] $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\Paginator
- **/
- public function all($list_max, $params = array(), $headers = array())
- {
- return new \GoCardlessPro\Core\Paginator($this, $list_max, $this->do_list($params), $params, $headers);
- }
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\Event';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'events';
- }
-}
diff --git a/lib/GoCardlessPro/Services/MandatePdfsService.php b/lib/GoCardlessPro/Services/MandatePdfsService.php
deleted file mode 100644
index ac48eb58..00000000
--- a/lib/GoCardlessPro/Services/MandatePdfsService.php
+++ /dev/null
@@ -1,78 +0,0 @@
-make_request('create', 'post', '/mandate_pdfs', $params, $headers);
- }
-
-
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\MandatePdf';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'mandate_pdfs';
- }
-}
diff --git a/lib/GoCardlessPro/Services/MandatesService.php b/lib/GoCardlessPro/Services/MandatesService.php
deleted file mode 100644
index a478a062..00000000
--- a/lib/GoCardlessPro/Services/MandatesService.php
+++ /dev/null
@@ -1,229 +0,0 @@
-make_request('create', 'post', '/mandates', $params, $headers);
- }
-
- /**
- * List mandates
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * mandates. Except where stated, these filters can only be used one at a
- * time.
- *
- * Example URL: /mandates
- *
- *
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\ListResponse
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function do_list($params = array(), $headers = array())
- {
- return $this->make_request('list', 'get', '/mandates', $params, $headers);
- }
-
- /**
- * Get a single mandate
- *
- * Retrieves the details of an existing mandate.
- *
- * Example URL: /mandates/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "MD".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Mandate
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/mandates/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
- /**
- * Update a mandate
- *
- * Updates a mandate object. This accepts only the metadata parameter.
- *
- * Example URL: /mandates/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "MD".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Mandate
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function update($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/mandates/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('update', 'put', $path, $params, $headers);
- }
-
- /**
- * Cancel a mandate
- *
- * Immediately cancels a mandate and all associated cancellable payments.
- * Any metadata supplied to this endpoint will be stored on the mandate
- * cancellation event it causes.
- *
- * This will fail with a
- * `cancellation_failed` error if the mandate is already cancelled.
- *
- * Example URL: /mandates/:identity/actions/cancel
- *
- *
- * @param string $identity Unique identifier, beginning with "MD".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Mandate
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function cancel($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/mandates/:identity/actions/cancel', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('cancel', 'post', $path, $params, $headers);
- }
-
- /**
- * Reinstate a mandate
- *
- * Reinstates a cancelled or expired
- * mandate to the banks. You will receive a `resubmission_requested`
- * webhook, but after that reinstating the mandate follows the same process
- * as its initial creation, so you will receive a `submitted` webhook,
- * followed by a `reinstated` or `failed` webhook up to two working days
- * later. Any metadata supplied to this endpoint will be stored on the
- * `resubmission_requested` event it causes.
- *
- * This will fail
- * with a `mandate_not_inactive` error if the mandate is already being
- * submitted, or is active.
- *
- * Mandates can be resubmitted up to
- * 3 times.
- *
- * Example URL: /mandates/:identity/actions/reinstate
- *
- *
- * @param string $identity Unique identifier, beginning with "MD".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Mandate
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function reinstate($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/mandates/:identity/actions/reinstate', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('reinstate', 'post', $path, $params, $headers);
- }
-
-
-
- /**
- * List mandates
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * mandates. Except where stated, these filters can only be used one at a
- * time.
- *
- * Example URL: /mandates
- *
- * @param int $list_max The maximum number of records to return while paginating.
- * @param string[mixed] $params POST/URL parameters for the argument. Automatically wrapped.
- * @param string[string] $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\Paginator
- **/
- public function all($list_max, $params = array(), $headers = array())
- {
- return new \GoCardlessPro\Core\Paginator($this, $list_max, $this->do_list($params), $params, $headers);
- }
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\Mandate';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'mandates';
- }
-}
diff --git a/lib/GoCardlessPro/Services/PaymentsService.php b/lib/GoCardlessPro/Services/PaymentsService.php
deleted file mode 100644
index 3d337630..00000000
--- a/lib/GoCardlessPro/Services/PaymentsService.php
+++ /dev/null
@@ -1,235 +0,0 @@
-Creates a new payment object.
- *
-
- * * This fails with a `mandate_is_inactive` error if the linked
- * [mandate](#core-endpoints-mandates) is cancelled or has failed. Payments
- * can be created against `pending_submission` and `submitted` as well as
- * `active` mandates.
- *
- * Example URL: /payments
- *
- *
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Payment
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function create($params = array(), $headers = array())
- {
- return $this->make_request('create', 'post', '/payments', $params, $headers);
- }
-
- /**
- * List payments
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * payments.
- *
- * Example URL: /payments
- *
- *
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\ListResponse
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function do_list($params = array(), $headers = array())
- {
- return $this->make_request('list', 'get', '/payments', $params, $headers);
- }
-
- /**
- * Get a single payment
- *
- * Retrieves the details of a single existing payment.
- *
- * Example URL: /payments/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "PM".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Payment
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/payments/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
- /**
- * Update a payment
- *
- * Updates a payment object. This accepts only the metadata parameter.
- *
- * Example URL: /payments/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "PM".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Payment
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function update($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/payments/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('update', 'put', $path, $params, $headers);
- }
-
- /**
- * Cancel a payment
- *
- * Cancels the payment if it has not already been submitted to the banks.
- * Any metadata supplied to this endpoint will be stored on the payment
- * cancellation event it causes.
- *
- * This will fail with a
- * `cancellation_failed` error unless the payment's status is
- * `pending_submission`.
- *
- * Example URL: /payments/:identity/actions/cancel
- *
- *
- * @param string $identity Unique identifier, beginning with "PM".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Payment
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function cancel($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/payments/:identity/actions/cancel', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('cancel', 'post', $path, $params, $headers);
- }
-
- /**
- * Retry a payment
- *
- * Retries a failed payment if the underlying
- * mandate is active. You will receive a `resubmission_requested` webhook,
- * but after that retrying the payment follows the same process as its
- * initial creation, so you will receive a `submitted` webhook, followed by
- * a `confirmed` or `failed` event. Any metadata supplied to this endpoint
- * will be stored against the payment submission event it causes.
- *
-
- * * This will return a `retry_failed` error if the payment has not
- * failed.
- *
- * Payments can be retried up to 3 times.
- *
- * Example URL: /payments/:identity/actions/retry
- *
- *
- * @param string $identity Unique identifier, beginning with "PM".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Payment
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function retry($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/payments/:identity/actions/retry', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('retry', 'post', $path, $params, $headers);
- }
-
-
-
- /**
- * List payments
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * payments.
- *
- * Example URL: /payments
- *
- * @param int $list_max The maximum number of records to return while paginating.
- * @param string[mixed] $params POST/URL parameters for the argument. Automatically wrapped.
- * @param string[string] $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\Paginator
- **/
- public function all($list_max, $params = array(), $headers = array())
- {
- return new \GoCardlessPro\Core\Paginator($this, $list_max, $this->do_list($params), $params, $headers);
- }
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\Payment';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'payments';
- }
-}
diff --git a/lib/GoCardlessPro/Services/PayoutsService.php b/lib/GoCardlessPro/Services/PayoutsService.php
deleted file mode 100644
index 6ddda438..00000000
--- a/lib/GoCardlessPro/Services/PayoutsService.php
+++ /dev/null
@@ -1,116 +0,0 @@
-make_request('list', 'get', '/payouts', $params, $headers);
- }
-
- /**
- * Get a single payout
- *
- * Retrieves the details of a single payout. For an example of how to
- * reconcile the transactions in a payout, see [this
- * guide](#events-reconciling-payouts-with-events).
- *
- * Example URL: /payouts/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "PO".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Payout
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/payouts/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
-
-
- /**
- * List payouts
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * payouts.
- *
- * Example URL: /payouts
- *
- * @param int $list_max The maximum number of records to return while paginating.
- * @param string[mixed] $params POST/URL parameters for the argument. Automatically wrapped.
- * @param string[string] $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\Paginator
- **/
- public function all($list_max, $params = array(), $headers = array())
- {
- return new \GoCardlessPro\Core\Paginator($this, $list_max, $this->do_list($params), $params, $headers);
- }
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\Payout';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'payouts';
- }
-}
diff --git a/lib/GoCardlessPro/Services/RedirectFlowsService.php b/lib/GoCardlessPro/Services/RedirectFlowsService.php
deleted file mode 100644
index 9d54fc95..00000000
--- a/lib/GoCardlessPro/Services/RedirectFlowsService.php
+++ /dev/null
@@ -1,158 +0,0 @@
-make_request('create', 'post', '/redirect_flows', $params, $headers);
- }
-
- /**
- * Get a single redirect flow
- *
- * Returns all details about a single redirect flow
- *
- * Example URL: /redirect_flows/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "RE".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return RedirectFlow
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/redirect_flows/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
- /**
- * Complete a redirect flow
- *
- * This creates a [customer](#core-endpoints-customers), [customer bank
- * account](#core-endpoints-customer-bank-accounts), and
- * [mandate](#core-endpoints-mandates) using the details supplied by your
- * customer and returns the ID of the created mandate.
- *
- * This
- * will return a `redirect_flow_incomplete` error if your customer has not
- * yet been redirected back to your site, and a
- * `redirect_flow_already_completed` error if your integration has already
- * completed this flow. It will return a `bad_request` error if the
- * `session_token` differs to the one supplied when the redirect flow was
- * created.
- *
- * Example URL: /redirect_flows/:identity/actions/complete
- *
- *
- * @param string $identity Unique identifier, beginning with "RE".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return RedirectFlow
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function complete($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/redirect_flows/:identity/actions/complete', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('complete', 'post', $path, $params, $headers);
- }
-
-
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\RedirectFlow';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'redirect_flows';
- }
-}
diff --git a/lib/GoCardlessPro/Services/RefundsService.php b/lib/GoCardlessPro/Services/RefundsService.php
deleted file mode 100644
index 3be50799..00000000
--- a/lib/GoCardlessPro/Services/RefundsService.php
+++ /dev/null
@@ -1,185 +0,0 @@
-
- *
- * -
- * `refund_payment_invalid_state` error if the linked
- * [payment](#core-endpoints-payments) isn't either `confirmed` or
- * `paid_out`.
- *
- * - `total_amount_confirmation_invalid` if the
- * confirmation amount doesn't match the total amount refunded for the
- * payment. This safeguard is there to prevent two processes from creating
- * refunds without awareness of each other.
- *
- * -
- * `number_of_refunds_exceeded` if five or more refunds have already been
- * created against the payment.
- *
- *
- * Example URL: /refunds
- *
- *
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Refund
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function create($params = array(), $headers = array())
- {
- return $this->make_request('create', 'post', '/refunds', $params, $headers);
- }
-
- /**
- * List refunds
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * refunds.
- *
- * Example URL: /refunds
- *
- *
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\ListResponse
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function do_list($params = array(), $headers = array())
- {
- return $this->make_request('list', 'get', '/refunds', $params, $headers);
- }
-
- /**
- * Get a single refund
- *
- * Retrieves all details for a single refund
- *
- * Example URL: /refunds/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "RF".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Refund
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/refunds/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
- /**
- * Update a refund
- *
- * Updates a refund object.
- *
- * Example URL: /refunds/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "RF".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Refund
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function update($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/refunds/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('update', 'put', $path, $params, $headers);
- }
-
-
-
- /**
- * List refunds
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * refunds.
- *
- * Example URL: /refunds
- *
- * @param int $list_max The maximum number of records to return while paginating.
- * @param string[mixed] $params POST/URL parameters for the argument. Automatically wrapped.
- * @param string[string] $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\Paginator
- **/
- public function all($list_max, $params = array(), $headers = array())
- {
- return new \GoCardlessPro\Core\Paginator($this, $list_max, $this->do_list($params), $params, $headers);
- }
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\Refund';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'refunds';
- }
-}
diff --git a/lib/GoCardlessPro/Services/SubscriptionsService.php b/lib/GoCardlessPro/Services/SubscriptionsService.php
deleted file mode 100644
index 8f735945..00000000
--- a/lib/GoCardlessPro/Services/SubscriptionsService.php
+++ /dev/null
@@ -1,252 +0,0 @@
-make_request('create', 'post', '/subscriptions', $params, $headers);
- }
-
- /**
- * List subscriptions
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * subscriptions.
- *
- * Example URL: /subscriptions
- *
- *
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\ListResponse
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function do_list($params = array(), $headers = array())
- {
- return $this->make_request('list', 'get', '/subscriptions', $params, $headers);
- }
-
- /**
- * Get a single subscription
- *
- * Retrieves the details of a single subscription.
- *
- * Example URL: /subscriptions/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "SB".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Subscription
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function get($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/subscriptions/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('get', 'get', $path, $params, $headers);
- }
-
- /**
- * Update a subscription
- *
- * Updates a subscription object.
- *
- * Example URL: /subscriptions/:identity
- *
- *
- * @param string $identity Unique identifier, beginning with "SB".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Subscription
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function update($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/subscriptions/:identity', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('update', 'put', $path, $params, $headers);
- }
-
- /**
- * Cancel a subscription
- *
- * Immediately cancels a subscription; no more payments will be created
- * under it. Any metadata supplied to this endpoint will be stored on the
- * payment cancellation event it causes.
- *
- * This will fail with
- * a cancellation_failed error if the subscription is already cancelled or
- * finished.
- *
- * Example URL: /subscriptions/:identity/actions/cancel
- *
- *
- * @param string $identity Unique identifier, beginning with "SB".
- * @param array $params POST/URL parameters for the argument. Automatically wrapped.
- * @param array $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return Subscription
- * @throws \GoCardlessPro\Core\Error\GoCardlessError GoCardless API or server error, subclasses thereof.
- * @throws \GoCardlessPro\Core\Error\HttpError PHP Curl transport layer-level errors.
- **/
- public function cancel($identity, $params = array(), $headers = array())
- {
- $path = self::sub_url('/subscriptions/:identity/actions/cancel', array(
- 'identity' => $identity
- ));
-
- return $this->make_request('cancel', 'post', $path, $params, $headers);
- }
-
-
-
- /**
- * List subscriptions
- *
- * Returns a [cursor-paginated](#overview-cursor-pagination) list of your
- * subscriptions.
- *
- * Example URL: /subscriptions
- *
- * @param int $list_max The maximum number of records to return while paginating.
- * @param string[mixed] $params POST/URL parameters for the argument. Automatically wrapped.
- * @param string[string] $headers String to string associative array of custom headers to add to the requestion.
- *
- * @return \GoCardlessPro\Core\Paginator
- **/
- public function all($list_max, $params = array(), $headers = array())
- {
- return new \GoCardlessPro\Core\Paginator($this, $list_max, $this->do_list($params), $params, $headers);
- }
-
-
- /**
- * Get the resource loading class.
- * Used internally to send http requests.
- *
- * @return string
- */
- protected function resourceClass()
- {
- return '\GoCardlessPro\Resources\Subscription';
- }
-
- /**
- * Get the key the response object is enclosed in in JSON.
- * Used internally to wrap and unwrap http requests.
- *
- * @return string
- */
- protected function envelopeKey()
- {
- return 'subscriptions';
- }
-}
diff --git a/lib/Resources/BankDetailsLookup.php b/lib/Resources/BankDetailsLookup.php
new file mode 100644
index 00000000..2d5ce288
--- /dev/null
+++ b/lib/Resources/BankDetailsLookup.php
@@ -0,0 +1,39 @@
+data = $data;
+
+ foreach($data as $key => $value) {
+ if (property_exists(get_class($this), $key)) {
+ $this->{$key} = $value;
+ }
+ }
+ $this->api_response = $api_response;
+ }
+
+ /**
+ * Magic getter. If you try and access an unkn own property, we
+ * throw an exception. The default in PHP would be to return null, but
+ * explicitly knowing when this is happening is more useful.
+ *
+ * @param string $field the name of the field we're accessing
+ * @throws Exception Throws an exception if the field is invalid.
+ * @return mixed
+ */
+ public function __get( $field )
+ {
+ if (!property_exists(get_class($this), $field)) {
+ throw new GoCardlessProException($field . ' is not a valid ' . $this->model_name . ' property');
+ }
+ return $this->{$field};
+ }
+
+ /**
+ * Returns a string representation of the model
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ $ret = $this->model_name . " Class\n";
+ $ret .= print_r($this->data, true);
+ return $ret;
+ }
+}
diff --git a/lib/Resources/Creditor.php b/lib/Resources/Creditor.php
new file mode 100644
index 00000000..65852863
--- /dev/null
+++ b/lib/Resources/Creditor.php
@@ -0,0 +1,88 @@
+Beta: this field is only used for
+ * Autogiro, which is currently in beta.
+ */
+ protected $swedish_identity_number;
+
+}
diff --git a/lib/Resources/CustomerBankAccount.php b/lib/Resources/CustomerBankAccount.php
new file mode 100644
index 00000000..a03a729b
--- /dev/null
+++ b/lib/Resources/CustomerBankAccount.php
@@ -0,0 +1,87 @@
+
+ *
+ * `payments`
+ * `mandates`
+ * `payouts`
+
+ * * `refunds`
+ * `subscriptions`
+ *
+ */
+ protected $resource_type;
+
+}
diff --git a/lib/Resources/Mandate.php b/lib/Resources/Mandate.php
new file mode 100644
index 00000000..e5b5d7f0
--- /dev/null
+++ b/lib/Resources/Mandate.php
@@ -0,0 +1,91 @@
+Direct Debit scheme to which this mandate
+ * and associated payments are submitted. Can be supplied or automatically
+ * detected from the customer's bank account. Currently only "autogiro",
+ * "bacs", "sepa_core", and "sepa_cor1" are supported.
+ */
+ protected $scheme;
+
+ /**
+ * One of:
+ *
+ * - `pending_submission`: the mandate has not
+ * yet been submitted to the customer's bank
+ * - `submitted`:
+ * the mandate has been submitted to the customer's bank but has not been
+ * processed yet
+ * - `active`: the mandate has been successfully
+ * set up by the customer's bank
+ * - `failed`: the mandate could
+ * not be created
+ * - `cancelled`: the mandate has been
+ * cancelled
+ * - `expired`: the mandate has expired due to
+ * dormancy
+ *
+ */
+ protected $status;
+
+}
diff --git a/lib/Resources/MandatePdf.php b/lib/Resources/MandatePdf.php
new file mode 100644
index 00000000..a2c4c14c
--- /dev/null
+++ b/lib/Resources/MandatePdf.php
@@ -0,0 +1,34 @@
+
+ * `pending_submission`: the payment has been
+ * created, but not yet submitted to the banks
+ * `submitted`:
+ * the payment has been submitted to the banks
+ * `confirmed`:
+ * the payment has been confirmed as collected
+ * `failed`: the
+ * payment failed to be processed. Note that payments can fail after being
+ * confirmed, if the failure message is sent late by the banks.
+ *
+ * `charged_back`: the payment has been charged back
+ *
+ * `paid_out`: the payment has been included in a
+ * [payout](#core-endpoints-payouts)
+ * `cancelled`: the
+ * payment has been cancelled
+ *
+ */
+ protected $status;
+
+}
diff --git a/lib/Resources/Payout.php b/lib/Resources/Payout.php
new file mode 100644
index 00000000..6ed27383
--- /dev/null
+++ b/lib/Resources/Payout.php
@@ -0,0 +1,69 @@
+
+ * `pending`: the payout has been created,
+ * but not yet sent to the banks
+ * `paid`: the payout has been
+ * sent to the banks
+ *
+ */
+ protected $status;
+
+}
diff --git a/lib/Resources/RedirectFlow.php b/lib/Resources/RedirectFlow.php
new file mode 100644
index 00000000..d26d451e
--- /dev/null
+++ b/lib/Resources/RedirectFlow.php
@@ -0,0 +1,74 @@
+
+ * `active`: the subscription is currently
+ * active and will continue to create payments
+ * `finished`:
+ * all of the payments scheduled for creation under this subscription have
+ * been created
+ * `cancelled`: the subscription has been
+ * cancelled and will no longer create payments
+ *
+ */
+ protected $status;
+
+ /**
+ * Up to 10 upcoming payments with the amount, in pence, and charge date for
+ * each.
+ */
+ protected $upcoming_payments;
+
+}
diff --git a/lib/Services/BankDetailsLookupsService.php b/lib/Services/BankDetailsLookupsService.php
new file mode 100644
index 00000000..813c7452
--- /dev/null
+++ b/lib/Services/BankDetailsLookupsService.php
@@ -0,0 +1,47 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+}
diff --git a/lib/Services/BaseService.php b/lib/Services/BaseService.php
new file mode 100644
index 00000000..32b5d0c2
--- /dev/null
+++ b/lib/Services/BaseService.php
@@ -0,0 +1,89 @@
+api_client = $api_client;
+ }
+
+ /**
+ * Handles functions in the API that are normally PHP reserved words. For
+ * example `list`.
+ *
+ * @param string $name The name of the function
+ * @param string[] $args any arguments to the intended function
+ */
+ public function __call($name, $args)
+ {
+ $attemptName = '_do' . ucfirst($name);
+ if (method_exists($this, $attemptName)) {
+ return call_user_func_array(array($this, $attemptName), $args);
+ }
+ trigger_error('Call to undefined method '.__CLASS__.'::'.$name.'()', E_USER_ERROR);
+ }
+
+ /**
+ * Takes a raw response and returns either an instantiated resource or a
+ * ListResponse
+ *
+ * @param array $response The raw API response
+ *
+ * @return ListResponse|\GoCardlessPro\Resources\BaseResource
+ */
+ protected function getResourceForResponse($response)
+ {
+ $api_response = new \GoCardlessPro\Core\ApiResponse($response);
+ $unenveloped_body = $this->getUnenvelopedBody($api_response->body);
+
+ if(is_array($unenveloped_body)) {
+ return new ListResponse($unenveloped_body, $this->resource_class, $api_response);
+ } else {
+ $rclass = $this->resource_class;
+ return new $rclass($unenveloped_body, $api_response);
+ }
+ }
+
+ /**
+ * @param object $body The decoded JSON body of the response
+ *
+ * @return object The body, unenveloped
+ */
+ protected function getUnenvelopedBody($body)
+ {
+ if(isset($body->{$this->envelope_key})) {
+ return $body->{$this->envelope_key};
+ }
+
+ return $body->data;
+ }
+
+}
diff --git a/lib/Services/CreditorBankAccountsService.php b/lib/Services/CreditorBankAccountsService.php
new file mode 100644
index 00000000..0e0c352c
--- /dev/null
+++ b/lib/Services/CreditorBankAccountsService.php
@@ -0,0 +1,137 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List creditor bank accounts
+ *
+ * Example URL: /creditor_bank_accounts
+ *
+ * @param string[mixed] $params An associative array for any params
+ * @return ListResponse
+ **/
+ protected function _doList($params = array())
+ {
+ $path = "/creditor_bank_accounts";
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single creditor bank account
+ *
+ * Example URL: /creditor_bank_accounts/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "BA".
+ * @param string[mixed] $params An associative array for any params
+ * @return CreditorBankAccount
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/creditor_bank_accounts/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Disable a creditor bank account
+ *
+ * Example URL: /creditor_bank_accounts/:identity/actions/disable
+ *
+ * @param string $identity Unique identifier, beginning with "BA".
+ * @param string[mixed] $params An associative array for any params
+ * @return CreditorBankAccount
+ **/
+ public function disable($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/creditor_bank_accounts/:identity/actions/disable',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array("data" => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List creditor bank accounts
+ *
+ * Example URL: /creditor_bank_accounts
+ *
+ * @param string[mixed] $params
+ *
+ * @return \GoCardlessPro\Core\Paginator
+ **/
+ public function all($params = array())
+ {
+ return new Paginator($this, $params);
+ }
+
+}
diff --git a/lib/Services/CreditorsService.php b/lib/Services/CreditorsService.php
new file mode 100644
index 00000000..6770bacd
--- /dev/null
+++ b/lib/Services/CreditorsService.php
@@ -0,0 +1,137 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List creditors
+ *
+ * Example URL: /creditors
+ *
+ * @param string[mixed] $params An associative array for any params
+ * @return ListResponse
+ **/
+ protected function _doList($params = array())
+ {
+ $path = "/creditors";
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single creditor
+ *
+ * Example URL: /creditors/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "CR".
+ * @param string[mixed] $params An associative array for any params
+ * @return Creditor
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/creditors/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Update a creditor
+ *
+ * Example URL: /creditors/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "CR".
+ * @param string[mixed] $params An associative array for any params
+ * @return Creditor
+ **/
+ public function update($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/creditors/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array($this->envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->put($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List creditors
+ *
+ * Example URL: /creditors
+ *
+ * @param string[mixed] $params
+ *
+ * @return \GoCardlessPro\Core\Paginator
+ **/
+ public function all($params = array())
+ {
+ return new Paginator($this, $params);
+ }
+
+}
diff --git a/lib/Services/CustomerBankAccountsService.php b/lib/Services/CustomerBankAccountsService.php
new file mode 100644
index 00000000..4219b0e8
--- /dev/null
+++ b/lib/Services/CustomerBankAccountsService.php
@@ -0,0 +1,166 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List customer bank accounts
+ *
+ * Example URL: /customer_bank_accounts
+ *
+ * @param string[mixed] $params An associative array for any params
+ * @return ListResponse
+ **/
+ protected function _doList($params = array())
+ {
+ $path = "/customer_bank_accounts";
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single customer bank account
+ *
+ * Example URL: /customer_bank_accounts/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "BA".
+ * @param string[mixed] $params An associative array for any params
+ * @return CustomerBankAccount
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/customer_bank_accounts/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Update a customer bank account
+ *
+ * Example URL: /customer_bank_accounts/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "BA".
+ * @param string[mixed] $params An associative array for any params
+ * @return CustomerBankAccount
+ **/
+ public function update($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/customer_bank_accounts/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array($this->envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->put($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Disable a customer bank account
+ *
+ * Example URL: /customer_bank_accounts/:identity/actions/disable
+ *
+ * @param string $identity Unique identifier, beginning with "BA".
+ * @param string[mixed] $params An associative array for any params
+ * @return CustomerBankAccount
+ **/
+ public function disable($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/customer_bank_accounts/:identity/actions/disable',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array("data" => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List customer bank accounts
+ *
+ * Example URL: /customer_bank_accounts
+ *
+ * @param string[mixed] $params
+ *
+ * @return \GoCardlessPro\Core\Paginator
+ **/
+ public function all($params = array())
+ {
+ return new Paginator($this, $params);
+ }
+
+}
diff --git a/lib/Services/CustomersService.php b/lib/Services/CustomersService.php
new file mode 100644
index 00000000..883a3445
--- /dev/null
+++ b/lib/Services/CustomersService.php
@@ -0,0 +1,137 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List customers
+ *
+ * Example URL: /customers
+ *
+ * @param string[mixed] $params An associative array for any params
+ * @return ListResponse
+ **/
+ protected function _doList($params = array())
+ {
+ $path = "/customers";
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single customer
+ *
+ * Example URL: /customers/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "CU".
+ * @param string[mixed] $params An associative array for any params
+ * @return Customer
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/customers/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Update a customer
+ *
+ * Example URL: /customers/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "CU".
+ * @param string[mixed] $params An associative array for any params
+ * @return Customer
+ **/
+ public function update($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/customers/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array($this->envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->put($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List customers
+ *
+ * Example URL: /customers
+ *
+ * @param string[mixed] $params
+ *
+ * @return \GoCardlessPro\Core\Paginator
+ **/
+ public function all($params = array())
+ {
+ return new Paginator($this, $params);
+ }
+
+}
diff --git a/lib/Services/EventsService.php b/lib/Services/EventsService.php
new file mode 100644
index 00000000..25fd14af
--- /dev/null
+++ b/lib/Services/EventsService.php
@@ -0,0 +1,86 @@
+api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single event
+ *
+ * Example URL: /events/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "EV".
+ * @param string[mixed] $params An associative array for any params
+ * @return Event
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/events/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List events
+ *
+ * Example URL: /events
+ *
+ * @param string[mixed] $params
+ *
+ * @return \GoCardlessPro\Core\Paginator
+ **/
+ public function all($params = array())
+ {
+ return new Paginator($this, $params);
+ }
+
+}
diff --git a/lib/Services/MandatePdfsService.php b/lib/Services/MandatePdfsService.php
new file mode 100644
index 00000000..845d625b
--- /dev/null
+++ b/lib/Services/MandatePdfsService.php
@@ -0,0 +1,47 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+}
diff --git a/lib/Services/MandatesService.php b/lib/Services/MandatesService.php
new file mode 100644
index 00000000..95e4a28b
--- /dev/null
+++ b/lib/Services/MandatesService.php
@@ -0,0 +1,195 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List mandates
+ *
+ * Example URL: /mandates
+ *
+ * @param string[mixed] $params An associative array for any params
+ * @return ListResponse
+ **/
+ protected function _doList($params = array())
+ {
+ $path = "/mandates";
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single mandate
+ *
+ * Example URL: /mandates/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "MD".
+ * @param string[mixed] $params An associative array for any params
+ * @return Mandate
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/mandates/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Update a mandate
+ *
+ * Example URL: /mandates/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "MD".
+ * @param string[mixed] $params An associative array for any params
+ * @return Mandate
+ **/
+ public function update($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/mandates/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array($this->envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->put($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Cancel a mandate
+ *
+ * Example URL: /mandates/:identity/actions/cancel
+ *
+ * @param string $identity Unique identifier, beginning with "MD".
+ * @param string[mixed] $params An associative array for any params
+ * @return Mandate
+ **/
+ public function cancel($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/mandates/:identity/actions/cancel',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array("data" => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Reinstate a mandate
+ *
+ * Example URL: /mandates/:identity/actions/reinstate
+ *
+ * @param string $identity Unique identifier, beginning with "MD".
+ * @param string[mixed] $params An associative array for any params
+ * @return Mandate
+ **/
+ public function reinstate($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/mandates/:identity/actions/reinstate',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array("data" => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List mandates
+ *
+ * Example URL: /mandates
+ *
+ * @param string[mixed] $params
+ *
+ * @return \GoCardlessPro\Core\Paginator
+ **/
+ public function all($params = array())
+ {
+ return new Paginator($this, $params);
+ }
+
+}
diff --git a/lib/Services/PaymentsService.php b/lib/Services/PaymentsService.php
new file mode 100644
index 00000000..93c4bcad
--- /dev/null
+++ b/lib/Services/PaymentsService.php
@@ -0,0 +1,195 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List payments
+ *
+ * Example URL: /payments
+ *
+ * @param string[mixed] $params An associative array for any params
+ * @return ListResponse
+ **/
+ protected function _doList($params = array())
+ {
+ $path = "/payments";
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single payment
+ *
+ * Example URL: /payments/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "PM".
+ * @param string[mixed] $params An associative array for any params
+ * @return Payment
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/payments/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Update a payment
+ *
+ * Example URL: /payments/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "PM".
+ * @param string[mixed] $params An associative array for any params
+ * @return Payment
+ **/
+ public function update($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/payments/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array($this->envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->put($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Cancel a payment
+ *
+ * Example URL: /payments/:identity/actions/cancel
+ *
+ * @param string $identity Unique identifier, beginning with "PM".
+ * @param string[mixed] $params An associative array for any params
+ * @return Payment
+ **/
+ public function cancel($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/payments/:identity/actions/cancel',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array("data" => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Retry a payment
+ *
+ * Example URL: /payments/:identity/actions/retry
+ *
+ * @param string $identity Unique identifier, beginning with "PM".
+ * @param string[mixed] $params An associative array for any params
+ * @return Payment
+ **/
+ public function retry($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/payments/:identity/actions/retry',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array("data" => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List payments
+ *
+ * Example URL: /payments
+ *
+ * @param string[mixed] $params
+ *
+ * @return \GoCardlessPro\Core\Paginator
+ **/
+ public function all($params = array())
+ {
+ return new Paginator($this, $params);
+ }
+
+}
diff --git a/lib/Services/PayoutsService.php b/lib/Services/PayoutsService.php
new file mode 100644
index 00000000..4eeb23c3
--- /dev/null
+++ b/lib/Services/PayoutsService.php
@@ -0,0 +1,86 @@
+api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single payout
+ *
+ * Example URL: /payouts/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "PO".
+ * @param string[mixed] $params An associative array for any params
+ * @return Payout
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/payouts/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List payouts
+ *
+ * Example URL: /payouts
+ *
+ * @param string[mixed] $params
+ *
+ * @return \GoCardlessPro\Core\Paginator
+ **/
+ public function all($params = array())
+ {
+ return new Paginator($this, $params);
+ }
+
+}
diff --git a/lib/Services/RedirectFlowsService.php b/lib/Services/RedirectFlowsService.php
new file mode 100644
index 00000000..00337a04
--- /dev/null
+++ b/lib/Services/RedirectFlowsService.php
@@ -0,0 +1,103 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single redirect flow
+ *
+ * Example URL: /redirect_flows/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "RE".
+ * @param string[mixed] $params An associative array for any params
+ * @return RedirectFlow
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/redirect_flows/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Complete a redirect flow
+ *
+ * Example URL: /redirect_flows/:identity/actions/complete
+ *
+ * @param string $identity Unique identifier, beginning with "RE".
+ * @param string[mixed] $params An associative array for any params
+ * @return RedirectFlow
+ **/
+ public function complete($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/redirect_flows/:identity/actions/complete',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array("data" => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+}
diff --git a/lib/Services/RefundsService.php b/lib/Services/RefundsService.php
new file mode 100644
index 00000000..3d165733
--- /dev/null
+++ b/lib/Services/RefundsService.php
@@ -0,0 +1,137 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List refunds
+ *
+ * Example URL: /refunds
+ *
+ * @param string[mixed] $params An associative array for any params
+ * @return ListResponse
+ **/
+ protected function _doList($params = array())
+ {
+ $path = "/refunds";
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single refund
+ *
+ * Example URL: /refunds/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "RF".
+ * @param string[mixed] $params An associative array for any params
+ * @return Refund
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/refunds/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Update a refund
+ *
+ * Example URL: /refunds/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "RF".
+ * @param string[mixed] $params An associative array for any params
+ * @return Refund
+ **/
+ public function update($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/refunds/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array($this->envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->put($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List refunds
+ *
+ * Example URL: /refunds
+ *
+ * @param string[mixed] $params
+ *
+ * @return \GoCardlessPro\Core\Paginator
+ **/
+ public function all($params = array())
+ {
+ return new Paginator($this, $params);
+ }
+
+}
diff --git a/lib/Services/SubscriptionsService.php b/lib/Services/SubscriptionsService.php
new file mode 100644
index 00000000..ca5e2fe4
--- /dev/null
+++ b/lib/Services/SubscriptionsService.php
@@ -0,0 +1,166 @@
+envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List subscriptions
+ *
+ * Example URL: /subscriptions
+ *
+ * @param string[mixed] $params An associative array for any params
+ * @return ListResponse
+ **/
+ protected function _doList($params = array())
+ {
+ $path = "/subscriptions";
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Get a single subscription
+ *
+ * Example URL: /subscriptions/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "SB".
+ * @param string[mixed] $params An associative array for any params
+ * @return Subscription
+ **/
+ public function get($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/subscriptions/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) { $params['query'] = $params['params'];
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->get($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Update a subscription
+ *
+ * Example URL: /subscriptions/:identity
+ *
+ * @param string $identity Unique identifier, beginning with "SB".
+ * @param string[mixed] $params An associative array for any params
+ * @return Subscription
+ **/
+ public function update($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/subscriptions/:identity',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array($this->envelope_key => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->put($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * Cancel a subscription
+ *
+ * Example URL: /subscriptions/:identity/actions/cancel
+ *
+ * @param string $identity Unique identifier, beginning with "SB".
+ * @param string[mixed] $params An associative array for any params
+ * @return Subscription
+ **/
+ public function cancel($identity, $params = array())
+ {
+ $path = Util::subUrl(
+ '/subscriptions/:identity/actions/cancel',
+ array(
+
+ 'identity' => $identity
+ )
+ );
+ if(isset($params['params'])) {
+ $params['body'] = json_encode(array("data" => (object)$params['params']));
+
+ unset($params['params']);
+ }
+
+ $response = $this->api_client->post($path, $params);
+
+ return $this->getResourceForResponse($response);
+ }
+
+ /**
+ * List subscriptions
+ *
+ * Example URL: /subscriptions
+ *
+ * @param string[mixed] $params
+ *
+ * @return \GoCardlessPro\Core\Paginator
+ **/
+ public function all($params = array())
+ {
+ return new Paginator($this, $params);
+ }
+
+}
diff --git a/lib/loader.php b/lib/loader.php
index 076e32aa..3cc4ca1f 100644
--- a/lib/loader.php
+++ b/lib/loader.php
@@ -1,4 +1,5 @@
bank_details_lookups;
}
- /**
+ /**
* Creditors
*
* Each [payment](#core-endpoints-payments) taken through the API is linked
@@ -79,7 +81,7 @@ public function creditors()
return $this->creditors;
}
- /**
+ /**
* Creditor Bank Accounts
*
* Creditor Bank Accounts hold the bank details of a
@@ -103,7 +105,7 @@ public function creditor_bank_accounts()
return $this->creditor_bank_accounts;
}
- /**
+ /**
* Customers
*
* Customer objects hold the contact details for a customer. A customer can
@@ -126,7 +128,7 @@ public function customers()
return $this->customers;
}
- /**
+ /**
* Customer Bank Accounts
*
* Customer Bank Accounts hold the bank details of a
@@ -151,7 +153,7 @@ public function customer_bank_accounts()
return $this->customer_bank_accounts;
}
- /**
+ /**
* Events
*
* Events are stored for all webhooks. An event refers to a resource which
@@ -168,7 +170,7 @@ public function events()
return $this->events;
}
- /**
+ /**
* Mandates
*
* Mandates represent the Direct Debit mandate with a
@@ -187,7 +189,7 @@ public function mandates()
return $this->mandates;
}
- /**
+ /**
* Mandate PDFs
*
* Mandate PDFs allow you to easily display [scheme-rules
@@ -204,7 +206,7 @@ public function mandate_pdfs()
return $this->mandate_pdfs;
}
- /**
+ /**
* Payments
*
* Payment objects represent payments from a
@@ -226,7 +228,7 @@ public function payments()
return $this->payments;
}
- /**
+ /**
* Payouts
*
* Payouts represent transfers from GoCardless to a
@@ -245,7 +247,7 @@ public function payouts()
return $this->payouts;
}
- /**
+ /**
* Redirect Flows
*
* Redirect flows enable you to use GoCardless Pro's [hosted payment
@@ -292,7 +294,7 @@ public function redirect_flows()
return $this->redirect_flows;
}
- /**
+ /**
* Refunds
*
* Refund objects represent (partial) refunds of a
@@ -317,7 +319,7 @@ public function refunds()
return $this->refunds;
}
- /**
+ /**
* Subscriptions
*
* Subscriptions create [payments](#core-endpoints-payments) according to a
@@ -387,8 +389,7 @@ public function refunds()
* -
* otherwise the charge date will be rolled __forwards__ to the next business
* day.
- *
- *
+ *
* @return Services\Subscription
*/
public function subscriptions()
@@ -400,7 +401,7 @@ public function subscriptions()
}
- /**
+ /**
* Get the client library's internal http client.
* @return Core\HttpClient
*/
diff --git a/lib/GoCardlessPro/Core/CurlWrapper.php b/lib/package_path/Core/CurlWrapper.php
similarity index 88%
rename from lib/GoCardlessPro/Core/CurlWrapper.php
rename to lib/package_path/Core/CurlWrapper.php
index c554098b..32379a43 100644
--- a/lib/GoCardlessPro/Core/CurlWrapper.php
+++ b/lib/package_path/Core/CurlWrapper.php
@@ -2,7 +2,6 @@
/**
* WARNING: Do not edit by hand, this file was generated by Crank:
* https://github.com/gocardless/crank
- *
*/
namespace GoCardlessPro\Core;
@@ -15,26 +14,36 @@
*/
class CurlWrapper
{
- /** The path to the CA cert bundle for use by Curl */
+ /**
+ * The path to the CA cert bundle for use by Curl
+*/
const CA_CERT_FILENAME = 'cacert.pem';
- /** @var array[string]string Associative array of request headers */
+ /**
+ * @var array[string]string Associative array of request headers
+*/
private $headers;
- /** @var array[string]string Associative array of response headers */
+ /**
+ * @var array[string]string Associative array of response headers
+*/
private $response_headers;
- /** @var int Raw curl handle reference */
+ /**
+ * @var int Raw curl handle reference
+*/
private $curl;
- /** @var array[int]mixed Curl options hash */
+ /**
+ * @var array[int]mixed Curl options hash
+*/
private $opts;
- /**
+ /**
* Creates a new curl request to a given url
*
* @param string $method HTTP Method
- * @param string $url HTTP url
+ * @param string $url HTTP url
*/
public function __construct($method, $url)
{
@@ -44,11 +53,11 @@ public function __construct($method, $url)
$this->setup_curl($method, $url);
}
- /**
+ /**
* Internal function delegated from the constructor to init the curl handle.
*
* @param string $method HTTP Method
- * @param string $url HTTP url
+ * @param string $url HTTP url
*/
private function setup_curl($method, $url)
{
@@ -65,7 +74,7 @@ private function setup_curl($method, $url)
);
}
- /**
+ /**
* Gets the client's user agent for calling to the api.
*
* @return string
@@ -74,7 +83,7 @@ private function getUserAgent()
{
$curlinfo = curl_version();
$uagent = array();
- $uagent[] = 'gocardless-pro-php/0.3.1';
+ $uagent[] = 'gocardless-pro-php/0.9.0';
$uagent[] = 'php/' . phpversion();
$uagent[] = 'curl/' . $curlinfo['version'];
$uagent[] = 'os/' . $curlinfo['host'];
@@ -82,7 +91,7 @@ private function getUserAgent()
return implode(' ', $uagent);
}
- /**
+ /**
* Get a curl option previously set.
*
* @param integer $opt Curl option constant
@@ -95,10 +104,10 @@ public function getOpt($opt)
return $this->opts[$opt];
}
- /**
+ /**
* Get a header set (case-insensitive)
*
- * @param string $name header name
+ * @param string $name header name
* @return string
*/
public function getHeader($name)
@@ -106,19 +115,19 @@ public function getHeader($name)
return $this->headers[strtolower($name)];
}
- /**
+ /**
* Set option header for CURL
* @param integer $key curl option key
- * @param mixed $val curl option value
+ * @param mixed $val curl option value
*/
private function setOpt($key, $val)
{
$this->opts[$key] = $val;
}
- /**
+ /**
* Sets a post body
- * @param string $post_body The post body data
+ * @param string $post_body The post body data
* @param string $content_type content type of the post body
*/
public function setPostBody($post_body, $content_type)
@@ -127,7 +136,7 @@ public function setPostBody($post_body, $content_type)
$this->setOpt(CURLOPT_POSTFIELDS, $post_body);
}
- /**
+ /**
* Sets the curl authorization header
* @param string $auth Authorisation header to set
*/
@@ -136,7 +145,7 @@ public function setAuth($auth)
$this->setHeaders(array('Authorization' => 'Bearer ' . $auth));
}
- /**
+ /**
* Sets request headers from an associative array. Case insensitive.
* @param array[string]string $headers Keys need to be strings, values need to be strings.
*/
@@ -150,7 +159,7 @@ public function setHeaders($headers)
}
}
- /**
+ /**
* Internal function called by curl to set a response header as a callback.
* @param unused
* @param string $header Full header line from response
@@ -164,7 +173,7 @@ public function setResponseHeader($_, $header)
return strlen($header);
}
- /**
+ /**
* Setup the http request headers.
*/
protected function setup_request()
@@ -179,7 +188,7 @@ protected function setup_request()
}
}
- /**
+ /**
* Run the prepared http request
* @return Response HTTP response object.
*/
@@ -201,7 +210,7 @@ public function run()
);
}
- /**
+ /**
* Internal function for finding the root path of the library, used to build the path to cacert.pem
* @return Path to the root of the library
*/
diff --git a/lib/GoCardlessPro/Core/HttpClient.php b/lib/package_path/Core/HttpClient.php
similarity index 84%
rename from lib/GoCardlessPro/Core/HttpClient.php
rename to lib/package_path/Core/HttpClient.php
index 73b7e74a..f25ef983 100644
--- a/lib/GoCardlessPro/Core/HttpClient.php
+++ b/lib/package_path/Core/HttpClient.php
@@ -13,23 +13,23 @@
*/
class HttpClient
{
- // GoCardless Pro API
+ // GoCardless Pro API
- /**
+ /**
* Authorisation header
*/
private $auth;
- /**
+ /**
* Base API Url prefixing all requests the library makes
*/
private $baseUrl;
- /**
+ /**
* List of default headers set during initialisation.
*/
private $headers = array();
- /**
- * @param string $baseUrl Base HTTP access url
+ /**
+ * @param string $baseUrl Base HTTP access url
* @param array[string]string Options (only inludes default headers for now)
*/
public function __construct($token, $baseUrl, $options = array())
@@ -51,7 +51,7 @@ public function __construct($token, $baseUrl, $options = array())
}
- /**
+ /**
* Gets the list of default headers the library is using. For debug purposes.
* @return array[string]string
*/
@@ -60,7 +60,7 @@ public function headers()
return $this->headers;
}
- /**
+ /**
* Gets the base url being used by the library. Primarily for debug purposes.
* @return string
*/
@@ -69,7 +69,7 @@ public function base_url()
return $this->baseUrl;
}
- /**
+ /**
* Constructor for a HTTP Request object
* @param string $envelopeKey The key enveloping the request and response in json
* @return Request
@@ -79,7 +79,7 @@ public function make_request($envelopeKey)
return new Request($this, $envelopeKey);
}
- /**
+ /**
* Combine default and new request headers.
* @param array $headers HTTP Headers
* @return array New Merged HTTP Headers
@@ -93,12 +93,12 @@ private function combine_request_headers($headers)
return $request_headers;
}
- /**
+ /**
* Sets up a request using the curl wrapper passing in the current baseUrl, headers, and auth.
- * @param string $method HTTP Method
- * @param string $path Resource relative path (starts with a /)
- * @param string $postBody (Can be null), the post body sent with the request
- * @param array[string]string $headers Optional HTTP Override headers.
+ * @param string $method HTTP Method
+ * @param string $path Resource relative path (starts with a /)
+ * @param string $postBody (Can be null), the post body sent with the request
+ * @param array[string]string $headers Optional HTTP Override headers.
* @return Response
*/
public function run_curl_request($method, $path, $postBody = null, $headers = array())
diff --git a/lib/GoCardlessPro/Core/Request.php b/lib/package_path/Core/Request.php
similarity index 81%
rename from lib/GoCardlessPro/Core/Request.php
rename to lib/package_path/Core/Request.php
index 4709222a..bfa5f3e8 100644
--- a/lib/GoCardlessPro/Core/Request.php
+++ b/lib/package_path/Core/Request.php
@@ -7,23 +7,31 @@
*/
class Request
{
- /** @var HttpClient HTTP Client reference for requests */
+ /**
+ * @var HttpClient HTTP Client reference for requests
+*/
private $http_client;
- /** @var string JSON Envelope data key */
+ /**
+ * @var string JSON Envelope data key
+*/
private $envelope_key;
- /** @const string[] Valid methods to send url parameters for */
+ /**
+ * @const string[] Valid methods to send url parameters for
+*/
private static $params_methods = array('get', 'delete');
- /** @const string[] Valid method to send a json-encoded postbody for */
+ /**
+ * @const string[] Valid method to send a json-encoded postbody for
+*/
private static $body_methods = array('post', 'put');
- /**
+ /**
* Constructor for a request class to wrap a request
*
- * @param HttpClient $http_client HTTP Client Reference
- * @param string $envelope_key Envelope Key
+ * @param HttpClient $http_client HTTP Client Reference
+ * @param string $envelope_key Envelope Key
*/
public function __construct($http_client, $envelope_key)
{
@@ -31,7 +39,7 @@ public function __construct($http_client, $envelope_key)
$this->envelope_key = $envelope_key;
}
- /**
+ /**
* Gets the request envelope key.
* @param string $type request type to match
*/
@@ -43,11 +51,11 @@ private function getReqEnvelopeKey($type)
return $this->envelope_key;
}
- /**
+ /**
* Runs a raw HTTP request
*
- * @param string $method HTTP Method
- * @param string $path Relative Path for Request
+ * @param string $method HTTP Method
+ * @param string $path Relative Path for Request
* @param array[string]string $options URL parameter or post body options
* @param array[string]string $headers Additional request headers
*
diff --git a/phpcs-ruleset.xml b/phpcs-ruleset.xml
index 92d81cc6..bc443e8c 100644
--- a/phpcs-ruleset.xml
+++ b/phpcs-ruleset.xml
@@ -1,14 +1,10 @@
-
-GoCardless PHP Client Library Ruleset
+GoCardlessPro PHP Client Library Ruleset
-
-
-
-
diff --git a/phpunit.xml b/phpunit.xml
index 7d817e50..8d9206da 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -3,7 +3,7 @@
- ./tests
+ tests
diff --git a/tests/ClientTest.php b/tests/ClientTest.php
new file mode 100644
index 00000000..d88943c3
--- /dev/null
+++ b/tests/ClientTest.php
@@ -0,0 +1,31 @@
+setExpectedException('Exception', 'Missing required option `environment`.');
+ $client = new Client(array('access_token' => 'foo'));
+ }
+
+ public function testNoAccessTokenCreationFails()
+ {
+ $this->setExpectedException('Exception', 'Missing required option `access_token`.');
+ $client = new Client(array('environment' => 'live'));
+ }
+
+ public function testOnlyStringArguments()
+ {
+ $this->setExpectedException('Exception', 'Option `access_token` can only be a string.');
+ $client = new Client(array('access_token' => array(), 'environment' => 'live'));
+ }
+
+ public function testCreatesClientSuccessfully()
+ {
+ $client = new Client(array('access_token' => 'foo', 'environment' => 'live'));
+ $this->assertNotNull($client);
+ $this->assertInstanceOf('\GoCardlessPro\Services\CustomersService', $client->customers());
+ }
+}
diff --git a/tests/Core/ApiClientTest.php b/tests/Core/ApiClientTest.php
new file mode 100644
index 00000000..e6ff401e
--- /dev/null
+++ b/tests/Core/ApiClientTest.php
@@ -0,0 +1,50 @@
+mock = new \GuzzleHttp\Handler\MockHandler();
+ $handler = \GuzzleHttp\HandlerStack::create($this->mock);
+ $this->mock_http_client = new \GuzzleHttp\Client([
+ 'handler' => $handler,
+ 'http_errors' => false
+ ]);
+
+ $this->api_client = new ApiClient($this->mock_http_client);
+ }
+
+ public function testSuccessfulResponse()
+ {
+ $data = array("payments" => array("amount" => "10"));
+ $body = json_encode($data);
+ $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $body));
+ $response = $this->api_client->get('/some_endpoint');
+
+ $this->assertEquals(200, $response->getStatusCode());
+ $this->assertEquals($body, $response->getBody());
+ }
+
+ public function testMalformedResponse()
+ {
+ $this->setExpectedException(
+ 'GoCardlessPro\Core\Exception\MalformedResponseException',
+ 'Malformed response received from server'
+ );
+ $body = "rubbish non-json response";
+ $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], $body));
+ $this->api_client->get('/some_endpoint');
+ }
+
+ public function testNon2XXresponse()
+ {
+ $path = 'tests/fixtures/invalid_state_error.json';
+ $body = fread(fopen($path, "r"), filesize($path));
+ $this->setExpectedException('GoCardlessPro\Core\Exception\InvalidStateException');
+
+ $this->mock->append(new \GuzzleHttp\Psr7\Response(400, [], $body));
+ $this->api_client->get('/some_endpoint');
+ }
+}
diff --git a/tests/Core/Exceptions/ApiExceptionTest.php b/tests/Core/Exceptions/ApiExceptionTest.php
new file mode 100644
index 00000000..00501093
--- /dev/null
+++ b/tests/Core/Exceptions/ApiExceptionTest.php
@@ -0,0 +1,53 @@
+error = new InvalidStateException($fixture->error);
+ }
+
+ public function testType()
+ {
+ $this->assertEquals('invalid_state', $this->error->getType());
+
+ }
+
+ public function testCode()
+ {
+ $this->assertEquals(422, $this->error->getCode());
+ }
+
+ public function testErrors()
+ {
+ $expected_errors = array(
+ (object) array(
+ "message" => "Mandate is already active or being submitted",
+ "reason" => "mandate_not_inactive"
+ )
+ );
+
+ $this->assertEquals($expected_errors, $this->error->getErrors());
+ }
+
+ public function testDocumentationUrl()
+ {
+ $this->assertEquals('https://developer.gocardless.com/pro#mandate_not_inactive', $this->error->getDocumentationUrl());
+ }
+
+ public function testMessage()
+ {
+ $this->assertEquals('Mandate is already active or being submitted', $this->error->getMessage());
+ }
+
+ public function testRequestId()
+ {
+ $this->assertEquals('9aac0445-fd1e-4dc2-8854-a5a6afbaaeae', $this->error->getRequestId());
+ }
+}
diff --git a/tests/Core/Exceptions/ExceptionMessagesTest.php b/tests/Core/Exceptions/ExceptionMessagesTest.php
new file mode 100644
index 00000000..542b0afd
--- /dev/null
+++ b/tests/Core/Exceptions/ExceptionMessagesTest.php
@@ -0,0 +1,53 @@
+getFixture('invalid_state_error');
+ throw new InvalidStateException($fixture->error);
+ }
+
+ /**
+ * @expectedException GoCardlessPro\Core\Exception\InvalidApiUsageException
+ * @expectedExceptionMessage Invalid document structure (Root element must be an object.)
+ */
+ public function testInvalidApiUsageMessage()
+ {
+ $fixture = $this->getFixture('invalid_api_usage_error');
+ throw new InvalidApiUsageException($fixture->error);
+ }
+
+ /**
+ * @expectedException GoCardlessPro\Core\Exception\ValidationFailedException
+ * @expectedExceptionMessage Validation failed (branch_code must be a number, country_code is invalid)
+ */
+ public function testValidationFailedMessage()
+ {
+ $fixture = $this->getFixture('validation_failed_error');
+ throw new ValidationFailedException($fixture->error);
+ }
+
+ /**
+ * @expectedException GoCardlessPro\Core\Exception\GoCardlessInternalException
+ * @expectedExceptionMessage Uh-oh!
+ */
+ public function testGoCardlessException()
+ {
+ $fixture = $this->getFixture('gocardless_error');
+ throw new GoCardlessInternalException($fixture->error);
+ }
+}
diff --git a/tests/Core/ListResponseTest.php b/tests/Core/ListResponseTest.php
new file mode 100644
index 00000000..71142e5a
--- /dev/null
+++ b/tests/Core/ListResponseTest.php
@@ -0,0 +1,57 @@
+list_response = new ListResponse($decoded_body['data'], $model_class, $api_response);
+ }
+
+ public function testModelsUnwrap()
+ {
+ $records = $this->list_response->records;
+ $this->assertEquals(count($records), 2);
+ $this->assertEquals('test', $records[1]->foo);
+ }
+
+ public function testModelsIndexing()
+ {
+ $records = $this->list_response->records;
+ $this->assertNotNull($records[0]);
+ $this->assertTrue(isset($records[1]));
+ $this->assertFalse(isset($records[2]));
+ }
+
+ public function testForeachCount()
+ {
+ $count = 0;
+ $items = array();
+ foreach ($this->list_response->records as $item) {
+ $count++;
+ $items[] = $item;
+ }
+ $this->assertEquals('test', $items[1]->foo);
+ $this->assertEquals(2, count($items));
+ }
+}
diff --git a/tests/Core/Mocks/MockResource.php b/tests/Core/Mocks/MockResource.php
new file mode 100644
index 00000000..1e77f59e
--- /dev/null
+++ b/tests/Core/Mocks/MockResource.php
@@ -0,0 +1,16 @@
+data['id'];
+ }
+
+ public function name()
+ {
+ return $this->data['name'];
+ }
+}
diff --git a/tests/Core/Mocks/MockService.php b/tests/Core/Mocks/MockService.php
new file mode 100644
index 00000000..f9fbc7bc
--- /dev/null
+++ b/tests/Core/Mocks/MockService.php
@@ -0,0 +1,30 @@
+pages = $pages;
+ }
+
+ public function __call($name, $args)
+ {
+ if ($name == 'list') {
+ return $this->_doList($args[0]);
+ }
+ return false;
+ }
+
+ private function _doList($options)
+ {
+ if (isset($options['params']['after'])) {
+ return $this->pages[1];
+ }
+
+ return $this->pages[0];
+ }
+}
diff --git a/tests/Core/Mocks/ResourceHolder.php b/tests/Core/Mocks/ResourceHolder.php
new file mode 100644
index 00000000..94226e6d
--- /dev/null
+++ b/tests/Core/Mocks/ResourceHolder.php
@@ -0,0 +1,11 @@
+data;
+ }
+}
diff --git a/tests/Core/PaginatorTest.php b/tests/Core/PaginatorTest.php
new file mode 100644
index 00000000..9c742baa
--- /dev/null
+++ b/tests/Core/PaginatorTest.php
@@ -0,0 +1,69 @@
+data, $model_class, $api_response);
+ }
+
+ public function setUp()
+ {
+ $body_1 = '{"data": [{"id": "1", "name": "foo"},{"id":"2", "name":"bar"}], "meta": {"cursors": {"before": null, "after": "3"}}, "limit": 2}';
+ $body_2 = '{"data": [{"id": "3", "name": "baz"}], "meta": {"cursors": {"before": "2", "after": null}}, "limit": 2}';
+
+ $fake_service = new Mocks\MockService(
+ array(
+ $this->build_list_response($body_1),
+ $this->build_list_response($body_2)
+ )
+ );
+
+ $this->paginator = new Paginator($fake_service, array());
+ }
+
+ public function testSingleForeachIterator()
+ {
+ $results = array();
+ foreach ($this->paginator as $item) {
+ $results[] = $item;
+ }
+
+ $this->assertEquals("foo", $results[0]->name);
+ $this->assertEquals("bar", $results[1]->name);
+ $this->assertEquals("baz", $results[2]->name);
+ }
+
+ public function testMultipleIterations()
+ {
+ $results = array();
+ foreach ($this->paginator as $item) {
+ $results[] = $item;
+ }
+
+ $results = array();
+ foreach ($this->paginator as $item) {
+ $results[] = $item;
+ }
+
+ $this->assertEquals("foo", $results[0]->name);
+ $this->assertEquals("bar", $results[1]->name);
+ $this->assertEquals("baz", $results[2]->name);
+ }
+}
diff --git a/tests/GoCardlessPro/ClientTest.php b/tests/GoCardlessPro/ClientTest.php
deleted file mode 100644
index 928c827d..00000000
--- a/tests/GoCardlessPro/ClientTest.php
+++ /dev/null
@@ -1,45 +0,0 @@
-setExpectedException('Exception', 'Missing required option `access_token`.');
- $client = new Client(array());
- }
- public function testUnnecessaryArgumentsExplode()
- {
- $this->setExpectedException('Exception', 'Unexpected options passed in: blahblahblah');
- $client = new Client(array('access_token' => 'sdf', 'blahblahblah' => 'lol'));
- }
- public function testClientSetsProductionDefaultEnvironment()
- {
- $client = new Client(array('access_token' => ''));
- $this->assertEquals(Environment::PRODUCTION, $client->http_client()->base_url());
- }
- public function testClientSetsProperEnvironment()
- {
- $client = new Client(array('access_token' => '', 'environment' => Environment::SANDBOX));
- $this->assertEquals(Environment::SANDBOX, $client->http_client()->base_url());
- }
- public function testNoApiSecretCreationFails()
- {
- $this->setExpectedException('Exception', 'Missing required option `access_token`.');
- $client = new Client(array('environment' => ''));
- }
- public function testOnlyStringArguments()
- {
- $this->setExpectedException('Exception', 'Option `access_token` can only be a string.');
- $client = new Client(array('access_token' => array(), 'environment' => ''));
- }
- public function testCreatesClientSuccessfully()
- {
- $client = new Client(array('access_token' => 'foo', 'environment' => 'blah'));
- $this->assertNotNull($client);
- $this->assertNotNull($client->http_client());
- $this->assertInstanceOf('\GoCardlessPro\Core\HttpClient', $client->http_client());
- $this->assertInstanceOf('\GoCardlessPro\Services\CustomersService', $client->customers());
- }
-}
diff --git a/tests/GoCardlessPro/Core/CurlWrapperTest.php b/tests/GoCardlessPro/Core/CurlWrapperTest.php
deleted file mode 100644
index 69f915e5..00000000
--- a/tests/GoCardlessPro/Core/CurlWrapperTest.php
+++ /dev/null
@@ -1,73 +0,0 @@
-assertEquals($wrapper->getOpt(CURLOPT_VERBOSE), false);
- $this->assertGreaterThan(5, $wrapper->getOpt(CURLOPT_TIMEOUT));
- $this->assertEquals('GET', $wrapper->getOpt(CURLOPT_CUSTOMREQUEST));
- $this->assertNull($wrapper->getOpt(CURLOPT_USERPWD));
- }
- public function testCurlDeleteRequest()
- {
- $wrapper = new CurlWrapper('delete', 'http://example.com/resources/2');
- $this->assertEquals('DELETE', $wrapper->getOpt(CURLOPT_CUSTOMREQUEST));
- }
- public function testSetupAuth()
- {
- $wrapper = new CurlWrapper('get', 'http://example.com/');
- $wrapper->setAuth('testing123');
- $this->assertEquals($wrapper->getHeader('Authorization'), 'Bearer testing123');
- }
- public function testPostRequestSetup()
- {
- $wrapper = new CurlWrapper('post', 'http://example.com/');
- $this->assertEquals($wrapper->getOpt(CURLOPT_CUSTOMREQUEST), 'POST');
- $this->assertNull($wrapper->getOpt(CURLOPT_POSTFIELDS));
- $wrapper->setHeaders(array('content-Type' => 'blah/blah'));
- $this->assertEquals($wrapper->getHeader('content-type'), 'blah/blah');
- $wrapper->setPostBody('blahblahblah', 'text/plain');
- $this->assertEquals($wrapper->getHeader('content-type'), 'text/plain');
- $this->assertEquals($wrapper->getOpt(CURLOPT_POSTFIELDS), 'blahblahblah');
- }
- public function testSetupRequest()
- {
- $wrapper = new Helpers\OpenCurlWrapper('post', 'http://example.com/');
- $wrapper->setHeaders(array('blahHeader' => 'testing'));
- $wrapper->setPostBody('{"company": "gc"}', 'application/json');
- $wrapper->doSetOpt('21', 'blah');
- $wrapper->testSetupRequest();
- $this->assertEquals('POST', StaticStorage::getKey(CURLOPT_CUSTOMREQUEST));
- $headers = StaticStorage::getKey(CURLOPT_HTTPHEADER);
- $this->assertContains('content-type: application/json', $headers);
- }
- public function testCurlFlow()
- {
- StaticStorage::setRetVal('curl_exec', '{"company": "gocardless", "city": "london"}');
- StaticStorage::setRetVal(CURLINFO_HTTP_CODE, 200);
- StaticStorage::setRetVal(CURLINFO_CONTENT_TYPE, 'application/json');
-
- $wrapper = new Helpers\OpenCurlWrapper('post', 'http://example.com/');
- $wrapper->run();
- $this->assertEquals(1, StaticStorage::getCalls('curl_init'));
- $this->assertEquals(1, StaticStorage::getCalls('curl_close'));
- $this->assertEquals(1, StaticStorage::getCalls('curl_exec'));
- $this->assertGreaterThan(1, StaticStorage::getCalls('curl_getinfo'));
- $this->assertGreaterThan(4, StaticStorage::getCalls('curl_setopt'));
- }
-}
diff --git a/tests/GoCardlessPro/Core/Error/GoCardlessErrorTest.php b/tests/GoCardlessPro/Core/Error/GoCardlessErrorTest.php
deleted file mode 100644
index 15b314a5..00000000
--- a/tests/GoCardlessPro/Core/Error/GoCardlessErrorTest.php
+++ /dev/null
@@ -1,161 +0,0 @@
- '
- {
- "error": {
- "message": "Invalid document structure",
- "documentation_url": "https://developer.gocardless.com/pro#invalid_document_structure",
- "type": "invalid_api_usage",
- "request_id": "bd271b37-a2f5-47c8-b461-040dfe0e9cb1",
- "code": 400,
- "errors": [
- {
- "reason": "invalid_document_structure",
- "message": "Invalid document structure"
- }
- ]
- }
- }
- ',
- 'validation_failed' => '
- {
- "error": {
- "message": "Bank account already exists",
- "documentation_url": "https://developer.gocardless.com/pro#bank_account_exists",
- "type": "validation_failed",
- "request_id": "bd271b37-a2f5-47c8-b461-040dfe0e9cb1",
- "code": 409,
- "errors": [
- {
- "reason": "bank_account_exists",
- "message": "Bank account already exists",
- "links": {
- "creditor_bank_account": "BA123"
- }
- }
- ]
- }
- }
- ',
- 'invalid_state' => '
- {
- "error": {
- "message": "Bank account already exists",
- "documentation_url": "https://developer.gocardless.com/pro#invalid_state_error",
- "type": "invalid_state",
- "request_id": "bd271b37-a2f5-47c8-b461-040dfe0e9cb1",
- "code": 410,
- "errors": [
- {
- "reason": "bank_account_cannot_delete",
- "message": "Bank account cannot be deleted",
- "links": {
- "creditor_bank_account": "BA123"
- }
- }
- ]
- }
- }
- ',
- 'other' => '
- {
- "error": {
- "message": "Bank account already exists",
- "documentation_url": "https://developer.gocardless.com/pro#internal_error",
- "type": "backend_failure",
- "request_id": "bd271b37-a2f5-47c8-b461-4faegvawfga",
- "code": 500,
- "errors": [
- {
- "reason": "backend_failure",
- "message": "Server backend failure",
- "links": {
- "creditor_bank_account": "BA123"
- }
- }
- ]
- }
- }
- '
- );
-
- public function __construct()
- {
- parent::__construct();
- }
-
- private function getFixture($name)
- {
- return json_decode(self::$error_jsons[$name]);
- }
-
- public function testApiErrorConstructor()
- {
- $this->setExpectedException('GoCardlessPro\Core\Error\InvalidApiUsageError');
- try {
- throw GoCardlessError::makeApiError($this->getFixture('invalid_api_usage'), 400);
- } catch (InvalidApiUsageError $e) {
- $this->assertEquals('invalid_api_usage', $e->error()->type());
- $errors = $e->errors();
- $this->assertEquals('invalid_document_structure', $errors[0]->reason());
- $this->assertEquals(400, $e->http_status());
- $this->assertEquals(
- 'https://developer.gocardless.com/pro#invalid_document_structure',
- $e->documentation_url()
- );
- throw $e;
- }
- }
-
- public function testApiErrorConstructorNoErrorObject()
- {
- $this->setExpectedException('GoCardlessPro\Core\Error\GoCardlessError');
- try {
- throw GoCardlessError::makeApiError($this->getFixture('other'), 400);
- } catch (GoCardlessError $e) {
- $this->assertEquals('backend_failure', $e->error()->type());
- $errors = $e->errors();
- $this->assertEquals('backend_failure', $errors[0]->reason());
- $this->assertEquals(400, $e->http_status());
- $this->assertEquals('https://developer.gocardless.com/pro#internal_error', $e->documentation_url());
- throw $e;
- }
- }
-
- public function testApiErrorConstructorInvalidState()
- {
- $this->setExpectedException('GoCardlessPro\Core\Error\InvalidStateError');
- try {
- throw GoCardlessError::makeApiError($this->getFixture('invalid_state'), 410);
- } catch (InvalidStateError $e) {
- $this->assertEquals('invalid_state', $e->error()->type());
- $errors = $e->errors();
- $this->assertEquals('bank_account_cannot_delete', $errors[0]->reason());
- $this->assertEquals(410, $e->http_status());
- $this->assertEquals('https://developer.gocardless.com/pro#invalid_state_error', $e->documentation_url());
- throw $e;
- }
- }
-
- public function testApiErrorConstructorValidationFailed()
- {
- $this->setExpectedException('GoCardlessPro\Core\Error\ValidationFailedError');
- try {
- throw GoCardlessError::makeApiError($this->getFixture('validation_failed'), 400);
- } catch (ValidationFailedError $e) {
- $this->assertEquals('validation_failed', $e->error()->type());
- $errors = $e->errors();
- $this->assertEquals('bank_account_exists', $errors[0]->reason());
- $this->assertEquals(400, $e->http_status());
- $this->assertEquals('https://developer.gocardless.com/pro#bank_account_exists', $e->documentation_url());
- throw $e;
- }
- }
-}
diff --git a/tests/GoCardlessPro/Core/Helpers/CurlMocks.php b/tests/GoCardlessPro/Core/Helpers/CurlMocks.php
deleted file mode 100644
index 44deac2e..00000000
--- a/tests/GoCardlessPro/Core/Helpers/CurlMocks.php
+++ /dev/null
@@ -1,37 +0,0 @@
-headers;
- }
- public function testSetupRequest()
- {
- $this->setup_request();
- }
- public function doSetOpt($opta, $optb)
- {
- $this->opts[$opta] = $optb;
- }
-}
diff --git a/tests/GoCardlessPro/Core/Helpers/StaticStorage.php b/tests/GoCardlessPro/Core/Helpers/StaticStorage.php
deleted file mode 100644
index 737fd3cd..00000000
--- a/tests/GoCardlessPro/Core/Helpers/StaticStorage.php
+++ /dev/null
@@ -1,72 +0,0 @@
-client = new \GoCardlessPro\Client(
- array(
- 'access_token' => 'ssssh',
- 'environment' => 'https://example.com/'
- )
- );
- $this->http_client = $this->client->http_client();
- }
-
- public function testIncludedDefaultHeaders()
- {
- $defaultHeaders = $this->http_client->headers();
- // Config Headers
- $this->assertEquals('2015-07-06', $defaultHeaders['GoCardless-Version']);
-
- }
-
- public function testUrlBaseSet()
- {
- $this->assertEquals('https://example.com/', $this->http_client->base_url());
- }
-
- public function testMakesProperCurlRequest()
- {
- StaticStorage::setRetVal('curl_exec', '{"thiskey": "hi!"}');
- StaticStorage::setRetVal(CURLINFO_HTTP_CODE, 200);
- StaticStorage::setRetVal(CURLINFO_CONTENT_TYPE, 'application/json');
-
- $request = $this->http_client->make_request('thiskey');
- $response = $request->run('index', 'get', '/', array());
-
- $this->assertEquals('hi!', $response->response());
- $this->assertEquals(200, $response->status());
- $this->assertEquals('application/json', $response->content_type());
- }
-
- public function testHandlesProperQueryParameters()
- {
- StaticStorage::setRetVal('curl_exec', '{"thiskey": "hi!"}');
- StaticStorage::setRetVal(CURLINFO_HTTP_CODE, 200);
- StaticStorage::setRetVal(CURLINFO_CONTENT_TYPE, 'application/json');
-
- $request = $this->http_client->make_request('thiskey');
- $response = $request->run('hi', 'get', '/hi', array('age' => '23'));
-
- $this->assertEquals('https://example.com/hi?age=23', StaticStorage::getOpt(CURLOPT_URL));
- }
-
- public function testHandlesJoinedQueryParameters()
- {
- StaticStorage::setRetVal('curl_exec', '{"thiskey": "hi!"}');
- StaticStorage::setRetVal(CURLINFO_HTTP_CODE, 200);
- StaticStorage::setRetVal(CURLINFO_CONTENT_TYPE, 'application/json');
-
- $request = $this->http_client->make_request('thiskey');
- $response = $request->run('hi_name', 'get', '/hi?name=jane', array('age' => '23'));
-
- $this->assertEquals('https://example.com/hi?name=jane&age=23', StaticStorage::getOpt(CURLOPT_URL));
- }
- public function testHandlesAdjacentQueryParams()
- {
- StaticStorage::setRetVal('curl_exec', '{"thiskey": "hi!"}');
- StaticStorage::setRetVal(CURLINFO_HTTP_CODE, 200);
- StaticStorage::setRetVal(CURLINFO_CONTENT_TYPE, 'application/json');
-
- $request = $this->http_client->make_request('thiskey');
- $response = $request->run('hi_name', 'get', '/hi?name=jane', array('age' => '23'));
-
- $this->assertEquals('https://example.com/hi?name=jane&age=23', StaticStorage::getOpt(CURLOPT_URL));
- }
-}
diff --git a/tests/GoCardlessPro/Core/ListResponseTest.php b/tests/GoCardlessPro/Core/ListResponseTest.php
deleted file mode 100644
index f64d5873..00000000
--- a/tests/GoCardlessPro/Core/ListResponseTest.php
+++ /dev/null
@@ -1,47 +0,0 @@
-raw_response = new Response(
- '{"test": [{"obj":"hi"}, {"foo": "test"}], "meta": {"limit": 5}}',
- 200,
- 'text/html'
- );
- $this->raw_response->set_unwrap_json('test');
- $this->response = new ListResponse('\GoCardlessPro\Core\Mocks\ResourceHolder', $this->raw_response);
- }
- public function testModelsUnwrap()
- {
- $records = $this->response->records();
- $this->assertEquals(count($records), 2);
- $this->assertEquals('test', $records[1]->data()->foo);
- }
- public function testModelsIndexing()
- {
- $records = $this->response->records();
- $this->assertNotNull($records[0]);
- $this->assertFalse(isset($records[2]));
- $this->assertTrue(isset($records[1]));
- }
- public function testForeachCount()
- {
- $count = 0;
- $items = array();
- foreach ($this->response->records() as $item) {
- $count++;
- $items[] = $item;
- }
- $this->assertEquals('test', $items[1]->data()->foo);
- $this->assertEquals(2, count($items));
- }
- public function testRawResponse()
- {
- $this->assertEquals($this->raw_response, $this->response->response());
- $this->assertEquals($this->raw_response->meta(), $this->response->meta());
- $this->assertEquals($this->raw_response->limit(), $this->response->meta()->limit());
- }
-}
diff --git a/tests/GoCardlessPro/Core/Mocks/ResourceHolder.php b/tests/GoCardlessPro/Core/Mocks/ResourceHolder.php
deleted file mode 100644
index 042591f1..00000000
--- a/tests/GoCardlessPro/Core/Mocks/ResourceHolder.php
+++ /dev/null
@@ -1,16 +0,0 @@
-data = $data;
- }
- public function data()
- {
- return $this->data;
- }
-}
diff --git a/tests/GoCardlessPro/Core/Mocks/TestResource.php b/tests/GoCardlessPro/Core/Mocks/TestResource.php
deleted file mode 100644
index 9d5eedb1..00000000
--- a/tests/GoCardlessPro/Core/Mocks/TestResource.php
+++ /dev/null
@@ -1,32 +0,0 @@
-pages = $pages;
- }
- public function data()
- {
- return $this->pages;
- }
- public function __call($name, $args)
- {
- if ($name == 'list') {
- return $this->do_list($args[0]);
- }
- return false;
- }
- public function do_list($options)
- {
- if (isset($options['after']) && isset($this->pages[$options['after']])) {
- return $this->pages[$options['after']];
- }
- if (isset($options['before']) && isset($this->pages[$options['before']])) {
- return $this->pages[$options['before']];
- }
- }
-}
diff --git a/tests/GoCardlessPro/Core/PaginatorTest.php b/tests/GoCardlessPro/Core/PaginatorTest.php
deleted file mode 100644
index ea89883f..00000000
--- a/tests/GoCardlessPro/Core/PaginatorTest.php
+++ /dev/null
@@ -1,94 +0,0 @@
-set_unwrap_json('data');
- $responsePage2 = new Response(
- '{"data": [{"domain": ".com"}, {"age": "40"}],
- "meta": {"cursors": {"before": "10", "after": null}}, "limit": 40}',
- 200,
- 'application/json'
- );
- $responsePage2->set_unwrap_json('data');
- $this->paginator = new Paginator(new Mocks\TestResource(array(
- '20' => new ListResponse('\GoCardlessPro\Core\Mocks\ResourceHolder', $responsePage2),
- '10' => new ListResponse('\GoCardlessPro\Core\Mocks\ResourceHolder', $response)
- )), 10, new ListResponse('\GoCardlessPro\Core\Mocks\ResourceHolder', $response), array(), array());
- }
-
- public function testSinglePage()
- {
- $items = $this->paginator->items()->records();
- $this->assertEquals('.co.uk', $items[0]->data()->domain);
- $this->assertTrue($this->paginator->next_page());
- $this->assertTrue($this->paginator->previous_page());
- $this->assertFalse($this->paginator->previous_page());
- }
-
- public function testTwoPages()
- {
- $items = $this->paginator->items()->records();
- $this->assertEquals('.co.uk', $items[0]->data()->domain);
- $this->assertTrue($this->paginator->next_page());
- $items = $this->paginator->items()->records();
- $this->assertEquals('.com', $items[0]->data()->domain);
- $this->assertFalse($this->paginator->next_page());
- $this->assertEmpty($this->paginator->items());
- }
-
- public function testForEachIterator()
- {
- $results = array();
- foreach ($this->paginator as $item) {
- $results[] = $item;
- }
- $this->assertFalse($this->paginator->next_page());
- $this->assertTrue($this->paginator->previous_page());
-
- $this->assertEquals('.co.uk', $results[0]->data()->domain);
- $this->assertEquals('.com', $results[3]->data()->domain);
- $this->assertEquals('gocardless', $results[2]->data()->name);
- $this->assertEquals(5, count($results));
- }
-
- public function testMultipleForeach()
- {
- foreach ($this->paginator as $item) {
- // ignore this
- }
- $results = array();
- foreach ($this->paginator as $item) {
- $results[] = $item;
- }
- $this->assertEquals(5, count($results));
- $this->assertEquals('.co.uk', $results[0]->data()->domain);
- $this->assertEquals('.com', $results[3]->data()->domain);
- $this->assertEquals('gocardless', $results[2]->data()->name);
-
- $this->assertFalse($this->paginator->next_page());
- $this->assertTrue($this->paginator->previous_page());
- }
-
- public function testForwardsBackwards()
- {
- $this->paginator->next_page();
- $items = $this->paginator->items()->records();
- $this->assertEquals(2, count($items));
- $this->assertEquals('.com', $items[0]->data()->domain);
- $this->paginator->previous_page();
- $this->assertEquals(3, count($this->paginator->items()->records()));
- $items = $this->paginator->items()->records();
- $this->assertEquals('.co.uk', $items[0]->data()->domain);
-
- }
-}
diff --git a/tests/GoCardlessPro/Core/RequestTest.php b/tests/GoCardlessPro/Core/RequestTest.php
deleted file mode 100644
index 11a056bb..00000000
--- a/tests/GoCardlessPro/Core/RequestTest.php
+++ /dev/null
@@ -1,52 +0,0 @@
-client = new \GoCardlessPro\Client(array(
- 'access_token' => 'hi',
- 'environment' => 'https://example.com/'
- ));
- $this->http_client = $this->client->http_client();
- StaticStorage::setRetVal('exec', '{"thiskey": "hi!"}');
- StaticStorage::setRetVal(CURLINFO_HTTP_CODE, 200);
- StaticStorage::setRetVal(CURLINFO_CONTENT_TYPE, 'application/json');
- $this->request = $this->http_client->make_request('thiskey');
- }
-
- public function testHandlesProperQueryParameters()
- {
- $this->request->run('hi', 'get', '/hi', array('age' => '23'));
- $this->assertEquals('https://example.com/hi?age=23', StaticStorage::getOpt(CURLOPT_URL));
- }
- public function testHandlesJoinedQueryParameters()
- {
- $this->request->run('hi', 'get', '/hi?name=jane', array('age' => '23'));
- $this->assertEquals('https://example.com/hi?name=jane&age=23', StaticStorage::getOpt(CURLOPT_URL));
- }
- public function testHandlesMultipleQueryParams()
- {
- $this->request->run('hi', 'get', '/hi?name=jane&', array('age' => '23'));
- $this->assertEquals('https://example.com/hi?name=jane&age=23', StaticStorage::getOpt(CURLOPT_URL));
- }
- public function testHandlesAdjacentQueryParams()
- {
- $this->request->run('hi', 'get', '/hi?', array('age' => '23'));
- $this->assertEquals('https://example.com/hi?age=23', StaticStorage::getOpt(CURLOPT_URL));
- }
-}
diff --git a/tests/GoCardlessPro/Integration/BankDetailsLookupIntegrationTest.php b/tests/GoCardlessPro/Integration/BankDetailsLookupIntegrationTest.php
deleted file mode 100644
index c43dc728..00000000
--- a/tests/GoCardlessPro/Integration/BankDetailsLookupIntegrationTest.php
+++ /dev/null
@@ -1,42 +0,0 @@
-clientAndFixtureSetup('bank_details_lookups');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\BankDetailsLookup(null);
- $this->assertNotNull($obj);
- }
-
- public function testBankDetailsLookupsCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->bank_details_lookups();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->bank_details_lookups;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\BankDetailsLookup', $response);
-
- $this->matchDeepResponse($body->available_debit_schemes, $response->available_debit_schemes());
- $this->matchDeepResponse($body->bank_name, $response->bank_name());
- $this->matchDeepResponse($body->bic, $response->bic());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/CreditorBankAccountIntegrationTest.php b/tests/GoCardlessPro/Integration/CreditorBankAccountIntegrationTest.php
deleted file mode 100644
index 007df58b..00000000
--- a/tests/GoCardlessPro/Integration/CreditorBankAccountIntegrationTest.php
+++ /dev/null
@@ -1,143 +0,0 @@
-clientAndFixtureSetup('creditor_bank_accounts');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\CreditorBankAccount(null);
- $this->assertNotNull($obj);
- }
-
- public function testCreditorBankAccountsCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->creditor_bank_accounts();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->creditor_bank_accounts;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\CreditorBankAccount', $response);
-
- $this->matchDeepResponse($body->account_holder_name, $response->account_holder_name());
- $this->matchDeepResponse($body->account_number_ending, $response->account_number_ending());
- $this->matchDeepResponse($body->bank_name, $response->bank_name());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->enabled, $response->enabled());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCreditorBankAccountsList()
- {
- $fixture = $this->stubResponse('list');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->creditor_bank_accounts();
- $response = call_user_func_array(array($resourceService, 'list'), $func_array);
-
- $body = $fixture->body->creditor_bank_accounts;
-
-
- $records = $response->records();
- $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
- $this->assertInstanceOf('\GoCardlessPro\Resources\CreditorBankAccount', $records[0]);
-
- $this->assertEquals($fixture->body->meta->cursors->before, $response->meta()->cursors()->before());
- $this->assertEquals($fixture->body->meta->cursors->after, $response->meta()->cursors()->after());
-
-
-
- foreach (range(0, count($body) - 1) as $num) {
- $record = $records[$num];
- $this->matchDeepResponse($body[$num]->account_holder_name, $record->account_holder_name());
- $this->matchDeepResponse($body[$num]->account_number_ending, $record->account_number_ending());
- $this->matchDeepResponse($body[$num]->bank_name, $record->bank_name());
- $this->matchDeepResponse($body[$num]->country_code, $record->country_code());
- $this->matchDeepResponse($body[$num]->created_at, $record->created_at());
- $this->matchDeepResponse($body[$num]->currency, $record->currency());
- $this->matchDeepResponse($body[$num]->enabled, $record->enabled());
- $this->matchDeepResponse($body[$num]->id, $record->id());
- $this->matchDeepResponse($body[$num]->links, $record->links());
- $this->matchDeepResponse($body[$num]->metadata, $record->metadata());
-
- }
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCreditorBankAccountsGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->creditor_bank_accounts();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->creditor_bank_accounts;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\CreditorBankAccount', $response);
-
- $this->matchDeepResponse($body->account_holder_name, $response->account_holder_name());
- $this->matchDeepResponse($body->account_number_ending, $response->account_number_ending());
- $this->matchDeepResponse($body->bank_name, $response->bank_name());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->enabled, $response->enabled());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCreditorBankAccountsDisable()
- {
- $fixture = $this->stubResponse('disable');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->creditor_bank_accounts();
- $response = call_user_func_array(array($resourceService, 'disable'), $func_array);
-
- $body = $fixture->body->creditor_bank_accounts;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\CreditorBankAccount', $response);
-
- $this->matchDeepResponse($body->account_holder_name, $response->account_holder_name());
- $this->matchDeepResponse($body->account_number_ending, $response->account_number_ending());
- $this->matchDeepResponse($body->bank_name, $response->bank_name());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->enabled, $response->enabled());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/CreditorIntegrationTest.php b/tests/GoCardlessPro/Integration/CreditorIntegrationTest.php
deleted file mode 100644
index c40ef544..00000000
--- a/tests/GoCardlessPro/Integration/CreditorIntegrationTest.php
+++ /dev/null
@@ -1,147 +0,0 @@
-clientAndFixtureSetup('creditors');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\Creditor(null);
- $this->assertNotNull($obj);
- }
-
- public function testCreditorsCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->creditors();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->creditors;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Creditor', $response);
-
- $this->matchDeepResponse($body->address_line1, $response->address_line1());
- $this->matchDeepResponse($body->address_line2, $response->address_line2());
- $this->matchDeepResponse($body->address_line3, $response->address_line3());
- $this->matchDeepResponse($body->city, $response->city());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->name, $response->name());
- $this->matchDeepResponse($body->postal_code, $response->postal_code());
- $this->matchDeepResponse($body->region, $response->region());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCreditorsList()
- {
- $fixture = $this->stubResponse('list');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->creditors();
- $response = call_user_func_array(array($resourceService, 'list'), $func_array);
-
- $body = $fixture->body->creditors;
-
-
- $records = $response->records();
- $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
- $this->assertInstanceOf('\GoCardlessPro\Resources\Creditor', $records[0]);
-
- $this->assertEquals($fixture->body->meta->cursors->before, $response->meta()->cursors()->before());
- $this->assertEquals($fixture->body->meta->cursors->after, $response->meta()->cursors()->after());
-
-
-
- foreach (range(0, count($body) - 1) as $num) {
- $record = $records[$num];
- $this->matchDeepResponse($body[$num]->address_line1, $record->address_line1());
- $this->matchDeepResponse($body[$num]->address_line2, $record->address_line2());
- $this->matchDeepResponse($body[$num]->address_line3, $record->address_line3());
- $this->matchDeepResponse($body[$num]->city, $record->city());
- $this->matchDeepResponse($body[$num]->country_code, $record->country_code());
- $this->matchDeepResponse($body[$num]->created_at, $record->created_at());
- $this->matchDeepResponse($body[$num]->id, $record->id());
- $this->matchDeepResponse($body[$num]->links, $record->links());
- $this->matchDeepResponse($body[$num]->name, $record->name());
- $this->matchDeepResponse($body[$num]->postal_code, $record->postal_code());
- $this->matchDeepResponse($body[$num]->region, $record->region());
-
- }
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCreditorsGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->creditors();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->creditors;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Creditor', $response);
-
- $this->matchDeepResponse($body->address_line1, $response->address_line1());
- $this->matchDeepResponse($body->address_line2, $response->address_line2());
- $this->matchDeepResponse($body->address_line3, $response->address_line3());
- $this->matchDeepResponse($body->city, $response->city());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->name, $response->name());
- $this->matchDeepResponse($body->postal_code, $response->postal_code());
- $this->matchDeepResponse($body->region, $response->region());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCreditorsUpdate()
- {
- $fixture = $this->stubResponse('update');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->creditors();
- $response = call_user_func_array(array($resourceService, 'update'), $func_array);
-
- $body = $fixture->body->creditors;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Creditor', $response);
-
- $this->matchDeepResponse($body->address_line1, $response->address_line1());
- $this->matchDeepResponse($body->address_line2, $response->address_line2());
- $this->matchDeepResponse($body->address_line3, $response->address_line3());
- $this->matchDeepResponse($body->city, $response->city());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->name, $response->name());
- $this->matchDeepResponse($body->postal_code, $response->postal_code());
- $this->matchDeepResponse($body->region, $response->region());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/CustomerBankAccountIntegrationTest.php b/tests/GoCardlessPro/Integration/CustomerBankAccountIntegrationTest.php
deleted file mode 100644
index 89a3dca7..00000000
--- a/tests/GoCardlessPro/Integration/CustomerBankAccountIntegrationTest.php
+++ /dev/null
@@ -1,171 +0,0 @@
-clientAndFixtureSetup('customer_bank_accounts');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\CustomerBankAccount(null);
- $this->assertNotNull($obj);
- }
-
- public function testCustomerBankAccountsCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->customer_bank_accounts();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->customer_bank_accounts;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\CustomerBankAccount', $response);
-
- $this->matchDeepResponse($body->account_holder_name, $response->account_holder_name());
- $this->matchDeepResponse($body->account_number_ending, $response->account_number_ending());
- $this->matchDeepResponse($body->bank_name, $response->bank_name());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->enabled, $response->enabled());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCustomerBankAccountsList()
- {
- $fixture = $this->stubResponse('list');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->customer_bank_accounts();
- $response = call_user_func_array(array($resourceService, 'list'), $func_array);
-
- $body = $fixture->body->customer_bank_accounts;
-
-
- $records = $response->records();
- $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
- $this->assertInstanceOf('\GoCardlessPro\Resources\CustomerBankAccount', $records[0]);
-
- $this->assertEquals($fixture->body->meta->cursors->before, $response->meta()->cursors()->before());
- $this->assertEquals($fixture->body->meta->cursors->after, $response->meta()->cursors()->after());
-
-
-
- foreach (range(0, count($body) - 1) as $num) {
- $record = $records[$num];
- $this->matchDeepResponse($body[$num]->account_holder_name, $record->account_holder_name());
- $this->matchDeepResponse($body[$num]->account_number_ending, $record->account_number_ending());
- $this->matchDeepResponse($body[$num]->bank_name, $record->bank_name());
- $this->matchDeepResponse($body[$num]->country_code, $record->country_code());
- $this->matchDeepResponse($body[$num]->created_at, $record->created_at());
- $this->matchDeepResponse($body[$num]->currency, $record->currency());
- $this->matchDeepResponse($body[$num]->enabled, $record->enabled());
- $this->matchDeepResponse($body[$num]->id, $record->id());
- $this->matchDeepResponse($body[$num]->links, $record->links());
- $this->matchDeepResponse($body[$num]->metadata, $record->metadata());
-
- }
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCustomerBankAccountsGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->customer_bank_accounts();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->customer_bank_accounts;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\CustomerBankAccount', $response);
-
- $this->matchDeepResponse($body->account_holder_name, $response->account_holder_name());
- $this->matchDeepResponse($body->account_number_ending, $response->account_number_ending());
- $this->matchDeepResponse($body->bank_name, $response->bank_name());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->enabled, $response->enabled());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCustomerBankAccountsUpdate()
- {
- $fixture = $this->stubResponse('update');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->customer_bank_accounts();
- $response = call_user_func_array(array($resourceService, 'update'), $func_array);
-
- $body = $fixture->body->customer_bank_accounts;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\CustomerBankAccount', $response);
-
- $this->matchDeepResponse($body->account_holder_name, $response->account_holder_name());
- $this->matchDeepResponse($body->account_number_ending, $response->account_number_ending());
- $this->matchDeepResponse($body->bank_name, $response->bank_name());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->enabled, $response->enabled());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCustomerBankAccountsDisable()
- {
- $fixture = $this->stubResponse('disable');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->customer_bank_accounts();
- $response = call_user_func_array(array($resourceService, 'disable'), $func_array);
-
- $body = $fixture->body->customer_bank_accounts;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\CustomerBankAccount', $response);
-
- $this->matchDeepResponse($body->account_holder_name, $response->account_holder_name());
- $this->matchDeepResponse($body->account_number_ending, $response->account_number_ending());
- $this->matchDeepResponse($body->bank_name, $response->bank_name());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->enabled, $response->enabled());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/CustomerIntegrationTest.php b/tests/GoCardlessPro/Integration/CustomerIntegrationTest.php
deleted file mode 100644
index 427ed876..00000000
--- a/tests/GoCardlessPro/Integration/CustomerIntegrationTest.php
+++ /dev/null
@@ -1,167 +0,0 @@
-clientAndFixtureSetup('customers');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\Customer(null);
- $this->assertNotNull($obj);
- }
-
- public function testCustomersCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->customers();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->customers;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Customer', $response);
-
- $this->matchDeepResponse($body->address_line1, $response->address_line1());
- $this->matchDeepResponse($body->address_line2, $response->address_line2());
- $this->matchDeepResponse($body->address_line3, $response->address_line3());
- $this->matchDeepResponse($body->city, $response->city());
- $this->matchDeepResponse($body->company_name, $response->company_name());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->email, $response->email());
- $this->matchDeepResponse($body->family_name, $response->family_name());
- $this->matchDeepResponse($body->given_name, $response->given_name());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->language, $response->language());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->postal_code, $response->postal_code());
- $this->matchDeepResponse($body->region, $response->region());
- $this->matchDeepResponse($body->swedish_identity_number, $response->swedish_identity_number());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCustomersList()
- {
- $fixture = $this->stubResponse('list');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->customers();
- $response = call_user_func_array(array($resourceService, 'list'), $func_array);
-
- $body = $fixture->body->customers;
-
-
- $records = $response->records();
- $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
- $this->assertInstanceOf('\GoCardlessPro\Resources\Customer', $records[0]);
-
- $this->assertEquals($fixture->body->meta->cursors->before, $response->meta()->cursors()->before());
- $this->assertEquals($fixture->body->meta->cursors->after, $response->meta()->cursors()->after());
-
-
-
- foreach (range(0, count($body) - 1) as $num) {
- $record = $records[$num];
- $this->matchDeepResponse($body[$num]->address_line1, $record->address_line1());
- $this->matchDeepResponse($body[$num]->address_line2, $record->address_line2());
- $this->matchDeepResponse($body[$num]->address_line3, $record->address_line3());
- $this->matchDeepResponse($body[$num]->city, $record->city());
- $this->matchDeepResponse($body[$num]->company_name, $record->company_name());
- $this->matchDeepResponse($body[$num]->country_code, $record->country_code());
- $this->matchDeepResponse($body[$num]->created_at, $record->created_at());
- $this->matchDeepResponse($body[$num]->email, $record->email());
- $this->matchDeepResponse($body[$num]->family_name, $record->family_name());
- $this->matchDeepResponse($body[$num]->given_name, $record->given_name());
- $this->matchDeepResponse($body[$num]->id, $record->id());
- $this->matchDeepResponse($body[$num]->language, $record->language());
- $this->matchDeepResponse($body[$num]->metadata, $record->metadata());
- $this->matchDeepResponse($body[$num]->postal_code, $record->postal_code());
- $this->matchDeepResponse($body[$num]->region, $record->region());
- $this->matchDeepResponse($body[$num]->swedish_identity_number, $record->swedish_identity_number());
-
- }
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCustomersGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->customers();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->customers;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Customer', $response);
-
- $this->matchDeepResponse($body->address_line1, $response->address_line1());
- $this->matchDeepResponse($body->address_line2, $response->address_line2());
- $this->matchDeepResponse($body->address_line3, $response->address_line3());
- $this->matchDeepResponse($body->city, $response->city());
- $this->matchDeepResponse($body->company_name, $response->company_name());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->email, $response->email());
- $this->matchDeepResponse($body->family_name, $response->family_name());
- $this->matchDeepResponse($body->given_name, $response->given_name());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->language, $response->language());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->postal_code, $response->postal_code());
- $this->matchDeepResponse($body->region, $response->region());
- $this->matchDeepResponse($body->swedish_identity_number, $response->swedish_identity_number());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testCustomersUpdate()
- {
- $fixture = $this->stubResponse('update');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->customers();
- $response = call_user_func_array(array($resourceService, 'update'), $func_array);
-
- $body = $fixture->body->customers;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Customer', $response);
-
- $this->matchDeepResponse($body->address_line1, $response->address_line1());
- $this->matchDeepResponse($body->address_line2, $response->address_line2());
- $this->matchDeepResponse($body->address_line3, $response->address_line3());
- $this->matchDeepResponse($body->city, $response->city());
- $this->matchDeepResponse($body->company_name, $response->company_name());
- $this->matchDeepResponse($body->country_code, $response->country_code());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->email, $response->email());
- $this->matchDeepResponse($body->family_name, $response->family_name());
- $this->matchDeepResponse($body->given_name, $response->given_name());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->language, $response->language());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->postal_code, $response->postal_code());
- $this->matchDeepResponse($body->region, $response->region());
- $this->matchDeepResponse($body->swedish_identity_number, $response->swedish_identity_number());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/EventIntegrationTest.php b/tests/GoCardlessPro/Integration/EventIntegrationTest.php
deleted file mode 100644
index 0f767c8e..00000000
--- a/tests/GoCardlessPro/Integration/EventIntegrationTest.php
+++ /dev/null
@@ -1,81 +0,0 @@
-clientAndFixtureSetup('events');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\Event(null);
- $this->assertNotNull($obj);
- }
-
- public function testEventsList()
- {
- $fixture = $this->stubResponse('list');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->events();
- $response = call_user_func_array(array($resourceService, 'list'), $func_array);
-
- $body = $fixture->body->events;
-
-
- $records = $response->records();
- $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
- $this->assertInstanceOf('\GoCardlessPro\Resources\Event', $records[0]);
-
- $this->assertEquals($fixture->body->meta->cursors->before, $response->meta()->cursors()->before());
- $this->assertEquals($fixture->body->meta->cursors->after, $response->meta()->cursors()->after());
-
-
-
- foreach (range(0, count($body) - 1) as $num) {
- $record = $records[$num];
- $this->matchDeepResponse($body[$num]->action, $record->action());
- $this->matchDeepResponse($body[$num]->created_at, $record->created_at());
- $this->matchDeepResponse($body[$num]->details, $record->details());
- $this->matchDeepResponse($body[$num]->id, $record->id());
- $this->matchDeepResponse($body[$num]->links, $record->links());
- $this->matchDeepResponse($body[$num]->metadata, $record->metadata());
- $this->matchDeepResponse($body[$num]->resource_type, $record->resource_type());
-
- }
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testEventsGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->events();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->events;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Event', $response);
-
- $this->matchDeepResponse($body->action, $response->action());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->details, $response->details());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->resource_type, $response->resource_type());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/IntegrationTestBase.php b/tests/GoCardlessPro/Integration/IntegrationTestBase.php
deleted file mode 100644
index 18603b0c..00000000
--- a/tests/GoCardlessPro/Integration/IntegrationTestBase.php
+++ /dev/null
@@ -1,71 +0,0 @@
-hasCheckedCurl = false;
- }
-
- public function tearDown()
- {
- StaticStorage::tearDown();
- }
-
- protected function stubResponse($method)
- {
- $fixture = $this->fixture->{$method};
- $this->stubFixture = $fixture;
- StaticStorage::onCall('curl_exec', array($this, 'checkCurlCall'));
- StaticStorage::setRetVal('curl_exec', json_encode($fixture->body));
- return $fixture;
- }
-
- public function checkCurlCall()
- {
- $pathTest = \GoCardlessPro\Services\Base::sub_url(
- $this->stubFixture->path_template,
- (array)$this->stubFixture->url_params
- );
-
- $curlUrl = StaticStorage::getOpt(CURLOPT_URL);
- $this->assertEquals($this->client->http_client()->base_url() . substr($pathTest, 1), $curlUrl);
- $requestMethod = StaticStorage::getOpt(CURLOPT_CUSTOMREQUEST);
- $this->assertEquals($requestMethod, strtoupper($this->stubFixture->method));
- StaticStorage::setRetVal(CURLINFO_CONTENT_TYPE, 'application/json');
- StaticStorage::setRetVal(CURLINFO_HTTP_CODE, 200);
- $headers = StaticStorage::getOpt(CURLOPT_HTTPHEADER);
- $this->assertContains('authorization: Bearer foobar', $headers);
-
- // Set flag for ensuring curl library is called.
- $this->hasCheckedCurl = true;
- }
-
- protected function matchDeepResponse($fixture, $test)
- {
- if ($test instanceof \GoCardlessPro\Resources\Wrapper\NestedObject) {
- $this->assertEquals($fixture, $test->raw());
- } elseif ($test instanceof \GoCardlessPro\Resources\Wrapper\NestedArray) {
- $this->assertEquals($fixture, $test->raw());
- } else {
- $this->assertEquals($fixture, $test);
- }
- }
-
- protected function clientAndFixtureSetup($modelName)
- {
- $this->client = new \GoCardlessPro\Client(array('access_token' => 'foobar'));
- $json_path = './tests/GoCardlessPro/fixtures/'.$modelName.'.json';
- $this->fixture = json_decode(file_get_contents($json_path));
- }
-}
diff --git a/tests/GoCardlessPro/Integration/MandateIntegrationTest.php b/tests/GoCardlessPro/Integration/MandateIntegrationTest.php
deleted file mode 100644
index ce0d94e9..00000000
--- a/tests/GoCardlessPro/Integration/MandateIntegrationTest.php
+++ /dev/null
@@ -1,187 +0,0 @@
-clientAndFixtureSetup('mandates');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\Mandate(null);
- $this->assertNotNull($obj);
- }
-
- public function testMandatesCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->mandates();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->mandates;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $response);
-
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->next_possible_charge_date, $response->next_possible_charge_date());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->scheme, $response->scheme());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testMandatesList()
- {
- $fixture = $this->stubResponse('list');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->mandates();
- $response = call_user_func_array(array($resourceService, 'list'), $func_array);
-
- $body = $fixture->body->mandates;
-
-
- $records = $response->records();
- $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
- $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $records[0]);
-
- $this->assertEquals($fixture->body->meta->cursors->before, $response->meta()->cursors()->before());
- $this->assertEquals($fixture->body->meta->cursors->after, $response->meta()->cursors()->after());
-
-
-
- foreach (range(0, count($body) - 1) as $num) {
- $record = $records[$num];
- $this->matchDeepResponse($body[$num]->created_at, $record->created_at());
- $this->matchDeepResponse($body[$num]->id, $record->id());
- $this->matchDeepResponse($body[$num]->links, $record->links());
- $this->matchDeepResponse($body[$num]->metadata, $record->metadata());
- $this->matchDeepResponse($body[$num]->next_possible_charge_date, $record->next_possible_charge_date());
- $this->matchDeepResponse($body[$num]->reference, $record->reference());
- $this->matchDeepResponse($body[$num]->scheme, $record->scheme());
- $this->matchDeepResponse($body[$num]->status, $record->status());
-
- }
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testMandatesGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->mandates();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->mandates;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $response);
-
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->next_possible_charge_date, $response->next_possible_charge_date());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->scheme, $response->scheme());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testMandatesUpdate()
- {
- $fixture = $this->stubResponse('update');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->mandates();
- $response = call_user_func_array(array($resourceService, 'update'), $func_array);
-
- $body = $fixture->body->mandates;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $response);
-
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->next_possible_charge_date, $response->next_possible_charge_date());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->scheme, $response->scheme());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testMandatesCancel()
- {
- $fixture = $this->stubResponse('cancel');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->mandates();
- $response = call_user_func_array(array($resourceService, 'cancel'), $func_array);
-
- $body = $fixture->body->mandates;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $response);
-
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->next_possible_charge_date, $response->next_possible_charge_date());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->scheme, $response->scheme());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testMandatesReinstate()
- {
- $fixture = $this->stubResponse('reinstate');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->mandates();
- $response = call_user_func_array(array($resourceService, 'reinstate'), $func_array);
-
- $body = $fixture->body->mandates;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $response);
-
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->next_possible_charge_date, $response->next_possible_charge_date());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->scheme, $response->scheme());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/MandatePdfIntegrationTest.php b/tests/GoCardlessPro/Integration/MandatePdfIntegrationTest.php
deleted file mode 100644
index 37de435e..00000000
--- a/tests/GoCardlessPro/Integration/MandatePdfIntegrationTest.php
+++ /dev/null
@@ -1,41 +0,0 @@
-clientAndFixtureSetup('mandate_pdfs');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\MandatePdf(null);
- $this->assertNotNull($obj);
- }
-
- public function testMandatePdfsCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->mandate_pdfs();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->mandate_pdfs;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\MandatePdf', $response);
-
- $this->matchDeepResponse($body->expires_at, $response->expires_at());
- $this->matchDeepResponse($body->url, $response->url());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/PaymentIntegrationTest.php b/tests/GoCardlessPro/Integration/PaymentIntegrationTest.php
deleted file mode 100644
index 9952fa68..00000000
--- a/tests/GoCardlessPro/Integration/PaymentIntegrationTest.php
+++ /dev/null
@@ -1,205 +0,0 @@
-clientAndFixtureSetup('payments');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\Payment(null);
- $this->assertNotNull($obj);
- }
-
- public function testPaymentsCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->payments();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->payments;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->amount_refunded, $response->amount_refunded());
- $this->matchDeepResponse($body->charge_date, $response->charge_date());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->description, $response->description());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testPaymentsList()
- {
- $fixture = $this->stubResponse('list');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->payments();
- $response = call_user_func_array(array($resourceService, 'list'), $func_array);
-
- $body = $fixture->body->payments;
-
-
- $records = $response->records();
- $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
- $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $records[0]);
-
- $this->assertEquals($fixture->body->meta->cursors->before, $response->meta()->cursors()->before());
- $this->assertEquals($fixture->body->meta->cursors->after, $response->meta()->cursors()->after());
-
-
-
- foreach (range(0, count($body) - 1) as $num) {
- $record = $records[$num];
- $this->matchDeepResponse($body[$num]->amount, $record->amount());
- $this->matchDeepResponse($body[$num]->amount_refunded, $record->amount_refunded());
- $this->matchDeepResponse($body[$num]->charge_date, $record->charge_date());
- $this->matchDeepResponse($body[$num]->created_at, $record->created_at());
- $this->matchDeepResponse($body[$num]->currency, $record->currency());
- $this->matchDeepResponse($body[$num]->description, $record->description());
- $this->matchDeepResponse($body[$num]->id, $record->id());
- $this->matchDeepResponse($body[$num]->links, $record->links());
- $this->matchDeepResponse($body[$num]->metadata, $record->metadata());
- $this->matchDeepResponse($body[$num]->reference, $record->reference());
- $this->matchDeepResponse($body[$num]->status, $record->status());
-
- }
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testPaymentsGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->payments();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->payments;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->amount_refunded, $response->amount_refunded());
- $this->matchDeepResponse($body->charge_date, $response->charge_date());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->description, $response->description());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testPaymentsUpdate()
- {
- $fixture = $this->stubResponse('update');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->payments();
- $response = call_user_func_array(array($resourceService, 'update'), $func_array);
-
- $body = $fixture->body->payments;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->amount_refunded, $response->amount_refunded());
- $this->matchDeepResponse($body->charge_date, $response->charge_date());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->description, $response->description());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testPaymentsCancel()
- {
- $fixture = $this->stubResponse('cancel');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->payments();
- $response = call_user_func_array(array($resourceService, 'cancel'), $func_array);
-
- $body = $fixture->body->payments;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->amount_refunded, $response->amount_refunded());
- $this->matchDeepResponse($body->charge_date, $response->charge_date());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->description, $response->description());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testPaymentsRetry()
- {
- $fixture = $this->stubResponse('retry');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->payments();
- $response = call_user_func_array(array($resourceService, 'retry'), $func_array);
-
- $body = $fixture->body->payments;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->amount_refunded, $response->amount_refunded());
- $this->matchDeepResponse($body->charge_date, $response->charge_date());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->description, $response->description());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/PayoutIntegrationTest.php b/tests/GoCardlessPro/Integration/PayoutIntegrationTest.php
deleted file mode 100644
index 3d7468da..00000000
--- a/tests/GoCardlessPro/Integration/PayoutIntegrationTest.php
+++ /dev/null
@@ -1,81 +0,0 @@
-clientAndFixtureSetup('payouts');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\Payout(null);
- $this->assertNotNull($obj);
- }
-
- public function testPayoutsList()
- {
- $fixture = $this->stubResponse('list');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->payouts();
- $response = call_user_func_array(array($resourceService, 'list'), $func_array);
-
- $body = $fixture->body->payouts;
-
-
- $records = $response->records();
- $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
- $this->assertInstanceOf('\GoCardlessPro\Resources\Payout', $records[0]);
-
- $this->assertEquals($fixture->body->meta->cursors->before, $response->meta()->cursors()->before());
- $this->assertEquals($fixture->body->meta->cursors->after, $response->meta()->cursors()->after());
-
-
-
- foreach (range(0, count($body) - 1) as $num) {
- $record = $records[$num];
- $this->matchDeepResponse($body[$num]->amount, $record->amount());
- $this->matchDeepResponse($body[$num]->created_at, $record->created_at());
- $this->matchDeepResponse($body[$num]->currency, $record->currency());
- $this->matchDeepResponse($body[$num]->id, $record->id());
- $this->matchDeepResponse($body[$num]->links, $record->links());
- $this->matchDeepResponse($body[$num]->reference, $record->reference());
- $this->matchDeepResponse($body[$num]->status, $record->status());
-
- }
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testPayoutsGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->payouts();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->payouts;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Payout', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->reference, $response->reference());
- $this->matchDeepResponse($body->status, $response->status());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/RedirectFlowIntegrationTest.php b/tests/GoCardlessPro/Integration/RedirectFlowIntegrationTest.php
deleted file mode 100644
index 31e9bfe5..00000000
--- a/tests/GoCardlessPro/Integration/RedirectFlowIntegrationTest.php
+++ /dev/null
@@ -1,99 +0,0 @@
-clientAndFixtureSetup('redirect_flows');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\RedirectFlow(null);
- $this->assertNotNull($obj);
- }
-
- public function testRedirectFlowsCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->redirect_flows();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->redirect_flows;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\RedirectFlow', $response);
-
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->description, $response->description());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->redirect_url, $response->redirect_url());
- $this->matchDeepResponse($body->scheme, $response->scheme());
- $this->matchDeepResponse($body->session_token, $response->session_token());
- $this->matchDeepResponse($body->success_redirect_url, $response->success_redirect_url());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testRedirectFlowsGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->redirect_flows();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->redirect_flows;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\RedirectFlow', $response);
-
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->description, $response->description());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->redirect_url, $response->redirect_url());
- $this->matchDeepResponse($body->scheme, $response->scheme());
- $this->matchDeepResponse($body->session_token, $response->session_token());
- $this->matchDeepResponse($body->success_redirect_url, $response->success_redirect_url());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testRedirectFlowsComplete()
- {
- $fixture = $this->stubResponse('complete');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->redirect_flows();
- $response = call_user_func_array(array($resourceService, 'complete'), $func_array);
-
- $body = $fixture->body->redirect_flows;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\RedirectFlow', $response);
-
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->description, $response->description());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->redirect_url, $response->redirect_url());
- $this->matchDeepResponse($body->scheme, $response->scheme());
- $this->matchDeepResponse($body->session_token, $response->session_token());
- $this->matchDeepResponse($body->success_redirect_url, $response->success_redirect_url());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/RefundIntegrationTest.php b/tests/GoCardlessPro/Integration/RefundIntegrationTest.php
deleted file mode 100644
index 2ba2f026..00000000
--- a/tests/GoCardlessPro/Integration/RefundIntegrationTest.php
+++ /dev/null
@@ -1,131 +0,0 @@
-clientAndFixtureSetup('refunds');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\Refund(null);
- $this->assertNotNull($obj);
- }
-
- public function testRefundsCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->refunds();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->refunds;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Refund', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->reference, $response->reference());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testRefundsList()
- {
- $fixture = $this->stubResponse('list');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->refunds();
- $response = call_user_func_array(array($resourceService, 'list'), $func_array);
-
- $body = $fixture->body->refunds;
-
-
- $records = $response->records();
- $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
- $this->assertInstanceOf('\GoCardlessPro\Resources\Refund', $records[0]);
-
- $this->assertEquals($fixture->body->meta->cursors->before, $response->meta()->cursors()->before());
- $this->assertEquals($fixture->body->meta->cursors->after, $response->meta()->cursors()->after());
-
-
-
- foreach (range(0, count($body) - 1) as $num) {
- $record = $records[$num];
- $this->matchDeepResponse($body[$num]->amount, $record->amount());
- $this->matchDeepResponse($body[$num]->created_at, $record->created_at());
- $this->matchDeepResponse($body[$num]->currency, $record->currency());
- $this->matchDeepResponse($body[$num]->id, $record->id());
- $this->matchDeepResponse($body[$num]->links, $record->links());
- $this->matchDeepResponse($body[$num]->metadata, $record->metadata());
- $this->matchDeepResponse($body[$num]->reference, $record->reference());
-
- }
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testRefundsGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->refunds();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->refunds;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Refund', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->reference, $response->reference());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testRefundsUpdate()
- {
- $fixture = $this->stubResponse('update');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->refunds();
- $response = call_user_func_array(array($resourceService, 'update'), $func_array);
-
- $body = $fixture->body->refunds;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Refund', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->reference, $response->reference());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Integration/SubscriptionIntegrationTest.php b/tests/GoCardlessPro/Integration/SubscriptionIntegrationTest.php
deleted file mode 100644
index 43b27899..00000000
--- a/tests/GoCardlessPro/Integration/SubscriptionIntegrationTest.php
+++ /dev/null
@@ -1,206 +0,0 @@
-clientAndFixtureSetup('subscriptions');
- }
-
- public function testResourceExists()
- {
- $obj = new \GoCardlessPro\Resources\Subscription(null);
- $this->assertNotNull($obj);
- }
-
- public function testSubscriptionsCreate()
- {
- $fixture = $this->stubResponse('create');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->subscriptions();
- $response = call_user_func_array(array($resourceService, 'create'), $func_array);
-
- $body = $fixture->body->subscriptions;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Subscription', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->count, $response->count());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->day_of_month, $response->day_of_month());
- $this->matchDeepResponse($body->end_date, $response->end_date());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->interval, $response->interval());
- $this->matchDeepResponse($body->interval_unit, $response->interval_unit());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->month, $response->month());
- $this->matchDeepResponse($body->name, $response->name());
- $this->matchDeepResponse($body->payment_reference, $response->payment_reference());
- $this->matchDeepResponse($body->start_date, $response->start_date());
- $this->matchDeepResponse($body->status, $response->status());
- $this->matchDeepResponse($body->upcoming_payments, $response->upcoming_payments());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testSubscriptionsList()
- {
- $fixture = $this->stubResponse('list');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->subscriptions();
- $response = call_user_func_array(array($resourceService, 'list'), $func_array);
-
- $body = $fixture->body->subscriptions;
-
-
- $records = $response->records();
- $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
- $this->assertInstanceOf('\GoCardlessPro\Resources\Subscription', $records[0]);
-
- $this->assertEquals($fixture->body->meta->cursors->before, $response->meta()->cursors()->before());
- $this->assertEquals($fixture->body->meta->cursors->after, $response->meta()->cursors()->after());
-
-
-
- foreach (range(0, count($body) - 1) as $num) {
- $record = $records[$num];
- $this->matchDeepResponse($body[$num]->amount, $record->amount());
- $this->matchDeepResponse($body[$num]->count, $record->count());
- $this->matchDeepResponse($body[$num]->created_at, $record->created_at());
- $this->matchDeepResponse($body[$num]->currency, $record->currency());
- $this->matchDeepResponse($body[$num]->day_of_month, $record->day_of_month());
- $this->matchDeepResponse($body[$num]->end_date, $record->end_date());
- $this->matchDeepResponse($body[$num]->id, $record->id());
- $this->matchDeepResponse($body[$num]->interval, $record->interval());
- $this->matchDeepResponse($body[$num]->interval_unit, $record->interval_unit());
- $this->matchDeepResponse($body[$num]->links, $record->links());
- $this->matchDeepResponse($body[$num]->metadata, $record->metadata());
- $this->matchDeepResponse($body[$num]->month, $record->month());
- $this->matchDeepResponse($body[$num]->name, $record->name());
- $this->matchDeepResponse($body[$num]->payment_reference, $record->payment_reference());
- $this->matchDeepResponse($body[$num]->start_date, $record->start_date());
- $this->matchDeepResponse($body[$num]->status, $record->status());
- $this->matchDeepResponse($body[$num]->upcoming_payments, $record->upcoming_payments());
-
- }
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testSubscriptionsGet()
- {
- $fixture = $this->stubResponse('get');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->subscriptions();
- $response = call_user_func_array(array($resourceService, 'get'), $func_array);
-
- $body = $fixture->body->subscriptions;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Subscription', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->count, $response->count());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->day_of_month, $response->day_of_month());
- $this->matchDeepResponse($body->end_date, $response->end_date());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->interval, $response->interval());
- $this->matchDeepResponse($body->interval_unit, $response->interval_unit());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->month, $response->month());
- $this->matchDeepResponse($body->name, $response->name());
- $this->matchDeepResponse($body->payment_reference, $response->payment_reference());
- $this->matchDeepResponse($body->start_date, $response->start_date());
- $this->matchDeepResponse($body->status, $response->status());
- $this->matchDeepResponse($body->upcoming_payments, $response->upcoming_payments());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testSubscriptionsUpdate()
- {
- $fixture = $this->stubResponse('update');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->subscriptions();
- $response = call_user_func_array(array($resourceService, 'update'), $func_array);
-
- $body = $fixture->body->subscriptions;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Subscription', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->count, $response->count());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->day_of_month, $response->day_of_month());
- $this->matchDeepResponse($body->end_date, $response->end_date());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->interval, $response->interval());
- $this->matchDeepResponse($body->interval_unit, $response->interval_unit());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->month, $response->month());
- $this->matchDeepResponse($body->name, $response->name());
- $this->matchDeepResponse($body->payment_reference, $response->payment_reference());
- $this->matchDeepResponse($body->start_date, $response->start_date());
- $this->matchDeepResponse($body->status, $response->status());
- $this->matchDeepResponse($body->upcoming_payments, $response->upcoming_payments());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-
- public function testSubscriptionsCancel()
- {
- $fixture = $this->stubResponse('cancel');
-
- $func_array = array_values((array) $fixture->url_params);
- $resourceService = $this->client->subscriptions();
- $response = call_user_func_array(array($resourceService, 'cancel'), $func_array);
-
- $body = $fixture->body->subscriptions;
-
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Subscription', $response);
-
- $this->matchDeepResponse($body->amount, $response->amount());
- $this->matchDeepResponse($body->count, $response->count());
- $this->matchDeepResponse($body->created_at, $response->created_at());
- $this->matchDeepResponse($body->currency, $response->currency());
- $this->matchDeepResponse($body->day_of_month, $response->day_of_month());
- $this->matchDeepResponse($body->end_date, $response->end_date());
- $this->matchDeepResponse($body->id, $response->id());
- $this->matchDeepResponse($body->interval, $response->interval());
- $this->matchDeepResponse($body->interval_unit, $response->interval_unit());
- $this->matchDeepResponse($body->links, $response->links());
- $this->matchDeepResponse($body->metadata, $response->metadata());
- $this->matchDeepResponse($body->month, $response->month());
- $this->matchDeepResponse($body->name, $response->name());
- $this->matchDeepResponse($body->payment_reference, $response->payment_reference());
- $this->matchDeepResponse($body->start_date, $response->start_date());
- $this->matchDeepResponse($body->status, $response->status());
- $this->matchDeepResponse($body->upcoming_payments, $response->upcoming_payments());
-
-
- $this->assertTrue($this->hasCheckedCurl);
- }
-}
diff --git a/tests/GoCardlessPro/Resources/ResourceTest.php b/tests/GoCardlessPro/Resources/ResourceTest.php
deleted file mode 100644
index 7014004f..00000000
--- a/tests/GoCardlessPro/Resources/ResourceTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
- 'iain'));
-
- $this->assertEquals('iain', $resource->given_name());
- }
-
- public function testRequiredData()
- {
- $resource = new Customer(null);
- $this->assertNull($resource->family_name());
- }
-
- public function testInvalidGetter()
- {
- $resource = new Customer((object) array('blah' => 'foo'));
-
- $this->assertFalse(method_exists($resource, 'blah'));
- }
-
- public function testValidGetter()
- {
- $resource = new Customer((object) array('given_name' => 'notbad'));
-
- $this->assertEquals('notbad', $resource->given_name());
- }
-
- public function testRequestNotOverridden()
- {
- $mockResponse = $this->getMockBuilder('\GoCardlessPro\Core\Response')
- ->disableOriginalConstructor()
- ->getMock();
-
- $resource = new Customer((object) array('response' => 'hi'), $mockResponse);
-
- $this->assertEquals($mockResponse, $resource->response());
- }
-
- public function testGetResponse()
- {
-
- $mockResponse = $this->getMockBuilder('\GoCardlessPro\Core\Response')
- ->disableOriginalConstructor()
- ->getMock();
-
- $resource = new Customer((object) array(), $mockResponse);
-
- $this->assertEquals($mockResponse, $resource->response());
- }
-}
diff --git a/tests/GoCardlessPro/Resources/Wrapper/NestedArrayTest.php b/tests/GoCardlessPro/Resources/Wrapper/NestedArrayTest.php
deleted file mode 100644
index c4c36c51..00000000
--- a/tests/GoCardlessPro/Resources/Wrapper/NestedArrayTest.php
+++ /dev/null
@@ -1,43 +0,0 @@
- 'jill'));
- // A side effect of this implementation - better than only allowing getters.
- $this->assertEquals('jill', $o['name']);
- }
-
- public function testArrayGet()
- {
- $json = json_decode('[1,2,3,4]');
- $o = new NestedArray('test', $json);
- $this->assertEquals(4, count($o));
- $this->assertEquals(3, $o[2]);
- }
-
- public function testNestedArrayGet()
- {
- $json = json_decode('[[1,2,3],1,2,3,4]');
- $o = new NestedArray('test', $json);
- $this->assertEquals(5, count($o));
- $this->assertEquals(2, $o[2]);
- $this->assertEquals(3, count($o[0]));
- $this->assertEquals(1, $o[0][0]);
- }
-
- public function testNestedObjectGet()
- {
- $json = json_decode('[{"age": 20},1,2,3,4]');
- $o = new NestedArray('test', $json);
- $this->assertEquals(5, count($o));
- $this->assertEquals(20, $o[0]->age());
- }
-}
diff --git a/tests/GoCardlessPro/Resources/Wrapper/NestedObjectTest.php b/tests/GoCardlessPro/Resources/Wrapper/NestedObjectTest.php
deleted file mode 100644
index 57071367..00000000
--- a/tests/GoCardlessPro/Resources/Wrapper/NestedObjectTest.php
+++ /dev/null
@@ -1,30 +0,0 @@
- 'jill'));
- $this->assertEquals('jill', $o->name());
- }
-
- public function testNestedObjectInnerGet()
- {
- $o = new NestedObject('test', (object) array('person' => (object) array('age' => 20)));
- $this->assertEquals(20, $o->person()->age());
- }
-
- public function testNestedObjectArrayGet()
- {
- $json = json_decode('{"numbers": [1,2,3,4]}');
- $o = new NestedObject('test', $json);
- $numbers = $o->numbers();
- $this->assertEquals(4, count($numbers));
- $this->assertEquals(2, $numbers[1]);
- }
-}
diff --git a/tests/GoCardlessPro/Services/BaseTest.php b/tests/GoCardlessPro/Services/BaseTest.php
deleted file mode 100644
index 4d081606..00000000
--- a/tests/GoCardlessPro/Services/BaseTest.php
+++ /dev/null
@@ -1,94 +0,0 @@
-base = new Mocks\BaseImpl(null);
- }
-
- public function testEnvelopeKey()
- {
- $this->assertEquals($this->base->envelopeKey(), 'envelopeKey');
- }
-
- public function testResourceClass()
- {
- $this->assertEquals($this->base->resourceClass(), '\GoCardlessPro\Resources\Customer');
- }
-
- public function testSubUrlNoChanges()
- {
- $original = 'asdfasdf';
- $this->assertEquals($original, $this->base->proxySubUrl($original, array()));
- }
-
- public function testSubMultipleChanges()
- {
- $res = $this->base->proxySubUrl('/people/:county/:age', array('county' => 'london', 'age' => '30'));
- $this->assertEquals($res, '/people/london/30');
- }
-
- public function testSubChangesWrongTypeInt()
- {
- $this->setExpectedException(
- 'Exception',
- 'URL value for age needs to be a string, not a integer.'
- );
- $res = $this->base->proxySubUrl('/people/:county/:age', array('county' => 'london', 'age' => 30));
- $this->assertEquals($res, '/people/london/30');
- }
-
- public function testSubChangesWrongTypeObject()
- {
- $this->setExpectedException(
- 'Exception',
- 'URL value for person needs to be a string, not a object.'
- );
- $res = $this->base->proxySubUrl('/people/:county/:age', array('person' => new \stdClass()));
- $this->assertEquals($res, '/people/london/30');
- }
-
- public function testMakeRequest()
- {
- $mockClient = $this->getMockBuilder('\GoCardlessPro\Core\HttpClient')
- ->setMethods(array('make_request'))
- ->disableOriginalConstructor()
- ->getMock();
-
-
- $mockRequest = $this->getMockBuilder('\GoCardlessPro\Core\Request')
- ->setMethods(array('run'))
- ->disableOriginalConstructor()
- ->getMock();
-
- $emptyResponse = new \GoCardlessPro\Core\Response(
- '{"envelopeKey": {"name": "iain"}}',
- 200,
- 'application/json; utf-8'
- );
- $emptyResponse->set_unwrap_json('envelopeKey');
-
- $mockRequest->expects($this->once())
- ->method('run')
- ->with('post', 'http://example.com/api', array())
- ->willReturn($emptyResponse);
-
- $mockClient->expects($this->once())
- ->method('make_request')
- ->with($this->equalTo('envelopeKey'))
- ->willReturn($mockRequest);
-
- $base = new Mocks\BaseImpl($mockClient);
-
- $response = $base->proxyMakeRequest('post', 'http://example.com/api', array(), array(), array());
-
- $this->assertInstanceOf('\GoCardlessPro\Resources\Customer', $response);
- $this->assertEquals($response->response(), $emptyResponse);
-
- }
-}
diff --git a/tests/GoCardlessPro/Services/Mocks/BaseImpl.php b/tests/GoCardlessPro/Services/Mocks/BaseImpl.php
deleted file mode 100644
index 25f47ecb..00000000
--- a/tests/GoCardlessPro/Services/Mocks/BaseImpl.php
+++ /dev/null
@@ -1,25 +0,0 @@
-sub_url($url, $subs);
- }
- public function proxyMakeRequest($method, $uri, $options, $params, $headers)
- {
- return $this->make_request($method, $uri, $options, $params, $headers);
- }
-}
diff --git a/tests/GoCardlessPro/fixtures/creditors.json b/tests/GoCardlessPro/fixtures/creditors.json
deleted file mode 100644
index f64c055b..00000000
--- a/tests/GoCardlessPro/fixtures/creditors.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "create": {
- "method": "POST",
- "path_template": "/creditors",
- "url_params": {},
- "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":null,"city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_sek_payout_account":null},"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 456"}}
- },
- "list": {
- "method": "GET",
- "path_template": "/creditors",
- "url_params": {},
- "body": {"creditors":[{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":null,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_sek_payout_account":null},"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 4728"},{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 8287","city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":null,"default_gbp_payout_account":null,"default_sek_payout_account":"BA789"},"name":"Nude Wines","postal_code":null,"region":null}],"meta":{"cursors":{"after":"example after 5356","before":"example before 1737"},"limit":50}}
- },
- "get": {
- "method": "GET",
- "path_template": "/creditors/:identity",
- "url_params": {"identity": "CR123"},
- "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":null,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":"BA456","default_gbp_payout_account":null,"default_sek_payout_account":"BA789"},"name":"Nude Wines","postal_code":null,"region":null}}
- },
- "update": {
- "method": "PUT",
- "path_template": "/creditors/:identity",
- "url_params": {"identity": "CR123"},
- "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":null,"address_line3":"example address_line3 6159","city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":"BA456","default_gbp_payout_account":null,"default_sek_payout_account":"BA789"},"name":"Nude Wines","postal_code":null,"region":"example region 1957"}}
- }
-}
-
diff --git a/tests/GoCardlessPro/fixtures/customers.json b/tests/GoCardlessPro/fixtures/customers.json
deleted file mode 100644
index 7452b406..00000000
--- a/tests/GoCardlessPro/fixtures/customers.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "create": {
- "method": "POST",
- "path_template": "/customers",
- "url_params": {},
- "body": {"customers":{"address_line1":"221B Baker Street","address_line2":null,"address_line3":null,"city":null,"company_name":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":null,"metadata":{},"postal_code":null,"region":null,"swedish_identity_number":null}}
- },
- "list": {
- "method": "GET",
- "path_template": "/customers",
- "url_params": {},
- "body": {"customers":[{"address_line1":null,"address_line2":null,"address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":null,"family_name":null,"given_name":"Frank","id":"CU123","language":null,"metadata":{},"postal_code":"NW1 6XE","region":null,"swedish_identity_number":"556564-5404"},{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":null,"city":"London","company_name":"Hamilton Trading Ltd.","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":null,"family_name":"Osborne","given_name":null,"id":"CU123","language":null,"metadata":{},"postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":null}],"meta":{"cursors":{"after":"example after 8553","before":"example before 3098"},"limit":50}}
- },
- "get": {
- "method": "GET",
- "path_template": "/customers/:identity",
- "url_params": {"identity": "CU123"},
- "body": {"customers":{"address_line1":"221B Baker Street","address_line2":null,"address_line3":null,"city":"London","company_name":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":"user@example.com","family_name":null,"given_name":"Frank","id":"CU123","language":null,"metadata":{},"postal_code":null,"region":"Greater London","swedish_identity_number":"556564-5404"}}
- },
- "update": {
- "method": "PUT",
- "path_template": "/customers/:identity",
- "url_params": {"identity": "CU123"},
- "body": {"customers":{"address_line1":null,"address_line2":null,"address_line3":"City of Westminster","city":"London","company_name":null,"country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","email":null,"family_name":null,"given_name":null,"id":"CU123","language":"en","metadata":{},"postal_code":null,"region":"Greater London","swedish_identity_number":null}}
- }
-}
-
diff --git a/tests/Integration/BankDetailsLookupsIntegrationTest.php b/tests/Integration/BankDetailsLookupsIntegrationTest.php
new file mode 100644
index 00000000..25256974
--- /dev/null
+++ b/tests/Integration/BankDetailsLookupsIntegrationTest.php
@@ -0,0 +1,35 @@
+assertNotNull($obj);
+ }
+
+ public function testBankDetailsLookupsCreate()
+ {
+ $fixture = $this->load_fixture('bank_details_lookups')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->bankDetailsLookups();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->bank_details_lookups;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\BankDetailsLookup', $response);
+
+ $this->assertEquals($body->available_debit_schemes, $response->available_debit_schemes);
+ $this->assertEquals($body->bank_name, $response->bank_name);
+ $this->assertEquals($body->bic, $response->bic);
+
+ }
+
+}
diff --git a/tests/Integration/CreditorBankAccountsIntegrationTest.php b/tests/Integration/CreditorBankAccountsIntegrationTest.php
new file mode 100644
index 00000000..dd49de2d
--- /dev/null
+++ b/tests/Integration/CreditorBankAccountsIntegrationTest.php
@@ -0,0 +1,127 @@
+assertNotNull($obj);
+ }
+
+ public function testCreditorBankAccountsCreate()
+ {
+ $fixture = $this->load_fixture('creditor_bank_accounts')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->creditorBankAccounts();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->creditor_bank_accounts;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\CreditorBankAccount', $response);
+
+ $this->assertEquals($body->account_holder_name, $response->account_holder_name);
+ $this->assertEquals($body->account_number_ending, $response->account_number_ending);
+ $this->assertEquals($body->bank_name, $response->bank_name);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->enabled, $response->enabled);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+
+ }
+
+ public function testCreditorBankAccountsList()
+ {
+ $fixture = $this->load_fixture('creditor_bank_accounts')->list;
+ $this->stub_request($fixture);
+
+ $service = $this->client->creditorBankAccounts();
+ $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params);
+
+ $body = $fixture->body->creditor_bank_accounts;
+
+ $records = $response->records;
+ $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
+ $this->assertInstanceOf('\GoCardlessPro\Resources\CreditorBankAccount', $records[0]);
+
+ $this->assertEquals($fixture->body->meta->cursors->before, $response->before);
+ $this->assertEquals($fixture->body->meta->cursors->after, $response->after);
+
+
+
+ foreach (range(0, count($body) - 1) as $num) {
+ $record = $records[$num];
+ $this->assertEquals($body[$num]->account_holder_name, $record->account_holder_name);
+ $this->assertEquals($body[$num]->account_number_ending, $record->account_number_ending);
+ $this->assertEquals($body[$num]->bank_name, $record->bank_name);
+ $this->assertEquals($body[$num]->country_code, $record->country_code);
+ $this->assertEquals($body[$num]->created_at, $record->created_at);
+ $this->assertEquals($body[$num]->currency, $record->currency);
+ $this->assertEquals($body[$num]->enabled, $record->enabled);
+ $this->assertEquals($body[$num]->id, $record->id);
+ $this->assertEquals($body[$num]->links, $record->links);
+ $this->assertEquals($body[$num]->metadata, $record->metadata);
+
+ }
+ }
+
+ public function testCreditorBankAccountsGet()
+ {
+ $fixture = $this->load_fixture('creditor_bank_accounts')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->creditorBankAccounts();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->creditor_bank_accounts;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\CreditorBankAccount', $response);
+
+ $this->assertEquals($body->account_holder_name, $response->account_holder_name);
+ $this->assertEquals($body->account_number_ending, $response->account_number_ending);
+ $this->assertEquals($body->bank_name, $response->bank_name);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->enabled, $response->enabled);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+
+ }
+
+ public function testCreditorBankAccountsDisable()
+ {
+ $fixture = $this->load_fixture('creditor_bank_accounts')->disable;
+ $this->stub_request($fixture);
+
+ $service = $this->client->creditorBankAccounts();
+ $response = call_user_func_array(array($service, 'disable'), (array)$fixture->url_params);
+
+ $body = $fixture->body->creditor_bank_accounts;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\CreditorBankAccount', $response);
+
+ $this->assertEquals($body->account_holder_name, $response->account_holder_name);
+ $this->assertEquals($body->account_number_ending, $response->account_number_ending);
+ $this->assertEquals($body->bank_name, $response->bank_name);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->enabled, $response->enabled);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+
+ }
+
+}
diff --git a/tests/Integration/CreditorsIntegrationTest.php b/tests/Integration/CreditorsIntegrationTest.php
new file mode 100644
index 00000000..5b8fda45
--- /dev/null
+++ b/tests/Integration/CreditorsIntegrationTest.php
@@ -0,0 +1,131 @@
+assertNotNull($obj);
+ }
+
+ public function testCreditorsCreate()
+ {
+ $fixture = $this->load_fixture('creditors')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->creditors();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->creditors;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Creditor', $response);
+
+ $this->assertEquals($body->address_line1, $response->address_line1);
+ $this->assertEquals($body->address_line2, $response->address_line2);
+ $this->assertEquals($body->address_line3, $response->address_line3);
+ $this->assertEquals($body->city, $response->city);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->name, $response->name);
+ $this->assertEquals($body->postal_code, $response->postal_code);
+ $this->assertEquals($body->region, $response->region);
+
+ }
+
+ public function testCreditorsList()
+ {
+ $fixture = $this->load_fixture('creditors')->list;
+ $this->stub_request($fixture);
+
+ $service = $this->client->creditors();
+ $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params);
+
+ $body = $fixture->body->creditors;
+
+ $records = $response->records;
+ $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Creditor', $records[0]);
+
+ $this->assertEquals($fixture->body->meta->cursors->before, $response->before);
+ $this->assertEquals($fixture->body->meta->cursors->after, $response->after);
+
+
+
+ foreach (range(0, count($body) - 1) as $num) {
+ $record = $records[$num];
+ $this->assertEquals($body[$num]->address_line1, $record->address_line1);
+ $this->assertEquals($body[$num]->address_line2, $record->address_line2);
+ $this->assertEquals($body[$num]->address_line3, $record->address_line3);
+ $this->assertEquals($body[$num]->city, $record->city);
+ $this->assertEquals($body[$num]->country_code, $record->country_code);
+ $this->assertEquals($body[$num]->created_at, $record->created_at);
+ $this->assertEquals($body[$num]->id, $record->id);
+ $this->assertEquals($body[$num]->links, $record->links);
+ $this->assertEquals($body[$num]->name, $record->name);
+ $this->assertEquals($body[$num]->postal_code, $record->postal_code);
+ $this->assertEquals($body[$num]->region, $record->region);
+
+ }
+ }
+
+ public function testCreditorsGet()
+ {
+ $fixture = $this->load_fixture('creditors')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->creditors();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->creditors;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Creditor', $response);
+
+ $this->assertEquals($body->address_line1, $response->address_line1);
+ $this->assertEquals($body->address_line2, $response->address_line2);
+ $this->assertEquals($body->address_line3, $response->address_line3);
+ $this->assertEquals($body->city, $response->city);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->name, $response->name);
+ $this->assertEquals($body->postal_code, $response->postal_code);
+ $this->assertEquals($body->region, $response->region);
+
+ }
+
+ public function testCreditorsUpdate()
+ {
+ $fixture = $this->load_fixture('creditors')->update;
+ $this->stub_request($fixture);
+
+ $service = $this->client->creditors();
+ $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params);
+
+ $body = $fixture->body->creditors;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Creditor', $response);
+
+ $this->assertEquals($body->address_line1, $response->address_line1);
+ $this->assertEquals($body->address_line2, $response->address_line2);
+ $this->assertEquals($body->address_line3, $response->address_line3);
+ $this->assertEquals($body->city, $response->city);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->name, $response->name);
+ $this->assertEquals($body->postal_code, $response->postal_code);
+ $this->assertEquals($body->region, $response->region);
+
+ }
+
+}
diff --git a/tests/Integration/CustomerBankAccountsIntegrationTest.php b/tests/Integration/CustomerBankAccountsIntegrationTest.php
new file mode 100644
index 00000000..a9c907fa
--- /dev/null
+++ b/tests/Integration/CustomerBankAccountsIntegrationTest.php
@@ -0,0 +1,152 @@
+assertNotNull($obj);
+ }
+
+ public function testCustomerBankAccountsCreate()
+ {
+ $fixture = $this->load_fixture('customer_bank_accounts')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->customerBankAccounts();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->customer_bank_accounts;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\CustomerBankAccount', $response);
+
+ $this->assertEquals($body->account_holder_name, $response->account_holder_name);
+ $this->assertEquals($body->account_number_ending, $response->account_number_ending);
+ $this->assertEquals($body->bank_name, $response->bank_name);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->enabled, $response->enabled);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+
+ }
+
+ public function testCustomerBankAccountsList()
+ {
+ $fixture = $this->load_fixture('customer_bank_accounts')->list;
+ $this->stub_request($fixture);
+
+ $service = $this->client->customerBankAccounts();
+ $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params);
+
+ $body = $fixture->body->customer_bank_accounts;
+
+ $records = $response->records;
+ $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
+ $this->assertInstanceOf('\GoCardlessPro\Resources\CustomerBankAccount', $records[0]);
+
+ $this->assertEquals($fixture->body->meta->cursors->before, $response->before);
+ $this->assertEquals($fixture->body->meta->cursors->after, $response->after);
+
+
+
+ foreach (range(0, count($body) - 1) as $num) {
+ $record = $records[$num];
+ $this->assertEquals($body[$num]->account_holder_name, $record->account_holder_name);
+ $this->assertEquals($body[$num]->account_number_ending, $record->account_number_ending);
+ $this->assertEquals($body[$num]->bank_name, $record->bank_name);
+ $this->assertEquals($body[$num]->country_code, $record->country_code);
+ $this->assertEquals($body[$num]->created_at, $record->created_at);
+ $this->assertEquals($body[$num]->currency, $record->currency);
+ $this->assertEquals($body[$num]->enabled, $record->enabled);
+ $this->assertEquals($body[$num]->id, $record->id);
+ $this->assertEquals($body[$num]->links, $record->links);
+ $this->assertEquals($body[$num]->metadata, $record->metadata);
+
+ }
+ }
+
+ public function testCustomerBankAccountsGet()
+ {
+ $fixture = $this->load_fixture('customer_bank_accounts')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->customerBankAccounts();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->customer_bank_accounts;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\CustomerBankAccount', $response);
+
+ $this->assertEquals($body->account_holder_name, $response->account_holder_name);
+ $this->assertEquals($body->account_number_ending, $response->account_number_ending);
+ $this->assertEquals($body->bank_name, $response->bank_name);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->enabled, $response->enabled);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+
+ }
+
+ public function testCustomerBankAccountsUpdate()
+ {
+ $fixture = $this->load_fixture('customer_bank_accounts')->update;
+ $this->stub_request($fixture);
+
+ $service = $this->client->customerBankAccounts();
+ $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params);
+
+ $body = $fixture->body->customer_bank_accounts;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\CustomerBankAccount', $response);
+
+ $this->assertEquals($body->account_holder_name, $response->account_holder_name);
+ $this->assertEquals($body->account_number_ending, $response->account_number_ending);
+ $this->assertEquals($body->bank_name, $response->bank_name);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->enabled, $response->enabled);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+
+ }
+
+ public function testCustomerBankAccountsDisable()
+ {
+ $fixture = $this->load_fixture('customer_bank_accounts')->disable;
+ $this->stub_request($fixture);
+
+ $service = $this->client->customerBankAccounts();
+ $response = call_user_func_array(array($service, 'disable'), (array)$fixture->url_params);
+
+ $body = $fixture->body->customer_bank_accounts;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\CustomerBankAccount', $response);
+
+ $this->assertEquals($body->account_holder_name, $response->account_holder_name);
+ $this->assertEquals($body->account_number_ending, $response->account_number_ending);
+ $this->assertEquals($body->bank_name, $response->bank_name);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->enabled, $response->enabled);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+
+ }
+
+}
diff --git a/tests/Integration/CustomersIntegrationTest.php b/tests/Integration/CustomersIntegrationTest.php
new file mode 100644
index 00000000..9bc8c4d6
--- /dev/null
+++ b/tests/Integration/CustomersIntegrationTest.php
@@ -0,0 +1,151 @@
+assertNotNull($obj);
+ }
+
+ public function testCustomersCreate()
+ {
+ $fixture = $this->load_fixture('customers')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->customers();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->customers;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Customer', $response);
+
+ $this->assertEquals($body->address_line1, $response->address_line1);
+ $this->assertEquals($body->address_line2, $response->address_line2);
+ $this->assertEquals($body->address_line3, $response->address_line3);
+ $this->assertEquals($body->city, $response->city);
+ $this->assertEquals($body->company_name, $response->company_name);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->email, $response->email);
+ $this->assertEquals($body->family_name, $response->family_name);
+ $this->assertEquals($body->given_name, $response->given_name);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->language, $response->language);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->postal_code, $response->postal_code);
+ $this->assertEquals($body->region, $response->region);
+ $this->assertEquals($body->swedish_identity_number, $response->swedish_identity_number);
+
+ }
+
+ public function testCustomersList()
+ {
+ $fixture = $this->load_fixture('customers')->list;
+ $this->stub_request($fixture);
+
+ $service = $this->client->customers();
+ $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params);
+
+ $body = $fixture->body->customers;
+
+ $records = $response->records;
+ $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Customer', $records[0]);
+
+ $this->assertEquals($fixture->body->meta->cursors->before, $response->before);
+ $this->assertEquals($fixture->body->meta->cursors->after, $response->after);
+
+
+
+ foreach (range(0, count($body) - 1) as $num) {
+ $record = $records[$num];
+ $this->assertEquals($body[$num]->address_line1, $record->address_line1);
+ $this->assertEquals($body[$num]->address_line2, $record->address_line2);
+ $this->assertEquals($body[$num]->address_line3, $record->address_line3);
+ $this->assertEquals($body[$num]->city, $record->city);
+ $this->assertEquals($body[$num]->company_name, $record->company_name);
+ $this->assertEquals($body[$num]->country_code, $record->country_code);
+ $this->assertEquals($body[$num]->created_at, $record->created_at);
+ $this->assertEquals($body[$num]->email, $record->email);
+ $this->assertEquals($body[$num]->family_name, $record->family_name);
+ $this->assertEquals($body[$num]->given_name, $record->given_name);
+ $this->assertEquals($body[$num]->id, $record->id);
+ $this->assertEquals($body[$num]->language, $record->language);
+ $this->assertEquals($body[$num]->metadata, $record->metadata);
+ $this->assertEquals($body[$num]->postal_code, $record->postal_code);
+ $this->assertEquals($body[$num]->region, $record->region);
+ $this->assertEquals($body[$num]->swedish_identity_number, $record->swedish_identity_number);
+
+ }
+ }
+
+ public function testCustomersGet()
+ {
+ $fixture = $this->load_fixture('customers')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->customers();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->customers;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Customer', $response);
+
+ $this->assertEquals($body->address_line1, $response->address_line1);
+ $this->assertEquals($body->address_line2, $response->address_line2);
+ $this->assertEquals($body->address_line3, $response->address_line3);
+ $this->assertEquals($body->city, $response->city);
+ $this->assertEquals($body->company_name, $response->company_name);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->email, $response->email);
+ $this->assertEquals($body->family_name, $response->family_name);
+ $this->assertEquals($body->given_name, $response->given_name);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->language, $response->language);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->postal_code, $response->postal_code);
+ $this->assertEquals($body->region, $response->region);
+ $this->assertEquals($body->swedish_identity_number, $response->swedish_identity_number);
+
+ }
+
+ public function testCustomersUpdate()
+ {
+ $fixture = $this->load_fixture('customers')->update;
+ $this->stub_request($fixture);
+
+ $service = $this->client->customers();
+ $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params);
+
+ $body = $fixture->body->customers;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Customer', $response);
+
+ $this->assertEquals($body->address_line1, $response->address_line1);
+ $this->assertEquals($body->address_line2, $response->address_line2);
+ $this->assertEquals($body->address_line3, $response->address_line3);
+ $this->assertEquals($body->city, $response->city);
+ $this->assertEquals($body->company_name, $response->company_name);
+ $this->assertEquals($body->country_code, $response->country_code);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->email, $response->email);
+ $this->assertEquals($body->family_name, $response->family_name);
+ $this->assertEquals($body->given_name, $response->given_name);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->language, $response->language);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->postal_code, $response->postal_code);
+ $this->assertEquals($body->region, $response->region);
+ $this->assertEquals($body->swedish_identity_number, $response->swedish_identity_number);
+
+ }
+
+}
diff --git a/tests/Integration/EventsIntegrationTest.php b/tests/Integration/EventsIntegrationTest.php
new file mode 100644
index 00000000..6bb20c71
--- /dev/null
+++ b/tests/Integration/EventsIntegrationTest.php
@@ -0,0 +1,71 @@
+assertNotNull($obj);
+ }
+
+ public function testEventsList()
+ {
+ $fixture = $this->load_fixture('events')->list;
+ $this->stub_request($fixture);
+
+ $service = $this->client->events();
+ $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params);
+
+ $body = $fixture->body->events;
+
+ $records = $response->records;
+ $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Event', $records[0]);
+
+ $this->assertEquals($fixture->body->meta->cursors->before, $response->before);
+ $this->assertEquals($fixture->body->meta->cursors->after, $response->after);
+
+
+
+ foreach (range(0, count($body) - 1) as $num) {
+ $record = $records[$num];
+ $this->assertEquals($body[$num]->action, $record->action);
+ $this->assertEquals($body[$num]->created_at, $record->created_at);
+ $this->assertEquals($body[$num]->details, $record->details);
+ $this->assertEquals($body[$num]->id, $record->id);
+ $this->assertEquals($body[$num]->links, $record->links);
+ $this->assertEquals($body[$num]->metadata, $record->metadata);
+ $this->assertEquals($body[$num]->resource_type, $record->resource_type);
+
+ }
+ }
+
+ public function testEventsGet()
+ {
+ $fixture = $this->load_fixture('events')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->events();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->events;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Event', $response);
+
+ $this->assertEquals($body->action, $response->action);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->details, $response->details);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->resource_type, $response->resource_type);
+
+ }
+
+}
diff --git a/tests/Integration/IntegrationTestBase.php b/tests/Integration/IntegrationTestBase.php
new file mode 100644
index 00000000..203fbd5e
--- /dev/null
+++ b/tests/Integration/IntegrationTestBase.php
@@ -0,0 +1,47 @@
+mock_http_client = $this->getMock('\GuzzleHttp\ClientInterface');
+ $this->client = new \GoCardlessPro\Client(
+ array(
+ 'access_token' => 'foobar',
+ 'environment' => Environment::LIVE,
+ 'http_client' => $this->mock_http_client
+ )
+ );
+ }
+
+ public function tearDown()
+ {
+ }
+
+ public function load_fixture($filename)
+ {
+ $json_fixture_path = "./tests/fixtures/$filename.json";
+ return json_decode(file_get_contents($json_fixture_path));
+ }
+
+ public function stub_request($resource_fixture)
+ {
+ $path = preg_replace("/:(\w+)/", "\w+", $resource_fixture->path_template);
+ $path_regexp = "|" . str_replace("\\\\w\+", "\w+", preg_quote($path)) . "|";
+ $json_body = json_encode($resource_fixture->body);
+ $response = new \GuzzleHttp\Psr7\Response(200, [], $json_body);
+ $this->mock_http_client
+ ->method('request')//$resource_fixture->method)
+ ->with($resource_fixture->method, $this->matchesRegularExpression($path_regexp), $this->anything())
+ ->willReturn($response);
+ }
+}
diff --git a/tests/Integration/MandatePdfsIntegrationTest.php b/tests/Integration/MandatePdfsIntegrationTest.php
new file mode 100644
index 00000000..d918e1cd
--- /dev/null
+++ b/tests/Integration/MandatePdfsIntegrationTest.php
@@ -0,0 +1,34 @@
+assertNotNull($obj);
+ }
+
+ public function testMandatePdfsCreate()
+ {
+ $fixture = $this->load_fixture('mandate_pdfs')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->mandatePdfs();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->mandate_pdfs;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\MandatePdf', $response);
+
+ $this->assertEquals($body->expires_at, $response->expires_at);
+ $this->assertEquals($body->url, $response->url);
+
+ }
+
+}
diff --git a/tests/Integration/MandatesIntegrationTest.php b/tests/Integration/MandatesIntegrationTest.php
new file mode 100644
index 00000000..9ac7a69b
--- /dev/null
+++ b/tests/Integration/MandatesIntegrationTest.php
@@ -0,0 +1,165 @@
+assertNotNull($obj);
+ }
+
+ public function testMandatesCreate()
+ {
+ $fixture = $this->load_fixture('mandates')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->mandates();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->mandates;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $response);
+
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->next_possible_charge_date, $response->next_possible_charge_date);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->scheme, $response->scheme);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+ public function testMandatesList()
+ {
+ $fixture = $this->load_fixture('mandates')->list;
+ $this->stub_request($fixture);
+
+ $service = $this->client->mandates();
+ $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params);
+
+ $body = $fixture->body->mandates;
+
+ $records = $response->records;
+ $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $records[0]);
+
+ $this->assertEquals($fixture->body->meta->cursors->before, $response->before);
+ $this->assertEquals($fixture->body->meta->cursors->after, $response->after);
+
+
+
+ foreach (range(0, count($body) - 1) as $num) {
+ $record = $records[$num];
+ $this->assertEquals($body[$num]->created_at, $record->created_at);
+ $this->assertEquals($body[$num]->id, $record->id);
+ $this->assertEquals($body[$num]->links, $record->links);
+ $this->assertEquals($body[$num]->metadata, $record->metadata);
+ $this->assertEquals($body[$num]->next_possible_charge_date, $record->next_possible_charge_date);
+ $this->assertEquals($body[$num]->reference, $record->reference);
+ $this->assertEquals($body[$num]->scheme, $record->scheme);
+ $this->assertEquals($body[$num]->status, $record->status);
+
+ }
+ }
+
+ public function testMandatesGet()
+ {
+ $fixture = $this->load_fixture('mandates')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->mandates();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->mandates;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $response);
+
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->next_possible_charge_date, $response->next_possible_charge_date);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->scheme, $response->scheme);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+ public function testMandatesUpdate()
+ {
+ $fixture = $this->load_fixture('mandates')->update;
+ $this->stub_request($fixture);
+
+ $service = $this->client->mandates();
+ $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params);
+
+ $body = $fixture->body->mandates;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $response);
+
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->next_possible_charge_date, $response->next_possible_charge_date);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->scheme, $response->scheme);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+ public function testMandatesCancel()
+ {
+ $fixture = $this->load_fixture('mandates')->cancel;
+ $this->stub_request($fixture);
+
+ $service = $this->client->mandates();
+ $response = call_user_func_array(array($service, 'cancel'), (array)$fixture->url_params);
+
+ $body = $fixture->body->mandates;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $response);
+
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->next_possible_charge_date, $response->next_possible_charge_date);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->scheme, $response->scheme);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+ public function testMandatesReinstate()
+ {
+ $fixture = $this->load_fixture('mandates')->reinstate;
+ $this->stub_request($fixture);
+
+ $service = $this->client->mandates();
+ $response = call_user_func_array(array($service, 'reinstate'), (array)$fixture->url_params);
+
+ $body = $fixture->body->mandates;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Mandate', $response);
+
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->next_possible_charge_date, $response->next_possible_charge_date);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->scheme, $response->scheme);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+}
diff --git a/tests/Integration/PaymentsIntegrationTest.php b/tests/Integration/PaymentsIntegrationTest.php
new file mode 100644
index 00000000..ab388c4c
--- /dev/null
+++ b/tests/Integration/PaymentsIntegrationTest.php
@@ -0,0 +1,183 @@
+assertNotNull($obj);
+ }
+
+ public function testPaymentsCreate()
+ {
+ $fixture = $this->load_fixture('payments')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->payments();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->payments;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->amount_refunded, $response->amount_refunded);
+ $this->assertEquals($body->charge_date, $response->charge_date);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->description, $response->description);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+ public function testPaymentsList()
+ {
+ $fixture = $this->load_fixture('payments')->list;
+ $this->stub_request($fixture);
+
+ $service = $this->client->payments();
+ $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params);
+
+ $body = $fixture->body->payments;
+
+ $records = $response->records;
+ $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $records[0]);
+
+ $this->assertEquals($fixture->body->meta->cursors->before, $response->before);
+ $this->assertEquals($fixture->body->meta->cursors->after, $response->after);
+
+
+
+ foreach (range(0, count($body) - 1) as $num) {
+ $record = $records[$num];
+ $this->assertEquals($body[$num]->amount, $record->amount);
+ $this->assertEquals($body[$num]->amount_refunded, $record->amount_refunded);
+ $this->assertEquals($body[$num]->charge_date, $record->charge_date);
+ $this->assertEquals($body[$num]->created_at, $record->created_at);
+ $this->assertEquals($body[$num]->currency, $record->currency);
+ $this->assertEquals($body[$num]->description, $record->description);
+ $this->assertEquals($body[$num]->id, $record->id);
+ $this->assertEquals($body[$num]->links, $record->links);
+ $this->assertEquals($body[$num]->metadata, $record->metadata);
+ $this->assertEquals($body[$num]->reference, $record->reference);
+ $this->assertEquals($body[$num]->status, $record->status);
+
+ }
+ }
+
+ public function testPaymentsGet()
+ {
+ $fixture = $this->load_fixture('payments')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->payments();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->payments;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->amount_refunded, $response->amount_refunded);
+ $this->assertEquals($body->charge_date, $response->charge_date);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->description, $response->description);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+ public function testPaymentsUpdate()
+ {
+ $fixture = $this->load_fixture('payments')->update;
+ $this->stub_request($fixture);
+
+ $service = $this->client->payments();
+ $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params);
+
+ $body = $fixture->body->payments;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->amount_refunded, $response->amount_refunded);
+ $this->assertEquals($body->charge_date, $response->charge_date);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->description, $response->description);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+ public function testPaymentsCancel()
+ {
+ $fixture = $this->load_fixture('payments')->cancel;
+ $this->stub_request($fixture);
+
+ $service = $this->client->payments();
+ $response = call_user_func_array(array($service, 'cancel'), (array)$fixture->url_params);
+
+ $body = $fixture->body->payments;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->amount_refunded, $response->amount_refunded);
+ $this->assertEquals($body->charge_date, $response->charge_date);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->description, $response->description);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+ public function testPaymentsRetry()
+ {
+ $fixture = $this->load_fixture('payments')->retry;
+ $this->stub_request($fixture);
+
+ $service = $this->client->payments();
+ $response = call_user_func_array(array($service, 'retry'), (array)$fixture->url_params);
+
+ $body = $fixture->body->payments;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Payment', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->amount_refunded, $response->amount_refunded);
+ $this->assertEquals($body->charge_date, $response->charge_date);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->description, $response->description);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+}
diff --git a/tests/Integration/PayoutsIntegrationTest.php b/tests/Integration/PayoutsIntegrationTest.php
new file mode 100644
index 00000000..932aa31d
--- /dev/null
+++ b/tests/Integration/PayoutsIntegrationTest.php
@@ -0,0 +1,71 @@
+assertNotNull($obj);
+ }
+
+ public function testPayoutsList()
+ {
+ $fixture = $this->load_fixture('payouts')->list;
+ $this->stub_request($fixture);
+
+ $service = $this->client->payouts();
+ $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params);
+
+ $body = $fixture->body->payouts;
+
+ $records = $response->records;
+ $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Payout', $records[0]);
+
+ $this->assertEquals($fixture->body->meta->cursors->before, $response->before);
+ $this->assertEquals($fixture->body->meta->cursors->after, $response->after);
+
+
+
+ foreach (range(0, count($body) - 1) as $num) {
+ $record = $records[$num];
+ $this->assertEquals($body[$num]->amount, $record->amount);
+ $this->assertEquals($body[$num]->created_at, $record->created_at);
+ $this->assertEquals($body[$num]->currency, $record->currency);
+ $this->assertEquals($body[$num]->id, $record->id);
+ $this->assertEquals($body[$num]->links, $record->links);
+ $this->assertEquals($body[$num]->reference, $record->reference);
+ $this->assertEquals($body[$num]->status, $record->status);
+
+ }
+ }
+
+ public function testPayoutsGet()
+ {
+ $fixture = $this->load_fixture('payouts')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->payouts();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->payouts;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Payout', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->reference, $response->reference);
+ $this->assertEquals($body->status, $response->status);
+
+ }
+
+}
diff --git a/tests/Integration/RedirectFlowsIntegrationTest.php b/tests/Integration/RedirectFlowsIntegrationTest.php
new file mode 100644
index 00000000..dc2a7c4a
--- /dev/null
+++ b/tests/Integration/RedirectFlowsIntegrationTest.php
@@ -0,0 +1,86 @@
+assertNotNull($obj);
+ }
+
+ public function testRedirectFlowsCreate()
+ {
+ $fixture = $this->load_fixture('redirect_flows')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->redirectFlows();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->redirect_flows;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\RedirectFlow', $response);
+
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->description, $response->description);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->redirect_url, $response->redirect_url);
+ $this->assertEquals($body->scheme, $response->scheme);
+ $this->assertEquals($body->session_token, $response->session_token);
+ $this->assertEquals($body->success_redirect_url, $response->success_redirect_url);
+
+ }
+
+ public function testRedirectFlowsGet()
+ {
+ $fixture = $this->load_fixture('redirect_flows')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->redirectFlows();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->redirect_flows;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\RedirectFlow', $response);
+
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->description, $response->description);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->redirect_url, $response->redirect_url);
+ $this->assertEquals($body->scheme, $response->scheme);
+ $this->assertEquals($body->session_token, $response->session_token);
+ $this->assertEquals($body->success_redirect_url, $response->success_redirect_url);
+
+ }
+
+ public function testRedirectFlowsComplete()
+ {
+ $fixture = $this->load_fixture('redirect_flows')->complete;
+ $this->stub_request($fixture);
+
+ $service = $this->client->redirectFlows();
+ $response = call_user_func_array(array($service, 'complete'), (array)$fixture->url_params);
+
+ $body = $fixture->body->redirect_flows;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\RedirectFlow', $response);
+
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->description, $response->description);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->redirect_url, $response->redirect_url);
+ $this->assertEquals($body->scheme, $response->scheme);
+ $this->assertEquals($body->session_token, $response->session_token);
+ $this->assertEquals($body->success_redirect_url, $response->success_redirect_url);
+
+ }
+
+}
diff --git a/tests/Integration/RefundsIntegrationTest.php b/tests/Integration/RefundsIntegrationTest.php
new file mode 100644
index 00000000..a6c2c023
--- /dev/null
+++ b/tests/Integration/RefundsIntegrationTest.php
@@ -0,0 +1,115 @@
+assertNotNull($obj);
+ }
+
+ public function testRefundsCreate()
+ {
+ $fixture = $this->load_fixture('refunds')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->refunds();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->refunds;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Refund', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->reference, $response->reference);
+
+ }
+
+ public function testRefundsList()
+ {
+ $fixture = $this->load_fixture('refunds')->list;
+ $this->stub_request($fixture);
+
+ $service = $this->client->refunds();
+ $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params);
+
+ $body = $fixture->body->refunds;
+
+ $records = $response->records;
+ $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Refund', $records[0]);
+
+ $this->assertEquals($fixture->body->meta->cursors->before, $response->before);
+ $this->assertEquals($fixture->body->meta->cursors->after, $response->after);
+
+
+
+ foreach (range(0, count($body) - 1) as $num) {
+ $record = $records[$num];
+ $this->assertEquals($body[$num]->amount, $record->amount);
+ $this->assertEquals($body[$num]->created_at, $record->created_at);
+ $this->assertEquals($body[$num]->currency, $record->currency);
+ $this->assertEquals($body[$num]->id, $record->id);
+ $this->assertEquals($body[$num]->links, $record->links);
+ $this->assertEquals($body[$num]->metadata, $record->metadata);
+ $this->assertEquals($body[$num]->reference, $record->reference);
+
+ }
+ }
+
+ public function testRefundsGet()
+ {
+ $fixture = $this->load_fixture('refunds')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->refunds();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->refunds;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Refund', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->reference, $response->reference);
+
+ }
+
+ public function testRefundsUpdate()
+ {
+ $fixture = $this->load_fixture('refunds')->update;
+ $this->stub_request($fixture);
+
+ $service = $this->client->refunds();
+ $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params);
+
+ $body = $fixture->body->refunds;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Refund', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->reference, $response->reference);
+
+ }
+
+}
diff --git a/tests/Integration/SubscriptionsIntegrationTest.php b/tests/Integration/SubscriptionsIntegrationTest.php
new file mode 100644
index 00000000..794534ef
--- /dev/null
+++ b/tests/Integration/SubscriptionsIntegrationTest.php
@@ -0,0 +1,187 @@
+assertNotNull($obj);
+ }
+
+ public function testSubscriptionsCreate()
+ {
+ $fixture = $this->load_fixture('subscriptions')->create;
+ $this->stub_request($fixture);
+
+ $service = $this->client->subscriptions();
+ $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params);
+
+ $body = $fixture->body->subscriptions;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Subscription', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->count, $response->count);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->day_of_month, $response->day_of_month);
+ $this->assertEquals($body->end_date, $response->end_date);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->interval, $response->interval);
+ $this->assertEquals($body->interval_unit, $response->interval_unit);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->month, $response->month);
+ $this->assertEquals($body->name, $response->name);
+ $this->assertEquals($body->payment_reference, $response->payment_reference);
+ $this->assertEquals($body->start_date, $response->start_date);
+ $this->assertEquals($body->status, $response->status);
+ $this->assertEquals($body->upcoming_payments, $response->upcoming_payments);
+
+ }
+
+ public function testSubscriptionsList()
+ {
+ $fixture = $this->load_fixture('subscriptions')->list;
+ $this->stub_request($fixture);
+
+ $service = $this->client->subscriptions();
+ $response = call_user_func_array(array($service, 'list'), (array)$fixture->url_params);
+
+ $body = $fixture->body->subscriptions;
+
+ $records = $response->records;
+ $this->assertInstanceOf('\GoCardlessPro\Core\ListResponse', $response);
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Subscription', $records[0]);
+
+ $this->assertEquals($fixture->body->meta->cursors->before, $response->before);
+ $this->assertEquals($fixture->body->meta->cursors->after, $response->after);
+
+
+
+ foreach (range(0, count($body) - 1) as $num) {
+ $record = $records[$num];
+ $this->assertEquals($body[$num]->amount, $record->amount);
+ $this->assertEquals($body[$num]->count, $record->count);
+ $this->assertEquals($body[$num]->created_at, $record->created_at);
+ $this->assertEquals($body[$num]->currency, $record->currency);
+ $this->assertEquals($body[$num]->day_of_month, $record->day_of_month);
+ $this->assertEquals($body[$num]->end_date, $record->end_date);
+ $this->assertEquals($body[$num]->id, $record->id);
+ $this->assertEquals($body[$num]->interval, $record->interval);
+ $this->assertEquals($body[$num]->interval_unit, $record->interval_unit);
+ $this->assertEquals($body[$num]->links, $record->links);
+ $this->assertEquals($body[$num]->metadata, $record->metadata);
+ $this->assertEquals($body[$num]->month, $record->month);
+ $this->assertEquals($body[$num]->name, $record->name);
+ $this->assertEquals($body[$num]->payment_reference, $record->payment_reference);
+ $this->assertEquals($body[$num]->start_date, $record->start_date);
+ $this->assertEquals($body[$num]->status, $record->status);
+ $this->assertEquals($body[$num]->upcoming_payments, $record->upcoming_payments);
+
+ }
+ }
+
+ public function testSubscriptionsGet()
+ {
+ $fixture = $this->load_fixture('subscriptions')->get;
+ $this->stub_request($fixture);
+
+ $service = $this->client->subscriptions();
+ $response = call_user_func_array(array($service, 'get'), (array)$fixture->url_params);
+
+ $body = $fixture->body->subscriptions;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Subscription', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->count, $response->count);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->day_of_month, $response->day_of_month);
+ $this->assertEquals($body->end_date, $response->end_date);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->interval, $response->interval);
+ $this->assertEquals($body->interval_unit, $response->interval_unit);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->month, $response->month);
+ $this->assertEquals($body->name, $response->name);
+ $this->assertEquals($body->payment_reference, $response->payment_reference);
+ $this->assertEquals($body->start_date, $response->start_date);
+ $this->assertEquals($body->status, $response->status);
+ $this->assertEquals($body->upcoming_payments, $response->upcoming_payments);
+
+ }
+
+ public function testSubscriptionsUpdate()
+ {
+ $fixture = $this->load_fixture('subscriptions')->update;
+ $this->stub_request($fixture);
+
+ $service = $this->client->subscriptions();
+ $response = call_user_func_array(array($service, 'update'), (array)$fixture->url_params);
+
+ $body = $fixture->body->subscriptions;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Subscription', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->count, $response->count);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->day_of_month, $response->day_of_month);
+ $this->assertEquals($body->end_date, $response->end_date);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->interval, $response->interval);
+ $this->assertEquals($body->interval_unit, $response->interval_unit);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->month, $response->month);
+ $this->assertEquals($body->name, $response->name);
+ $this->assertEquals($body->payment_reference, $response->payment_reference);
+ $this->assertEquals($body->start_date, $response->start_date);
+ $this->assertEquals($body->status, $response->status);
+ $this->assertEquals($body->upcoming_payments, $response->upcoming_payments);
+
+ }
+
+ public function testSubscriptionsCancel()
+ {
+ $fixture = $this->load_fixture('subscriptions')->cancel;
+ $this->stub_request($fixture);
+
+ $service = $this->client->subscriptions();
+ $response = call_user_func_array(array($service, 'cancel'), (array)$fixture->url_params);
+
+ $body = $fixture->body->subscriptions;
+
+ $this->assertInstanceOf('\GoCardlessPro\Resources\Subscription', $response);
+
+ $this->assertEquals($body->amount, $response->amount);
+ $this->assertEquals($body->count, $response->count);
+ $this->assertEquals($body->created_at, $response->created_at);
+ $this->assertEquals($body->currency, $response->currency);
+ $this->assertEquals($body->day_of_month, $response->day_of_month);
+ $this->assertEquals($body->end_date, $response->end_date);
+ $this->assertEquals($body->id, $response->id);
+ $this->assertEquals($body->interval, $response->interval);
+ $this->assertEquals($body->interval_unit, $response->interval_unit);
+ $this->assertEquals($body->links, $response->links);
+ $this->assertEquals($body->metadata, $response->metadata);
+ $this->assertEquals($body->month, $response->month);
+ $this->assertEquals($body->name, $response->name);
+ $this->assertEquals($body->payment_reference, $response->payment_reference);
+ $this->assertEquals($body->start_date, $response->start_date);
+ $this->assertEquals($body->status, $response->status);
+ $this->assertEquals($body->upcoming_payments, $response->upcoming_payments);
+
+ }
+
+}
diff --git a/tests/Resources/ResourceTest.php b/tests/Resources/ResourceTest.php
new file mode 100644
index 00000000..dbe0013a
--- /dev/null
+++ b/tests/Resources/ResourceTest.php
@@ -0,0 +1,53 @@
+ 'bar'));
+
+ $this->assertEquals('bar', $resource->foo);
+ }
+
+ public function testValidNestedGetter()
+ {
+ $fake_data = (object) array("links" => (object) array("one" => 1));
+ $resource = new FakeResource($fake_data);
+
+ $this->assertEquals(1, $resource->links->one);
+ }
+
+ /**
+ * @expectedException GoCardlessPro\Core\Exception\GoCardlessProException
+ * @expectedExceptionMessage unknown is not a valid FakeResource property
+ */
+ public function testInvalidGetter()
+ {
+ $resource = new FakeResource((object) array('foo' => 'bar'));
+ $resource->unknown;
+ }
+
+ public function testGetApiResponse()
+ {
+ $mockResponse = $this
+ ->getMockBuilder('\GoCardlessPro\Core\ApiResponse')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $resource = new FakeResource((object) array('foo' => 'bar'), $mockResponse);
+ $this->assertEquals($mockResponse, $resource->api_response);
+ }
+}
diff --git a/tests/GoCardlessPro/fixtures/bank_details_lookups.json b/tests/fixtures/bank_details_lookups.json
similarity index 100%
rename from tests/GoCardlessPro/fixtures/bank_details_lookups.json
rename to tests/fixtures/bank_details_lookups.json
diff --git a/tests/GoCardlessPro/fixtures/creditor_bank_accounts.json b/tests/fixtures/creditor_bank_accounts.json
similarity index 91%
rename from tests/GoCardlessPro/fixtures/creditor_bank_accounts.json
rename to tests/fixtures/creditor_bank_accounts.json
index 9835cbfa..e56446c4 100644
--- a/tests/GoCardlessPro/fixtures/creditor_bank_accounts.json
+++ b/tests/fixtures/creditor_bank_accounts.json
@@ -3,13 +3,13 @@
"method": "POST",
"path_template": "/creditor_bank_accounts",
"url_params": {},
- "body": {"creditor_bank_accounts":{"account_holder_name":"Nude Wines","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}}
+ "body": {"creditor_bank_accounts":{"account_holder_name":"Nude Wines","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}}
},
"list": {
"method": "GET",
"path_template": "/creditor_bank_accounts",
"url_params": {},
- "body": {"creditor_bank_accounts":[{"account_holder_name":"Nude Wines","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}},{"account_holder_name":"Nude Wines","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}],"meta":{"cursors":{"after":"example after 9828","before":"example before 5561"},"limit":50}}
+ "body": {"creditor_bank_accounts":[{"account_holder_name":"Nude Wines","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}},{"account_holder_name":"Nude Wines","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}],"meta":{"cursors":{"after":"example after 7202","before":"example before 5561"},"limit":50}}
},
"get": {
"method": "GET",
@@ -21,7 +21,7 @@
"method": "POST",
"path_template": "/creditor_bank_accounts/:identity/actions/disable",
"url_params": {"identity": "BA123"},
- "body": {"creditor_bank_accounts":{"account_holder_name":"Nude Wines","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}}
+ "body": {"creditor_bank_accounts":{"account_holder_name":"Nude Wines","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}}
}
}
diff --git a/tests/fixtures/creditors.json b/tests/fixtures/creditors.json
new file mode 100644
index 00000000..d8463f00
--- /dev/null
+++ b/tests/fixtures/creditors.json
@@ -0,0 +1,27 @@
+{
+ "create": {
+ "method": "POST",
+ "path_template": "/creditors",
+ "url_params": {},
+ "body": {"creditors":{"address_line1":null,"address_line2":"Islington","address_line3":"example address_line3 1318","city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_sek_payout_account":"BA789"},"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 694"}}
+ },
+ "list": {
+ "method": "GET",
+ "path_template": "/creditors",
+ "url_params": {},
+ "body": {"creditors":[{"address_line1":null,"address_line2":"Islington","address_line3":"example address_line3 3237","city":null,"country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":"BA456","default_gbp_payout_account":"BA123","default_sek_payout_account":"BA789"},"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 9947"},{"address_line1":null,"address_line2":"Islington","address_line3":"example address_line3 7387","city":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":"BA456","default_gbp_payout_account":null,"default_sek_payout_account":null},"name":"Nude Wines","postal_code":null,"region":null}],"meta":{"cursors":{"after":"example after 1485","before":"example before 631"},"limit":50}}
+ },
+ "get": {
+ "method": "GET",
+ "path_template": "/creditors/:identity",
+ "url_params": {"identity": "CR123"},
+ "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":null,"city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":"BA456","default_gbp_payout_account":"BA123","default_sek_payout_account":null},"name":"Nude Wines","postal_code":"EC1V 7LQ","region":null}}
+ },
+ "update": {
+ "method": "PUT",
+ "path_template": "/creditors/:identity",
+ "url_params": {"identity": "CR123"},
+ "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":null,"city":null,"country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_sek_payout_account":"BA789"},"name":"Nude Wines","postal_code":null,"region":"example region 9355"}}
+ }
+}
+
diff --git a/tests/GoCardlessPro/fixtures/customer_bank_accounts.json b/tests/fixtures/customer_bank_accounts.json
similarity index 80%
rename from tests/GoCardlessPro/fixtures/customer_bank_accounts.json
rename to tests/fixtures/customer_bank_accounts.json
index 73f80cfc..2b2935ed 100644
--- a/tests/GoCardlessPro/fixtures/customer_bank_accounts.json
+++ b/tests/fixtures/customer_bank_accounts.json
@@ -9,7 +9,7 @@
"method": "GET",
"path_template": "/customer_bank_accounts",
"url_params": {},
- "body": {"customer_bank_accounts":[{"account_holder_name":"Billy Jean","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"customer":"example customer 1224"},"metadata":{}},{"account_holder_name":"Billy Jean","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","enabled":true,"id":"BA123","links":{"customer":"example customer 1532"},"metadata":{}}],"meta":{"cursors":{"after":"example after 7839","before":"example before 3616"},"limit":50}}
+ "body": {"customer_bank_accounts":[{"account_holder_name":"Billy Jean","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","enabled":true,"id":"BA123","links":{"customer":"example customer 1532"},"metadata":{}},{"account_holder_name":"Billy Jean","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"customer":"example customer 7839"},"metadata":{}}],"meta":{"cursors":{"after":"example after 3612","before":"example before 4547"},"limit":50}}
},
"get": {
"method": "GET",
@@ -21,13 +21,13 @@
"method": "PUT",
"path_template": "/customer_bank_accounts/:identity",
"url_params": {"identity": "BA123"},
- "body": {"customer_bank_accounts":{"account_holder_name":"Billy Jean","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"customer":"example customer 7051"},"metadata":{}}}
+ "body": {"customer_bank_accounts":{"account_holder_name":"Billy Jean","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"customer":"example customer 3640"},"metadata":{}}}
},
"disable": {
"method": "POST",
"path_template": "/customer_bank_accounts/:identity/actions/disable",
"url_params": {"identity": "BA123"},
- "body": {"customer_bank_accounts":{"account_holder_name":"Billy Jean","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"customer":"example customer 3640"},"metadata":{}}}
+ "body": {"customer_bank_accounts":{"account_holder_name":"Billy Jean","account_number_ending":"11","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"customer":"example customer 8844"},"metadata":{}}}
}
}
diff --git a/tests/fixtures/customers.json b/tests/fixtures/customers.json
new file mode 100644
index 00000000..03e7a77c
--- /dev/null
+++ b/tests/fixtures/customers.json
@@ -0,0 +1,27 @@
+{
+ "create": {
+ "method": "POST",
+ "path_template": "/customers",
+ "url_params": {},
+ "body": {"customers":{"address_line1":null,"address_line2":null,"address_line3":null,"city":"London","company_name":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":"user@example.com","family_name":null,"given_name":null,"id":"CU123","language":null,"metadata":{},"postal_code":"NW1 6XE","region":null,"swedish_identity_number":null}}
+ },
+ "list": {
+ "method": "GET",
+ "path_template": "/customers",
+ "url_params": {},
+ "body": {"customers":[{"address_line1":null,"address_line2":"Marylebone","address_line3":"City of Westminster","city":null,"company_name":null,"country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"postal_code":"NW1 6XE","region":null,"swedish_identity_number":null},{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":null,"city":"London","company_name":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":"user@example.com","family_name":null,"given_name":null,"id":"CU123","language":"en","metadata":{},"postal_code":"NW1 6XE","region":null,"swedish_identity_number":null}],"meta":{"cursors":{"after":"example after 59","before":"example before 3033"},"limit":50}}
+ },
+ "get": {
+ "method": "GET",
+ "path_template": "/customers/:identity",
+ "url_params": {"identity": "CU123"},
+ "body": {"customers":{"address_line1":"221B Baker Street","address_line2":null,"address_line3":"City of Westminster","city":null,"company_name":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":null,"family_name":null,"given_name":"Frank","id":"CU123","language":null,"metadata":{},"postal_code":null,"region":"Greater London","swedish_identity_number":"556564-5404"}}
+ },
+ "update": {
+ "method": "PUT",
+ "path_template": "/customers/:identity",
+ "url_params": {"identity": "CU123"},
+ "body": {"customers":{"address_line1":"221B Baker Street","address_line2":null,"address_line3":"City of Westminster","city":null,"company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","email":null,"family_name":null,"given_name":null,"id":"CU123","language":"en","metadata":{},"postal_code":null,"region":"Greater London","swedish_identity_number":null}}
+ }
+}
+
diff --git a/tests/GoCardlessPro/fixtures/events.json b/tests/fixtures/events.json
similarity index 94%
rename from tests/GoCardlessPro/fixtures/events.json
rename to tests/fixtures/events.json
index fc9ce542..5fb94490 100644
--- a/tests/GoCardlessPro/fixtures/events.json
+++ b/tests/fixtures/events.json
@@ -3,7 +3,7 @@
"method": "GET",
"path_template": "/events",
"url_params": {},
- "body": {"events":[{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","details":{"cause":"bank_account_disabled","description":"Customer's bank account closed","origin":"bank","reason_code":"ADDACS-B","scheme":"bacs"},"id":"EV123","links":{"mandate":"MD123","new_customer_bank_account":"BA123","parent_event":"EV123","payment":"PM123","payout":"PO123","previous_customer_bank_account":"BA123","refund":"RF123","subscription":"SB123"},"metadata":{},"resource_type":"mandates"},{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","details":{"cause":"bank_account_disabled","description":"Customer's bank account closed","origin":"bank","reason_code":"ADDACS-B","scheme":"bacs"},"id":"EV123","links":{"mandate":"MD123","new_customer_bank_account":"BA123","parent_event":"EV123","payment":"PM123","payout":"PO123","previous_customer_bank_account":"BA123","refund":"RF123","subscription":"SB123"},"metadata":{},"resource_type":"mandates"}],"meta":{"cursors":{"after":"example after 364","before":"example before 8844"},"limit":50}}
+ "body": {"events":[{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","details":{"cause":"bank_account_disabled","description":"Customer's bank account closed","origin":"bank","reason_code":"ADDACS-B","scheme":"bacs"},"id":"EV123","links":{"mandate":"MD123","new_customer_bank_account":"BA123","parent_event":"EV123","payment":"PM123","payout":"PO123","previous_customer_bank_account":"BA123","refund":"RF123","subscription":"SB123"},"metadata":{},"resource_type":"mandates"},{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","details":{"cause":"bank_account_disabled","description":"Customer's bank account closed","origin":"bank","reason_code":"ADDACS-B","scheme":"bacs"},"id":"EV123","links":{"mandate":"MD123","new_customer_bank_account":"BA123","parent_event":"EV123","payment":"PM123","payout":"PO123","previous_customer_bank_account":"BA123","refund":"RF123","subscription":"SB123"},"metadata":{},"resource_type":"mandates"}],"meta":{"cursors":{"after":"example after 2305","before":"example before 364"},"limit":50}}
},
"get": {
"method": "GET",
diff --git a/tests/fixtures/gocardless_error.json b/tests/fixtures/gocardless_error.json
new file mode 100644
index 00000000..6cac7e1a
--- /dev/null
+++ b/tests/fixtures/gocardless_error.json
@@ -0,0 +1,9 @@
+{
+ "error": {
+ "message": "Uh-oh!",
+ "documentation_url": "https://developer.gocardless.com/pro#internal_error",
+ "type": "gocardless",
+ "request_id": "41a59cf8-ca4c-474c-9931-7f01fb547bc7",
+ "code": 500
+ }
+}
diff --git a/tests/fixtures/invalid_api_usage_error.json b/tests/fixtures/invalid_api_usage_error.json
new file mode 100644
index 00000000..93300a27
--- /dev/null
+++ b/tests/fixtures/invalid_api_usage_error.json
@@ -0,0 +1,14 @@
+{
+ "error": {
+ "message": "Invalid document structure",
+ "documentation_url": "https://developer.gocardless.com/pro#invalid_document_structure",
+ "type": "invalid_api_usage",
+ "request_id": "bd271b37-a2f5-47c8-b461-040dfe0e9cb1",
+ "code": 400,
+ "errors": [
+ {
+ "message": "Root element must be an object."
+ }
+ ]
+ }
+}
diff --git a/tests/fixtures/invalid_state_error.json b/tests/fixtures/invalid_state_error.json
new file mode 100644
index 00000000..13848a7a
--- /dev/null
+++ b/tests/fixtures/invalid_state_error.json
@@ -0,0 +1,15 @@
+{
+ "error": {
+ "code": 422,
+ "documentation_url": "https://developer.gocardless.com/pro#mandate_not_inactive",
+ "errors": [
+ {
+ "message": "Mandate is already active or being submitted",
+ "reason": "mandate_not_inactive"
+ }
+ ],
+ "message": "Mandate is already active or being submitted",
+ "request_id": "9aac0445-fd1e-4dc2-8854-a5a6afbaaeae",
+ "type": "invalid_state"
+ }
+}
diff --git a/tests/GoCardlessPro/fixtures/mandate_pdfs.json b/tests/fixtures/mandate_pdfs.json
similarity index 100%
rename from tests/GoCardlessPro/fixtures/mandate_pdfs.json
rename to tests/fixtures/mandate_pdfs.json
diff --git a/tests/GoCardlessPro/fixtures/mandates.json b/tests/fixtures/mandates.json
similarity index 74%
rename from tests/GoCardlessPro/fixtures/mandates.json
rename to tests/fixtures/mandates.json
index 9844d17b..eb192377 100644
--- a/tests/GoCardlessPro/fixtures/mandates.json
+++ b/tests/fixtures/mandates.json
@@ -3,13 +3,13 @@
"method": "POST",
"path_template": "/mandates",
"url_params": {},
- "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer_bank_account":"BA123"},"metadata":{},"next_possible_charge_date":null,"reference":"REF-123","scheme":null,"status":"pending_submission"}}
+ "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer_bank_account":"BA123"},"metadata":{},"next_possible_charge_date":"2014-10-27","reference":"REF-123","scheme":null,"status":"pending_submission"}}
},
"list": {
"method": "GET",
"path_template": "/mandates",
"url_params": {},
- "body": {"mandates":[{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer_bank_account":"BA123"},"metadata":{},"next_possible_charge_date":"2014-10-27","reference":"REF-123","scheme":"bacs","status":"pending_submission"},{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer_bank_account":"BA123"},"metadata":{},"next_possible_charge_date":"2014-10-27","reference":null,"scheme":null,"status":"pending_submission"}],"meta":{"cursors":{"after":"example after 7822","before":"example before 8154"},"limit":50}}
+ "body": {"mandates":[{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer_bank_account":"BA123"},"metadata":{},"next_possible_charge_date":null,"reference":"REF-123","scheme":"bacs","status":"pending_submission"},{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer_bank_account":"BA123"},"metadata":{},"next_possible_charge_date":null,"reference":null,"scheme":"bacs","status":"pending_submission"}],"meta":{"cursors":{"after":"example after 1223","before":"example before 7822"},"limit":50}}
},
"get": {
"method": "GET",
@@ -21,7 +21,7 @@
"method": "PUT",
"path_template": "/mandates/:identity",
"url_params": {"identity": "MD123"},
- "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer_bank_account":"BA123"},"metadata":{},"next_possible_charge_date":"2014-10-27","reference":"REF-123","scheme":"bacs","status":"pending_submission"}}
+ "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer_bank_account":"BA123"},"metadata":{},"next_possible_charge_date":"2014-10-27","reference":null,"scheme":"bacs","status":"pending_submission"}}
},
"cancel": {
"method": "POST",
diff --git a/tests/GoCardlessPro/fixtures/payments.json b/tests/fixtures/payments.json
similarity index 65%
rename from tests/GoCardlessPro/fixtures/payments.json
rename to tests/fixtures/payments.json
index 67eaa027..049df2b4 100644
--- a/tests/GoCardlessPro/fixtures/payments.json
+++ b/tests/fixtures/payments.json
@@ -3,19 +3,19 @@
"method": "POST",
"path_template": "/payments",
"url_params": {},
- "body": {"payments":{"amount":"1000","amount_refunded":"150","charge_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":null,"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"status":"submitted"}}
+ "body": {"payments":{"amount":"1000","amount_refunded":"150","charge_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":null,"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}}
},
"list": {
"method": "GET",
"path_template": "/payments",
"url_params": {},
- "body": {"meta":{"cursors":{"after":"example after 870","before":"example before 2984"},"limit":50},"payments":[{"amount":"1000","amount_refunded":"150","charge_date":"2014-05-21","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":"One-off upgrade fee","id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"},{"amount":"1000","amount_refunded":"150","charge_date":"2014-05-21","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":null,"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}]}
+ "body": {"meta":{"cursors":{"after":"example after 8247","before":"example before 2984"},"limit":50},"payments":[{"amount":"1000","amount_refunded":"150","charge_date":"2014-05-21","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":"One-off upgrade fee","id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"},{"amount":"1000","amount_refunded":"150","charge_date":"2014-05-21","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":null,"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}]}
},
"get": {
"method": "GET",
"path_template": "/payments/:identity",
"url_params": {"identity": "PM123"},
- "body": {"payments":{"amount":"1000","amount_refunded":"150","charge_date":"2014-05-21","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":"One-off upgrade fee","id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"status":"submitted"}}
+ "body": {"payments":{"amount":"1000","amount_refunded":"150","charge_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":"One-off upgrade fee","id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"status":"submitted"}}
},
"update": {
"method": "PUT",
@@ -27,7 +27,7 @@
"method": "POST",
"path_template": "/payments/:identity/actions/cancel",
"url_params": {"identity": "PM123"},
- "body": {"payments":{"amount":"1000","amount_refunded":"150","charge_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":"One-off upgrade fee","id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"status":"submitted"}}
+ "body": {"payments":{"amount":"1000","amount_refunded":"150","charge_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":null,"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}}
},
"retry": {
"method": "POST",
diff --git a/tests/GoCardlessPro/fixtures/payouts.json b/tests/fixtures/payouts.json
similarity index 93%
rename from tests/GoCardlessPro/fixtures/payouts.json
rename to tests/fixtures/payouts.json
index 8e772d4a..ccc4f392 100644
--- a/tests/GoCardlessPro/fixtures/payouts.json
+++ b/tests/fixtures/payouts.json
@@ -3,7 +3,7 @@
"method": "GET",
"path_template": "/payouts",
"url_params": {},
- "body": {"meta":{"cursors":{"after":"example after 1092","before":"example before 6629"},"limit":50},"payouts":[{"amount":"1000","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"reference":"ref-1","status":"pending"},{"amount":"1000","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"reference":"ref-1","status":"pending"}]}
+ "body": {"meta":{"cursors":{"after":"example after 1092","before":"example before 8831"},"limit":50},"payouts":[{"amount":"1000","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"reference":"ref-1","status":"pending"},{"amount":"1000","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"reference":"ref-1","status":"pending"}]}
},
"get": {
"method": "GET",
diff --git a/tests/GoCardlessPro/fixtures/redirect_flows.json b/tests/fixtures/redirect_flows.json
similarity index 100%
rename from tests/GoCardlessPro/fixtures/redirect_flows.json
rename to tests/fixtures/redirect_flows.json
diff --git a/tests/GoCardlessPro/fixtures/refunds.json b/tests/fixtures/refunds.json
similarity index 82%
rename from tests/GoCardlessPro/fixtures/refunds.json
rename to tests/fixtures/refunds.json
index 53553613..a39d73d2 100644
--- a/tests/GoCardlessPro/fixtures/refunds.json
+++ b/tests/fixtures/refunds.json
@@ -3,13 +3,13 @@
"method": "POST",
"path_template": "/refunds",
"url_params": {},
- "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{},"reference":"Nude Wines refund"}}
+ "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{},"reference":null}}
},
"list": {
"method": "GET",
"path_template": "/refunds",
"url_params": {},
- "body": {"meta":{"cursors":{"after":"example after 5399","before":"example before 5320"},"limit":50},"refunds":[{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{},"reference":null},{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{},"reference":"Nude Wines refund"}]}
+ "body": {"meta":{"cursors":{"after":"example after 5320","before":"example before 7886"},"limit":50},"refunds":[{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{},"reference":null},{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{},"reference":"Nude Wines refund"}]}
},
"get": {
"method": "GET",
@@ -21,7 +21,7 @@
"method": "PUT",
"path_template": "/refunds/:identity",
"url_params": {"identity": "RF123"},
- "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{},"reference":"Nude Wines refund"}}
+ "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{},"reference":null}}
}
}
diff --git a/tests/GoCardlessPro/fixtures/subscriptions.json b/tests/fixtures/subscriptions.json
similarity index 53%
rename from tests/GoCardlessPro/fixtures/subscriptions.json
rename to tests/fixtures/subscriptions.json
index fdbd8156..b9111897 100644
--- a/tests/GoCardlessPro/fixtures/subscriptions.json
+++ b/tests/fixtures/subscriptions.json
@@ -3,31 +3,31 @@
"method": "POST",
"path_template": "/subscriptions",
"url_params": {},
- "body": {"subscriptions":{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":"28","end_date":"2015-10-21","id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":null,"payment_reference":null,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}}
+ "body": {"subscriptions":{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":"28","end_date":"2015-10-21","id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":"GOLDPLAN","start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}}
},
"list": {
"method": "GET",
"path_template": "/subscriptions",
"url_params": {},
- "body": {"meta":{"cursors":{"after":"example after 1393","before":"example before 417"},"limit":50},"subscriptions":[{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":"28","end_date":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":"GOLDPLAN","start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]},{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":"28","end_date":"2015-10-21","id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":null,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}]}
+ "body": {"meta":{"cursors":{"after":"example after 1393","before":"example before 8470"},"limit":50},"subscriptions":[{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":null,"end_date":"2015-10-21","id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":null,"payment_reference":null,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]},{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":"28","end_date":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":"GOLDPLAN","start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}]}
},
"get": {
"method": "GET",
"path_template": "/subscriptions/:identity",
"url_params": {"identity": "SB123"},
- "body": {"subscriptions":{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":null,"end_date":"2015-10-21","id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":null,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}}
+ "body": {"subscriptions":{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":null,"end_date":"2015-10-21","id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":null,"start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}}
},
"update": {
"method": "PUT",
"path_template": "/subscriptions/:identity",
"url_params": {"identity": "SB123"},
- "body": {"subscriptions":{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":null,"end_date":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":null,"payment_reference":null,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}}
+ "body": {"subscriptions":{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":null,"end_date":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":null,"payment_reference":"GOLDPLAN","start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}}
},
"cancel": {
"method": "POST",
"path_template": "/subscriptions/:identity/actions/cancel",
"url_params": {"identity": "SB123"},
- "body": {"subscriptions":{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":null,"end_date":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":null,"start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}}
+ "body": {"subscriptions":{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":null,"end_date":"2015-10-21","id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":null,"payment_reference":null,"start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}}
}
}
diff --git a/tests/fixtures/validation_failed_error.json b/tests/fixtures/validation_failed_error.json
new file mode 100644
index 00000000..a72a36b2
--- /dev/null
+++ b/tests/fixtures/validation_failed_error.json
@@ -0,0 +1,18 @@
+{
+ "error": {
+ "documentation_url": "https://developer.gocardless.com/pro#validation_failed",
+ "message": "Validation failed",
+ "type": "validation_failed",
+ "code": 422,
+ "request_id": "dd50eaaf-8213-48fe-90d6-5466872efbc4",
+ "errors": [
+ {
+ "message": "must be a number",
+ "field": "branch_code"
+ }, {
+ "message": "is invalid",
+ "field": "country_code"
+ }
+ ]
+ }
+}
diff --git a/tests/loader.php b/tests/loader.php
index a10b6b31..b2104436 100644
--- a/tests/loader.php
+++ b/tests/loader.php
@@ -1,6 +1,7 @@