Skip to content

Commit

Permalink
Changes generated by 356ce698bd3197e034109480797f9370355d812f
Browse files Browse the repository at this point in the history
  • Loading branch information
gocardless-robot committed Aug 6, 2024
1 parent d495833 commit 49ce5a1
Show file tree
Hide file tree
Showing 41 changed files with 375 additions and 75 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<!-- @format -->
# 1.53.0

- Added `/exports` APIs and added `exports` as a new event type available for Embed merchants

# 1.52.0

- Added new endpoints `/branding/logos` and `/branding/payer_themes` available for Embed merchants
Expand Down
14 changes: 14 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,20 @@ Events
# Get a single event
client.events.get('EV123', params={...})
Exports
''''''''''''''''''''''''''''''''''''''''''

.. code:: python
# Get a single export
client.exports.get('EX123', params={...})
# List exports
client.exports.list(params={...})
# Iterate through all exports
client.exports.all(params={...})
Instalment schedules
''''''''''''''''''''''''''''''''''''''''''

Expand Down
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.52.0'
__version__ = '1.53.0'

4 changes: 2 additions & 2 deletions gocardless_pro/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,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.52.0',
'GoCardless-Client-Version': '1.53.0',
'User-Agent': self._user_agent(),
'GoCardless-Version': '2015-07-06',
}
Expand All @@ -159,7 +159,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.52.0',
'gocardless-pro-python/1.53.0',
'python/{0}'.format(python_version),
'{0}/{1}'.format(platform.python_implementation(), vm_version),
'{0}/{1}'.format(platform.system(), platform.release()),
Expand Down
4 changes: 4 additions & 0 deletions gocardless_pro/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def customer_notifications(self):
def events(self):
return services.EventsService(self._api_client, 3, 0.5, self._raise_on_idempotency_conflict)

@property
def exports(self):
return services.ExportsService(self._api_client, 3, 0.5, self._raise_on_idempotency_conflict)

@property
def instalment_schedules(self):
return services.InstalmentSchedulesService(self._api_client, 3, 0.5, self._raise_on_idempotency_conflict)
Expand Down
2 changes: 2 additions & 0 deletions gocardless_pro/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

from .event import Event

from .export import Export

from .instalment_schedule import InstalmentSchedule

from .institution import Institution
Expand Down
4 changes: 4 additions & 0 deletions gocardless_pro/resources/billing_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ def links(self):
def metadata(self):
return self.attributes.get('metadata')

@property
def reference(self):
return self.attributes.get('reference')

@property
def scheme(self):
return self.attributes.get('scheme')
Expand Down
54 changes: 54 additions & 0 deletions gocardless_pro/resources/export.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#

class Export(object):
"""A thin wrapper around a export, providing easy access to its
attributes.
Example:
export = client.exports.get()
export.id
"""

def __init__(self, attributes, api_response):
self.attributes = attributes
self.api_response = api_response

@property
def created_at(self):
return self.attributes.get('created_at')


@property
def currency(self):
return self.attributes.get('currency')


@property
def download_url(self):
return self.attributes.get('download_url')


@property
def export_type(self):
return self.attributes.get('export_type')


@property
def id(self):
return self.attributes.get('id')













1 change: 1 addition & 0 deletions gocardless_pro/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .customer_bank_accounts_service import CustomerBankAccountsService
from .customer_notifications_service import CustomerNotificationsService
from .events_service import EventsService
from .exports_service import ExportsService
from .instalment_schedules_service import InstalmentSchedulesService
from .institutions_service import InstitutionsService
from .logos_service import LogosService
Expand Down
66 changes: 66 additions & 0 deletions gocardless_pro/services/exports_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#

from . import base_service
from .. import resources
from ..paginator import Paginator
from .. import errors

class ExportsService(base_service.BaseService):
"""Service class that provides access to the exports
endpoints of the GoCardless Pro API.
"""

RESOURCE_CLASS = resources.Export
RESOURCE_NAME = 'exports'


def get(self,identity,params=None, headers=None):
"""Get a single export.
Returns a single export.
Args:
identity (string): Unique identifier, beginning with "EX".
params (dict, optional): Query string parameters.
Returns:
Export
"""
path = self._sub_url_params('/exports/:identity', {

'identity': identity,
})


response = self._perform_request('GET', path, params, headers,
retry_failures=True)
return self._resource_for(response)


def list(self,params=None, headers=None):
"""List exports.
Returns a list of exports which are available for download.
Args:
params (dict, optional): Query string parameters.
Returns:
ListResponse of Export instances
"""
path = '/exports'


response = self._perform_request('GET', path, params, headers,
retry_failures=True)
return self._resource_for(response)

def all(self, params=None):
if params is None:
params = {}
return Paginator(self, params)


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.52.0',
version = '1.53.0',
packages = find_packages(exclude=['tests']),
install_requires = ['requests>=2.6', 'six'],
author = 'GoCardless',
Expand Down
3 changes: 3 additions & 0 deletions tests/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def test_customer_notifications_returns_service():
def test_events_returns_service():
assert isinstance(client.events, services.EventsService)

def test_exports_returns_service():
assert isinstance(client.exports, services.ExportsService)

