fix: more return types

This commit is contained in:
Stefan Stammberger
2021-09-11 11:02:48 +02:00
parent d8d8c6b454
commit 63d0242685
6 changed files with 34 additions and 17 deletions
+3 -3
View File
@@ -295,14 +295,14 @@ async def api_payment(payment_hash, wallet: WalletTypeInfo = Depends(get_key_typ
payment = await wallet.wallet.get_payment(payment_hash)
if not payment:
return {"message": "Payment does not exist."}, HTTPStatus.NOT_FOUND
return {"message": "Payment does not exist."}
elif not payment.pending:
return {"paid": True, "preimage": payment.preimage}, HTTPStatus.OK
return {"paid": True, "preimage": payment.preimage}
try:
await payment.check_pending()
except Exception:
return {"paid": False}, HTTPStatus.OK
return {"paid": False}
return {"paid": not payment.pending, "preimage": payment.preimage}