-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
355 lines (308 loc) · 10.1 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
from time import sleep
import random
def Code(x):
if x == "*966#":
print("loading......")
sleep(2.5)
secondPage()
else:
print("loading......")
sleep(2.5)
print("ussd code not recognised.")
def secondPage():
print("**************************************************")
print("Welcome to StarLink bank Plc eazy money.\n"
"Enter a number according to the service you want.")
print("1. Open Account.\n"
"2. Register.\n"
"3. Transfers.\n"
"4. Airtime.\n"
"5. Data.\n"
"6. Check Balance.")
response()
def response():
res = int(input(">: "))
if res == 1:
return openAccount()
elif res == 2:
return register()
elif res == 3:
return transfers()
elif res == 4:
return airtime()
elif res == 5:
return data()
else:
return checkBalance()
def openAccount():
print("***************************************************************")
print("Kindly fill in the form down below to create an account with us.")
while True:
try:
firstname = str(input("enter your firstname: "))
print("Name accepted.")
break
except ValueError:
print("invalid response")
while True:
try:
middlename = str(input("enter your middlename: "))
if middlename == "":
pass
else:
print("Name accepted")
break
break
except ValueError:
print("invalid response")
while True:
try:
lastname = str(input("enter your lastname: "))
print("Name accepted")
break
except ValueError:
print("invalid response")
while True:
try:
dob = int(input("enter your date of birth(in order of dd/mm/yyyy): "))
print("Accepted value")
break
except ValueError:
print("Invalid response")
while True:
try:
currentAddress = str(input("enter your current residency location: "))
print("Accepted value")
break
except ValueError:
print("Invalid response")
while True:
try:
nin = input("enter your NIN: ")
if len(nin) == 11:
print("Accepted value")
break
else:
print("Incomplete, check again.")
except ValueError:
print("Invalid response")
while True:
try:
bvn = input("enter your BVN: ")
if len(bvn) == 11:
print("Accepted value")
break
else:
print("Incomplete, check again.")
except ValueError:
print("Invalid response")
while True:
try:
phoneNumber = input("enter a working Phone NUmber: ")
if len(phoneNumber) == 11:
print("Accepted value")
break
else:
print("Incomplete, check again.")
except ValueError:
print("Invalid response")
accountNumber = random.getrandbits(33)
print("*********************************************************")
print("Thank you for providing the following details.\n"
"Kindly wait while your account number is being generated.")
print("processing......")
sleep(3.0)
print("Congratulations! Account successfully created!")
newUser = {
"firstname": firstname.capitalize(),
"middlename": middlename.capitalize(),
"lastname": lastname.capitalize(),
"date of birth": dob,
"currentAddress": currentAddress,
"nin": nin,
"bvn": bvn,
"phonenumber": phoneNumber,
}
def accountDetails():
print("Account name: ", newUser.get("firstname"), newUser.get("middlename"), newUser.get("lastname"))
print("Account number: ", accountNumber)
print("********************************************************")
accountDetails()
print("Thank you for banking with us.")
print("********************************************************")
def register():
print("********************************************************")
while True:
decide = input("Would you like to register for a debit card? y/n: ")
if decide == "y":
print("processing............")
sleep(2.5)
print("********************************************************")
print("You have successfully registered for a debit card.\n"
"Visit our nearby branch to collect your card.")
print("********************************************************")
break
else:
print("Thank you for visiting!")
def transfers():
banklist = {
"1": "Union Bank",
"2": "Zenith Bank",
"3": "UBA",
"4": "Access/Diamond Bank",
"5": "Sterling Bank",
"6": "Ecobank Bank",
}
print("**************************************************")
while True:
try:
acct = str(input("Enter account number: "))
if len(acct) == 10:
pass
break
else:
print("check account number")
except ValueError:
print("invalid response")
for i, j in banklist.items():
print(f"{i}. {j}")
bank = int(input("Select bank: "))
while True:
try:
amount = str(input("Enter amount: "))
if len(amount) > 1:
pass
break
else:
print("invalid amount")
except ValueError:
print("invalid response")
while True:
try:
pinn = str(input("Enter pin: "))
if len(pinn) == 4:
print("Valid pin.")
break
else:
print("invalid pin")
except ValueError:
print("invalid response")
print("processing............")
sleep(2.5)
print("***************************************************************")
print(f"{amount} has been successfully transferred to {acct}, {bank}")
print("Thank you for banking with us.")
print("***************************************************************")
def airtime():
network = {
"1": "Glo",
"2": "MTN",
"3": "Airtel",
"4": "9mobile"
}
print("**************************************************")
while True:
try:
phonenumber = str(input("Enter phone number: "))
if len(phonenumber) == 11:
pass
break
else:
print("check phone number.")
except ValueError:
print("invalid response")
while True:
try:
amount2 = str(input("Enter amount: "))
if len(amount2) > 2:
pass
break
else:
print("check amount number.")
except ValueError:
print("invalid response")
while True:
try:
pin2 = str(input("Enter pin: "))
if len(pin2) == 4:
pass
break
else:
print("check pin.")
except ValueError:
print("invalid response")
print("processing............")
sleep(2.5)
print("***************************************************************")
print(f"{amount2} has been successfully credited to {phonenumber}")
print("Thank you for banking with us.")
print("***************************************************************")
def data():
plans = {
"1": "4.5(9)GB",
"2": "6(12)GB",
"3": "10(20)GB",
"4": "12(24)GB",
"5": "20(40)GB",
"6": "40(80)GB",
"7": "75(150)GB",
}
network2 = {
"1": "Glo",
"2": "MTN",
"3": "Airtel",
"4": "9mobile"
}
print("**************************************************")
while True:
try:
phonenumber2 = str(input("Enter phone number: "))
if len(phonenumber2) == 11:
pass
break
else:
print("check phone number.")
except ValueError:
print("invalid response")
for key, value in network2.items():
print(f"{key}. {value}")
net = input("select network: ")
for key, value in plans.items():
print(f"{key}. {value}")
plan = str(input("select plan: "))
while True:
try:
pin2 = str(input("Enter pin: "))
if len(pin2) == 4:
pass
break
else:
print("check pin.")
except ValueError:
print("invalid response")
print("processing............")
sleep(2.5)
print("***************************************************************")
print(f"{phonenumber2} has been successfully credited with {plans.get(plan)}.")
print("Thank you for banking with us.")
print("***************************************************************")
def checkBalance():
accountBalance = "N1,000,000,000.00"
print("***************************************************************")
while True:
try:
pin3 = str(input("Enter pin: "))
if len(pin3) == 4:
pass
break
else:
print("check pin.")
except ValueError:
print("invalid response")
print("processing............")
sleep(2.5)
print(f"Your account balance is: {accountBalance}")
print("Thank you for banking with us.")
print("*******************************************")
pin = input(">: ")
Code(pin)