making loan tables
This commit is contained in:
+21
-3
@@ -343,6 +343,9 @@ def salary_verifloan2():
|
||||
bvn = data["bvn"]
|
||||
pin = data["pin"]
|
||||
loan_application_id = data["loan_application_id"]
|
||||
|
||||
loan_read = load_offer(loan,bvn)
|
||||
|
||||
SELECT_ACC = "SELECT id, uid,pin,bvn FROM demo_bank_accounts WHERE bvn='" + bvn + "' AND pin = '" + pin + "' "
|
||||
print(SELECT_ACC)
|
||||
with connection:
|
||||
@@ -353,7 +356,7 @@ def salary_verifloan2():
|
||||
account_found = count = len( account )
|
||||
print("10000-a")
|
||||
if account_found == 1 :
|
||||
UPDATE_APPLICATION = "UPDATE loan_apply SET verified = now(),status=5 WHERE uid::text = '" + loan_application_id + "' AND status = 1"
|
||||
UPDATE_APPLICATION = "UPDATE loan_apply SET verified = now(), due_date = now(() + '30 days' status=5 WHERE uid::text = '" + loan_application_id + "' AND status = 1"
|
||||
print(UPDATE_APPLICATION)
|
||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||
cursor.execute(UPDATE_APPLICATION)
|
||||
@@ -395,14 +398,15 @@ def products():
|
||||
return product_data
|
||||
|
||||
def load_offer(loan,bvn):
|
||||
OFFER_QUERY = "SELECT uid AS cid,loan,amount,description,days_duration,active FROM loan_offers WHERE loan='" + loan +"'"
|
||||
OFFER_QUERY = "SELECT uid AS cid,loan,amount,description,days_duration,active FROM loan_offers WHERE loan='" + loan +"' LIMIT 1"
|
||||
with connection:
|
||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||
cursor.execute(OFFER_QUERY)
|
||||
select_demoS = cursor.fetchall()
|
||||
|
||||
loan_data = json.dumps( [dict(ix) for ix in select_demoS] )
|
||||
return json.loads( loan_data )
|
||||
loan_result = json.loads( loan_data[0] )
|
||||
return json.loads( loan_data[0] )
|
||||
|
||||
def offers():
|
||||
OFFER_QUERY = "SELECT uid AS cid,loan,amount,description,days_duration,active FROM loan_offers ORDER BY amount ASC"
|
||||
@@ -503,5 +507,19 @@ def office_loan_data(loanLevel):
|
||||
demo_data = json.dumps( [dict(ix) for ix in select_demoS] )
|
||||
return json.loads( demo_data)
|
||||
|
||||
@app.route('/office/offers')
|
||||
def offer_offers():
|
||||
OFFER_QUERY = "SELECT uid AS cid,loan,amount,description,days_duration,active,score,lorder FROM loan_offers "
|
||||
with connection:
|
||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||
cursor.execute(OFFER_QUERY)
|
||||
select_demoS = cursor.fetchall()
|
||||
|
||||
loan_data = json.dumps( [dict(ix) for ix in select_demoS] )
|
||||
loan_result = json.loads( loan_data)
|
||||
return loan_result
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=8000)
|
||||
Reference in New Issue
Block a user