def test_instalment_schedules_returns_service():
assert isinstance(client.instalment_schedules, services.InstalmentSchedulesService)

Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/bank_authorisations.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"method": "POST",
"path_template": "/bank_authorisations",
"url_params": [],
"body": {"bank_authorisations":{"authorisation_type":"example authorisation_type 8081","authorised_at":"2020-01-01T12:00:00.000Z","created_at":"2024-06-27T14:13:58.773Z","expires_at":"2024-06-27T14:13:58.773Z","id":"BAU123","last_visited_at":"2020-01-01T12:00:00.000Z","links":{"billing_request":"BRQ123","institution":"monzo"},"qr_code_url":"https://pay.gocardless.com/obauth/BAU123/qr_code","redirect_uri":"https://my-website.com/abc/callback","url":"https://pay.gocardless.com/obauth/BAU123"}}
"body": {"bank_authorisations":{"authorisation_type":"example authorisation_type 8081","authorised_at":"2020-01-01T12:00:00.000Z","created_at":"2024-08-06T08:55:22.049Z","expires_at":"2024-08-06T08:55:22.049Z","id":"BAU123","last_visited_at":"2020-01-01T12:00:00.000Z","links":{"billing_request":"BRQ123","institution":"monzo"},"qr_code_url":"https://pay.gocardless.com/obauth/BAU123/qr_code","redirect_uri":"https://my-website.com/abc/callback","url":"https://pay.gocardless.com/obauth/BAU123"}}
},
"get": {
"method": "GET",
"path_template": "/bank_authorisations/:identity",
"url_params": ["BAU123"],
"body": {"bank_authorisations":{"authorisation_type":"example authorisation_type 7887","authorised_at":"2020-01-01T12:00:00.000Z","created_at":"2024-06-27T14:13:58.773Z","expires_at":"2024-06-27T14:13:58.773Z","id":"BAU123","last_visited_at":"2020-01-01T12:00:00.000Z","links":{"billing_request":"BRQ123","institution":"monzo"},"qr_code_url":"https://pay.gocardless.com/obauth/BAU123/qr_code","redirect_uri":"https://my-website.com/abc/callback","url":"https://pay.gocardless.com/obauth/BAU123"}}
"body": {"bank_authorisations":{"authorisation_type":"example authorisation_type 7887","authorised_at":"2020-01-01T12:00:00.000Z","created_at":"2024-08-06T08:55:22.049Z","expires_at":"2024-08-06T08:55:22.049Z","id":"BAU123","last_visited_at":"2020-01-01T12:00:00.000Z","links":{"billing_request":"BRQ123","institution":"monzo"},"qr_code_url":"https://pay.gocardless.com/obauth/BAU123/qr_code","redirect_uri":"https://my-website.com/abc/callback","url":"https://pay.gocardless.com/obauth/BAU123"}}
}
}
4 changes: 2 additions & 2 deletions tests/fixtures/billing_request_flows.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"method": "POST",
"path_template": "/billing_request_flows",
"url_params": [],
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":true,"created_at":"2024-06-27T14:13:58.778Z","customer_details_captured":false,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-06-27T14:13:58.778Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":true,"lock_currency":true,"lock_customer_details":true,"prefilled_bank_account":{"account_type":"savings"},"prefilled_customer":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","danish_identity_number":"220550-6218","email":"[email protected]","family_name":"Osborne","given_name":"Frank","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},"redirect_uri":"https://my-website.com/abc/callback","session_token":"sesh_123","show_redirect_buttons":false,"show_success_redirect_button":false}}
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":true,"created_at":"2024-08-06T08:55:22.053Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-08-06T08:55:22.053Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":false,"lock_currency":true,"lock_customer_details":true,"prefilled_bank_account":{"account_type":"savings"},"prefilled_customer":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","danish_identity_number":"220550-6218","email":"[email protected]","family_name":"Osborne","given_name":"Frank","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},"redirect_uri":"https://my-website.com/abc/callback","session_token":"sesh_123","show_redirect_buttons":false,"show_success_redirect_button":false}}
},
"initialise": {
"method": "POST",
"path_template": "/billing_request_flows/:identity/actions/initialise",
"url_params": ["BRF123"],
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":true,"created_at":"2024-06-27T14:13:58.778Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-06-27T14:13:58.778Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":true,"lock_currency":true,"lock_customer_details":false,"prefilled_bank_account":{"account_type":"savings"},"prefilled_customer":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","danish_identity_number":"220550-6218","email":"[email protected]","family_name":"Osborne","given_name":"Frank","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},"redirect_uri":"https://my-website.com/abc/callback","session_token":"sesh_123","show_redirect_buttons":true,"show_success_redirect_button":true}}
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":true,"created_at":"2024-08-06T08:55:22.053Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-08-06T08:55:22.053Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":true,"lock_currency":true,"lock_customer_details":false,"prefilled_bank_account":{"account_type":"savings"},"prefilled_customer":{"address_line1":"221B Baker Street","address_line2":"Marylebone","address_line3":"City of Westminster","city":"London","company_name":"Hamilton Trading Ltd.","country_code":"GB","danish_identity_number":"220550-6218","email":"[email protected]","family_name":"Osborne","given_name":"Frank","postal_code":"NW1 6XE","region":"Greater London","swedish_identity_number":"556564-5404"},"redirect_uri":"https://my-website.com/abc/callback","session_token":"sesh_123","show_redirect_buttons":true,"show_success_redirect_button":true}}
}
}
Loading

0 comments on commit 49ce5a1

Please sign in to comment.