EnrolledEntity
- exception q2_sdk.hq.db.enrolled_entity.EnrollmentException(message, number, detail)[source]
Bases:
ExceptionEnrollment Exception handling class
- exception q2_sdk.hq.db.enrolled_entity.CustomerExistsError(message, number, detail)[source]
Bases:
EnrollmentExceptionCustomer already exists in Q2’s database
- exception q2_sdk.hq.db.enrolled_entity.UserExistsError(message, number, detail)[source]
Bases:
EnrollmentExceptionUser already exists in Q2’s database
- exception q2_sdk.hq.db.enrolled_entity.LoginNameExistsError(message, number, detail)[source]
Bases:
EnrollmentExceptionLogin Name already exists in Q2’s database
- class q2_sdk.hq.db.enrolled_entity.CreateCustomerParams(cust_info, group_id, is_company, host_user, host_pwd)[source]
Bases:
objectParameters needed to create a customer Note: grab_customer_data can be utilized to build the cust_info parameter
- cust_info: DemographicInfo
- group_id: int
- is_company: bool
- host_user: str
- host_pwd: str
- class q2_sdk.hq.db.enrolled_entity.CreateCustomerResult(success=False, reason=None, customer_id=None)[source]
Bases:
objectExpected response object for create customer function
- success: bool = False
- reason: str | None = None
- customer_id: str | None = None
- class q2_sdk.hq.db.enrolled_entity.CreateCustomerDataParams(customer_id, name, value)[source]
Bases:
objectParameters needed to create customer data
- customer_id: int
- name: str
- value: str
- class q2_sdk.hq.db.enrolled_entity.CreateUserParams(user_info, customer_id, host_user, host_pwd, null_primary_cif=False)[source]
Bases:
objectParameters needed to create a user
- user_info: DemographicInfo
- customer_id: int
- host_user: str
- host_pwd: str
- null_primary_cif: bool = False
- class q2_sdk.hq.db.enrolled_entity.CreateUserResult(success=False, reason=None, user_id=None)[source]
Bases:
objectExpected response object for create user function
- success: bool = False
- reason: str | None = None
- user_id: str | None = None
- class q2_sdk.hq.db.enrolled_entity.CreateUserLogonParams(user_id, logon_name, user_logon_obj, password=None, require_password_reset=True, group_id_for_zone_check=None)[source]
Bases:
objectParameters needed to create a logon
- user_id: int
- logon_name: str
- password: str | None = None
- require_password_reset: bool = True
- group_id_for_zone_check: int | None = None
- class q2_sdk.hq.db.enrolled_entity.CreateUserLogonResponse(logon_error='', password='', user_logon_id=None)[source]
Bases:
objectExpected response object for create user logon function
- logon_error: str = ''
- password: str = ''
- user_logon_id: int | None = None
- class q2_sdk.hq.db.enrolled_entity.GrabCustomerDataParams(customer_dict, user_dict, user_demographic_obj=None)[source]
Bases:
objectParameters needed to create a customer demographic info object
- customer_dict: dict
- user_dict: dict
- user_demographic_obj: UserDemographicData | None = None
- class q2_sdk.hq.db.enrolled_entity.GetPhoneParams(customer_dict, user_dict, user_demographic_obj=None)[source]
Bases:
objectParameters needed to retrieve and validate phone information from a customer and user dictionary
- customer_dict: dict
- user_dict: dict
- user_demographic_obj: UserDemographicData | None = None
- class q2_sdk.hq.db.enrolled_entity.CheckForExistingParams(login_name, primary_cif='', ssn='', tax_id='', skip_customer_tax_check=False, skip_customer_cif_check=False, skip_user_check=False, skip_existing_customer_check=False, group_id=None)[source]
Bases:
objectParameters needed to check if customer, user, or logon exists
- login_name: str
- primary_cif: str = ''
- ssn: str = ''
- tax_id: str = ''
- skip_customer_tax_check: bool = False
- skip_customer_cif_check: bool = False
- skip_user_check: bool = False
- skip_existing_customer_check: bool = False
- group_id: int | None = None
- class q2_sdk.hq.db.enrolled_entity.UserDemoObjectValues(additional_user_info, emails, phone_numbers, addresses, ssn, primary_cif, dob=None, email_is_sac_target=None, email_objects=None)[source]
Bases:
objectParameters needed to create user demographic object
- additional_user_info: dict
- emails: list
- ssn: int
- primary_cif: int
- dob: datetime | None = None
- email_is_sac_target: bool | None = None
- class q2_sdk.hq.db.enrolled_entity.LinkAccountsViaCifParams(primary_only, primary_cif, customer_id, user_id)[source]
Bases:
objectParameters needed to link accounts via primary cif
- primary_only: bool
- primary_cif: str
- customer_id: int
- user_id: int
- class q2_sdk.hq.db.enrolled_entity.SsoIdentifierResponse(duplicate_exists=False, sso_result_error=False)[source]
Bases:
objectExpected response object for sso enrollment function
- duplicate_exists: bool = False
- sso_result_error: bool = False
- class q2_sdk.hq.db.enrolled_entity.EnrolledEntity(logger, hq_credentials=None, ret_table_obj=None)[source]
Bases:
DbObjectAllows you to create a customer, user and logon in the Q2 Platform. Additional methods have been provided to assist you with the enrollment process
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 ifFalseor TableRow objects from DB calls ifTrue(Defaults to settings file)
- NAME = 'EnrolledEntity'
- async create_customer_data(params)[source]
Sets CustomerData in our DB to the key|value pairs passed in in the format [{“Name”:”DataName”, “Value”: “DataValue”}]
- async create_user_data(userdata, user_id)[source]
Sets UserData in our DB to the key|value pairs passed in in the format {“key”:”value”}
- async create_user_logon(params)[source]
Creates a UserLogon in Q2 db and returns the password
- Return type:
- async enroll_sso_identifier(user_logon_id, sso_identifier)[source]
Enrolling sso information given an sso identifier and logon id
- Return type:
- async check_disclaimers(disclaimers_info, user_id)[source]
Marking disclaimer as accepted. Prevents the user from having to accept them on first login
- Return type:
bool
- async check_db_for_existing(params)[source]
If Customer, User, or UserLogon already exists, raise an exception. Otherwise, just return None
- build_user_demo_object(user_values)[source]
Creating Demographic Info object for User. Needed to created user
- Return type:
- async grab_customer_data(params, cache=None)[source]
Creating Demographic Info object for Customer. Required to created Customer Note: invalid phone information also gets returned
- Return type:
tuple[list,DemographicInfo]
- async get_customer_phones(params, cache=None)[source]
Retrieving phone information for the customer object. Note: This function first searches for customer phone information. If not found, any user phone information provided will be used to populate the customer object
- Return type:
tuple[list[str],list[Phone]]
- async get_user_phones(params, cache=None)[source]
Retrieving phone information for the user object. Note: This function first searches for user phone information. If not found, any customer phone information provided will be used to populate the user object
- Return type:
tuple[list[str],list[Phone]]
- async link_accounts_via_cif(params)[source]
Linking accounts associated to the created customer/user using given primary cif value
- Return type:
bool