Class: PaymentEngine

PaymentEngine()

The central engine for performing card transactions with Quantum Pay.

Constructor

new PaymentEngine()

Source:

Methods

(static) this.builder(errorFunction) → {PaymentEngineBuilder}

A payment engine builder. This builder must be initialized before calling other functions
Parameters:
Name Type Description
errorFunction function Any error will be passed in here.
Source:
Returns:
- The PaymentEngineBuilder object to fluent access.
Type
PaymentEngineBuilder

(static) this.buildInvoice(reference, errorFunction) → {InvoiceBuilder}

Returns an InvoiceBuilder for creating and configuring a new invoice.
Parameters:
Name Type Description
reference string The reference to use for this invoice.
errorFunction function
Source:
Returns:
- The InvoiceBuilder object for fluent access.
Type
InvoiceBuilder

(static) this.buildTransaction(invoice, errorFunction) → {TransactionBuilder}

Build a transaction using the provided invoice.
Parameters:
Name Type Description
invoice Invoice The invoice object received from InvoiceBuilder.build() when the function succeed.
errorFunction function
Source:
Returns:
Type
TransactionBuilder

(static) this.getStoredTransactions(successFunction, errorFunction)

Get all offline stored transaction from database
Parameters:
Name Type Description
successFunction function When success, a list of stored transaction will be returned.
errorFunction function
Source:

(static) this.setConnectionStateHandler(handler)

This return the state of the payment device only
Parameters:
Name Type Description
handler function The function where the connection state will be passed in
Source:

(static) this.setPeripheralMessageHandler(handler)

This returns the peripheral message (e.g.: idle, presentCard, insertCard, enterPin, removeCard...)
Parameters:
Name Type Description
handler function This function will receive the peripheral message.
Source:

(static) this.setPeripheralStateHandler(handler)

This returns the peripheral state (e.g.: not ready, ready, processing, error...) to the handler function.
Parameters:
Name Type Description
handler function This function will receive the peripheral state
Source:

(static) this.setTransactionResultHandler(handler)

This return the transaction result (e.g.: complete, failed...) to the handler function
Parameters:
Name Type Description
handler function The function which will receive the TransactionResult object
Source:

(static) this.setTransactionStateHandler(handler)

This return the transaction state (e.g.: inactive, readReadFailed...) to the handler function
Parameters:
Name Type Description
handler function This function will receive the current state of the transaction as well as the updated transaction object. The transaction object contain info needed for generating a receipt when it is approved.
Source:

(static) this.startTransaction(errorFunction)

Start taking card payment and process the transaction.
Parameters:
Name Type Description
errorFunction function
Source:

(static) this.stopActiveTransaction(errorFunction)

Stop current active transaction if it is not being processed.
Parameters:
Name Type Description
errorFunction function
Source:

(static) this.uploadAllStoredTransactions(successFunction, errorFunction)

Upload all local stored transactions
Parameters:
Name Type Description
successFunction *
errorFunction *
Source: