From 3cad3eb5153118a6c633fd4a820967921285a56c Mon Sep 17 00:00:00 2001 From: PhilipWafula Date: Mon, 22 Nov 2021 12:42:26 +0300 Subject: [PATCH] Updates state and transitions to incorporate multi token setup. --- apps/cic-ussd/cic_ussd/db/ussd_menu.json | 31 ++++++- .../states/token_management_states.json | 7 ++ .../transitions/exit_transitions.json | 12 +++ .../transitions/start_menu_transitions.json | 10 +- .../token_management_transitions.json | 93 +++++++++++++++++++ 5 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 apps/cic-ussd/states/token_management_states.json create mode 100644 apps/cic-ussd/transitions/token_management_transitions.json diff --git a/apps/cic-ussd/cic_ussd/db/ussd_menu.json b/apps/cic-ussd/cic_ussd/db/ussd_menu.json index bbb23d74..616021ea 100644 --- a/apps/cic-ussd/cic_ussd/db/ussd_menu.json +++ b/apps/cic-ussd/cic_ussd/db/ussd_menu.json @@ -287,7 +287,36 @@ "display_key": "ussd.kenya.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", + "name": "first_account_tokens_set", + "parent": null + }, + "50": { + "description": "Menu to display middle set of tokens in the account's token list.", + "display_key": "ussd.kenya.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", + "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", + "name": "token_selection_pin_authorization", + "parent": null + }, + "53": { + "description": "Exit following a successful active token setting.", + "display_key": "ussd.kenya.exit_successful_token_selection", + "name": "exit_successful_token_selection", + "parent": null } - } } \ No newline at end of file diff --git a/apps/cic-ussd/states/token_management_states.json b/apps/cic-ussd/states/token_management_states.json new file mode 100644 index 00000000..c1007ef1 --- /dev/null +++ b/apps/cic-ussd/states/token_management_states.json @@ -0,0 +1,7 @@ +[ + "first_account_tokens_set", + "middle_account_tokens_set", + "last_account_tokens_set", + "token_selection_pin_authorization", + "exit_successful_token_selection" +] \ No newline at end of file diff --git a/apps/cic-ussd/transitions/exit_transitions.json b/apps/cic-ussd/transitions/exit_transitions.json index 54661a03..975dd14c 100644 --- a/apps/cic-ussd/transitions/exit_transitions.json +++ b/apps/cic-ussd/transitions/exit_transitions.json @@ -58,5 +58,17 @@ "source": "exit_successful_transaction", "dest": "exit", "conditions": "cic_ussd.state_machine.logic.menu.menu_ninety_nine_selected" + }, + { + "trigger": "scan_data", + "source": "exit_successful_token_selection", + "dest": "start", + "conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected" + }, + { + "trigger": "scan_data", + "source": "exit_successful_token_selection", + "dest": "exit", + "conditions": "cic_ussd.state_machine.logic.menu.menu_ninety_nine_selected" } ] \ No newline at end of file diff --git a/apps/cic-ussd/transitions/start_menu_transitions.json b/apps/cic-ussd/transitions/start_menu_transitions.json index a62c777f..e309d4f4 100644 --- a/apps/cic-ussd/transitions/start_menu_transitions.json +++ b/apps/cic-ussd/transitions/start_menu_transitions.json @@ -8,15 +8,21 @@ { "trigger": "scan_data", "source": "start", - "dest": "account_management", + "dest": "first_account_tokens_set", "conditions": "cic_ussd.state_machine.logic.menu.menu_two_selected" }, { "trigger": "scan_data", "source": "start", - "dest": "help", + "dest": "account_management", "conditions": "cic_ussd.state_machine.logic.menu.menu_three_selected" }, + { + "trigger": "scan_data", + "source": "start", + "dest": "help", + "conditions": "cic_ussd.state_machine.logic.menu.menu_four_selected" + }, { "trigger": "scan_data", "source": "start", diff --git a/apps/cic-ussd/transitions/token_management_transitions.json b/apps/cic-ussd/transitions/token_management_transitions.json new file mode 100644 index 00000000..31e276dd --- /dev/null +++ b/apps/cic-ussd/transitions/token_management_transitions.json @@ -0,0 +1,93 @@ +[ + { + "trigger": "scan_data", + "source": "first_account_tokens_set", + "dest": "middle_account_tokens_set", + "conditions": "cic_ussd.state_machine.logic.menu.menu_eleven_selected" + }, + { + "trigger": "scan_data", + "source": "first_account_tokens_set", + "dest": "exit", + "conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected" + }, + { + "trigger": "scan_data", + "source": "first_account_tokens_set", + "dest": "token_selection_pin_authorization", + "conditions": "cic_ussd.state_machine.logic.tokens.is_valid_token_selection", + "after": "cic_ussd.state_machine.logic.tokens.process_token_selection" + }, + { + "trigger": "scan_data", + "source": "first_account_tokens_set", + "dest": "exit_invalid_menu_option" + }, + { + "trigger": "scan_data", + "source": "middle_account_tokens_set", + "dest": "last_account_tokens_set", + "conditions": "cic_ussd.state_machine.logic.menu.menu_eleven_selected" + }, + { + "trigger": "scan_data", + "source": "middle_account_tokens_set", + "dest": "first_account_tokens_set", + "conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected" + }, + { + "trigger": "scan_data", + "source": "middle_account_tokens_set", + "dest": "exit", + "conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected" + }, + { + "trigger": "scan_data", + "source": "middle_account_tokens_set", + "dest": "token_selection_pin_authorization", + "conditions": "cic_ussd.state_machine.logic.tokens.is_valid_token_selection", + "after": "cic_ussd.state_machine.logic.tokens.process_token_selection" + }, + { + "trigger": "scan_data", + "source": "middle_account_tokens_set", + "dest": "exit_invalid_menu_option" + }, + { + "trigger": "scan_data", + "source": "last_account_tokens_set", + "dest": "middle_account_tokens_set", + "conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected" + }, + { + "trigger": "scan_data", + "source": "last_account_tokens_set", + "dest": "exit", + "conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected" + }, + { + "trigger": "scan_data", + "source": "last_account_tokens_set", + "dest": "token_selection_pin_authorization", + "conditions": "cic_ussd.state_machine.logic.tokens.is_valid_token_selection", + "after": "cic_ussd.state_machine.logic.tokens.process_token_selection" + }, + { + "trigger": "scan_data", + "source": "last_account_tokens_set", + "dest": "exit_invalid_menu_option" + }, + { + "trigger": "scan_data", + "source": "token_selection_pin_authorization", + "dest": "exit_successful_token_selection", + "conditions": "cic_ussd.state_machine.logic.pin.is_authorized_pin", + "after": "cic_ussd.state_machine.logic.tokens.set_selected_active_token" + }, + { + "trigger": "scan_data", + "source": "token_selection_pin_authorization", + "dest": "exit", + "conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected" + } +] \ No newline at end of file