From 5425ad444ea0e1f20d24354a0dbc2c675a3f2fc8 Mon Sep 17 00:00:00 2001 From: Crankshaft Robot Date: Mon, 6 Jul 2015 16:32:32 +0000 Subject: [PATCH] Crankshaft[BU000001EE1CZ5] Client - PHP @ 2015-07-06 16:32:32 +0000 9ad83f4 Pete Hamilton Handle nested arrays of non-objects ---------------- 60a9bcc Pete Hamilton Use latest schema version ---------------- 5c38c76 Pete Hamilton Updated Makefile ---------------- --- README.md | 2 +- composer.json | 2 +- lib/GoCardlessPro/Client.php | 17 +-- lib/GoCardlessPro/Core/CurlWrapper.php | 4 +- lib/GoCardlessPro/Core/HttpClient.php | 4 +- lib/GoCardlessPro/Resources/Helper.php | 28 ----- lib/GoCardlessPro/Resources/Subscription.php | 24 ++-- .../Resources/Wrapper/NestedArray.php | 6 +- lib/GoCardlessPro/Services/HelpersService.php | 113 ------------------ .../Services/MandatesService.php | 11 -- .../Services/SubscriptionsService.php | 4 +- tests/GoCardlessPro/Core/HttpClientTest.php | 2 +- .../BankDetailsLookupIntegrationTest.php | 20 ++++ .../Integration/HelperIntegrationTest.php | 21 ---- .../Integration/MandatePdfIntegrationTest.php | 20 ++++ .../SubscriptionIntegrationTest.php | 20 ++-- .../fixtures/bank_details_lookups.json | 6 + .../fixtures/creditor_bank_accounts.json | 6 +- tests/GoCardlessPro/fixtures/creditors.json | 8 +- .../fixtures/customer_bank_accounts.json | 10 +- tests/GoCardlessPro/fixtures/customers.json | 8 +- tests/GoCardlessPro/fixtures/events.json | 2 +- tests/GoCardlessPro/fixtures/helpers.json | 3 - .../GoCardlessPro/fixtures/mandate_pdfs.json | 6 + tests/GoCardlessPro/fixtures/mandates.json | 6 +- tests/GoCardlessPro/fixtures/payments.json | 8 +- tests/GoCardlessPro/fixtures/payouts.json | 2 +- tests/GoCardlessPro/fixtures/refunds.json | 2 +- .../GoCardlessPro/fixtures/subscriptions.json | 10 +- 29 files changed, 121 insertions(+), 254 deletions(-) delete mode 100644 lib/GoCardlessPro/Resources/Helper.php delete mode 100644 lib/GoCardlessPro/Services/HelpersService.php delete mode 100644 tests/GoCardlessPro/Integration/HelperIntegrationTest.php delete mode 100644 tests/GoCardlessPro/fixtures/helpers.json diff --git a/README.md b/README.md index 7636d037..7f4dd12f 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Add this repository to the contents of your `composer.json`: ```javascript { "require": { - "gocardless/gocardless-pro-php": "0.2.0" + "gocardless/gocardless-pro-php": "0.3.0" } } ``` diff --git a/composer.json b/composer.json index d562fbf0..8a8ebe2c 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "squizlabs/php_codesniffer": "~2.0", "phpdocumentor/phpdocumentor": "2.*" }, - "version": "0.2.0", + "version": "0.3.0", "autoload": { "psr-4": { "GoCardlessPro\\" : "lib/GoCardlessPro" diff --git a/lib/GoCardlessPro/Client.php b/lib/GoCardlessPro/Client.php index d7de724a..bcbb4b00 100644 --- a/lib/GoCardlessPro/Client.php +++ b/lib/GoCardlessPro/Client.php @@ -163,19 +163,6 @@ public function events() return $this->events; } - /** - * Helpers - * - * @return Services\Helper - */ - public function helpers() - { - if (!isset($this->helpers)) { - $this->helpers = new Services\HelpersService($this->http_client); - } - return $this->helpers; - } - /** * Mandates * @@ -336,10 +323,10 @@ public function refunds() * - The first payment must be * charged within 1 year. * - When neither `month` nor `day_of_month` are - * present, the subscription will recur from the `start_at` based on the + * present, the subscription will recur from the `start_date` based on the * `interval_unit`. * - If `month` or `day_of_month` are present, the - * recurrence rules will be applied from the `start_at`, and the following + * recurrence rules will be applied from the `start_date`, and the following * validations apply: * * | interval_unit | month diff --git a/lib/GoCardlessPro/Core/CurlWrapper.php b/lib/GoCardlessPro/Core/CurlWrapper.php index f5bc65fa..a9844479 100644 --- a/lib/GoCardlessPro/Core/CurlWrapper.php +++ b/lib/GoCardlessPro/Core/CurlWrapper.php @@ -70,11 +70,11 @@ private function getUserAgent() { $curlinfo = curl_version(); $uagent = array(); - $uagent[] = 'gocardless-pro-php/0.2.0'; + $uagent[] = 'gocardless-pro-php/0.3.0'; $uagent[] = 'php/' . phpversion(); $uagent[] = 'curl/' . $curlinfo['version']; $uagent[] = 'os/' . $curlinfo['host']; - $uagent[] = 'schema-version/2015-04-29'; + $uagent[] = 'schema-version/2015-07-06'; return implode(' ', $uagent); } diff --git a/lib/GoCardlessPro/Core/HttpClient.php b/lib/GoCardlessPro/Core/HttpClient.php index 4c9cac59..d8dedc28 100644 --- a/lib/GoCardlessPro/Core/HttpClient.php +++ b/lib/GoCardlessPro/Core/HttpClient.php @@ -48,8 +48,8 @@ public function __construct($token, $baseUrl, $options = array()) $this->headers['accept'] = 'application/json'; // Config Headers - $this->headers['GoCardless-Version'] = '2015-04-29'; - $this->headers['GoCardless-Version'] = '2015-04-29'; + $this->headers['GoCardless-Version'] = '2015-07-06'; + $this->headers['GoCardless-Version'] = '2015-07-06'; } diff --git a/lib/GoCardlessPro/Resources/Helper.php b/lib/GoCardlessPro/Resources/Helper.php deleted file mode 100644 index 9e1c93d7..00000000 --- a/lib/GoCardlessPro/Resources/Helper.php +++ /dev/null @@ -1,28 +0,0 @@ -data, true); - return $ret; - } -} diff --git a/lib/GoCardlessPro/Resources/Subscription.php b/lib/GoCardlessPro/Resources/Subscription.php index 913761c9..664ddc41 100644 --- a/lib/GoCardlessPro/Resources/Subscription.php +++ b/lib/GoCardlessPro/Resources/Subscription.php @@ -18,13 +18,13 @@ * - The first payment must be charged within 1 * year. * - When neither `month` nor `day_of_month` are present, the - * subscription will recur from the `start_at` based on the `interval_unit`. - - * * - If `month` or `day_of_month` are present, the recurrence rules will be - * applied from the `start_at`, and the following validations apply: + * subscription will recur from the `start_date` based on the `interval_unit`. + + * * - If `month` or `day_of_month` are present, the recurrence rules will be + * applied from the `start_date`, and the following validations apply: * - * | - * interval_unit | month | + * + * | interval_unit | month | * day_of_month | * | :-------------- | * :--------------------------------------------- | @@ -95,8 +95,8 @@ public function amount() } /** - * An alternative way to set `end_at`. The total number of payments that - * should be taken by this subscription. This will set `end_at` + * 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 @@ -163,9 +163,9 @@ public function day_of_month() * * @return string */ - public function end_at() + public function end_date() { - $field = 'end_at'; + $field = 'end_date'; if (!property_exists($this->data, $field)) { return null; } @@ -301,9 +301,9 @@ public function payment_reference() * * @return string */ - public function start_at() + public function start_date() { - $field = 'start_at'; + $field = 'start_date'; if (!property_exists($this->data, $field)) { return null; } diff --git a/lib/GoCardlessPro/Resources/Wrapper/NestedArray.php b/lib/GoCardlessPro/Resources/Wrapper/NestedArray.php index 5599c634..a9009a0d 100644 --- a/lib/GoCardlessPro/Resources/Wrapper/NestedArray.php +++ b/lib/GoCardlessPro/Resources/Wrapper/NestedArray.php @@ -62,7 +62,11 @@ public function raw() { $arrayOut = $this->data; foreach ($arrayOut as $key => $data_element) { - $arrayOut[$key] = $data_element->raw(); + 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/Services/HelpersService.php b/lib/GoCardlessPro/Services/HelpersService.php deleted file mode 100644 index 3d79e0f6..00000000 --- a/lib/GoCardlessPro/Services/HelpersService.php +++ /dev/null @@ -1,113 +0,0 @@ -make_request('mandate', 'post', '/helpers/mandate', $params, $headers); - } - - /** - * Modulus checking - * - * Check whether an account number and bank / branch code combination are - * compatible. - * - * Bank account details may either be supplied - * using the IBAN (international bank account number), or [local - * details](#ui-local-bank-details). For more information on the different - * fields required in each country, please see the [local bank - * details](#ui-local-bank-details) section. - * - * Example URL: /helpers/modulus_check - * - * - * @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 Helper - * @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 modulus_check($params = array(), $headers = array()) - { - return $this->make_request('modulus_check', 'post', '/helpers/modulus_check', $params, $headers); - } - - - - - /** - * Get the resource loading class. - * Used internally to send http requests. - * - * @return string - */ - protected function resourceClass() - { - return '\GoCardlessPro\Resources\Helper'; - } - - /** - * 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 'data'; - } -} diff --git a/lib/GoCardlessPro/Services/MandatesService.php b/lib/GoCardlessPro/Services/MandatesService.php index 8b575605..a478a062 100644 --- a/lib/GoCardlessPro/Services/MandatesService.php +++ b/lib/GoCardlessPro/Services/MandatesService.php @@ -68,17 +68,6 @@ public function do_list($params = array(), $headers = array()) * Get a single mandate * * Retrieves the details of an existing mandate. - * - * If you - * specify `Accept: application/pdf` on a request to this endpoint it will - * return a PDF complying to the relevant scheme rules, which you can - * present to your customer. - * - * PDF mandates can be retrieved in - * Dutch, English, French, German, Italian, Portuguese and Spanish by - * specifying the [ISO - * 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes#Partial_ISO_639_table) - * language code as an `Accept-Language` header. * * Example URL: /mandates/:identity * diff --git a/lib/GoCardlessPro/Services/SubscriptionsService.php b/lib/GoCardlessPro/Services/SubscriptionsService.php index 77c2d854..8f735945 100644 --- a/lib/GoCardlessPro/Services/SubscriptionsService.php +++ b/lib/GoCardlessPro/Services/SubscriptionsService.php @@ -23,10 +23,10 @@ * - The first payment must be charged * within 1 year. * - When neither `month` nor `day_of_month` are present, - * the subscription will recur from the `start_at` based on the + * the subscription will recur from the `start_date` based on the * `interval_unit`. * - If `month` or `day_of_month` are present, the - * recurrence rules will be applied from the `start_at`, and the following + * recurrence rules will be applied from the `start_date`, and the following * validations apply: * * | interval_unit | month diff --git a/tests/GoCardlessPro/Core/HttpClientTest.php b/tests/GoCardlessPro/Core/HttpClientTest.php index ef705e44..fcbde1af 100644 --- a/tests/GoCardlessPro/Core/HttpClientTest.php +++ b/tests/GoCardlessPro/Core/HttpClientTest.php @@ -34,7 +34,7 @@ public function testIncludedDefaultHeaders() { $defaultHeaders = $this->http_client->headers(); // Config Headers - $this->assertEquals('2015-04-29', $defaultHeaders['GoCardless-Version']); + $this->assertEquals('2015-07-06', $defaultHeaders['GoCardless-Version']); } diff --git a/tests/GoCardlessPro/Integration/BankDetailsLookupIntegrationTest.php b/tests/GoCardlessPro/Integration/BankDetailsLookupIntegrationTest.php index d794bdd5..977daea4 100644 --- a/tests/GoCardlessPro/Integration/BankDetailsLookupIntegrationTest.php +++ b/tests/GoCardlessPro/Integration/BankDetailsLookupIntegrationTest.php @@ -18,4 +18,24 @@ 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->assertTrue($this->hasCheckedCurl); + } } diff --git a/tests/GoCardlessPro/Integration/HelperIntegrationTest.php b/tests/GoCardlessPro/Integration/HelperIntegrationTest.php deleted file mode 100644 index c05e6a4f..00000000 --- a/tests/GoCardlessPro/Integration/HelperIntegrationTest.php +++ /dev/null @@ -1,21 +0,0 @@ -clientAndFixtureSetup('helpers'); - } - - public function testResourceExists() - { - $obj = new \GoCardlessPro\Resources\Helper(null); - $this->assertNotNull($obj); - } -} diff --git a/tests/GoCardlessPro/Integration/MandatePdfIntegrationTest.php b/tests/GoCardlessPro/Integration/MandatePdfIntegrationTest.php index efd57681..37de435e 100644 --- a/tests/GoCardlessPro/Integration/MandatePdfIntegrationTest.php +++ b/tests/GoCardlessPro/Integration/MandatePdfIntegrationTest.php @@ -18,4 +18,24 @@ 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/SubscriptionIntegrationTest.php b/tests/GoCardlessPro/Integration/SubscriptionIntegrationTest.php index bfb9a83b..43b27899 100644 --- a/tests/GoCardlessPro/Integration/SubscriptionIntegrationTest.php +++ b/tests/GoCardlessPro/Integration/SubscriptionIntegrationTest.php @@ -37,7 +37,7 @@ public function testSubscriptionsCreate() $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_at, $response->end_at()); + $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()); @@ -46,7 +46,7 @@ public function testSubscriptionsCreate() $this->matchDeepResponse($body->month, $response->month()); $this->matchDeepResponse($body->name, $response->name()); $this->matchDeepResponse($body->payment_reference, $response->payment_reference()); - $this->matchDeepResponse($body->start_at, $response->start_at()); + $this->matchDeepResponse($body->start_date, $response->start_date()); $this->matchDeepResponse($body->status, $response->status()); $this->matchDeepResponse($body->upcoming_payments, $response->upcoming_payments()); @@ -81,7 +81,7 @@ public function testSubscriptionsList() $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_at, $record->end_at()); + $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()); @@ -90,7 +90,7 @@ public function testSubscriptionsList() $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_at, $record->start_at()); + $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()); @@ -117,7 +117,7 @@ public function testSubscriptionsGet() $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_at, $response->end_at()); + $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()); @@ -126,7 +126,7 @@ public function testSubscriptionsGet() $this->matchDeepResponse($body->month, $response->month()); $this->matchDeepResponse($body->name, $response->name()); $this->matchDeepResponse($body->payment_reference, $response->payment_reference()); - $this->matchDeepResponse($body->start_at, $response->start_at()); + $this->matchDeepResponse($body->start_date, $response->start_date()); $this->matchDeepResponse($body->status, $response->status()); $this->matchDeepResponse($body->upcoming_payments, $response->upcoming_payments()); @@ -152,7 +152,7 @@ public function testSubscriptionsUpdate() $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_at, $response->end_at()); + $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()); @@ -161,7 +161,7 @@ public function testSubscriptionsUpdate() $this->matchDeepResponse($body->month, $response->month()); $this->matchDeepResponse($body->name, $response->name()); $this->matchDeepResponse($body->payment_reference, $response->payment_reference()); - $this->matchDeepResponse($body->start_at, $response->start_at()); + $this->matchDeepResponse($body->start_date, $response->start_date()); $this->matchDeepResponse($body->status, $response->status()); $this->matchDeepResponse($body->upcoming_payments, $response->upcoming_payments()); @@ -187,7 +187,7 @@ public function testSubscriptionsCancel() $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_at, $response->end_at()); + $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()); @@ -196,7 +196,7 @@ public function testSubscriptionsCancel() $this->matchDeepResponse($body->month, $response->month()); $this->matchDeepResponse($body->name, $response->name()); $this->matchDeepResponse($body->payment_reference, $response->payment_reference()); - $this->matchDeepResponse($body->start_at, $response->start_at()); + $this->matchDeepResponse($body->start_date, $response->start_date()); $this->matchDeepResponse($body->status, $response->status()); $this->matchDeepResponse($body->upcoming_payments, $response->upcoming_payments()); diff --git a/tests/GoCardlessPro/fixtures/bank_details_lookups.json b/tests/GoCardlessPro/fixtures/bank_details_lookups.json index 88076379..24f41c0e 100644 --- a/tests/GoCardlessPro/fixtures/bank_details_lookups.json +++ b/tests/GoCardlessPro/fixtures/bank_details_lookups.json @@ -1,3 +1,9 @@ { + "create": { + "method": "POST", + "path_template": "/bank_details_lookups", + "url_params": {}, + "body": {"bank_details_lookups":{"available_debit_schemes":["bacs"],"bank_name":null}} + } } diff --git a/tests/GoCardlessPro/fixtures/creditor_bank_accounts.json b/tests/GoCardlessPro/fixtures/creditor_bank_accounts.json index a1a09ad9..5b10a05d 100644 --- a/tests/GoCardlessPro/fixtures/creditor_bank_accounts.json +++ b/tests/GoCardlessPro/fixtures/creditor_bank_accounts.json @@ -3,19 +3,19 @@ "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":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","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":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"GBP","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":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}],"meta":{"cursors":{"after":"example after 2451","before":"example before 9355"},"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":"GBP","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 8510","before":"example before 2605"},"limit":50}} }, "get": { "method": "GET", "path_template": "/creditor_bank_accounts/:identity", "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":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":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}} }, "disable": { "method": "POST", diff --git a/tests/GoCardlessPro/fixtures/creditors.json b/tests/GoCardlessPro/fixtures/creditors.json index 2be43c6a..111c5ecf 100644 --- a/tests/GoCardlessPro/fixtures/creditors.json +++ b/tests/GoCardlessPro/fixtures/creditors.json @@ -3,25 +3,25 @@ "method": "POST", "path_template": "/creditors", "url_params": {}, - "body": {"creditors":{"address_line1":null,"address_line2":"Islington","address_line3":"example address_line3 2540","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":null},"name":"Nude Wines","postal_code":"EC1V 7LQ","region":null}} + "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":null,"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":"BA123"},"name":"Nude Wines","postal_code":"EC1V 7LQ","region":null}} }, "list": { "method": "GET", "path_template": "/creditors", "url_params": {}, - "body": {"creditors":[{"address_line1":"338-346 Goswell Road","address_line2":null,"address_line3":"example address_line3 5089","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"},"name":"Nude Wines","postal_code":null,"region":"example region 3274"},{"address_line1":"338-346 Goswell Road","address_line2":null,"address_line3":null,"city":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_eur_payout_account":null,"default_gbp_payout_account":"BA123"},"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 8287"}],"meta":{"cursors":{"after":"example after 408","before":"example before 7387"},"limit":50}} + "body": {"creditors":[{"address_line1":null,"address_line2":"Islington","address_line3":"example address_line3 5089","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"},"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 3274"},{"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},"name":"Nude Wines","postal_code":null,"region":"example region 1528"}],"meta":{"cursors":{"after":"example after 7387","before":"example before 6831"},"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":"example address_line3 3090","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},"name":"Nude Wines","postal_code":null,"region":null}} + "body": {"creditors":{"address_line1":null,"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},"name":"Nude Wines","postal_code":null,"region":"example region 1737"}} }, "update": { "method": "PUT", "path_template": "/creditors/:identity", "url_params": {"identity": "CR123"}, - "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 2433","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"},"name":"Nude Wines","postal_code":null,"region":null}} + "body": {"creditors":{"address_line1":null,"address_line2":"Islington","address_line3":"example address_line3 1957","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"},"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 7189"}} } } diff --git a/tests/GoCardlessPro/fixtures/customer_bank_accounts.json b/tests/GoCardlessPro/fixtures/customer_bank_accounts.json index 08a188ad..3467e794 100644 --- a/tests/GoCardlessPro/fixtures/customer_bank_accounts.json +++ b/tests/GoCardlessPro/fixtures/customer_bank_accounts.json @@ -3,31 +3,31 @@ "method": "POST", "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 3981"},"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":"GBP","enabled":true,"id":"BA123","links":{"customer":"example customer 1270"},"metadata":{}}} }, "list": { "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":"GBP","enabled":true,"id":"BA123","links":{"customer":"example customer 3086"},"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 9819"},"metadata":{}}],"meta":{"cursors":{"after":"example after 1270","before":"example before 2066"},"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 493"},"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 9819"},"metadata":{}}],"meta":{"cursors":{"after":"example after 7175","before":"example before 6052"},"limit":50}} }, "get": { "method": "GET", "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":"GBP","enabled":true,"id":"BA123","links":{"customer":"example customer 6052"},"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 4885"},"metadata":{}}} }, "update": { "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 5710"},"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 3749"},"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 3749"},"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":"GBP","enabled":true,"id":"BA123","links":{"customer":"example customer 1528"},"metadata":{}}} } } diff --git a/tests/GoCardlessPro/fixtures/customers.json b/tests/GoCardlessPro/fixtures/customers.json index b7b621ed..6c967c8b 100644 --- a/tests/GoCardlessPro/fixtures/customers.json +++ b/tests/GoCardlessPro/fixtures/customers.json @@ -3,25 +3,25 @@ "method": "POST", "path_template": "/customers", "url_params": {}, - "body": {"customers":{"address_line1":null,"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","metadata":{},"postal_code":"NW1 6XE","region":null}} + "body": {"customers":{"address_line1":null,"address_line2":null,"address_line3":null,"city":null,"company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","email":null,"family_name":"Osborne","given_name":null,"id":"CU123","metadata":{},"postal_code":null,"region":null}} }, "list": { "method": "GET", "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":null,"family_name":null,"given_name":"Frank","id":"CU123","metadata":{},"postal_code":"NW1 6XE","region":null},{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":null,"company_name":"Hamilton Trading Ltd.","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":"user@example.com","family_name":"Osborne","given_name":null,"id":"CU123","metadata":{},"postal_code":null,"region":null}],"meta":{"cursors":{"after":"example after 1598","before":"example before 2205"},"limit":50}} + "body": {"customers":[{"address_line1":"221B Baker Street","address_line2":null,"address_line3":null,"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","metadata":{},"postal_code":null,"region":"Greater London"},{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","metadata":{},"postal_code":null,"region":null}],"meta":{"cursors":{"after":"example after 6420","before":"example before 7996"},"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":null,"family_name":"Osborne","given_name":null,"id":"CU123","metadata":{},"postal_code":null,"region":"Greater London"}} + "body": {"customers":{"address_line1":"221B Baker Street","address_line2":null,"address_line3":"City of Westminster","city":"London","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","metadata":{},"postal_code":null,"region":null}} }, "update": { "method": "PUT", "path_template": "/customers/:identity", "url_params": {"identity": "CU123"}, - "body": {"customers":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":null,"city":null,"company_name":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":null,"family_name":"Osborne","given_name":"Frank","id":"CU123","metadata":{},"postal_code":null,"region":"Greater London"}} + "body": {"customers":{"address_line1":"221B Baker Street","address_line2":null,"address_line3":"City of Westminster","city":null,"company_name":"Hamilton Trading Ltd.","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","email":null,"family_name":null,"given_name":null,"id":"CU123","metadata":{},"postal_code":null,"region":"Greater London"}} } } diff --git a/tests/GoCardlessPro/fixtures/events.json b/tests/GoCardlessPro/fixtures/events.json index 5131a14b..02d16417 100644 --- a/tests/GoCardlessPro/fixtures/events.json +++ b/tests/GoCardlessPro/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 2818","before":"example before 1528"},"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 7903","before":"example before 4384"},"limit":50}} }, "get": { "method": "GET", diff --git a/tests/GoCardlessPro/fixtures/helpers.json b/tests/GoCardlessPro/fixtures/helpers.json deleted file mode 100644 index 88076379..00000000 --- a/tests/GoCardlessPro/fixtures/helpers.json +++ /dev/null @@ -1,3 +0,0 @@ -{ -} - diff --git a/tests/GoCardlessPro/fixtures/mandate_pdfs.json b/tests/GoCardlessPro/fixtures/mandate_pdfs.json index 88076379..75ec5855 100644 --- a/tests/GoCardlessPro/fixtures/mandate_pdfs.json +++ b/tests/GoCardlessPro/fixtures/mandate_pdfs.json @@ -1,3 +1,9 @@ { + "create": { + "method": "POST", + "path_template": "/mandate_pdfs", + "url_params": {}, + "body": {"mandate_pdfs":{"expires_at":"2014-01-01T12:00:00.000Z","url":"https://api.gocardless.com/mandate_pdfs/wLJKzbG12uqcDly7t6L2"}} + } } diff --git a/tests/GoCardlessPro/fixtures/mandates.json b/tests/GoCardlessPro/fixtures/mandates.json index 67da1e47..4f281b42 100644 --- a/tests/GoCardlessPro/fixtures/mandates.json +++ b/tests/GoCardlessPro/fixtures/mandates.json @@ -9,7 +9,7 @@ "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":null,"reference":null,"scheme":null,"status":"pending_submission"}],"meta":{"cursors":{"after":"example after 4547","before":"example before 3612"},"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":"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":null,"reference":null,"scheme":null,"status":"pending_submission"}],"meta":{"cursors":{"after":"example after 3640","before":"example before 8076"},"limit":50}} }, "get": { "method": "GET", @@ -27,13 +27,13 @@ "method": "POST", "path_template": "/mandates/:identity/actions/cancel", "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":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":"bacs","status":"pending_submission"}} }, "reinstate": { "method": "POST", "path_template": "/mandates/:identity/actions/reinstate", "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":null,"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":null,"status":"pending_submission"}} } } diff --git a/tests/GoCardlessPro/fixtures/payments.json b/tests/GoCardlessPro/fixtures/payments.json index 245d24ef..62f0ea02 100644 --- a/tests/GoCardlessPro/fixtures/payments.json +++ b/tests/GoCardlessPro/fixtures/payments.json @@ -3,13 +3,13 @@ "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":"WINEBOX001","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":"WINEBOX001","status":"submitted"}} }, "list": { "method": "GET", "path_template": "/payments", "url_params": {}, - "body": {"meta":{"cursors":{"after":"example after 1223","before":"example before 7822"},"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 4535","before":"example before 440"},"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":"One-off upgrade fee","id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"status":"submitted"}]} }, "get": { "method": "GET", @@ -27,13 +27,13 @@ "method": "POST", "path_template": "/payments/:identity/actions/cancel", "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":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":"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"}} }, "retry": { "method": "POST", "path_template": "/payments/:identity/actions/retry", "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":"WINEBOX001","status":"submitted"}} + "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"}} } } diff --git a/tests/GoCardlessPro/fixtures/payouts.json b/tests/GoCardlessPro/fixtures/payouts.json index 484c7f79..182ad592 100644 --- a/tests/GoCardlessPro/fixtures/payouts.json +++ b/tests/GoCardlessPro/fixtures/payouts.json @@ -3,7 +3,7 @@ "method": "GET", "path_template": "/payouts", "url_params": {}, - "body": {"meta":{"cursors":{"after":"example after 783","before":"example before 6720"},"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 2984","before":"example before 870"},"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/refunds.json b/tests/GoCardlessPro/fixtures/refunds.json index 3df1560b..51e219b5 100644 --- a/tests/GoCardlessPro/fixtures/refunds.json +++ b/tests/GoCardlessPro/fixtures/refunds.json @@ -9,7 +9,7 @@ "method": "GET", "path_template": "/refunds", "url_params": {}, - "body": {"meta":{"cursors":{"after":"example after 2984","before":"example before 870"},"limit":50},"refunds":[{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{}},{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{}}]} + "body": {"meta":{"cursors":{"after":"example after 8010","before":"example before 8247"},"limit":50},"refunds":[{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{}},{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"payment":"PM123"},"metadata":{}}]} }, "get": { "method": "GET", diff --git a/tests/GoCardlessPro/fixtures/subscriptions.json b/tests/GoCardlessPro/fixtures/subscriptions.json index f5ebfade..b294952a 100644 --- a/tests/GoCardlessPro/fixtures/subscriptions.json +++ b/tests/GoCardlessPro/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":null,"end_at":"2015-10-21","id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":null,"start_at":"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":null,"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 7577","before":"example before 7886"},"limit":50},"subscriptions":[{"amount":"1000","count":"5","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":null,"end_at":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":null,"start_at":"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_at":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":"GOLDPLAN","start_at":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}]} + "body": {"meta":{"cursors":{"after":"example after 5695","before":"example before 6756"},"limit":50},"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"}]},{"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":"GOLDPLAN","start_date":null,"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_at":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":null,"payment_reference":"GOLDPLAN","start_at":"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":"2014-10-21","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":"28","end_at":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscripton","payment_reference":"GOLDPLAN","start_at":"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":null,"start_date":"2014-10-21","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":"28","end_at":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":null,"payment_reference":null,"start_at":"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":null,"payment_reference":"GOLDPLAN","start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} } }