Source code for q2_sdk.hq.hq_api.q2_api.GetPolicyDataByPolicyIdentifier

# This is an autogenerated file from the command "q2 generate_hq_api" and will be overwritten if run again

"""


Sample response (may differ slightly in your environment)

.. code-block:: xml

    <Q2API HqVersion="4.5.0.6095" HqAssemblyVersion="4.5.0.0" ServerDateTime="2024-03-06T12:13:20.9424833-06:00" AuditId="13628735">
    <Result>
        <ErrorCode ErrorType="Success">0</ErrorCode>
        <ErrorDescription />
        <HydraErrorReturnCode>0</HydraErrorReturnCode>
    </Result>
    <Data>
        <PolicyData>
            <Q2_PolicyGeneratedTransactionRights>
                <PolicyIdentifier>G-1</PolicyIdentifier>
                <TransactionTypeID>1</TransactionTypeID>
                <ShortName>AchBatch</ShortName>
                <GroupID>1</GroupID>
                <Enabled>false</Enabled>
                <Authorize>false</Authorize>
                <Cancel>false</Cancel>
                <Create>false</Create>
                <CreateRestricted>false</CreateRestricted>
                <Update>false</Update>
                <View>1</View>
                <LimitPerTransaction>0.0000</LimitPerTransaction>
                <LimitPerDay>0.0000</LimitPerDay>
                <LimitPerMonth>0.0000</LimitPerMonth>
                <LimitPerAcctPerDay>0.0000</LimitPerAcctPerDay>
                <CountPerDay>0</CountPerDay>
                <CountPerMonth>0</CountPerMonth>
                <CountPerAcctPerDay>0</CountPerAcctPerDay>
                <DualApprovalLimit>-1.0000</DualApprovalLimit>
                <TokenRequiredLimit>-1.0000</TokenRequiredLimit>
                <DraftLimit>0.0000</DraftLimit>
            </Q2_PolicyGeneratedTransactionRights>
            <Q2_PolicySubsidiaries>
                <PolicyIdentifier>U-3</PolicyIdentifier>
                <SubsidiaryID>0</SubsidiaryID>
                <Name>SDX Test user</Name>
            </Q2_PolicySubsidiaries>
            <Q2_PolicyData>
                <PolicyIdentifier>G-1</PolicyIdentifier>
                <PolicyDataType>Group</PolicyDataType>
                <PolicyTypeId>1</PolicyTypeId>
                <Description>Retail Users</Description>
                <HasPendingChange>false</HasPendingChange>
                <Enabled>true</Enabled>
                <IsTreasury>false</IsTreasury>
                <IsTemplate>false</IsTemplate>
                <IsOpenBanking>false</IsOpenBanking>
            </Q2_PolicyData>
            <Q2_PolicyAccounts>
                <PolicyIdentifier>U-3</PolicyIdentifier>
                <CustomerAccountID>2</CustomerAccountID>
                <HostAccountID>5060</HostAccountID>
                <CustomerAccess>7</CustomerAccess>
                <PolicyReferenceID>2</PolicyReferenceID>
                <PolicyAccess>7</PolicyAccess>
                <AccountNumberInternal>S00</AccountNumberInternal>
                <AccountNumberExternal>XXXXXX0S00</AccountNumberExternal>
                <AccountDesc />
                <StatusDescription>Account Open</StatusDescription>
                <ProductTypeName>Q2 Checking</ProductTypeName>
                <ProductName>Q2 BASIC CHECKING</ProductName>
                <ABA />
                <IsExternalAccount>false</IsExternalAccount>
                <ProductTypeID>5</ProductTypeID>
                <ProductID>16</ProductID>
            </Q2_PolicyAccounts>
            <Q2_PolicyFeatures>
                <PolicyIdentifier>G-1</PolicyIdentifier>
                <GroupID>1</GroupID>
                <PropertyID>476</PropertyID>
                <Enabled>false</Enabled>
                <PropertyName>Customer/PfmAccountAggregation</PropertyName>
                <CategoryShortName>PFM</CategoryShortName>
                <CategoryDescription>PFM</CategoryDescription>
                <AllowView>true</AllowView>
                <AllowEdit>true</AllowEdit>
            </Q2_PolicyFeatures>
            </PolicyData>
    </Data>
    </Q2API>

"""

from dataclasses import dataclass

from typing import List, Optional, Union


from lxml.objectify import FloatElement, StringElement, IntElement, BoolElement

from q2_sdk.core.q2_logging.logger import Q2LoggerType
from q2_sdk.hq.models.hq_response import HqResponse
from q2_sdk.hq.models.hq_credentials import HqCredentials

from q2_sdk.hq.models.hq_params.q2_api import Q2ApiParamsObj
from q2_sdk.hq.models.hq_request.q2_api import Q2ApiRequest


