From 95c921b973423a0ca2fdff16a7ebfee18821304e Mon Sep 17 00:00:00 2001 From: Robot Date: Mon, 29 Jul 2019 13:42:56 +0000 Subject: [PATCH] Release v1.11.0 - Add fx_payout_currency to creditor - Add fx to payment, payout and refund --- gocardless_pro/__init__.py | 2 +- gocardless_pro/api_client.py | 4 +- gocardless_pro/resources/creditor.py | 7 ++++ gocardless_pro/resources/payment.py | 30 ++++++++++++++ gocardless_pro/resources/payout.py | 30 ++++++++++++++ gocardless_pro/resources/refund.py | 30 ++++++++++++++ setup.py | 2 +- tests/fixtures/creditor_bank_accounts.json | 8 ++-- tests/fixtures/creditors.json | 8 ++-- tests/fixtures/customer_bank_accounts.json | 10 ++--- tests/fixtures/customer_notifications.json | 2 +- tests/fixtures/customers.json | 10 ++--- tests/fixtures/events.json | 4 +- tests/fixtures/mandate_import_entries.json | 2 +- tests/fixtures/mandates.json | 6 +-- tests/fixtures/payments.json | 12 +++--- tests/fixtures/payout_items.json | 2 +- tests/fixtures/payouts.json | 4 +- tests/fixtures/refunds.json | 8 ++-- tests/fixtures/subscriptions.json | 10 ++--- .../integration/creditors_integration_test.py | 5 +++ .../integration/payments_integration_test.py | 40 +++++++++++++++++++ tests/integration/payouts_integration_test.py | 8 ++++ tests/integration/refunds_integration_test.py | 24 +++++++++++ 24 files changed, 221 insertions(+), 47 deletions(-) diff --git a/gocardless_pro/__init__.py b/gocardless_pro/__init__.py index 7a77ac7f..5126e19f 100644 --- a/gocardless_pro/__init__.py +++ b/gocardless_pro/__init__.py @@ -2,5 +2,5 @@ from .client import Client -__version__ = '1.10.0' +__version__ = '1.11.0' diff --git a/gocardless_pro/api_client.py b/gocardless_pro/api_client.py index d21259c0..9b424af5 100644 --- a/gocardless_pro/api_client.py +++ b/gocardless_pro/api_client.py @@ -141,7 +141,7 @@ def _default_headers(self): 'Authorization': 'Bearer {0}'.format(self.access_token), 'Content-Type': 'application/json', 'GoCardless-Client-Library': 'gocardless-pro-python', - 'GoCardless-Client-Version': '1.10.0', + 'GoCardless-Client-Version': '1.11.0', 'User-Agent': self._user_agent(), 'GoCardless-Version': '2015-07-06', } @@ -150,7 +150,7 @@ def _user_agent(self): python_version = '.'.join(platform.python_version_tuple()[0:2]) vm_version = '{}.{}.{}-{}{}'.format(*sys.version_info) return ' '.join([ - 'gocardless-pro-python/1.10.0', + 'gocardless-pro-python/1.11.0', 'python/{0}'.format(python_version), '{0}/{1}'.format(platform.python_implementation(), vm_version), '{0}/{1}'.format(platform.system(), platform.release()), diff --git a/gocardless_pro/resources/creditor.py b/gocardless_pro/resources/creditor.py index 90504761..2b6fb7e8 100644 --- a/gocardless_pro/resources/creditor.py +++ b/gocardless_pro/resources/creditor.py @@ -51,6 +51,11 @@ def created_at(self): return self.attributes.get('created_at') + @property + def fx_payout_currency(self): + return self.attributes.get('fx_payout_currency') + + @property def id(self): return self.attributes.get('id') @@ -107,6 +112,8 @@ def verification_status(self): + + class Links(object): diff --git a/gocardless_pro/resources/payment.py b/gocardless_pro/resources/payment.py index dbfffa46..a5cdcd06 100644 --- a/gocardless_pro/resources/payment.py +++ b/gocardless_pro/resources/payment.py @@ -46,6 +46,11 @@ def description(self): return self.attributes.get('description') + @property + def fx(self): + return self.Fx(self.attributes.get('fx')) + + @property def id(self): return self.attributes.get('id') @@ -85,6 +90,31 @@ def status(self): + class Fx(object): + """Wrapper for the response's 'fx' attribute.""" + + def __init__(self, attributes): + self.attributes = attributes + + @property + def estimated_exchange_rate(self): + return self.attributes.get('estimated_exchange_rate') + + @property + def exchange_rate(self): + return self.attributes.get('exchange_rate') + + @property + def fx_amount(self): + return self.attributes.get('fx_amount') + + @property + def fx_currency(self): + return self.attributes.get('fx_currency') + + + + class Links(object): diff --git a/gocardless_pro/resources/payout.py b/gocardless_pro/resources/payout.py index 447dadc2..3e195686 100644 --- a/gocardless_pro/resources/payout.py +++ b/gocardless_pro/resources/payout.py @@ -41,6 +41,11 @@ def deducted_fees(self): return self.attributes.get('deducted_fees') + @property + def fx(self): + return self.Fx(self.attributes.get('fx')) + + @property def id(self): return self.attributes.get('id') @@ -78,6 +83,31 @@ def status(self): + class Fx(object): + """Wrapper for the response's 'fx' attribute.""" + + def __init__(self, attributes): + self.attributes = attributes + + @property + def estimated_exchange_rate(self): + return self.attributes.get('estimated_exchange_rate') + + @property + def exchange_rate(self): + return self.attributes.get('exchange_rate') + + @property + def fx_amount(self): + return self.attributes.get('fx_amount') + + @property + def fx_currency(self): + return self.attributes.get('fx_currency') + + + + class Links(object): diff --git a/gocardless_pro/resources/refund.py b/gocardless_pro/resources/refund.py index 8884b696..50f3fd94 100644 --- a/gocardless_pro/resources/refund.py +++ b/gocardless_pro/resources/refund.py @@ -31,6 +31,11 @@ def currency(self): return self.attributes.get('currency') + @property + def fx(self): + return self.Fx(self.attributes.get('fx')) + + @property def id(self): return self.attributes.get('id') @@ -59,6 +64,31 @@ def reference(self): + class Fx(object): + """Wrapper for the response's 'fx' attribute.""" + + def __init__(self, attributes): + self.attributes = attributes + + @property + def estimated_exchange_rate(self): + return self.attributes.get('estimated_exchange_rate') + + @property + def exchange_rate(self): + return self.attributes.get('exchange_rate') + + @property + def fx_amount(self): + return self.attributes.get('fx_amount') + + @property + def fx_currency(self): + return self.attributes.get('fx_currency') + + + + class Links(object): diff --git a/setup.py b/setup.py index 4997b8f0..016219f0 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name = 'gocardless_pro', - version = '1.10.0', + version = '1.11.0', packages = find_packages(exclude=['tests']), install_requires = ['requests>=2.6', 'six'], author = 'GoCardless', diff --git a/tests/fixtures/creditor_bank_accounts.json b/tests/fixtures/creditor_bank_accounts.json index 5189bc5d..0284a8d6 100644 --- a/tests/fixtures/creditor_bank_accounts.json +++ b/tests/fixtures/creditor_bank_accounts.json @@ -3,24 +3,24 @@ "method": "POST", "path_template": "/creditor_bank_accounts", "url_params": [], - "body": {"creditor_bank_accounts":{"account_holder_name":"Nude Wines","account_number_ending":"11","account_type":"savings","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":{}}} + "body": {"creditor_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","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","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":"Nude Wines","account_number_ending":"11","account_type":"savings","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":{}}],"meta":{"cursors":{"after":"example after 3981","before":"example before 5802"},"limit":50}} + "body": {"creditor_bank_accounts":[{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":null,"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":"11","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 6137","before":"example before 9267"},"limit":50}} }, "get": { "method": "GET", "path_template": "/creditor_bank_accounts/:identity", "url_params": ["BA123"], - "body": {"creditor_bank_accounts":{"account_holder_name":"Nude Wines","account_number_ending":"11","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":"11","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":{}}} }, "disable": { "method": "POST", "path_template": "/creditor_bank_accounts/:identity/actions/disable", "url_params": ["BA123"], - "body": {"creditor_bank_accounts":{"account_holder_name":"Nude Wines","account_number_ending":"11","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":"11","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":{"creditor":"CR123"},"metadata":{}}} } } diff --git a/tests/fixtures/creditors.json b/tests/fixtures/creditors.json index 26ad0459..e4830b88 100644 --- a/tests/fixtures/creditors.json +++ b/tests/fixtures/creditors.json @@ -3,24 +3,24 @@ "method": "POST", "path_template": "/creditors", "url_params": [], - "body": {"creditors":{"address_line1":null,"address_line2":"Islington","address_line3":"example address_line3 1318","can_create_refunds":false,"city":null,"country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":"BA792","default_dkk_payout_account":"BA790","default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":"BA789"},"logo_url":null,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 2540","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 3237","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 5466","region":null,"scheme":"bacs"}],"verification_status":"action_required"}} + "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","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":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":null},"logo_url":"https://uploads.gocardless.com/logo.png","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 9106","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 1211","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}} }, "list": { "method": "GET", "path_template": "/creditors", "url_params": [], - "body": {"creditors":[{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 8287","can_create_refunds":false,"city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":null,"default_dkk_payout_account":"BA790","default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_nzd_payout_account":null,"default_sek_payout_account":null},"logo_url":"https://uploads.gocardless.com/logo.png","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 6413","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 563","region":null,"scheme":"bacs"}],"verification_status":"action_required"},{"address_line1":"338-346 Goswell Road","address_line2":null,"address_line3":"example address_line3 9355","can_create_refunds":false,"city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","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":"BA123","default_nzd_payout_account":null,"default_sek_payout_account":null},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":null,"region":"example region 4324","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 1957","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 3000","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}],"meta":{"cursors":{"after":"example after 4783","before":"example before 7202"},"limit":50}} + "body": {"creditors":[{"address_line1":null,"address_line2":null,"address_line3":null,"can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","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":null,"default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":"BA789"},"logo_url":null,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":"example region 3090","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 8287","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 2888","region":null,"scheme":"bacs"}],"verification_status":"action_required"},{"address_line1":"338-346 Goswell Road","address_line2":"Islington","address_line3":"example address_line3 3000","can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":null,"default_cad_payout_account":null,"default_dkk_payout_account":"BA790","default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_nzd_payout_account":null,"default_sek_payout_account":"BA789"},"logo_url":null,"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 6159","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 1353","region":null,"scheme":"bacs"}],"verification_status":"action_required"}],"meta":{"cursors":{"after":"example after 9828","before":"example before 8266"},"limit":50}} }, "get": { "method": "GET", "path_template": "/creditors/:identity", "url_params": ["CR123"], - "body": {"creditors":{"address_line1":null,"address_line2":null,"address_line3":null,"can_create_refunds":false,"city":null,"country_code":null,"created_at":"2014-01-01T12:00:00.000Z","id":"CR123","links":{"default_aud_payout_account":null,"default_cad_payout_account":null,"default_dkk_payout_account":null,"default_eur_payout_account":null,"default_gbp_payout_account":"BA123","default_nzd_payout_account":"BA791","default_sek_payout_account":null},"logo_url":null,"name":"Nude Wines","postal_code":null,"region":"example region 1137","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 9002","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 1563","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}} + "body": {"creditors":{"address_line1":null,"address_line2":null,"address_line3":null,"can_create_refunds":false,"city":null,"country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":null,"default_cad_payout_account":null,"default_dkk_payout_account":"BA790","default_eur_payout_account":null,"default_gbp_payout_account":null,"default_nzd_payout_account":"BA791","default_sek_payout_account":null},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":"EC1V 7LQ","region":null,"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 5447","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 1577","region":null,"scheme":"bacs"}],"verification_status":"action_required"}} }, "update": { "method": "PUT", "path_template": "/creditors/:identity", "url_params": ["CR123"], - "body": {"creditors":{"address_line1":"338-346 Goswell Road","address_line2":null,"address_line3":"example address_line3 9107","can_create_refunds":false,"city":"London","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","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},"logo_url":"https://uploads.gocardless.com/logo.png","name":"Nude Wines","postal_code":null,"region":"example region 6503","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 552","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 9843","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}} + "body": {"creditors":{"address_line1":null,"address_line2":null,"address_line3":"example address_line3 6503","can_create_refunds":false,"city":"London","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","fx_payout_currency":"EUR","id":"CR123","links":{"default_aud_payout_account":"BA234","default_cad_payout_account":"BA792","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},"logo_url":null,"name":"Nude Wines","postal_code":"EC1V 7LQ","region":null,"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 8878","phone_number":"+44 20 1234 1234","postal_code":"NW1 6XE","reference":"example reference 9336","region":"Greater London","scheme":"bacs"}],"verification_status":"action_required"}} } } diff --git a/tests/fixtures/customer_bank_accounts.json b/tests/fixtures/customer_bank_accounts.json index 59188434..56e901a0 100644 --- a/tests/fixtures/customer_bank_accounts.json +++ b/tests/fixtures/customer_bank_accounts.json @@ -3,30 +3,30 @@ "method": "POST", "path_template": "/customer_bank_accounts", "url_params": [], - "body": {"customer_bank_accounts":{"account_holder_name":"Billy Jean","account_number_ending":"11","account_type":"savings","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 8795"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"11","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":{"customer":"example customer 7807"},"metadata":{}}} }, "list": { "method": "GET", "path_template": "/customer_bank_accounts", "url_params": [], - "body": {"customer_bank_accounts":[{"account_holder_name":"Billy Jean","account_number_ending":"11","account_type":"savings","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 8996"},"metadata":{}},{"account_holder_name":"Billy Jean","account_number_ending":"11","account_type":null,"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 2632"},"metadata":{}}],"meta":{"cursors":{"after":"example after 1393","before":"example before 417"},"limit":50}} + "body": {"customer_bank_accounts":[{"account_holder_name":"Billie Jean","account_number_ending":"11","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 8795"},"metadata":{}},{"account_holder_name":"Billie Jean","account_number_ending":"11","account_type":"savings","bank_name":"BARCLAYS BANK PLC","country_code":null,"created_at":"2014-01-01T12:00:00.000Z","currency":null,"enabled":true,"id":"BA123","links":{"customer":"example customer 8470"},"metadata":{}}],"meta":{"cursors":{"after":"example after 2632","before":"example before 9386"},"limit":50}} }, "get": { "method": "GET", "path_template": "/customer_bank_accounts/:identity", "url_params": ["BA123"], - "body": {"customer_bank_accounts":{"account_holder_name":"Billy Jean","account_number_ending":"11","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 3922"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"11","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 3922"},"metadata":{}}} }, "update": { "method": "PUT", "path_template": "/customer_bank_accounts/:identity", "url_params": ["BA123"], - "body": {"customer_bank_accounts":{"account_holder_name":"Billy Jean","account_number_ending":"11","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 2420"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"11","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 2420"},"metadata":{}}} }, "disable": { "method": "POST", "path_template": "/customer_bank_accounts/:identity/actions/disable", "url_params": ["BA123"], - "body": {"customer_bank_accounts":{"account_holder_name":"Billy Jean","account_number_ending":"11","account_type":null,"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 1464"},"metadata":{}}} + "body": {"customer_bank_accounts":{"account_holder_name":"Billie Jean","account_number_ending":"11","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 2954"},"metadata":{}}} } } diff --git a/tests/fixtures/customer_notifications.json b/tests/fixtures/customer_notifications.json index ece19b73..6058e032 100644 --- a/tests/fixtures/customer_notifications.json +++ b/tests/fixtures/customer_notifications.json @@ -3,6 +3,6 @@ "method": "POST", "path_template": "/customer_notifications/:identity/actions/handle", "url_params": ["PCN123"], - "body": {"customer_notifications":{"action_taken":"example action_taken 9551","action_taken_at":"2019-07-25T16:11:39.161Z","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 9516","action_taken_at":"2019-10-16T14:05:07.942Z","action_taken_by":null,"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 5b37a3ed..684e9378 100644 --- a/tests/fixtures/customers.json +++ b/tests/fixtures/customers.json @@ -3,30 +3,30 @@ "method": "POST", "path_template": "/customers", "url_params": [], - "body": {"customers":{"address_line1":null,"address_line2":null,"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":null}} + "body": {"customers":{"address_line1":null,"address_line2":null,"address_line3":null,"city":"London","company_name":null,"country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":null,"email":null,"family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":null,"region":"Greater London","swedish_identity_number":null}} }, "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":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":"220550-6218","email":null,"family_name":"Osborne","given_name":"Frank","id":"CU123","language":null,"metadata":{},"phone_number":"+64 4 817 9999","postal_code":null,"region":null,"swedish_identity_number":"556564-5404"},{"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":"user@example.com","family_name":null,"given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":null,"postal_code":null,"region":"Greater London","swedish_identity_number":"556564-5404"}],"meta":{"cursors":{"after":"example after 3162","before":"example before 4904"},"limit":50}} + "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":null,"metadata":{},"phone_number":"+64 4 817 9999","postal_code":"NW1 6XE","region":null,"swedish_identity_number":"556564-5404"},{"address_line1":"221B Baker Street","address_line2":null,"address_line3":null,"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":null,"region":null,"swedish_identity_number":null}],"meta":{"cursors":{"after":"example after 1166","before":"example before 1968"},"limit":50}} }, "get": { "method": "GET", "path_template": "/customers/:identity", "url_params": ["CU123"], - "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","danish_identity_number":null,"email":"user@example.com","family_name":null,"given_name":"Frank","id":"CU123","language":null,"metadata":{},"phone_number":"+64 4 817 9999","postal_code":null,"region":"Greater London","swedish_identity_number":null}} + "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","danish_identity_number":null,"email":null,"family_name":null,"given_name":"Frank","id":"CU123","language":null,"metadata":{},"phone_number":"+64 4 817 9999","postal_code":null,"region":"Greater London","swedish_identity_number":null}} }, "update": { "method": "PUT", "path_template": "/customers/:identity", "url_params": ["CU123"], - "body": {"customers":{"address_line1":null,"address_line2":"Marylebone","address_line3":null,"city":null,"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":"Frank","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":null,"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":"user@example.com","family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":null,"postal_code":"NW1 6XE","region":null,"swedish_identity_number":null}} }, "remove": { "method": "DELETE", "path_template": "/customers/:identity", "url_params": ["CU123"], - "body": {"customers":{"address_line1":null,"address_line2":"Marylebone","address_line3":"City of Westminster","city":null,"company_name":"Hamilton Trading Ltd.","country_code":"GB","created_at":"2014-01-01T12:00:00.000Z","danish_identity_number":null,"email":null,"family_name":"Osborne","given_name":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":null,"postal_code":null,"region":"Greater London","swedish_identity_number":"556564-5404"}} + "body": {"customers":{"address_line1":"221B Baker Street","address_line2":null,"address_line3":null,"city":"London","company_name":"Hamilton Trading Ltd.","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":"Frank","id":"CU123","language":"en","metadata":{},"phone_number":"+64 4 817 9999","postal_code":null,"region":"Greater London","swedish_identity_number":null}} } } diff --git a/tests/fixtures/events.json b/tests/fixtures/events.json index 5aee6a0f..a42b144e 100644 --- a/tests/fixtures/events.json +++ b/tests/fixtures/events.json @@ -3,12 +3,12 @@ "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"},"id":"EV123","links":{"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"},"id":"EV123","links":{"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 7039","before":"example before 4637"},"limit":50}} + "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"},"id":"EV123","links":{"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"},"id":"EV123","links":{"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 4637","before":"example before 1533"},"limit":50}} }, "get": { "method": "GET", "path_template": "/events/:identity", "url_params": ["EV123"], - "body": {"events":{"action":"cancelled","created_at":"2014-01-01T12:00:00.000Z","customer_notifications":[{"deadline":"2019-07-25T16:11:39.162Z","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"},"id":"EV123","links":{"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":null,"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","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/mandate_import_entries.json b/tests/fixtures/mandate_import_entries.json index 6700f08e..453cf240 100644 --- a/tests/fixtures/mandate_import_entries.json +++ b/tests/fixtures/mandate_import_entries.json @@ -9,6 +9,6 @@ "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":null},{"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 9648","before":"example before 1606"},"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":null},{"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 1606","before":"example before 9648"},"limit":50}} } } diff --git a/tests/fixtures/mandates.json b/tests/fixtures/mandates.json index 80a8a234..721677c5 100644 --- a/tests/fixtures/mandates.json +++ b/tests/fixtures/mandates.json @@ -21,18 +21,18 @@ "method": "PUT", "path_template": "/mandates/:identity", "url_params": ["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":null,"status":"pending_submission"}} }, "cancel": { "method": "POST", "path_template": "/mandates/:identity/actions/cancel", "url_params": ["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":null,"payments_require_approval":"false","reference":null,"scheme":"bacs","status":"pending_submission"}} }, "reinstate": { "method": "POST", "path_template": "/mandates/:identity/actions/reinstate", "url_params": ["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":null,"scheme":"bacs","status":"pending_submission"}} } } diff --git a/tests/fixtures/payments.json b/tests/fixtures/payments.json index 812f1ec6..fc661f96 100644 --- a/tests/fixtures/payments.json +++ b/tests/fixtures/payments.json @@ -3,36 +3,36 @@ "method": "POST", "path_template": "/payments", "url_params": [], - "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":"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","fx":{"estimated_exchange_rate":null,"exchange_rate":1.153,"fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"status":"submitted"}} }, "list": { "method": "GET", "path_template": "/payments", "url_params": [], - "body": {"meta":{"cursors":{"after":"example after 8721","before":"example before 4231"},"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":null,"status":"submitted"},{"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"}]} + "body": {"meta":{"cursors":{"after":"example after 7008","before":"example before 8408"},"limit":50},"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.316,"exchange_rate":1.153,"fx_amount":null,"fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"},{"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":1.316,"exchange_rate":null,"fx_amount":null,"fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}]} }, "get": { "method": "GET", "path_template": "/payments/:identity", "url_params": ["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":null,"fx":{"estimated_exchange_rate":1.316,"exchange_rate":1.153,"fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}} }, "update": { "method": "PUT", "path_template": "/payments/:identity", "url_params": ["PM123"], - "body": {"payments":{"amount":"1000","amount_refunded":"150","charge_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":"One-off upgrade fee","id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"status":"submitted"}} + "body": {"payments":{"amount":"1000","amount_refunded":"150","charge_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":"One-off upgrade fee","fx":{"estimated_exchange_rate":null,"exchange_rate":null,"fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":"WINEBOX001","status":"submitted"}} }, "cancel": { "method": "POST", "path_template": "/payments/:identity/actions/cancel", "url_params": ["PM123"], - "body": {"payments":{"amount":"1000","amount_refunded":"150","charge_date":"2014-05-21","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":"One-off upgrade fee","id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"status":"submitted"}} + "body": {"payments":{"amount":"1000","amount_refunded":"150","charge_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","description":null,"fx":{"estimated_exchange_rate":null,"exchange_rate":1.153,"fx_amount":null,"fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"status":"submitted"}} }, "retry": { "method": "POST", "path_template": "/payments/:identity/actions/retry", "url_params": ["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":"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","fx":{"estimated_exchange_rate":null,"exchange_rate":null,"fx_amount":"1150","fx_currency":"EUR"},"id":"PM123","links":{"creditor":"CR123","mandate":"MD123","payout":"PO123","subscription":"SU123"},"metadata":{},"reference":null,"status":"submitted"}} } } diff --git a/tests/fixtures/payout_items.json b/tests/fixtures/payout_items.json index 74c87301..f0345615 100644 --- a/tests/fixtures/payout_items.json +++ b/tests/fixtures/payout_items.json @@ -3,6 +3,6 @@ "method": "GET", "path_template": "/payout_items", "url_params": [], - "body": {"meta":{"cursors":{"after":"example after 4467","before":"example before 2286"},"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 6861","before":"example before 9159"},"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 6ee10ebd..e675a106 100644 --- a/tests/fixtures/payouts.json +++ b/tests/fixtures/payouts.json @@ -3,12 +3,12 @@ "method": "GET", "path_template": "/payouts", "url_params": [], - "body": {"meta":{"cursors":{"after":"example after 106","before":"example before 1874"},"limit":50},"payouts":[{"amount":"1000","arrival_date":"2014-01-01","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":"20","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","id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"payout_type":"merchant","reference":"ref-1","status":"pending"}]} + "body": {"meta":{"cursors":{"after":"example after 6789","before":"example before 4698"},"limit":50},"payouts":[{"amount":"1000","arrival_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":"20","fx":{"estimated_exchange_rate":1.316,"exchange_rate":1.153,"fx_amount":null,"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":null,"exchange_rate":1.153,"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": ["PO123"], - "body": {"payouts":{"amount":"1000","arrival_date":null,"created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","deducted_fees":"20","id":"PO123","links":{"creditor":"CR123","creditor_bank_account":"BA123"},"payout_type":"merchant","reference":"ref-1","status":"pending"}} + "body": {"payouts":{"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"}} } } diff --git a/tests/fixtures/refunds.json b/tests/fixtures/refunds.json index 8f1d2d58..8c2d5a9c 100644 --- a/tests/fixtures/refunds.json +++ b/tests/fixtures/refunds.json @@ -3,24 +3,24 @@ "method": "POST", "path_template": "/refunds", "url_params": [], - "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":null}} + "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":null,"exchange_rate":1.153,"fx_amount":null,"fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":null}} }, "list": { "method": "GET", "path_template": "/refunds", "url_params": [], - "body": {"meta":{"cursors":{"after":"example after 9723","before":"example before 3546"},"limit":50},"refunds":[{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"Nude Wines refund"},{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":null}]} + "body": {"meta":{"cursors":{"after":"example after 556","before":"example before 7695"},"limit":50},"refunds":[{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":1.316,"exchange_rate":null,"fx_amount":"1150","fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":null},{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":null,"exchange_rate":1.153,"fx_amount":"1150","fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":"WINEBOX001"}]} }, "get": { "method": "GET", "path_template": "/refunds/:identity", "url_params": ["RF123"], - "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":null}} + "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":1.316,"exchange_rate":1.153,"fx_amount":"1150","fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":null}} }, "update": { "method": "PUT", "path_template": "/refunds/:identity", "url_params": ["RF123"], - "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":null}} + "body": {"refunds":{"amount":"150","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","fx":{"estimated_exchange_rate":1.316,"exchange_rate":null,"fx_amount":null,"fx_currency":"EUR"},"id":"RF123","links":{"mandate":"MD123","payment":"PM123"},"metadata":{},"reference":null}} } } diff --git a/tests/fixtures/subscriptions.json b/tests/fixtures/subscriptions.json index 5c5f244d..00c12817 100644 --- a/tests/fixtures/subscriptions.json +++ b/tests/fixtures/subscriptions.json @@ -3,30 +3,30 @@ "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":"28","end_date":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscription","payment_reference":null,"start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} + "body": {"subscriptions":{"amount":"1000","app_fee":"100","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":"28","end_date":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":null,"payment_reference":null,"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 2409","before":"example before 9430"},"limit":50},"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,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]},{"amount":"1000","app_fee":"100","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"}]}]} + "body": {"meta":{"cursors":{"after":"example after 3740","before":"example before 1306"},"limit":50},"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":"GOLDPLAN","start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]},{"amount":"1000","app_fee":"100","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 subscription","payment_reference":null,"start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}]} }, "get": { "method": "GET", "path_template": "/subscriptions/:identity", "url_params": ["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":null,"payment_reference":null,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} + "body": {"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":"GOLDPLAN","start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} }, "update": { "method": "PUT", "path_template": "/subscriptions/:identity", "url_params": ["SB123"], - "body": {"subscriptions":{"amount":"1000","app_fee":"100","created_at":"2014-01-01T12:00:00.000Z","currency":"EUR","day_of_month":"28","end_date":null,"id":"SB123","interval":"1","interval_unit":"monthly","links":{"mandate":"MD123"},"metadata":{},"month":"january","name":"12 month subscription","payment_reference":null,"start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} + "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":null,"payment_reference":null,"start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} }, "cancel": { "method": "POST", "path_template": "/subscriptions/:identity/actions/cancel", "url_params": ["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,"start_date":"2014-10-21","status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} + "body": {"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":"GOLDPLAN","start_date":null,"status":"active","upcoming_payments":[{"amount":2500,"charge_date":"2014-11-03"}]}} } } diff --git a/tests/integration/creditors_integration_test.py b/tests/integration/creditors_integration_test.py index 5b7600e0..4f8767d5 100644 --- a/tests/integration/creditors_integration_test.py +++ b/tests/integration/creditors_integration_test.py @@ -39,6 +39,7 @@ def test_creditors_create(): assert_equal(response.city, body.get('city')) assert_equal(response.country_code, body.get('country_code')) assert_equal(response.created_at, body.get('created_at')) + assert_equal(response.fx_payout_currency, body.get('fx_payout_currency')) assert_equal(response.id, body.get('id')) assert_equal(response.logo_url, body.get('logo_url')) assert_equal(response.name, body.get('name')) @@ -130,6 +131,8 @@ def test_creditors_list(): [b.get('country_code') for b in body]) assert_equal([r.created_at for r in response.records], [b.get('created_at') for b in body]) + assert_equal([r.fx_payout_currency for r in response.records], + [b.get('fx_payout_currency') for b in body]) assert_equal([r.id for r in response.records], [b.get('id') for b in body]) assert_equal([r.logo_url for r in response.records], @@ -213,6 +216,7 @@ def test_creditors_get(): assert_equal(response.city, body.get('city')) assert_equal(response.country_code, body.get('country_code')) assert_equal(response.created_at, body.get('created_at')) + assert_equal(response.fx_payout_currency, body.get('fx_payout_currency')) assert_equal(response.id, body.get('id')) assert_equal(response.logo_url, body.get('logo_url')) assert_equal(response.name, body.get('name')) @@ -275,6 +279,7 @@ def test_creditors_update(): assert_equal(response.city, body.get('city')) assert_equal(response.country_code, body.get('country_code')) assert_equal(response.created_at, body.get('created_at')) + assert_equal(response.fx_payout_currency, body.get('fx_payout_currency')) assert_equal(response.id, body.get('id')) assert_equal(response.logo_url, body.get('logo_url')) assert_equal(response.name, body.get('name')) diff --git a/tests/integration/payments_integration_test.py b/tests/integration/payments_integration_test.py index 82de07fa..f3d139d2 100644 --- a/tests/integration/payments_integration_test.py +++ b/tests/integration/payments_integration_test.py @@ -42,6 +42,14 @@ def test_payments_create(): assert_equal(response.metadata, body.get('metadata')) assert_equal(response.reference, body.get('reference')) assert_equal(response.status, body.get('status')) + assert_equal(response.fx.estimated_exchange_rate, + body.get('fx')['estimated_exchange_rate']) + assert_equal(response.fx.exchange_rate, + body.get('fx')['exchange_rate']) + assert_equal(response.fx.fx_amount, + body.get('fx')['fx_amount']) + assert_equal(response.fx.fx_currency, + body.get('fx')['fx_currency']) assert_equal(response.links.creditor, body.get('links')['creditor']) assert_equal(response.links.mandate, @@ -198,6 +206,14 @@ def test_payments_get(): assert_equal(response.metadata, body.get('metadata')) assert_equal(response.reference, body.get('reference')) assert_equal(response.status, body.get('status')) + assert_equal(response.fx.estimated_exchange_rate, + body.get('fx')['estimated_exchange_rate']) + assert_equal(response.fx.exchange_rate, + body.get('fx')['exchange_rate']) + assert_equal(response.fx.fx_amount, + body.get('fx')['fx_amount']) + assert_equal(response.fx.fx_currency, + body.get('fx')['fx_currency']) assert_equal(response.links.creditor, body.get('links')['creditor']) assert_equal(response.links.mandate, @@ -250,6 +266,14 @@ def test_payments_update(): assert_equal(response.metadata, body.get('metadata')) assert_equal(response.reference, body.get('reference')) assert_equal(response.status, body.get('status')) + assert_equal(response.fx.estimated_exchange_rate, + body.get('fx')['estimated_exchange_rate']) + assert_equal(response.fx.exchange_rate, + body.get('fx')['exchange_rate']) + assert_equal(response.fx.fx_amount, + body.get('fx')['fx_amount']) + assert_equal(response.fx.fx_currency, + body.get('fx')['fx_currency']) assert_equal(response.links.creditor, body.get('links')['creditor']) assert_equal(response.links.mandate, @@ -302,6 +326,14 @@ def test_payments_cancel(): assert_equal(response.metadata, body.get('metadata')) assert_equal(response.reference, body.get('reference')) assert_equal(response.status, body.get('status')) + assert_equal(response.fx.estimated_exchange_rate, + body.get('fx')['estimated_exchange_rate']) + assert_equal(response.fx.exchange_rate, + body.get('fx')['exchange_rate']) + assert_equal(response.fx.fx_amount, + body.get('fx')['fx_amount']) + assert_equal(response.fx.fx_currency, + body.get('fx')['fx_currency']) assert_equal(response.links.creditor, body.get('links')['creditor']) assert_equal(response.links.mandate, @@ -345,6 +377,14 @@ def test_payments_retry(): assert_equal(response.metadata, body.get('metadata')) assert_equal(response.reference, body.get('reference')) assert_equal(response.status, body.get('status')) + assert_equal(response.fx.estimated_exchange_rate, + body.get('fx')['estimated_exchange_rate']) + assert_equal(response.fx.exchange_rate, + body.get('fx')['exchange_rate']) + assert_equal(response.fx.fx_amount, + body.get('fx')['fx_amount']) + assert_equal(response.fx.fx_currency, + body.get('fx')['fx_currency']) assert_equal(response.links.creditor, body.get('links')['creditor']) assert_equal(response.links.mandate, diff --git a/tests/integration/payouts_integration_test.py b/tests/integration/payouts_integration_test.py index 78bea716..abbad4b6 100644 --- a/tests/integration/payouts_integration_test.py +++ b/tests/integration/payouts_integration_test.py @@ -125,6 +125,14 @@ def test_payouts_get(): assert_equal(response.payout_type, body.get('payout_type')) assert_equal(response.reference, body.get('reference')) assert_equal(response.status, body.get('status')) + assert_equal(response.fx.estimated_exchange_rate, + body.get('fx')['estimated_exchange_rate']) + assert_equal(response.fx.exchange_rate, + body.get('fx')['exchange_rate']) + assert_equal(response.fx.fx_amount, + body.get('fx')['fx_amount']) + assert_equal(response.fx.fx_currency, + body.get('fx')['fx_currency']) assert_equal(response.links.creditor, body.get('links')['creditor']) assert_equal(response.links.creditor_bank_account, diff --git a/tests/integration/refunds_integration_test.py b/tests/integration/refunds_integration_test.py index 8b1e1f27..81b377ef 100644 --- a/tests/integration/refunds_integration_test.py +++ b/tests/integration/refunds_integration_test.py @@ -38,6 +38,14 @@ def test_refunds_create(): assert_equal(response.id, body.get('id')) assert_equal(response.metadata, body.get('metadata')) assert_equal(response.reference, body.get('reference')) + assert_equal(response.fx.estimated_exchange_rate, + body.get('fx')['estimated_exchange_rate']) + assert_equal(response.fx.exchange_rate, + body.get('fx')['exchange_rate']) + assert_equal(response.fx.fx_amount, + body.get('fx')['fx_amount']) + assert_equal(response.fx.fx_currency, + body.get('fx')['fx_currency']) assert_equal(response.links.mandate, body.get('links')['mandate']) assert_equal(response.links.payment, @@ -178,6 +186,14 @@ def test_refunds_get(): assert_equal(response.id, body.get('id')) assert_equal(response.metadata, body.get('metadata')) assert_equal(response.reference, body.get('reference')) + assert_equal(response.fx.estimated_exchange_rate, + body.get('fx')['estimated_exchange_rate']) + assert_equal(response.fx.exchange_rate, + body.get('fx')['exchange_rate']) + assert_equal(response.fx.fx_amount, + body.get('fx')['fx_amount']) + assert_equal(response.fx.fx_currency, + body.get('fx')['fx_currency']) assert_equal(response.links.mandate, body.get('links')['mandate']) assert_equal(response.links.payment, @@ -222,6 +238,14 @@ def test_refunds_update(): assert_equal(response.id, body.get('id')) assert_equal(response.metadata, body.get('metadata')) assert_equal(response.reference, body.get('reference')) + assert_equal(response.fx.estimated_exchange_rate, + body.get('fx')['estimated_exchange_rate']) + assert_equal(response.fx.exchange_rate, + body.get('fx')['exchange_rate']) + assert_equal(response.fx.fx_amount, + body.get('fx')['fx_amount']) + assert_equal(response.fx.fx_currency, + body.get('fx')['fx_currency']) assert_equal(response.links.mandate, body.get('links')['mandate']) assert_equal(response.links.payment,