Oracle® MICROS Simphony
Simphony Kiosk JavaScript API Reference Guide
Release 19.5
F83211-01
June 2023

Copyright © 2023, Oracle and/or its affiliates.

Introduction

The Simphony Kiosk JS API provides an interface that can be utilized by an HTML5 Kiosk ordering application to access the necessary pieces of the POS logic in the Simphony ServiceHost to obtain configuration datasets, be notified of pertinent system events, trigger tax and totals calculation, initiate payment processing and create checks in the Point of Sale.
Additionally, the API offers capabilities to allow a custom HTML5 App to send print commands to a local receipt printer as well as write errors and other important troubleshooting information to the EGateway log, allowing for a consistent source for troubleshooting information.

Solution Overview

Simphony Kiosk JavaScript API solution overview.

SIMPHONY KIOSK JAVASCRIPT API Solution Overview

Get Started

1. Initialization

The SimphonyKioskApi must be initalized before use. This allows it to make the necessary websocket network connections and fetch any data it needs from Simphony.

When initialization is complete the ApiReady event will be raised. (See Events below.)

Argument for initialize(config)

The initalize(config) function takes a single argument, config, with two properties:

  • key: This is a string to identify your client app, e.g. 'MyKioskWebApp'. Used by Simphony logging.
  • onApiEvent: This is the callback function to handle events raised by SimphonyKioskApi. It should take one argument, the event object.
