Merge pull request #376 from arcbtc/FastAPI
restored create invoice api endpoint
This commit is contained in:
commit
cfdf3a2008
|
@ -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}
|
||||
|
||||
|
|
|
@ -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"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user