yonoton-pos-api v0.0.9
yonoton-pos-api
Getting started
npm i yonoton-pos-api
import { YonotonAPI, YonotonApiTypes } from 'yonoton-pos-api';
...
const { View } = YonotonApiTypes
Introduction
The YonotonAPI is injected to the embedded web site by the Yonoton POS. These APIs communicate directly with the POS on the frontend side.
The embedded view is opened fullscreen. Navigate API should be used to return back Home and close the webview.
Cart related actions
Clear cart
YonotonAPI.cart.clear()
Add items to cart by product ID
YonotonAPI.cart.addItemsByProductId(items: ItemByProductId[])
Add items to cart matching by EAN code
YonotonAPI.cart.addItemsByEAN(items: ItemByEAN[])
Add items to cart matching by reference code
YonotonAPI.cart.addItemsByReferenceCode(items: ItemByReferenceCode[])
Payment actions
Add pre-payment
The pre-payment is registered as a payment and it reduces the amount remaining to pay for the cart.
YonotonAPI.cart.addPayments(payments: Payment[])
Identity actions
Add identity
Identity represents a user. The identity information is attached to the purchase.
YonotonAPI.cart.connectIdentity(identity: Identity)
Navigating actions
Navigate
YonotonAPI.navigate.navigate(View.HOME)