Skip to content

# Barcode

## barcode : `object`

Handle tracking barcodes

Kind: global namespace

- barcode : `object`
  - .TrackingBarcode
    - new TrackingBarcode(code)
  - .addPrepaidBarcode(trackingBarcodeData)
  - .inject(barcodeData)
  - .onPrepaidScan(f)

### barcode.TrackingBarcode

Kind: static class of `barcode`
Properties

Name | Type | Description
--- | --- | ---
tracking | `string` | Tracking number
barcode | `string` | Original barcode data this was created from
toZip | `string` | Destination ZIP Code, for domestic shipments. The city and state are automatically added. If toAddress is specified, toZip is ignored in favor of it.
toCountry | `string` | Two-letter destination country code. If it doesn't match the country PostalPoint is running in, the full country name is appended to the displayed address information.
toAddress | `string` | Destination mailing/shipping address.
carrier | `string` | Shipping carrier name.
service | `string` | Shipping service/mail class name. Example: "Priority Mail".
dropoff | `boolean` | If set to false, the barcode will be rejected with a suitable message when PostalPoint is running in self-serve kiosk mode.
confidentCarrier | `boolean` | If false, PostalPoint may prompt user to specify the shipping carrier.
extraInfo | `Array.<string>` | Extra description strings, like "Signature Required".
message | `string` | If not empty, the barcode will NOT be added and the contents of `message` will be displayed to the user.
warning | `string` | If not empty, the barcode WILL be added and the contents of `warning` will be displayed to the user.
destString | `string` | (read only) Get the destination information as a human-presentable multiline string.
serviceString | `string` | (read only) Get the carrier and service.
toString() | `function` | Get the package information in a format suitable for display on a receipt.
toString(false) | `function` | Get the package information in a format suitable for display on a receipt, suppressing the tracking number.

#### new TrackingBarcode(code)

A Tracking barcode object.

Param | Type | Description
--- | --- | ---
code | `string` | Barcode data

### barcode.addPrepaidBarcode(trackingBarcodeData)

Add a TrackingBarcode object to the transaction receipt at any time other than `onPrepaidScan`.

Kind: static method of `barcode`

Param | Type
--- | ---
trackingBarcodeData | `TrackingBarcode`

### barcode.inject(barcodeData)

Pass data to the internal barcode event subsystem. The data is handled as if it were just received from a physical barcode scanner.

Kind: static method of `barcode`

Param | Type
--- | ---
barcodeData | `string`

### barcode.onPrepaidScan(f)

The function passed to onPrepaidScan is run when a barcode is scanned on the Prepaid page. The function is passed one argument, a string containing the raw barcode data. The function shall return boolean false if unable or unwilling to handle the barcode. If the barcode is handled by this function, it shall return a TrackingBarcode object.

Kind: static method of `barcode`

Param | Type
--- | ---
f | `function`