Acquire.Client._account module

class Account(user=None, account_name=None, accounting_service=None, accounting_url=None)[source]

Bases: object

This is the client-side handle that is used to interact with an account on the service. If the account is created with a valid user login then you can perform tasks such as making payments, or issueing receipts or refunds. Otherwise, this is a simple interface that allows the account to be used as a receiver of value

accounting_service()[source]

Return the accounting service managing this account

Returns:Accounting service managing this account
Return type:Service
balance(force_update=False)[source]

Return the current balance of this account

Parameters:force_update (bool, default=False) – Force the refresh
Returns:Balance of the account
Return type:Decimal
description()[source]

Return the description of this account

Returns:Description of account
Return type:str
guid()[source]

Return the globally unique UID of this account. This is a combination of the UID of the accounting service and the UID of the account

Returns:Globally unique UID of this account
Return type:str
is_beyond_overdraft_limit(force_update=False)[source]

Return whether or not the current balance is beyond the overdraft limit

Parameters:force_update (bool, default=False) – Force the refresh
Returns:True if account over overdraft limit, else False
Return type:bool
is_logged_in()[source]

Return whether or not the user has an authenticated login to this account

Returns:True if user logged in, else False
Return type:bool
is_null()[source]

Return whether or not this is a null account

Returns:True if account null, else False
Return type:bool
last_update_time()[source]

Return the time of the last update of the balance

Returns:Datetime of last update of the account balance
Return type:datetime
liability(force_update=False)[source]

Return the current total liability of this account

Parameters:force_update (bool, default=False) – Force the refresh
Returns:Liability of the account
Return type:Decimal
name()[source]

Return the name of this account

Returns:Name of this account
Return type:str
overdraft_limit(force_update=False)[source]

Return the overdraft limit of this account

Parameters:force_update (bool, default=False) – Force the refresh
Returns:Overdraft limit of account
Return type:Decimal
owner()[source]

Return the user who owns this account

Returns:Name of owner
Return type:str
perform(transaction, credit_account, is_provisional=False)[source]

Tell this accounting service to apply the transfer described in ‘transaction’ from this account to the passed account. Note that the user must have logged into this account so that they have authorised this transaction. This returns the record of this transaction

Parameters:
  • transaction (Transaction) – Transaction to perform
  • credit_account (Account) – Account to credit
  • is_provisional (bool, default=False) – Is transaction
  • provisional
receipt(credit_note, receipted_value=None)[source]

Receipt the passed credit note that contains a request to transfer value from another account to the passed account

Parameters:
  • credit_note (CreditNote) – CreditNote to use to create
  • receipt
  • receipted_value – Receipted value
receivable(force_update=False)[source]

Return the current total accounts receivable of this account

Parameters:force_update (bool, default=False) – Force the refresh
Returns:Accounts receivable of the account
Return type:Decimal
refund(credit_note)[source]

Refunds the passed credit note that contained a transfer of from another account to the passed account

Parameters:credit_note (CreditNote) – Credit note to refund
Returns:Record of this transaction
Return type:TransactionRecord
uid()[source]

Return the UID of this account

Returns:Account UID
Return type:str
user()[source]

Synonym for owner

Returns:Name of owner
Return type:str
get_accounts(user, accounting_service=None, accounting_url=None)[source]

Return all of the accounts of the passed user. Note that the user must be authenticated to call this function

Args:
user (User): User for query accounting_service (Service, default=None): Accounting service to check accounting_url (str, default=None): Accounting URL
Returns:
list: List of accounts of the passed user
create_account(user, account_name, description=None, accounting_service=None, accounting_url=None)[source]

Create an account on the accounting service for the passed user, calling the account ‘account_name’ and optionally passing in an account description. Note that the user must have authorised the login

Parameters:
  • user (User) – User to create account for
  • account_name (str) – Name of account to create
  • accounting_service (Service, default=None) – Accounting
  • on which to create account (service) –
  • accounting_url (str, default=None) – Accounting URL
Returns:

New account

Return type:

Account

deposit(user, value, description=None, accounting_service=None, accounting_url=None)[source]

Tell the system to allow the user to deposit ‘value’ from their (real) financial account to the system accounts

Parameters:
  • user (User) – User to authorise
  • value (Decimal) – Value to deposit
  • description (str) – Description of deposit
  • accounting_service (Service, default=None) – Accounting
  • to make deposit (service) –
  • accounting_url (str) – Accounting URl
Returns:

TODO - return value here

withdraw(user, value, description=None, accounting_service=None, accounting_url=None)[source]

Tell the system to allow the user to withdraw ‘value’ from the system accounts back to their (real) financial account