Skip to content

feat: online checkout with optional WhatsApp opt-in (Step 4)#56

Draft
zshanhui wants to merge 4 commits into
mainfrom
cursor/checkout-step4-8b02
Draft

feat: online checkout with optional WhatsApp opt-in (Step 4)#56
zshanhui wants to merge 4 commits into
mainfrom
cursor/checkout-step4-8b02

Conversation

@zshanhui
Copy link
Copy Markdown
Owner

@zshanhui zshanhui commented Jun 1, 2026

Implements Step 4 — Checkout & consent from the WhatsApp integration plan.

Features

  • Full checkout at /online-ordering/:slug/checkout (replaces placeholder)
  • Cart via localStorage + add-to-cart on online menu
  • Contact (optional name; phone or email required; can use non-WhatsApp phone)
  • WhatsApp opt-in — optional checkbox, only when phone is entered; records whatsapp_opt_ins when checked
  • Mock paymentsmock_pay_at_pickup or mock_card (no real payment processor)
  • APIPOST /api/menus/:slug/checkout creates customer, order, line items, receipt, marks order paid

Database

  • customers.email
  • whatsapp_opt_ins (customer, merchant, order, phone_e164, opt_in_source)

Tests

  • specs/shared/contact.spec.ts
  • specs/services/checkout.spec.ts

Depends on Step 2 WhatsApp webhook plumbing (separate PR #55) for future outbound messages (Step 3).

Open in Web Open in Cursor 

cursoragent and others added 4 commits June 1, 2026 15:15
- Add whatsapp_message_log migration and model with idempotent inserts
- Mount GET/POST /api/webhooks/whatsapp with raw body for signature verify
- Add config, signature, and ingest services behind WHATSAPP_ENABLED
- Add .env.example, AGENTS.md and routes.md docs, mocha specs

Co-authored-by: zshanhui <zshanhui@users.noreply.github.com>
- Convert webhook route, services, model, and specs from JS to TS
- Add shared types in src/shared/whatsapp.ts
- Remove duplicate .js implementations; use named export for router

Co-authored-by: zshanhui <zshanhui@users.noreply.github.com>
Co-authored-by: zshanhui <zshanhui@users.noreply.github.com>
…(Step 4)

- Add POST /api/menus/:slug/checkout with mock payment methods
- Add whatsapp_opt_ins table and customers.email
- Implement cart in localStorage, OnlineMenu add-to-cart, full Checkout page
- Optional WhatsApp opt-in when phone provided; require phone or email
- Mock pay-at-pickup and mock card; redirect to receipt on success

Co-authored-by: zshanhui <zshanhui@users.noreply.github.com>
@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented Jun 1, 2026

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
14986488 Triggered Generic Password e1ff300 .env.example View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants