mirror of
https://github.com/lnbits/lnbits.git
synced 2025-08-08 17:22:14 +02:00
fix: lnbits funding source (#2319)
fix a bug where payments are deleted
This commit is contained in:
@@ -129,12 +129,16 @@ class LNbitsWallet(Wallet):
|
|||||||
r = await self.client.get(url=f"/api/v1/payments/{checking_id}")
|
r = await self.client.get(url=f"/api/v1/payments/{checking_id}")
|
||||||
|
|
||||||
if r.is_error:
|
if r.is_error:
|
||||||
return PaymentStatus(False)
|
return PaymentStatus(None)
|
||||||
data = r.json()
|
data = r.json()
|
||||||
if "paid" not in data and "details" not in data:
|
|
||||||
|
if "paid" not in data or not data["paid"]:
|
||||||
return PaymentStatus(None)
|
return PaymentStatus(None)
|
||||||
|
|
||||||
return PaymentStatus(data["paid"], data["details"]["fee"], data["preimage"])
|
if "details" not in data:
|
||||||
|
return PaymentStatus(None)
|
||||||
|
|
||||||
|
return PaymentStatus(True, data["details"]["fee"], data["preimage"])
|
||||||
|
|
||||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||||
url = f"{self.endpoint}/api/v1/payments/sse"
|
url = f"{self.endpoint}/api/v1/payments/sse"
|
||||||
|
@@ -763,7 +763,7 @@ async def test_pay_hold_invoice_check_pending_and_fail_cancel_payment_task_in_me
|
|||||||
|
|
||||||
# status should still be available and be False
|
# status should still be available and be False
|
||||||
status = await payment_db.check_status()
|
status = await payment_db.check_status()
|
||||||
assert status.paid is False
|
assert not status.paid
|
||||||
|
|
||||||
# now the payment should be gone after the status check
|
# now the payment should be gone after the status check
|
||||||
# payment_db_after_status_check = await get_standalone_payment(
|
# payment_db_after_status_check = await get_standalone_payment(
|
||||||
|
Reference in New Issue
Block a user