This commit is contained in:
ben
2022-12-14 00:04:03 +00:00
parent 5f53eb8e4e
commit f506b010f6

View File

@@ -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}")