TIP Base Models
- class q2_sdk.models.tip.schemas.base.TIPModel[source]
TIPModel()
- DesiredTipType = ~DesiredTipType
- ParserType = ~ParserType
- static try_getattr_from_elem(obj_elem, attr)[source]
Safely get an attribute from an etree Element, raising TIPModelParsingException if not found.
- Parameters:
obj_elem (
Element) – The etree Element to get the attribute fromattr (
str) – The attribute name to retrieve
- Returns:
The attribute value
- Raises:
TIPModelParsingException – If the attribute is not found
- static parse_optional(elem, parser_func)[source]
Generic method to parse optional fields with any parser function.
- static parse_datetime(elem)[source]
Convert a date string from elem.text that should be in iso format to datetime object.
- static parse_int_id_optional(elem)[source]
Parse optional int id field. In TIP Models, we have some ID fields which are optional. In our stored procedures, if a field is NULL, its xml node is not included in the xml request body. To make the NULL more explicit, we set this value to -1. But here we want to set this -1 to None to be more clear to users of TIP that the value is missing.
- validate()[source]
registers all validation checks, ensures all succeed
- Return type:
- Returns:
None
- Raises:
TIPModelValidationException – If any validation checks fail.
- validate_type(f, field_val, field_types, is_optional, validation_errors, parent_field_str)[source]
Validate a single field’s type against expected types.
- Parameters:
f (
Field) – The dataclass field being validatedfield_val (
Any) – The value of the fieldfield_types (
Set[type]) – Set of expected types for the fieldis_optional (
bool) – Whether the field is optional (can be None)validation_errors (
List[str]) – List to append validation errors toparent_field_str (
str) – String prefix for nested field names
- Return type:
- Returns:
None
- validate_types(validation_errors=None, parent_field='')[source]
Validate all field types in this model.
- abstract classmethod model_validate_from_elem(data)[source]
Abstract method for converting lxml objectify data to TIPModel
- Return type:
- class q2_sdk.models.tip.schemas.base.TIPRequest(customer_key, event_user_id, session_id, ui_source, transaction_id, audit_id, event_date_time, customer_id, group_id, transaction_type, gt_type_short_name, transaction_type_version, create_date, transaction_amount, login_audit_id, user_logon_id, created_user_id, authorized_user_id, modified_user_id)[source]
Data class that contains fields that are shared across transaction types and should be included in all TIP requests.
-
transaction_type:
TransactionTypeEnum
-
transaction_type:
- class q2_sdk.models.tip.schemas.base.TIPResponse(status, version=TIPResponseVersion.V0, tracking_id=None, transaction_id=None, error_type='Success', error_code='0', error_description='')[source]
Data class used to build the TIP response XML returned to HQ
-
status:
TIPStatus
-
version:
TIPResponseVersion= '0'
- to_xml()[source]
Convert this TIPResponse to XML formatted string.
- Return type:
- Returns:
XML string representation of the response
- classmethod from_exception(error_description, version=TIPResponseVersion.V0, tracking_id=None, transaction_id=None)[source]
Converts an error description along with other optional parameters to a TIPResponse
- Parameters:
- Return type:
-
status:
- q2_sdk.models.tip.schemas.base.get_execute_request_as_xml_response_from_tip_response(root_node, xml_str, attrs)[source]
Builds a soap envelope to respond to an “ExecuteRequestAsXML” request from HQ
- Parameters:
root_node (
str) – Request nodename provided by HQform_data – Response data
attrs (
dict) – Attributes to add to the interior Data node, passed through to HQhq_commands – (Optional) Instance of
HqCommandsto send additional commands with the response
- Return type: