Commit graph

270 commits

Author SHA1 Message Date
John Mizerek
9e2c3a8478 Fix CFML syntax error in webhook.cfm breaking all Stripe webhooks
The ## escape sequence was missing the closing # for variable interpolation,
causing 500 errors on all webhook requests. Fixed ##metaTipID# -> ###metaTipID#
and similar patterns.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 16:48:25 -08:00
John Mizerek
160144d40d Remove ExpectedAmountCents column reference (migration pending)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 14:31:30 -08:00
John Mizerek
695df9fc8e Fix createChat.cfm column name: TaskID → ID
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 11:22:47 -08:00
John Mizerek
fc310c35cf Fix cancel task to not cancel order, standardize OTP messages
- Cancel Task now leaves order untouched (customer can pay another way)
- Standardized SMS text to "Your Payfrit code is:" across all endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 11:11:37 -08:00
John Mizerek
43afe9ae8c Prevent duplicate cash tasks for same order
Check for existing active (uncompleted) cash task before creating
a new one. Prevents duplicate "Pay With Cash" tasks if order status
changes are triggered multiple times.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 09:41:58 -08:00
John Mizerek
7f4af8b910 Add CancelOrder option for cash tasks
When worker passes CancelOrder: true to complete.cfm:
- Skips all cash validation and financial processing
- Sets order status to 6 (cancelled)
- Completes the task normally
- Returns OrderCancelled: true in response

For when customer changes their mind about paying with cash.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 09:39:35 -08:00
John Mizerek
eb92042de5 Use business PayfritFee instead of hardcoded 5% in task order totals
Fixed complete.cfm, getDetails.cfm, listMine.cfm, listPending.cfm to pull
PayfritFee from Businesses table with 0.05 fallback if not set.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 09:20:18 -08:00
John Mizerek
0a08b1da3e Fix beacon sharding: use ServicePoints.BeaconMinor not BeaconHardware
Matches the lookup.cfm approach:
- UUID from BeaconShards
- Major from Businesses.BeaconMajor
- Minor from ServicePoints.BeaconMinor

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 20:10:04 -08:00
John Mizerek
957f494ba8 Get beacon info from BeaconHardware table
Looks up actual ShardUUID, Major, Minor from BeaconHardware
instead of deriving from Business/ServicePoint tables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 20:06:38 -08:00
John Mizerek
dd7a4dda4a Return beacon sharding info (UUID, Major, Minor) for task completion
- UUID from BeaconShards via Business.BeaconShardID
- Major from Business.BeaconMajor
- Minor = ServicePointID

Replaces old beacon lookup via ServicePoints.BeaconID

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 20:02:19 -08:00
John Mizerek
06c4b99a66 Include ServicePointID when creating delivery tasks
Needed for beacon dwell auto-completion to work.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 19:32:37 -08:00
John Mizerek
2019b9ff43 Use proper task types for delivery/pickup tasks
- Looks up task type by name for the business instead of hardcoding ID
- Dine-in: 'Deliver to Table'
- Takeaway: 'Order Ready for Pickup'
- Delivery: 'Deliver to Address'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 19:29:47 -08:00
John Mizerek
7caf4d60b0 Fix delivery task creation when other tasks exist for order
The duplicate check was preventing delivery task creation if ANY task
existed for the order (e.g., Cash or Chat tasks). Now only checks for
TaskTypeID=1 (delivery/pickup tasks) to allow proper task creation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 19:24:59 -08:00
John Mizerek
aeeba3c6e5 Update about screen content
- Improved feature descriptions
- Updated main description
- Added "coming soon" note for delivery

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 18:36:15 -08:00
John Mizerek
01cb11dad3 fix: Cash task completion now triggers kitchen flow
When a cash task is completed, the order now goes to status 1 (submitted)
instead of directly to status 5 (complete). This allows the normal kitchen
flow to proceed: kitchen sees order → prepares → marks status 3 → delivery
task is auto-created.