[docs] class ParamsObj(Q2ApiParamsObj): """Parameters definition for GetPolicyDataByPolicyIdentifier""" def __init__( self, logger: Q2LoggerType, policy_identifier: str, get_parent_policies: bool, hq_credentials: Optional[HqCredentials] = None, ): """ :param logger: Reference to calling request's logger (self.logger in your extension) :param policy_identifier: :param get_parent_policies: :param hq_credentials: Defaults to settings.HQ_CREDENTIALS """ super().__init__(logger, hq_credentials) self.request_params.update({ "PolicyIdentifier": policy_identifier, "GetParentPolicies": get_parent_policies, })
[docs] @dataclass class Q2_PolicyFeatures: AllowEdit: BoolElement AllowView: BoolElement CategoryDescription: StringElement CategoryShortName: StringElement Enabled: BoolElement GroupID: IntElement PolicyIdentifier: StringElement PropertyID: IntElement PropertyName: StringElement
[docs] @dataclass class Q2_PolicyAccounts: ABA: StringElement AccountDesc: StringElement AccountNumberExternal: StringElement AccountNumberInternal: StringElement CustomerAccess: IntElement CustomerAccountID: IntElement HostAccountID: IntElement IsExternalAccount: BoolElement PolicyAccess: IntElement PolicyIdentifier: StringElement PolicyReferenceID: IntElement ProductID: IntElement ProductName: StringElement ProductTypeID: IntElement ProductTypeName: StringElement StatusDescription: StringElement
[docs] @dataclass class Q2_PolicyData: Description: StringElement Enabled: BoolElement HasPendingChange: BoolElement IsOpenBanking: BoolElement IsTemplate: BoolElement IsTreasury: BoolElement PolicyDataType: StringElement PolicyIdentifier: StringElement PolicyTypeId: IntElement
[docs] @dataclass class Q2_PolicySubsidiaries: Name: StringElement PolicyIdentifier: StringElement SubsidiaryID: IntElement
[docs] @dataclass class Q2_PolicyGeneratedTransactionRights: Authorize: BoolElement Cancel: BoolElement CountPerAcctPerDay: IntElement CountPerDay: IntElement CountPerMonth: IntElement Create: BoolElement CreateRestricted: BoolElement DraftLimit: FloatElement DualApprovalLimit: FloatElement Enabled: BoolElement GroupID: IntElement LimitPerAcctPerDay: FloatElement LimitPerDay: FloatElement LimitPerMonth: FloatElement LimitPerTransaction: FloatElement PolicyIdentifier: StringElement ShortName: StringElement TokenRequiredLimit: FloatElement TransactionTypeID: IntElement Update: BoolElement View: IntElement
[docs] @dataclass class PolicyData: Q2_PolicyAccounts: Union[Q2_PolicyAccounts, List[Q2_PolicyAccounts]] Q2_PolicyData: Union[Q2_PolicyData, List[Q2_PolicyData]] Q2_PolicyFeatures: Union[Q2_PolicyFeatures, List[Q2_PolicyFeatures]] Q2_PolicyGeneratedTransactionRights: Union[ Q2_PolicyGeneratedTransactionRights, List[Q2_PolicyGeneratedTransactionRights] ] Q2_PolicySubsidiaries: Union[Q2_PolicySubsidiaries, List[Q2_PolicySubsidiaries]]
[docs] @dataclass class Data: PolicyData: Union[PolicyData, List[PolicyData]]
[docs] class ResultNode: def __init__(self): self.Data = Data()
[docs] class HqResponse(HqResponse): def __init__(self, raw_response: Union[str, dict]): super().__init__(raw_response) self.result_node: ResultNode = None
[docs] async def execute(params_obj: ParamsObj, use_json=False, **kwargs) -> HqResponse: """ This is the default way to submit the request to HQ. In theory, both json and soap payloads are equally accepted by HQ, though several variables may affect that (HQ version, Q2SDK implementation bugs, etc). This should not affect anything about the way your code deals with the data. In fact, the only difference to consuming extensions is the logging. Basically, call this with default parameters unless you find a compelling reason not to. :param params_obj: Object containing everything necessary to call this HQ endpoint :param use_json: If True, will call HQ's .ashx (json) endpoint instead of .asmx (soap) """ request = Q2ApiRequest( "GetPolicyDataByPolicyIdentifier", use_json=use_json, **kwargs ) return await request.execute(params_obj, **kwargs)
[docs] async def get_soap(params_obj: ParamsObj, **kwargs) -> HqResponse: """Deprecated. Please use execute instead""" params_obj.logger.warning( "GetPolicyDataByPolicyIdentifier.get_soap is deprecated. Please use GetPolicyDataByPolicyIdentifier.execute instead." ) return await execute(params_obj, **kwargs)
[docs] async def get_json(params_obj: ParamsObj, **kwargs) -> HqResponse: """Deprecated. Please use execute instead""" params_obj.logger.warning( "GetPolicyDataByPolicyIdentifier.get_json is deprecated. Please use GetPolicyDataByPolicyIdentifier.execute instead." ) return await execute(params_obj, use_json=True, **kwargs)
[docs] def build_json(params_obj: ParamsObj): return Q2ApiRequest.build_json(params_obj)
[docs] def build_soap(params_obj: ParamsObj): return Q2ApiRequest("GetPolicyDataByPolicyIdentifier", use_json=False).build_soap( params_obj )