verify pin
This commit is contained in:
+41
@@ -95,6 +95,47 @@ def salary_login():
|
||||
"data": None
|
||||
}, 500
|
||||
|
||||
@app.route('/salary/verifypin', methods=["POST"])
|
||||
def salary_verifypin():
|
||||
try:
|
||||
data = request.json
|
||||
if not data:
|
||||
return {
|
||||
"message": "Please provide pin",
|
||||
"data": None,
|
||||
"error": "Bad request"
|
||||
}, 400
|
||||
# validate input
|
||||
bvn = data["bvn"]
|
||||
pin = data["pin"]
|
||||
SELECT_ACC = "SELECT id, uid,pin,bvn FROM demo_bank_accounts WHERE bvn='" + bvn + "' AND pin = '" + pin + "' "
|
||||
with connection:
|
||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||
cursor.execute(SELECT_ACC)
|
||||
account = cursor.fetchall()
|
||||
|
||||
account_found = count = len( account )
|
||||
|
||||
if account_found == 1 :
|
||||
return {
|
||||
"status": "1",
|
||||
"data": account
|
||||
}, 201
|
||||
else:
|
||||
return {
|
||||
"status": "-1",
|
||||
"data": None,
|
||||
"error": "1"
|
||||
}, 404
|
||||
|
||||
except Exception as e:
|
||||
return {
|
||||
"status": "0",
|
||||
"error": str(e),
|
||||
"data": None
|
||||
}, 500
|
||||
|
||||
|
||||
|
||||
@app.route('/salary/demousers')
|
||||
def salary_demousers():
|
||||
|
||||
Reference in New Issue
Block a user