Skip to content

feat(orders): show WhatsApp receipt status - #784

Merged
khaira777 merged 5 commits into
mainfrom
fm/flocafe-issue-718-delivery-r1
Sep 18, 2026
Merged

khaira777 merged 5 commits into
mainfrom
fm/flocafe-issue-718-delivery-r1

Conversation

@khaira777

@khaira777 khaira777 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Implement FloCafe issue #718 as a separate pull request. On the Orders page, show a compact receipt-status indicator derived from the existing bill-linked WhatsApp message ledger so staff can see whether a native receipt send is pending, successful, or failed without opening WhatsApp. Use sent, delivered, or read as positive; queued or typing as pending; failed as failed; and no matching row as no recorded send. Do not treat the wa.me fallback as sent because opening a prefilled URL does not prove that the employee pressed Send. Leave the fallback behavior unchanged. Do not touch Google Drive, local backups, migrations, or unrelated features. Use no-mistakes to open a PR and stop before merge for captain testing.

What Changed

  • Added whatsapp_receipt_status to hydrated order responses, summarizing bill-linked outbound receipt ledger rows while excluding wa.me fallback shares.
  • Added localized compact receipt-status badges to the Orders page and refreshed order data after native receipt sends.
  • Documented the API field and added issue 718 regression coverage for status precedence, split bills, missing rows, and non-receipt messages.

Risk Assessment

✅ Low: The reviewed change is bounded and its order-level receipt-status projection, split-bill aggregation, UI gating, and native-send classification align with the stated intent.

Testing

