This commit is contained in:
Tiago Vasconcelos 2023-01-05 14:37:31 +00:00
parent 954bbc6de4
commit 9e96025dc7

View File

@ -41,8 +41,10 @@ async def on_invoice_paid(payment: Payment) -> None:
logger.debug(f"performing split payments to {len(targets)} targets")
amount_to_split = payment.amount
if payment.extra.get("amount"):
amount_to_split = int(payment.extra.get("amount") * 1000)
_amount = payment.extra.get("amount") or 0
amount_to_split = _amount * 1000
for target in targets:
if target.percent > 0:
@ -65,13 +67,11 @@ async def on_invoice_paid(payment: Payment) -> None:
logger.debug(f"created split invoice: {payment_hash}")
extra = {**payment.extra, "splitted": True}
if not extra.get("tag"):
extra["tag"] = "splitpayments"
checking_id = await pay_invoice(
payment_request=payment_request,
wallet_id=payment.wallet_id,
extra={**extra},
extra=extra,
)
logger.debug(f"paid split invoice: {checking_id}")