Skip to content
Open
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
22 changes: 22 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ Bank account details
# Get encrypted bank details
client.bank_account_details.get('BA123', params={...})

Bank account holder verifications
''''''''''''''''''''''''''''''''''''''''''

.. code:: python

# Create a bank account holder verification.
client.bank_account_holder_verifications.create(params={...})

# Get a bank account holder verification.
client.bank_account_holder_verifications.get('BAHV123', params={...})

Bank authorisations
''''''''''''''''''''''''''''''''''''''''''

Expand Down Expand Up @@ -563,6 +574,17 @@ Payments
# Retry a payment
client.payments.retry('PM123', params={...})

Payment accounts
''''''''''''''''''''''''''''''''''''''''''

.. code:: python

# List payment accounts
client.payment_accounts.list(params={...})

# Iterate through all payment_accounts
client.payment_accounts.all(params={...})

Payment account transactions
''''''''''''''''''''''''''''''''''''''''''

Expand Down
8 changes: 8 additions & 0 deletions gocardless_pro/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def balances(self):
def bank_account_details(self):
return services.BankAccountDetailsService(self._api_client, 3, 0.5, self._raise_on_idempotency_conflict)

@property
def bank_account_holder_verifications(self):
return services.BankAccountHolderVerificationsService(self._api_client, 3, 0.5, self._raise_on_idempotency_conflict)

@property
def bank_authorisations(self):
return services.BankAuthorisationsService(self._api_client, 3, 0.5, self._raise_on_idempotency_conflict)
Expand Down Expand Up @@ -153,6 +157,10 @@ def payer_themes(self):
def payments(self):
return services.PaymentsService(self._api_client, 3, 0.5, self._raise_on_idempotency_conflict)

@property
def payment_accounts(self):
return services.PaymentAccountsService(self._api_client, 3, 0.5, self._raise_on_idempotency_conflict)

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

from .bank_account_detail import BankAccountDetail

from .bank_account_holder_verification import BankAccountHolderVerification

from .bank_authorisation import BankAuthorisation

from .bank_details_lookup import BankDetailsLookup
Expand Down Expand Up @@ -61,6 +63,8 @@

from .payment import Payment

from .payment_account import PaymentAccount

from .payment_account_transaction import PaymentAccountTransaction

from .payout import Payout
Expand Down
54 changes: 54 additions & 0 deletions gocardless_pro/resources/bank_account_holder_verification.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 BankAccountHolderVerification(object):
"""A thin wrapper around a bank_account_holder_verification, providing easy access to its
attributes.

Example:
bank_account_holder_verification = client.bank_account_holder_verifications.get()
bank_account_holder_verification.id
"""

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

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


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


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


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


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













79 changes: 79 additions & 0 deletions gocardless_pro/resources/payment_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#

class PaymentAccount(object):
"""A thin wrapper around a payment_account, providing easy access to its
attributes.

Example:
payment_account = client.payment_accounts.get()
payment_account.id
"""

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

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


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


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


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


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


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


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
















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

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

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



2 changes: 2 additions & 0 deletions gocardless_pro/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from .balances_service import BalancesService
from .bank_account_details_service import BankAccountDetailsService
from .bank_account_holder_verifications_service import BankAccountHolderVerificationsService
from .bank_authorisations_service import BankAuthorisationsService
from .bank_details_lookups_service import BankDetailsLookupsService
from .billing_requests_service import BillingRequestsService
Expand Down Expand Up @@ -32,6 +33,7 @@
from .payer_authorisations_service import PayerAuthorisationsService
from .payer_themes_service import PayerThemesService
from .payments_service import PaymentsService
from .payment_accounts_service import PaymentAccountsService
from .payment_account_transactions_service import PaymentAccountTransactionsService
from .payouts_service import PayoutsService
from .payout_items_service import PayoutItemsService
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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 BankAccountHolderVerificationsService(base_service.BaseService):
"""Service class that provides access to the bank_account_holder_verifications
endpoints of the GoCardless Pro API.
"""

RESOURCE_CLASS = resources.BankAccountHolderVerification
RESOURCE_NAME = 'bank_account_holder_verifications'