Example use
Initialization
// Initializing SimphonyKioskAPI
var config =
{
  key: 'MyKioskWebApp',
  onApiEvent: myOnApiEventHandler,
};
SimphonyKioskAPI.initialize(config);
Handler for onApiEvent
function myOnApiEventHandler(event)
{
  switch (event.Message) {
    case 'ApiReady':
      console.log('SimphonyKioskAPI initialized successfully and is ready for use.');
      break;
    default:
      console.log(event.Message);
      break;
}

Events

The SimphonyKioskApi raises asynchronous events which can be handled.

The callback handler is set in the onApiEvent property passed when calling initialize().

Event properties

Events will have one of the folowing values for Message:

  • ApiReady
  • ServerConnectionLost
  • Error
  • ConfigurationDataUpdated
  • MenuItemAvailabilityDataUpdated
  • Scanner
  • ScannerError

Events may have one or more of the following properties populated:

  • Description
  • Data
  • IsFatal

Event types by Message

ApiReady

Raised when the SimphonyKioskApi is initialized and ready for use.

  • Description: The event code which was returned from the websocket connection.
ServerConnectionLost

Raised when the websocket loses connection.

  • Description: The event code which was returned from the websocket connection.
Error

Raised when there is an error from the websocket connection.

  • Description: The string 'Server communications error: ' followed by the event code which was returned from the websocket connection..
  • IsFatal: boolean which indicates if the error is recoverable or not.
ConfigurationDataUpdated

Raised when updated configuration data is sent to SimphonyKioskApi from the POS.

MenuItemAvailabilityDataUpdated

Raised when the updated menu item availability data is sent to SimphonyKioskApi from the POS.

Scanner

Raised when a barcode is scanned.

  • Data: The value of the scanned barcode as a string.
ScannerError

Raised when a barcode is scanned unsuccessfully.

  • Description: The reason for the failure.

2. Getting kiosk parameters from kioskParameters

This is a JSON string containing various settings for the Kiosk web app.

Its value is the _KioskParameters_ entry in EMC's "Content" for the current revenue center.

3. Getting configuration from posConfiguration

The SimphonyKioskApi's posConfiguration property contains all the configuration settings for the revenue center.

Note: posConfiguration must not be accessed before the ApiReady event has been raised. Attempts to do so before initalization is complete will result in errors or incorrect data.

The properties of posConfiguration contain the various types of data.

Properties of posConfiguration

The following properties are defined on posConfiguration. A brief description is given below. A more complete specification can be found at LINK_TO_JSDOC.

menu

A menu describes the set of items that can be ordered from a revenue center. The menu includes the menu items, prices, and related information necessary to order an item.

discounts

The discount collection is a list of discounts that can be used when interacting with the checks endpoint. The API returns a collection of discounts that can be used at the specified revenue center.

tenders

The tender collection is a list of tenders that can be used for payment when interacting with the checks endpoint. The API returns a collection of tenders for the specified revenue center.

servicecharges

The service charge collection is a list of service charges that can be used when interacting with the checks endpoint. The API returns a collection of service charges that can be used at the specified revenue center.

barcodes

The barcodes array contains all available barcodes

rvc

A revenue center represents the organizational entity that produces and sells items and services.

location

A location represents the places of business within a customer's organization. A location can have one or more revenue centers.

menuitemAvailability

This contains data about which menu items which are currently unavailable for sale.

Logging to EGateway with logToHost

Log entries can be sent to the EGateway logs using the logToHost(message, logLevel) function.

The parameter message is a string containing the message for the entry.

The parameter level is a number indicating the Simphony log level severity for the entry:

level value Simphony log level
-99 NONE
-3 LOG_ALWAYS_ERROR
-2 LOG_ALWAYS_WARN
-1 LOG_ALWAYS_INFO
0 LOG_ALWAYS_DEBUG
0 LOG_ALWAYS
1 LIGHT_FLOW
2 GENERAL_FLOW
3 DETAIL_FLOW
4 BUFFER_DUMPS
5 ULTIMATE_DEBUG
Example
SimphonyKioskAPI.logToHost('My General Flow message', 2);
SimphonyKioskAPI.logToHost("Some message at level zero" 0);

4. Making API calls

It is required to retrieve Kiosk parameters from KioskParameters file in order to be able to make subsequent API calls Calculate totals for a Check, Create Payment for a Check and Submit a Check. The configuration details from the KioskParamaters have to be used to make API calls to get posConfiguration, Calculate totals for a Check, Create Payment for a Check and Submit a Check.

Calculate totals for a Check

SimphonyKioskApi has two functions for calculating a check, one asynchronous and the other not. Both functions take a Check as the only parameter.

The calculateTotals(check) function will return a Check containing the result of the calculation, or an error message if unsuccessful.

The calculateTotalsAsync(check) function returns a resolved Promise with a Check containing the result of the calculation, or a rejected Promise with an error message if unsuccessful.

Create Payment for a Check

Before a Check is submitted any required payments in its tenders should be created and processed. For Service Total tenders the payment will need to be removed.

Service Total tenders

You must use the removePaymentData() to remove the empty payment created by the TenderItem constructor.

Tenders where payment is required

SimphonyKioskApi has two functions for creating a payment, one asynchronous and the other not. Both functions take a AuthAndPayRequest as the only parameter.

The submitPayment(req) function takes an AuthAndPayRequest as an argument and returns an AuthAndPayResponse.

The submitPaymentAsync(req) function takes an AuthAndPayRequest as an argument and returns a resolved Promise with an AuthAndPayResponse, or an error message if unsuccessful.

If successful the response should be added to the Check's tenders.paymentData before it is submitted.

AuthAndPayResponse

This contains the response from the payment provider.

If DriverSuccess is true then the payment provider was contacted successfully. If it is false then there was a problem contacting the payment provider and the payment was not processed. In this case DriverMessage may describe the problem encountered.

If the payment provider was contacted successfully then RespCode will contain the response code from the payment provider indicating whether the request was successful or not.

More information

You can access Oracle Payment Interface documentation through the following Oracle Hospitality documentation page: https://docs.oracle.com/en/industries/hospitality/integration_platforms.html

Submit a Check

Once a Check is ready it can be submitted.

SimphonyKioskApi has two functions for submitting a Check, one asynchronous and the other not. Both functions take a Check as the only parameter.

The submitCheck(check) function returns the Check.

The submitCheckAsync(check) function returns a Promise containing a Check.

Simphony Kiosk JavaScript API

The Simphony Kiosk JavaScript API can be used to get information about a revenue center and place orders.

Simphony Kiosk JavaScript API
Static Members
new __SimphonyKioskAPI()

Types used in ordering

These are the types used for creating and placing Checks.

Types used in ordering
Static Members
new AuthAndPayRequest()
new AuthAndPayResponse()
new Check()
new CheckHeader()
new CheckTotals()
new ComboMealItem()
new ExtensionItem()
new PaymentData()
new TaxItem()

POS Configuration Types

These are the types returned by SimphonyKioskApi posConfiguration()

POS Configuration Types
Static Members
ConfigurationData
new CondimentItem()
new CondimentItemDefinition()
new FamilyGroupItem()
new Allergen()
new ScreenLookup()
new BarcodeCollection()
new BarcodeItem()
new DiscountCollection()
new DiscountItem()
new ServiceChargeCollection()
new ServiceChargeItem()
new TaxDefinitions()
new TaxClassItem()
new TaxRateItem()
new TenderCollection()
new TenderItem()
new Organization()
new Location()
new RevenueCenter()
new GeoLocation()
new OrderType()
new SuggestedTip()
new PosPlatform()
new PostalAddress()
new Timezone()
new TranslatedString()

Examples

Examples

Menu

{
     "orgShortName": "mymeal",
     "locRef": "store66",
     "rvcRef": 2,
     "menuId": "myb:store2:dining",
     "name": "Bar Menu",
     "description": "string",
     "menuItems": [
         {
             "name": {
                 "en-US": "Coffee",
                 "de-DE": "Kaffee",
                 "ar-AR": "قهوة"
             },
             "menuItemId": 32,
             "familyGroupRef": 0,
             "definitions": [
                 {
                     "definitionSequence": 0,
                     "name": {
                         "en-US": "Coffee",
                         "de-DE": "Kaffee",
                         "ar-AR": "قهوة"
                     },
                     "name2": {
                         "en-US": "Coffee",
                         "de-DE": "Kaffee",
                         "ar-AR": "قهوة"
                     },
                     "slus": [
                         {
                             "sluNumber": 0,
                             "sluId": 0,
                             "name": {
                                 "en-US": "Coffee",
                                 "de-DE": "Kaffee",
                                 "ar-AR": "قهوة"
                             },
                             "images": [
                                 {
                                     "index": "string",
                                     "url": "https://oracleObjectStore.com/images/coffee822815.jpg",
                                     "altText": "pizza",
                                     "description": "string",
                                     "isCloudImage": true,
                                     "size": "string"
                                 }
                             ]
                         }
                     ],
                     "taxClassRef": 0,
                     "prices": [
                         {
                             "priceSequence": 0,
                             "price": 0,
                             "name": "string"
                         }
                     ],
                     "defaultCondiments": [
                         {
                             "condimentRef": 0,
                             "quantity": 1
                         }
                     ],
                     "condimentGroupRules": [
                         {
                             "condimentGroupRef": 5802109,
                             "minimumCount": 1,
                             "maximumCount": 0
                         }
                     ],
                     "consumerName": {
                         "en-US": "Coffee",
                         "de-DE": "Kaffee",
                         "ar-AR": "قهوة"
                     },
                     "consumerDescription": {
                         "en-US": "Coffee",
                         "de-DE": "Kaffee",
                         "ar-AR": "قهوة"
                     },
                     "images": [
                         {
                             "index": "string",
                             "url": "https://oracleObjectStore.com/images/coffee822815.jpg",
                             "altText": "pizza",
                             "description": "string",
                             "isCloudImage": true,
                             "size": "string"
                         }
                     ],
                     "consumerAdvisoryText": {
                         "en-US": "Coffee",
                         "de-DE": "Kaffee",
                         "ar-AR": "قهوة"
                     },
                     "allergens": [
                         "milk",
                         "peanut"
                     ],
                     "nutritionalData": [
                         {
                             "nutritionalItemId": "fat, sodium",
                             "value": 475,
                             "unitOfMeasure": "grams, milligrams, calorie",
                             "name": {
                                 "en-US": "Coffee",
                                 "de-DE": "Kaffee",
                                 "ar-AR": "قهوة"
                             }
                         }
                     ],
                     "options": [
                         "containsAlcohol"
                     ],
                     "tags": [
                         "hot",
                         "cold"
                     ],
                     "tagGroups": [
                         {
                             "id": "string",
                             "tags": [
                                 "spicy",
                                 "lo-carb"
                             ]
                         }
                     ],
                     "extensions": {
                         "additionalProp1": "string",
                         "additionalProp2": "string",
                         "additionalProp3": "string"
                     }
                 }
             ],
             "dietaryInformation": [
                 "string"
             ],
             "tags": [
                 "string"
             ],
             "tagGroups": [
                 {
                     "id": "string",
                     "tags": [
                         "spicy",
                         "lo-carb"
                     ]
                 }
             ]
         }
     ],
     "comboMeals": [
         {
             "comboMealId": 0,
             "name": "string",
             "menuItemRef": 0,
             "comboGroups": [
                 {
                     "comboGroupId": 0,
                     "name": "string",
                     "count": 0,
                     "isMainGroup": true,
                     "prices": [
                         {
                             "priceSequence": 0,
                             "price": 0,
                             "name": "string"
                         }
                     ],
                     "menuItems": [
                         {
                             "menuItemRef": 0,
                             "count": 0,
                             "prices": [
                                 {
                                     "priceSequence": 0,
                                     "price": 0,
                                     "name": "string"
                                 }
                             ]
                         }
                     ]
                 }
             ]
         }
     ],
     "condimentItems": [
         {
             "name": {
                 "en-US": "Coffee",
                 "de-DE": "Kaffee",
                 "ar-AR": "قهوة"
             },
             "condimentId": 32,
             "familyGroupRef": 0,
             "definitions": [
                 {
                     "number": 0,
                     "name": {
                         "en-US": "Coffee",
                         "de-DE": "Kaffee",
                         "ar-AR": "قهوة"
                     },
                     "name2": {
                         "en-US": "Coffee",
                         "de-DE": "Kaffee",
                         "ar-AR": "قهوة"
                     },
                     "slus": [
                         {
                             "sluNumber": 0,
                             "sluId": 0,
                             "name": {
                                 "en-US": "Coffee",
                                 "de-DE": "Kaffee",
                                 "ar-AR": "قهوة"
                             },
                             "images": [
                                 {
                                     "index": "string",
                                     "url": "https://oracleObjectStore.com/images/coffee822815.jpg",
                                     "altText": "pizza",
                                     "description": "string",
                                     "isCloudImage": true,
                                     "size": "string"
                                 }
                             ]
                         }
                     ],
                     "prices": [
                         {
                             "priceSequence": 0,
                             "price": 0,
                             "name": "string"
                         }
                     ],
                     "consumerName": {
                         "en-US": "Coffee",
                         "de-DE": "Kaffee",
                         "ar-AR": "قهوة"
                     },
                     "consumerDescription": {
                         "en-US": "Coffee",
                         "de-DE": "Kaffee",
                         "ar-AR": "قهوة"
                     },
                     "images": [
                         {
                             "index": "string",
                             "url": "https://oracleObjectStore.com/images/coffee822815.jpg",
                             "altText": "pizza",
                             "description": "string",
                             "isCloudImage": true,
                             "size": "string"
                         }
                     ],
                     "allergens": [
                         "milk",
                         "peanut"
                     ],
                     "nutritionalData": [
                         {
                             "nutritionalItemId": "fat, sodium",
                             "value": 475,
                             "unitOfMeasure": "grams, milligrams, calorie",
                             "name": {
                                 "en-US": "Coffee",
                                 "de-DE": "Kaffee",
                                 "ar-AR": "قهوة"
                             }
                         }
                     ],
                     "options": [
                         "containsAlcohol"
                     ],
                     "tags": [
                         "hot",
                         "cold"
                     ],
                     "tagGroups": [
                         {
                             "id": "string",
                             "tags": [
                                 "spicy",
                                 "lo-carb"
                             ]
                         }
                     ],
                     "extensions": {
                         "additionalProp1": "string",
                         "additionalProp2": "string",
                         "additionalProp3": "string"
                     }
                 }
             ],
             "dietaryInformation": [
                 "string"
             ],
             "tags": [
                 "string"
             ],
             "tagGroups": [
                 {
                     "id": "string",
                     "tags": [
                         "spicy",
                         "lo-carb"
                     ]
                 }
             ]
         }
     ],
     "condimentGroups": [
         {
             "condimentGroupId": 32,
             "name": {
                 "en-US": "Coffee",
                 "de-DE": "Kaffee",
                 "ar-AR": "قهوة"
             },
             "condimentItemRefs": [
                 0
             ],
             "consumerName": {
                 "en-US": "Coffee",
                 "de-DE": "Kaffee",
                 "ar-AR": "قهوة"
             },
             "consumerDescription": {
                 "en-US": "Coffee",
                 "de-DE": "Kaffee",
                 "ar-AR": "قهوة"
             },
             "images": [
                 {
                     "index": "string",
                     "url": "https://oracleObjectStore.com/images/coffee822815.jpg",
                     "altText": "pizza",
                     "description": "string",
                     "isCloudImage": true,
                     "size": "string"
                 }
             ]
         }
     ],
     "familyGroups": [
         {
             "familyGroupItemId": 0,
             "name": {
                 "en-US": "Coffee",
                 "de-DE": "Kaffee",
                 "ar-AR": "قهوة"
             },
             "consumerName": {
                 "en-US": "Coffee",
                 "de-DE": "Kaffee",
                 "ar-AR": "قهوة"
             },
             "consumerDescription": {
                 "en-US": "Coffee",
                 "de-DE": "Kaffee",
                 "ar-AR": "قهوة"
             },
             "images": [
                 {
                     "index": "string",
                     "url": "https://oracleObjectStore.com/images/coffee822815.jpg",
                     "altText": "pizza",
                     "description": "string",
                     "isCloudImage": true,
                     "size": "string"
                 }
             ]
         }
     ],
     "allergens": [
         {
             "allergenId": "string",
             "name": {
                 "en-US": "Coffee",
                 "de-DE": "Kaffee",
                 "ar-AR": "قهوة"
             }
         }
     ]
}

Discount Collection

{
    "orgShortName": "mymeal",
    "locRef": "store66",
    "rvcRef": 2,
    "items": [
        {
            "discountId": 13,
            "name": {
                "en-US": "Coffee",
                "de-DE": "Kaffee",
                "ar-AR": "قهوة"
            },
            "type": "amount",
            "value": 5,
            "consumerName": {
                "en-US": "Coffee",
                "de-DE": "Kaffee",
                "ar-AR": "قهوة"
            },
            "consumerDescription": {
                "en-US": "Coffee",
                "de-DE": "Kaffee",
                "ar-AR": "قهوة"
            },
            "extensions": {
                "additionalProp1": "string",
                "additionalProp2": "string",
                "additionalProp3": "string"
            }
        }
    ]
}

Service Charge Collection

{
    "orgShortName": "mymeal",
    "locRef": "store66",
    "rvcRef": 2,
    "items": [
        {
            "serviceChargeId": 0,
            "name": "string",
            "type": "amount",
            "value": 5,
            "consumerName": {
                "en-US": "Coffee",
                "de-DE": "Kaffee",
                "ar-AR": "قهوة"
            },
            "consumerDescription": {
                "en-US": "Coffee",
                "de-DE": "Kaffee",
                "ar-AR": "قهوة"
            },
            "extensions": {
                "additionalProp1": "string",
                "additionalProp2": "string",
                "additionalProp3": "string"
            }
        }
    ]
}

Tax Definitions

{
    "orgShortName": "mymeal",
    "locRef": "store66",
    "rvcRef": 2,
    "taxClasses": [
        {
            "taxClassId": 0,
            "activeTaxRateRefs": [
                0
            ]
        }
    ],
    "taxRates": [
        {
            "taxRateId": 0,
            "percentage": 0,
            "taxType": "addonBreakpoint",
            "name": {
                "en-US": "Coffee",
                "de-DE": "Kaffee",
                "ar-AR": "قهوة"
            },
            "repeatStartIndex": 0,
            "repeatEndIndex": 0,
            "startAmount": 0,
            "breakpoints": [
                0
            ]
        }
    ]
}

Tender Collection

{
    "orgShortName": "mymeal",
    "locRef": "store66",
    "rvcRef": 2,
    "items": [
        {
            "tenderId": 0,
            "name": "string",
            "type": "serviceTotal",
            "consumerName": {
                "en-US": "Coffee",
                "de-DE": "Kaffee",
                "ar-AR": "قهوة"
            },
            "consumerDescription": {
                "en-US": "Coffee",
                "de-DE": "Kaffee",
                "ar-AR": "قهوة"
            },
            "extensions": {
                "additionalProp1": "string",
                "additionalProp2": "string",
                "additionalProp3": "string"
            }
        }
    ]
}

Barcode Collection

{
    "orgShortName": "mymeal",
    "locRef": "store66",
    "rvcRef": 2,
    "items": [
        {
            "barcodeId": 1,
            "barcode": "00003000002",
            "menuItemId": 32.
            "definitionSequence": 1,
            "price": 14.99
        }
    ]
}

MenuItem Availability

{
    "orgShortName": "mymeal",
    "locRef": "store66",
    "rvcRef": 2,
    "items": [
        {
            "menuItemId": 32,
            "definitions": [
                {
                    "definitionSequence": 1
                }
            ]
        }
    ]
}

Organization

{
    "limit": 0,
    "offset": 0,
    "count": 0,
    "items": [
        {
            "orgShortName": "tfoinc",
            "name": "The Food Organization Inc"
        }
    ]
}

Location

{
    "orgShortName": "tfoinc",
    "locRef": "fdmnh144",
    "name": "The Food Organization Inc",
    "currency": "USD",
    "languages": [
        "en-GB",
        "fr-FR",
        "de-DE"
    ],
    "timezone": {
        "ianaName": "America/New_York",
        "windowsName": "Eastern Standard Time",
        "tzIndex": 23
    },
    "address": {
        "addressLine1": "144 W 54th St",
        "addressLine2": "Suite 11B",
        "floor": "42A",
        "locality": "New York",
        "region": "NY",
        "postalCode": "10019",
        "country": "USA",
        "notes": "West Entrance"
    },
    "phoneNumber": "(0030) 0453 343 234",
    "geoLocation": {
        "latitude": 40.763188,
        "longitude": -73.914835
    },
    "posPlatform": {
        "name": "Oracle.Simphony",
        "version": "19.2.0.1234"
    }
}

Revenue Center

{
    "orgShortName": "tfoinc",
    "locRef": "fdmnh144",
    "rvcRef": 5234,
    "name": "Bar",
    "orderTypes": [
        {
            "orderTypeRef": 1,
            "name": "Eat In",
            "serviceLevelTime": 20,
            "suggestedTips": [
                {
                    "isDefault": false,
                    "percentage": 10
                },
                {
                    "isDefault": true,
                    "percentage": 20
                },
                {
                    "isDefault": false,
                    "percentage": 25
                }
            ]
        },
        {
            "orderTypeRef": 2,
            "name": "Take Out",
            "serviceLevelTime": 30,
            "suggestedTips": [
                {
                    "isDefault": true,
                    "percentage": 18
                },
                {
                    "isDefault": false,
                    "percentage": 20
                },
                {
                    "isDefault": false,
                    "percentage": 25
                }
            ]
        }
    ],
    "tables": [
        "1",
        "2",
        "3",
        "B1",
        "B2"
    ],
    "address": {
        "addressLine1": "144 W 54th St",
        "addressLine2": "Suite 11B",
        "floor": "42A",
        "locality": "New York",
        "region": "NY",
        "postalCode": "10019",
        "country": "USA",
        "notes": "West Entrance"
    },
    "phoneNumber": "2741022334",
    "geoLocation": {
        "latitude": 40.763188,
        "longitude": -73.914835
    }
}

GeoLocation

"geoLocation": {
    "latitude": 40.763188,
    "longitude": -73.914835
}

Order Type

"orderTypes": [
    {
        "orderTypeRef": 1,
        "name": "Eat In"
    },
    {
        "orderTypeRef": 2,
        "name": "Take Out"
    }
]

Suggested Tip

"suggestedTips": [
    {
        "isDefault": false,
        "percentage": 10
    },
    {
        "isDefault": true,
        "percentage": 20
    },
    {
        "isDefault": false,
        "percentage": 25
    }
]

Pos Platform

"posPlatform": {
    "name": "Oracle.Simphony",
    "version": "19.2.0.1234"
}

Postal Address

"address": {
    "addressLine1": "144 W 54th St",
    "addressLine2": "Suite 11B",
    "floor": "42A",
    "locality": "New York",
    "region": "NY",
    "postalCode": "10019",
    "country": "USA",
    "notes": "West Entrance"
}

Timezone

"timezone": {
  "ianaName": "America/New_York",
  "windowsName": "Eastern Standard Time",
  "tzIndex": 23
}