A wrapper for the Doshii Partner API
Our API has been designed specifically to provide seamless integration into any POS, whether cloud or legacy. Built on the cloud, our SSL-secure API provides two-way communication between the POS and any app integrated with Doshii. Simply put, we're connecting hospitality.
Looking to integrate? Check us out at Doshii.io and one of our awesome staff will hook you up with an API key.
A breakdown of all the methods available are available on the wiki page
$ npm install --save doshii-sdk# or$ yarn add doshii-sdk
Your clientId and clientSecret will be picked up by default if they're set in your environment variables as 'DOSHII_CLIENT_ID' and 'DOSHII_CLIENT_SECRET', both or none must be set.
I would suggest only using the default 'v3' for version. Specifying 'v2' will work for some of these methods, but reliability may be lacking.
// Initialize the libraryconst Doshii =clientId: 'YOUR_DOSHII_CLIENT_ID'clientSecret: 'YOUR_DOSHII_CLIENT_SECRET'env: 'sandbox'version: 'v3'silent: false// The above settings would result in a base path of// The silent flag enables/disables the heartbeat console output
Both promises and callbacks are supported by this library
A breakdown of the methods available are available on the wiki page
This library also includes a wrapper for Doshii WebSocket events. While WebSockets aren't mandatory to make your project work and gain certification, they will make development vastly simpler. Instead of manually polling Doshii, the WebSocket will send you exactly what you're after. All you need to is listen.
// Establish a connection to the Doshii WebSocketconst DoshiiSocket = Doshii// Your authKey and environment will be generated in the same manner as you initialize the library// It will also automatically ping the server and send a heartbeat, just to make sure it knows you're listening// And add an error catcher in case there are any surprisesDoshiiSocket
There are a number of events which are handled by the Doshii WebSocket. A complete list can be found in the Doshii WebSocket documentation, while examples of all the methods can be found in the wiki. The underlying library is
ws, more information about this lib can be found here
Here's a quick example of a socket event listener.
// Listen for the generic 'message' event. You should receive a 'pong' every 15 seconds.DoshiiSocket// Listen for the 'order_updated' event and then do stuff with itDoshiiSocket
We LOVE PRs. Contribution is the foundation of open source and what makes the development community so great.
In saying that, it would really help out a bunch if you follow a few guidelines before submitting a PR for this repo.
- Please update/create then run tests (check out the /test folder). You'll need a DOSHII_CLIENT_ID and DOSHII_CLIENT_SECRET set as environment variables.
- Please keep the coding style consistent. If you use eslint, the standard babel config is being used and will be applied when installing dependencies for this repo. Simply put, we use spaces, no trailing semi-colons and prefer nice thin functions/conditionals where reasonable.
More generic points about contributing to this repo can be found in CONTRIBUTING.md
Developed by Jimmy Cann and maintained by the Doshii Team.