Service Lifetime
Service Start Time
After order is paid based on merchant's instruction, start
Lua script will be executed. By default, system creates user service record UserService
after execution of start
Lua script, and UserService
status is ServiceRunning
which means the service starts timing. The creation time of UserService
is the start time of service.
If service provider wants to disable defult service status, provider can invoke preventDefault()
from librarySystemUtils
in start
Lua script. This function can initiate UserService
status to be ServicePending
which means system has not start timing. User then can use service following instructions provided by service provider.
E.g. User deploys his application though HTTP API following instruction from service provider. When deployment is successful , provider resource node will send request to provider SDK node to update UserService
status to be ServiceRunning
and start timing.
Service End Time
Service provider SDK node will check expiration of UserService
hourly: When service end time is less than current time, system will update UserService
status to ServiceDone
and run stop
Lua script to terminate service resource.
Service Termination By Insufficient Resource
When user follows instructions from a provider to start service, once provider resource node does not have enough resource, it will send refund request to SDK node. SDK node then updates UserService
status to ServiceAbsort
. Service is terminated.
Service Termination By User
If user wants to stop an order before expiration, he can send refund request via cli tool (Service should be refundable). After sending the request, system will calculate the remaining value of the order in vsys and convert the value into provider-defined token using vsysTokenExchangeRate
. The token can be used for future service purchasing.