def create(self,params=None, headers=None):
"""Create a bank account holder verification..

Verify the account holder of the bank account. A complete verification
can be attached when creating an outbound payment. This endpoint allows
partner merchants to create Confirmation of Payee checks on customer
bank accounts before sending outbound payments.

Args:
params (dict, optional): Request body.

Returns:
BankAccountHolderVerification
"""
path = '/bank_account_holder_verifications'

if params is not None:
params = {self._envelope_key(): params}

try:
response = self._perform_request('POST', path, params, headers,
retry_failures=True)
except errors.IdempotentCreationConflictError as err:
if self.raise_on_idempotency_conflict:
raise err
return self.get(identity=err.conflicting_resource_id,
params=params,
headers=headers)
return self._resource_for(response)


def get(self,identity,params=None, headers=None):
"""Get a bank account holder verification..

Fetches a bank account holder verification by ID.

Args:
identity (string): The unique identifier for the bank account holder verification resource, e.g. "BAHV123".
params (dict, optional): Query string parameters.

Returns:
BankAccountHolderVerification
"""
path = self._sub_url_params('/bank_account_holder_verifications/:identity', {

'identity': identity,
})


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

45 changes: 45 additions & 0 deletions gocardless_pro/services/payment_accounts_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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 PaymentAccountsService(base_service.BaseService):
"""Service class that provides access to the payment_accounts
endpoints of the GoCardless Pro API.
"""

RESOURCE_CLASS = resources.PaymentAccount
RESOURCE_NAME = 'payment_accounts'


def list(self,params=None, headers=None):
"""List payment accounts.

Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
payment accounts.

Args:
params (dict, optional): Query string parameters.

Returns:
ListResponse of PaymentAccount instances
"""
path = '/payment_accounts'


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, identity_params={
})


6 changes: 6 additions & 0 deletions tests/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def test_balances_returns_service():
def test_bank_account_details_returns_service():
assert isinstance(client.bank_account_details, services.BankAccountDetailsService)

def test_bank_account_holder_verifications_returns_service():
assert isinstance(client.bank_account_holder_verifications, services.BankAccountHolderVerificationsService)

def test_bank_authorisations_returns_service():
assert isinstance(client.bank_authorisations, services.BankAuthorisationsService)

Expand Down Expand Up @@ -104,6 +107,9 @@ def test_payer_themes_returns_service():
def test_payments_returns_service():
assert isinstance(client.payments, services.PaymentsService)

def test_payment_accounts_returns_service():
assert isinstance(client.payment_accounts, services.PaymentAccountsService)

def test_payment_account_transactions_returns_service():
assert isinstance(client.payment_account_transactions, services.PaymentAccountTransactionsService)

Expand Down
4 changes: 3 additions & 1 deletion tests/fixtures/balances.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{


"list": {
"method": "GET",
"path_template": "/balances",
"url_params": [],
"body": {"balances":[{"amount":8081,"balance_type":"confirmed_funds","currency":"EUR","last_updated_at":"2014-01-01T12:00:00.000Z","links":{"creditor":"CR123"}},{"amount":7887,"balance_type":"confirmed_funds","currency":"EUR","last_updated_at":"2014-01-01T12:00:00.000Z","links":{"creditor":"CR123"}}],"meta":{"cursors":{"after":"example after 4059","before":"example before 1847"},"limit":50}}
"body": {"balances":[{"amount":101,"balance_type":"confirmed_funds","currency":"EUR","last_updated_at":"2014-01-01T12:00:00.000Z","links":{"creditor":"CR123"}},{"amount":102,"balance_type":"confirmed_funds","currency":"EUR","last_updated_at":"2014-01-01T12:00:00.000Z","links":{"creditor":"CR123"}}],"meta":{"cursors":{"after":"example after 101","before":"example before 101"},"limit":50}}
}
}
4 changes: 3 additions & 1 deletion tests/fixtures/bank_account_details.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{


"get": {
"method": "GET",
"path_template": "/bank_account_details/:identity",
"url_params": ["BA123"],
"body": {"bank_account_details":{"ciphertext":"example ciphertext 4425","encrypted_key":"example encrypted_key 2081","iv":"example iv 1318","protected":"example protected 456","tag":"example tag 2540"}}
"body": {"bank_account_details":{"ciphertext":"example ciphertext 101","encrypted_key":"example encrypted_key 101","iv":"example iv 101","protected":"example protected 101","tag":"example tag 101"}}
}
}
Loading