Merge pull request #374 from arcbtc/FastAPI

restored create invoice api endpoint
This commit is contained in:
Arc 2021-11-03 10:02:48 +00:00 committed by GitHub
commit e7e8d307a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,16 +98,18 @@ class LNbitsWallet(Wallet):
return PaymentResponse(ok, checking_id, fee_msat, error_message)
async def get_invoice_status(self, checking_id: str) -> PaymentStatus:
async with httpx.AsyncClient() as client:
r = await client.get(
url=f"{self.endpoint}/api/v1/payments/{checking_id}", headers=self.key
)
if r.is_error:
try:
async with httpx.AsyncClient() as client:
r = await client.get(
url=f"{self.endpoint}/api/v1/payments/{checking_id}",
headers=self.key,
)
if r.is_error:
return PaymentStatus(None)
return PaymentStatus(r.json()["paid"])
except:
return PaymentStatus(None)
return PaymentStatus(r.json()["paid"])
async def get_payment_status(self, checking_id: str) -> PaymentStatus:
async with httpx.AsyncClient() as client:
r = await client.get(