Satspay mostly working

This commit is contained in:
Ben Arc
2021-04-07 01:50:38 +01:00
parent f5d06653a6
commit 90319bfd8c
8 changed files with 342 additions and 237 deletions

View File

@@ -1,5 +1,6 @@
from sqlite3 import Row
from typing import NamedTuple
import time
class Charges(NamedTuple):
@@ -12,12 +13,25 @@ class Charges(NamedTuple):
payment_request: str
payment_hash: str
webhook: str
time: str
time: int
amount: int
balance: int
paid: bool
timestamp: int
@classmethod
def from_row(cls, row: Row) -> "Charges":
return cls(**dict(row))
@property
def time_elapsed(self):
if (self.timestamp + (self.time * 60)) >= time.time():
return False
else:
return True
@property
def paid(self):
if self.balance >= self.amount:
return True
else:
return False