Skip to content

Commit

Permalink
Changes generated by 853e5c24f4ab548791a4d6781c22927dff469260
Browse files Browse the repository at this point in the history
  • Loading branch information
gocardless-robot committed Nov 24, 2023
1 parent cf79683 commit 77a72f3
Show file tree
Hide file tree
Showing 30 changed files with 229 additions and 53 deletions.
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,14 @@ Tax rates
# Get a single tax rate
client.tax_rates.get('GB_VAT_1', params={...})
Transferred mandates
''''''''''''''''''''''''''''''''''''''''''

.. code:: python
# Get updated customer bank details
client.transferred_mandates.transferred_mandates('MD123', params={...})
Verification details
''''''''''''''''''''''''''''''''''''''''''

Expand Down
4 changes: 4 additions & 0 deletions gocardless_pro/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ def subscriptions(self):
def tax_rates(self):
return services.TaxRatesService(self._api_client, 3, 0.5, self._raise_on_idempotency_conflict)

@property
def transferred_mandates(self):
return services.TransferredMandatesService(self._api_client, 3, 0.5, self._raise_on_idempotency_conflict)

@property
def verification_details(self):
return services.VerificationDetailsService(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 @@ -63,6 +63,8 @@

from .tax_rate import TaxRate

from .transferred_mandate import TransferredMandate

from .verification_detail import VerificationDetail

from .webhook import Webhook
Expand Down
62 changes: 62 additions & 0 deletions gocardless_pro/resources/transferred_mandate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#

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

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

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


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


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


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








class Links(object):
"""Wrapper for the response's 'links' attribute."""

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

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

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





1 change: 1 addition & 0 deletions gocardless_pro/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
from .scheme_identifiers_service import SchemeIdentifiersService
from .subscriptions_service import SubscriptionsService
from .tax_rates_service import TaxRatesService
from .transferred_mandates_service import TransferredMandatesService
from .verification_details_service import VerificationDetailsService
from .webhooks_service import WebhooksService
41 changes: 41 additions & 0 deletions gocardless_pro/services/transferred_mandates_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 TransferredMandatesService(base_service.BaseService):
"""Service class that provides access to the transferred_mandates
endpoints of the GoCardless Pro API.
"""

RESOURCE_CLASS = resources.TransferredMandate
RESOURCE_NAME = 'transferred_mandates'


def transferred_mandates(self,identity,params=None, headers=None):
"""Get updated customer bank details.
Returns new customer bank details for a mandate that's been recently
transferred
Args:
identity (string): Unique identifier, beginning with "MD". Note that this prefix may not apply to mandates created before 2016.
params (dict, optional): Query string parameters.
Returns:
TransferredMandate
"""
path = self._sub_url_params('/transferred_mandates/:identity', {

'identity': identity,
})

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

3 changes: 3 additions & 0 deletions tests/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ def test_subscriptions_returns_service():
def test_tax_rates_returns_service():
assert isinstance(client.tax_rates, services.TaxRatesService)

def test_transferred_mandates_returns_service():
assert isinstance(client.transferred_mandates, services.TransferredMandatesService)

def test_verification_details_returns_service():
assert isinstance(client.verification_details, services.VerificationDetailsService)

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":"2023-11-13T13:40:04.986Z","expires_at":"2023-11-13T13:40:04.986Z","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":"2023-11-24T08:50:03.670Z","expires_at":"2023-11-24T08:50:03.670Z","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":"2023-11-13T13:40:04.986Z","expires_at":"2023-11-13T13:40:04.986Z","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":"2023-11-24T08:50:03.670Z","expires_at":"2023-11-24T08:50:03.670Z","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":"2023-11-13T13:40:04.997Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-11-13T13:40:04.997Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":false,"lock_currency":false,"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":false,"show_success_redirect_button":false}}
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":false,"created_at":"2023-11-24T08:50:03.675Z","customer_details_captured":false,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-11-24T08:50:03.675Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":false,"lock_currency":false,"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":true}}
},
"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":false,"created_at":"2023-11-13T13:40:04.997Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-11-13T13:40:04.997Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":true,"lock_currency":false,"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":true,"show_success_redirect_button":false}}
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":true,"created_at":"2023-11-24T08:50:03.675Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2023-11-24T08:50:03.675Z","id":"BRF123","language":"en","links":{"billing_request":"BRQ123"},"lock_bank_account":true,"lock_currency":false,"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}}
}
}
Loading

0 comments on commit 77a72f3

Please sign in to comment.