mirror of
https://github.com/lnbits/lnbits.git
synced 2025-03-26 17:51:53 +01:00
FEAT: proper failing invoice/payment responses for VoidWallet (#1805)
before that change anyone using the api just got a 500 error without any error message. there was also a bug stacetrace in the logs each time. flake8
This commit is contained in:
parent
427f155c76
commit
6ce0387e1c
@ -1,4 +1,4 @@
|
||||
from typing import AsyncGenerator, Optional
|
||||
from typing import AsyncGenerator
|
||||
|
||||
from loguru import logger
|
||||
|
||||
@ -7,20 +7,15 @@ from .base import (
|
||||
PaymentResponse,
|
||||
PaymentStatus,
|
||||
StatusResponse,
|
||||
Unsupported,
|
||||
Wallet,
|
||||
)
|
||||
|
||||
|
||||
class VoidWallet(Wallet):
|
||||
async def create_invoice(
|
||||
self,
|
||||
amount: int,
|
||||
memo: Optional[str] = None,
|
||||
description_hash: Optional[bytes] = None,
|
||||
**kwargs,
|
||||
) -> InvoiceResponse:
|
||||
raise Unsupported("")
|
||||
async def create_invoice(self, *_, **__) -> InvoiceResponse:
|
||||
return InvoiceResponse(
|
||||
ok=False, error_message="VoidWallet cannot create invoices."
|
||||
)
|
||||
|
||||
async def status(self) -> StatusResponse:
|
||||
logger.warning(
|
||||
@ -31,13 +26,15 @@ class VoidWallet(Wallet):
|
||||
)
|
||||
return StatusResponse(None, 0)
|
||||
|
||||
async def pay_invoice(self, bolt11: str, fee_limit_msat: int) -> PaymentResponse:
|
||||
raise Unsupported("")
|
||||
async def pay_invoice(self, *_, **__) -> PaymentResponse:
|
||||
return PaymentResponse(
|
||||
ok=False, error_message="VoidWallet cannot pay invoices."
|
||||
)
|
||||
|
||||
async def get_invoice_status(self, checking_id: str) -> PaymentStatus:
|
||||
async def get_invoice_status(self, *_, **__) -> PaymentStatus:
|
||||
return PaymentStatus(None)
|
||||
|
||||
async def get_payment_status(self, checking_id: str) -> PaymentStatus:
|
||||
async def get_payment_status(self, *_, **__) -> PaymentStatus:
|
||||
return PaymentStatus(None)
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user