Verifone

Verifone

Captures a signature and renders forms on Verifone devices.

Constructor

new Verifone(baseURLopt)

Description:
  • Instantiate a Verifone Class

Source:
See:
Example
const tablet = new Verifone()
Parameters:
Name Type Attributes Description
baseURL string <optional>

Protocol, domain, and port for the service.

Extends

Classes

Verifone

Members

baseUrl

Source:
Overrides:
Properties:
Name Type Description
id string

ID of the plugin, used when building REST endpoint paths.

name string

Human friendly name for the plugin.

description string

Human friendly description of plugin.

version string

Semantic version version of the plugin.

methods Array.<string>

A plugin's list of supported RPC methods.

ready boolean

True if plugin has been loaded into memory and is ready to receive requests.

defaultDevice object

Default device to use for the plugin.

configMethods Array.<string>

Methods required to implement configuration.

Methods

(async) cancel(timeoutopt, nullable, deviceOptopt) → {object}

Description:
  • Will attempt to cancel any active long-running operation

Source:
Example
const {status} = await device.cancel()
Parameters:
Name Type Attributes Default Description
timeout Number <optional>
<nullable>
null

If provided, will attempt to wait at least this long (in seconds) for the operation to be cancelled before returning a response. By default this endpoint will request a cancellation and return immediately, however if you'd like to block, waiting for the device to be ready before attempting another operation you may supply this timeout.

deviceOpt string | object <optional>

Cancel the operation for either a specific Device ID or a Device Object. The default is the first available device.

Returns:

Cancellation status

Type
object

(async) clear(backlightopt, deviceOptopt) → {object}

Description:
  • Clear a signature tablet's display.

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
backlight boolean <optional>
false

If true, the device's backlight will be enabled. If false, it will be disabled. If unspecified no action will be taken on the backlight.

deviceOpt string | Device <optional>

Clear the display of a either a specific Device ID or a Device Object. The default is the first available device.

Returns:
Type
object

(async) device(id) → (nullable) {object}

Description:
  • Get a device by ID for this plugin

Source:
Overrides:
See:
Example
const plugin = await captureBridge.plugin('capture_camera_canon')
const device = await plugin.device('AWOOO56709')
Parameters:
Name Type Description
id string

Device ID

Returns:

Requested Device or null

Type
object

(async) devices() → {Array.<object>}

Description:
  • Get all devices for this plugin

Source:
Overrides:
See:
Example
const plugin = await captureBridge.plugin('capture_camera_canon')
const devices = await plugin.devices()
Returns:

Array of Device objects.

Type
Array.<object>

(async) displayObjects(objects, formOptopt, deviceOptopt, requestOptopt) → (nullable) {string}

Description:
  • If any objects are Button types, the method will wait for one to be clicked.

Source:
Overrides:
Example
const result = await tablet.displayObjects([
 new Button("OK", 20, 200),
 new Button("Cancel", 80, 200)
], { background: 'rgb(10,100,10)'})

console.log(result)
Parameters:
Name Type Attributes Description
objects Array.<object>

An array of objects to display.

formOpt object <optional>

Form configuration options.

Properties
Name Type Attributes Default Description
background string <optional>
'#ffffff'

Background color of form (hex or RGB.)

timeout number <optional>
45

Form timeout, in seconds.

deviceOpt string | object <optional>

Display the objects on either a specific Device ID or a Device Object. The default is the first available device.

requestOpt object <optional>

Additional options for the request

Properties
Name Type Attributes Default Description
signal AbortSignal <optional>
null

An AbortSignal obtained from an AbortController allowing the request to be aborted. If the request is aborted or the HTTP connection is closed for any reason before a user has interacted with the display, the device state will be reset and the screen will be cleared. The Verifone#cancel method is the preferred method for cancelling a displayObjects request and should usually be used instead of an AbortSignal.

readyTimeout Number <optional>
<nullable>
10

Attempt to wait at least this long (in seconds) for the device to be ready before sending the displayObjects request. This reduces the chance that the request will fail due to the serial port being locked after a previously cancelled or aborted request.

Returns:

ID of the clicked object if any

Type
string

(async) fullCapture(captureOptopt, deviceOptopt)

Description:
  • Take a full capture

Source:
Overrides:
Example
// Capture an image as an ArrayBuffer and add it to an img tag appended to
// the document's body.
const img = document.createElement('img')
img.src = await capture.fullCapture()
document.body.appendChild(img)
Parameters:
Name Type Attributes Description
captureOpt CaptureOptions <optional>

Additional options for capturing an image.

deviceOpt string | object <optional>

Take the capture using either a specific Device ID or a Device Object. The default is the first available device.

(async) getMostRecentFrame(captureOptopt, deviceOptopt)

Description:
  • Not currently supported for this plugin.

Source:
Overrides:
See:
  • CapturePlugin#streamUrl
  • CapturePlugin#stopFeed
