Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions gocardless_pro/resources/institution.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ def __init__(self, attributes, api_response):
self.attributes = attributes
self.api_response = api_response

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


@property
def country_code(self):
return self.attributes.get('country_code')
Expand Down Expand Up @@ -56,13 +51,6 @@ def roles(self):
return self.attributes.get('roles')


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







Expand Down Expand Up @@ -93,5 +81,3 @@ def single(self):





16 changes: 16 additions & 0 deletions gocardless_pro/resources/mandate.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,22 @@ class ConsentParameters(object):
def __init__(self, attributes):
self.attributes = attributes

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

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

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

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

@property
def max_amount_per_payment(self):
return self.attributes.get('max_amount_per_payment')
Expand All @@ -130,6 +142,10 @@ def period(self):
def period_alignment(self):
return self.attributes.get('period_alignment')

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

@property
def start_date(self):
return self.attributes.get('start_date')
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/events.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/fixtures/institutions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"method": "GET",
"path_template": "/institutions",
"url_params": [],
"body": {"institutions":[{"autocompletes_collect_bank_account":true,"country_code":"GB","icon_url":"https://gocardless/assets/icons/monzo","id":"monzo","limits":{"daily":{},"single":{}},"logo_url":"https://gocardless/assets/logos/monzo","name":"VAT","roles":["corporate_accounts","funds_confirmation"],"status":"enabled"},{"autocompletes_collect_bank_account":true,"country_code":"GB","icon_url":"https://gocardless/assets/icons/monzo","id":"monzo","limits":{"daily":{},"single":{}},"logo_url":"https://gocardless/assets/logos/monzo","name":"VAT","roles":["corporate_accounts","funds_confirmation"],"status":"enabled"}],"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50}}
"body": {"institutions":[{"country_code":"GB","icon_url":"https://gocardless/assets/icons/monzo","id":"monzo","limits":{"daily":{},"single":{}},"logo_url":"https://gocardless/assets/logos/monzo","name":"VAT","roles":["corporate_accounts","funds_confirmation"]},{"country_code":"GB","icon_url":"https://gocardless/assets/icons/monzo","id":"monzo","limits":{"daily":{},"single":{}},"logo_url":"https://gocardless/assets/logos/monzo","name":"VAT","roles":["corporate_accounts","funds_confirmation"]}],"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50}}
},
"list_for_billing_request": {
"method": "GET",
"path_template": "/billing_requests/:identity/institutions",
"url_params": ["BRQ123"],
"body": {"institutions":[{"autocompletes_collect_bank_account":true,"country_code":"GB","icon_url":"https://gocardless/assets/icons/monzo","id":"monzo","limits":{"daily":{},"single":{}},"logo_url":"https://gocardless/assets/logos/monzo","name":"VAT","roles":["corporate_accounts","funds_confirmation"],"status":"enabled"},{"autocompletes_collect_bank_account":true,"country_code":"GB","icon_url":"https://gocardless/assets/icons/monzo","id":"monzo","limits":{"daily":{},"single":{}},"logo_url":"https://gocardless/assets/logos/monzo","name":"VAT","roles":["corporate_accounts","funds_confirmation"],"status":"enabled"}],"meta":{"cursors":{"after":"example after 102","before":"example before 102"},"limit":50}}
"body": {"institutions":[{"autocompletes_collect_bank_account":true,"country_code":"GB","icon_url":"https://gocardless/assets/icons/monzo","id":"monzo","logo_url":"https://gocardless/assets/logos/monzo","name":"VAT","status":"enabled"},{"autocompletes_collect_bank_account":true,"country_code":"GB","icon_url":"https://gocardless/assets/icons/monzo","id":"monzo","logo_url":"https://gocardless/assets/logos/monzo","name":"VAT","status":"enabled"}],"meta":{"cursors":{"after":"example after 102","before":"example before 102"},"limit":50}}
}
}
12 changes: 6 additions & 6 deletions tests/fixtures/mandates.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@
"method": "POST",
"path_template": "/mandates",
"url_params": [],
"body": {"mandates":{"authorisation_source":"telephone","consent_parameters":{"end_date":"example end_date 101","max_amount_per_payment":101,"max_amount_per_period":101,"max_payments_per_period":101,"period":"week","period_alignment":"example period_alignment 101","start_date":"example start_date 101"},"consent_type":"example consent_type 101","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"direct","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}}
"body": {"mandates":{"authorisation_source":"telephone","consent_parameters":{"currency":"example currency 101","end_date":"example end_date 101","fixed_amount_per_payment":101,"id":"example id 101","max_amount_per_payment":101,"max_amount_per_period":101,"max_payments_per_period":101,"period":"week","period_alignment":"example period_alignment 101","scheme":"example scheme 101","start_date":"example start_date 101"},"consent_type":"example consent_type 101","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"direct","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}}
},
"list": {
"method": "GET",
"path_template": "/mandates",
"url_params": [],
"body": {"mandates":[{"authorisation_source":"paper","consent_parameters":{"end_date":"example end_date 102","max_amount_per_payment":102,"max_amount_per_period":102,"max_payments_per_period":102,"period":"month","period_alignment":"example period_alignment 102","start_date":"example start_date 102"},"consent_type":"example consent_type 102","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"managed","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"},{"authorisation_source":"web","consent_parameters":{"end_date":"example end_date 103","max_amount_per_payment":103,"max_amount_per_period":103,"max_payments_per_period":103,"period":"year","period_alignment":"example period_alignment 103","start_date":"example start_date 103"},"consent_type":"example consent_type 103","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"direct","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}],"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50}}
"body": {"mandates":[{"authorisation_source":"paper","consent_parameters":{"currency":"example currency 102","end_date":"example end_date 102","fixed_amount_per_payment":102,"id":"example id 102","max_amount_per_payment":102,"max_amount_per_period":102,"max_payments_per_period":102,"period":"month","period_alignment":"example period_alignment 102","scheme":"example scheme 102","start_date":"example start_date 102"},"consent_type":"example consent_type 102","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"managed","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"},{"authorisation_source":"web","consent_parameters":{"currency":"example currency 103","end_date":"example end_date 103","fixed_amount_per_payment":103,"id":"example id 103","max_amount_per_payment":103,"max_amount_per_period":103,"max_payments_per_period":103,"period":"year","period_alignment":"example period_alignment 103","scheme":"example scheme 103","start_date":"example start_date 103"},"consent_type":"example consent_type 103","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"direct","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}],"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50}}
},
"get": {
"method": "GET",
"path_template": "/mandates/:identity",
"url_params": ["MD123"],
"body": {"mandates":{"authorisation_source":"telephone","consent_parameters":{"end_date":"example end_date 104","max_amount_per_payment":104,"max_amount_per_period":104,"max_payments_per_period":104,"period":"flexible","period_alignment":"example period_alignment 104","start_date":"example start_date 104"},"consent_type":"example consent_type 104","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"managed","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}}
"body": {"mandates":{"authorisation_source":"telephone","consent_parameters":{"currency":"example currency 104","end_date":"example end_date 104","fixed_amount_per_payment":104,"id":"example id 104","max_amount_per_payment":104,"max_amount_per_period":104,"max_payments_per_period":104,"period":"flexible","period_alignment":"example period_alignment 104","scheme":"example scheme 104","start_date":"example start_date 104"},"consent_type":"example consent_type 104","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"managed","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}}
},
"update": {
"method": "PUT",
"path_template": "/mandates/:identity",
"url_params": ["MD123"],
"body": {"mandates":{"authorisation_source":"paper","consent_parameters":{"end_date":"example end_date 105","max_amount_per_payment":105,"max_amount_per_period":105,"max_payments_per_period":105,"period":"day","period_alignment":"example period_alignment 105","start_date":"example start_date 105"},"consent_type":"example consent_type 105","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"direct","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}}
"body": {"mandates":{"authorisation_source":"paper","consent_parameters":{"currency":"example currency 105","end_date":"example end_date 105","fixed_amount_per_payment":105,"id":"example id 105","max_amount_per_payment":105,"max_amount_per_period":105,"max_payments_per_period":105,"period":"day","period_alignment":"example period_alignment 105","scheme":"example scheme 105","start_date":"example start_date 105"},"consent_type":"example consent_type 105","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"direct","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}}
},
"cancel": {
"method": "POST",
"path_template": "/mandates/:identity/actions/cancel",
"url_params": ["MD123"],
"body": {"mandates":{"authorisation_source":"web","consent_parameters":{"end_date":"example end_date 106","max_amount_per_payment":106,"max_amount_per_period":106,"max_payments_per_period":106,"period":"week","period_alignment":"example period_alignment 106","start_date":"example start_date 106"},"consent_type":"example consent_type 106","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"managed","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}}
"body": {"mandates":{"authorisation_source":"web","consent_parameters":{"currency":"example currency 106","end_date":"example end_date 106","fixed_amount_per_payment":106,"id":"example id 106","max_amount_per_payment":106,"max_amount_per_period":106,"max_payments_per_period":106,"period":"week","period_alignment":"example period_alignment 106","scheme":"example scheme 106","start_date":"example start_date 106"},"consent_type":"example consent_type 106","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"managed","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}}
},
"reinstate": {
"method": "POST",
"path_template": "/mandates/:identity/actions/reinstate",
"url_params": ["MD123"],
"body": {"mandates":{"authorisation_source":"telephone","consent_parameters":{"end_date":"example end_date 107","max_amount_per_payment":107,"max_amount_per_period":107,"max_payments_per_period":107,"period":"month","period_alignment":"example period_alignment 107","start_date":"example start_date 107"},"consent_type":"example consent_type 107","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"direct","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}}
"body": {"mandates":{"authorisation_source":"telephone","consent_parameters":{"currency":"example currency 107","end_date":"example end_date 107","fixed_amount_per_payment":107,"id":"example id 107","max_amount_per_payment":107,"max_amount_per_period":107,"max_payments_per_period":107,"period":"month","period_alignment":"example period_alignment 107","scheme":"example scheme 107","start_date":"example start_date 107"},"consent_type":"example consent_type 107","created_at":"2014-01-01T12:00:00.000Z","funds_settlement":"direct","id":"MD123","links":{"creditor":"CR123","customer":"CU123","customer_bank_account":"BA123","new_mandate":"MD123"},"mandate_type":"bank_debit","metadata":{},"next_possible_charge_date":"2014-10-27","next_possible_standard_ach_charge_date":"2014-10-27","payments_require_approval":false,"reference":"REF-123","scheme":"bacs","status":"pending_submission","verified_at":"2021-01-01T12:00:00.000Z"}}
}
}
4 changes: 0 additions & 4 deletions tests/integration/institutions_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ def test_institutions_list():
assert response.before == fixture['body']['meta']['cursors']['before']
assert response.after == fixture['body']['meta']['cursors']['after']
assert responses.calls[-1].request.headers.get('Idempotency-Key') is None
assert [r.autocompletes_collect_bank_account for r in response.records] == [b.get('autocompletes_collect_bank_account') for b in body]
assert [r.country_code for r in response.records] == [b.get('country_code') for b in body]
assert [r.icon_url for r in response.records] == [b.get('icon_url') for b in body]
assert [r.id for r in response.records] == [b.get('id') for b in body]
assert [r.logo_url for r in response.records] == [b.get('logo_url') for b in body]
assert [r.name for r in response.records] == [b.get('name') for b in body]
assert [r.roles for r in response.records] == [b.get('roles') for b in body]
assert [r.status for r in response.records] == [b.get('status') for b in body]

@responses.activate
def test_timeout_institutions_list_retries():
Expand Down Expand Up @@ -102,14 +100,12 @@ def test_institutions_list_for_billing_request():
assert response.before == fixture['body']['meta']['cursors']['before']
assert response.after == fixture['body']['meta']['cursors']['after']
assert responses.calls[-1].request.headers.get('Idempotency-Key') is None
assert [r.autocompletes_collect_bank_account for r in response.records] == [b.get('autocompletes_collect_bank_account') for b in body]
assert [r.country_code for r in response.records] == [b.get('country_code') for b in body]
assert [r.icon_url for r in response.records] == [b.get('icon_url') for b in body]
assert [r.id for r in response.records] == [b.get('id') for b in body]
assert [r.logo_url for r in response.records] == [b.get('logo_url') for b in body]
assert [r.name for r in response.records] == [b.get('name') for b in body]
assert [r.roles for r in response.records] == [b.get('roles') for b in body]
assert [r.status for r in response.records] == [b.get('status') for b in body]

def test_timeout_institutions_list_for_billing_request_doesnt_retry():
fixture = helpers.load_fixture('institutions')['list_for_billing_request']
Expand Down
Loading
Loading