Philip/add support phone number
This commit is contained in:
parent
d0f2bc0120
commit
0da617d29e
@ -5,6 +5,7 @@ LOCALE_PATH=/usr/src/cic-ussd/var/lib/locale/
|
|||||||
MAX_BODY_LENGTH=1024
|
MAX_BODY_LENGTH=1024
|
||||||
PASSWORD_PEPPER=QYbzKff6NhiQzY3ygl2BkiKOpER8RE/Upqs/5aZWW+I=
|
PASSWORD_PEPPER=QYbzKff6NhiQzY3ygl2BkiKOpER8RE/Upqs/5aZWW+I=
|
||||||
SERVICE_CODE=*483*46#,*483*061#,*384*96#
|
SERVICE_CODE=*483*46#,*483*061#,*384*96#
|
||||||
|
SUPPORT_PHONE_NUMBER=0757628885
|
||||||
|
|
||||||
[phone_number]
|
[phone_number]
|
||||||
REGION=KE
|
REGION=KE
|
||||||
|
@ -5,6 +5,7 @@ LOCALE_PATH=var/lib/locale/
|
|||||||
MAX_BODY_LENGTH=1024
|
MAX_BODY_LENGTH=1024
|
||||||
PASSWORD_PEPPER=QYbzKff6NhiQzY3ygl2BkiKOpER8RE/Upqs/5aZWW+I=
|
PASSWORD_PEPPER=QYbzKff6NhiQzY3ygl2BkiKOpER8RE/Upqs/5aZWW+I=
|
||||||
SERVICE_CODE=*483*46#
|
SERVICE_CODE=*483*46#
|
||||||
|
SUPPORT_PHONE_NUMBER=0757628885
|
||||||
|
|
||||||
[ussd]
|
[ussd]
|
||||||
MENU_FILE=/usr/local/lib/python3.8/site-packages/cic_ussd/db/ussd_menu.json
|
MENU_FILE=/usr/local/lib/python3.8/site-packages/cic_ussd/db/ussd_menu.json
|
||||||
|
@ -41,3 +41,7 @@ def get_user_by_phone_number(phone_number: str) -> Optional[Account]:
|
|||||||
phone_number = process_phone_number(phone_number=phone_number, region='KE')
|
phone_number = process_phone_number(phone_number=phone_number, region='KE')
|
||||||
user = Account.session.query(Account).filter_by(phone_number=phone_number).first()
|
user = Account.session.query(Account).filter_by(phone_number=phone_number).first()
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
|
class Support:
|
||||||
|
phone_number = None
|
||||||
|
@ -19,7 +19,7 @@ from cic_ussd.db.models.ussd_session import UssdSession
|
|||||||
from cic_ussd.error import MetadataNotFoundError, SeppukuError
|
from cic_ussd.error import MetadataNotFoundError, SeppukuError
|
||||||
from cic_ussd.menu.ussd_menu import UssdMenu
|
from cic_ussd.menu.ussd_menu import UssdMenu
|
||||||
from cic_ussd.metadata import blockchain_address_to_metadata_pointer
|
from cic_ussd.metadata import blockchain_address_to_metadata_pointer
|
||||||
from cic_ussd.phone_number import get_user_by_phone_number
|
from cic_ussd.phone_number import get_user_by_phone_number, Support
|
||||||
from cic_ussd.redis import cache_data, create_cached_data_key, get_cached_data
|
from cic_ussd.redis import cache_data, create_cached_data_key, get_cached_data
|
||||||
from cic_ussd.state_machine import UssdStateMachine
|
from cic_ussd.state_machine import UssdStateMachine
|
||||||
from cic_ussd.conversions import to_wei, from_wei
|
from cic_ussd.conversions import to_wei, from_wei
|
||||||
@ -466,6 +466,14 @@ def next_state(ussd_session: dict, user: Account, user_input: str) -> str:
|
|||||||
return new_state
|
return new_state
|
||||||
|
|
||||||
|
|
||||||
|
def process_exit_invalid_menu_option(display_key: str, preferred_language: str):
|
||||||
|
return translation_for(
|
||||||
|
key=display_key,
|
||||||
|
preferred_language=preferred_language,
|
||||||
|
support_phone=Support.phone_number
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def custom_display_text(
|
def custom_display_text(
|
||||||
display_key: str,
|
display_key: str,
|
||||||
menu_name: str,
|
menu_name: str,
|
||||||
@ -502,5 +510,7 @@ def custom_display_text(
|
|||||||
return process_account_statement(display_key=display_key, user=user, ussd_session=ussd_session)
|
return process_account_statement(display_key=display_key, user=user, ussd_session=ussd_session)
|
||||||
elif menu_name == 'display_user_metadata':
|
elif menu_name == 'display_user_metadata':
|
||||||
return process_display_user_metadata(display_key=display_key, user=user)
|
return process_display_user_metadata(display_key=display_key, user=user)
|
||||||
|
elif menu_name == 'exit_invalid_menu_option':
|
||||||
|
return process_exit_invalid_menu_option(display_key=display_key, preferred_language=user.preferred_language)
|
||||||
else:
|
else:
|
||||||
return translation_for(key=display_key, preferred_language=user.preferred_language)
|
return translation_for(key=display_key, preferred_language=user.preferred_language)
|
||||||
|
@ -26,7 +26,7 @@ from cic_ussd.metadata.base import Metadata
|
|||||||
from cic_ussd.operations import (define_response_with_content,
|
from cic_ussd.operations import (define_response_with_content,
|
||||||
process_menu_interaction_requests,
|
process_menu_interaction_requests,
|
||||||
define_multilingual_responses)
|
define_multilingual_responses)
|
||||||
from cic_ussd.phone_number import process_phone_number
|
from cic_ussd.phone_number import process_phone_number, Support
|
||||||
from cic_ussd.processor import get_default_token_data
|
from cic_ussd.processor import get_default_token_data
|
||||||
from cic_ussd.redis import cache_data, create_cached_data_key, InMemoryStore
|
from cic_ussd.redis import cache_data, create_cached_data_key, InMemoryStore
|
||||||
from cic_ussd.requests import (get_request_endpoint,
|
from cic_ussd.requests import (get_request_endpoint,
|
||||||
@ -126,6 +126,8 @@ else:
|
|||||||
|
|
||||||
valid_service_codes = config.get('APP_SERVICE_CODE').split(",")
|
valid_service_codes = config.get('APP_SERVICE_CODE').split(",")
|
||||||
|
|
||||||
|
Support.phone_number = config.get('APP_SUPPORT_PHONE_NUMBER')
|
||||||
|
|
||||||
|
|
||||||
def application(env, start_response):
|
def application(env, start_response):
|
||||||
"""Loads python code for application to be accessible over web server
|
"""Loads python code for application to be accessible over web server
|
||||||
|
Loading…
Reference in New Issue
Block a user