mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-05 19:22:34 +02:00
Working
This commit is contained in:
@@ -57,24 +57,25 @@ async def on_invoice_paid(payment: Payment) -> None:
|
|||||||
logger.debug(f"paid split invoice: {checking_id}")
|
logger.debug(f"paid split invoice: {checking_id}")
|
||||||
|
|
||||||
logger.debug(f"performing split to {len(targets)} targets")
|
logger.debug(f"performing split to {len(targets)} targets")
|
||||||
logger.debug("pitbull")
|
|
||||||
if tagged == False:
|
if tagged == False:
|
||||||
for target in targets:
|
for target in targets:
|
||||||
amount = int(payment.amount * target.percent / 100) # msats
|
if target.percent > 0:
|
||||||
payment_hash, payment_request = await create_invoice(
|
amount = int(payment.amount * target.percent / 100) # msats
|
||||||
wallet_id=target.wallet,
|
payment_hash, payment_request = await create_invoice(
|
||||||
amount=int(amount / 1000), # sats
|
wallet_id=target.wallet,
|
||||||
internal=True,
|
amount=int(amount / 1000), # sats
|
||||||
memo=f"split payment: {target.percent}% for {target.alias or target.wallet}",
|
internal=True,
|
||||||
extra={"tag": "splitpayments"},
|
memo=f"split payment: {target.percent}% for {target.alias or target.wallet}",
|
||||||
)
|
extra={"tag": "splitpayments"},
|
||||||
logger.debug(f"created split invoice: {payment_hash}")
|
)
|
||||||
|
logger.debug(f"created split invoice: {payment_hash}")
|
||||||
|
|
||||||
checking_id = await pay_invoice(
|
checking_id = await pay_invoice(
|
||||||
payment_request=payment_request,
|
payment_request=payment_request,
|
||||||
wallet_id=payment.wallet_id,
|
wallet_id=payment.wallet_id,
|
||||||
extra={"tag": "splitpayments"},
|
extra={"tag": "splitpayments"},
|
||||||
)
|
)
|
||||||
logger.debug(f"paid split invoice: {checking_id}")
|
logger.debug(f"paid split invoice: {checking_id}")
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user