make payment.extra non-optional
this makes handling in tasks.py so much easier
This commit is contained in:
parent
301a784e95
commit
191ad1e224
|
@ -88,7 +88,7 @@ class Payment(BaseModel):
|
||||||
preimage: str
|
preimage: str
|
||||||
payment_hash: str
|
payment_hash: str
|
||||||
expiry: Optional[float]
|
expiry: Optional[float]
|
||||||
extra: Optional[Dict] = {}
|
extra: Dict = {}
|
||||||
wallet_id: str
|
wallet_id: str
|
||||||
webhook: Optional[str]
|
webhook: Optional[str]
|
||||||
webhook_status: Optional[int]
|
webhook_status: Optional[int]
|
||||||
|
|
|
@ -28,6 +28,7 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
if payment.extra and not payment.extra.get("tag") == "cashu":
|
if payment.extra.get("tag") != "cashu":
|
||||||
return
|
return
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
@ -24,12 +24,12 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
webhook = None
|
if payment.extra.get("tag") != "copilot":
|
||||||
data = None
|
|
||||||
if not payment.extra or payment.extra.get("tag") != "copilot":
|
|
||||||
# not an copilot invoice
|
# not an copilot invoice
|
||||||
return
|
return
|
||||||
|
|
||||||
|
webhook = None
|
||||||
|
data = None
|
||||||
copilot = await get_copilot(payment.extra.get("copilotid", -1))
|
copilot = await get_copilot(payment.extra.get("copilotid", -1))
|
||||||
|
|
||||||
if not copilot:
|
if not copilot:
|
||||||
|
|
|
@ -25,9 +25,6 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
if not payment.extra:
|
|
||||||
return
|
|
||||||
|
|
||||||
if payment.extra.get("tag") != "invoices":
|
if payment.extra.get("tag") != "invoices":
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
if payment.extra:
|
if payment.extra.get("tag") != "jukebox":
|
||||||
if payment.extra.get("tag") != "jukebox":
|
# not a jukebox invoice
|
||||||
# not a jukebox invoice
|
return
|
||||||
return
|
|
||||||
await update_jukebox_payment(payment.payment_hash, paid=True)
|
await update_jukebox_payment(payment.payment_hash, paid=True)
|
||||||
|
|
|
@ -19,7 +19,7 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
if not payment.extra or payment.extra.get("tag") != "lnticket":
|
if payment.extra.get("tag") != "lnticket":
|
||||||
# not a lnticket invoice
|
# not a lnticket invoice
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment):
|
async def on_invoice_paid(payment: Payment):
|
||||||
if not payment.extra or payment.extra.get("tag") != "lnurlp":
|
if payment.extra.get("tag") != "lnurlp":
|
||||||
return
|
return
|
||||||
|
|
||||||
if payment.extra.get("wh_status"):
|
if payment.extra.get("wh_status"):
|
||||||
|
|
|
@ -23,9 +23,6 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
if not payment.extra:
|
|
||||||
return
|
|
||||||
|
|
||||||
if payment.extra.get("tag") != "market":
|
if payment.extra.get("tag") != "market":
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,6 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
if not payment.extra:
|
|
||||||
return
|
|
||||||
if payment.extra.get("tag") != "nostrnip5":
|
if payment.extra.get("tag") != "nostrnip5":
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment):
|
async def on_invoice_paid(payment: Payment):
|
||||||
# (avoid loops)
|
# (avoid loops)
|
||||||
if payment.extra and payment.extra.get("tag") == "scrubed":
|
if payment.extra.get("tag") == "scrubed":
|
||||||
# already scrubbed
|
# already scrubbed
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
if not payment.extra or payment.extra.get("tag") == "splitpayments":
|
if payment.extra.get("tag") == "splitpayments":
|
||||||
# already a splitted payment, ignore
|
# already a splitted payment, ignore
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
if not payment.extra or payment.extra.get("tag") != "lnsubdomain":
|
if payment.extra.get("tag") != "lnsubdomain":
|
||||||
# not an lnurlp invoice
|
# not an lnurlp invoice
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,6 @@ async def wait_for_paid_invoices():
|
||||||
|
|
||||||
|
|
||||||
async def on_invoice_paid(payment: Payment) -> None:
|
async def on_invoice_paid(payment: Payment) -> None:
|
||||||
if not payment.extra:
|
|
||||||
return
|
|
||||||
if payment.extra.get("tag") != "tpos":
|
if payment.extra.get("tag") != "tpos":
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user