X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/d1ddf1df6b8987cc1be7dc96608e22998c3e9cb6..8f8c49688664c8681a11ea31f6a810625dcd108b:/projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp diff --git a/projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp b/projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp index c96b7d31..a6ec1feb 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp @@ -1,7 +1,11 @@ -#include // xmlrpc-c devs have missed something :) - #include "tariff_helper.h" +#include "stg/tariff_conf.h" +#include "stg/common.h" +#include "stg/const.h" + +#include // xmlrpc-c devs have missed something :) + void TARIFF_HELPER::GetTariffInfo(xmlrpc_c::value * info) const { std::map structVal; @@ -12,8 +16,9 @@ structVal["fee"] = xmlrpc_c::value_double(data.tariffConf.fee); structVal["freemb"] = xmlrpc_c::value_double(data.tariffConf.free); structVal["passivecost"] = xmlrpc_c::value_double(data.tariffConf.passiveCost); structVal["traffType"] = xmlrpc_c::value_int(data.tariffConf.traffType); -structVal["period"] = xmlrpc_c::value_string(TARIFF::PeriodToString(data.tariffConf.period)); -structVal["changePolicy"] = xmlrpc_c::value_string(TARIFF::ChangePolicyToString(data.tariffConf.changePolicy)); +structVal["period"] = xmlrpc_c::value_string(STG::Tariff::toString(data.tariffConf.period)); +structVal["changePolicy"] = xmlrpc_c::value_string(STG::Tariff::toString(data.tariffConf.changePolicy)); +structVal["changePolicyTimeout"] = xmlrpc_c::value_string(formatTime(data.tariffConf.changePolicyTimeout)); std::vector prices(DIR_NUM); @@ -64,17 +69,22 @@ if ((it = structVal.find("passivecost")) != structVal.end()) if ((it = structVal.find("traffType")) != structVal.end()) { - data.tariffConf.traffType = static_cast(xmlrpc_c::value_int(it->second).cvalue()); + data.tariffConf.traffType = static_cast(xmlrpc_c::value_int(it->second).cvalue()); } if ((it = structVal.find("period")) != structVal.end()) { - data.tariffConf.period = TARIFF::StringToPeriod(xmlrpc_c::value_string(it->second)); + data.tariffConf.period = STG::Tariff::parsePeriod(xmlrpc_c::value_string(it->second)); } if ((it = structVal.find("changePolicy")) != structVal.end()) { - data.tariffConf.changePolicy = TARIFF::StringToChangePolicy(xmlrpc_c::value_string(it->second)); + data.tariffConf.changePolicy = STG::Tariff::parseChangePolicy(xmlrpc_c::value_string(it->second)); + } + +if ((it = structVal.find("changePolicyTimeout")) != structVal.end()) + { + data.tariffConf.changePolicyTimeout = readTime(xmlrpc_c::value_string(it->second)); } if ((it = structVal.find("dirprices")) != structVal.end())