Example
// Not currently supported for this plugin
Parameters:
Name Type Attributes Description
captureOpt CaptureOptions <optional>

Additional options for capturing a photo.

deviceOpt string | object <optional>

Return the frame from either a specific Device ID or a Device Object. The default, if not supplied, is the first available device.

Throws:

Not implemented error

(async) hasMethod(method) → {boolean}

Description:
  • Check if a plugin has an RPC method

Source:
Overrides:
Example
const canCapture = await plugin.hasMethod('capture')
Parameters:
Name Type Description
method string

An RPC method

Returns:

Return true if plugin has the provided method.

Type
boolean

(async) info() → {object}

Description:
  • Returns detailed information about a device.

Source:
Example
const info = await device.info()
Returns:

Device info

Type
object

(async) readMagstripe(readOptsopt, deviceOptopt, requestOptopt)

Description:
  • Read magstripe from a card reader

Source:
Parameters:
Name Type Attributes Description
readOpts object <optional>

Additional options for reading magstripe.

Properties
Name Type Attributes Default Description
timeout number <optional>
30

Magstripe read timeout, in seconds.

deviceOpt string | object <optional>

Read magstrip using a specific Device ID or a Device Object. The default is the first available device.

requestOpt object <optional>

Additional options for the request

Properties
Name Type Attributes Default Description
signal AbortSignal <optional>
null

An AbortSignal obtained from an AbortController allowing the request to be aborted. If the request is aborted or the HTTP connection is closed for any reason before a user has interacted with the display, the device state will be reset and the screen will be cleared. The Verifone#cancel method is the preferred method for cancelling a readMagstripe request and should usually be used instead of an AbortSignal.

readyTimeout Number <optional>
<nullable>
10

Attempt to wait at least this long (in seconds) for the device to be ready before sending the readMagstripe request. This reduces the chance that the request will fail due to the serial port being locked after a previously cancelled or aborted request.

(async) renderForm(form, controlPropsopt, deviceOptopt)

Description:
  • Render a form and get event data.

Source:
See:
Parameters:
Name Type Attributes Description
form string | DeviceForm

ID of the form on the device or a DeviceForm object with addtional configuration details.

controlProps Array.<ControlProperty> <optional>

Array of ControlProperty objects.

deviceOpt string | object <optional>

Display the objects on either a specific Device ID or a Device Object. The default is the first available device.

(async) reset(depthopt, nullable, deviceOptopt) → {object}

Description:
  • Reset the Verifone's internal state, reboot the device, or Forms Processor application.

Source:
Example
const {status} = await device.reset()
Parameters:
Name Type Attributes Default Description
depth Number <optional>
<nullable>
3

0 = Reboot the device, 1 = Restart Forms Processor, 2 = Reset device state, 3 = Reset device state and drain serial port.

deviceOpt string | object <optional>

Display the objects on either a specific Device ID or a Device Object. The default is the first available device.

Returns:

Reset status

Type
object

(async) shutdown(timeoutopt)

Description:
  • Shutdown a plugin

Source:
Overrides:
See:
Example
await plugin.shutdown()
Parameters:
Name Type Attributes Default Description
timeout number <optional>
10

Timeout in seconds. Forcefully terminate the plugin if it doesn't shutdown cleanly within the specified timeout. A value of 0 will result in immediately terminating the plugin and should be avoided unless the plugin is unresponsive.

(async) signature(captureOptopt, deviceOptopt)

Description:
  • Capture a high resolution signature.

Source:
Overrides:
Example
// Capture signature as an ArrayBuffer and add it to an img tag appended to
// the document's body.
const img = document.createElement('img')
img.src = await tablet.signature()
document.body.appendChild(img)
Parameters:
Name Type Attributes Description
captureOpt CaptureOptions <optional>

Additional options for capturing a signature.

deviceOpt string | object <optional>

Capture the signature using either a specific Device ID or a Device Object. The default is the first available device.

(async) stopFeed(deviceOptopt) → {object}

Description:
  • Not currently supported for this plugin.

Source:
Overrides:
See:
Example
// Not currently supported for this plugin
Parameters:
Name Type Attributes Description
deviceOpt string | object <optional>

Stop the feed for a specific Device ID or a Device Object. The default, if not supplied, is the first available device.

Throws:

Not implemented error

Returns:

Status of the stop operation

Type
object

(async) streamUrl(streamOptopt, deviceOptopt) → {string}

Description:
  • Not currently supported for this plugin.

Source:
Overrides:
Example
// Not currently supported for this plugin
Parameters:
Name Type Attributes Description
streamOpt StreamOptions <optional>

Additional options for the stream.

deviceOpt string | object <optional>

Get the stream URL from either a specific Device ID or a Device Object. The default is the first available device.

Throws:

Not implemented error

Returns:

stream endpoint URL

Type
string