# Initial Development Tasks — Wavora / WAGW SaaS ## Phase 0 — Docs & Project Scaffold - [x] Create project folder. - [x] Create docs folder. - [x] Add PRD. - [x] Add development guide. - [x] Add architecture draft. - [x] Add database plan. - [x] Add API plan. - [ ] Add README.md. - [ ] Add AGENTS.md for project-specific opencode rules. ## Phase 1 — Foundation - [ ] Basic PHP app scaffold. - [ ] Front controller `index.php`. - [ ] Router. - [ ] Controller base. - [ ] DB connection. - [ ] Migration runner. - [ ] Auth/session/CSRF/captcha. - [ ] BRAC tables + seed. - [ ] Parker layout. ## Phase 2 — Tenant + API Key - [ ] Tenant tables. - [ ] Tenant CRUD admin. - [ ] Tenant user binding. - [ ] API key create/revoke. - [ ] API auth middleware. ## Phase 3 — GOWA Integration - [ ] Gateway node setting. - [ ] GOWA client service. - [ ] Device CRUD. - [ ] QR login. - [ ] Pairing code login. - [ ] Device status/reconnect/logout. ## Phase 4 — Messaging + Async Queue - [ ] Send text. - [ ] Send media. - [ ] `t_wa_send_job` table (async job queue). - [ ] Branding footer append untuk device dengan plan Free. - [ ] 300 pesan/hari/device limit enforcement untuk Free plan. - [ ] Daily counter reset + tracking per device plan (`m_device_plan`). - [ ] Queue worker cron task (`wa-queue`): pick pending job → send to GOWA → update status + retry. - [ ] Retry logic: exponential backoff, max 3 attempts, `last_error` capture. - [ ] Sync/live mode fallback untuk admin/dev (`X-Send-Mode: sync`). - [ ] Message logs. ## Phase 5 — Webhook + Billing - [ ] Webhook endpoint settings. - [ ] HMAC signing. - [ ] Retry delivery. - [ ] Usage tracking. - [ ] Plan/limit enforcement. ## Phase 6 — Billing Detail - [ ] Plan CRUD: price, device limit, monthly message quota, API/webhook limit. - [ ] Tenant subscription lifecycle: trial/active/past_due/suspended/cancelled/expired. - [ ] Invoice generator monthly/yearly. - [ ] Fee calculator: subtotal + service fee + admin fee = grand total. - [ ] DOKU Hosted Checkout payment intent. - [ ] DOKU callback signature validation + idempotency. - [ ] QRIS manual helper: static QRIS payload → nominal dynamic; manual proof upload. - [ ] Bank transfer manual: instruction + proof upload. - [ ] Admin verification queue for manual payments. - [ ] Approve/reject manual payment with audit log. - [ ] Auto-suspend tenant if invoice overdue. - [ ] Usage limit enforcement per active plan. ## Modern Stack Pivot - [x] Create separate modern-stack PRD: `docs/PRD_MODERN_STACK.md`. - [x] Review and approve modern stack decision. - [x] If approved, update active docs from PHP 7.4/manual-router assumptions to Laravel/custom-admin/PostgreSQL/Redis. - [x] Scaffold Laravel project with Docker Compose for OrbStack.