npm package: @jaakaru/softpos_api
Description: Restolution SoftPoS Javascript API
Latest version: 0.1.52

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

*   [jsonApi][1]
    *   [placeOrder][2]
        *   [Parameters][3]
    *   [addToOpenTable][4]
        *   [Parameters][5]
    *   [listUsersWithOpenTables][6]
        *   [Parameters][7]
    *   [getActiveTransaction][8]
        *   [Parameters][9]
    *   [executeLisp][10]
        *   [Parameters][11]
    *   [evalLisp][12]
        *   [Parameters][13]
*   [printer][14]
    *   [print][15]
        *   [Parameters][16]
        *   [Examples][17]
*   [payments][18]
    *   [authorizePayment][19]
        *   [Parameters][20]
    *   [abortAuthorization][21]
        *   [Parameters][22]
*   [articles][23]
    *   [listAll][24]
        *   [Parameters][25]
    *   [getPrice][71]
*   [displays][26]
    *   [listAllKitchenSystemTransactions][27]
        *   [Parameters][28]
    *   [removeTransactionFromKitchenSystem][29]
        *   [Parameters][30]
    *   [setLineStateInKitchenSystem][31]
        *   [Parameters][32]
    *   [getConfiguration][33]
        *   [Parameters][34]
    *   [saveCustomConfiguration][35]
        *   [Parameters][36]
    *   [saveWaitingTime][37]
        *   [Parameters][38]
    *   [getWaitingTime][39]
        *   [Parameters][40]
*   [messages][41]
    *   [listenAll][42]
        *   [Parameters][43]
        *   [Examples][44]
*   [utils][45]
    *   [getApiType][46]
    *   [getSoftPosVersion][47]
    *   [getSoftPosInfo][48]
        *   [Parameters][49]
    *   [log][50]
        *   [log][51]
            *   [Parameters][52]
            *   [Examples][53]
        *   [trace][54]
            *   [Parameters][55]
        *   [debug][56]
            *   [Parameters][57]
        *   [info][58]
            *   [Parameters][59]
        *   [warn][60]
            *   [Parameters][61]
        *   [error][62]
            *   [Parameters][63]
        *   [fatal][64]
            *   [Parameters][65]

## jsonApi