The built product displayed No recorded send, Sent, Failed, and Pending badges. Backend regression coverage passed all requested mappings, fallback exclusion, retries, split bills, and no-phone behavior.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Paid orders show receipt-status indicators ✅ pass live Live screenshot and Playwright assertion.
Native status mapping excludes wa.me fallback ✅ pass live Focused issue 718 regression test.
Split-bill statuses summarize truthfully ✅ pass live Focused issue 718 regression test.
Evidence: Orders status assertion
Live Playwright assertion found one each of `No recorded send`, `Sent`, `Failed`, and `Pending`.
![Receipt status variants](https://github.com/user-attachments/assets/ab9864f7-3f95-4302-aa18-3216f72fcc41)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed (2) ✅
  • ⚠️ main/routes/orders.ts:318 - Split-check orders can show the wrong status: the API projects only order.bill (first unpaid bill or first bill), and the UI renders the badge only when that bill is paid. A receipt sent for another paid split bill can therefore be reported as "No recorded send" or hidden. Choose and implement explicit multi-bill semantics (aggregate or per-bill indicator).
  • ⚠️ AGENTS.md:90 - The added instruction-maintenance section is unrelated to issue 718 and is not required for the receipt-status feature. Remove this unrequired change from the feature PR.
  • ⚠️ CLAUDE.md:1 - This PR unnecessarily converts CLAUDE.md from the repository's symlink to AGENTS.md into a regular file. Restore the symlink; the feature does not require changing repository instruction-file semantics.

🔧 Fix applied.
2 warnings still open:

  • ⚠️ main/routes/orders.ts:341 - A real native receipt send can be recorded as manual_reply when the paid bill has no customer ID, so this new kind = 'bill_receipt' query misses it and the UI remains "No recorded send". Preserve receipt classification at the shared send boundary.
  • ⚠️ frontend/src/app/(dashboard)/orders/page.tsx:1106 - The backend summarizes paid split bills, but the UI only renders the badge when order.bill is paid. With one paid bill and one unpaid sibling, order.bill is the unpaid bill, so the valid order-level summary is hidden. Gate the badge on any paid bill while keeping the send-button guard unchanged.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Paid orders show receipt-status indicators ✅ pass live Live screenshot and Playwright assertion.
Native status mapping excludes wa.me fallback ✅ pass live Focused issue 718 regression test.
Split-bill statuses summarize truthfully ✅ pass live Focused issue 718 regression test.
  • npm run test:issue-718-whatsapp-order-status
  • npm run build
  • npm run build:frontend
  • Live API setup and Playwright Orders-page drive
  • git diff --check
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Summary by CodeRabbit

  • New Features

    • Orders now display WhatsApp bill-receipt statuses, including sent, partially sent, pending, and failed.
    • Receipt statuses refresh after sending a bill through WhatsApp.
    • Status labels are available across supported languages.
  • Documentation

    • Orders API documentation now describes the WhatsApp receipt-status field and its values.
  • Bug Fixes

    • Improved receipt-status handling for split bills, missing messages, and unpaid bills.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • package.json is excluded by !package.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Repository: FreeOpenSourcePOS/FloCafe/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: cc788229-b649-450a-8b5a-3eee3165ec6b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: FreeOpenSourcePOS/FloCafe/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: bbc70d49-3463-478a-9b8d-d7e526c0db59

📥 Commits

Reviewing files that changed from the base of the PR and between dd8cf70 and d87b0c5.

⛔ Files ignored due to path filters (1)
  • package.json is excluded by !package.json
📒 Files selected for processing (14)
  • docs/API.md
  • frontend/src/app/(dashboard)/orders/page.tsx
  • frontend/src/lib/i18n/messages/de.json
  • frontend/src/lib/i18n/messages/en.json
  • frontend/src/lib/i18n/messages/es.json
  • frontend/src/lib/i18n/messages/fa.json
  • frontend/src/lib/i18n/messages/fil.json
  • frontend/src/lib/i18n/messages/fr.json
  • frontend/src/lib/i18n/messages/pt.json
  • frontend/src/lib/i18n/messages/tr.json
  • frontend/src/lib/types.ts
  • frontend/src/lib/whatsapp-share.ts
  • main/routes/orders.ts
  • tests/issue-718-whatsapp-order-status.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The orders API now projects WhatsApp bill receipt status. The Orders page displays localized status badges for paid orders and refreshes after Flo sends a bill. API documentation and regression tests cover the new behavior.

Changes

WhatsApp receipt status

Layer / File(s) Summary
Receipt status projection and validation
main/routes/orders.ts, tests/issue-718-whatsapp-order-status.test.ts
The orders route summarizes the latest outbound bill_receipt status for paid bills. Tests cover status precedence, split bills, message filtering, and orders without phone numbers.
Order display and sending integration
frontend/src/lib/types.ts, frontend/src/lib/whatsapp-share.ts, frontend/src/app/(dashboard)/orders/page.tsx, frontend/src/lib/i18n/messages/*.json
The order type accepts receipt statuses. Flo sends identify bill receipts. Paid orders display localized badges and refresh after sending.
API response documentation
docs/API.md
The list and detail endpoint documentation describes whatsapp_receipt_status and its derivation.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant OrdersPage
  participant WhatsAppSend
  participant WhatsAppMessages
  participant OrdersAPI
  OrdersPage->>WhatsAppSend: send bill with kind bill_receipt
  WhatsAppSend->>WhatsAppMessages: record outbound receipt status
  OrdersPage->>OrdersAPI: refresh orders
  OrdersAPI-->>OrdersPage: return whatsapp_receipt_status
  OrdersPage-->>OrdersPage: render localized receipt badge
Loading

Merge Risk: ⚪ Minimal · up to d87b0

No concrete current-head risk remains; the claimed missing receipt badge cannot occur through the Orders API response path.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 5 files. (9 skipped: 9… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly explains the issue, scope, implementation, user-visible behavior, testing, screenshots, and data-safety constraints. It does not use the template headings or include the contri…
Title check ✅ Passed The title clearly and concisely describes the primary change: displaying WhatsApp receipt status for orders.
Full details: Docstring Coverage

Explanation

Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 5 files. (9 skipped: 9 unsupported.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…command in package.json. npm run test:script-coverage, the focused theme test, and git diff --check pass; only package.json changed
@khaira777
khaira777 merged commit de48901 into main Sep 18, 2026
15 checks passed
@khaira777
khaira777 deleted the fm/flocafe-issue-718-delivery-r1 branch September 18, 2026 23:02
@itoqa

itoqa Bot commented Sep 18, 2026

Copy link
Copy Markdown

Ito QA test results
Commit: fb91a6f: 11 test cases ran, 11 passed ✅.

Summary

Coverage spans receipt-status business rules for orders and split bills, including sent, failed, partial, pending, and no-recorded-send states, plus handling of unrelated messages and retry ordering. It also covers user-facing order badges, localization and accessibility labels, native and fallback sharing behavior, refresh stability, and concurrency-related safeguards.

Safe to merge — the exercised application behaviors passed without any PR-attributable regressions or new failures. A few native-send and concurrency scenarios were blocked by missing test data, but they are environment limitations rather than merge blockers.

Tests run by Ito

View full run

Result Severity Type Description
✅ — Badge Paid orders show Sent, Pending, Partially sent, and Failed badges. Each badge uses the same localized label on screen and for assistive technology.
✅ — General The order detail stayed at no recorded send when the paid bill had only an inbound receipt message and an outbound manual reply.
✅ — General The order list and order detail both show Partial when two paid split bills have only one recorded receipt.
✅ — General The test could not reach the receipt send because the Orders page had no seeded paid order. This is a test-environment setup issue, so no application failure was confirmed.
✅ — General The orders list showed the newer failed receipt event instead of the earlier successful event on both refreshes.
✅ — General The local Orders page loaded, but it had no paid order or bill to use for the concurrent send check. No corrupted bill data or duplicate record was observed.
✅ — Detail The order detail request returned HTTP 200 and included the order with whatsapp_receipt_status set to sent.
✅ — Orders The orders endpoint returned paid orders with the expected receipt states, including sent, failed, and partial results.
✅ — Rev Receipt badges showed clear, translated labels in English, German, Spanish, French, Persian, Filipino, Portuguese, and Turkish. Each badge had a non-empty accessible name, and no message key was shown.
✅ — Send The Orders page opened, but the local run had no seeded order, so the receipt send could not be exercised. This is a test-environment setup issue rather than a product failure.
✅ — Share The paid order kept its completed status and the bill stayed paid after the fallback share attempt. No native receipt was recorded, which is the expected behavior for a prefilled WhatsApp share.

Tip

Reply with @itoqa to send us feedback on this test run.

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.

1 participant