← All tests

Loyalty app — claim delivery spins by screenshot DEV

Phase 5 delivery slice on the customer app. Members already claim delivery-order spin chances by typing the order number; this adds the OCR screenshot fallback from Blueprint v1.1 — snap the delivery-app order screenshot, the backend’s vision provider reads the order number, and the same claim logic attributes the spin chances. When the photo can’t be read, the app cleanly nudges the member back to manual order-# entry.

New E2E 6/6 (screenshot upload → claim, expo-web vs local backend) · regression: verify-app 16/16 + manual delivery-claim 6/6 · tsc clean.

App-only slice — the backend POST /delivery/claim-screenshot (multipart → pluggable OCR provider → shared claim helper) already shipped; this wires the app to it. New api.claimDeliveryScreenshot() (cross-platform multipart) + an “Upload order screenshot” button on the Spin › Claim Chance panel via expo-image-picker. Verified with the dev-echo OCR provider (no paid vision API); prod uses Claude vision behind ANTHROPIC_API_KEY.

Screenshot-claim checks (demo tenant, spin on):

delivery order ingested (2 items → 2 spin chances)
Claim panel renders the “Upload order screenshot” button
upload → OCR reads the order # → claim success feedback (claiming window)
chances list shows the 2 claiming chances (unlock ~1h after order)
unreadable screenshot → ocr_no_order_code → “enter it above instead”
regression unaffected: verify-app 16/16 · manual delivery-claim 6/6

The flow

Claim Chance panel with upload button
Claim Chance — type the order # or “Upload order screenshot”
After a successful screenshot upload
Photo uploaded — OCR read the order #; 2 spins claimed (unlock in ~1h)
Unreadable screenshot fallback
Unreadable photo — nudges the member to enter the number manually

nix-loyalty-app src/lib/api.ts + src/app/(tabs)/spin.tsx (commit b4e4ac9, branch master) · expo-image-picker@17 · verify harness test-app-delivery-screenshot.mjs · local dev, no EAS build.