Merge pull request #376 from arcbtc/FastAPI

restored create invoice api endpoint
This commit is contained in:
Arc 2021-11-03 10:30:05 +00:00 committed by GitHub
commit cfdf3a2008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -324,12 +324,14 @@ async def api_payments_sse(
@core_app.get("/api/v1/payments/{payment_hash}")
async def api_payment(payment_hash):
payment = await get_standalone_payment(payment_hash)
await check_invoice_status(payment.wallet_id, payment_hash)
payment = await get_standalone_payment(payment_hash)
if not payment:
return {"message": "Payment does not exist."}
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND,
detail="Payment does not exist.",
)
elif not payment.pending:
return {"paid": True, "preimage": payment.preimage}

View File

@ -45,7 +45,7 @@ class LNbitsWallet(Wallet):
)
if r.is_error:
return StatusResponse(data["message"], 0)
return StatusResponse(data["detail"], 0)
return StatusResponse(None, data["balance"])
@ -73,7 +73,7 @@ class LNbitsWallet(Wallet):
)
if r.is_error:
error_message = r.json()["message"]
error_message = r.json()["detail"]
else:
data = r.json()
checking_id, payment_request = data["checking_id"], data["payment_request"]
@ -90,7 +90,7 @@ class LNbitsWallet(Wallet):
ok, checking_id, fee_msat, error_message = not r.is_error, None, 0, None
if r.is_error:
error_message = r.json()["message"]
error_message = r.json()["detail"]
else:
data = r.json()
checking_id = data["checking_id"]