list(id)


Tariff

tariff/ actions

list(device_type)

Get list of device’s tariffs available to user. If user’s dealer is default dealer or paas then listed tariffs of that dealer else listed tariffs of parent dealer.

Availability of tariffs with docType:
all and paas – for all users
individual – only for users with legal type individual
legal entity – are available for users with legal type legal entity and sole trader.

Parameter device_type is currently ‘tracker’ only (reserved).
return:

[php]
{
"success": true,
"list": [<tariff>, …]
}
[/php]

where <tariff> is

[php]
{
"id": <int>,
"name": <string>,
"group_id": <int>,
"price": <double>
}
[/php]

tariff/ actions

list(device_type)
Get list of device’s tariffs available to user.
If user’s dealer if default dealer or paas then listed tariffs of that dealer else listed tariffs of parent dealer.
Listed only tariffs HandlerTariff#Tariffstolegaltypes available for user’s legal type.
return:

[php]
{
"success": true,
"list": [<tariff>, …]
}
[/php]

where <tariff> is

[php]
{
"id": <int>,
"name": <string>,
"group_id": <int>,
"price": <double>,
"has_reports" : <true if reports are allowed, false otherwise>, //bool
"paas_free": <true if this tariff is free for PaaS owner, false otherwise> //bool
}
[/php]

tariff/tracker/ actions:

User of dealer can switch tracker from tariff t1 to tariff t2 if:
tracker belongs to user and isn’t a //clone//.
tracker’s tariff last changed more than tariff.freeze.period (config option. default 30 days) ago.
t1.tariff_id != t2.tariff_id, i.e. new tariff must be differ from current.
t1.dealer_id = t2.dealer_id = dealer.effectiveDealerId, i.e. current and new tariffs must belongs to user’s effective dealer
t2.active = 1, i.e. new tariff is //active// (tariff’s option “Allow users to switch to this tariff independently” in panel is set on)
t1.grouping = t2.grouping, i.e. user can change tariff only within one group of tariffs
t2.device = tracker, i.e. new tariff must be for trackers
new tariff is HandlerTariff#Tariffstolegaltypes available to user’s legal type
User’s effective dealer is 1. user’s dealer if its dealer_id = defaultDealerId (config option) or contract_type = ‘paas’ 2. parent of user’s dealer elsewise
Errors:

  • 201 – Not found in database (if user have not trackers with given tracker_id)
  • 219 – Not allowed for clones of the device
  • 237 – Invalid tariff (if there are no tariff with tracker.tariff_id and belongs to user’s effective dealer)

list(tracker_id)
List tariffs on which user can switch passed tracker (even when tariff last changed less or equal than tariff.freeze.period time ago).
Return:

[php]
{
"success": true,
"list": [<tariff>, …],
"hours_to_next_change": <hours> // int
}
[/php]

Where hours_to_next_change is whole number of hours in tariff.freeze.period.
change(tracker_id, tariff_id)
Change tariff of tracker (with tracker_id) to new tariff (with tariff_id). See: BillingUsers users billing.
Return:

[php]
{ "success": true }
[/php]

Errors:

  • 238 – Changing tariff is not allowed (if user can’t switch tracker to that tariff)
  • 240 – Not allowed to change tariff too frequently (tariff last changed less or equal to tariff.freeze.period of time)

If you have more questions please contact our support team

Contacts

USA: +1 858 815 9045

Mexico: +52 334 1642158

UK: +44 808 1641499

Germany: +49 1573 5988250

Russia: +7 495 223 0427

Log in

Login

[clean-login]

CLOSE
Register

[clean-login-register]

CLOSE
Loading...