express.js wrapper to qps api
- node: 8.X^
- npm: 5.X^
- Clone the repo: 'git@github.com:SamLife91/quanterall-payment-system-wrapper.git'
- Install dependencies: 'npm install'
- Create Config file: 'npm run config'
- Fill Config variables: { 'API_URL', 'API_URL_PORT'. 'FISCAL_DEVICE_URL', 'FISCAL_DEVICE_PORT'}
API_URL = xxxx
API_URL_PORT = xxxx
FISCAL_DEVICE_URL = xxxx
FISCAL_DEVICE_PORT = xxxx
- Start the server: 'npm run start'
- import already created POSTMAN file 'Quanterall Payment.postman_collection.json' ()
Login
- Method:
POST
- URL:
/api/v1/auth/login
- Body:
{
"operation": "auth",
"type": "login",
"data": {
"user": "test_user",
"password": "test_password"
}
}
Register
- Method:
POST
- URL:
/api/v1/auth/register
- Body:
{
"operation": "system",
"type": "add_device",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"type": "fiscal",
"manufacture": "datecs",
"model": "fp-60kl",
"serial_number": "dt2742k873"
}
}
operations with fiscal device
add new fiscal device and set to active state
- Method:
POST
- URL:
/api/v1/device/add
- Body:
{
"operation": "system",
"type": "add_device",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"type": "fiscal",
"manufacture": "datecs",
"model": "fp-60kl",
"serial_number": "dt2742k873"
}
}
get all devices of current user.
- Method:
POST
- URL:
/api/v1/device
- Body:
{
"operation": "system",
"type": "get_all_devices",
"auth": {
"user": "test_user",
"token": "test_user_token"
}
}
get device status
- Method:
POST
- URL:
/api/v1/device/status
- Body:
{
"operation": "build_command",
"type": "device_status",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"device": {
"id": "1"
}
}
}
get all user devices
- Method:
POST
- URL:
/api/v1/device/list
- Body:
{
"operation": "system",
"type": "get_all_devices",
"auth": {
"user": "test_user",
"token": "test_user_token"
}
}
get current date and time of device
- Method:
POST
- URL:
/api/v1/device/get-time
- Body:
{
"operation": "build_command",
"type": "get_time_and_date",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"device": {
"id": "1"
}
}
}
set date and time of device
- Method:
POST
- URL:
/api/v1/device/set-time
- Body:
{
"operation": "build_command",
"type": "set_time_and_date",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"clock": "DD-MM-YY HH:MM:SS",
"device": {
"id": "1"
}
}
}
operations with fiscal device items(products)
adding new item, or overwrite exsisting one
- Method:
POST
- URL:
/api/v1/item/add
- Body:
{
"operation": "build_command",
"type": "add_item",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"item_data": {
"group": "1",
"name": "test_item_name",
"number": "1",
"quantity": "1",
"price": "1.00",
"tax_group": "Б"
},
"device": {
"id": "1"
}
}
}
get item from fiscal device
- Method:
POST
- URL:
/api/v1/item
- Body:
{
"operation": "build_command",
"type": "get_item",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"item_data": {
"number": "1"
},
"device": {
"id": "1"
}
}
}
get all items from fiscal device
- Method:
POST
- URL:
/api/v1/item/all
- Body:
{
"operation": "build_command",
"type": "get_first_item",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"device": {
"id": "1"
}
}
}
trigger fiscal device to print receipt
- Method:
POST
- URL:
/api/v1/receipt/fiscal
- Body:
{
"operation": "build_command",
"type": "fiscal_receipt",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"items": [
{
"price": "0.01",
"product": "Пуканки",
"quantity": "1"
},
{
"price": "0.01",
"product": "Вафла",
"quantity": "2"
}
],
"operator": {
"name": "test_operator_name",
"num": "1",
"pwd": "0000"
},
"paidmode": "cash",
"tax_type": "B",
"till_num": "1",
"device": {
"id": "1"
}
}
}
trigger fiscal device to print non-fiscal receipt
- Method:
POST
- URL:
/api/v1/receipt/non-fiscal
- Body:
{
"operation": "build_command",
"type": "non_fiscal_receipt",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"text":
[
"Non fiscal receipt text 1",
"Non fiscal receipt text 2"
],
"device": {
"id": "1"
}
}
}
trigger fiscal device to print reversal receipt
- Method:
POST
- URL:
/api/v1/receipt/reversal
- Body:
{
"operation": "build_command",
"type": "reversal",
"auth": {
"user": "test_user",
"token": "test_user_token"
},
"data": {
"reversal_data": {
"operator": {"name": "pesho", "num": "1", "pwd": "1"},
"till_num": "1",
"tax_type": "Б",
"unp": "DT518231-0001-0000015",
"document_type": "2",
"document_number": "34",
"document_date_time": "2702191208",
"fm_number": "02518231",
"reason": "не ме кефят пуканки 2",
"items": [
{"price": "0.01", "product": "Пуканки", "quantity": "1"}
]
},
"device": {
"id": "1"
}
}
}