diff --git a/composer.json b/composer.json index 97870af1..e23645a2 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "gocardless/gocardless-pro", "description": "GoCardless Pro PHP Client Library", - "version": "3.5.2", + "version": "3.6.0", "keywords": [ "gocardless", "direct debit", diff --git a/lib/Client.php b/lib/Client.php index fbb2599f..13f2d353 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -59,7 +59,7 @@ public function __construct($config) 'Content-Type' => 'application/json', 'Authorization' => "Bearer " . $access_token, 'GoCardless-Client-Library' => 'gocardless-pro-php', - 'GoCardless-Client-Version' => '3.5.2', + 'GoCardless-Client-Version' => '3.6.0', 'User-Agent' => $this->getUserAgent() ), 'http_errors' => false, @@ -369,7 +369,7 @@ private function getUserAgent() { $curlinfo = curl_version(); $uagent = array(); - $uagent[] = 'gocardless-pro-php/3.5.2'; + $uagent[] = 'gocardless-pro-php/3.6.0'; $uagent[] = 'schema-version/2015-07-06'; $uagent[] = 'GuzzleHttp/' . \GuzzleHttp\Client::VERSION; $uagent[] = 'php/' . phpversion(); diff --git a/lib/Resources/Creditor.php b/lib/Resources/Creditor.php index 10aa71c0..4e3f15ac 100644 --- a/lib/Resources/Creditor.php +++ b/lib/Resources/Creditor.php @@ -113,8 +113,8 @@ class Creditor extends BaseResource * Boolean value indicating whether the organisation is responsible for * sending all customer notifications (note this is separate from the * functionality described - * [here](https://developer.gocardless.com/getting-started/api/handling-customer-notifications/). - * If you are a partner app, and this value is true, you should not send + * [here](/getting-started/api/handling-customer-notifications/)). If you + * are a partner app, and this value is true, you should not send * notifications on behalf of this organisation. */ protected $merchant_responsible_for_notifications; diff --git a/lib/Resources/InstalmentSchedule.php b/lib/Resources/InstalmentSchedule.php index 2eaa1f86..6f09ef8d 100644 --- a/lib/Resources/InstalmentSchedule.php +++ b/lib/Resources/InstalmentSchedule.php @@ -88,9 +88,11 @@ class InstalmentSchedule extends BaseResource /** * The total amount of the instalment schedule, defined as the sum of all * individual - * payments. If the requested payment amounts do not sum up correctly, a - * validation - * error will be returned. + * payments, in the lowest denomination for the currency (e.g. pence in GBP, + * cents in + * EUR). If the requested payment amounts do not sum up correctly, a + * validation error + * will be returned. */ protected $total_amount; diff --git a/lib/Resources/Subscription.php b/lib/Resources/Subscription.php index 6ab35417..2c07c610 100644 --- a/lib/Resources/Subscription.php +++ b/lib/Resources/Subscription.php @@ -13,6 +13,7 @@ * * @property-read $amount * @property-read $app_fee + * @property-read $count * @property-read $created_at * @property-read $currency * @property-read $day_of_month @@ -47,6 +48,11 @@ class Subscription extends BaseResource */ protected $app_fee; + /** + * The total number of payments that should be taken by this subscription. + */ + protected $count; + /** * Fixed [timestamp](#api-usage-time-zones--dates), recording when this * resource was created. diff --git a/lib/Services/InstalmentSchedulesService.php b/lib/Services/InstalmentSchedulesService.php index 511528d9..59a7f0f0 100644 --- a/lib/Services/InstalmentSchedulesService.php +++ b/lib/Services/InstalmentSchedulesService.php @@ -26,14 +26,49 @@ class InstalmentSchedulesService extends BaseService /** - * Create an instalment schedule + * Create (with dates) * * Example URL: /instalment_schedules * * @param string[mixed] $params An associative array for any params * @return InstalmentSchedule **/ - public function create($params = array()) + public function createWithDates($params = array()) + { + $path = "/instalment_schedules"; + if(isset($params['params'])) { + $params['body'] = json_encode(array($this->envelope_key => (object)$params['params'])); + + unset($params['params']); + } + + + try { + $response = $this->api_client->post($path, $params); + } catch(InvalidStateException $e) { + if ($e->isIdempotentCreationConflict()) { + if ($this->api_client->error_on_idempotency_conflict) { + throw $e; + } + return $this->get($e->getConflictingResourceId()); + } + + throw $e; + } + + + return $this->getResourceForResponse($response); + } + + /** + * Create (with schedule) + * + * Example URL: /instalment_schedules + * + * @param string[mixed] $params An associative array for any params + * @return InstalmentSchedule + **/ + public function createWithSchedule($params = array()) { $path = "/instalment_schedules"; if(isset($params['params'])) { diff --git a/tests/Integration/InstalmentSchedulesIntegrationTest.php b/tests/Integration/InstalmentSchedulesIntegrationTest.php index 638b1e2b..2bfa65c5 100644 --- a/tests/Integration/InstalmentSchedulesIntegrationTest.php +++ b/tests/Integration/InstalmentSchedulesIntegrationTest.php @@ -14,13 +14,13 @@ public function testResourceModelExists() $this->assertNotNull($obj); } - public function testInstalmentSchedulesCreate() + public function testInstalmentSchedulesCreateWithDates() { - $fixture = $this->loadJsonFixture('instalment_schedules')->create; + $fixture = $this->loadJsonFixture('instalment_schedules')->create_with_dates; $this->stub_request($fixture); $service = $this->client->instalmentSchedules(); - $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); + $response = call_user_func_array(array($service, 'createWithDates'), (array)$fixture->url_params); $body = $fixture->body->instalment_schedules; @@ -42,9 +42,9 @@ public function testInstalmentSchedulesCreate() $this->assertRegExp($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); } - public function testInstalmentSchedulesCreateWithIdempotencyConflict() + public function testInstalmentSchedulesCreateWithDatesWithIdempotencyConflict() { - $fixture = $this->loadJsonFixture('instalment_schedules')->create; + $fixture = $this->loadJsonFixture('instalment_schedules')->create_with_dates; $idempotencyConflictResponseFixture = $this->loadFixture('idempotent_creation_conflict_invalid_state_error'); @@ -57,7 +57,73 @@ public function testInstalmentSchedulesCreateWithIdempotencyConflict() $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], json_encode($fixture->body))); $service = $this->client->instalmentSchedules(); - $response = call_user_func_array(array($service, 'create'), (array)$fixture->url_params); + $response = call_user_func_array(array($service, 'createWithDates'), (array)$fixture->url_params); + $body = $fixture->body->instalment_schedules; + + $this->assertInstanceOf('\GoCardlessPro\Resources\InstalmentSchedule', $response); + + $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->name, $response->name); + $this->assertEquals($body->payment_errors, $response->payment_errors); + $this->assertEquals($body->status, $response->status); + $this->assertEquals($body->total_amount, $response->total_amount); + + + $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $conflictRequest = $this->history[0]['request']; + $this->assertRegExp($expectedPathRegex, $conflictRequest->getUri()->getPath()); + $getRequest = $this->history[1]['request']; + $this->assertEquals($getRequest->getUri()->getPath(), '/instalment_schedules/ID123'); + } + + public function testInstalmentSchedulesCreateWithSchedule() + { + $fixture = $this->loadJsonFixture('instalment_schedules')->create_with_schedule; + $this->stub_request($fixture); + + $service = $this->client->instalmentSchedules(); + $response = call_user_func_array(array($service, 'createWithSchedule'), (array)$fixture->url_params); + + $body = $fixture->body->instalment_schedules; + + $this->assertInstanceOf('\GoCardlessPro\Resources\InstalmentSchedule', $response); + + $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->name, $response->name); + $this->assertEquals($body->payment_errors, $response->payment_errors); + $this->assertEquals($body->status, $response->status); + $this->assertEquals($body->total_amount, $response->total_amount); + + + $expectedPathRegex = $this->extract_resource_fixture_path_regex($fixture); + $dispatchedRequest = $this->history[0]['request']; + $this->assertRegExp($expectedPathRegex, $dispatchedRequest->getUri()->getPath()); + } + + public function testInstalmentSchedulesCreateWithScheduleWithIdempotencyConflict() + { + $fixture = $this->loadJsonFixture('instalment_schedules')->create_with_schedule; + + $idempotencyConflictResponseFixture = $this->loadFixture('idempotent_creation_conflict_invalid_state_error'); + + // The POST request responds with a 409 to our original POST, due to an idempotency conflict + $this->mock->append(new \GuzzleHttp\Psr7\Response(409, [], $idempotencyConflictResponseFixture)); + + // The client makes a second request to fetch the resource that was already + // created using our idempotency key. It responds with the created resource, + // which looks just like the response for a successful POST request. + $this->mock->append(new \GuzzleHttp\Psr7\Response(200, [], json_encode($fixture->body))); + + $service = $this->client->instalmentSchedules(); + $response = call_user_func_array(array($service, 'createWithSchedule'), (array)$fixture->url_params); $body = $fixture->body->instalment_schedules; $this->assertInstanceOf('\GoCardlessPro\Resources\InstalmentSchedule', $response); diff --git a/tests/Integration/SubscriptionsIntegrationTest.php b/tests/Integration/SubscriptionsIntegrationTest.php index 88a1a24f..a1a5aef5 100644 --- a/tests/Integration/SubscriptionsIntegrationTest.php +++ b/tests/Integration/SubscriptionsIntegrationTest.php @@ -28,6 +28,7 @@ public function testSubscriptionsCreate() $this->assertEquals($body->amount, $response->amount); $this->assertEquals($body->app_fee, $response->app_fee); + $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); @@ -73,6 +74,7 @@ public function testSubscriptionsCreateWithIdempotencyConflict() $this->assertEquals($body->amount, $response->amount); $this->assertEquals($body->app_fee, $response->app_fee); + $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); @@ -121,6 +123,7 @@ public function testSubscriptionsList() $record = $records[$num]; $this->assertEquals($body[$num]->amount, $record->amount); $this->assertEquals($body[$num]->app_fee, $record->app_fee); + $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); @@ -160,6 +163,7 @@ public function testSubscriptionsGet() $this->assertEquals($body->amount, $response->amount); $this->assertEquals($body->app_fee, $response->app_fee); + $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); @@ -198,6 +202,7 @@ public function testSubscriptionsUpdate() $this->assertEquals($body->amount, $response->amount); $this->assertEquals($body->app_fee, $response->app_fee); + $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); @@ -236,6 +241,7 @@ public function testSubscriptionsCancel() $this->assertEquals($body->amount, $response->amount); $this->assertEquals($body->app_fee, $response->app_fee); + $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); @@ -281,6 +287,7 @@ public function testSubscriptionsCancelWithIdempotencyConflict() $this->assertEquals($body->amount, $response->amount); $this->assertEquals($body->app_fee, $response->app_fee); + $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); diff --git a/tests/fixtures/bank_details_lookups.json b/tests/fixtures/bank_details_lookups.json index 5eccc1dd..85cb86b2 100644 --- a/tests/fixtures/bank_details_lookups.json +++ b/tests/fixtures/bank_details_lookups.json @@ -3,7 +3,7 @@ "method": "POST", "path_template": "/bank_details_lookups", "url_params": {}, - "body": {"bank_details_lookups":{"available_debit_schemes":["bacs"],"bank_name":null,"bic":null}} + "body": {"bank_details_lookups":{"available_debit_schemes":["bacs"],"bank_name":"NATWEST BANK PLC","bic":"BARCGB22XXX"}} } } diff --git a/tests/fixtures/creditor_bank_accounts.json b/tests/fixtures/creditor_bank_accounts.json index 357f4042..36b94282 100644 --- a/tests/fixtures/creditor_bank_accounts.json +++ b/tests/fixtures/creditor_bank_accounts.json @@ -9,19 +9,19 @@ "method": "GET", "path_template": "/creditor_bank_accounts", "url_params": {}, - "body": {"creditor_bank_accounts":[{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":null,"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":"Billie Jean","account_number_ending":"1234","account_type":null,"bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}],"meta":{"cursors":{"after":"example after 9267","before":"example before 1297"},"limit":50}} + "body": {"creditor_bank_accounts":[{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}},{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}],"meta":{"cursors":{"after":"example after 6258","before":"example before 1528"},"limit":50}} }, "get": { "method": "GET", "path_template": "/creditor_bank_accounts/:identity", "url_params": {"identity": "BA123"}, - "body": {"creditor_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":null,"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":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}} }, "disable": { "method": "POST", "path_template": "/creditor_bank_accounts/:identity/actions/disable", "url_params": {"identity": "BA123"}, - "body": {"creditor_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","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":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"creditor":"CR123"},"metadata":{}}} } } diff --git a/tests/fixtures/creditors.json b/tests/fixtures/creditors.json index 01bdc82c..9d898928 100644 --- a/tests/fixtures/creditors.json +++ b/tests/fixtures/creditors.json @@ -3,25 +3,25 @@ "method": "POST", "path_template": "/creditors", "url_params": {}, - "body": {"creditors":{"address_line1":null,"address_line2":"Islington","address_line3":null,"can_create_refunds":false,"city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","custom_payment_pages_enabled":true,"fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":null,"default_cad_payout_account":"BA792","default_dkk_payout_account":"BA790","default_eur_payout_account":"BA456","default_gbp_payout_account":null,"default_nzd_payout_account":"BA791","default_sek_payout_account":"BA789","default_usd_payout_account":"BA792"},"logo_url":"https://uploads.gocardless.com/logo.png","mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 1528","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 4425","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 4059","region":null,"scheme":"bacs"}],"verification_status":"action_required"}} + "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 8081","can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","custom_payment_pages_enabled":true,"fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":"BA792","default_dkk_payout_account":"BA790","default_eur_payout_account":"BA456","default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":"BA789","default_usd_payout_account":"BA792"},"logo_url":"https://uploads.gocardless.com/logo.png","mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 4059","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 1847","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 7887","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}} }, "list": { "method": "GET", "path_template": "/creditors", "url_params": {}, - "body": {"creditors":[{"address_line1":null,"address_line2":"Islington","address_line3":null,"can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","custom_payment_pages_enabled":true,"fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":null,"default_dkk_payout_account":"BA790","default_eur_payout_account":"BA456","default_gbp_payout_account":null,"default_nzd_payout_account":null,"default_sek_payout_account":"BA789","default_usd_payout_account":"BA792"},"logo_url":null,"mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Nude Wines","postal_code":null,"region":null,"scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":null,"address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 6831","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 408","region":null,"scheme":"bacs"}],"verification_status":"action_required"},{"address_line1":null,"address_line2":null,"address_line3":"example address_line3 6159","can_create_refunds":false,"city":null,"country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","custom_payment_pages_enabled":true,"fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":null,"default_dkk_payout_account":null,"default_eur_payout_account":null,"default_gbp_payout_account":null,"default_nzd_payout_account":"BA791","default_sek_payout_account":null,"default_usd_payout_account":"BA792"},"logo_url":"https://uploads.gocardless.com/logo.png","mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":null,"scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":null,"can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 8705","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 2199","region":null,"scheme":"bacs"}],"verification_status":"action_required"}],"meta":{"cursors":{"after":"example after 9947","before":"example before 8047"},"limit":50}} + "body": {"creditors":[{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 2081","can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","custom_payment_pages_enabled":true,"fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":"BA792","default_dkk_payout_account":"BA790","default_eur_payout_account":"BA456","default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":"BA789","default_usd_payout_account":"BA792"},"logo_url":"https://uploads.gocardless.com/logo.png","mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 1318","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 2540","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 4425","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"},{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 456","can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","custom_payment_pages_enabled":true,"fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":"BA792","default_dkk_payout_account":"BA790","default_eur_payout_account":"BA456","default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":"BA789","default_usd_payout_account":"BA792"},"logo_url":"https://uploads.gocardless.com/logo.png","mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 8511","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 3300","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 694","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}],"meta":{"cursors":{"after":"example after 8162","before":"example before 5089"},"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,"can_create_refunds":false,"city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","custom_payment_pages_enabled":true,"fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":null,"default_cad_payout_account":null,"default_dkk_payout_account":null,"default_eur_payout_account":"BA456","default_gbp_payout_account":null,"default_nzd_payout_account":"BA791","default_sek_payout_account":null,"default_usd_payout_account":null},"logo_url":"https://uploads.gocardless.com/logo.png","mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Nude Wines","postal_code":null,"region":"example region 5094","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":null,"address_line3":null,"can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 8623","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 7996","region":null,"scheme":"bacs"}],"verification_status":"action_required"}} + "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 4728","can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","custom_payment_pages_enabled":true,"fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":"BA792","default_dkk_payout_account":"BA790","default_eur_payout_account":"BA456","default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":"BA789","default_usd_payout_account":"BA792"},"logo_url":"https://uploads.gocardless.com/logo.png","mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 3274","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 1211","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 1445","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}} }, "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,"can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","custom_payment_pages_enabled":true,"fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":null,"default_dkk_payout_account":null,"default_eur_payout_account":null,"default_gbp_payout_account":null,"default_nzd_payout_account":"BA791","default_sek_payout_account":null,"default_usd_payout_account":"BA792"},"logo_url":null,"mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":null,"scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":null,"address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 6503","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 2205","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}} + "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 3237","can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","custom_payment_pages_enabled":true,"fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":"BA792","default_dkk_payout_account":"BA790","default_eur_payout_account":"BA456","default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":"BA789","default_usd_payout_account":"BA792"},"logo_url":"https://uploads.gocardless.com/logo.png","mandate_imports_enabled":true,"merchant_responsible_for_notifications":true,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 9106","scheme_identifiers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","can_specify_mandate_reference":false,"city":"London","country_code":"GB","currency":"EUR","email":"user@example.com","minimum_advance_notice":3,"name":"example name 5466","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 495","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}} } } diff --git a/tests/fixtures/currency_exchange_rates.json b/tests/fixtures/currency_exchange_rates.json index e32d157b..38bdcd10 100644 --- a/tests/fixtures/currency_exchange_rates.json +++ b/tests/fixtures/currency_exchange_rates.json @@ -3,7 +3,7 @@ "method": "GET", "path_template": "/currency_exchange_rates", "url_params": {}, - "body": {"currency_exchange_rates":[{"rate":"1.1234567890","source":"GBP","target":"EUR","time":"2014-01-01T12:00:00Z"},{"rate":"1.1234567890","source":"GBP","target":"EUR","time":"2014-01-01T12:00:00Z"}],"meta":{"cursors":{"after":"example after 6052","before":"example before 8981"},"limit":50}} + "body": {"currency_exchange_rates":[{"rate":"1.1234567890","source":"GBP","target":"EUR","time":"2014-01-01T12:00:00Z"},{"rate":"1.1234567890","source":"GBP","target":"EUR","time":"2014-01-01T12:00:00Z"}],"meta":{"cursors":{"after":"example after 8047","before":"example before 9947"},"limit":50}} } } diff --git a/tests/fixtures/customer_bank_accounts.json b/tests/fixtures/customer_bank_accounts.json index cbb3df31..bfe3e0cf 100644 --- a/tests/fixtures/customer_bank_accounts.json +++ b/tests/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":"Billie Jean","account_number_ending":"1234","account_type":"savings","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 8470"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 2790"},"metadata":{}}} }, "list": { "method": "GET", "path_template": "/customer_bank_accounts", "url_params": {}, - "body": {"customer_bank_accounts":[{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":null,"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 2520"},"metadata":{}},{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":null,"bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 7029"},"metadata":{}}],"meta":{"cursors":{"after":"example after 2420","before":"example before 60"},"limit":50}} + "body": {"customer_bank_accounts":[{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 3015"},"metadata":{}},{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 5541"},"metadata":{}}],"meta":{"cursors":{"after":"example after 7387","before":"example before 408"},"limit":50}} }, "get": { "method": "GET", "path_template": "/customer_bank_accounts/:identity", "url_params": {"identity": "BA123"}, - "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":null,"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 1464"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 6831"},"metadata":{}}} }, "update": { "method": "PUT", "path_template": "/customer_bank_accounts/:identity", "url_params": {"identity": "BA123"}, - "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":null,"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 9551"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 5429"},"metadata":{}}} }, "disable": { "method": "POST", "path_template": "/customer_bank_accounts/:identity/actions/disable", "url_params": {"identity": "BA123"}, - "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","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 7039"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"1234","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","enabled":true,"id":"BA123","links":{"customer":"example customer 5356"},"metadata":{}}} } } diff --git a/tests/fixtures/customer_notifications.json b/tests/fixtures/customer_notifications.json index 5254212b..9d0dc201 100644 --- a/tests/fixtures/customer_notifications.json +++ b/tests/fixtures/customer_notifications.json @@ -3,7 +3,7 @@ "method": "POST", "path_template": "/customer_notifications/:identity/actions/handle", "url_params": {"identity": "PCN123"}, - "body": {"customer_notifications":{"action_taken":"example action_taken 5561","action_taken_at":"2020-02-26T13:10:56.052Z","action_taken_by":null,"id":"PCN123","links":{"customer":"CU123","event":"EV123","mandate":"MD123","payment":"PM123","refund":"RF123","subscription":"SB123"},"type":"payment_created"}} + "body": {"customer_notifications":{"action_taken":"example action_taken 1737","action_taken_at":"2020-03-04T15:16:22.516Z","action_taken_by":"example action_taken_by 631","id":"PCN123","links":{"customer":"CU123","event":"EV123","mandate":"MD123","payment":"PM123","refund":"RF123","subscription":"SB123"},"type":"payment_created"}} } } diff --git a/tests/fixtures/customers.json b/tests/fixtures/customers.json index d9b5e707..853fe53e 100644 --- a/tests/fixtures/customers.json +++ b/tests/fixtures/customers.json @@ -3,31 +3,31 @@ "method": "POST", "path_template": "/customers", "url_params": {}, - "body": {"customers":{"address_line1":null,"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","danish_identity_number":"220550-6218","email":null,"family_name":"Osborne","given_name":null,"id":"CU123","language":null,"metadata":{},"phone_number":"+64 4 817 9999","postal_code":null,"region":"Greater London","swedish_identity_number":"556564-5404"}} + "body": {"customers":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"}} }, "list": { "method": "GET", "path_template": "/customers", "url_params": {}, - "body": {"customers":[{"address_line1":null,"address_line2":"Marylebone","address_line3":null,"city":null,"company_name":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":"user@example.com","family_name":"Osborne","given_name":null,"id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":null,"region":"Greater London","swedish_identity_number":null},{"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","danish_identity_number":"220550-6218","email":null,"family_name":null,"given_name":null,"id":"CU123","language":"en","metadata":{},"phone_number":null,"postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":null}],"meta":{"cursors":{"after":"example after 5786","before":"example before 540"},"limit":50}} + "body": {"customers":[{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"}],"meta":{"cursors":{"after":"example after 8287","before":"example before 2888"},"limit":50}} }, "get": { "method": "GET", "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":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":null,"email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","region":null,"swedish_identity_number":"556564-5404"}} + "body": {"customers":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","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":"Marylebone","address_line3":null,"city":null,"company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":null,"family_name":"Osborne","given_name":null,"id":"CU123","language":null,"metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","region":null,"swedish_identity_number":"556564-5404"}} + "body": {"customers":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"}} }, "remove": { "method": "DELETE", "path_template": "/customers/:identity", "url_params": {"identity": "CU123"}, - "body": {"customers":{"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","danish_identity_number":"220550-6218","email":null,"family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":null,"postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"}} + "body": {"customers":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"}} } } diff --git a/tests/fixtures/events.json b/tests/fixtures/events.json index 49dca402..f48625ac 100644 --- a/tests/fixtures/events.json +++ b/tests/fixtures/events.json @@ -3,13 +3,13 @@ "method": "GET", "path_template": "/events", "url_params": {}, - "body": {"events":[{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","customer_notifications":null,"details":{"cause":"bank_account_disabled","description":"Customer's bank account closed","origin":"bank","reason_code":"ADDACS-B","scheme":"bacs","will_attempt_retry":true},"id":"EV123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","new_customer_bank_account":"BA123","new_mandate":"MD123","organisation":"OR123","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","customer_notifications":null,"details":{"cause":"bank_account_disabled","description":"Customer's bank account closed","origin":"bank","reason_code":"ADDACS-B","scheme":"bacs","will_attempt_retry":true},"id":"EV123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","new_customer_bank_account":"BA123","new_mandate":"MD123","organisation":"OR123","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 5014","before":"example before 1719"},"limit":50}} + "body": {"events":[{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","customer_notifications":[{"deadline":"2020-03-04T15:16:22.518Z","id":"PCN123","mandatory":true,"type":"payment_created"}],"details":{"cause":"bank_account_disabled","description":"Customer's bank account closed","origin":"bank","reason_code":"ADDACS-B","scheme":"bacs","will_attempt_retry":true},"id":"EV123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","new_customer_bank_account":"BA123","new_mandate":"MD123","organisation":"OR123","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","customer_notifications":[{"deadline":"2020-03-04T15:16:22.518Z","id":"PCN123","mandatory":false,"type":"payment_created"}],"details":{"cause":"bank_account_disabled","description":"Customer's bank account closed","origin":"bank","reason_code":"ADDACS-B","scheme":"bacs","will_attempt_retry":true},"id":"EV123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","new_customer_bank_account":"BA123","new_mandate":"MD123","organisation":"OR123","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 3090","before":"example before 6413"},"limit":50}} }, "get": { "method": "GET", "path_template": "/events/:identity", "url_params": {"identity": "EV123"}, - "body": {"events":{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","customer_notifications":null,"details":{"cause":"bank_account_disabled","description":"Customer's bank account closed","origin":"bank","reason_code":"ADDACS-B","scheme":"bacs","will_attempt_retry":true},"id":"EV123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","new_customer_bank_account":"BA123","new_mandate":"MD123","organisation":"OR123","parent_event":"EV123","payment":"PM123","payout":"PO123","previous_customer_bank_account":"BA123","refund":"RF123","subscription":"SB123"},"metadata":{},"resource_type":"mandates"}} + "body": {"events":{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","customer_notifications":[{"deadline":"2020-03-04T15:16:22.518Z","id":"PCN123","mandatory":true,"type":"payment_created"}],"details":{"cause":"bank_account_disabled","description":"Customer's bank account closed","origin":"bank","reason_code":"ADDACS-B","scheme":"bacs","will_attempt_retry":true},"id":"EV123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","new_customer_bank_account":"BA123","new_mandate":"MD123","organisation":"OR123","parent_event":"EV123","payment":"PM123","payout":"PO123","previous_customer_bank_account":"BA123","refund":"RF123","subscription":"SB123"},"metadata":{},"resource_type":"mandates"}} } } diff --git a/tests/fixtures/instalment_schedules.json b/tests/fixtures/instalment_schedules.json index 40b8f12b..1fae8f2b 100644 --- a/tests/fixtures/instalment_schedules.json +++ b/tests/fixtures/instalment_schedules.json @@ -1,5 +1,11 @@ { - "create": { + "create_with_dates": { + "method": "POST", + "path_template": "/instalment_schedules", + "url_params": {}, + "body": {"instalment_schedules":{"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"IS123","links":{"customer":"CU123","mandate":"MD123","payments":["PM123","PM456"]},"metadata":{},"name":"Invoice 4404","payment_errors":"{\n \"0\": [],\n \"1\": {\n \"field\": \"charge_date\",\n \"message\": \"must be on or after mandate's next_possible_customer_charge_date\"\n }\n}","status":"active","total_amount":"1000"}} + }, + "create_with_schedule": { "method": "POST", "path_template": "/instalment_schedules", "url_params": {}, @@ -9,7 +15,7 @@ "method": "GET", "path_template": "/instalment_schedules", "url_params": {}, - "body": {"instalment_schedules":[{"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"IS123","links":{"customer":"CU123","mandate":"MD123","payments":["PM123","PM456"]},"metadata":{},"name":"Invoice 4404","payment_errors":"{\n \"0\": [],\n \"1\": {\n \"field\": \"charge_date\",\n \"message\": \"must be on or after mandate's next_possible_customer_charge_date\"\n }\n}","status":"active","total_amount":"1000"},{"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"IS123","links":{"customer":"CU123","mandate":"MD123","payments":["PM123","PM456"]},"metadata":{},"name":"Invoice 4404","payment_errors":"{\n \"0\": [],\n \"1\": {\n \"field\": \"charge_date\",\n \"message\": \"must be on or after mandate's next_possible_customer_charge_date\"\n }\n}","status":"active","total_amount":"1000"}],"meta":{"cursors":{"after":"example after 5740","before":"example before 8662"},"limit":50}} + "body": {"instalment_schedules":[{"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"IS123","links":{"customer":"CU123","mandate":"MD123","payments":["PM123","PM456"]},"metadata":{},"name":"Invoice 4404","payment_errors":"{\n \"0\": [],\n \"1\": {\n \"field\": \"charge_date\",\n \"message\": \"must be on or after mandate's next_possible_customer_charge_date\"\n }\n}","status":"active","total_amount":"1000"},{"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"IS123","links":{"customer":"CU123","mandate":"MD123","payments":["PM123","PM456"]},"metadata":{},"name":"Invoice 4404","payment_errors":"{\n \"0\": [],\n \"1\": {\n \"field\": \"charge_date\",\n \"message\": \"must be on or after mandate's next_possible_customer_charge_date\"\n }\n}","status":"active","total_amount":"1000"}],"meta":{"cursors":{"after":"example after 2433","before":"example before 563"},"limit":50}} }, "get": { "method": "GET", diff --git a/tests/fixtures/mandate_import_entries.json b/tests/fixtures/mandate_import_entries.json index 2051c715..fd25e102 100644 --- a/tests/fixtures/mandate_import_entries.json +++ b/tests/fixtures/mandate_import_entries.json @@ -9,7 +9,7 @@ "method": "GET", "path_template": "/mandate_import_entries", "url_params": {}, - "body": {"mandate_import_entries":[{"created_at":"2014-01-01T12:00:00.000Z","links":{"customer":"CU123","customer_bank_account":"BA123","mandate":"MD123","mandate_import":"IM0000AAAAAAA"},"record_identifier":"bank-file.xml/line-1"},{"created_at":"2014-01-01T12:00:00.000Z","links":{"customer":"CU123","customer_bank_account":"BA123","mandate":"MD123","mandate_import":"IM0000AAAAAAA"},"record_identifier":null}],"meta":{"cursors":{"after":"example after 5265","before":"example before 8151"},"limit":50}} + "body": {"mandate_import_entries":[{"created_at":"2014-01-01T12:00:00.000Z","links":{"customer":"CU123","customer_bank_account":"BA123","mandate":"MD123","mandate_import":"IM0000AAAAAAA"},"record_identifier":"bank-file.xml/line-1"},{"created_at":"2014-01-01T12:00:00.000Z","links":{"customer":"CU123","customer_bank_account":"BA123","mandate":"MD123","mandate_import":"IM0000AAAAAAA"},"record_identifier":"bank-file.xml/line-1"}],"meta":{"cursors":{"after":"example after 6159","before":"example before 4324"},"limit":50}} } } diff --git a/tests/fixtures/mandates.json b/tests/fixtures/mandates.json index 5ab58318..5d17b163 100644 --- a/tests/fixtures/mandates.json +++ b/tests/fixtures/mandates.json @@ -3,37 +3,37 @@ "method": "POST", "path_template": "/mandates", "url_params": {}, - "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":null,"payments_require_approval":"false","reference":"REF-123","scheme":null,"status":"pending_submission"}} + "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":"2014-10-27","payments_require_approval":"false","reference":"REF-123","scheme":"bacs","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":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":null,"payments_require_approval":"false","reference":"REF-123","scheme":"bacs","status":"pending_submission"},{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":null,"payments_require_approval":"false","reference":null,"scheme":"bacs","status":"pending_submission"}],"meta":{"cursors":{"after":"example after 6336","before":"example before 8070"},"limit":50}} + "body": {"mandates":[{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":"2014-10-27","payments_require_approval":"false","reference":"REF-123","scheme":"bacs","status":"pending_submission"},{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":"2014-10-27","payments_require_approval":"false","reference":"REF-123","scheme":"bacs","status":"pending_submission"}],"meta":{"cursors":{"after":"example after 4078","before":"example before 4147"},"limit":50}} }, "get": { "method": "GET", "path_template": "/mandates/:identity", "url_params": {"identity": "MD123"}, - "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":null,"payments_require_approval":"false","reference":"REF-123","scheme":"bacs","status":"pending_submission"}} + "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":"2014-10-27","payments_require_approval":"false","reference":"REF-123","scheme":"bacs","status":"pending_submission"}} }, "update": { "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":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":null,"payments_require_approval":"false","reference":"REF-123","scheme":null,"status":"pending_submission"}} + "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":"2014-10-27","payments_require_approval":"false","reference":"REF-123","scheme":"bacs","status":"pending_submission"}} }, "cancel": { "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":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":null,"payments_require_approval":"false","reference":"REF-123","scheme":"bacs","status":"pending_submission"}} + "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":"2014-10-27","payments_require_approval":"false","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":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":"2014-10-27","payments_require_approval":"false","reference":null,"scheme":null,"status":"pending_submission"}} + "body": {"mandates":{"created_at":"2014-01-01T12:00:00.000Z","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"metadata":{},"next_possible_charge_date":"2014-10-27","payments_require_approval":"false","reference":"REF-123","scheme":"bacs","status":"pending_submission"}} } } diff --git a/tests/fixtures/payments.json b/tests/fixtures/payments.json index 1bdc1154..89bb83f7 100644 --- a/tests/fixtures/payments.json +++ b/tests/fixtures/payments.json @@ -3,37 +3,37 @@ "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,"fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":null,"fx_amount":null,"fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":false,"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","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":false,"status":"submitted"}} }, "list": { "method": "GET", "path_template": "/payments", "url_params": {}, - "body": {"meta":{"cursors":{"after":"example after 106","before":"example before 6537"},"limit":50},"payments":[{"amount":"1000","amount_refunded":"150","charge_date":"2014-05-21","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":null,"fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":null,"fx_amount":null,"fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":false,"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","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":null,"fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":false,"status":"submitted"}]} + "body": {"meta":{"cursors":{"after":"example after 7189","before":"example before 2199"},"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","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":true,"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","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":false,"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":null,"fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":null,"fx_amount":null,"fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"retry_if_possible":false,"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","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":true,"status":"submitted"}} }, "update": { "method": "PUT", "path_template": "/payments/:identity", "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","fx":{"estimated_exchange_rate":null,"exchange_rate":null,"fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"retry_if_possible":true,"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","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":false,"status":"submitted"}} }, "cancel": { "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,"fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":null,"fx_amount":null,"fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"retry_if_possible":false,"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","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":false,"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","fx":{"estimated_exchange_rate":null,"exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"retry_if_possible":true,"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","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","instalment_schedule":"IS123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","retry_if_possible":true,"status":"submitted"}} } } diff --git a/tests/fixtures/payout_items.json b/tests/fixtures/payout_items.json index eb80ab25..eda71238 100644 --- a/tests/fixtures/payout_items.json +++ b/tests/fixtures/payout_items.json @@ -3,7 +3,7 @@ "method": "GET", "path_template": "/payout_items", "url_params": {}, - "body": {"meta":{"cursors":{"after":"example after 1466","before":"example before 1509"},"limit":10},"payout_items":[{"amount":"45.0","links":{"mandate":"MD123","payment":"PM123"},"type":"payment_paid_out"},{"amount":"45.0","links":{"mandate":"MD123","payment":"PM123"},"type":"payment_paid_out"}]} + "body": {"meta":{"cursors":{"after":"example after 8510","before":"example before 2451"},"limit":10},"payout_items":[{"amount":"45.0","links":{"mandate":"MD123","payment":"PM123"},"type":"payment_paid_out"},{"amount":"45.0","links":{"mandate":"MD123","payment":"PM123"},"type":"payment_paid_out"}]} } } diff --git a/tests/fixtures/payouts.json b/tests/fixtures/payouts.json index b6936b14..5ffb7eb8 100644 --- a/tests/fixtures/payouts.json +++ b/tests/fixtures/payouts.json @@ -3,13 +3,13 @@ "method": "GET", "path_template": "/payouts", "url_params": {}, - "body": {"meta":{"cursors":{"after":"example after 1128","before":"example before 2409"},"limit":50},"payouts":[{"amount":"1000","arrival_date":"2014-01-01","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":"20","fx":{"estimated_exchange_rate":null,"exchange_rate":null,"fx_amount":"1150","fx_currency":"EUR"},"id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"payout_type":"merchant","reference":"ref-1","status":"pending"},{"amount":"1000","arrival_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":"20","fx":{"estimated_exchange_rate":null,"exchange_rate":null,"fx_amount":null,"fx_currency":"EUR"},"id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"payout_type":"merchant","reference":"ref-1","status":"pending"}]} + "body": {"meta":{"cursors":{"after":"example after 9355","before":"example before 9703"},"limit":50},"payouts":[{"amount":"1000","arrival_date":"2014-01-01","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":"20","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"payout_type":"merchant","reference":"ref-1","status":"pending"},{"amount":"1000","arrival_date":"2014-01-01","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":"20","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"payout_type":"merchant","reference":"ref-1","status":"pending"}]} }, "get": { "method": "GET", "path_template": "/payouts/:identity", "url_params": {"identity": "PO123"}, - "body": {"payouts":{"amount":"1000","arrival_date":"2014-01-01","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":"20","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":null,"fx_currency":"EUR"},"id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"payout_type":"merchant","reference":"ref-1","status":"pending"}} + "body": {"payouts":{"amount":"1000","arrival_date":"2014-01-01","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":"20","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"payout_type":"merchant","reference":"ref-1","status":"pending"}} } } diff --git a/tests/fixtures/refunds.json b/tests/fixtures/refunds.json index 01dd05af..2c0df8c0 100644 --- a/tests/fixtures/refunds.json +++ b/tests/fixtures/refunds.json @@ -3,25 +3,25 @@ "method": "POST", "path_template": "/refunds", "url_params": {}, - "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":null,"exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}} + "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}} }, "list": { "method": "GET", "path_template": "/refunds", "url_params": {}, - "body": {"meta":{"cursors":{"after":"example after 8558","before":"example before 8265"},"limit":50},"refunds":[{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":null,"fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"},{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":null,"fx_amount":null,"fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}]} + "body": {"meta":{"cursors":{"after":"example after 156","before":"example before 2605"},"limit":50},"refunds":[{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"},{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}]} }, "get": { "method": "GET", "path_template": "/refunds/:identity", "url_params": {"identity": "RF123"}, - "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":null,"fx_amount":"1150","fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":null,"status":"submitted"}} + "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}} }, "update": { "method": "PUT", "path_template": "/refunds/:identity", "url_params": {"identity": "RF123"}, - "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":null,"fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":null,"status":"submitted"}} + "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":"1.1234567890","exchange_rate":"1.1234567890","fx_amount":"1150","fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}} } } diff --git a/tests/fixtures/subscriptions.json b/tests/fixtures/subscriptions.json index 99e0ee1c..7db5aea1 100644 --- a/tests/fixtures/subscriptions.json +++ b/tests/fixtures/subscriptions.json @@ -3,31 +3,31 @@ "method": "POST", "path_template": "/subscriptions", "url_params": {}, - "body": {"subscriptions":{"amount":"1000","app_fee":null,"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","retry_if_possible":false,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} + "body": {"subscriptions":{"amount":"1000","app_fee":"100","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 subscription","payment_reference":"GOLDPLAN","retry_if_possible":false,"start_date":"2014-10-21","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 8956","before":"example before 8398"},"limit":50},"subscriptions":[{"amount":"1000","app_fee":"100","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 subscription","payment_reference":null,"retry_if_possible":false,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]},{"amount":"1000","app_fee":null,"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,"retry_if_possible":true,"start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}]} + "body": {"meta":{"cursors":{"after":"example after 5561","before":"example before 9828"},"limit":50},"subscriptions":[{"amount":"1000","app_fee":"100","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 subscription","payment_reference":"GOLDPLAN","retry_if_possible":true,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]},{"amount":"1000","app_fee":"100","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 subscription","payment_reference":"GOLDPLAN","retry_if_possible":true,"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","app_fee":null,"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,"retry_if_possible":true,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} + "body": {"subscriptions":{"amount":"1000","app_fee":"100","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 subscription","payment_reference":"GOLDPLAN","retry_if_possible":true,"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","app_fee":"100","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 subscription","payment_reference":null,"retry_if_possible":false,"start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} + "body": {"subscriptions":{"amount":"1000","app_fee":"100","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 subscription","payment_reference":"GOLDPLAN","retry_if_possible":false,"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","app_fee":null,"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 subscription","payment_reference":null,"retry_if_possible":false,"start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} + "body": {"subscriptions":{"amount":"1000","app_fee":"100","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 subscription","payment_reference":"GOLDPLAN","retry_if_possible":false,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} } }