From c4eeaf682e89eeac354ef27e4243d32e3ad4cfc7 Mon Sep 17 00:00:00 2001 From: PhilipWafula Date: Sun, 28 Nov 2021 15:48:49 +0300 Subject: [PATCH] Adds pin guard and reset states and transitions. --- apps/cic-ussd/states/exit_states.json | 2 + .../transitions/pin_guard_transitions.json | 83 ++++++++++++++++++- .../transitions/pin_reset_transitions.json | 43 ++++++++++ 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 apps/cic-ussd/transitions/pin_reset_transitions.json diff --git a/apps/cic-ussd/states/exit_states.json b/apps/cic-ussd/states/exit_states.json index 982e6b3a..6060a732 100644 --- a/apps/cic-ussd/states/exit_states.json +++ b/apps/cic-ussd/states/exit_states.json @@ -11,5 +11,7 @@ "account_creation_prompt", "exit_successful_transaction", "exit_insufficient_balance", + "exit_invalid_guardian_addition", + "exit_invalid_guardian_removal", "complete" ] \ No newline at end of file diff --git a/apps/cic-ussd/transitions/pin_guard_transitions.json b/apps/cic-ussd/transitions/pin_guard_transitions.json index 6c014771..fb77fba3 100644 --- a/apps/cic-ussd/transitions/pin_guard_transitions.json +++ b/apps/cic-ussd/transitions/pin_guard_transitions.json @@ -23,6 +23,35 @@ "dest": "add_guardian", "conditions": "cic_ussd.state_machine.logic.menu.menu_two_selected" }, + { + "trigger": "scan_data", + "source": "add_guardian", + "dest": "add_guardian_pin_authorization", + "after": [ + "cic_ussd.state_machine.logic.pin_guard.save_guardian_to_session_data", + "cic_ussd.state_machine.logic.pin_guard.retrieve_person_metadata" + ], + "conditions": "cic_ussd.state_machine.logic.pin_guard.is_valid_guardian_addition" + }, + { + "trigger": "scan_data", + "source": "add_guardian", + "dest": "exit_invalid_guardian_addition", + "unless": "cic_ussd.state_machine.logic.pin_guard.is_valid_guardian_addition" + }, + { + "trigger": "scan_data", + "source": "add_guardian_pin_authorization", + "dest": "exit_guardian_addition_success", + "after": "cic_ussd.state_machine.logic.pin_guard.add_pin_guardian", + "conditions": "cic_ussd.state_machine.logic.pin.is_authorized_pin" + }, + { + "trigger": "scan_data", + "source": "add_guardian_pin_authorization", + "dest": "exit_pin_blocked", + "conditions": "cic_ussd.state_machine.logic.pin.is_locked_account" + }, { "trigger": "scan_data", "source": "guard_pin", @@ -31,8 +60,60 @@ }, { "trigger": "scan_data", - "source": "guard_pin", + "source": "remove_guardian", + "dest": "remove_guardian_pin_authorization", + "after": [ + "cic_ussd.state_machine.logic.pin_guard.save_guardian_to_session_data", + "cic_ussd.state_machine.logic.pin_guard.retrieve_person_metadata" + ], + "conditions": "cic_ussd.state_machine.logic.pin_guard.is_dialers_pin_guardian" + }, + { + "trigger": "scan_data", + "source": "remove_guardian", + "dest": "exit_invalid_guardian_removal", + "unless": "cic_ussd.state_machine.logic.pin_guard.is_dialers_pin_guardian" + }, + { + "trigger": "scan_data", + "source": "remove_guardian_pin_authorization", + "dest": "exit_guardian_removal_success", + "after": "cic_ussd.state_machine.logic.pin_guard.remove_pin_guardian", + "conditions": "cic_ussd.state_machine.logic.pin.is_authorized_pin" + }, + { + "trigger": "scan_data", + "source": "remove_guardian_pin_authorization", + "dest": "exit_pin_blocked", + "conditions": "cic_ussd.state_machine.logic.pin.is_locked_account" + }, + { + "trigger": "scan_data", + "source": "exit_guardian_removal_success", "dest": "exit", "conditions": "cic_ussd.state_machine.logic.menu.menu_nine_selected" + }, + { + "trigger": "scan_data", + "source": "exit_invalid_guardian_addition", + "dest": "exit", + "conditions": "cic_ussd.state_machine.logic.menu.menu_nine_selected" + }, + { + "trigger": "scan_data", + "source": "exit_invalid_guardian_removal", + "dest": "exit", + "conditions": "cic_ussd.state_machine.logic.menu.menu_nine_selected" + }, + { + "trigger": "scan_data", + "source": "guardian_list", + "dest": "exit", + "conditions": "cic_ussd.state_machine.logic.menu.menu_nine_selected" + }, + { + "trigger": "scan_data", + "source": "guard_pin", + "dest": "exit_invalid_menu_option" } ] \ No newline at end of file diff --git a/apps/cic-ussd/transitions/pin_reset_transitions.json b/apps/cic-ussd/transitions/pin_reset_transitions.json new file mode 100644 index 00000000..f0c2b2ce --- /dev/null +++ b/apps/cic-ussd/transitions/pin_reset_transitions.json @@ -0,0 +1,43 @@ +[ + { + "trigger": "scan_data", + "source": "reset_guarded_pin", + "dest": "reset_guarded_pin_authorization", + "after": [ + "cic_ussd.state_machine.logic.pin_guard.save_guarded_account_session_data", + "cic_ussd.state_machine.logic.pin_guard.retrieve_person_metadata" + ], + "conditions": "cic_ussd.state_machine.logic.pin_guard.is_others_pin_guardian" + }, + { + "trigger": "scan_data", + "source": "reset_guarded_pin_authorization", + "dest": "exit_pin_reset_initiated_success", + "after": "cic_ussd.state_machine.logic.pin_guard.initiate_pin_reset", + "conditions": "cic_ussd.state_machine.logic.pin.is_authorized_pin" + }, + { + "trigger": "scan_data", + "source": "exit_pin_reset_initiated_success", + "dest": "exit", + "conditions": "cic_ussd.state_machine.logic.menu.menu_nine_selected" + }, + { + "trigger": "scan_data", + "source": "reset_guarded_pin_authorization", + "dest": "exit_pin_blocked", + "conditions": "cic_ussd.state_machine.logic.pin.is_locked_account" + }, + { + "trigger": "scan_data", + "source": "reset_guarded_pin", + "dest": "exit_not_authorized_for_pin_reset", + "unless": "cic_ussd.state_machine.logic.pin_guard.is_others_pin_guardian" + }, + { + "trigger": "scan_data", + "source": "exit_not_authorized_for_pin_reset", + "dest": "exit", + "conditions": "cic_ussd.state_machine.logic.menu.menu_nine_selected" + } +] \ No newline at end of file