Skip to content

Commit

Permalink
Merge pull request #31 from gocardless/template-changes
Browse files Browse the repository at this point in the history
Release v1.11.0
  • Loading branch information
matt-thomson authored Oct 16, 2019
2 parents 6e6f230 + 95c921b commit 9955806
Show file tree
Hide file tree
Showing 24 changed files with 221 additions and 47 deletions.
2 changes: 1 addition & 1 deletion gocardless_pro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

from .client import Client

__version__ = '1.10.0'
__version__ = '1.11.0'

4 changes: 2 additions & 2 deletions gocardless_pro/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand All @@ -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()),
Expand Down
7 changes: 7 additions & 0 deletions gocardless_pro/resources/creditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -107,6 +112,8 @@ def verification_status(self):







class Links(object):
Expand Down
30 changes: 30 additions & 0 deletions gocardless_pro/resources/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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):
Expand Down
30 changes: 30 additions & 0 deletions gocardless_pro/resources/payout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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):
Expand Down
30 changes: 30 additions & 0 deletions gocardless_pro/resources/refund.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
8 changes: 4 additions & 4 deletions tests/fixtures/creditor_bank_accounts.json
Original file line number Diff line number Diff line change
Expand Up @@ -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":{}}}
}
}
8 changes: 4 additions & 4 deletions tests/fixtures/creditors.json
Original file line number Diff line number Diff line change
Expand Up @@ -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":"[email protected]","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":"[email protected]","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":"[email protected]","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":"[email protected]","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":"[email protected]","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":"[email protected]","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":"[email protected]","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":"[email protected]","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":"[email protected]","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":"[email protected]","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"}}
}
}
Loading

0 comments on commit 9955806

Please sign in to comment.