Coder Social home page Coder Social logo

freshkds's Introduction

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

freshkds's People

Contributors

arch-linux avatar

Watchers

James Cloos avatar  avatar

freshkds's Issues

JSON parser

JSON manager for the following

  • Locations
  • Devices
  • Items
  • Orders

KDS Cloud Notifications

Saving the best for last -- KDS Cloud Notifications

Preserving this one for V1.2

POST /integrators/kds-notifications/customer-arrived
POST /integrators/kds-notifications/estimated-arrival-update

Reference this

POST /integrators/kds-orders

POST /integrators/kds-orders

Additional Headers

x-location-id: {locationId}
x-device-ids: {Comma delimited for multiple devices, value of 'all' for all active devices at location}

KDS Order

Property Required Type Description
id yes string Integration order id
name yes string Order Name/Number
time yes date Order Date/Time, ISO 8601 Format
pickupTime no date Pickup Date/Time, ISO 8601 Format
phoneNumber no string Phone number to contact regarding order
optInForSms no bool If a phone number is supplied and KDS is configured to send SMS messages, provides an option to send a SMS or not for this order. NOTE: If this property is not sent, default is true
deliveryAddress no string If order is for delivery, can supply and address for display
mode yes string Order Mode (For Here, ToGo, Pickup, DriveThru, Delivery, CurbSide) note: if invalid order mode, mode will be added to order name
server no string Server Name
source no string Identifier of Integrator. This is for partner integrations with KDS and value to send must be supplied by Fresh Technology. Current accepted values are null or togotechnology.
items yes KdsItem[] Items
terminal yes string Pos Terminal
specialInstructions no string Text based special instructions that will be displayed on the order
customerArrivedUrl no url If SMS Bolt-On enabled and this value is supplied. This link will be included with the SMS for Order Received and Order Ready for Pickup. This URL should route to integrators system to send the Customer Arrived Notification to KDS
vehicleModel no string Car Model
vehicleColor no string Car Color
retry no object If specified devices are not connected when the order is sent. Values in this object are used for notification and expiration
costs no Costs Object that contains costs associated with the order
deliveryService no DeliveryService Object contains information regarding the order if a delivery service is being used
accessibility no Accessibility Object contains information regarding accessibility (ADA) neededs

KDS Item

Property Required Type Description
id no string Item Id
name yes string Item Name
qty yes int Quantity
price no string Cost of item, value should be a string and can include the currency symbol or not
mods yes string[] Item Modifiers, empty array if none
specialInstructions no string Text based special instructions that will be displayed on the item

NOTE: Order responds will include an array of device id's and status of delivery to the device. If a retry object is specified, KDS Cloud will attempt to deliver until the expiration time. If no expiration time is specified, retry will attempt for 2 minutes.

Notification POST Data

If a notificationUrl is provided, when either all deliveries are successful, or the order delivery has expired, a POST will be made to the supplied url

Costs

Property Required Type Description
subtotal no string Sub total of the order
tax no string Tax on the order
deliveryFee no string Delivery Fee for the order
surcharge no string Surcharge for the order
convenienceFee no string Convenience Fee for the order
tip no string Tip on the order
additionalFees no additionalFees[] Additional / Custom Fees
total no string Total for the order
promoCodes no promoCodes[] Promo codes for the order



Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.