Skip to content

Commit

Permalink
Changes generated by af23d6ac7be7e8c08ca9d5986093b52b9b7c8405
Browse files Browse the repository at this point in the history
  • Loading branch information
gocardless-robot committed Dec 3, 2024
1 parent f7f1cac commit 389e116
Show file tree
Hide file tree
Showing 37 changed files with 530 additions and 88 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<!-- @format -->
# 2.1.0

- Added `mandate_request[consent_type]` parameter to Billing Request creation.
- Added `constraints[payment_method]` parameter to Billing Request creation.
- Added `subscription_request` parameter to Billing Request creation.
- Added `instalment_schedule_request` parameter to Billing Request creation.

# 1.53.0

- Added `/exports` APIs and added `exports` as a new event type available for Embed merchants
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__ = '2.0.0'
__version__ = '2.1.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': '2.0.0',
'GoCardless-Client-Version': '2.1.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/2.0.0',
'gocardless-pro-python/2.1.0',
'python/{0}'.format(python_version),
'{0}/{1}'.format(platform.python_implementation(), vm_version),
'{0}/{1}'.format(platform.system(), platform.release()),
Expand Down
136 changes: 136 additions & 0 deletions gocardless_pro/resources/billing_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ def id(self):
return self.attributes.get('id')


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


@property
def links(self):
return self.Links(self.attributes.get('links'))
Expand Down Expand Up @@ -76,6 +81,11 @@ def status(self):
return self.attributes.get('status')


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





Expand All @@ -88,6 +98,51 @@ def status(self):



class InstalmentScheduleRequest(object):
"""Wrapper for the response's 'instalment_schedule_request' attribute."""

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

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

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

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

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

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

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

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

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

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




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

Expand All @@ -114,6 +169,14 @@ def customer_bank_account(self):
def customer_billing_detail(self):
return self.attributes.get('customer_billing_detail')

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

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

@property
def mandate_request(self):
return self.attributes.get('mandate_request')
Expand All @@ -138,6 +201,14 @@ def payment_request(self):
def payment_request_payment(self):
return self.attributes.get('payment_request_payment')

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

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




Expand Down Expand Up @@ -261,3 +332,68 @@ def customer_billing_detail(self):




class SubscriptionRequest(object):
"""Wrapper for the response's 'subscription_request' attribute."""

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



4 changes: 3 additions & 1 deletion gocardless_pro/services/billing_requests_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class BillingRequestsService(base_service.BaseService):
def create(self,params=None, headers=None):
"""Create a Billing Request.
<p class="notice"><strong>Important</strong>: All properties associated
with `subscription_request` and `instalment_schedule_request` are only
supported for ACH and PAD schemes.</p>
Args:
params (dict, optional): Request body.
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 = '2.0.0',
version = '2.1.0',
packages = find_packages(exclude=['tests']),
install_requires = ['requests>=2.6', 'six'],
author = 'GoCardless',
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-11-05T10:03:56.275Z","expires_at":"2024-11-05T10:03:56.275Z","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-12-03T12:55:13.866Z","expires_at":"2024-12-03T12:55:13.866Z","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-11-05T10:03:56.275Z","expires_at":"2024-11-05T10:03:56.275Z","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-12-03T12:55:13.866Z","expires_at":"2024-12-03T12:55:13.866Z","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-11-05T10:03:56.278Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-11-05T10:03:56.278Z","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":false,"skip_success_screen":false}}
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":false,"created_at":"2024-12-03T12:55:13.871Z","customer_details_captured":false,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-12-03T12:55:13.871Z","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,"skip_success_screen":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":"2024-11-05T10:03:56.279Z","customer_details_captured":true,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-11-05T10:03:56.279Z","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":false,"skip_success_screen":true}}
"body": {"billing_request_flows":{"authorisation_url":"https://monzo.com/abc-123-things","auto_fulfil":false,"created_at":"2024-12-03T12:55:13.871Z","customer_details_captured":false,"exit_uri":"https://my-website.com/abc/callback","expires_at":"2024-12-03T12:55:13.871Z","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,"skip_success_screen":false}}
}
}
2 changes: 1 addition & 1 deletion tests/fixtures/billing_request_templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"method": "GET",
"path_template": "/billing_request_templates",
"url_params": [],
"body": {"billing_request_templates":[{"authorisation_url":"https://pay.gocardless.com/BRT123","created_at":"2021-01-01T12:00:00.000Z","id":"BRT123","mandate_request_currency":"GBP","mandate_request_description":"Top-up Payment","mandate_request_metadata":{},"mandate_request_scheme":"bacs","mandate_request_verify":null,"metadata":{},"name":"12 Month Gold Plan","payment_request_amount":"100.00","payment_request_currency":"GBP","payment_request_description":"Top-up Payment","payment_request_metadata":{},"payment_request_scheme":"faster_payments","redirect_uri":"https://my-website.com/abc/callback","updated_at":"2021-01-01T12:00:00.000Z"},{"authorisation_url":"https://pay.gocardless.com/BRT123","created_at":"2021-01-01T12:00:00.000Z","id":"BRT123","mandate_request_currency":"GBP","mandate_request_description":"Top-up Payment","mandate_request_metadata":{},"mandate_request_scheme":"bacs","mandate_request_verify":null,"metadata":{},"name":"12 Month Gold Plan","payment_request_amount":"100.00","payment_request_currency":"GBP","payment_request_description":"Top-up Payment","payment_request_metadata":{},"payment_request_scheme":"faster_payments","redirect_uri":"https://my-website.com/abc/callback","updated_at":"2021-01-01T12:00:00.000Z"}],"meta":{"cursors":{"after":"example after 4405","before":"example before 9081"},"limit":50}}
"body": {"billing_request_templates":[{"authorisation_url":"https://pay.gocardless.com/BRT123","created_at":"2021-01-01T12:00:00.000Z","id":"BRT123","mandate_request_currency":"GBP","mandate_request_description":"Top-up Payment","mandate_request_metadata":{},"mandate_request_scheme":"bacs","mandate_request_verify":null,"metadata":{},"name":"12 Month Gold Plan","payment_request_amount":"100.00","payment_request_currency":"GBP","payment_request_description":"Top-up Payment","payment_request_metadata":{},"payment_request_scheme":"faster_payments","redirect_uri":"https://my-website.com/abc/callback","updated_at":"2021-01-01T12:00:00.000Z"},{"authorisation_url":"https://pay.gocardless.com/BRT123","created_at":"2021-01-01T12:00:00.000Z","id":"BRT123","mandate_request_currency":"GBP","mandate_request_description":"Top-up Payment","mandate_request_metadata":{},"mandate_request_scheme":"bacs","mandate_request_verify":null,"metadata":{},"name":"12 Month Gold Plan","payment_request_amount":"100.00","payment_request_currency":"GBP","payment_request_description":"Top-up Payment","payment_request_metadata":{},"payment_request_scheme":"faster_payments","redirect_uri":"https://my-website.com/abc/callback","updated_at":"2021-01-01T12:00:00.000Z"}],"meta":{"cursors":{"after":"example after 5740","before":"example before 8475"},"limit":50}}
},
"get": {
"method": "GET",
Expand Down
Loading

0 comments on commit 389e116

Please sign in to comment.