Category: Backend / Scripts
Complexity: High
Points: 200
Branch: feat/daily-revenue-webhook
Background
daily-revenue-summary.ts computes revenue but only outputs to console. Merchant operators want daily revenue reports delivered automatically to their preferred notification channel (email, Slack, Discord, or generic webhook).
Problem
Daily revenue reports are only available by manually running a script. There is no automated delivery mechanism to push reports to merchant notification channels.
Acceptance Criteria
Implementation Guidelines
Key files: scripts/daily-revenue-summary.ts
Approach: After computing the report, check if a cached file exists for today. If not, compute, cache to data/reports/YYYY-MM-DD.json. Format for Slack or generic JSON. POST to webhook URL.
Edge cases: Webhook URL not set (skip delivery, still output to console); partial day run (report for today may be incomplete — note in payload as partial: true); date in different timezone (use UTC consistently).
Validation: Run script with a test Slack webhook, verify message format and delivery
PR Requirements
- TypeScript with strict types
- Error handling and graceful failure
- README or inline JSDoc for usage
- Configuration via environment variables
Category: Backend / Scripts
Complexity: High
Points: 200
Branch:
feat/daily-revenue-webhookBackground
daily-revenue-summary.tscomputes revenue but only outputs to console. Merchant operators want daily revenue reports delivered automatically to their preferred notification channel (email, Slack, Discord, or generic webhook).Problem
Daily revenue reports are only available by manually running a script. There is no automated delivery mechanism to push reports to merchant notification channels.
Acceptance Criteria
scripts/daily-revenue-summary.tsis extended to support--webhook <url>flag{ date, total_volume_xlm, total_charges, unique_merchants, new_subscribers, cancellations, fee_collected_xlm }SLACK_WEBHOOK_URLis setdata/reports/, skip re-computation and re-delivery (unless--force)Implementation Guidelines
Key files:
scripts/daily-revenue-summary.tsApproach: After computing the report, check if a cached file exists for today. If not, compute, cache to
data/reports/YYYY-MM-DD.json. Format for Slack or generic JSON. POST to webhook URL.Edge cases: Webhook URL not set (skip delivery, still output to console); partial day run (report for today may be incomplete — note in payload as
partial: true); date in different timezone (use UTC consistently).Validation: Run script with a test Slack webhook, verify message format and delivery
PR Requirements