Skip to content
Our IoT SDK in NodeJS to enable any connected device to pay
JavaScript Shell Makefile
Branch: master
Clone or download
Latest commit 4a25473 Jul 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin reorder the config Mar 20, 2019
examples Update example.txt Feb 20, 2019
lib fix build errors (formatting) Apr 29, 2019
storage remove other stub file Sep 8, 2018
test
.eslintrc.json add some eslint config and refactor utils -> store Sep 5, 2018
.gitignore [WIP] Sep 6, 2018
.travis.yml more consistent naming + comply with eslint + small refactors Sep 5, 2018
CHANGELOG.md Fix bluetooth for node 7 unable to use arrow functions on prototypes … Sep 21, 2018
CONTRIBUTING.md add contributing option Sep 12, 2018
LICENSE Add apache 2.0 license Sep 11, 2018
Makefile Add config setup menu Feb 20, 2019
README.md Update README.md Jul 16, 2019
package-lock.json README updated Jul 10, 2019
package.json Add apache 2.0 license Sep 11, 2018
readme-header.png Update readme banner Dec 12, 2018
sonar-project.properties added sonarqube properties file without credentials Oct 17, 2018

README.md

readme-header

Build Status

FINN enables your IoT devices to perform seamless autonomous payments on your behalf. For more information, visit us at makethingsfinn.com

Requirements

This SDK works best on devices with a debian-based distribution. like Raspberry Pi or a regular Ubuntu. To follow this tutorial you'll need:

  • A device with a debian distribution OS, such as Raspberry Pi with Raspbian. For further instructions on how to install, check on Raspberry Pi official documentation. Or a computer with the following tools:
    • A Unix system (Linux - preferrably Debian based or Mac)
    • NodeJS 8.16.0. You can find the version suitable for your device in the official download page.
    • Git
  • An iOS or Android device with FINN - Banking of Things App. Find it on the Appstore or in the Playstore
  • A Computer with a web browser

Getting Started

Visit our official documentation for a complete overview. The main steps are:

Installation

Setting up your device

For Raspberry Pi Users

If you're on a Raspberry Pi, you can download Raspbian Buster Lite and flash it with Apple Pi Baker

Check your local node installation.

node -v

If your node version is different, make sure to install the right version:

curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm

Now, install git:

sudo apt-get install git

For Mac Users

Note: Mac usage is for testing purposes only and some peripherals might not work properly.

Check your local node installation by opening a Terminal and writting the following command.

node -v

If your node version is different than this one we suggest using nvm to go back and forth on different node versions. For more information, Visit the documentation.

Install command line tools

xcode-select --install

Now your device is set and ready to install the SDK.


Installing the SDK

Clone the repository

Clone the repository on your device, for example with ssh, and enter the folder:

git clone https://github.com/BankingofThings/BoT-NodeJS-SDK.git && cd BoT-NodeJS-SDK

Creating your environment

As for now, this SDK supports debian based environments. To setup your environment, run:

make environment-debian

For development wit a Mac, you can skip this step. Make sure you use macOS with Xcode installed.

Installing dependencies

To install dependencies run:

make install

Configuration

Before your first run, start the configuration tool. It will ask for a few things to configure:

sh bin/config.sh

Enter your MakerID

Copy paste your unique MakerID from the account page in the FINN Maker Portal.

Multi-pairable device (yes/no)

When your IoT device is meant to be used by more than one user say "yes" to this option. This will result in an IoT device that is usable for all FINN app users. If your IoT device meant to have one owner then say "no" to this option

Enter your alternativeID

When configuring a Multi-pairable device we have to set an alternativeID. This alternativeID needs to be filled-in during the pairing process in the FINN Companion app. Examples can be a "loyalty card number" or the "license plate" of your car.

Reset

To reset the SDK to its default configuration type:

make reset

Using the SDK

Running the server

To run the server normally after you've configured it, simply run:

make server

This makes your device a server with a few web endpoints that can be accessed through any web client.

We are using curl in the examples below.

Pairing your device

You can get pairing information by making a get call to the /pairing endpoint

curl localhost:3001/pairing

Retrieving actions

You can see available actions that have been configured in the FINN Maker Portal by making a get call to the /actions endpoint

curl localhost:3001/actions

Triggering actions

You can manually trigger an action by sending a post call to the /actions endpoint

curl -d '{"actionID":"YOUR_ACTION_ID"}' -H "Content-Type: application/json" http://localhost:3001/actions

Triggering Multipairing actions

If your device is set to be a multipairable device, you need to specify the alternativeID in your request body

curl -d '{"actionID":"YOUR_ACTION_ID", "alternativeID":"ID"}' -H "Content-Type: application/json" http://localhost:3001/actions

SDK server API Reference

Get Pairing info

Get information about device for pairing

URL: /pairing

Method: GET

Success Response

Code: 200

Content:

{
    "deviceID": "The-device-ID",
    "makerID": "Find-Maker-ID-in-maker-portal",
    "publicKey": "the-public-key"
}

Get Actions info

URL: /actions

Method: GET

Response Type

Success Response

-- Code: 200

Content: An Array of objects with a list of all the actions specified in the Maker Portal

[
    {
        "actionID": "the-action-id",
        "frequency": "always",
        "info": "when the event triggers",
        "date_created": "2019-01-01 12:12:12 +0000",
        "metadata": "{data: [\"info\", \"here\"]}",
        "actionName": "event triggers",
        "makerID": "Find-Maker-ID-in-maker-portal",
        "type": "push"
    },
    { ... },
    { ... }
]

Trigger an Action

URL: /actions

Method: POST

Response Type: Application/json

Payload:

{
    "actionID": "Find-action-ID-in-maker-portal",
    //optional:
    "alternativeID" "alternative-ID-for-multi-paired-devices"
}

Success Response

-- Code: 200

Content:


Contributing

Any improvement to the FINN SDK are very much welcome! Our software is open-source and we believe your input can help create a lively community and the best version of FINN. We’ve already implemented much of the feedback given to us by community members and will continue to do so. Join them by contributing to the SDK or by contributing to the documentation.

Running tests

At the moment we do not have high test-coverage. You're free to make a PR to add tests! To run the tests:

make test

Community

Slack

Slack is our main feedback channel for the SDK and documentation. Join our Slack channel and be part of the FINN community.

Meetups

We also organize meetups, e.g. demo or hands-on workshops. Keep an eye on our meetup group for any events coming up soon. Here you will be able to see the FINN software in action and meet the team.
Meetup/Amsterdam-ING-Banking-of-Things.

About FINN

After winning the ING Innovation Bootcamp in 2017, FINN is now part of the ING Accelerator Program. Our aim is to become the new Internet of Things (IoT) payment standard that enables service-led business models. FINN offers safe, autonomous transactions for smart devices. We believe our software offers tremendous business opportunities. However, at heart, we are enthusiasts. Every member of our team has a passion for innovation. That’s why we love working on FINN. makethingsfinn.com

You can’t perform that action at this time.