POSConnector Allows for communication with the native POS application.
Kind: global class
- POSConnector
- static
- .LineItem
- .Transaction
- .Discount
- .Basket
- .LoginInformation
- .TransactionType :
enum
- .EventType :
enum
- .addEventListener(type, listener)
- .removeEventListener(listener)
- .isConnected() ⇒
boolean
- .payBasket(basket, callback)
- .getLoginInformation(callback)
- .openURL(url, callback)
- .printDocumentAtURL(url, callback)
- .printDocumentWithData(data, [callback])
- .sendPOSConnectorObjectPathToPOS(objectPath, [callback])
- inner
- ~barcodeScannedListener :
function
- ~payBasketCallback :
function
- ~getLoginInformationCallback :
function
- ~openURLCallback :
function
- ~printDocumentCallback :
function
- ~sendPOSConnectorObjectPathToPOSCallback :
function
- ~barcodeScannedListener :
- static
Kind: static class of POSConnector
new LineItem(name, quantity, unitPrice, vatPercentage, salesTaxPercentage, [productId], [imei], [discounts])
Represents a line item
Param | Type | Description |
---|---|---|
name | string |
Name of the line item |
quantity | number |
Number of items, positive or negative, represented on the line (eg. 5) |
unitPrice | number |
The price of each item on the line (eg. 9.95) |
vatPercentage | number |
The VAT included in the unit price (eg. 0.25) |
salesTaxPercentage | number |
The sales tax to apply to the unit price (eg. 0.05) |
[productId] | string |
Id of the product represented on the line |
[imei] | string |
IMEI of the product represented on the line |
[discounts] | Array.<Discount> |
Discounts on the line item |
Kind: static class of POSConnector
Represents a payment transaction
Param | Type | Description |
---|---|---|
transactionType | TransactionType |
The type of payment transaction |
amount | number |
Amount payed by the transaction |
Kind: static class of POSConnector
Represents a discount on either a basket or a line item
Param | Type | Description |
---|---|---|
description | string |
Reason for the discount to be given (shown on receipt) |
[amount] | number |
Amount that the discount applies (eg. 90.50). Do not pass if passing percentage. |
[percentage] | number |
The percentage which will be calculated based on what it's applied to (eg. 0.5). Do not pass if passing amount. |
Kind: static class of POSConnector
Represents a shopping basket
Param | Type | Description |
---|---|---|
id | string |
Id of the basket |
lineItems | Array.<LineItem> |
Line items contained in the basket |
[transactions] | Array.<Transaction> |
Transactions on the basket |
[discounts] | Array.<Discount> |
Discounts on the basket |
Kind: static class of POSConnector
Param | Type | Description |
---|---|---|
shopId | string |
Shop's id |
shopName | string |
Shop's name |
registerId | string |
Register's id |
registerName | string |
Register's name |
userId | string |
User's id |
userName | string |
User's name |
Enum of possible transaction types
Kind: static enum property of POSConnector
Properties
Name | Type | Default |
---|---|---|
Cash | string |
"Cash" |
DebitorAccount | string |
"DebitorAccount" |
Ecommerce | string |
"Ecommerce" |
External | string |
"External" |
ExternalCard | string |
"ExternalCard" |
ExternalGiftCard | string |
"ExternalGiftCard" |
GiftCardVoucher | string |
"GiftCardVoucher" |
Installment | string |
"Installment" |
MobilePay | string |
"MobilePay" |
Point | string |
"Point" |
Enum of possible event types
Kind: static enum property of POSConnector
Properties
Name | Type | Default |
---|---|---|
BarcodeScanned | string |
"BarcodeScanned" |
Add an event listener
Kind: static method of POSConnector
Param | Type | Description |
---|---|---|
type | EventType |
The type of event to listen for |
listener | barcodeScannedListener |
The listener function to add |
Remove an event listener
Kind: static method of POSConnector
Param | Type | Description |
---|---|---|
listener | barcodeScannedListener |
The listener function to remove |
Check for connection toward the POS
Kind: static method of POSConnector
Returns: boolean
- The connection status
Pass a basket to the POS for payment processing
Kind: static method of POSConnector
Param | Type | Description |
---|---|---|
basket | Basket |
Basket to pass on to the POS |
callback | payBasketCallback |
Called when the operation concludes |
Get current login information from the native POS
Kind: static method of POSConnector
Param | Type | Description |
---|---|---|
callback | getLoginInformationCallback |
Called when the operation concludes |
Request opening of a URL from the native application. The URL will open in which ever application the device prefers, typically Safari.
Kind: static method of POSConnector
Param | Type | Description |
---|---|---|
url | string |
The URL to open |
callback | openURLCallback |
Called when the native application opened or rejected opening the URL |
Request printing of a document located at a URL
Kind: static method of POSConnector
Param | Type | Description |
---|---|---|
url | string |
The URL pointing toward the document to print |
callback | printDocumentCallback |
Called when the operation concludes |
Requests printing of a document with a data object
Kind: static method of POSConnector
Param | Type | Description |
---|---|---|
data | Blob | string |
The document data either contained in a Blob object or a base64 string |
[callback] | printDocumentCallback |
Called when the operation concludes |
Send an object path for the POSConnector to the native POS application. You'd do this if you're utilizing modules or similar and you don't want to depend on having the POSConnector object with that specific variable name in the global scope.
Kind: static method of POSConnector
Param | Type | Description |
---|---|---|
objectPath | string |
Path the the POSConnector object (ie. "Vendor.Wallmob.POSLink") |
[callback] | sendPOSConnectorObjectPathToPOSCallback |
Called when the operation concludes. |
Passed to POSConnector.addEventListener for EventType.BarcodeScanned
Kind: inner typedef of POSConnector
Param | Type | Description |
---|---|---|
barcode | string |
The barcode that was scanned |
Passed to the payBasket function
Kind: inner typedef of POSConnector
Param | Type | Description |
---|---|---|
result | boolean |
Whether or not the payment was completed |
[error] | string |
Optional string describing what went wrong |
Passed to the getLoginInformation function
Kind: inner typedef of POSConnector
Param | Type | Description |
---|---|---|
[result] | LoginInformation |
The requested login information if successful |
[error] | string |
The error that occurred if unsuccessful |
Passed to the openURL function
Kind: inner typedef of POSConnector
Param | Type | Description |
---|---|---|
[error] | string |
The error that occurred if unsuccessful |
Passed to the printDocumentAtURL and printDocumentData functions
Kind: inner typedef of POSConnector
Param | Type | Description |
---|---|---|
result | boolean |
Whether or not the printing job was completed |
[error] | string |
The error that occurred if printing wasn't just cancelled by the user |
Passed to the sendPOSConnectorObjectPathToPOS function
Kind: inner typedef of POSConnector
Param | Type | Description |
---|---|---|
[error] | string |
The error that occurred if unsuccessful |