Skip to content

Commit

Permalink
feat: always send webhook on balance update (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
dni authored Aug 28, 2024
1 parent 4f6765f commit 8c40352
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async def check_charge_balance(charge: Charge) -> Charge:

charge.paid = charge.balance >= charge.amount

if charge.paid and charge.webhook:
if charge.webhook:
resp = await call_webhook(charge)
charge.extra = json.dumps({**charge.config.dict(), **resp})

Expand Down
6 changes: 3 additions & 3 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def _handle_ws_message(address: str, data: dict):
if charge.paid:
logger.success(f"Charge {charge.id} onchain paid.")
stop_onchain_listener(address)
if charge.webhook:
resp = await call_webhook(charge)
charge.extra = json.dumps({**charge.config.dict(), **resp})
if charge.webhook:
resp = await call_webhook(charge)
charge.extra = json.dumps({**charge.config.dict(), **resp})
await update_charge(charge)

0 comments on commit 8c40352

Please sign in to comment.