-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccessbank.py
More file actions
144 lines (112 loc) · 5.53 KB
/
accessbank.py
File metadata and controls
144 lines (112 loc) · 5.53 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
import mysql.connector
connect = mysql.connector.connect(host='127.0.0.1', user='root', passwd='' , database='verification')
manage = connect.cursor()
import re
import random
press = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
# PHONE NUMBER VERIFICATION AND NETWORK IDENTIFIER METHOD USING LIST METHOD( NO ERROR)
mtn = ['0803','0806','0814','0810','0813','0814','0816','0703','0706','0903','0906','+234803','+234806','+234814','+234810','+234813','+234814','+234816','+234703','+234706','+234903','+234906']
# PHONE NUMBER VERIFICATION AND NETWORK IDENTIFIER PROVEN NOT ACCURATE
mwork = r'(^0[7|8|9]{1}[0|1]{1}[0-9]{8})|(^\+234{1}[7|8|9]{1}[0|1]{1}[0|1|3|4|6]{1}[0-9]{7})'
# mwork = r'\d{0803}\d{0806}\d{0814}\d{0813}\d{0816}\d{0703}\d{0706}\d{0903}\d{0906}\d{0904}'
# mwork = r'\d{0803}\d{0806}\d{0814}\d{0813}\d{0816}\d{0703}\d{0706}\d{0903}\d{0906}\d{0904}'
# ((^0)(7|8|9{1}()))
# ((^0)(7|8|9){1}(0|1){1}[0–9]{8}))
# this expressions matches:
# (^0) any text that begins with a “0”, followed by
# (7|8|9){1} exactly one occurrence of any of the text “7”, “8” or “9”, followed by
# (0|1){1} exactly one occurrence of any of the text “0” or “1”, followed by
# [0–9]{8} eight occurrences of any digit from 0 to 9.
# The regular expression we have discussed, will validate Nigerian phone numbers from the popular carriers in whatever form they are written.
# # CREATE DATABASE
# manage.execute("CREATE DATABASE verification")
# manage.execute("SHOW DATABASES")
# for db in manage:
# print(db)
# MTN = [0803,0806,0814,0810,0813,0814,0816,0703,0706,0903,0906]
# CREATE TABLE
# manage.execute("CREATE TABLE newdata (Mobile_Number varchar(11), BVN INT(12))")
# manage.execute("SHOW TABLES")
# for table in manage:
# print(table)
# manage.execute("ALTER TABLE accessbank add column total_balance INT (10) NOT NULL")
# manage.execute("SHOW TABLES")
# for table in manage:
# print(table)
# ALTER TABLE
# manage.execute("ALTER TABLE newdata add Service_Oper VARCHAR (12) NOT NULL")
# manage.execute("SHOW TABLES")
# for table in manage:
# print(table)
class Verify:
def __init__(self):
self.vn= 'vn'
def bvn(self):
phone = input("Enter your Mobile Number>>>>:")
if phone[:4] in mtn and len(phone)==11 or phone[:7] in mtn and len(phone)==14:
# if(re.search(mwork, self.Mobile_Number)):
print("MTN")
else:
print("Invalid Phone Number")
# BVN GENERATOR VALIDAATE AND GOES INTO DATABASE
self.bvn = random.randrange(222222222222, 222222222852)
bank_customer = 'INSERT into newdata (Mobile_Number, Bvn) VALUES(%s,%s)'
details = (phone, self.bvn)
manage.execute(bank_customer, details)
connect.commit()
print(manage.rowcount, 'record(s) inserted successfully')
print(f'You have signed up successfully')
print(f'Your BVN is {self.bvn}!')
def confirm(self):
self.bvn = input("Enter your BVN for Verification>>>>:")
check = input("confirm your BVN for Verification>>>>:")
if check == self.bvn:
print("Your BVN has been successfully verified!")
else:
print("Wrong BVN,Please recheck and try later!")
quit()
var = Verify()
var.bvn()
var.confirm()
# phone = input("Enter your phone number")
# if phone(:4) in mtn and len(phone)==11 or phone(:7) in mtn and len(phone)==13:
# print("MTN")
# MTN = [0803,0806,0814,0810,0813,0814,0816,0703,0706,0903,0906]
# phone = input("Enter your Phone Number")
# if re.search("\d{0}\d{7}\d{0}\d{3},\d{0}\d{7}\d{0}\d{6},\d{0}\d{8}\d{0}\d{3},\d{0}\d{8}\d{0}\d{6},\d{0}\d{8}\d{1}\d{0}\d{0}\d{8}\d{1}\d{3},\d{0}\d{8}\d{1}\d{4},\d{0}\d{8}\d{1}\d{6},\d{0}\d{9}\d{0}\d{3},\d{0}\d{9}\d{0}\d{6},\d{0}\d{9}\d{1}\d{3} ," phone ):
# print(MTN)
# glo = [0805,0807, 0705, 0815, 0811, 0905]
# Airtel = [0802, 0808, 0812,0701,0708,0902,0907,0901]
# ninemobile = [0809,0817,0818,0908,0909]
# phone = input("Enter your mobile number")
# def customer_signup(self):
# print(f'Welcome to Access Bank,Please sign up to enjoy our services')
# self.firstname = input('Enter your Firstname>>>:')
# self.surname = input('Enter your Surname>>>:')
# self.email = input('Enter your email>>>:')
# if(re.fullmatch(press, self.email)):
# print('Email Valid')
# else:
# print("Please Enter a valid Email")
# quit()
# self.password = input('Password>>:')
# self.con_password = input('Confirm Password')
# if self.con_password != self.password:
# print('Password not the same')
# quit()
# else:
# print('Password Verified!')
# self.bvn = int(input('Enter your BVN'))
# self.username = input('Enter your username')
# self.pin = int(input('Enter your pin'))
# self.confirm_pin = int(input('Confirm your Pin'))
# if self.pin == self.confirm_pin:
# print(f'Welcome {self.firstname}!\n Enjoy Banking with us!')
# else:
# print('Pin not Verified!')
# quit()
# bank_customer = 'INSERT into accessbank (Firstname, Surname, Email, Password, bvn, Username, Pin, Account_number, Deposit, Withdrawal, Account_Balance) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'
# details = (self.firstname, self.surname, self.email, self.password, self.bvn, self.username, self.pin, 0, 0, 0, 0)
# manage.execute(bank_customer, details)
# connect.commit()
# print(manage.rowcount, 'record(s) inserted successfully')