Add cart endpoints and enhance menu API
Cart management improvements: - Added cart endpoints to public API allowlist (getOrCreateCart, setLineItem, getCart, submit) - Fixed setLineItem null parameter handling for remarks - Standardized API responses to use uppercase keys (ORDER, ORDERLINEITEMS) - Updated getCart to match response format consistency - Added CategoryName to menu items endpoint These changes enable the mobile app to browse menu with categories and manage cart operations without authentication. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d3eef67e2e
commit
4dcf4e4385
4 changed files with 12 additions and 6 deletions
|
|
@ -64,6 +64,10 @@ if (len(request._api_path)) {
|
||||||
if (findNoCase("/api/businesses/list.cfm", request._api_path)) request._api_isPublic = true;
|
if (findNoCase("/api/businesses/list.cfm", request._api_path)) request._api_isPublic = true;
|
||||||
if (findNoCase("/api/servicepoints/list.cfm", request._api_path)) request._api_isPublic = true;
|
if (findNoCase("/api/servicepoints/list.cfm", request._api_path)) request._api_isPublic = true;
|
||||||
if (findNoCase("/api/menu/items.cfm", request._api_path)) request._api_isPublic = true;
|
if (findNoCase("/api/menu/items.cfm", request._api_path)) request._api_isPublic = true;
|
||||||
|
if (findNoCase("/api/orders/getOrCreateCart.cfm", request._api_path)) request._api_isPublic = true;
|
||||||
|
if (findNoCase("/api/orders/getCart.cfm", request._api_path)) request._api_isPublic = true;
|
||||||
|
if (findNoCase("/api/orders/setLineItem.cfm", request._api_path)) request._api_isPublic = true;
|
||||||
|
if (findNoCase("/api/orders/submit.cfm", request._api_path)) request._api_isPublic = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carry session values into request (if present)
|
// Carry session values into request (if present)
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
SELECT
|
SELECT
|
||||||
i.ItemID,
|
i.ItemID,
|
||||||
i.ItemCategoryID,
|
i.ItemCategoryID,
|
||||||
|
c.CategoryName,
|
||||||
i.ItemName,
|
i.ItemName,
|
||||||
i.ItemDescription,
|
i.ItemDescription,
|
||||||
i.ItemParentItemID,
|
i.ItemParentItemID,
|
||||||
|
|
@ -67,6 +68,7 @@
|
||||||
<cfset arrayAppend(rows, {
|
<cfset arrayAppend(rows, {
|
||||||
"ItemID": q.ItemID,
|
"ItemID": q.ItemID,
|
||||||
"ItemCategoryID": q.ItemCategoryID,
|
"ItemCategoryID": q.ItemCategoryID,
|
||||||
|
"ItemCategoryName": q.CategoryName,
|
||||||
"ItemName": q.ItemName,
|
"ItemName": q.ItemName,
|
||||||
"ItemDescription": q.ItemDescription,
|
"ItemDescription": q.ItemDescription,
|
||||||
"ItemParentItemID": q.ItemParentItemID,
|
"ItemParentItemID": q.ItemParentItemID,
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
<cfset apiAbort({
|
<cfset apiAbort({
|
||||||
"OK": true,
|
"OK": true,
|
||||||
"ERROR": "",
|
"ERROR": "",
|
||||||
"Order": {
|
"ORDER": {
|
||||||
"OrderID": qOrder.OrderID,
|
"OrderID": qOrder.OrderID,
|
||||||
"OrderUUID": qOrder.OrderUUID,
|
"OrderUUID": qOrder.OrderUUID,
|
||||||
"OrderUserID": qOrder.OrderUserID,
|
"OrderUserID": qOrder.OrderUserID,
|
||||||
|
|
@ -121,7 +121,7 @@
|
||||||
"OrderSubmittedOn": qOrder.OrderSubmittedOn,
|
"OrderSubmittedOn": qOrder.OrderSubmittedOn,
|
||||||
"OrderServicePointID": qOrder.OrderServicePointID
|
"OrderServicePointID": qOrder.OrderServicePointID
|
||||||
},
|
},
|
||||||
"OrderLineItems": rows
|
"ORDERLINEITEMS": rows
|
||||||
})>
|
})>
|
||||||
|
|
||||||
<cfcatch>
|
<cfcatch>
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@
|
||||||
<cfreturn { "OK": false, "ERROR": "not_found", "MESSAGE": "Order not found", "DETAIL": "" }>
|
<cfreturn { "OK": false, "ERROR": "not_found", "MESSAGE": "Order not found", "DETAIL": "" }>
|
||||||
</cfif>
|
</cfif>
|
||||||
|
|
||||||
<cfset out.Order = {
|
<cfset out.ORDER = {
|
||||||
"OrderID": qOrder.OrderID,
|
"OrderID": qOrder.OrderID,
|
||||||
"OrderUUID": qOrder.OrderUUID,
|
"OrderUUID": qOrder.OrderUUID,
|
||||||
"OrderUserID": qOrder.OrderUserID,
|
"OrderUserID": qOrder.OrderUserID,
|
||||||
|
|
@ -219,7 +219,7 @@
|
||||||
})>
|
})>
|
||||||
</cfloop>
|
</cfloop>
|
||||||
|
|
||||||
<cfset out.OrderLineItems = rows>
|
<cfset out.ORDERLINEITEMS = rows>
|
||||||
<cfset out.OK = true>
|
<cfset out.OK = true>
|
||||||
<cfset out.ERROR = "">
|
<cfset out.ERROR = "">
|
||||||
<cfreturn out>
|
<cfreturn out>
|
||||||
|
|
@ -308,7 +308,7 @@
|
||||||
[
|
[
|
||||||
{ value = Quantity, cfsqltype = "cf_sql_integer" },
|
{ value = Quantity, cfsqltype = "cf_sql_integer" },
|
||||||
{ value = qItem.ItemPrice, cfsqltype = "cf_sql_decimal" },
|
{ value = qItem.ItemPrice, cfsqltype = "cf_sql_decimal" },
|
||||||
{ value = (len(trim(Remark)) EQ 0 ? javacast("null","") : Remark), cfsqltype = "cf_sql_varchar", null = (len(trim(Remark)) EQ 0) },
|
{ value = Remark, cfsqltype = "cf_sql_varchar", null = (len(trim(Remark)) EQ 0) },
|
||||||
{ value = qExisting.OrderLineItemID, cfsqltype = "cf_sql_integer" }
|
{ value = qExisting.OrderLineItemID, cfsqltype = "cf_sql_integer" }
|
||||||
],
|
],
|
||||||
{ datasource = "payfrit" }
|
{ datasource = "payfrit" }
|
||||||
|
|
@ -365,7 +365,7 @@
|
||||||
{ value = ItemID, cfsqltype = "cf_sql_integer" },
|
{ value = ItemID, cfsqltype = "cf_sql_integer" },
|
||||||
{ value = qItem.ItemPrice, cfsqltype = "cf_sql_decimal" },
|
{ value = qItem.ItemPrice, cfsqltype = "cf_sql_decimal" },
|
||||||
{ value = (ParentLineItemID EQ 0 ? Quantity : 1), cfsqltype = "cf_sql_integer" },
|
{ value = (ParentLineItemID EQ 0 ? Quantity : 1), cfsqltype = "cf_sql_integer" },
|
||||||
{ value = (len(trim(Remark)) EQ 0 ? javacast("null","") : Remark), cfsqltype = "cf_sql_varchar", null = (len(trim(Remark)) EQ 0) },
|
{ value = Remark, cfsqltype = "cf_sql_varchar", null = (len(trim(Remark)) EQ 0) },
|
||||||
{ value = now(), cfsqltype = "cf_sql_timestamp" }
|
{ value = now(), cfsqltype = "cf_sql_timestamp" }
|
||||||
],
|
],
|
||||||
{ datasource = "payfrit" }
|
{ datasource = "payfrit" }
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue