Skip to content

Commit 00c5172

Browse files
authored
Merge pull request Python-World#225 from Tomyzon1728/master
Unstructured supplementary service data
2 parents 9ebe6a3 + 99d041a commit 00c5172

3 files changed

Lines changed: 207 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# USSD
2+
Unstructured Supplementary Service Data (USSD), sometimes referred to as "Quick Codes" or "Feature codes", is a communications protocol used by GSM cellular telephones to communicate with the mobile network operator's computers. USSD can be used for WAP browsing, prepaid callback service, mobile-money services, location-based content services, menu-based information services, and as part of configuring the phone on the network
3+
4+
MODULES REQUIRED
5+
1. random
6+
2.time
7+
3. sys
8+
9+
EXECUTION PROCESS
10+
1. fork code
11+
2. git clone SSH
12+
3. open on device using a python IDE
13+
4. run the script
14+
15+
16+
AUTHOR
17+
18+
Ajayi Raymond Tomisin (ART)
50.5 KB
Loading
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
import random
2+
import time
3+
import sys
4+
5+
print('Welcome To fastrack USSD Banking Project...')
6+
time.sleep(8)
7+
8+
bank_list="""
9+
1. Access Bank
10+
2. Fidelity Bank
11+
3. Guarantee Trust Bank
12+
4. Heritage Bank
13+
5. Polaris Bank
14+
6. Stanbic IBTC
15+
7. Unity Bank
16+
8. Wema Bank
17+
"""
18+
19+
gen_bvn = " "
20+
21+
def BVN_checker( ):
22+
global gen_bvn
23+
bvn = [str(i) for i in range (5)]
24+
gen_bvn= "".join(bvn)
25+
26+
27+
def open_acct( ):
28+
global gen_bvn
29+
print("Welcome to our online Account opening services.")
30+
print("loading...")
31+
# creating an empty list to serve as a temporary place holder.
32+
temp_storage= [ ]
33+
f_name= input("Enter your first name:")
34+
s_name= input ("Enter your second name:")
35+
sex = input("Enter sex [M/F]:")
36+
BVN_checker( )
37+
temp_storage.append(f_name)
38+
temp_storage.append(s_name)
39+
temp_storage.append(sex)
40+
temp_storage.append(gen_bvn)
41+
details= " ".join(temp_storage)
42+
split_details = details.split(" ")
43+
#print(split_details)
44+
print(split_details[0]+" "+split_details[1])
45+
print(split_details[2])
46+
print("Your bvn is :"+split_details[3])
47+
print("1. Press # to go back to options menu\n2. Press * to exit")
48+
bck=input(":")
49+
if bck=='#':
50+
options_menu( )
51+
else:
52+
sys.exit( )
53+
54+
exit( )
55+
56+
def upgrade_migrate( ):
57+
print("Welcome to our online Upgrade/Migration services.\n 1. Ugrade\n 2. Migrate")
58+
print("press # is go back to the Main Menu.")
59+
prompt = input("Enter preferred Choice:")
60+
if prompt=="1":
61+
time.sleep(5)
62+
print("Upgrading...")
63+
exit( )
64+
elif prompt == "2":
65+
time.sleep(5)
66+
print("Migrating...")
67+
exit( )
68+
elif prompt == "#":
69+
options_menu( )
70+
else:
71+
sys.exit( )
72+
73+
def balance ( ):
74+
print("ACCOUNT\tBALANCE\n CHECKER")
75+
print("press # is go back to the Main Menu.")
76+
pin=input("Enter your 4 digit pin:")
77+
# isdigit( ) is used to check for digits within a str while the nested if is used to make sure the user inputs 4 digits.
78+
79+
###```i am to put the pin trial in a while loop```###REMINDER!!!
80+
81+
if len(pin)!=4:
82+
print("Make sure its a 4digit pin.")
83+
time.sleep(5)
84+
balance( )
85+
else:
86+
if pin.isdigit( ):
87+
time.sleep(5)
88+
print("Loading...")
89+
exit( )
90+
elif pin== "#":
91+
options_menu( )
92+
else:
93+
time.sleep(15)
94+
print("wrong pin")
95+
sys.exit( )
96+
97+
def transf( ):
98+
print("1. Transfer self\n2. Transfer others")
99+
print("press # is go back to the Main Menu.")
100+
trnsf=input(":")
101+
if trnsf == "#" :
102+
options_menu( )
103+
elif trnsf == "1":
104+
time.sleep(5)
105+
print("Sending...")
106+
exit( )
107+
elif trnsf=="2":
108+
time.sleep(5)
109+
num=int(input("Enter receivers mobile number:"))
110+
print("Transferring to",num)
111+
exit( )
112+
else:
113+
if trnsf.isdigit( )!= True:
114+
time.sleep(5)
115+
print("Not an option")
116+
sys.exit( )
117+
elif trnsf.isdigit( ) and len(trnsf)>2:
118+
time.sleep( 5)
119+
print("wrong password.")
120+
sys.exit( )
121+
else:
122+
time.sleep(10)
123+
print("An error has occurred")
124+
sys.exit( )
125+
126+
def funds( ):
127+
time.sleep(3)
128+
print(bank_list)
129+
bnk = input("Select receipients Bank:")
130+
acc_num= input("Entet account number:")
131+
print("Sending to",acc_num)
132+
hash= input("1.Press # to go back to options menu\n2. Press * to go exit.")
133+
if hash == "#":
134+
options_menu( )
135+
elif hash == "*":
136+
exit( )
137+
else:
138+
sys.exit( )
139+
140+
#--------------------------------------------------
141+
###i'm yet to catch an error for non -digit and more than one digit###REMINDER!!! #-#------------------------------------------------------
142+
# This is the function for options.
143+
def options_menu( ) :
144+
print("1. Open Account\n2. Upgrade/Migrate\n3. Balance\n4. Transfer\n5. Funds")
145+
select_options ={
146+
'1':open_acct,
147+
'2':upgrade_migrate,
148+
'3': balance,
149+
'4':transf,
150+
'5':funds}
151+
choice=input("Enter an option:")
152+
if select_options.get(choice):
153+
select_options[choice]()
154+
else:
155+
sys.exit()
156+
157+
# This is the function which prompts the user as to whether the user wishes to continue or stop transaction.
158+
def exit( ):
159+
exit= input("Do you wish to make another transaction [Y/N] :")
160+
if exit== "N":
161+
sys.exit( )
162+
elif exit == "#":
163+
options_menu( )
164+
else:
165+
log_in( )
166+
167+
# This is the function for logging using the fast code *919#
168+
def log_in( ):
169+
try:
170+
a=0
171+
while a<3:
172+
a+=1
173+
USSD=input("ENTER USSD:")
174+
if(USSD !="*919#"):
175+
print("please re-enter USSD ...")
176+
else:
177+
print("Welcome to our online services how may we help you")
178+
options_menu( )
179+
exit( )
180+
else:
181+
time.sleep(10)
182+
print("checking discrepancies...")
183+
time.sleep(5)
184+
print("An error has occured.")
185+
186+
except:
187+
sys.exit( )
188+
189+
log_in( )

0 commit comments

Comments
 (0)