mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 14:51:05 +01:00
api endpoint to get last payments
This commit is contained in:
parent
0b883d02b3
commit
8d8a309258
1 changed files with 17 additions and 1 deletions
|
@ -13,7 +13,7 @@ from lnbits.core.views.api import api_payment
|
||||||
from lnbits.decorators import WalletTypeInfo, get_key_type, require_admin_key
|
from lnbits.decorators import WalletTypeInfo, get_key_type, require_admin_key
|
||||||
|
|
||||||
from . import tpos_ext
|
from . import tpos_ext
|
||||||
from .crud import create_tpos, delete_tpos, get_tpos, get_tposs
|
from .crud import create_tpos, delete_tpos, get_tpos, get_tpos_payments, get_tposs
|
||||||
from .models import CreateTposData, PayLnurlWData
|
from .models import CreateTposData, PayLnurlWData
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,6 +81,22 @@ async def api_tpos_create_invoice(
|
||||||
return {"payment_hash": payment_hash, "payment_request": payment_request}
|
return {"payment_hash": payment_hash, "payment_request": payment_request}
|
||||||
|
|
||||||
|
|
||||||
|
@tpos_ext.get("/api/v1/tposs/{tpos_id}/invoices")
|
||||||
|
async def api_tpos_get_latest_invoices(tpos_id: str = None):
|
||||||
|
payments = await get_tpos_payments(tpos_id)
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
"checking_id": payment.checking_id,
|
||||||
|
"amount": payment.amount,
|
||||||
|
"time": payment.time,
|
||||||
|
"bolt11": payment.bolt11,
|
||||||
|
"pending": payment.pending,
|
||||||
|
}
|
||||||
|
for payment in payments
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@tpos_ext.post(
|
@tpos_ext.post(
|
||||||
"/api/v1/tposs/{tpos_id}/invoices/{payment_request}/pay", status_code=HTTPStatus.OK
|
"/api/v1/tposs/{tpos_id}/invoices/{payment_request}/pay", status_code=HTTPStatus.OK
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue