Skip to content

feat(store): KeepKey dropship live-API polling + webhook hardening#131

Merged
sktbrd merged 1 commit into
mainfrom
feat/keepkey-dropship-live-polling
Jul 16, 2026
Merged

feat(store): KeepKey dropship live-API polling + webhook hardening#131
sktbrd merged 1 commit into
mainfrom
feat/keepkey-dropship-live-polling

Conversation

@sktbrd

@sktbrd sktbrd commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Align the KeepKey dropship integration with the live API contract from the 2026-07-15 go-live handoff so live orders can be tracked and settled.
  • Poll-by-externalOrderId (KeepKey's order.shipped webhook doesn't fire yet, so this is the only way to learn a live order shipped).
  • Harden webhook signature verification (confirmed Stripe-style HMAC + 5-min replay window).

Changes

  • src/services/keepkey-dropship.tsgetDropshipOrderByExternalId(); verifyWebhookSignature() now single Stripe-style scheme HMAC("${t}.${rawBody}") + rejects timestamps outside 5 min (WEBHOOK_TIMESTAMP_TOLERANCE_SECONDS).
  • src/app/api/store/orders/route.ts — new GET /api/store/orders?externalOrderId=….
  • src/lib/schemas/dropship.tsDropshipOrderRecord carries settlement + estimatedShippingDate.
  • src/components/store/SandboxOrderTester.tsx — polls the new route, shows tracking.
  • src/services/keepkey-dropship.test.ts (+ src/test/server-only-stub.ts, vitest alias) — 12 tests.
  • docs/integrations/keepkey-fulfillment.md — poll-only tracking, settlement, account_suspended, live-order checklist.

Test plan

  • pnpm test — 102 passing (12 new)
  • pnpm lint + prettier clean
  • Verified end-to-end against the KeepKey sandbox: POST place → GET ?externalOrderId= poll round-trip
  • After merge + redeploy, exercise the sandbox tester on /store/keepkey-hardware-wallet

Generated with Claude Code

Align the KeepKey dropship integration with the live API contract from the
2026-07-15 go-live handoff so live orders can be tracked and settled.

- Poll by externalOrderId: getDropshipOrderByExternalId + GET
  /api/store/orders?externalOrderId=… (order.shipped webhook doesn't fire
  yet, so this is the only way to learn a live order shipped). Response now
  re-returns the settlement block for recovery.
- Harden webhook verification: confirmed Stripe-style
  HMAC-SHA256("${t}.${rawBody}"); drop the ambiguous fallback and reject
  timestamps outside a 5-min window (replay defense).
- DropshipOrderRecord carries settlement + estimatedShippingDate.
- SandboxOrderTester polls the new route and shows tracking.
- Tests: signature verification + externalOrderId lookup (server-only vitest alias).
- Docs: poll-only tracking, settlement, account_suspended, live-order checklist.

Verified end-to-end against the KeepKey sandbox (place → poll round-trip).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
gnars-shadcn Ignored Ignored Jul 16, 2026 4:35am
hackertestdao Ignored Ignored Jul 16, 2026 4:35am

@sktbrd
sktbrd merged commit 53edf5b into main Jul 16, 2026
4 checks passed
@sktbrd
sktbrd deleted the feat/keepkey-dropship-live-polling branch July 16, 2026 04:35
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