-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathContinental_user.py
More file actions
1376 lines (1164 loc) · 60.7 KB
/
Copy pathContinental_user.py
File metadata and controls
1376 lines (1164 loc) · 60.7 KB
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
##IMPORTING MODULES
from tkinter import *
from PIL import ImageTk, Image
from User_functions import login as lg, signup as sg
import captcha_project as cp
from tkinter import messagebox
import sys
from User_functions.emailserver import otp_email_sender_yagmail as mail
ID_info = ""
ID_info_initial = []
volatile = 0
Password = 0
variable = "new_cust"
lis = []
accntid = 0
wrong_login = 0
wrong_credentials = 0
wrong_otp = 0
card_number_initial = []
def intro():
global image_f
global login_register
login_register = Tk()
login_register.title("The Continental")
login_register.iconbitmap("Icon.ico")
login_register.geometry("540x640")
image = Image.open("Continental.png")
image = image.resize((520, 100), Image.ANTIALIAS)
image_f = ImageTk.PhotoImage(image)
image_g = image_f
logo = Label(login_register, image=image_g).grid(row=0, column=0, columnspan=3)
Butt1 = Button(login_register, text="LOGIN", command=login_page, height=5, width=50, bg="#B4B4B4").grid(row=1,
column=1)
gap_a = Label(login_register, text="", height=3).grid(row=2, column=0)
Butt2 = Button(login_register, text="REGISTER", command= lambda : account_selection(variable), height=5, width=50, bg="#B4B4B4").grid(
row=3, column=1)
gap_b = Label(login_register, text="", height=3).grid(row=4, column=0)
Butt3 = Button(login_register, text="CUSTOMER CARE", command=cust_care_page, height=5, width=50, bg="#B4B4B4").grid(
row=5, column=1)
gap_c = Label(login_register, text="", height=3).grid(row=6, column=0)
Butt4 = Button(login_register, text="EXIT", command=lambda: back(login_register), height=5, width=50,
bg="#B4B4B4").grid(row=7, column=1)
login_register.mainloop()
def login_page():
global image_f
global ID
global Pass
global login_screen
global volatile
volatile = 0
ID = StringVar()
Pass = StringVar()
login_screen = Toplevel()
login_screen.title("The Continental")
login_screen.iconbitmap("Icon.ico")
login_screen.geometry("860x550")
logo = Label(login_screen, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(login_screen, text="Enter Login Details", padx=50, pady=50)
frame.grid(row=2, column=0, columnspan=3, padx=10, pady=10)
# Login Details
label1 = Label(frame, font=("Calibri", 22), text="CustomerID: ").grid(row=0, column=0)
label2 = Label(frame, font=("Calibri", 22), text="Password: ").grid(row=2, column=0)
Gap1 = Label(frame, text=" ").grid(row=1, column=2)
global entry1
global entry2
entry1 = Entry(frame, font=("Calibri", 22), textvariable=ID, width=35)
entry1.grid(row=0, column=1)
entry2 = Entry(frame, font=("Calibri", 22), textvariable=Pass, width=35, show="*")
entry2.grid(row=2, column=1)
Gap2 = Label(frame, text=" ").grid(row=3, column=2)
Button_login = Button(frame, font=("Calibri", 22), text="Login", bg="#B4B4B4", command=login, width=15).grid(row=4,
column=1)
Gap3 = Label(frame, text=" ").grid(row=5, column=2)
Gap3 = Label(login_screen, text=" ").grid(row=1, column=2)
Button_exit = Button(login_screen, text="Back", highlightbackground="#B4B4B4", command=lambda: back(login_screen)).grid(row=6,
column=2,
sticky=E)
def login():
global ID_info
global entry1
global entry2
global account_list
from User_functions import accounts as acnt
global login_screen
global volatile
global ID_info_initial
ID_info = ID.get()
ID_info_initial.append(ID_info)
account_list = acnt.getno_of_acnts(ID_info)
try:
status = acnt.get_status_account(account_list[0])
name = acnt.get_name(ID_info)
if status == 'open':
if check_login():
message = messagebox.showinfo("LOGGED IN", f"Welcome {name}.", icon="info")
if message == "ok":
login_register.destroy()
accounts()
else:
message = messagebox.showerror("ERROR!", "Login Unsuccessful. \nTry Again")
if message == "ok":
entry2.delete(0, END)
else:
error = messagebox.showerror("ALERT!",
f"Your customer id is {status}\n Please contact customer care for more details")
if error == 'ok':
sys.exit(0)
else:
pass
except:
message = messagebox.showerror("ERROR!", "Login Unsuccessful. \nTry Again")
if message == 'ok':
pass
else:
pass
def check_login():
global ID_info
global Password
global wrong_login
from User_functions import accounts as acnt
global login_register
global ID_info_initial
ID_info = str(ID.get())
Password = int(Pass.get())
try:
if lg.login(ID_info,Password):
return True
elif ID_info_initial[wrong_login]==ID_info:
wrong_login+=1
if wrong_login == 4:
acnt.block_cust(ID_info)
mail.status_email(acnt.get_email(custid=ID_info),'customer id')
error = messagebox.showerror("ALERT!",
"You have entered the login details wrong 4 times\n YOUR ACCOUNT HAS BEEN BLOCKED\n Please contact customer care for more details")
wrong_login = 0
ID_info_initial = []
else:
return False
else:
wrong_login = 1
return False
except:
return False
def account_selection(variable):
global image_f
global login_register
global screen1
screen1 = Toplevel()
screen1.title("The Continental")
screen1.iconbitmap("Icon.ico")
screen1.geometry("530x455")
image = Image.open("Continental.png")
image = image.resize((520, 100), Image.ANTIALIAS)
image_f = ImageTk.PhotoImage(image)
logo = Label(screen1, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(screen1, text="Choose Account Type", padx=50, pady=50)
frame.grid(row=1, column=0, padx=10, pady=10)
global choice
choice = StringVar()
choice.set("CREDIT")
Radiobutton(frame, text="CREDIT", font=("Calibri", 22), variable=choice, value="CREDIT").grid(row=1, column=1)
Radiobutton(frame, text="DEBIT", font=("Calibri", 22), variable=choice, value="DEBIT").grid(row=2, column=1)
Radiobutton(frame, text="SAVINGS", font=("Calibri", 22), variable=choice, value="SAVINGS").grid(row=3, column=1)
Butt_next = Button(frame, text="NEXT", command=lambda: next_page(screen1), highlightbackground="#B4B4B4").grid(row=4, column=1)
if variable == "logged_in":
Butt_exit = Button(screen1, text="EXIT", command=lambda: back(account_screen), highlightbackground="#B4B4B4").grid(row=5,
column=0,
sticky=W)
Butt_back = Button(screen1, text="BACK", command=lambda: back(screen1), highlightbackground="#B4B4B4").grid(row=5, column=0,
sticky=E)
else:
Butt_exit = Button(screen1, text="EXIT", command=lambda: back(login_register), highlightbackground="#B4B4B4").grid(row=5,
column=0,
sticky=W)
Butt_back = Button(screen1, text="BACK", command=lambda: back(screen1), highlightbackground="#B4B4B4").grid(row=5, column=0,
sticky=E)
def credit_page_form():
global image_f
global incomeamt
global business_address
global ssno
global profitpa
global credit_screen
incomeamt = IntVar()
business_address = StringVar()
ssno = IntVar()
profitpa = IntVar()
credit_screen = Toplevel()
credit_screen.title("The Continental")
credit_screen.iconbitmap("Icon.ico")
credit_screen.geometry("850x630")
logo = Label(credit_screen, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(credit_screen, text="Enter The Necessary details for Credit Account", padx=50, pady=50)
frame.grid(row=1, column=0, padx=10, pady=10)
# Labels and Inputs
label_income = Label(frame, font=("Calibri", 20), text="Income: RS.\n(Per Annum)", height=2).grid(row=0, column=0)
label_businessaddress = Label(frame, font=("Calibri", 20), text="Business/Work Address: ", height=2).grid(row=1,
column=0)
label_socialsecno = Label(frame, font=("Calibri", 20), text="Social Security : \nNumber", height=2).grid(row=2,
column=0)
label_profitpa = Label(frame, font=("Calibri", 20), text="Profit : \n(Per Annum)", height=2).grid(row=3, column=0)
input_income = Entry(frame, font=("Calibri", 18), textvariable=incomeamt, width=35)
input_businessaddress = Entry(frame, font=("Calibri", 18), textvariable=business_address, width=35)
input_socialsecno = Entry(frame, font=("Calibri", 18), textvariable=ssno, width=35)
input_profitpa = Entry(frame, font=("Calibri", 18), textvariable=profitpa, width=35)
# Grid System
input_income.grid(row=0, column=1)
input_income.delete(0, END)
input_businessaddress.grid(row=1, column=1)
input_socialsecno.grid(row=2, column=1)
input_socialsecno.delete(0, END)
input_profitpa.grid(row=3, column=1)
input_profitpa.delete(0, END)
button_eligibility = Button(frame, font=("Calibri", 22), text="Check Eligibility", highlightbackground="#B4B4B4",
command=lambda: check_eligible(credit_screen), width=15).grid(row=4, column=1)
Butt_exit = Button(credit_screen, text="EXIT", command=lambda: back(login_register), highlightbackground="#B4B4B4").grid(row=5,column=0,sticky=W)
Butt_back = Button(credit_screen, text="BACK", command=lambda: back(credit_screen), highlightbackground="#B4B4B4").grid(row=5,column=0,sticky=E)
def register_page():
global image_f
global f_name
global l_name
global bday
global mailID
global password
global sex
global number
global ad
global cityID
global stateID
global aadharID
global pincode
global register_screen
f_name = StringVar()
l_name = StringVar()
bday = StringVar()
mailID = StringVar()
password = StringVar()
sex = StringVar()
sex.set("(Choose Gender)")
number = IntVar()
ad = StringVar()
cityID = StringVar()
stateID = StringVar()
aadharID = IntVar()
pincode = IntVar()
li = ["Male", "Female", "other"]
register_screen = Toplevel()
register_screen.title("The Continental")
register_screen.iconbitmap("Icon.ico")
register_screen.geometry("820x720")
logo = Label(register_screen, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(register_screen, text="Enter Necessary Details to Register", padx=50, pady=50)
frame.grid(row=2, column=0, columnspan=3, padx=10, pady=10)
# Labels
label_firstname = Label(frame, font=("Calibri", 18), text="First Name: ").grid(row=0, column=0)
label_lastname = Label(frame, font=("Calibri", 18), text="Last Name: ").grid(row=1, column=0)
label_dob = Label(frame, font=("Calibri", 18), text="DOB(YYYY-MM-DD): ").grid(row=2, column=0)
label_email = Label(frame, font=("Calibri", 18), text="Email: ").grid(row=3, column=0)
label_passwd = Label(frame, font=("Calibri", 18), text="Passwd: ").grid(row=4, column=0)
label_gender = Label(frame, font=("Calibri", 18), text="Gender: ").grid(row=5, column=0)
label_mobile = Label(frame, font=("Calibri", 18), text="Mobile: ").grid(row=6, column=0)
label_address = Label(frame, font=("Calibri", 18), text="Address: ").grid(row=7, column=0)
label_city = Label(frame, font=("Calibri", 18), text="City: ").grid(row=8, column=0)
label_state = Label(frame, font=("Calibri", 18), text="State: ").grid(row=9, column=0)
label_aadhar = Label(frame, font=("Calibri", 18), text="AadharID: ").grid(row=10, column=0)
label_zipcode = Label(frame, font=("Calibri", 18), text="Zipcode: ").grid(row=11, column=0)
# Input Fields
input_firstname = Entry(frame, font=("Calibri", 18), textvariable=f_name, width=35)
input_lastname = Entry(frame, font=("Calibri", 18), textvariable=l_name, width=35)
input_dob = Entry(frame, font=("Calibri", 18), textvariable=bday, width=35)
input_email = Entry(frame, font=("Calibri", 18), textvariable=mailID, width=35)
input_passwd = Entry(frame, font=("Calibri", 18), textvariable=password, show="*", width=35)
input_gender = OptionMenu(frame, sex, *li)
input_mobile = Entry(frame, font=("Calibri", 18), textvariable=number, width=35)
input_address = Entry(frame, font=("Calibri", 18), textvariable=ad, width=35)
input_city = Entry(frame, font=("Calibri", 18), textvariable=cityID, width=35)
input_state = Entry(frame, font=("Calibri", 18), textvariable=stateID, width=35)
input_aadhar = Entry(frame, font=("Calibri", 18), textvariable=aadharID, width=35)
input_zipcode = Entry(frame, font=("Calibri", 18), textvariable=pincode, width=35)
# Gridding Input Fields
input_firstname.grid(row=0, column=1)
input_lastname.grid(row=1, column=1)
input_dob.grid(row=2, column=1)
input_email.grid(row=3, column=1)
input_passwd.grid(row=4, column=1)
input_gender.grid(row=5, column=1, sticky=W)
input_mobile.grid(row=6, column=1)
input_mobile.delete(0, END)
input_address.grid(row=7, column=1)
input_city.grid(row=8, column=1)
input_state.grid(row=9, column=1)
input_aadhar.grid(row=10, column=1)
input_aadhar.delete(0, END)
input_zipcode.grid(row=11, column=1)
input_zipcode.delete(0, END)
# Register Button
Button_register = Button(frame, font=("Calibri", 22), text="Register", highlightbackground="#B4B4B4",
command=lambda: register(register_screen), width=15).grid(row=12, column=1)
Gap4 = Label(register_screen, text=" ").grid(row=14, column=2)
Button_back = Button(register_screen, text="Back", highlightbackground="#B4B4B4", command=lambda: back(register_screen)).grid(row=14,
column=2,
sticky=E)
Button_exit = Button(register_screen, text="Exit", highlightbackground="#B4B4B4", command=lambda: back(login_register)).grid(row=14,
column=0,
sticky=W)
##REGISTRATION PROCESS AND CONFIRMATION
def register(screen):
screen.destroy()
captcha_page("register","na","na",screen)
def accounts():
from User_functions import accounts as acnt
global account_screen
global ID_info
account_screen = Tk()
account_screen.title("The Continental")
account_screen.iconbitmap("Icon.ico")
account_list = acnt.getno_of_acnts(ID_info)
n = len(account_list)
n = n + 2
image = Image.open("Continental.png")
image = image.resize((520, 100), Image.ANTIALIAS)
image_f = ImageTk.PhotoImage(image)
logo = Label(account_screen, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(account_screen, text="Select Account", padx=250, pady=50)
frame.grid(row=1, column=0, padx=80, pady=20)
for i in range(len(account_list)):
status = acnt.get_status_account(int(account_list[i]))
if status == "blocked":
bg = "red"
else:
bg = "green"
button_account = Button(frame, font=("Calibri", 14), text=str(account_list[i]), highlightbackground = bg,
command=lambda a=i: get_account(account_list[a]), width = 5,height = 2).grid(row=i, column=1, padx=10,
pady=10)
if len(account_list) < 10:
button_add_ac = Button(frame, font=("Calibri", 8), text="Add Account", bg="#B4B4B4",
command=lambda: next_page(account_screen)).grid(row=n, column=1)
button_exit = Button(account_screen, text="EXIT", bg="#B4B4B4", command=lambda: back(account_screen)).grid(
row=n + 1, column=1, sticky=E, padx=10, pady=10)
account_screen.mainloop()
def get_account(ac_no):
global image_f
global menu
global accntid
from User_functions import accounts as acnt
accntid = ac_no
status = acnt.get_status_account(accntid)
if status == "blocked":
message = messagebox.showerror("ALERT",f"Your account is currently {status}\n Please contact customer care for more details")
else:
account_screen.destroy()
menu = Tk()
menu.title("The Continental")
menu.iconbitmap("Icon.ico")
image = Image.open("Continental.png")
image = image.resize((520, 100), Image.ANTIALIAS)
image_f = ImageTk.PhotoImage(image)
image_g = image_f
logo = Label(menu, image=image_g).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(menu, text="Account Number: " + str(ac_no))
frame.grid(row=1, column=0, padx=80, pady=20)
button_deposit = Button(frame, font=("Calibri", 18), text="Deposit", bg="#B4B4B4",
command=lambda: deposit_withdraw_transfer(mode="deposit"), padx=76).grid(row=0,
column=0,
padx=40,
pady=40)
button_mnstment = Button(frame, font=("Calibri", 18), text="Mini Statement", bg="#B4B4B4",
command=lambda: statement_page(ac_no), padx=45).grid(row=0, column=1, padx=40, pady=40)
button_withdraw = Button(frame, font=("Calibri", 18), text="Withdraw", bg="#B4B4B4",
command=deposit_withdraw_transfer, padx=60).grid(row=1, column=0, padx=40, pady=40)
button_transfer = Button(frame, font=("Calibri", 18), text="Transfer", bg="#B4B4B4",
command=lambda: deposit_withdraw_transfer(mode="transfer"), padx=80).grid(row=1,
column=1,
padx=40,
pady=40,
columnspan=1)
button_balance = Button(frame, font=("Calibri", 18), text="Check Balance", bg="#B4B4B4", command=lambda : balance_page(accntid),
padx=45).grid(row=2, column=0, columnspan=1, padx=40, pady=40)
button_apply = Button(frame, font=("Calibri", 18), text="Apply For Card", bg="#B4B4B4",
command=lambda: card_type_page(ac_no), padx=45).grid(row=2, column=1, columnspan=1,
padx=40, pady=40)
button_back = Button(menu, font=("Calibri", 10), text="Back", bg="#B4B4B4", command=lambda: back(menu)).grid(
row=4, column=1, padx=20, pady=10, sticky=E)
button_exit = Button(menu, font=("Calibri", 10), text="Exit", bg="#B4B4B4",
command=lambda: back(menu, value="exit")).grid(row=4, column=0, padx=20, pady=10, sticky=W)
menu.mainloop()
def back(screen, value="back"):
global credit_screen
global register_screen
global login_register
global screen1
global login_screen
global menu
global deposit_withdraw_transfer_page
global statement_screen
global card_type_screen
global cust_care_screen
global account_IDno
global ID_info
global captcha_screen
global card_page
global company_screen
global card_typo
if screen == credit_screen or screen == register_screen:
warning = messagebox.askquestion("Confirm Form Resubmission!",
"Turning back will take you to Account Selection Page!\n Do you wish to proceed ?")
if warning == 'yes':
account_selection(variable)
screen.destroy()
else:
pass
elif screen == login_register or screen == account_screen:
warning = messagebox.askquestion("WARNING!", "Are you sure You want to Exit?")
if warning == 'yes':
screen.destroy()
else:
pass
elif screen == screen1 or screen == login_screen or screen == deposit_withdraw_transfer_page or screen == statement_screen or screen == cust_care_screen or screen == card_type_screen:
screen.destroy()
elif screen == menu:
if value == "exit":
warning = messagebox.askquestion("WARNING!", "Are you sure You want to Exit?")
if warning == 'yes':
screen.destroy()
else:
pass
else:
screen.destroy()
accounts()
elif screen == amount_screen:
warning = messagebox.askquestion("Confirm Form Resubmission!",
"Turning back will take you to back to Menu!\n Do you wish to proceed ?")
if warning == 'yes':
screen.destroy()
else:
pass
elif screen == company_screen:
screen.destroy()
card_type_page(account_IDno)
elif screen == captcha_screen:
if value == "register":
warning = messagebox.askquestion("Confirm Form Resubmission!",
"Turning back will take you to Account Selection Page!\n Do you wish to proceed ?")
if warning == 'yes':
account_selection(variable)
screen.destroy()
else:
pass
elif value == "card_application":
screen.destroy()
card_company(card_typo)
elif screen == card_page:
screen.destroy()
card_type_page(account_IDno)
def deposit_withdraw_transfer(mode="withdraw"):
global image_f
global c_no
global expiry
global c_vv
global typo
global deposit_withdraw_transfer_page
global entry_a
global entry_b
global entry_c
global entry_d
global receiver_ac
global entry_receiver
global accntid
from User_functions.card_function import cardlog as cl
if cl.has_card(accntid):
c_no = IntVar()
expiry = StringVar()
c_vv = IntVar()
li = ["MASTER", "VISA"]
typo = StringVar()
typo.set("(Choose Type)")
receiver_ac = IntVar()
deposit_withdraw_transfer_page = Toplevel()
deposit_withdraw_transfer_page.title("The Continental")
deposit_withdraw_transfer_page.iconbitmap("Icon.ico")
deposit_withdraw_transfer_page.geometry("800x600")
image = Image.open("Continental.png")
image = image.resize((520, 100), Image.ANTIALIAS)
image_f = ImageTk.PhotoImage(image)
logo = Label(deposit_withdraw_transfer_page, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(deposit_withdraw_transfer_page, text=mode.upper())
frame.grid(row=1, column=0, padx=80, pady=20)
n = 0
if mode == "transfer":
n = 1
label_receiver = Label(frame, font=("Calibri", 18), text="Receiver's Acc. ID: ").grid(row=0, column=0,
pady=15,
padx=50)
entry_receiver = Entry(frame, font=("Calibri", 18), textvariable=receiver_ac, width=25)
entry_receiver.grid(row=0, column=1, padx=50)
entry_receiver.delete(0, END)
label1 = Label(frame, font=("Calibri", 18), text="Card Number: ").grid(row=n, column=0, pady=15, padx=50)
label2 = Label(frame, font=("Calibri", 18), text="Expiry Date: ").grid(row=n + 1, column=0, pady=15)
label3 = Label(frame, font=("Calibri", 18), text="CVV: ").grid(row=n + 2, column=0, pady=15)
label4 = Label(frame, font=("Calibri", 18), text="Type: ").grid(row=n + 3, column=0, pady=15)
entry_a = Entry(frame, font=("Calibri", 18), textvariable=c_no, width=25)
entry_a.delete(0, END)
entry_b = Entry(frame, font=("Calibri", 18), textvariable=expiry, width=25)
entry_c = Entry(frame, font=("Calibri", 18), textvariable=c_vv, show="*", width=25)
entry_c.delete(0, END)
entry_d = OptionMenu(frame, typo, *li)
entry_a.grid(row=n, column=1, padx=50)
entry_b.grid(row=n + 1, column=1)
entry_c.grid(row=n + 2, column=1)
entry_d.grid(row=n + 3, column=1)
enter = Button(frame, font=("Calibri", 18), text="ENTER", command=lambda: check_card(mode), highlightbackground="#B4B4B4",
padx=35).grid(row=n + 4, column=1, pady=30, sticky=W)
button_back = Button(deposit_withdraw_transfer_page, font=("Calibri", 10), text="Back", highlightbackground="#B4B4B4",
command=lambda: back(deposit_withdraw_transfer_page)).grid(row=n + 5, column=0, padx=50,
pady=10, sticky=E)
button_exit = Button(deposit_withdraw_transfer_page, font=("Calibri", 10), text="Exit", highlightbackground="#B4B4B4",
command=lambda: back(menu, value="exit")).grid(row=n + 5, column=0, padx=20, pady=10,
sticky=W)
else:
message = messagebox.showinfo("ERROR!","You do not have a transaction card\nPlease do apply for one by contacting Customer Care")
if message == "ok":
pass
def amount_page(mode):
global image_f
global entry_amt
global amount_screen
global amt_value
amt_value = IntVar()
deposit_withdraw_transfer_page.destroy()
amount_screen = Toplevel()
amount_screen.title("The Continental")
amount_screen.iconbitmap("Icon.ico")
logo = Label(amount_screen, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(amount_screen, text=mode.upper())
frame.grid(row=1, column=0, padx=80, pady=20)
label1 = Label(frame, font=("Calibri", 20), text="Enter Amount(in rupees): ").grid(row=0, column=0, pady=15,
padx=50, columnspan=3)
entry_amt = Entry(frame, font=("Calibri", 18), textvariable=amt_value)
entry_amt.grid(row=1, column=1, columnspan=3, sticky=W + E, padx=20, pady=10)
entry_amt.delete(0, END)
button_1 = Button(frame, font=("Calibri", 16), text="1", command=lambda: insert("1"), highlightbackground="#B4B4B4", padx=55,
pady=10).grid(row=2, column=1, pady=1, padx=1, columnspan=1)
button_2 = Button(frame, font=("Calibri", 16), text="2", command=lambda: insert("2"), highlightbackground="#B4B4B4", padx=52,
pady=10).grid(row=2, column=2, pady=1, padx=1, columnspan=1)
button_3 = Button(frame, font=("Calibri", 16), text="3", command=lambda: insert("3"), highlightbackground="#B4B4B4", padx=60,
pady=10).grid(row=2, column=3, pady=1, padx=1, columnspan=1)
button_4 = Button(frame, font=("Calibri", 16), text="4", command=lambda: insert("4"), highlightbackground="#B4B4B4", padx=55,
pady=10).grid(row=3, column=1, pady=1, padx=1, columnspan=1)
button_5 = Button(frame, font=("Calibri", 16), text="5", command=lambda: insert("5"), highlightbackground="#B4B4B4", padx=52,
pady=10).grid(row=3, column=2, pady=1, padx=1, columnspan=1)
button_6 = Button(frame, font=("Calibri", 16), text="6", command=lambda: insert("6"), highlightbackground="#B4B4B4", padx=60,
pady=10).grid(row=3, column=3, pady=1, padx=1, columnspan=1)
button_7 = Button(frame, font=("Calibri", 16), text="7", command=lambda: insert("7"), highlightbackground="#B4B4B4", padx=55,
pady=10).grid(row=4, column=1, pady=1, padx=1, columnspan=1)
button_8 = Button(frame, font=("Calibri", 16), text="8", command=lambda: insert("8"), highlightbackground="#B4B4B4", padx=52,
pady=10).grid(row=4, column=2, pady=1, padx=1, columnspan=1)
button_9 = Button(frame, font=("Calibri", 16), text="9", command=lambda: insert("9"), highlightbackground="#B4B4B4", padx=60,
pady=10).grid(row=4, column=3, pady=1, padx=1, columnspan=1)
button_0 = Button(frame, font=("Calibri", 16), text="0", command=lambda: insert("0"), highlightbackground="#B4B4B4", padx=55,
pady=10).grid(row=5, column=1, pady=1, padx=1, columnspan=1)
button_00 = Button(frame, font=("Calibri", 16), text="00", command=lambda: insert("00"), highlightbackground="#B4B4B4", padx=45,
pady=10).grid(row=5, column=2, pady=1, padx=1, columnspan=1)
button_clear = Button(frame, font=("Calibri", 16), text="Clear", command=lambda: entry_amt.delete(0, END),
highlightbackground="#B4B4B4", padx=45, pady=10).grid(row=5, column=3, pady=1, padx=1, columnspan=1)
enter = Button(frame, font=("Calibri", 18), text="ENTER", command=lambda: withdraw_or_deposit_value(mode),
highlightbackground="#B4B4B4", padx=35).grid(row=6, column=2, pady=30)
button_back = Button(frame, font=("Calibri", 10), text="Back", highlightbackground="#B4B4B4",
command=lambda: back(amount_screen)).grid(row=7, column=0, padx=50, pady=20, sticky=E)
button_exit = Button(frame, font=("Calibri", 10), text="Exit", highlightbackground="#B4B4B4",
command=lambda: back(menu, value="exit")).grid(row=7, column=4, padx=20, pady=20, sticky=W)
def insert(value):
string = entry_amt.get()
entry_amt.delete(0, END)
entry_amt.insert(0, string + value)
def withdraw_or_deposit_value(mode):
global c_no
global expiry
global c_vv
global typo
global amt_value
global receiver_ac
from User_functions.card_function import cardlog as cl
card_number = int(c_no.get()) # int
expiry_date = expiry.get() # string
cvv = int(c_vv.get()) # int
if typo.get() in ['MASTER','master','Master']:
card_type = 'mastercard'
else:
card_type = 'visa'
amount = int(amt_value.get()) # int
receiver_ac_id = 0
if mode == "transfer":
receiver_ac_id = receiver_ac.get()
##YOUR JOB
cardlimit = cl.get_limit(card_number)
status = cl.get_card_status(card_number)
if status == "open":
if amount>cardlimit:
message = messagebox.showinfo("ALERT!",f"You are exceeding {mode} limit.\nYou can {mode} only till Rs.{cardlimit}\n Try again")
if message == 'ok':
amount_screen.destroy()
amount_page(mode)
else:
question = messagebox.askquestion("ALERT!",
"Your process to " + mode + " needs OTP Verification!\nDo you wish to proceed ?")
if question == "yes":
amount_screen.destroy()
otp_page(amount, card_number,receiver_ac_id,mode)
else:
pass
else:
message = messagebox.showinfo("ALERT",f'Your card is {status}\nPlease contact admin for more details')
if message == 'ok':
amount_screen.destroy()
# amount_page(mode)
def check_card(mode="withdraw"):
global c_no
global expiry
global c_vv
global typo
global entry_a
global entry_b
global entry_c
global typo
global receiver_ac
global entry_receiver
from User_functions.card_function import cardlog as cl
global menu
global card_number_initial
receiver_ac_id = 0
if mode == "transfer":
receiver_ac_id = receiver_ac.get()
card_number = int(c_no.get())
card_number_initial.append(card_number)
status = cl.get_card_status(card_number)
if status == 'blocked':
error = messagebox.showinfo("ERROR!",f"Your card status is{status}\nPlease contact customer care for more details")
else:
expiry_date = str(expiry.get())
cvv = int(c_vv.get())
if typo.get() in ['VISA', 'visa', 'Visa']:
card_type = "visa"
else:
card_type = "mastercard"
output = confirm_card(card_number, expiry_date, cvv, card_type, receiver_ac_id)
if output == True:
success = messagebox.showinfo("SUCCESS!", "Your credentials have matched!\nClick OK to proceed")
if success == "ok":
deposit_withdraw_transfer_page.destroy()
amount_page(mode)
else:
error = messagebox.showerror("ERROR!", "Your credentials did not match!\nTry Again")
if error == "ok":
entry_a.delete(0, END)
entry_b.delete(0, END)
entry_c.delete(0, END)
if mode == "transfer":
entry_receiver.delete(0, END)
typo.set("(Choose Type)")
def confirm_card(card_number, expiry_date, cvv, card_type,reciever_ac_id=0):
from User_functions.card_function import cardlog as cl
global wrong_credentials
from User_functions import accounts as acnt
global card_number_initial
if cl.check_details(card_number,expiry_date,cvv,card_type):
card_number_initial = []
return True # USE YOUR CONFIRMATION PROGRAM HERE
else:
if card_number_initial[wrong_credentials] == card_number:
wrong_credentials+=1
if wrong_credentials == 4:
cl.block_card(ID_info,accntid,card_number)
mail.status_email(acnt.get_email(card_number),"card",card_number)
error = messagebox.showerror("ALERT!",
"Your have entered the credentials wrong 4 times\nYOUR CARD IS BLOCKED\nPlease contact customer care for more details")
wrong_credentials = 0
card_number_initial = []
if error == 'ok':
sys.exit(0)
else:
wrong_credentials = 1
return False
def statement_page(ac_no):
from User_functions import transaction as txn
from User_functions.card_function import cardlog as cl
global image_f
global statement_screen
lst = [["Transaction ID", "Date", "Time", "Action"]]
if cl.has_card(accntid):
cardno = cl.get_cardno(ac_no)
lst2 = []
for i in cardno:
lst2+=txn.ministatement(i)
else:
lst2 = [['NA', 'NA', 'NA', 'No transaction made till date']]
for i in range(len(lst2)):
lst.append(lst2[i])
total_rows = len(lst)
total_columns = len(lst[0])
statement_screen = Toplevel()
statement_screen.title("The Continental")
statement_screen.iconbitmap("Icon.ico")
logo = Label(statement_screen, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(statement_screen, text="MINI STATEMENT")
frame.grid(row=1, column=0, padx=30, pady=20)
label = Label(frame, text=" ").grid(row=0, column=0)
for i in range(total_rows):
for j in range(total_columns):
tab = Entry(frame, width=35,
font=('Arial', 16, 'bold'))
tab.grid(row=i + 1, column=j + 1)
tab.insert(END, lst[i][j])
tab.config(state="disabled")
label = Label(frame, text=" ").grid(row=i + 2, column=j + 2)
button_back = Button(statement_screen, font=("Calibri", 10), text="Back", bg="#B4B4B4",
command=lambda: back(statement_screen)).grid(row=i + 3, column=0, padx=50, pady=20, sticky=E)
button_exit = Button(statement_screen, font=("Calibri", 10), text="Exit", bg="#B4B4B4",
command=lambda: back(menu, value="exit")).grid(row=i + 3, column=0, padx=20, pady=20, sticky=W)
def otp_page(amount, card_number, receiver_ac_id, mode):
global otp_screen
global image_f
from User_functions import accounts as acnt
otp = mail.otp_mail(acnt.get_email(card_number))
otp_screen = Toplevel()
otp_screen.title("The Continental")
otp_screen.iconbitmap("Icon.ico")
logo = Label(otp_screen, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(otp_screen, text="OTP VERIFICATION")
frame.grid(row=1, column=0, padx=80, pady=20)
otp_value = IntVar()
label1 = Label(frame, font=("Calibri", 20), text="Enter Sent OTP: ").grid(row=0, column=0, pady=15, padx=50,
columnspan=3)
entry_otp = Entry(frame, font=("Calibri", 18), textvariable=otp_value)
entry_otp.grid(row=1, column=0, padx=20, pady=10)
entry_otp.delete(0, END)
button_enter = Button(frame, font=("Calibri", 18), text="ENTER", highlightbackground="#B4B4B4",
command=lambda: check_otp(otp, otp_value.get(), amount, card_number, receiver_ac_id,
mode)).grid(row=2, column=0, padx=20, pady=50)
def check_otp(generated, entered, amount, card_number,reciever_ac_id, mode):
from User_functions import transaction as txn
if generated == entered:
success = messagebox.showinfo("Success!",
"OTP Verification Complete!\nYour Transaction is being processed.\nClick OK to return to confirm finally")
if success == "ok":
if mode == "withdraw":
result = txn.withdraw(amount,card_number)
elif mode == 'deposit':
result = txn.deposit(amount,card_number)
else:
result = txn.transfer(amount,card_number,reciever_ac_id)
success2 = messagebox.showinfo("success!",result)
if success2 == "ok":
otp_screen.destroy()
else:
error = messagebox.showerror("ERROR!", "OTP Verification Failed!\n Otp Did not match.\nPlease Try Again")
otp_screen.destroy()
def balance_page(accntid):
from User_functions.card_function import cardlog as cl
try:
balance = cl.get_balance(accntid)
message = messagebox.showinfo("BALANCE",f"Your current balance is{balance}")
if message == "ok":
pass
else:
pass
except:
message = messagebox.showinfo("ERROR!",
"You do not have a transaction card\nPlease do apply for one by contacting Customer Care")
if message == "ok":
pass
def cust_care_page():
global image_f
global cust_care_screen
cust_care_screen = Toplevel()
cust_care_screen.title("The Continental")
cust_care_screen.iconbitmap("Icon.ico")
logo = Label(cust_care_screen, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(cust_care_screen, text="REQUEST")
frame.grid(row=1, column=0, padx=80, pady=20)
request_type = StringVar()
request_type.set("(Choose Type)")
li = ["service status", "update records", "others"]
label = Label(frame, font=("Calibri", 20), text="Enter your Customer ID: ").grid(row=0, column=0, pady=15, padx=50,
sticky=W)
label = Label(frame, font=("Calibri", 20), text="Request Type: ").grid(row=1, column=0, columnspan=2, pady=15,
padx=50, sticky=W)
label = Label(frame, font=("Calibri", 20), text="Please type your report/complain here: ").grid(row=2, column=0,
columnspan=2,
pady=15, padx=50,
sticky=W)
entry_id = Entry(frame, font=("Calibri", 18), width=30)
entry_id.grid(row=0, column=0, padx=20, pady=10, columnspan=2, sticky=E)
entry_type = OptionMenu(frame, request_type, *li)
entry_type.grid(row=1, column=0, padx=20, pady=10, columnspan=2)
text_field = Text(frame, font=("Calibri", 18), width=60, height=5)
text_field.grid(row=2, column=0, columnspan=2, padx=20, pady=10)
button_enter = Button(frame, font=("Calibri", 16), text="ENTER", bg="#B4B4B4",
command=lambda: process_request(entry_id.get(), text_field.get("1.0", "end-1c"),
request_type.get()), width=20).grid(row=3, column=0,
columnspan=1, padx=20,
pady=20, sticky=E)
button_back = Button(frame, font=("Calibri", 10), text="Back", bg="#B4B4B4",
command=lambda: back(cust_care_screen)).grid(row=4, column=2, padx=20, pady=20, sticky=E)
button_exit = Button(frame, font=("Calibri", 10), text="Exit", bg="#B4B4B4",
command=lambda: back(login_register)).grid(row=4, column=0, padx=20, pady=20, sticky=W)
def process_request(cust_id, request, request_type):
global cust_care_screen
from admin_functions import request_admin as r
print(cust_id, request, request_type)
##SAVE YOUR REQUEST FROM HERE
r.add_request(cust_id,request,request_type)
success = messagebox.showinfo("Success!", "Your Request/Complain has been recorded!\nClick OK to return to Menu")
if success == "ok":
cust_care_screen.destroy()
def card_type_page(ac_no):
global image_f
global menu
global card_type_screen
global account_IDno
account_IDno = ac_no
card_type_screen = Toplevel()
card_type_screen.title("The Continental")
card_type_screen.iconbitmap("Icon.ico")
card_type_screen.geometry("530x455")
logo = Label(card_type_screen, image=image_f).grid(row=0, column=0, columnspan=3)
frame = LabelFrame(card_type_screen, text="Choose Card Type", padx=50, pady=50)
frame.grid(row=1, column=0, padx=110, pady=10)
global card_type_choice
card_type_choice = StringVar()
card_type_choice.set("CREDIT")
Radiobutton(frame, text="CREDIT", font=("Calibri", 22), variable=card_type_choice, value="CREDIT").grid(row=1,
column=1)
Radiobutton(frame, text="DEBIT", font=("Calibri", 22), variable=card_type_choice, value="DEBIT").grid(row=2,
column=1)
Butt_next = Button(frame, text="NEXT",
command=lambda: next_page(card_type_screen, card_type=card_type_choice.get()),
bg="#B4B4B4").grid(row=3, column=1)
Butt_exit = Button(card_type_screen, text="EXIT", command=lambda: back(menu, value="exit"), bg="#B4B4B4").grid(
row=4, column=0, sticky=W)
Butt_back = Button(card_type_screen, text="BACK", command=lambda: back(card_type_screen), bg="#B4B4B4").grid(row=4,
column=0,
sticky=E)
def check_eligible(screen):
import User_functions.signup as sg
global incomeamt
global business_address
global ssno
global profitpa