-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Crankshaft Robot
authored and
Nick Campbell
committed
Apr 26, 2018
1 parent
a1f3075
commit 715d657
Showing
24 changed files
with
762 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# WARNING: Do not edit by hand, this file was generated by Crank: | ||
# | ||
# https://github.com/gocardless/crank | ||
# | ||
|
||
class MandateImport(object): | ||
"""A thin wrapper around a mandate_import, providing easy access to its | ||
attributes. | ||
Example: | ||
mandate_import = client.mandate_imports.get() | ||
mandate_import.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 id(self): | ||
return self.attributes.get('id') | ||
|
||
|
||
@property | ||
def scheme(self): | ||
return self.attributes.get('scheme') | ||
|
||
|
||
@property | ||
def status(self): | ||
return self.attributes.get('status') | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# WARNING: Do not edit by hand, this file was generated by Crank: | ||
# | ||
# https://github.com/gocardless/crank | ||
# | ||
|
||
class MandateImportEntry(object): | ||
"""A thin wrapper around a mandate_import_entry, providing easy access to its | ||
attributes. | ||
Example: | ||
mandate_import_entry = client.mandate_import_entries.get() | ||
mandate_import_entry.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 links(self): | ||
return self.Links(self.attributes.get('links')) | ||
|
||
|
||
@property | ||
def record_identifier(self): | ||
return self.attributes.get('record_identifier') | ||
|
||
|
||
|
||
|
||
|
||
|
||
class Links(object): | ||
"""Wrapper for the response's 'links' attribute.""" | ||
|
||
def __init__(self, attributes): | ||
self.attributes = attributes | ||
|
||
@property | ||
def customer(self): | ||
return self.attributes.get('customer') | ||
|
||
@property | ||
def customer_bank_account(self): | ||
return self.attributes.get('customer_bank_account') | ||
|
||
@property | ||
def mandate(self): | ||
return self.attributes.get('mandate') | ||
|
||
@property | ||
def mandate_import(self): | ||
return self.attributes.get('mandate_import') | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# 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 MandateImportEntriesService(base_service.BaseService): | ||
"""Service class that provides access to the mandate_import_entries | ||
endpoints of the GoCardless Pro API. | ||
""" | ||
|
||
RESOURCE_CLASS = resources.MandateImportEntry | ||
RESOURCE_NAME = 'mandate_import_entries' | ||
|
||
|
||
def create(self,params=None, headers=None): | ||
"""Add a mandate import entry. | ||
For an existing [mandate import](#core-endpoints-mandate-imports), this | ||
endpoint can | ||
be used to add individual mandates to be imported into GoCardless. | ||
You can add no more than 30,000 rows to a single mandate import. | ||
If you attempt to go over this limit, the API will return a | ||
`record_limit_exceeded` error. | ||
Args: | ||
params (dict, optional): Request body. | ||
Returns: | ||
ListResponse of MandateImportEntry instances | ||
""" | ||
path = '/mandate_import_entries' | ||
|
||
if params is not None: | ||
params = {self._envelope_key(): params} | ||
|
||
response = self._perform_request('POST', path, params, headers, | ||
retry_failures=True) | ||
return self._resource_for(response) | ||
|
||
|
||
def list(self,params=None, headers=None): | ||
"""List all mandate import entries. | ||
For an existing mandate import, this endpoint lists all of the entries | ||
attached. | ||
After a mandate import has been submitted, you can use this endpoint to | ||
associate records | ||
in your system (using the `record_identifier` that you provided when | ||
creating the | ||
mandate import). | ||
Args: | ||
params (dict, optional): Query string parameters. | ||
Returns: | ||
MandateImportEntry | ||
""" | ||
path = '/mandate_import_entries' | ||
|
||
|
||
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) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# 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 MandateImportsService(base_service.BaseService): | ||
"""Service class that provides access to the mandate_imports | ||
endpoints of the GoCardless Pro API. | ||
""" | ||
|
||
RESOURCE_CLASS = resources.MandateImport | ||
RESOURCE_NAME = 'mandate_imports' | ||
|
||
|
||
def create(self,params=None, headers=None): | ||
"""Create a new mandate import. | ||
Mandate imports are first created, before mandates are added | ||
one-at-a-time, so | ||
this endpoint merely signals the start of the import process. Once | ||
you've finished | ||
adding entries to an import, you should | ||
[submit](#mandate-imports-submit-a-mandate-import) it. | ||
Args: | ||
params (dict, optional): Request body. | ||
Returns: | ||
ListResponse of MandateImport instances | ||
""" | ||
path = '/mandate_imports' | ||
|
||
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: | ||
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 mandate import. | ||
Returns a single mandate import. | ||
Args: | ||
identity (string): Unique identifier, beginning with "IM". | ||
params (dict, optional): Query string parameters. | ||
Returns: | ||
ListResponse of MandateImport instances | ||
""" | ||
path = self._sub_url_params('/mandate_imports/:identity', { | ||
|
||
'identity': identity, | ||
}) | ||
|
||
|
||
response = self._perform_request('GET', path, params, headers, | ||
retry_failures=True) | ||
return self._resource_for(response) | ||
|
||
|
||
def submit(self,identity,params=None, headers=None): | ||
"""Submit a mandate import. | ||
Submits the mandate import, which allows it to be processed by a member | ||
of the | ||
GoCardless team. Once the import has been submitted, it can no longer | ||
have entries | ||
added to it. | ||
Args: | ||
identity (string): Unique identifier, beginning with "IM". | ||
params (dict, optional): Request body. | ||
Returns: | ||
ListResponse of MandateImport instances | ||
""" | ||
path = self._sub_url_params('/mandate_imports/:identity/actions/submit', { | ||
|
||
'identity': identity, | ||
}) | ||
|
||
if params is not None: | ||
params = {'data': params} | ||
response = self._perform_request('POST', path, params, headers, | ||
retry_failures=False) | ||
return self._resource_for(response) | ||
|
||
|
||
def cancel(self,identity,params=None, headers=None): | ||
"""Cancel a mandate import. | ||
Cancels the mandate import, which aborts the import process and stops | ||
the mandates | ||
being set up in GoCardless. Once the import has been cancelled, it can | ||
no longer have | ||
entries added to it. Mandate imports which have already been submitted | ||
cannot be | ||
cancelled. | ||
Args: | ||
identity (string): Unique identifier, beginning with "IM". | ||
params (dict, optional): Request body. | ||
Returns: | ||
ListResponse of MandateImport instances | ||
""" | ||
path = self._sub_url_params('/mandate_imports/:identity/actions/cancel', { | ||
|
||
'identity': identity, | ||
}) | ||
|
||
if params is not None: | ||
params = {'data': params} | ||
response = self._perform_request('POST', path, params, headers, | ||
retry_failures=False) | ||
return self._resource_for(response) | ||
|
Oops, something went wrong.