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/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/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)
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
SELECT
|
||||
i.ItemID,
|
||||
i.ItemCategoryID,
|
||||
c.CategoryName,
|
||||
i.ItemName,
|
||||
i.ItemDescription,
|
||||
i.ItemParentItemID,
|
||||
|
|
@ -67,6 +68,7 @@
|
|||
<cfset arrayAppend(rows, {
|
||||
"ItemID": q.ItemID,
|
||||
"ItemCategoryID": q.ItemCategoryID,
|
||||
"ItemCategoryName": q.CategoryName,
|
||||
"ItemName": q.ItemName,
|
||||
"ItemDescription": q.ItemDescription,
|
||||
"ItemParentItemID": q.ItemParentItemID,
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@
|
|||
<cfset apiAbort({
|
||||
"OK": true,
|
||||
"ERROR": "",
|
||||
"Order": {
|
||||
"ORDER": {
|
||||
"OrderID": qOrder.OrderID,
|
||||
"OrderUUID": qOrder.OrderUUID,
|
||||
"OrderUserID": qOrder.OrderUserID,
|
||||
|
|
@ -121,7 +121,7 @@
|
|||
"OrderSubmittedOn": qOrder.OrderSubmittedOn,
|
||||
"OrderServicePointID": qOrder.OrderServicePointID
|
||||
},
|
||||
"OrderLineItems": rows
|
||||
"ORDERLINEITEMS": rows
|
||||
})>
|
||||
|
||||
<cfcatch>
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@
|
|||
<cfreturn { "OK": false, "ERROR": "not_found", "MESSAGE": "Order not found", "DETAIL": "" }>
|
||||
</cfif>
|
||||
|
||||
<cfset out.Order = {
|
||||
<cfset out.ORDER = {
|
||||
"OrderID": qOrder.OrderID,
|
||||
"OrderUUID": qOrder.OrderUUID,
|
||||
"OrderUserID": qOrder.OrderUserID,
|
||||
|
|
@ -219,7 +219,7 @@
|
|||
})>
|
||||
</cfloop>
|
||||
|
||||
<cfset out.OrderLineItems = rows>
|
||||
<cfset out.ORDERLINEITEMS = rows>
|
||||
<cfset out.OK = true>
|
||||
<cfset out.ERROR = "">
|
||||
<cfreturn out>
|
||||
|
|
@ -308,7 +308,7 @@
|
|||
[
|
||||
{ value = Quantity, cfsqltype = "cf_sql_integer" },
|
||||
{ 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" }
|
||||
],
|
||||
{ datasource = "payfrit" }
|
||||
|
|
@ -365,7 +365,7 @@
|
|||
{ value = ItemID, cfsqltype = "cf_sql_integer" },
|
||||
{ value = qItem.ItemPrice, cfsqltype = "cf_sql_decimal" },
|
||||
{ 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" }
|
||||
],
|
||||
{ datasource = "payfrit" }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue