-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOnlineBanking.py
175 lines (156 loc) · 6.19 KB
/
OnlineBanking.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
class B(object):
def __init__(self,password=''):
self.password=password
def lower(self):
lower=any(c.islower() for c in self.password)
return lower
def upper(self):
upper= any(c.isupper() for c in self.password)
return upper
def digit(self):
digit=any(c.isdigit() for c in self.password)
return digit
def validation(self):
lower=self.lower()
upper=self.upper()
digit=self.digit()
length=len(self.password)
cond=lower and upper and digit and length >=6 and length<=10
if cond==True:
print("\nUser Created Successfully\n")
elif not lower:
print("Include a lowerCase ")
exit()
elif not upper:
print("Include a upperCase")
exit()
elif not digit:
print("Include a digit")
exit()
elif not length>=6 and length<=10:
print("Password length must be 6-10 characters\n ")
exit()
class A(object):
def __init__(self):
pass
print("\n\n*****WELCOME TO SMU BANKING*****\n")
print("If you are new please create an account or Sign In with your existing account\n")
acc=input("If you have already created and account, type 'Y' else 'N' \n")
def Database(data,data1):
content=open('BankingDatabase.txt','w')
content.write(data)
content.write(" ")
content.write(data1)
content.write(" ")
content.close()
def Login():
user=input("Enter your User name\n")
pwd=input("Enter your password\n")
content=open('BankingDatabase.txt','r')
L=content.readlines()
for i in L:
L1=i.split()
while user and pwd not in L1:
print("User NOT FOUND!\n")
print("TRY AGAIN!")
user=input("\nEnter your User name\n")
pwd=input("Enter your password\n")
print("\n LOGGED IN!\n Welcome "+user)
def Transaction():
print("\nYour Last 5 transactions\n")
print("Date\t\t Transactions\t\t\t Amount\n")
print("8/11/202\t ATM w/d Kpg\t\tRs.2000")
print("9/11/202\t Credited from Nik\t Rs.5000")
print("10/11/202\t Electricity Bill Payed Rs.560")
print("8/11/202\t Paid at KFC \t\t Rs.999")
print("8/11/202\t Transfer to SMIT\t Rs.95000")
def Balance():
print("\n***ACCOUNT DETAILS***\n")
print("Name: "+user)
bal=int(10000)
print("Available Balance: ",bal)
return bal
def Transfer():
naam=input("Enter the Payee Name: ")
ac=int(input("Enter the 11 Digits Account Number: "))
amt=int(input("ENter the amount: "))
cnf=input("Y to Pay, N to Cancel")
if cnf=='Y':
print("\n ---Payment Successful----\n")
print("Payer Name: "+user)
print("\nPayee Name: "+naam)
print("Account Number: ",ac)
print("Amount Paid: ",amt)
avlbal1=Balance()
avlbal=avlbal1-amt
print(avlbal)
elif cnf=='N':
print("Transaction Cancelled!!!")
def payment():
ch=int(input("\n 1. Dth\n 2. Mobile\n 3. Electricty"))
if ch==1:
id=input("Enter your Dth No.: ")
am=int(input("Enter the amt: "))
cnf=input("Y to Pay, N to Cancel")
if cnf=='Y':
print("\n ---Payment Successful----\n")
print("Id: "+id)
print("Amount Paid: ",am)
avlbal1=Balance()
avlbal=avlbal1-am
print(avlbal)
elif cnf=='N':
print("Transaction Cancelled!!!")
elif ch==2:
id=input("Enter your Mobile No.: ")
am=int(input("Enter the amt: "))
cnf=input("Y to Pay, N to Cancel")
if cnf=='Y':
print("\n ---Payment Successful----\n")
print("Id: "+id)
print("Amount Paid: ",am)
avlbal1=Balance()
avlbal=avlbal1-am
print(avlbal)
elif cnf=='N':
print("Transaction Cancelled!!!")
elif ch==3:
id=input("Enter your Consumer No.: ")
am=int(input("Enter the amt: "))
cnf=input("Y to Pay, N to Cancel")
if cnf=='Y':
print("\n ---Payment Successful----\n")
print("Id: "+id)
print("Amount Paid: ",am)
avlbal1=Balance()
avlbal=avlbal1-am
print(avlbal)
elif cnf=='N':
print("Transaction Cancelled!!!")
def Logout():
print("\n LOGGED OUT SUCCESSFULLY!!!")
choose=int(input("\nType 1: For Last Five Transactions\nType 2: View your account balance\nType 3: Pay Bills\nType 4: Money Transfer\nType 5: Logout\n"))
while choose!=5:
if choose==1:
Transaction()
elif choose==2:
Balance()
elif choose==3:
payment()
elif choose==4:
Transfer()
choose=int(input("\nType 1: For Last Five Transactions\nType 2: View your account balance\nType 3: Pay Bills\nType 4: Money Transfer\nType 5: Logout\n"))
Logout()
#choice={1:Transaction,2:Balance,3:payment,4:Transfer,5:Logout}
#print(choice)
#obj1=C()
#check1=obj1.AForm()
if acc=='Y':
Login()
elif acc=='N':
user=input("Create a user Id\n")
pwd=input("Create a password\n")
obj=B(pwd)
obj.validation()
Database(user,pwd)
Login()