refactor services

- add PaymentFiatAmount
- return Payment on api endpoints
This commit is contained in:
dni ⚡
2024-10-17 10:43:03 +02:00
parent 33bc380594
commit deee7d80be
11 changed files with 391 additions and 411 deletions
+8 -5
View File
@@ -28,7 +28,6 @@ from lnbits.core.crud import (
)
from lnbits.core.models import Account, CreateInvoice, PaymentState, User
from lnbits.core.services import create_user_account, update_wallet_balance
from lnbits.core.views.payment_api import api_payments_create_invoice
from lnbits.db import DB_TYPE, SQLITE, Database
from lnbits.settings import AuthMethods, Settings
from lnbits.settings import settings as lnbits_settings
@@ -232,12 +231,16 @@ async def adminkey_headers_to(to_wallet):
@pytest_asyncio.fixture(scope="session")
async def invoice(to_wallet):
async def invoice(client, adminkey_headers_from):
data = await get_random_invoice_data()
invoice_data = CreateInvoice(**data)
invoice = await api_payments_create_invoice(invoice_data, to_wallet)
yield invoice
del invoice
response = await client.post(
"/api/v1/payments", headers=adminkey_headers_from, json=invoice_data.dict()
)
assert response.is_success
data = response.json()
assert data["checking_id"]
yield data["bolt11"]
@pytest_asyncio.fixture(scope="function")