Also sets PaymentStatus, PaymentCompletedOn, and SubmittedOn to match the
Stripe webhook behavior for paid orders.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 18:22:14 -08:00
John Mizerek
703a283d32 Enable cart recovery API with optional business filter
- getActiveCart now returns existing cart for user
- Optional BusinessID parameter to filter by specific business
- Used by Android app for cart recovery when scanning at a business

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 12:53:57 -08:00
John Mizerek
084e815c6c Stripe and beacon API updates
- createPaymentIntent: improved error handling
- webhook: updated payment processing
- resolve_business: minor fix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 12:53:05 -08:00
John Pinkyfloyd
ec0f2dea6a Add Latitude/Longitude to businesses list response
iOS app needs lat/lng for client-side distance calculations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 12:41:00 -08:00
John Pinkyfloyd
df903a9c75 Allow completing orphaned cash tasks without payment processing
Skip cash validation and processing for tasks with no linked order.
These are likely test tasks that were created before order linking.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 12:26:24 -08:00
John Pinkyfloyd
dc2d66b50b Add OrderTotalCents to task details for cash collection
Returns order total in cents as integer for Flutter Works app
to display exact cash amount due for cash payment tasks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 12:01:46 -08:00
John Mizerek
c5614f0f50 Disable worker-rates-customer rating prompt temporarily
Rating UI not ready in Works app yet. Will re-enable when implemented.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 11:58:20 -08:00
John Pinkyfloyd
eebf231aad Fix column names in submitCash.cfm (PaymentAddedOn, TipAmount) 2026-02-16 11:50:57 -08:00
John Pinkyfloyd
175fdfb2b9 Add submitCash.cfm endpoint for cash payments
Creates Payment record with PaymentPaidInCash and links to order
Sets PaymentStatus = 'pending' and StatusID = 1 (submitted)
2026-02-16 11:49:06 -08:00
John Mizerek
5912784772 Create 'Pay With Cash' task when cash orders reach Final Prep
- Auto-create cash task when order status transitions to 3 (Final Prep)
  and has a pending cash payment (Payments.PaymentPaidInCash > 0)
- Task includes OrderID so Android can display OrderTotal
- Task title includes service point name when available
- Fix duplicate task check: was WHERE ID = ?, now WHERE OrderID = ?

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 11:27:16 -08:00
John Pinkyfloyd
c198b68ee0 Unified OTP flow - works for both login and signup 2026-02-15 17:13:18 -08:00
John Mizerek
b96277e902 Add TaskTypeID to fixOrder task insert 2026-02-15 16:34:55 -08:00
John Pinkyfloyd
ce334cf95c Add fixOrder admin script for webhook recovery 2026-02-15 15:45:34 -08:00
John Mizerek
be29352b21 Migrate beacon APIs to shard-only system
- save.cfm: Auto-allocates shard+Major to business, creates ServicePoint with Minor
- list.cfm: Lists ServicePoints with BeaconMinor (removed legacy Beacons table)
- list_all.cfm: Returns shard UUIDs instead of legacy beacon UUIDs
- lookup.cfm: Removed legacy UUID lookup, shard-only resolution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 19:33:49 -08:00
John Mizerek
b360284e56 Beacon delete fix, price extraction, tax rate lookup, add modifiers form 2026-02-14 19:17:48 -08:00
John Mizerek
0bdf9d60b7 Fix beacon lookup to match by namespace (first 20 chars) instead of full UUID
This allows beacons to use any Eddystone-UID configuration where:
- Namespace (10 bytes) matches first 20 hex chars of shard UUID
- Instance bytes encode Major/Minor for business/service point lookup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 17:08:33 -08:00
John Mizerek
d5dab8f9c5 Fix addTeamMember query alias mismatch - qNew.ID should be qNew.EmployeeID 2026-02-13 20:42:32 -08:00
John Mizerek
3cd7bbb8b7 Fix tax rate lookup and add price extraction from __OO_STATE__
- Tax rate: Use Zippopotam (free, no key) to get state, then lookup
  from built-in state+local rate tables instead of API Ninjas
- Prices: Extract prices from Toast __OO_STATE__ MenuItem objects
  when visible HTML prices are missing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 12:05:24 -08:00
