2.2.2 • Published 23 days ago
tenbis-api v2.2.2
10BIS API wrapper
Overview
This repo contains a fully functional typescript api wrapper to the 10bis api to be able to automate making 10bis orders.
Get started
Install library
yarn add tenbis-api
Full Example Usage
import api from 'tenbis-api'
const { getPayments, getTransactionReport, getUser, loadTenbisCredit } = './core'
// Example to load user credit with api
// More functionality is implemented - searching for restaurants, adding to cart, submiting orders
try {
// Login with User Token
const user = await getUser('***************')
// Get User's id, address, token and current shopping cart id
const { userId: assignedUserId, userToken } = user.Data
const { refreshToken, authToken } = user
const shoppingCartId = user.ShoppingCartGuid
// Get moneycards
const moneycards = await getPayments(shoppingCartId)
console.log(moneycards)
// load credit of remaining usage diff 50 shekels
const transactionReport = await getTransactionReport(userToken)
const usage = transactionReport.Data.moneycards[0].usage.daily
await loadTenbisCredit(100 - usage, moneycards.Data[0].cardId)
} catch (e) {
console.log(e.message)
}