mirror of
https://github.com/lnbits/lnbits.git
synced 2025-08-02 06:52:28 +02:00
Splitpayments booting, but not sure how to handle internal pays
This commit is contained in:
@@ -8,11 +8,11 @@ from lnbits.tasks import catch_everything_and_restart
|
||||
|
||||
db = Database("ext_splitpayments")
|
||||
|
||||
copilot_static_files = [
|
||||
splitpayments_static_files = [
|
||||
{
|
||||
"path": "/copilot/static",
|
||||
"path": "/splitpayments/static",
|
||||
"app": StaticFiles(directory="lnbits/extensions/splitpayments/static"),
|
||||
"name": "copilot_static",
|
||||
"name": "splitpayments_static",
|
||||
}
|
||||
]
|
||||
splitpayments_ext: APIRouter = APIRouter(
|
||||
|
@@ -3,7 +3,7 @@ import json
|
||||
from lnbits.core.models import Payment
|
||||
from lnbits.core.crud import create_payment
|
||||
from lnbits.core import db as core_db
|
||||
from lnbits.tasks import register_invoice_listener, internal_invoice_paid
|
||||
from lnbits.tasks import register_invoice_listener # , internal_invoice_paid
|
||||
from lnbits.helpers import urlsafe_short_hash
|
||||
|
||||
from .crud import get_targets
|
||||
@@ -78,4 +78,5 @@ async def on_invoice_paid(payment: Payment) -> None:
|
||||
)
|
||||
|
||||
# manually send this for now
|
||||
await internal_invoice_paid.send(internal_checking_id)
|
||||
# await internal_invoice_paid.send(internal_checking_id)
|
||||
return
|
||||
|
@@ -33,14 +33,14 @@ async def api_targets_set(
|
||||
data: TargetPut, wallet: WalletTypeInfo = Depends(WalletAdminKeyChecker())
|
||||
):
|
||||
targets = []
|
||||
for entry in data["targets"]:
|
||||
wallet = await get_wallet(entry["wallet"])
|
||||
for entry in data.targets:
|
||||
wallet = await get_wallet(entry.wallet)
|
||||
if not wallet:
|
||||
wallet = await get_wallet_for_key(entry["wallet"], "invoice")
|
||||
wallet = await get_wallet_for_key(entry.wallet, "invoice")
|
||||
if not wallet:
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.BAD_REQUEST,
|
||||
detail=f"Invalid wallet '{entry['wallet']}'.",
|
||||
detail=f"Invalid wallet '{entry.wallet}'.",
|
||||
)
|
||||
|
||||
if wallet.id == wallet.wallet.id:
|
||||
@@ -49,14 +49,14 @@ async def api_targets_set(
|
||||
detail="Can't split to itself.",
|
||||
)
|
||||
|
||||
if entry["percent"] < 0:
|
||||
if entry.percent < 0:
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.BAD_REQUEST,
|
||||
detail=f"Invalid percent '{entry['percent']}'.",
|
||||
detail=f"Invalid percent '{entry.percent}'.",
|
||||
)
|
||||
|
||||
targets.append(
|
||||
Target(wallet.id, wallet.wallet.id, entry["percent"], entry["alias"] or "")
|
||||
Target(wallet.id, wallet.wallet.id, entry.percent, entry.alias or "")
|
||||
)
|
||||
|
||||
percent_sum = sum([target.percent for target in targets])
|
||||
|
Reference in New Issue
Block a user