ExternalTransaction

class q2_sdk.hq.db.external_transaction.ExternalTransactionRow(element, row_class=None, rename_fields=None)[source]

Bases: TableRow

ExternalTransactionID: int
ExternalTransactionTypeID: int
ExternalTransactionStatusID: int
CreatedDate: str
Description: str
CustomerID: int
UserID: int
EffectiveDate: str
TransactionAmount: int
HostAccountID: int
class q2_sdk.hq.db.external_transaction.ExternalTransaction(logger, hq_credentials=None, ret_table_obj=None)[source]

Bases: DbObject

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 = 'ExternalTransaction'
REPRESENTATION_ROW_CLASS

alias of ExternalTransactionRow

add_arguments(parser)[source]

Hook for subclassed DbObjects to add custom arguments.

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

List[ExternalTransactionRow]

async get_by_customer_id(customer_id, return_count=None, serialize_for_cli=False)[source]
async get_by_user_id(user_id, return_count=None, serialize_for_cli=False)[source]
async add_update(transaction, wire=None, details=None)[source]

Add or update an external wire transaction.

Calls the Q2 core proc bsp_AddUpdateExternalTransaction with an <ET><Txn><D/><Wire/></Txn></ET> XML payload built from the given dicts (the D and Wire nodes are children of Txn, matching the paths the proc reads: /ET/Txn/D and //Wire). The proc upserts on ExternalTransactionID or ExternalTrackingNumber: include either in transaction to force an update, omit both to insert.

Parameters:
  • transaction (dict) – Txn-node attributes. Requires TxnType, TxnStatus, CreatedDate, InsertedDate, Description.

  • wire (Optional[dict]) – optional Wire-node attributes (Sender, FromAccount, Recipient, ReceivingInstitution, ToAccount, ToRouting, BeneFi*, IntermedFi*, …). NOTE: when a wire row already exists for the transaction, the platform proc updates ONLY the Imad field.

  • details (Optional[List[dict]]) – optional list of D-node dicts (ShortName, CreateDate, DataValue). Omit DataValue to remove a detail element.

Return type:

List[ExternalTransactionRow]

Returns:

rows of ExternalTransactionID, ExternalTrackingNumber, updated, inserted

async get_by_host_account_id(host_account_id, return_count=None, serialize_for_cli=False)[source]