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

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

"""
Send an email, sms or voice call with optional email html body with NotificationFlavor
"""

from typing import List, Optional

from lxml import etree


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.base import BaseParameter


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


[docs] class NotificationFlavor: DateAlert = "DateAlert" HadeCurrencyAlert = "HadeCurrencyAlert" PostedTransactionAlert = "PostedTransactionAlert" NsfTransactionAlert = "NsfTransactionAlert" OnlineActivityAlert = "OnlineActivityAlert" GtAuthorizationAlert = "GtAuthorizationAlert" AchPayee = "AchPayee" DomesticWirePayee = "DomesticWirePayee" InternationalWirePayee = "InternationalWirePayee" PasswordResetTac = "PasswordResetTac" LoginTac = "LoginTac" AuthAccessCode = "AuthAccessCode" MobileAuthorization = "MobileAuthorization" MobileBankingUrl = "MobileBankingUrl" CsrAlert = "CsrAlert" SecurityAlert = "SecurityAlert" EStatementOptIn = "EStatementOptIn" EStatementOptOut = "EStatementOptOut" NewGroupMessage = "NewGroupMessage" ExternalTransactionAlert = "ExternalTransactionAlert" HadeCurrencyNotificationAlert = "HadeCurrencyNotificationAlert" EdvTac = "EdvTac" SecureMessagePushAlert = "SecureMessagePushAlert" UserVerification = "UserVerification"
[docs] class ParamsObj(Q2ApiParamsObj): """Parameters definition for SendNotification3WithHtml""" def __init__( self, logger: Q2LoggerType, notification_type: str, target_address: str, subject: str, text_body: str, target_country_iso_code_a3: str, html_body: str, add_html_header_and_footer: bool, add_disclaimer: bool, ui_short_name: str, notification_flavor: NotificationFlavor, hq_credentials: Optional[HqCredentials] = None, ): """ :param logger: Reference to calling request's logger (self.logger in your extension) :param notification_type: Corresponds to the Q2_NotificationType table (relevant options are sms/email) :param target_address: :param subject: :param text_body: :param target_country_iso_code_a3: :param html_body: :param add_html_header_and_footer: :param add_disclaimer: :param ui_short_name: Corresponds to ShortName column in the Q2_UiSelection table. Should almost always be "Q2" :param notification_flavor: Must be either None or an option listed in Q2_NotificationFlavor table :param hq_credentials: Defaults to settings.HQ_CREDENTIALS """ super().__init__(logger, hq_credentials) self.request_params.update({ "NotificationType": notification_type, "TargetAddress": target_address, "Subject": subject, "TextBody": text_body, "TargetCountryIsoCodeA3": target_country_iso_code_a3, "HtmlBody": html_body, "AddHtmlHeaderAndFooter": add_html_header_and_footer, "AddDisclaimer": add_disclaimer, "UiShortName": ui_short_name, "NotificationFlavor": notification_flavor, })
[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("SendNotification3WithHtml", 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( "SendNotification3WithHtml.get_soap is deprecated. Please use SendNotification3WithHtml.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( "SendNotification3WithHtml.get_json is deprecated. Please use SendNotification3WithHtml.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("SendNotification3WithHtml", use_json=False).build_soap( params_obj )