John Mizerek
76f089d1b9 Auto-populate tax rate from ZIP code using API Ninjas
When business info step loads with a ZIP code, automatically looks up
the combined sales tax rate and pre-fills the field. User can still
edit if needed. Field gets light green background to indicate auto-fill.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 11:52:56 -08:00
John Mizerek
26e5d92a03 Improve image analysis prompt - be more explicit about extracting all visible business info 2026-02-13 10:54:11 -08:00
John Mizerek
abf6965614 Image data overwrites HTML-extracted data (more reliable) 2026-02-13 10:53:48 -08:00
John Mizerek
1432d8e2b8 Use ## to escape hash in CFML string 2026-02-13 10:47:12 -08:00
John Mizerek
ba017348b0 Fix CFML syntax error - escape # in string 2026-02-13 10:46:32 -08:00
John Mizerek
aa447bd009 Fix extractDir path detection for ZIP scanning
- Extract UUID folder path from URL instead of using getDirectoryFromPath
- Old logic was broken: listLast on path ending with / returned empty string
- This caused the code to go up one level too far

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 10:32:18 -08:00
John Mizerek
f9bfbc8960 Analyze images in ZIP for business info
- Scan extracted ZIP for image files (jpg, png, gif, webp)
- Skip small files (<10KB, likely icons) and _files folder assets
- Send up to 3 images to Claude for business info extraction
- Merge extracted name, address, phone, hours, brandColor
- Only fills in fields not already found from HTML

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 10:16:18 -08:00
John Mizerek
cf34636879 Scan all HTML files in ZIP for business info
- Extract directory and scan all .htm/.html files recursively
- Look for business name in title tags (skip generic titles)
- Extract street addresses with regex patterns
- Extract phone numbers
- Check __OO_STATE__ in other pages for Restaurant data
- Merge found info into toastBusiness (first found wins)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 10:13:13 -08:00
John Mizerek
90ed78fa96 Fix: Extract categories from __OO_STATE__ groups
The __OO_STATE__ parsing was only extracting images, not the group names
as categories. Now extracts category names from menu.groups and maps
items to their proper categories.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 10:06:43 -08:00
John Mizerek
09e5807c94 Fix: Add default 'Menu' category when no categories found
Toast extraction was finding items but no h2.groupHeader categories,
leaving items ungrouped. showItemsStep() then rendered no checkboxes,
and confirmItems() filtered out all items (empty checkedIds set).

Now adds a default "Menu" category when items exist but categories is empty.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 09:35:50 -08:00
John Mizerek
b081e72347 Improve business info extraction from saved Toast pages
Added multiple fallback methods to extract business name:
1. Title tag with Toast-specific parsing
2. og:title and og:site_name meta tags
3. Header elements with restaurant/location classes
4. First h1 tag as last resort

Also added address and phone extraction from visible HTML.
Added summary logging of business info keys found.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 09:26:37 -08:00
John Mizerek
eec44011f4 Add more debug logging for title and OO_STATE extraction
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 09:21:47 -08:00
John Mizerek
e8dfd0ba7d Add debug logging for OO_STATE keys and title tag fallback
- Log all top-level keys in __OO_STATE__ to diagnose why Restaurant
  key isn't being found
- Extract business name from HTML title tag as fallback

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 09:19:32 -08:00
John Mizerek
5c49054e78 Extract business info from Toast __OO_STATE__ JSON
Look for Restaurant: keys and extract name, location (address, city,
state, zip), phone, and brandColor for the wizard business info step.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 09:12:24 -08:00
John Mizerek
c5b678ac05 Fix basePath undefined error for local temp file parsing
Define basePath before Toast parsing block so image URLs can be
properly constructed for local file uploads.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:54:10 -08:00
John Mizerek
d8e6f619ac Parse Toast menu from visible HTML for complete item extraction
- Extract items from visible HTML instead of just __OO_STATE__ JSON
- Parse headerText spans for item names, price spans for prices
- Extract images from Menu_files/ src attributes
- Fall back to simpler headerText matching if block parsing fails
- Also extract images from __OO_STATE__ and match to items by name
- Fixes issue where only 116 items extracted instead of 163+

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:53:25 -08:00
John Mizerek
b5abbe43b4 Add direct Toast menu parsing via __OO_STATE__
Skip Claude AI for Toast menus - parse the embedded JSON directly.
This extracts all items, categories, and images from the structured
__OO_STATE__ data, which is faster and more complete than AI extraction.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:34:09 -08:00
John Mizerek
1b16dd8671 Fix imageUrl field handling in menu extraction
Claude returns imageUrl but code only checked for images/imageSrc.
Add handling for imageUrl field to properly match images to items.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 08:31:24 -08:00