cic-stack/apps/cic-ussd/cic_ussd/state_machine/logic/sms.py

29 lines
1.2 KiB
Python
Raw Normal View History

2021-02-06 16:13:47 +01:00
# standard imports
from typing import Tuple
2021-08-06 18:29:01 +02:00
# external imports
from sqlalchemy.orm.session import Session
2021-02-06 16:13:47 +01:00
# local imports
2021-08-06 18:29:01 +02:00
from cic_ussd.account.metadata import get_cached_preferred_language
2021-11-29 16:04:50 +01:00
from cic_ussd.account.tokens import get_active_token_symbol
2021-04-19 10:44:40 +02:00
from cic_ussd.db.models.account import Account
2021-08-06 18:29:01 +02:00
from cic_ussd.notifications import Notifier
from cic_ussd.phone_number import Support
def upsell_unregistered_recipient(state_machine_data: Tuple[str, dict, Account, Session]):
""""""
user_input, ussd_session, account, session = state_machine_data
notifier = Notifier()
phone_number = ussd_session.get('data')['recipient_phone_number']
preferred_language = get_cached_preferred_language(account.blockchain_address)
2021-11-29 16:04:50 +01:00
token_symbol = get_active_token_symbol(account.blockchain_address)
2021-08-06 18:29:01 +02:00
tx_sender_information = account.standard_metadata_id()
notifier.send_sms_notification('sms.upsell_unregistered_recipient',
phone_number,
preferred_language,
tx_sender_information=tx_sender_information,
token_symbol=token_symbol,
support_phone=Support.phone_number)