Host Account

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

Bases: TableRow

HostAccountID: int
CustomerID: int
CustomerName: str
class q2_sdk.hq.db.host_account.HostAccountRow(element, row_class=None, rename_fields=None)[source]

Bases: TableRow

HostAccountID: int
AccountNumberInternal: str
AccountNumberExternal: str
ProductID: int
ProductName: str
ProductNickName: str
AccountDesc: str
CIFInternal: str
CIFExternal: str
DefaultPwd: str
DataAsOfDate: str
BranchID: int
SkipBalanceCheck: bool
ABA: str
IsExternalAccount: bool
AccountInfo: str
LastStatusChange: str
AccountStatusID: int
LastHistoryDate: str
class q2_sdk.hq.db.host_account.HostAccountCustomerRow(element, row_class=None, rename_fields=None)[source]

Bases: TableRow

CustomerID: int
UserID: int
HostAccountID: int
AccountNumberInternal: str
AccountNumberExternal: str
ProductID: int
ProductName: str
AccountDesc: str
CIFInternal: str
CIFExternal: str
DataAsOfDate: str
ProductTypeName: str
ABA: str
IsExternalAccount: bool
class q2_sdk.hq.db.host_account.HostAccountCustomerWithProductRow(element, row_class=None, rename_fields=None)[source]

Bases: TableRow

CustomerID: int
HostAccountID: int
ProductName: str
ProductID: int
AccountStatus: str
class q2_sdk.hq.db.host_account.UserRoleAccountRow(element, row_class=None, rename_fields=None)[source]

Bases: TableRow

UserRoleAccountID: int
UserRoleID: int
CustomerAccountID: int
Access: int
HostAccountID: int
AccountNumberInternal: str
AccountNumberExternal: str
ProductID: int
AccountDesc: str
CIFInternal: str
CIFExternal: str
DataAsOfDate: str
BranchID: int
SkipBalanceCheck: bool
ABA: str
IsExternalAccount: bool
AccountInfo: str
LastStatusChange: str
AccountStatusID: int
LastHistoryDate: str
AccountStatus: str
StatusDescription: str
HostProductCode: str
ProductName: str
ProductTypeID: int
ProductNickName: str
HydraProductCode: str
IsLoanAccount: bool
ProductTypeName: str
HydraProductTypeCode: str
HostProductTypeCode: str
class q2_sdk.hq.db.host_account.UpdateAccountRightsParameters(hostAccountId, userId, can_view, can_deposit, can_withdraw)[source]

Bases: object

UpdateAccountRightsParameters(hostAccountId: int, userId: int, can_view: bool, can_deposit: bool, can_withdraw: bool)

hostAccountId: int
userId: int
can_view: bool
can_deposit: bool
can_withdraw: bool
calculate_access()[source]
Return type:

int

build_sql_parameters()[source]
class q2_sdk.hq.db.host_account.ProductChangeParameters(host_account_id, old_product_id, new_product_id)[source]

Bases: object

ProductChangeParameters(host_account_id: int, old_product_id: int, new_product_id: int)

host_account_id: int
old_product_id: int
new_product_id: int
build_xml_node()[source]
class q2_sdk.hq.db.host_account.ProductChangeStatus(*values)[source]

Bases: Enum

Ok = 'OK'
AllRecordsSkipped = 'AllRecordsSkipped'
PartialUpdate = 'PartialUpdate'
class q2_sdk.hq.db.host_account.ProductChangeResults(result, successful_accounts, skipped_accounts)[source]

Bases: object

ProductChangeResults(result: q2_sdk.hq.db.host_account.ProductChangeStatus, successful_accounts: list, skipped_accounts: list)

result: ProductChangeStatus
successful_accounts: list
skipped_accounts: list
class q2_sdk.hq.db.host_account.HostAccount(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 (HqCredentials | None) – HQ Connectivity Information (Defaults to settings file)

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

REPRESENTATION_ROW_CLASS

alias of HostAccountRow

add_arguments(parser)[source]

Hook for subclassed DbObjects to add custom arguments.

async check_adapter_mode()[source]

Note: this only works in the dev environment

async update_to_batch()[source]

Note: this only works in the dev environment

async get_by_id(host_account_id, serialize_for_cli=False)[source]
Return type:

HostAccountRow

async create(account_internal, account_external, host_product_code, host_product_type_code, cif, account_description, is_external=False, data_as_of_date=None)[source]
Return type:

list[HostAccountRow]

async search_by_external_number(external_account_number)[source]
Return type:

list[HostAccountRow]

async search_by_internal_number(internal_account_number, cif_internal=None, cif_concatenated=False, open_only=False, product_type_id=None, host_product_type_code=None)[source]

Set cif_concatenated when internal_account_number contains a CIF prefix. An explicit cif_internal takes precedence and expects an unprefixed account number. Otherwise, concatenated lookup requires AccountRequiresCifInternal to be enabled. When disabled or unset, the account number is passed through unchanged. Set open_only to return only accounts whose status is Open. By default, all statuses are included. Filter by ProductTypeID from ProductType.get() or by HostProductTypeCode. When both product filters are supplied, both must match.

Return type:

list[HostAccountRow]

async update_account_rights(parameters)[source]

Update the account rights for an account linked to a user. This only works for accounts explicitly linked to the user, and will not work for accounts linked by a cif.

async get_customer_host_accounts(customer_ids)[source]

Retrieves multiple accounts associated to the customers in the list. For DB performance reason, the customer id list should be limited to 20

Parameters:

customer_ids (list[int]) – list of Q2_Customer.CustomerID <= 20

Return type:

list[HostAccountCustomerRow]

async get_accounts_by_product(group_id, product_id=None)[source]

Searches a group of customers for accounts with a specific product id

Parameters:
  • group_id (int) – Group to search [Q2_Group.GroupID]

  • product_id (int | None) – Product ID of the target product [Q2_Product.ProductID]

Return type:

list[HostAccountCustomerWithProductRow]

async change_account_product(account_changes)[source]

Changes the product of a list of accounts :type account_changes: list[ProductChangeParameters] :param account_changes: list of ProductChangeParameters objects.

Return type:

ProductChangeResults

Returns:

ProductChangeResults object

async get_account_owners(host_account_ids)[source]

Retrieves customer ownership info for the given host account IDs. Reverse lookup of get_customer_host_accounts: given accounts, find the owning customers.

Parameters:

host_account_ids (list[int]) – list of Q2_HostAccount.HostAccountID <= 20

Return type:

list[AccountOwnerRow]

Checks the account against the user’s user role accounts.

Parameters:
  • host_account_id (int) – int Q2_HostAccount.HostAccountID

  • login_name (str) – str Q2_UserLogon.LoginName