mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-10 12:32:34 +02:00
Satspay mostly working
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user