Skip to content

feat: send status update notification to buyer on order status change#19

Merged
eurobuddha merged 1 commit intomasterfrom
feat/status-update-buyer-notification
Mar 23, 2026
Merged

feat: send status update notification to buyer on order status change#19
eurobuddha merged 1 commit intomasterfrom
feat/status-update-buyer-notification

Conversation

@eurobuddha
Copy link
Copy Markdown
Owner

Summary

  • When the vendor changes order status in the inbox, a silent ChainMail on-chain message (STATUS_UPDATE) is encrypted and sent to the buyer using the existing MINIMERCH_ADDRESS messaging mechanism
  • Buyer's shop now receives, stores, and displays these notifications in their inbox
  • No new UI required on the vendor side — the "Update Status" button text reflects the outcome: ✓ Updated · Buyer notified, ✓ Updated · Pending approval, or plain ✓ Updated on send failure (DB update always succeeds regardless)

Changes

template/inbox/app.js

  • sendStatusUpdateToBuyer(msg, newStatus, btn) — encrypts {type: STATUS_UPDATE, randomid, ref, status, vendorPublicKey} and sends to MINIMERCH_ADDRESS; handles pending approval flow
  • setupStatusUpdateListener() calls it after successful DB update
  • MDS_PENDING handler extended for pendingStatusUpdateUid

template/shop/app.js

  • processReplyMessage() extended to handle STATUS_UPDATE type
  • renderMessageList() shows status emoji + "Status Update" label
  • renderMessageDetail() adds a STATUS_UPDATE detail view

template/shop/service.js

  • processDecryptedMessage() extended to handle STATUS_UPDATE type

Test plan

  • Place order from buyer shop, open in vendor inbox
  • Change status to Confirmed → button shows "✓ Updated · Buyer notified"
  • Buyer inbox receives a ✅ "Order status: Confirmed" notification within 10s
  • Opening the notification shows order ref, new status, timestamp
  • Test with no buyerPublicKey — status DB update succeeds, no crash
  • Test pending approval flow — notification sends after wallet approval

🤖 Generated with Claude Code

… change

When the vendor changes an order status in the inbox, a ChainMail
on-chain message (type: STATUS_UPDATE) is silently encrypted and sent
to the buyer via the existing MINIMERCH_ADDRESS mechanism.

Inbox (app.js):
- New sendStatusUpdateToBuyer(msg, newStatus, btn) function — encrypts
  payload {type, randomid, ref, status, vendorPublicKey} and sends via
  MDS to MINIMERCH_ADDRESS; updates button text to reflect outcome
- setupStatusUpdateListener() calls sendStatusUpdateToBuyer after DB
  update succeeds; button shows "✓ Updated · Buyer notified" on success
- MDS_PENDING handler extended to match pendingStatusUpdateUid so
  wallet-approval flow is handled correctly
- Added pendingStatusUpdateData/Uid globals

Shop (app.js, service.js):
- processReplyMessage() and processDecryptedMessage() now also handle
  STATUS_UPDATE type (previously filtered out as unknown)
- STATUS_UPDATE stored as received message with subject/message derived
  from the status value
- renderMessageList() shows status emoji icon and "Status Update" label
- renderMessageDetail() shows a dedicated STATUS_UPDATE detail view with
  order ref, new status, timestamp, and mark-as-read button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@eurobuddha eurobuddha merged commit b6fffbb into master Mar 23, 2026
5 checks passed
@eurobuddha eurobuddha deleted the feat/status-update-buyer-notification branch March 23, 2026 15:06
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