body:
{
phone: "+976 8666 1488" //international format
}
response: 200
body:
{
phone: string
code: string //0000 - for dev
}
response:
{
token: string
profile: {
name: string
email: string
phone: string
balance: number
},
device?: {
_id: string
deviceNumber: string
location: [number, number] //array of lenght 2
waitingPrice: number
price: number
}
nats: {
servers: string
topic: string
user: string
pass: string
}
}
response:
{
token: string
profile: {
name: string
email: string
phone: string
balance: number
},
device?: {
_id: string
deviceNumber: string
location: [number, number] //array of lenght 2
waitingPrice: number
price: number
}
nats: {
servers: string
topic: string
user: string
pass: string
}
}
Note: NATS is used as event bus, consider using this package
body:
{
FCMToken: string
}
response: 200
body
{
name: string
email: string
}
response: 200
query:
{
'bottom-left-longitude': number
'bottom-left-latitude': number
'upper-right-longitude': number
'upper-right-latitude': number
}
response:
[
{
_id: string
deviceNumber: string
price: number
waitingPrice: number
location: [number, number] //Longitude, Latitude
state: 'Idle' | 'Busy' | 'Repair' | 'Error'
},
...
]
example: /api/v1/devices/by-location?bottom-left-longitude=69.9&bottom-left-latitude=69.9&upper-right-longitude=127&upper-right-latitude=80
response: 200
This message will be emitted from the server every 2-5 seconds
//{subject}.CHARGING
{
energy: number
waitingTime: number
amount: number
}
If server
response: Purchase id
{
id: "12d76c8bfca2a22c07a6fca1"
}
response:
[
{
option: string
icon: string
title: string
disabled: true
}
]
params: id
is purchase id obtained from the request above
body:
{
option: string
}
response:
//EVM
{
option: 'EVM'
invoiceId: string //purchase id
newBalance: number
}
//QPAY
{
option: 'QPAY'
invoiceId: string
url: string
}
//Other payment options are disabled for now
Note: use url_launcher (or any other similar package) to open url for payment. After successful payment, the following message will be emitted from the server:
//{subject}.PAYMENT
{
status: 'success' | 'fail'
amount: number
}
Desc: for manually checking the payment status
body:
{
invoiceId: string
}
response:
{
status: 'pending' | 'success' | 'error' | 'canceled'
amount: number
}
body:
{
feedback: {
score: number, // 1-5
description: string
}
}
response: 200
example: /api/v1/purchases/12d76c8bfca2a22c07a6fca1/feedback
params:
{
page: number // from 1
'page-size': number //optional, 50 by default
}
response: check postman
body:
{
amount: number
option: string
}
response:
//QPAY
{
option: 'QPAY'
invoiceId: string
url: string
}
//Other payment options are disabled for now
Note: after successful replenishment, the following message will be emitted from the server:
//{subject}.REPLENISHMENT
{
status: "success"
amount: 10069
}
Desc: for manually checking the replenishment status
body:
{
invoiceId: string
}
response:
{
status: 'pending' | 'success' | 'error' | 'canceled'
amount: number
}