Makes language list dynamic-ish.
This commit is contained in:
parent
c2c7eb5e6d
commit
599c01931e
@ -2,417 +2,441 @@
|
||||
"ussd_menu": {
|
||||
"1": {
|
||||
"description": "Entry point for users to select their preferred language.",
|
||||
"display_key": "ussd.kenya.initial_language_selection",
|
||||
"display_key": "ussd.initial_language_selection",
|
||||
"name": "initial_language_selection",
|
||||
"parent": null
|
||||
},
|
||||
"2": {
|
||||
"description": "Entry point for users to enter a pin to secure their account.",
|
||||
"display_key": "ussd.kenya.initial_pin_entry",
|
||||
"display_key": "ussd.initial_pin_entry",
|
||||
"name": "initial_pin_entry",
|
||||
"parent": null
|
||||
},
|
||||
"3": {
|
||||
"description": "Pin confirmation entry menu.",
|
||||
"display_key": "ussd.kenya.initial_pin_confirmation",
|
||||
"display_key": "ussd.initial_pin_confirmation",
|
||||
"name": "initial_pin_confirmation",
|
||||
"parent": "initial_pin_entry"
|
||||
},
|
||||
"4": {
|
||||
"description": "The signup process has been initiated and the account is being created.",
|
||||
"display_key": "ussd.kenya.account_creation_prompt",
|
||||
"display_key": "ussd.account_creation_prompt",
|
||||
"name": "account_creation_prompt",
|
||||
"parent": null
|
||||
},
|
||||
"5": {
|
||||
"description": "Entry point for activated users.",
|
||||
"display_key": "ussd.kenya.start",
|
||||
"display_key": "ussd.start",
|
||||
"name": "start",
|
||||
"parent": null
|
||||
},
|
||||
"6": {
|
||||
"description": "Given name entry menu.",
|
||||
"display_key": "ussd.kenya.enter_given_name",
|
||||
"display_key": "ussd.enter_given_name",
|
||||
"name": "enter_given_name",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"7": {
|
||||
"description": "Family name entry menu.",
|
||||
"display_key": "ussd.kenya.enter_family_name",
|
||||
"display_key": "ussd.enter_family_name",
|
||||
"name": "enter_family_name",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"8": {
|
||||
"description": "Gender entry menu.",
|
||||
"display_key": "ussd.kenya.enter_gender",
|
||||
"display_key": "ussd.enter_gender",
|
||||
"name": "enter_gender",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"9": {
|
||||
"description": "Age entry menu.",
|
||||
"display_key": "ussd.kenya.enter_gender",
|
||||
"display_key": "ussd.enter_gender",
|
||||
"name": "enter_gender",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"10": {
|
||||
"description": "Location entry menu.",
|
||||
"display_key": "ussd.kenya.enter_location",
|
||||
"display_key": "ussd.enter_location",
|
||||
"name": "enter_location",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"11": {
|
||||
"description": "Products entry menu.",
|
||||
"display_key": "ussd.kenya.enter_products",
|
||||
"display_key": "ussd.enter_products",
|
||||
"name": "enter_products",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"12": {
|
||||
"description": "Entry point for activated users.",
|
||||
"display_key": "ussd.kenya.start",
|
||||
"display_key": "ussd.start",
|
||||
"name": "start",
|
||||
"parent": null
|
||||
},
|
||||
"13": {
|
||||
"description": "Send Token recipient entry.",
|
||||
"display_key": "ussd.kenya.enter_transaction_recipient",
|
||||
"display_key": "ussd.enter_transaction_recipient",
|
||||
"name": "enter_transaction_recipient",
|
||||
"parent": "start"
|
||||
},
|
||||
"14": {
|
||||
"description": "Send Token amount prompt menu.",
|
||||
"display_key": "ussd.kenya.enter_transaction_amount",
|
||||
"display_key": "ussd.enter_transaction_amount",
|
||||
"name": "enter_transaction_amount",
|
||||
"parent": "start"
|
||||
},
|
||||
"15": {
|
||||
"description": "Pin entry for authorization to send token.",
|
||||
"display_key": "ussd.kenya.transaction_pin_authorization",
|
||||
"display_key": "ussd.transaction_pin_authorization",
|
||||
"name": "transaction_pin_authorization",
|
||||
"parent": "start"
|
||||
},
|
||||
"16": {
|
||||
"description": "Manage account menu.",
|
||||
"display_key": "ussd.kenya.account_management",
|
||||
"display_key": "ussd.account_management",
|
||||
"name": "account_management",
|
||||
"parent": "start"
|
||||
},
|
||||
"17": {
|
||||
"description": "Manage metadata menu.",
|
||||
"display_key": "ussd.kenya.metadata_management",
|
||||
"display_key": "ussd.metadata_management",
|
||||
"name": "metadata_management",
|
||||
"parent": "start"
|
||||
},
|
||||
"18": {
|
||||
"description": "Manage user's preferred language menu.",
|
||||
"display_key": "ussd.kenya.select_preferred_language",
|
||||
"display_key": "ussd.select_preferred_language",
|
||||
"name": "select_preferred_language",
|
||||
"parent": "account_management"
|
||||
},
|
||||
"19": {
|
||||
"description": "Retrieve mini-statement menu.",
|
||||
"display_key": "ussd.kenya.mini_statement_pin_authorization",
|
||||
"display_key": "ussd.mini_statement_pin_authorization",
|
||||
"name": "mini_statement_pin_authorization",
|
||||
"parent": "account_management"
|
||||
},
|
||||
"20": {
|
||||
"description": "Manage user's pin menu.",
|
||||
"display_key": "ussd.kenya.enter_current_pin",
|
||||
"display_key": "ussd.enter_current_pin",
|
||||
"name": "enter_current_pin",
|
||||
"parent": "account_management"
|
||||
},
|
||||
"21": {
|
||||
"description": "New pin entry menu.",
|
||||
"display_key": "ussd.kenya.enter_new_pin",
|
||||
"display_key": "ussd.enter_new_pin",
|
||||
"name": "enter_new_pin",
|
||||
"parent": "account_management"
|
||||
},
|
||||
"22": {
|
||||
"description": "Pin entry menu.",
|
||||
"display_key": "ussd.kenya.display_metadata_pin_authorization",
|
||||
"display_key": "ussd.display_metadata_pin_authorization",
|
||||
"name": "display_metadata_pin_authorization",
|
||||
"parent": "start"
|
||||
},
|
||||
"23": {
|
||||
"description": "Exit menu.",
|
||||
"display_key": "ussd.kenya.exit",
|
||||
"display_key": "ussd.exit",
|
||||
"name": "exit",
|
||||
"parent": null
|
||||
},
|
||||
"24": {
|
||||
"description": "Invalid menu option.",
|
||||
"display_key": "ussd.kenya.exit_invalid_menu_option",
|
||||
"display_key": "ussd.exit_invalid_menu_option",
|
||||
"name": "exit_invalid_menu_option",
|
||||
"parent": null
|
||||
},
|
||||
"25": {
|
||||
"description": "Pin policy violation.",
|
||||
"display_key": "ussd.kenya.exit_invalid_pin",
|
||||
"display_key": "ussd.exit_invalid_pin",
|
||||
"name": "exit_invalid_pin",
|
||||
"parent": null
|
||||
},
|
||||
"26": {
|
||||
"description": "Pin mismatch. New pin and the new pin confirmation do not match",
|
||||
"display_key": "ussd.kenya.exit_pin_mismatch",
|
||||
"display_key": "ussd.exit_pin_mismatch",
|
||||
"name": "exit_pin_mismatch",
|
||||
"parent": null
|
||||
},
|
||||
"27": {
|
||||
"description": "Ussd pin blocked Menu",
|
||||
"display_key": "ussd.kenya.exit_pin_blocked",
|
||||
"display_key": "ussd.exit_pin_blocked",
|
||||
"name": "exit_pin_blocked",
|
||||
"parent": null
|
||||
},
|
||||
"28": {
|
||||
"description": "Key params missing in request.",
|
||||
"display_key": "ussd.kenya.exit_invalid_request",
|
||||
"display_key": "ussd.exit_invalid_request",
|
||||
"name": "exit_invalid_request",
|
||||
"parent": null
|
||||
},
|
||||
"29": {
|
||||
"description": "The user did not select a choice.",
|
||||
"display_key": "ussd.kenya.exit_invalid_input",
|
||||
"display_key": "ussd.exit_invalid_input",
|
||||
"name": "exit_invalid_input",
|
||||
"parent": null
|
||||
},
|
||||
"30": {
|
||||
"description": "Exit following unsuccessful transaction due to insufficient account balance.",
|
||||
"display_key": "ussd.kenya.exit_insufficient_balance",
|
||||
"display_key": "ussd.exit_insufficient_balance",
|
||||
"name": "exit_insufficient_balance",
|
||||
"parent": null
|
||||
},
|
||||
"31": {
|
||||
"description": "Exit following a successful transaction.",
|
||||
"display_key": "ussd.kenya.exit_successful_transaction",
|
||||
"display_key": "ussd.exit_successful_transaction",
|
||||
"name": "exit_successful_transaction",
|
||||
"parent": null
|
||||
},
|
||||
"32": {
|
||||
"description": "End of a menu flow.",
|
||||
"display_key": "ussd.kenya.complete",
|
||||
"display_key": "ussd.complete",
|
||||
"name": "complete",
|
||||
"parent": null
|
||||
},
|
||||
"33": {
|
||||
"description": "Pin entry menu to view account balances.",
|
||||
"display_key": "ussd.kenya.account_balances_pin_authorization",
|
||||
"display_key": "ussd.account_balances_pin_authorization",
|
||||
"name": "account_balances_pin_authorization",
|
||||
"parent": "account_management"
|
||||
},
|
||||
"34": {
|
||||
"description": "Pin entry menu to view account statement.",
|
||||
"display_key": "ussd.kenya.account_statement_pin_authorization",
|
||||
"display_key": "ussd.account_statement_pin_authorization",
|
||||
"name": "account_statement_pin_authorization",
|
||||
"parent": "account_management"
|
||||
},
|
||||
"35": {
|
||||
"description": "Menu to display account balances.",
|
||||
"display_key": "ussd.kenya.account_balances",
|
||||
"display_key": "ussd.account_balances",
|
||||
"name": "account_balances",
|
||||
"parent": "account_management"
|
||||
},
|
||||
"36": {
|
||||
"description": "Menu to display first set of transactions in statement.",
|
||||
"display_key": "ussd.kenya.first_transaction_set",
|
||||
"display_key": "ussd.first_transaction_set",
|
||||
"name": "first_transaction_set",
|
||||
"parent": null
|
||||
"parent": "account_management"
|
||||
},
|
||||
"37": {
|
||||
"description": "Menu to display middle set of transactions in statement.",
|
||||
"display_key": "ussd.kenya.middle_transaction_set",
|
||||
"display_key": "ussd.middle_transaction_set",
|
||||
"name": "middle_transaction_set",
|
||||
"parent": null
|
||||
},
|
||||
"38": {
|
||||
"description": "Menu to display last set of transactions in statement.",
|
||||
"display_key": "ussd.kenya.last_transaction_set",
|
||||
"display_key": "ussd.last_transaction_set",
|
||||
"name": "last_transaction_set",
|
||||
"parent": null
|
||||
},
|
||||
"39": {
|
||||
"description": "Menu to instruct users to call the office.",
|
||||
"display_key": "ussd.kenya.help",
|
||||
"display_key": "ussd.help",
|
||||
"name": "help",
|
||||
"parent": null
|
||||
},
|
||||
"40": {
|
||||
"description": "Menu to display a user's entire profile",
|
||||
"display_key": "ussd.kenya.display_user_metadata",
|
||||
"display_key": "ussd.display_user_metadata",
|
||||
"name": "display_user_metadata",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"41": {
|
||||
"description": "The recipient is not in the system",
|
||||
"display_key": "ussd.kenya.exit_invalid_recipient",
|
||||
"display_key": "ussd.exit_invalid_recipient",
|
||||
"name": "exit_invalid_recipient",
|
||||
"parent": null
|
||||
},
|
||||
"42": {
|
||||
"description": "Pin entry menu for changing name data.",
|
||||
"display_key": "ussd.kenya.name_edit_pin_authorization",
|
||||
"display_key": "ussd.name_edit_pin_authorization",
|
||||
"name": "name_edit_pin_authorization",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"43": {
|
||||
"description": "Pin entry menu for changing gender data.",
|
||||
"display_key": "ussd.kenya.gender_edit_pin_authorization",
|
||||
"display_key": "ussd.gender_edit_pin_authorization",
|
||||
"name": "gender_edit_pin_authorization",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"44": {
|
||||
"description": "Pin entry menu for changing location data.",
|
||||
"display_key": "ussd.kenya.location_edit_pin_authorization",
|
||||
"display_key": "ussd.location_edit_pin_authorization",
|
||||
"name": "location_edit_pin_authorization",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"45": {
|
||||
"description": "Pin entry menu for changing products data.",
|
||||
"display_key": "ussd.kenya.products_edit_pin_authorization",
|
||||
"display_key": "ussd.products_edit_pin_authorization",
|
||||
"name": "products_edit_pin_authorization",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"46": {
|
||||
"description": "Pin confirmation for pin change.",
|
||||
"display_key": "ussd.kenya.new_pin_confirmation",
|
||||
"display_key": "ussd.new_pin_confirmation",
|
||||
"name": "new_pin_confirmation",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"47": {
|
||||
"description": "Year of birth entry menu.",
|
||||
"display_key": "ussd.kenya.enter_date_of_birth",
|
||||
"display_key": "ussd.enter_date_of_birth",
|
||||
"name": "enter_date_of_birth",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"48": {
|
||||
"description": "Pin entry menu for changing year of birth data.",
|
||||
"display_key": "ussd.kenya.dob_edit_pin_authorization",
|
||||
"display_key": "ussd.dob_edit_pin_authorization",
|
||||
"name": "dob_edit_pin_authorization",
|
||||
"parent": "metadata_management"
|
||||
},
|
||||
"49": {
|
||||
"description": "Menu to display first set of tokens in the account's token list.",
|
||||
"display_key": "ussd.kenya.first_account_tokens_set",
|
||||
"display_key": "ussd.first_account_tokens_set",
|
||||
"name": "first_account_tokens_set",
|
||||
"parent": null
|
||||
"parent": "start"
|
||||
},
|
||||
"50": {
|
||||
"description": "Menu to display middle set of tokens in the account's token list.",
|
||||
"display_key": "ussd.kenya.middle_account_tokens_set",
|
||||
"display_key": "ussd.middle_account_tokens_set",
|
||||
"name": "middle_account_tokens_set",
|
||||
"parent": null
|
||||
},
|
||||
"51": {
|
||||
"description": "Menu to display last set of tokens in the account's token list.",
|
||||
"display_key": "ussd.kenya.last_account_tokens_set",
|
||||
"display_key": "ussd.last_account_tokens_set",
|
||||
"name": "last_account_tokens_set",
|
||||
"parent": null
|
||||
},
|
||||
"52": {
|
||||
"description": "Pin entry menu for setting an active token.",
|
||||
"display_key": "ussd.kenya.token_selection_pin_authorization",
|
||||
"display_key": "ussd.token_selection_pin_authorization",
|
||||
"name": "token_selection_pin_authorization",
|
||||
"parent": null
|
||||
"parent": "first_account_tokens_set"
|
||||
},
|
||||
"53": {
|
||||
"description": "Exit following a successful active token setting.",
|
||||
"display_key": "ussd.kenya.exit_successful_token_selection",
|
||||
"display_key": "ussd.exit_successful_token_selection",
|
||||
"name": "exit_successful_token_selection",
|
||||
"parent": null
|
||||
},
|
||||
"54": {
|
||||
"description": "Pin management menu for operations related to an account's pin.",
|
||||
"display_key": "ussd.kenya.pin_management",
|
||||
"display_key": "ussd.pin_management",
|
||||
"name": "pin_management",
|
||||
"parent": "start"
|
||||
},
|
||||
"55": {
|
||||
"description": "Phone number entry for account whose pin is being reset.",
|
||||
"display_key": "ussd.kenya.reset_guarded_pin",
|
||||
"display_key": "ussd.reset_guarded_pin",
|
||||
"name": "reset_guarded_pin",
|
||||
"parent": "pin_management"
|
||||
},
|
||||
"56": {
|
||||
"description": "Pin entry for initiating request to reset an account's pin.",
|
||||
"display_key": "ussd.kenya.reset_guarded_pin_authorization",
|
||||
"display_key": "ussd.reset_guarded_pin_authorization",
|
||||
"name": "reset_guarded_pin_authorization",
|
||||
"parent": "pin_management"
|
||||
},
|
||||
"57": {
|
||||
"description": "Exit menu following successful pin reset initiation.",
|
||||
"display_key": "ussd.kenya.exit_pin_reset_initiated_success",
|
||||
"display_key": "ussd.exit_pin_reset_initiated_success",
|
||||
"name": "exit_pin_reset_initiated_success",
|
||||
"parent": "pin_management"
|
||||
},
|
||||
"58": {
|
||||
"description": "Exit menu in the event that an account is not a set guardian.",
|
||||
"display_key": "ussd.kenya.exit_not_authorized_for_pin_reset",
|
||||
"display_key": "ussd.exit_not_authorized_for_pin_reset",
|
||||
"name": "exit_not_authorized_for_pin_reset",
|
||||
"parent": "pin_management"
|
||||
},
|
||||
"59": {
|
||||
"description": "Pin guard menu for handling guardianship operations.",
|
||||
"display_key": "ussd.kenya.guard_pin",
|
||||
"display_key": "ussd.guard_pin",
|
||||
"name": "guard_pin",
|
||||
"parent": "pin_management"
|
||||
},
|
||||
"60": {
|
||||
"description": "Pin entry to display a list of set guardians.",
|
||||
"display_key": "ussd.kenya.guardian_list_pin_authorization",
|
||||
"display_key": "ussd.guardian_list_pin_authorization",
|
||||
"name": "guardian_list_pin_authorization",
|
||||
"parent": "guard_pin"
|
||||
},
|
||||
"61": {
|
||||
"description": "Menu to display list of set guardians.",
|
||||
"display_key": "ussd.kenya.guardian_list",
|
||||
"display_key": "ussd.guardian_list",
|
||||
"name": "guardian_list",
|
||||
"parent": "guard_pin"
|
||||
},
|
||||
"62": {
|
||||
"description": "Phone number entry to add an account as a guardian to reset pin.",
|
||||
"display_key": "ussd.kenya.add_guardian",
|
||||
"display_key": "ussd.add_guardian",
|
||||
"name": "add_guardian",
|
||||
"parent": "guard_pin"
|
||||
},
|
||||
"63": {
|
||||
"description": "Pin entry to confirm addition of an account as a guardian.",
|
||||
"display_key": "ussd.kenya.add_guardian_pin_authorization",
|
||||
"display_key": "ussd.add_guardian_pin_authorization",
|
||||
"name": "add_guardian_pin_authorization",
|
||||
"parent": "guard_pin"
|
||||
},
|
||||
"64": {
|
||||
"description": "Exit menu when an account is successfully added as pin reset guardian.",
|
||||
"display_key": "ussd.kenya.exit_guardian_addition_success",
|
||||
"display_key": "ussd.exit_guardian_addition_success",
|
||||
"name": "exit_guardian_addition_success",
|
||||
"parent": "guard_pin"
|
||||
},
|
||||
"65": {
|
||||
"description": "Phone number entry to remove an account as a guardian to reset pin.",
|
||||
"display_key": "ussd.kenya.remove_guardian",
|
||||
"display_key": "ussd.remove_guardian",
|
||||
"name": "remove_guardian",
|
||||
"parent": "guard_pin"
|
||||
},
|
||||
"66": {
|
||||
"description": "Pin entry to confirm removal of an account as a guardian.",
|
||||
"display_key": "ussd.kenya.remove_guardian_pin_authorization",
|
||||
"display_key": "ussd.remove_guardian_pin_authorization",
|
||||
"name": "remove_guardian_pin_authorization",
|
||||
"parent": "guard_pin"
|
||||
},
|
||||
"67": {
|
||||
"description": "Exit menu when an account is successfully removed as pin reset guardian.",
|
||||
"display_key": "ussd.kenya.exit_guardian_removal_success",
|
||||
"display_key": "ussd.exit_guardian_removal_success",
|
||||
"name": "exit_guardian_removal_success",
|
||||
"parent": "guard_pin"
|
||||
},
|
||||
"68": {
|
||||
"description": "Exit menu when invalid phone number entry for guardian addition.",
|
||||
"display_key": "ussd.kenya.exit_invalid_guardian_addition",
|
||||
"display_key": "ussd.exit_invalid_guardian_addition",
|
||||
"name": "exit_invalid_guardian_addition",
|
||||
"parent": "guard_pin"
|
||||
},
|
||||
"69": {
|
||||
"description": "Exit menu when invalid phone number entry for guardian removal.",
|
||||
"display_key": "ussd.kenya.exit_invalid_guardian_removal",
|
||||
"display_key": "ussd.exit_invalid_guardian_removal",
|
||||
"name": "exit_invalid_guardian_removal",
|
||||
"parent": "guard_pin"
|
||||
},
|
||||
"70": {
|
||||
"description": "Menu to display middle set of languages to select.",
|
||||
"display_key": "ussd.initial_middle_language_set",
|
||||
"name": "initial_middle_language_set",
|
||||
"parent": null
|
||||
},
|
||||
"71": {
|
||||
"description": "Menu to display last set of languages to select.",
|
||||
"display_key": "ussd.initial_last_language_set",
|
||||
"name": "initial_last_language_set",
|
||||
"parent": null
|
||||
},
|
||||
"72": {
|
||||
"description": "Menu to display middle set of languages to select.",
|
||||
"display_key": "ussd.middle_language_set",
|
||||
"name": "middle_language_set",
|
||||
"parent": null
|
||||
},
|
||||
"73": {
|
||||
"description": "Menu to display last set of languages to select.",
|
||||
"display_key": "ussd.last_language_set",
|
||||
"name": "last_language_set",
|
||||
"parent": null
|
||||
}
|
||||
}
|
||||
}
|
@ -11,46 +11,20 @@ from cic_types.models.person import get_contact_data_from_vcard, generate_vcard_
|
||||
|
||||
# local imports
|
||||
from cic_ussd.account.chain import Chain
|
||||
from cic_ussd.account.maps import gender, language
|
||||
from cic_ussd.account.maps import gender
|
||||
from cic_ussd.account.metadata import get_cached_preferred_language
|
||||
from cic_ussd.db.models.account import Account
|
||||
from cic_ussd.db.models.account import Account, create
|
||||
from cic_ussd.db.models.base import SessionBase
|
||||
from cic_ussd.error import MetadataNotFoundError
|
||||
from cic_ussd.metadata import PersonMetadata
|
||||
from cic_ussd.session.ussd_session import save_session_data
|
||||
from cic_ussd.state_machine.logic.language import preferred_langauge_from_selection
|
||||
from cic_ussd.translation import translation_for
|
||||
from sqlalchemy.orm.session import Session
|
||||
|
||||
logg = logging.getLogger(__file__)
|
||||
|
||||
|
||||
def change_preferred_language(state_machine_data: Tuple[str, dict, Account, Session]):
|
||||
"""
|
||||
:param state_machine_data:
|
||||
:type state_machine_data:
|
||||
:return:
|
||||
:rtype:
|
||||
"""
|
||||
user_input, ussd_session, account, session = state_machine_data
|
||||
r_user_input = language().get(user_input)
|
||||
session = SessionBase.bind_session(session)
|
||||
account.preferred_language = r_user_input
|
||||
session.add(account)
|
||||
session.flush()
|
||||
SessionBase.release_session(session)
|
||||
|
||||
preferences_data = {
|
||||
'preferred_language': r_user_input
|
||||
}
|
||||
|
||||
s = celery.signature(
|
||||
'cic_ussd.tasks.metadata.add_preferences_metadata',
|
||||
[account.blockchain_address, preferences_data],
|
||||
queue='cic-ussd'
|
||||
)
|
||||
return s.apply_async()
|
||||
|
||||
|
||||
def update_account_status_to_active(state_machine_data: Tuple[str, dict, Account, Session]):
|
||||
"""This function sets user's account to active.
|
||||
:param state_machine_data: A tuple containing user input, a ussd session and user object.
|
||||
@ -245,3 +219,16 @@ def edit_user_metadata_attribute(state_machine_data: Tuple[str, dict, Account, S
|
||||
[blockchain_address, parsed_person_metadata]
|
||||
)
|
||||
s_edit_person_metadata.apply_async(queue='cic-ussd')
|
||||
|
||||
|
||||
def process_account_creation(state_machine_data: Tuple[str, dict, Account, Session]):
|
||||
"""
|
||||
:param state_machine_data:
|
||||
:type state_machine_data:
|
||||
:return:
|
||||
:rtype:
|
||||
"""
|
||||
user_input, ussd_session, account, session = state_machine_data
|
||||
preferred_language = preferred_langauge_from_selection(user_input=user_input)
|
||||
chain_str = Chain.spec.__str__()
|
||||
create(chain_str, ussd_session.get('msisdn'), session, preferred_language)
|
||||
|
@ -13,5 +13,7 @@
|
||||
"products_edit_pin_authorization",
|
||||
"account_balances_pin_authorization",
|
||||
"account_statement_pin_authorization",
|
||||
"account_balances"
|
||||
"account_balances",
|
||||
"middle_language_set",
|
||||
"last_language_set"
|
||||
]
|
@ -2,6 +2,8 @@
|
||||
"start",
|
||||
"scan_data",
|
||||
"initial_language_selection",
|
||||
"initial_middle_language_set",
|
||||
"initial_last_language_set",
|
||||
"initial_pin_entry",
|
||||
"initial_pin_confirmation",
|
||||
"change_preferred_language"
|
||||
|
@ -1,21 +1,142 @@
|
||||
[
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "select_preferred_language",
|
||||
"source": "initial_language_selection",
|
||||
"dest": "account_creation_prompt",
|
||||
"after": "cic_ussd.state_machine.logic.account.process_account_creation",
|
||||
"conditions": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_language_selection",
|
||||
"dest": "initial_middle_language_set",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_eleven_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_language_selection",
|
||||
"dest": "exit",
|
||||
"after": "cic_ussd.state_machine.logic.account.change_preferred_language",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_one_selected"
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_middle_language_set",
|
||||
"dest": "initial_language_selection",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_middle_language_set",
|
||||
"dest": "initial_last_language_set",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_eleven_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_middle_language_set",
|
||||
"dest": "exit",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_last_language_set",
|
||||
"dest": "initial_middle_language_set",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_last_language_set",
|
||||
"dest": "exit",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_middle_language_set",
|
||||
"dest": "exit",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_language_selection",
|
||||
"dest": "exit_invalid_menu_option"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "middle_language_set",
|
||||
"dest": "exit_invalid_menu_option"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "last_language_set",
|
||||
"dest": "exit_invalid_menu_option"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "select_preferred_language",
|
||||
"dest": "exit",
|
||||
"after": "cic_ussd.state_machine.logic.account.change_preferred_language",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_two_selected"
|
||||
"after": "cic_ussd.state_machine.logic.language.change_preferred_language",
|
||||
"conditions": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "select_preferred_language",
|
||||
"dest": "middle_language_set",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_eleven_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "select_preferred_language",
|
||||
"dest": "exit",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "middle_language_set",
|
||||
"dest": "select_preferred_language",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "middle_language_set",
|
||||
"dest": "last_language_set",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_eleven_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "middle_language_set",
|
||||
"dest": "exit",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "last_language_set",
|
||||
"dest": "middle_language_set",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "last_language_set",
|
||||
"dest": "exit",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "middle_language_set",
|
||||
"dest": "exit",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "select_preferred_language",
|
||||
"dest": "exit_invalid_menu_option"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "middle_language_set",
|
||||
"dest": "exit_invalid_menu_option"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "last_language_set",
|
||||
"dest": "exit_invalid_menu_option"
|
||||
}
|
||||
]
|
@ -1,29 +1,4 @@
|
||||
[
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_language_selection",
|
||||
"dest": "initial_pin_entry",
|
||||
"after": "cic_ussd.state_machine.logic.account.change_preferred_language",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_one_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_language_selection",
|
||||
"dest": "initial_pin_entry",
|
||||
"after": "cic_ussd.state_machine.logic.account.change_preferred_language",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_two_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_language_selection",
|
||||
"dest": "help",
|
||||
"conditions": "cic_ussd.state_machine.logic.menu.menu_three_selected"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_language_selection",
|
||||
"dest": "exit_invalid_menu_option"
|
||||
},
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_pin_entry",
|
||||
@ -39,7 +14,6 @@
|
||||
{
|
||||
"trigger": "scan_data",
|
||||
"source": "initial_pin_confirmation",
|
||||
"unless": "cic_ussd.state_machine.logic.validator.has_cached_person_metadata",
|
||||
"conditions": "cic_ussd.state_machine.logic.pin.pins_match",
|
||||
"dest": "start",
|
||||
"after": [
|
||||
|
9
apps/cic-ussd/var/lib/sys/languages.json
Normal file
9
apps/cic-ussd/var/lib/sys/languages.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"en": "English",
|
||||
"sw": "Kiswahili",
|
||||
"kam": "Kamba",
|
||||
"kik": "Kikiuyu",
|
||||
"miji": "Mijikenda",
|
||||
"luo": "Luo",
|
||||
"bor": "Borana"
|
||||
}
|
Loading…
Reference in New Issue
Block a user