Portal: - New business portal UI (portal/index.html, portal.css, portal.js) - Dashboard with real-time stats (orders today, revenue, pending, menu items) - Business info endpoint (api/businesses/get.cfm) - Portal stats endpoint (api/portal/stats.cfm) - Menu page links to existing full-featured menu editor Stripe Connect: - Onboarding endpoint (api/stripe/onboard.cfm) - Status check endpoint (api/stripe/status.cfm) - Payment intent creation (api/stripe/createPaymentIntent.cfm) - Webhook handler (api/stripe/webhook.cfm) Beacon APIs: - List all beacons (api/beacons/list_all.cfm) - Get business from beacon (api/beacons/getBusinessFromBeacon.cfm) Task System: - List pending tasks (api/tasks/listPending.cfm) - Accept task (api/tasks/accept.cfm) Other: - HUD interface for quick order status display - KDS debug/test pages - Updated Application.cfm with public endpoint allowlist - Order status check improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
82 lines
2.4 KiB
Text
82 lines
2.4 KiB
Text
<cfsetting showdebugoutput="false">
|
|
<cfsetting enablecfoutputonly="true">
|
|
|
|
<cffunction name="apiAbort" access="public" returntype="void" output="true">
|
|
<cfargument name="payload" type="struct" required="true">
|
|
<cfcontent type="application/json; charset=utf-8">
|
|
<cfoutput>#serializeJSON(arguments.payload)#</cfoutput>
|
|
<cfabort>
|
|
</cffunction>
|
|
|
|
<cffunction name="readJsonBody" access="public" returntype="struct" output="false">
|
|
<cfset var raw = getHttpRequestData().content>
|
|
<cfif isNull(raw) OR len(trim(raw)) EQ 0>
|
|
<cfreturn {}>
|
|
</cfif>
|
|
<cftry>
|
|
<cfset var data = deserializeJSON(raw)>
|
|
<cfif isStruct(data)>
|
|
<cfreturn data>
|
|
<cfelse>
|
|
<cfreturn {}>
|
|
</cfif>
|
|
<cfcatch>
|
|
<cfreturn {}>
|
|
</cfcatch>
|
|
</cftry>
|
|
</cffunction>
|
|
|
|
<cfset data = readJsonBody()>
|
|
<cfset TaskID = val( structKeyExists(data,"TaskID") ? data.TaskID : 0 )>
|
|
<cfset BusinessID = val( structKeyExists(data,"BusinessID") ? data.BusinessID : 0 )>
|
|
<cfset UserID = val( structKeyExists(request,"UserID") ? request.UserID : 0 )>
|
|
|
|
<cfif TaskID LTE 0>
|
|
<cfset apiAbort({ "OK": false, "ERROR": "missing_params", "MESSAGE": "TaskID is required." })>
|
|
</cfif>
|
|
|
|
<cftry>
|
|
<!--- Verify task exists and is pending --->
|
|
<cfset qTask = queryExecute("
|
|
SELECT TaskID, TaskStatusID, TaskBusinessID
|
|
FROM Tasks
|
|
WHERE TaskID = ?
|
|
", [ { value = TaskID, cfsqltype = "cf_sql_integer" } ], { datasource = "payfrit" })>
|
|
|
|
<cfif qTask.recordCount EQ 0>
|
|
<cfset apiAbort({ "OK": false, "ERROR": "not_found", "MESSAGE": "Task not found." })>
|
|
</cfif>
|
|
|
|
<cfif qTask.TaskStatusID NEQ 0>
|
|
<cfset apiAbort({ "OK": false, "ERROR": "already_accepted", "MESSAGE": "Task has already been accepted." })>
|
|
</cfif>
|
|
|
|
<!--- Update task to accepted status --->
|
|
<cfset queryExecute("
|
|
UPDATE Tasks
|
|
SET TaskStatusID = 1,
|
|
TaskAcceptedOn = NOW(),
|
|
TaskAcceptedByUserID = ?
|
|
WHERE TaskID = ?
|
|
AND TaskStatusID = 0
|
|
", [
|
|
{ value = UserID, cfsqltype = "cf_sql_integer", null = (UserID LTE 0) },
|
|
{ value = TaskID, cfsqltype = "cf_sql_integer" }
|
|
], { datasource = "payfrit" })>
|
|
|
|
<cfset apiAbort({
|
|
"OK": true,
|
|
"ERROR": "",
|
|
"MESSAGE": "Task accepted successfully.",
|
|
"TaskID": TaskID
|
|
})>
|
|
|
|
<cfcatch>
|
|
<cfset apiAbort({
|
|
"OK": false,
|
|
"ERROR": "server_error",
|
|
"MESSAGE": "Error accepting task",
|
|
"DETAIL": cfcatch.message
|
|
})>
|
|
</cfcatch>
|
|
</cftry>
|