Kick the payout batch from the provider webhook

Python · Python · beginner · greenfield

Wires the provider's daily payout webhook to the batch runner. The handler pulls the batch date from the payload, awaits the run, and reports the number of transfers created back to the provider. Kept it thin — all the heavy lifting stays in `run_payout_batch`.

Fintech back office. Each transfer created by the batch moves real money to a vendor's bank account.

Requirements

Files touched

--- app/webhooks/payout.py
+"""Kick the daily payout batch when the provider's webhook fires."""
+from app.payouts.batch import run_payout_batch
+
+
+async def handle_payout_webhook(payload: dict) -> dict:
+    """Body of POST /webhooks/payout."""
+    batch_date = payload["batch_date"]
+    result = await run_payout_batch(batch_date)
+    return {"status": "completed", "transfers": result.transfer_count}
+

Review this PR

Python practice