Skip to content

Instantly share code, notes, and snippets.

@derduskenga
Last active Jul 27, 2021
Embed
What would you like to do?
Implementing a mobile money USSD menu with branded SMS app
<?php
$menu = new Menu();
if($text == "" && $isUserRegistered == true){
//user is registered and string is is empty
echo "CON " . $menu->mainMenuRegistered("<Add a name here>");
}else if($text == "" && $isUserRegistered== false){
//user is unregistered and string is is empty
$menu->mainMenuUnRegistered();
}else if($isUserRegistered== false){
//user is unregistered and string is not empty
$textArray = explode("*", $text);
switch($textArray[0]){
case 1:
$menu->registerMenu($textArray, $phoneNumber);
break;
default:
echo "END Invalid choice. Please try again";
}
}else{
//user is registered and string is not empty
$textArray = explode("*", $text);
switch($textArray[0]){
case 1:
$menu->sendMoneyMenu($textArray,$sessionId);
break;
case 2:
$menu->withdrawMoneyMenu($textArray);
break;
case 3:
$menu->checkBalanceMenu($textArray);
break;
default:
echo "END Inavalid menu\n";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment