0.0.15 • Published 5 years ago

spendesk-collect v0.0.15

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

npm version

Spendesk Collect Node

Installation

yarn add spendesk-collect

Spendesk Collect Collector

const collector = new SpendeskCollect.Collector(PORT);
collector.startApp();

The collector module launches automatically an server instance and exposes what's necessary to develop a collector.

  • auth action: returns if ship settings are valids or not
  • collect action: called to extract invoices from a supplier
  • description: redirects to ./DESCRIPTION.md, collector description
  • manifest: redirects to ./manifest.json
  • assets/*: redirects to ./assets that contains the list of assets needed like logo (logo.png).

context is inialized for status and collect actions.

module.exports = async (ship, client, captchaSolver) => {
  // client is SpendeskCollect.Client instance
  // ship is an object that contains information { settings, nextCollectAt, currentSettingsStepTag }
  // captchaSolver is a instance of a captcha solver (see below for more information)
}

Spendesk Collect Client

const client = new SpendeskCollect.Client("SHIP_TOKEN");

This Client API allows to connect with the Spendesk Collect infrastructure. Here the list of methods available:

  • done(status, metadata): returns to broker the status of the ship
    • status is an object: { label: ok|error, type: auth|collect }
    • metadata is an optional object: { currentSettingsStepTag }
  • invoices.create(file, metadata, fileOptions): uploads a new invoice
    • file needs a path or a buffer
    • metadata is an object that contains invoice metadata. Requested attributes: identifier, dueAt, amount, currency
    • fileOptions is optional if file is a path otherwise it needs to follow this pattern: { contentType, filename }
  • logger: winston logger (error, warn, info, verbose, debug, silly)

Spendesk Collect Captcha Solver

const captchaSolver = new SpendeskCollect.CaptchaSolver("CAPTCHA_SOLVER_TOKEN");

List of methods availables:

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago