BackOffice Calls

Using a BackOffice method is a little different than one from Q2Api or WedgeOnlineBanking. These methods are used by platform administrators, and require a higher level of hq credentials in the form of a CSR login and password that have permissions to log into Q2 Central. In order to execute a BackOffice method, CSR credentials are used to login to Central to establish a session, then use the active session to execute the specific method. This can all be accomplished by calling get_backoffice_credentials on your self.hq_credentials object:

from q2_sdk.hq.hq_api.backoffice import DecideSuspectGt

back_office_credentials = self.hq_credentials.get_backoffice_credentials(
    self.logger,
    'user_name',
    'user_pwd'
)
params = DecideSuspectGt.ParamsObj(
    self.logger,
    back_office_credentials,
    1,
    1,
    "This is a test",
    False,
)
suspect_results = await DecideSuspectGt.execute(params)

If this BackOffice method is being used in a Central extension, then you can use the existing hq_credentials in the ParamsObj.

from q2_sdk.hq.hq_api.backoffice import DecideSuspectGt

params = DecideSuspectGt.ParamsObj(
    self.logger,
    self.hq_credentials,
    1,
    1,
    "This is a test",
    False,
)
suspect_results = await DecideSuspectGt.execute(params)