From 236fe9f8ebe8280e757a3fe6b4c4b83f9e89f2b1 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 3 Jan 2023 23:21:17 +0100 Subject: [PATCH] fix mypy for lnbits/extensions/paywall --- lnbits/extensions/paywall/views_api.py | 6 +++++- pyproject.toml | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lnbits/extensions/paywall/views_api.py b/lnbits/extensions/paywall/views_api.py index 3c1cd8fc..26480e01 100644 --- a/lnbits/extensions/paywall/views_api.py +++ b/lnbits/extensions/paywall/views_api.py @@ -19,7 +19,8 @@ async def api_paywalls( wallet_ids = [wallet.wallet.id] if all_wallets: - wallet_ids = (await get_user(wallet.wallet.user)).wallet_ids + user = await get_user(wallet.wallet.user) + wallet_ids = user.wallet_ids if user else [] return [paywall.dict() for paywall in await get_paywalls(wallet_ids)] @@ -57,6 +58,7 @@ async def api_paywall_create_invoice( data: CreatePaywallInvoice, paywall_id: str = Query(None) ): paywall = await get_paywall(paywall_id) + assert paywall if data.amount < paywall.amount: raise HTTPException( status_code=HTTPStatus.BAD_REQUEST, @@ -94,7 +96,9 @@ async def api_paywal_check_invoice( if is_paid: wallet = await get_wallet(paywall.wallet) + assert wallet payment = await wallet.get_payment(payment_hash) + assert payment await payment.set_pending(False) return {"paid": True, "url": paywall.url, "remembers": paywall.remembers} diff --git a/pyproject.toml b/pyproject.toml index ff186de3..b3f19fcd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,7 +102,6 @@ exclude = """(?x)( | ^lnbits/extensions/lnurldevice. | ^lnbits/extensions/lnurlp. | ^lnbits/extensions/offlineshop. - | ^lnbits/extensions/paywall. | ^lnbits/extensions/satspay. | ^lnbits/extensions/splitpayments. | ^lnbits/extensions/streamalerts.