mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-13 10:20:51 +02:00
Fix for LNURLp with ZBD wallet (#2609)
This commit is contained in:
parent
c834929f8b
commit
026c9b5155
@ -1,4 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import hashlib
|
||||||
from typing import AsyncGenerator, Dict, Optional
|
from typing import AsyncGenerator, Dict, Optional
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
@ -13,7 +14,6 @@ from .base import (
|
|||||||
PaymentResponse,
|
PaymentResponse,
|
||||||
PaymentStatus,
|
PaymentStatus,
|
||||||
StatusResponse,
|
StatusResponse,
|
||||||
UnsupportedError,
|
|
||||||
Wallet,
|
Wallet,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -64,18 +64,23 @@ class ZBDWallet(Wallet):
|
|||||||
**kwargs,
|
**kwargs,
|
||||||
) -> InvoiceResponse:
|
) -> InvoiceResponse:
|
||||||
# https://api.zebedee.io/v0/charges
|
# https://api.zebedee.io/v0/charges
|
||||||
if description_hash or unhashed_description:
|
|
||||||
raise UnsupportedError("description_hash")
|
|
||||||
|
|
||||||
msats_amount = amount * 1000
|
msats_amount = amount * 1000
|
||||||
data: Dict = {
|
data: Dict = {
|
||||||
"amount": f"{msats_amount}",
|
"amount": f"{msats_amount}",
|
||||||
"description": memo,
|
|
||||||
"expiresIn": 3600,
|
"expiresIn": 3600,
|
||||||
"callbackUrl": "",
|
"callbackUrl": "",
|
||||||
"internalId": "",
|
"internalId": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## handle description_hash and unhashed for ZBD
|
||||||
|
if description_hash:
|
||||||
|
data["description"] = description_hash.hex()
|
||||||
|
elif unhashed_description:
|
||||||
|
data["description"] = hashlib.sha256(unhashed_description).hexdigest()
|
||||||
|
else:
|
||||||
|
data["description"] = memo or ""
|
||||||
|
|
||||||
r = await self.client.post(
|
r = await self.client.post(
|
||||||
"charges",
|
"charges",
|
||||||
json=data,
|
json=data,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user