chore: rename api-key-macaroon
This commit is contained in:
@@ -2,7 +2,7 @@ from flask import g, jsonify, request
|
||||
|
||||
from lnbits.core.crud import get_user
|
||||
from lnbits.core.services import create_invoice
|
||||
from lnbits.decorators import api_check_wallet_macaroon, api_validate_post_request
|
||||
from lnbits.decorators import api_check_wallet_key, api_validate_post_request
|
||||
from lnbits.helpers import Status
|
||||
from lnbits.settings import WALLET
|
||||
|
||||
@@ -11,7 +11,7 @@ from .crud import create_tpos, get_tpos, get_tposs, delete_tpos
|
||||
|
||||
|
||||
@tpos_ext.route("/api/v1/tposs", methods=["GET"])
|
||||
@api_check_wallet_macaroon(key_type="invoice")
|
||||
@api_check_wallet_key("invoice")
|
||||
def api_tposs():
|
||||
wallet_ids = [g.wallet.id]
|
||||
|
||||
@@ -22,7 +22,7 @@ def api_tposs():
|
||||
|
||||
|
||||
@tpos_ext.route("/api/v1/tposs", methods=["POST"])
|
||||
@api_check_wallet_macaroon(key_type="invoice")
|
||||
@api_check_wallet_key("invoice")
|
||||
@api_validate_post_request(
|
||||
schema={
|
||||
"name": {"type": "string", "empty": False, "required": True},
|
||||
@@ -38,7 +38,7 @@ def api_tpos_create():
|
||||
|
||||
|
||||
@tpos_ext.route("/api/v1/tposs/<tpos_id>", methods=["DELETE"])
|
||||
@api_check_wallet_macaroon(key_type="invoice")
|
||||
@api_check_wallet_key("invoice")
|
||||
def api_tpos_delete(tpos_id):
|
||||
tpos = get_tpos(tpos_id)
|
||||
|
||||
@@ -58,13 +58,13 @@ def api_tpos_delete(tpos_id):
|
||||
def api_tpos_create_invoice(tpos_id):
|
||||
|
||||
tpos = get_tpos(tpos_id)
|
||||
|
||||
|
||||
if not tpos:
|
||||
return jsonify({"message": "TPoS does not exist."}), Status.NOT_FOUND
|
||||
try:
|
||||
memo = f"TPoS {tpos_id}"
|
||||
checking_id, payment_request = create_invoice(wallet_id=tpos.wallet, amount=g.data["amount"], memo=memo)
|
||||
|
||||
|
||||
except Exception as e:
|
||||
return jsonify({"message": str(e)}), Status.INTERNAL_SERVER_ERROR
|
||||
|
||||
@@ -74,7 +74,7 @@ def api_tpos_create_invoice(tpos_id):
|
||||
def api_tpos_check_invoice(checking_id):
|
||||
print(checking_id)
|
||||
PAID = WALLET.get_invoice_status(checking_id).paid
|
||||
|
||||
|
||||
if PAID == True:
|
||||
return jsonify({"PAID": True}), Status.OK
|
||||
return jsonify({"PAID": False}), Status.OK
|
||||
|
||||
Reference in New Issue
Block a user