EStatement

enum q2_sdk.hq.db.e_statement.EStatementDateColumn(value)[source]

Bases: Enum

Valid values are as follows:

CreateDate = <EStatementDateColumn.CreateDate: 'Create'>
LastChange = <EStatementDateColumn.LastChange: 'Last'>
class q2_sdk.hq.db.e_statement.AddOrUpdateParams(host_account_id, opt_in, email_address, user_id, alt_email_address=None, last_change=None)[source]

Bases: object

Parameters:
  • host_account_id (int) – The account id of the target account

  • opt_in (bool) – boolean representing opting in or out of e-statements

  • email_address (str) – the target email address

  • user_id (int) – The user ID making the creation or update

  • alt_email_address (Optional[str]) – An alternate email for e-statements

Params last_change:

The timestamp of the last change. Defaults to datetime.now

host_account_id: int
opt_in: bool
email_address: str
user_id: int
alt_email_address: Optional[str] = None
last_change: Optional[datetime] = None
build_sql_parameters()[source]
class q2_sdk.hq.db.e_statement.EStatementRow[source]

Bases: RepresentationRowBase

HostAccountID: IntElement = 'HostAccountID'
AccountNumberInternal: StringElement = 'AccountNumberInternal'
AccountNumberExternal: StringElement = 'AccountNumberExternal'
CreateDate: StringElement = 'CreateDate'
LastChange: StringElement = 'LastChange'
ModifiedByID: IntElement = 'ModifiedByID'
ModifiedFirstName: StringElement = 'ModifiedFirstName'
ModifiedLastName: StringElement = 'ModifiedLastName'
OptIn: BoolElement = 'OptIn'
HasBeenReported: IntElement = 'HasBeenReported'
EmailID: IntElement = 'EmailID'
EmailAddress: StringElement = 'EmailAddress'
AlternateEmailID: IntElement = 'AlternateEmailID'
AlternateEmailAddress: StringElement = 'AlternateEmailAddress'
ProcessedDate: StringElement = 'ProcessedDate'
class q2_sdk.hq.db.e_statement.EStatement(logger, hq_credentials=None, ret_table_obj=None)[source]

Bases: DbObject

Queries the Q2_Customer table for rows that match the given arguments. Gathers additional details on specific customers

Programmatic access to the Q2 database. Not as flexible as a true ORM, but takes the guesswork out of database schemas and ensures safety in the transactions.

Parameters:
  • logger – Reference to calling request’s logger (self.logger in your extension)

  • hq_credentials (Optional[HqCredentials]) – HQ Connectivity Information (Defaults to settings file)

  • ret_table_obj (Optional[bool]) – Flag to return list of LXML elements if False or TableRow objects from DB calls if True (Defaults to settings file)

NAME = 'EStatement'
REPRESENTATION_ROW_CLASS

alias of EStatementRow

add_arguments(parser)[source]

Hook for subclassed DbObjects to add custom arguments.

async get(host_account_ids, serialize_for_cli=False)[source]
Return type:

list[EStatementRow]

async get_by_date_range(start_date, end_date, date_column, page_number=1, page_size=200)[source]

Get e-statements by date range and supports pagination

Parameters:
  • start_date (datetime) – The start date of the date range, as a datetime object

  • end_date (datetime) – The end date of the date range, as a datetime object

  • date_column (EStatementDateColumn) – The date column to filter the date on

  • page_number – the starting point for pagination. Defaults to 1

  • page_size – The number of transactions to get per page

Return type:

list[EStatementRow]

Returns:

A list of EStatement rows that fit the provided parameters

async add_or_update(e_statement_values)[source]