Customer
- class q2_sdk.hq.db.customer.DeleteCustomerResponse(success, error_message)[source]
Bases:
object
DeleteCustomerResponse(success: bool, error_message: None)
-
success:
bool
-
error_message:
None
-
success:
- class q2_sdk.hq.db.customer.GetCustomerParams(customer_id=None, login_name=None, tax_id=None, primary_cif=None, zone_id=None, combine=False)[source]
Bases:
object
GetCustomerParams(customer_id: Optional[int] = None, login_name: Optional[str] = None, tax_id: Optional[str] = None, primary_cif: Optional[str] = None, zone_id: Optional[int] = None, combine: Optional[bool] = False)
-
customer_id:
Optional
[int
] = None
-
login_name:
Optional
[str
] = None
-
tax_id:
Optional
[str
] = None
-
primary_cif:
Optional
[str
] = None
-
zone_id:
Optional
[int
] = None
-
combine:
Optional
[bool
] = False
-
customer_id:
- class q2_sdk.hq.db.customer.UpdateCustomerValues(customer_id, customer_name=None, tax_id=None, primary_cif=None, is_company=None, charge_account=None, charge_account_valid=True)[source]
Bases:
object
UpdateCustomerValues(customer_id: int, customer_name: Optional[str] = None, tax_id: Optional[str] = None, primary_cif: Optional[str] = None, is_company: Optional[bool] = None, charge_account: Optional[int] = None, charge_account_valid: bool = True)
-
customer_id:
int
-
customer_name:
Optional
[str
] = None
-
tax_id:
Optional
[str
] = None
-
primary_cif:
Optional
[str
] = None
-
is_company:
Optional
[bool
] = None
-
charge_account:
Optional
[int
] = None
-
charge_account_valid:
bool
= True
-
customer_id:
- class q2_sdk.hq.db.customer.SearchCustomerValues(customername=None, taxid=None, primarycif=None)[source]
Bases:
object
SearchCustomerValues(customername: Optional[str] = None, taxid: Optional[str] = None, primarycif: Optional[str] = None)
-
customername:
Optional
[str
] = None
-
taxid:
Optional
[str
] = None
-
primarycif:
Optional
[str
] = None
-
customername:
- class q2_sdk.hq.db.customer.SearchCustomerResponse(success, result=None, error_message=None)[source]
Bases:
object
SearchCustomerResponse(success: bool, result: Optional[list] = None, error_message: Optional[str] = None)
-
success:
bool
-
result:
Optional
[list
] = None
-
error_message:
Optional
[str
] = None
-
success:
- exception q2_sdk.hq.db.customer.GroupMoverResponse(customer_ids, success, reason='', omitted=False)[source]
Bases:
Exception
- class q2_sdk.hq.db.customer.CustomerRow[source]
Bases:
RepresentationRowBase
-
CustomerID:
IntElement
= 'CustomerID'
-
CustomerName:
StringElement
= 'CustomerName'
-
TaxID:
StringElement
= 'TaxID'
-
IsCompany:
BoolElement
= 'IsCompany'
-
ServiceChargePlanID:
IntElement
= 'ServiceChargePlanID'
-
ChargeAccount:
IntElement
= 'ChargeAccount'
-
CreateDate:
StringElement
= 'CreateDate'
-
DefaultAddressID:
IntElement
= 'DefaultAddressID'
-
AutoGenerated:
BoolElement
= 'AutoGenerated'
-
DeletedDate:
StringElement
= 'DeletedDate'
-
GroupID:
IntElement
= 'GroupID'
-
ChargePlanStartDate:
StringElement
= 'ChargePlanStartDate'
-
CustInfo:
StringElement
= 'CustInfo'
-
PrimaryCIF:
StringElement
= 'PrimaryCIF'
-
PolicyID:
IntElement
= 'PolicyID'
-
CompanyPolicyID:
IntElement
= 'CompanyPolicyID'
-
HostUser:
StringElement
= 'HostUser'
-
HostPwd:
StringElement
= 'HostPwd'
-
CustomerID:
- class q2_sdk.hq.db.customer.GeneratedTransactionsPending[source]
Bases:
RepresentationRowBase
-
CustomerID:
IntElement
= 'CustomerID'
-
TransactionID:
IntElement
= 'TransactionID'
-
TransactionStatus:
StringElement
= 'TransactionStatus'
-
TransactionType:
StringElement
= 'TransactionType'
-
Description:
StringElement
= 'Description'
-
CustomerID:
- class q2_sdk.hq.db.customer.Customer(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 ifFalse
or TableRow objects from DB calls ifTrue
(Defaults to settings file)
- REPRESENTATION_ROW_CLASS
alias of
CustomerRow
- async get_deleted(deleted_after, serialize_for_cli=False, extended=False)[source]
- Return type:
List
[CustomerRow
]
- async get(customer_id=None, login_name=None, tax_id=None, primary_cif=None, zone_id=None, extended=False, combine=False, serialize_for_cli=False)[source]
- Return type:
List
[CustomerRow
]
- async get_many(customer_ids)[source]
Retrieves multiple customers based on provided IDs
- Parameters:
customer_ids (
list
[int
]) – list of Q2_Customer.CustomerID to retrieve- Return type:
list
[CustomerRow
]
- async get_pending_by_customer(customer_id_list, omit_transaction_type_ids=None)[source]
- Return type:
- async move_many_to_group(customer_ids, new_group_id, omit_pending=False)[source]
Allows for multiple customers to be moved to a different group. Moving customers are done in batches, and if a customer in a batch fails for some reason, the whole batch fails. Each batch will have a response object. If customers are omitted due to pending transactions (omit_pending=True), a response object will also be returned with any omissions.
There are some caveats to be aware of when using this method:
Moving to or from Commercial (Treasury) groups is not allowed
Moving customers to different zones is not allowed
If a customer has pending transactions, the code will attempt to check the limits of the new group. If the new groups transaction limits are lower than the current group, the move will fail and the pending transaction will need to be addressed before the move can be attempted again.
Will return a list of GroupMoverResponse objects
- Parameters:
customer_ids (
list
[int
]) – list of Q2_Customer.CustomerID to be movednew_group_id (
int
) – Q2_Group.GroupID to move toserialize_for_cli – Used when running from the command line
omit_pending – Omit customer ids from move process if they have pending transactions that may violate limits of target group
- Return type:
list
[GroupMoverResponse
]
- async move_group(customer_id, new_group_id, serialize_for_cli=False)[source]
Move a customer to another group.
There are some caveats to be aware of when using this method:
Moving to or from Commercial (Treasury) groups is not allowed
Moving customers to different zones is not allowed
If a customer has pending transactions, the code will attempt to check the limits of the new group. If the new groups transaction limits are lower than the current group, the move will fail and the pending transaction will need to be addressed before the move can be attempted again.
If successful, will return the same customer id If unsuccessful, will raise a DatabaseDataError.
- Parameters:
customer_id (
int
) – Q2_Customer.CustomerID to be movednew_group_id (
int
) – Q2_Group.GroupID to move toserialize_for_cli – Used when running from the command line
- Return type:
int
- async update(customer_id, customer_name=None, tax_id=None, primary_cif=None, is_company=None, charge_account=None)[source]
- async search_by_create_date(created_after, serialize_for_cli=False, extended=False, group_id=None, filter_out_deleted=False, page_number=None, page_size=None)[source]
- Return type:
List
[CustomerRow
]
- async search(customer_name='', tax_id='', primary_cif='', serialize_for_cli=False, extended=False)[source]
- async update_customer_address(customer_id, address)[source]
- Parameters:
customer_id (
int
) – the CustomerID of the customer you would like to updateaddress (
Address
) – the address object containing the customer’s new address information
:return
MessageCount
field. If value returned is1
, update was successful