Acquire.Accounting._transaction module

class Transaction(value=0, description=None)[source]

Bases: object

This class provides basic information about a transaction - namely just the value (always positive) and what the transaction is for

description()[source]

Return the description of this transaction

Returns:Description of transaction
Return type:str
fingerprint()[source]

Return a fingerprint that can be used to verify this transaction

static from_data(data)[source]

Return a newly constructed transaction from the passed dictionary that has been decoded from JSON

Parameters:data (dict) – Dictionary from JSON
Returns:Object created from JSON
Return type:Transaction
is_null()[source]

Return whether or not this is a null transaction

Returns:True if transaction is null, else False
Return type:bool
static maximum_transaction_value()[source]

Return the maximum value for a single transaction. Currently this is 999999.999999 so that a transaction fits into a f013.6 string

Returns:Maximum transaction value
Return type:Decimal
static round(value)[source]

Round the passed floating point value to the precision level of the transaction (currently 6 decimal places)

Parameters:value (float) – Value to convert to Decimal
Returns:Rounded value
Return type:Decimal
static split(value, description)[source]

Split the passed transaction described by ‘description’ with value ‘value’ into a list of transactions that fit the maximum transaction limit.

Parameters:
  • value (float) – Value to split between transactions
  • description (str) – Description of transactions
Returns:

List of Transactions

Return type:

list

to_data()[source]

Return this transaction as a dictionary that can be encoded to JSON

Returns:Dictionary of this object serialisable to JSON
Return type:dict
value()[source]

Return the value of this transaction. This will be always greater than or equal to zero

Returns:Value of this transaction
Return type:Decimal