Sindbad~EG File Manager

Current Path : /home/numerotech/paymentapi.numerotech.com/paymentapi/core/model/
Upload File :
Current File : //home/numerotech/paymentapi.numerotech.com/paymentapi/core/model/PaypalModel.py

from sqlalchemy import create_engine, MetaData, Table, insert, select,update,delete,text
from sqlalchemy.sql import and_, or_
from core import app
import json
from flask import session

engine = create_engine(app.config['DATABASE_URI'],pool_size=5000,pool_pre_ping=True,pool_recycle=3600,future = True)

class PaypalModel():
	def __init__(self):
		try:
			self.meta = MetaData()
			self.payments         = Table("payments", self.meta, autoload_with=engine)
			self.gateway_settings = Table("gateway_settings", self.meta, autoload_with=engine)
		except Exception as e:
			print(e)

	def update_paypal_payment_statusAndGetDetails(self,payment_id,payment_status,unique_id,dt_string,method):
		with engine.connect() as conn:
			stmt   = self.payments.update().values({"payment_id":payment_id,"payment_status":payment_status,"updated_at" :dt_string,"method":method}).where(self.payments.c.unique_id.in_([unique_id]))
			conn.execute(stmt)
			conn.commit()
			stmt_2 = text("SELECT payment_id, name,payment_status,email,mobile,amount,unique_id,method,res_url,currency from payments where unique_id = '"+unique_id+"';")
			result = conn.execute(stmt_2).first()
			return  dict(result._mapping)  if result else None		

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists