switch to polling for btcpay payment sessions because btcpay web hooks

are super duper slow
This commit is contained in:
2020-05-16 22:04:51 -05:00
parent 155b0d579a
commit 2b04463e4e
3 changed files with 35 additions and 14 deletions

View File

@ -164,6 +164,17 @@ class DBModel:
)
self.connection.commit()
def list_payment_sessions_for_account(self, email):
self.cursor.execute("""
SELECT id, type, dollars, created
FROM payment_sessions WHERE email = %s""",
(email, )
)
return list(map(
lambda x: dict(id=x[0], type=x[1], dollars=x[2], created=x[3]),
self.cursor.fetchall()
))
def consume_payment_session(self, payment_type, id, dollars):
self.cursor.execute("SELECT email, dollars FROM payment_sessions WHERE id = %s AND type = %s", (id, payment_type))
row = self.cursor.fetchone()