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+ print (gen_bvn )
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+ print (details )
43+ print ("1. Press # to go back to options menu\n 2. Press * to exit" )
44+ bck = input (":" )
45+ if bck == '#' :
46+ options_menu ( )
47+ else :
48+ sys .exit ( )
49+
50+ exit ( )
51+
52+ def upgrade_migrate ( ):
53+ print ("Welcome to our online Upgrade/Migration services.\n 1. Ugrade\n 2. Migrate" )
54+ print ("press # is go back to the Main Menu." )
55+ prompt = int (input ("Enter preferred Choice:" ))
56+ if prompt == 1 :
57+ time .sleep (5 )
58+ print ("Upgrading..." )
59+ exit ( )
60+ elif prompt == 2 :
61+ time .sleep (5 )
62+ print ("Migrating..." )
63+ exit ( )
64+ elif prompt == "#" :
65+ options_menu ( )
66+ else :
67+ sys .exit ( )
68+
69+ def balance ( ):
70+ print ("ACCOUNT\t BALANCE\n CHECKER" )
71+ print ("press # is go back to the Main Menu." )
72+ pin = input ("Enter your 4 digit pin:" )
73+ # isdigit( ) is used to check for digits within a str while the nested if is used to make sure the user inputs 4 digits.
74+
75+ ###```i am to put the pin trial in a while loop```###REMINDER!!!
76+
77+ if len (pin )!= 4 :
78+ print ("Make sure its a 4digit pin." )
79+ time .sleep (5 )
80+ balance ( )
81+ else :
82+ if pin .isdigit ( )== True :
83+ time .sleep (5 )
84+ print ("Loading..." )
85+ exit ( )
86+ elif pin == "#" :
87+ options_menu ( )
88+ else :
89+ time .sleep (15 )
90+ print ("wrong pin" )
91+ sys .exit ( )
92+
93+ def transf ( ):
94+ print ("1. Transfer self\n 2. Transfer others" )
95+ print ("press # is go back to the Main Menu." )
96+ trnsf = input (":" )
97+ if trnsf == "#" :
98+ options_menu ( )
99+ elif trnsf == "1" :
100+ time .sleep (5 )
101+ print ("Sending..." )
102+ exit ( )
103+ elif trnsf == "2" :
104+ time .sleep (5 )
105+ num = int (input ("Enter receivers mobile number:" ))
106+ print ("Transferring to" ,num )
107+ exit ( )
108+ else :
109+ if trnsf .isdigit ( )!= True :
110+ time .sleep (5 )
111+ print ("Not an option" )
112+ sys .exit ( )
113+ elif trnsf .isdigit ( )== True and len (trnsf )> 2 :
114+ time .sleep ( 5 )
115+ print ("wrong password." )
116+ sys .exit ( )
117+ else :
118+ time .sleep (10 )
119+ print ("An error has occurred" )
120+ sys .exit ( )
121+
122+ def funds ( ):
123+ time .sleep (3 )
124+ print (bank_list )
125+ bnk = input ("Select receipients Bank:" )
126+ acc_num = input ("Entet account number:" )
127+ print ("Sending to" ,acc_num )
128+ hash = input ("1.Press # to go back to options menu\n 2. Press * to go exit." )
129+ if hash == "#" :
130+ options_menu ( )
131+ elif hash == "*" :
132+ exit ( )
133+ else :
134+ sys .exit ( )
135+
136+ #--------------------------------------------------
137+ ###i'm yet to catch an error for non -digit and more than one digit###REMINDER!!! #-#------------------------------------------------------
138+ # This is the function for options.
139+ def options_menu ( ) :
140+ print ("1. Open Account\n 2. Upgrade/Migrate\n 3. Balance\n 4. Transfer\n 5. Funds" )
141+ choice = input ("Enter an option:" )
142+ if choice == "1" :
143+ time .sleep (10 )
144+ open_acct ( )
145+ elif choice == "2" :
146+ time .sleep (10 )
147+ upgrade_migrate ( )
148+ elif choice == "3" :
149+ time .sleep (10 )
150+ balance ( )
151+ elif choice == "4" :
152+ time .sleep (10 )
153+ transf ( )
154+ elif choice == "5" :
155+ time .sleep (10 )
156+ funds ( )
157+ else :
158+ time .sleep (5 )
159+ print ("Not an option." )
160+ sys .exit ( )
161+
162+ # This is the function which prompts the user as to whether the user wishes to continue or stop transaction.
163+ def exit ( ):
164+ exit = input ("Do you wish to make another transaction [Y/N] :" )
165+ if exit == "N" :
166+ sys .exit ( )
167+ elif exit == "#" :
168+ options_menu ( )
169+ else :
170+ log_in ( )
171+
172+ # This is the function for logging using the fast code *919#
173+ def log_in ( ):
174+ try :
175+ a = 0
176+ while a < 3 :
177+ a += 1
178+ USSD = input ("ENTER USSD:" )
179+ if (USSD != "*919#" ):
180+ print ("please re-enter USSD ..." )
181+ else :
182+ print ("Welcome to our online services how may we help you" )
183+ options_menu ( )
184+ exit ( )
185+ else :
186+ time .sleep (10 )
187+ print ("checking discrepancies..." )
188+ time .sleep (5 )
189+ print ("An error has occured." )
190+
191+ except :
192+ sys .exit ( )
193+
194+ log_in ( )
0 commit comments