1.0.24 • Published 2 years ago

@mvault/terminal v1.0.24

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Mvault Terminal

Mvault terminal is a module that provides differents way to use a Terminal Reader. It facilitate you things such as discovering connecting and collecting. Bellow you I'll find all you need to use Mvaul terminal

Usage/Examples

 // terminal is a global variable, you don't neet to import it

  const events = terminal.events()

  // initialize terminal sdk (Must be connected using @mvault/auth with 'role' provider)
  terminal.init()

  // discover readers arround you ( method = 'Internet' || 'BluetoothProximity')
  terminal.discover(method).then(() => {
    events.on('readers', (readers) => {
      if (readers.length) {
        // connect the desired reader
        terminal.connect(readers[0])
      }
    })
  })

  
  // collect payment with charge params
  // subscribe to user instructions - these should be displayed to the user
  events.on('display', (display) => {
    // show instructions to user
  })
  events.on('input', (input) => {
    // show input informations to user
  })
  terminal.collect(charge)

Terminal Reference

Initialize terminal

terminal.init()

Required You must be authenticated using @mvault/auth

Discover Reader

terminal.discover(method,simulated) <Promise>
ParameterTypeDescription
mehodstringRequired.
simulatedBoolDefault false.

Connect Reader

terminal.connect(reader)
ParameterTypeDescription
readerobjectRequired. reader from Discover

Collect Charge

terminal.collect({transaction, amount, order, app}) <Promise>
ParameterTypeDescription
amountintegerRequired. amount in cents

Reader

reader()

Return informations about the Reader

Install Update

terminal.installUpdate()

Return the progress

Register Reader

terminal.registerReader(registration_code) <Promise>
ParameterTypeDescription
registration_codeintegerRequirered

Cancel Discover

terminal.cancelDiscover()

It cancel a discover

Cancel Collect

terminal.cancelCollect()

It cancel a payment collect

Events

terminal.events.on(event, callback)
ParameterTypeDescription
eventstringRequired.
callbackfuncRequired. returns event data

events

eventDescription
redearsRequired. returns array of readers
displayRequired. returns instructions from payment to user
inputRequired.returns input informations (swipe/tap/insert)
updateRequired. returns update progress from 0 to 1
1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago