mirror of
https://github.com/lnbits/lnbits.git
synced 2025-07-14 15:02:45 +02:00
/api/v1/payments with limit and offset (#594)
This commit is contained in:
@ -110,16 +110,15 @@ async def api_update_wallet(
|
|||||||
|
|
||||||
|
|
||||||
@core_app.get("/api/v1/payments")
|
@core_app.get("/api/v1/payments")
|
||||||
async def api_payments(wallet: WalletTypeInfo = Depends(get_key_type)):
|
async def api_payments(limit: Optional[int]=None, offset: Optional[int]=None, wallet: WalletTypeInfo = Depends(get_key_type)):
|
||||||
await get_payments(wallet_id=wallet.wallet.id, pending=True, complete=True)
|
|
||||||
pendingPayments = await get_payments(
|
pendingPayments = await get_payments(
|
||||||
wallet_id=wallet.wallet.id, pending=True, exclude_uncheckable=True
|
wallet_id=wallet.wallet.id, pending=True, exclude_uncheckable=True, limit=limit, offset=offset
|
||||||
)
|
)
|
||||||
for payment in pendingPayments:
|
for payment in pendingPayments:
|
||||||
await check_invoice_status(
|
await check_invoice_status(
|
||||||
wallet_id=payment.wallet_id, payment_hash=payment.payment_hash
|
wallet_id=payment.wallet_id, payment_hash=payment.payment_hash
|
||||||
)
|
)
|
||||||
return await get_payments(wallet_id=wallet.wallet.id, pending=True, complete=True)
|
return await get_payments(wallet_id=wallet.wallet.id, pending=True, complete=True, limit=limit, offset=offset)
|
||||||
|
|
||||||
|
|
||||||
class CreateInvoiceData(BaseModel):
|
class CreateInvoiceData(BaseModel):
|
||||||
|
Reference in New Issue
Block a user