Skip to content

superbexperience/POSConnector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

POSConnector

POSConnector Allows for communication with the native POS application.

Kind: global class

POSConnector.LineItem

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

POSConnector.Transaction

Kind: static class of POSConnector

new Transaction(transactionType, amount)

Represents a payment transaction

Param Type Description
transactionType TransactionType The type of payment transaction
amount number Amount payed by the transaction

POSConnector.Discount

Kind: static class of POSConnector

new Discount(description, [amount], [percentage])

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.

POSConnector.Basket

Kind: static class of POSConnector

new Basket(id, lineItems, [transactions], [discounts])

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

POSConnector.LoginInformation

Kind: static class of POSConnector

new LoginInformation(shopId, shopName, registerId, registerName, userId, userName)

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

POSConnector.TransactionType : enum

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"

POSConnector.EventType : enum

Enum of possible event types

Kind: static enum property of POSConnector
Properties

Name Type Default
BarcodeScanned string "BarcodeScanned"

POSConnector.addEventListener(type, listener)

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

POSConnector.removeEventListener(listener)

Remove an event listener

Kind: static method of POSConnector

Param Type Description
listener barcodeScannedListener The listener function to remove

POSConnector.isConnected() ⇒ boolean

Check for connection toward the POS

Kind: static method of POSConnector
Returns: boolean - The connection status

POSConnector.payBasket(basket, callback)

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

POSConnector.getLoginInformation(callback)

Get current login information from the native POS

Kind: static method of POSConnector

Param Type Description
callback getLoginInformationCallback Called when the operation concludes

POSConnector.openURL(url, callback)

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

POSConnector.printDocumentAtURL(url, callback)

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

POSConnector.printDocumentWithData(data, [callback])

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

POSConnector.sendPOSConnectorObjectPathToPOS(objectPath, [callback])

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.

POSConnector~barcodeScannedListener : function

Passed to POSConnector.addEventListener for EventType.BarcodeScanned

Kind: inner typedef of POSConnector

Param Type Description
barcode string The barcode that was scanned

POSConnector~payBasketCallback : function

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

POSConnector~getLoginInformationCallback : function

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

POSConnector~openURLCallback : function

Passed to the openURL function

Kind: inner typedef of POSConnector

Param Type Description
[error] string The error that occurred if unsuccessful

POSConnector~printDocumentCallback : function

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

POSConnector~sendPOSConnectorObjectPathToPOSCallback : function

Passed to the sendPOSConnectorObjectPathToPOS function

Kind: inner typedef of POSConnector

Param Type Description
[error] string The error that occurred if unsuccessful

About

POS Connector Framework

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 60.1%
  • HTML 20.7%
  • CoffeeScript 19.2%