JSON API methods to control the SoftPoS CashRegister, see also [https://github.com/Soft-Contact/resto/issues/2#placeorder][66]

### placeOrder

Place order

#### Parameters

*   `order`  as a JSON object
*   `successCallback`  as a function for successful callback
*   `failureCallback`  as a function for failure callback

### addToOpenTable

addToOpenTable

#### Parameters

*   `openTable`  as a JSON object from [https://github.com/Soft-Contact/resto/issues/2#addtoopentable][67]
*   `successCallback`  as a function for successful callback
*   `failureCallback`  as a function for failure callback

### listUsersWithOpenTables

listUsersWithOpenTables, see [https://github.com/Soft-Contact/resto/issues/2#listUsersWithOpenTables][68]

#### Parameters

*   `successCallback`  as a function for successful callback
*   `failureCallback`  as a function for failure callback

### getActiveTransaction

get currently on cashregister screen active transaction

#### Parameters

*   `successCallback`  
*   `failureCallback`  

### executeLisp

Execute lisp macro on cashregister side

#### Parameters

*   `cmd`  lisp macro to execute
*   `successCallback`  
*   `failureCallback`  

**Meta**

*   **deprecated**: use evalLisp instead, kept some time for backwards compatibility

### evalLisp

Evaluate lisp macro on cashregister side

#### Parameters

*   `cmd`  lisp macro to evaluate
*   `successCallback`  
*   `failureCallback`  

## printer

JSON API methods to control the SoftPoS CashRegister printing

### print

Experimental: Print data to the printer

#### Parameters

*   `printData`  
*   `successCallback`  

#### Examples

```javascript
let printData =
{
lines: [

{ type: "TEXT", contents: "test string"},
{ type: "TEXT", contents: "text\non\nmultiple\nlines"},
{ type: "QR_CODE", contents: "sample code", alignment: "RIGHT"},
{ type: "BAR_CODE", contents: "1234567890123"},
{ type: "QR_CODE", contents: "another code"},
]
}
```

## payments

JSON API methods to control the SoftPoS CashRegister payment terminal

### authorizePayment

Experimental: Authorize payment on SoftPoS side using SoftPos configured payment device

#### Parameters

*   `payment`  
*   `successCallback`  
*   `failureCallback`  
*   `statusCallback`  

### abortAuthorization

Experimental: Abort currently active payment

#### Parameters

*   `successCallback`  

## articles

JSON API methods to get article and article group data

### listAll

Get all articles from SoftPos

#### Parameters

*   `successCallback`  
*   `errorCallback`  

### getPrice

Get article price

#### Parameters

*   `priceReq`  
*   `successCallback`  
*   `errorCallback`  

**Meta**

*   **requires**: SoftPoS 26.04.02 at least

## displays

API methods needed by various separate displays (KitchenDisplay, OrderDisplay).

### listAllKitchenSystemTransactions

Experimental: List all transactions based on jobOrderSystemId

#### Parameters

*   `jobOrderSystemId`  Job order system id from which to list transactions
*   `successCallback`  
*   `errorCallback`  

### removeTransactionFromKitchenSystem

Experimental: Remove transactions based on jobOrderSystemId and transactionUuid

#### Parameters

*   `jobOrderSystemId`  Job order system id from which to remove transaction
*   `transactionUuid`  transcation to remove
*   `successCallback`  
*   `errorCallback`  

### setLineStateInKitchenSystem

Experimental: Change transactionsline state

#### Parameters

*   `jobOrderSystemId`  Job order system id from which to remove transaction
*   `transactionUuid`  transcation to modify
*   `lineStateName`  Ordered, Ready, Prepared, Served, Deleted, Other
*   `successCallback`  
*   `errorCallback`  

### getConfiguration

Experimental: Get map of configuration parameters, including custom configuration

#### Parameters

*   `successCallback`  
*   `errorCallback`  

### saveCustomConfiguration

Experimental: Save custom configuration

#### Parameters

*   `conf`  custom configuration
*   `successCallback`  
*   `errorCallback`  

### saveWaitingTime

Save kitchen system waiting time in minutes

#### Parameters

*   `jobOrderSystemId`  
*   `waitingTime`  
*   `successCallback`  
*   `errorCallback`  

### getWaitingTime

Get kitchen system waiting time in minutes

#### Parameters

*   `jobOrderSystemId`  
*   `successCallback`  
*   `errorCallback`  

## messages

Methods related to messages from SoftPos

### listenAll

Experimental: Listen for all messages

#### Parameters

*   `listenCallbackFn`  callback fn where all SoftPoS side asynchronous messages are passed

#### Examples

```javascript
{ type: "COMMAND", data: "REFRESH_KITCHEN_DISPLAY"}
```

## utils

Utility methods

### getApiType

Gets the SoftPoS API type depending on which environment is used to run it

Returns **[string][69]** one of NONE/HTMLVIEW_LEGACY/HTMLVIEW_JCEF

### getSoftPosVersion

Gets the SoftPoS version

Returns **[string][69]** SoftPoS version

### getSoftPosInfo

Get the SoftPos info JSON

#### Parameters

*   `successCallback`  
*   `failureCallback`  

Returns **[json][70]** with fields "success" and "response", where response contains the SoftPosInfo object

### log

Utility methods for logging

#### log

##### Parameters

*   `logRecord`  

##### Examples

```javascript
window.softPos.log({level: 'INFO', msg:'Info message'});
```

#### trace

Log TRACE message

##### Parameters

*   `msg`  
*   `obj`  

#### debug

Log DEBUG message

##### Parameters

*   `msg`  
*   `obj`  

#### info

Log INFO message

##### Parameters

*   `msg`  
*   `obj`  

#### warn

Log WARN message

##### Parameters

*   `msg`  
*   `obj`  

#### error

Log ERROR message

##### Parameters

*   `msg`  
*   `obj`  

#### fatal

Log FATAL message

##### Parameters

*   `msg`  
*   `obj`  

[1]: #jsonapi

[2]: #placeorder

[3]: #parameters

[4]: #addtoopentable

[5]: #parameters-1

[6]: #listuserswithopentables

[7]: #parameters-2

[8]: #getactivetransaction

[9]: #parameters-3

[10]: #executelisp

[11]: #parameters-4

[12]: #evallisp

[13]: #parameters-5

[14]: #printer

[15]: #print

[16]: #parameters-6

[17]: #examples

[18]: #payments

[19]: #authorizepayment

[20]: #parameters-7

[21]: #abortauthorization

[22]: #parameters-8

[23]: #articles

[24]: #listall

[25]: #parameters-9

[26]: #displays

[27]: #listallkitchensystemtransactions

[28]: #parameters-10

[29]: #removetransactionfromkitchensystem

[30]: #parameters-11

[31]: #setlinestateinkitchensystem

[32]: #parameters-12

[33]: #getconfiguration

[34]: #parameters-13

[35]: #savecustomconfiguration

[36]: #parameters-14

[37]: #savewaitingtime

[38]: #parameters-15

[39]: #getwaitingtime

[40]: #parameters-16

[41]: #messages

[42]: #listenall

[43]: #parameters-17

[44]: #examples-1

[45]: #utils

[46]: #getapitype

[47]: #getsoftposversion

[48]: #getsoftposinfo

[49]: #parameters-18

[50]: #log

[51]: #log-1

[52]: #parameters-19

[53]: #examples-2

[54]: #trace

[55]: #parameters-20

[56]: #debug

[57]: #parameters-21

[58]: #info

[59]: #parameters-22

[60]: #warn

[61]: #parameters-23

[62]: #error

[63]: #parameters-24

[64]: #fatal

[65]: #parameters-25

[66]: https://github.com/Soft-Contact/resto/issues/2#placeorder

[67]: https://github.com/Soft-Contact/resto/issues/2#addtoopentable

[68]: https://github.com/Soft-Contact/resto/issues/2#listUsersWithOpenTables

[69]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[70]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON

[71]: #getprice