flotta-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.0-development • Public • Published

Flotta-sdk

Build Status Commitizen friendly

Flotta API wrapper

Installation

npm i flotta-sdk --save
yarn add flotta-sdk

Configuration

import Flotta from 'flotta-sdk';
 
const client = new Flotta(
  'api-key',
  'flotta-endpoint',
);

API

  • addBusinessHolder
client.addBusinessHolder({
  fisrtName: 'SDK',
  secondName: 'SDK',
  email: 'sdk@sdk.com',
  password: 'sdk',
})
  .then(token => console.log(token))
  .catch(err => { throw new Error(err); });
  • addStore
client.addStore(token, {
  address: {
    city: 'Milano',
    street: 'Via Melchiorre Gioia',
    number: '8',
    country: 'IT',
    zipCode: '20186',
  },
  position: {
    type: 'Point',
    coordinates: [0, 0],
  },
  email: 'email@email.com',
  phone: ['123456789'],
  name: 'Vynil'
})
  .then(store => console.log(store))
  .catch(err => { throw new Error(err); });
  • addShipment
client.addShipment(token, storeId, {
  delivery: {
    customer: {
      firstName: 'Darth',
      secondName: 'Vader',
      phone: '3663189261',
      email: 'darth@starwars.com'
    },
    address: {
      country: 'IT',
      city: 'Roma',
      street: 'Via Giovanni Giolitti',
      number: '10',
      zipCode: '20124'
    },
    position: {
      coordinates: [9.213473, 45.466794],
      type: 'Point'
    },
    time: '2017-08-30T19:33:51.149+0000',
    intercom: 'Death Star'
  },
  order: {
    paymentMethod: 'CASH',
    currency: 'EUR',
    total: 1600,
    fee: 100,
    items: [
      {
        name: 'Pizza Margherita',
        quantity: 1,
        price: 500,
      },
      {
        name: 'Hamburger',
        quantity: 1,
        price: 1000,
        description: 'Hamburger con insalata, pomodoro e formaggio'
      }
    ],
    notes: 'hamburger cottura al sangue, grazie.'
  },
  notes: 'in fondo al cortile a destra'
})
  .then(shipment => console.log(shipment))
  .catch(err => { throw new Error(err); });

Package Sidebar

Install

npm i flotta-sdk

Weekly Downloads

37

Version

0.1.0-development

License

MIT

Last publish

Collaborators

  • vittorio.adamo