freshkds

1.0.26 • Public • Published

Logo

Seemless KDS integration for your next kitchen project!

Report a Bug · Request a Feature

JavaScript NodeJS

freshKDS

FreshKDS implementation in Node.JS. This plugin was built on the documentaton from FreshKDS Developer Documentation The author of this software is not affiliated with FreshKDS or its associates in any way.

NPM

https://www.npmjs.com/package/freshkds

npm install freshkds

Import

var freshKDS = require("freshkds");

Token Based Methods

Before running any functions you need to create a new token to pass later. freshKDS.token requires three parameters,

  1. demo or production
  2. Your API key
  3. Return method in which you will store your token for later use.
var freshKDS = require("freshkds");
var token;
freshKDS.token("demo",APIKEY,(returns) => {
    token = returns;
});

Get KDS Information

This method will return any valid KDS devices and associated ID's You will need to pass your token as previously mentioned

freshKDS.token(token,(returns) => {});

Get KDS Locations

This method will return a list of all locations. Same situation! Pass your token like before

freshKDS.getKDSLocations(token,(response) => {});

Get KDS Location Devices

Returns all devices at a location. Along with your token, you also need to pass a location ID to this method.

freshKDS.getKDSLocationDevices(token,location,response){});
 

Get all active orders!

Returns all active orders by location and (optionally) device If you would like to get all devices at a location, pass "all" in your device parameter instead of a device ID.

freshKDS.getKDSActiveOrders(token,location,device,(response)=>{});
 

Order Managemenet

This (WIP) order managment will help you establish order objects instead of manually coding for them. If you would like to manually code these, please follow the documentation at Send-KDS-Order

All order management functions are provided under a subpackage freshKDS.orderManager.*

The bare minimum for an order to be processed through FreshKDS is in the "Start Order Function"

Start new order

freshKDS.orderManager.startNewOrder(id,orderName,time,mode,name,qty,mods,terminal,(returns) => {
  console.log(returns);
});

The parameters are as follows

  1. ID (Self generated, UNIQUE, Integer) EX: 001
  2. orderName (Customer Name or External Order Number, String) Ex: John Smith
  3. DateTime of Order (ISO 8601 FORMAT, STRING/DATETIME OBJECT) I recomend using Moment.JS to generate these Info
  4. Mode of Order -- Accepts one of the Following (For Here, ToGo, Pickup, DriveThru, Delivery, CurbSide) (STRING)
  5. Name of Item (First item in order), follow next function to add more items to this order. (STRING) Ex: Large Expresso
  6. Quantity of Items (First item in order) EX: 1
  7. Modifications of order, if none use [] IN ARRAY FORMAT (ARRAY) Ex: ["No Whip Cream"].
  8. Terminal ID See "Get KDS Location Devices" (STRING)

Submit Order to FreshKDS

This will transmit your order to KDS and respond with a status.

function sendKDSOrder(token,order,location,device,response => {
  console.log(response);
});

The following additional and optional functions are avaible for order managmenet All of the following can be reviewed here

freshKDS.orderManager.startNewItem(name,qty,mods,returns){}; // creates a new item object
freshKDS.orderManager.addItemsToOrder(order,items,returns){}; // adds item object to order
freshKDS.orderManager.addPickupTime(order,pickupTime,returns){}; // adds phone number to order
freshKDS.orderManager.optInForSMS(order,optIn,returns){}; // adds SMS messaging provided by freshKDS
freshKDS.orderManager.addDeliveryAddress(order,address,returns){}; // adds a delivery address
freshKDS.orderManager.addServer(order,server,returns){}; // adds a server name to an order
freshKDS.orderManager.addSource(order,source,returns){}; // adds a source to an order
freshKDS.orderManager.addSpecialInstructions(order,specialInstructions,returns){}; // adds special instructions to an order
freshKDS.orderManager.addCustomerArrivedUrl(order,customerArrivedUrl,returns){}; // adds customer arrived url instructions to an order
freshKDS.orderManager.freshKDS.orderManager.addVehicleModel(order,vehicleModel,returns){}; // adds vehicle info to order
freshKDS.orderManager.addVehicleColor(order,vehicleColor,returns){}; // adds vehicle color to an order
freshKDS.orderManager.addCosts(order,costs,returns){}; // adds unit costs to an order
freshKDS.orderManager.addDeliveryService(order,deliveryService,returns){}; // adds delivery service information to an order

Package Sidebar

Install

npm i freshkds

Weekly Downloads

0

Version

1.0.26

License

Unlicense

Unpacked Size

22.2 kB

Total Files

15

Last publish

Collaborators

  • archlinux