]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp
Verbose test reports on failures.
[stg.git] / projects / stargazer / plugins / configuration / rpcconfig / tariff_helper.cpp
index 91f60062cb48e3b08ef609b386b38f239d5e0d62..a6ec1feb89aa5744146e3c7cc726a57743e1e5ae 100644 (file)
@@ -1,5 +1,11 @@
 #include "tariff_helper.h"
 
 #include "tariff_helper.h"
 
+#include "stg/tariff_conf.h"
+#include "stg/common.h"
+#include "stg/const.h"
+
+#include <ostream> // xmlrpc-c devs have missed something :)
+
 void TARIFF_HELPER::GetTariffInfo(xmlrpc_c::value * info) const
 {
 std::map<std::string, xmlrpc_c::value> structVal;
 void TARIFF_HELPER::GetTariffInfo(xmlrpc_c::value * info) const
 {
 std::map<std::string, xmlrpc_c::value> structVal;
@@ -10,6 +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["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(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<xmlrpc_c::value> prices(DIR_NUM);
 
 
 std::vector<xmlrpc_c::value> prices(DIR_NUM);
 
@@ -60,7 +69,22 @@ if ((it = structVal.find("passivecost")) != structVal.end())
 
 if ((it = structVal.find("traffType")) != structVal.end())
     {
 
 if ((it = structVal.find("traffType")) != structVal.end())
     {
-    data.tariffConf.traffType = xmlrpc_c::value_int(it->second);
+    data.tariffConf.traffType = static_cast<STG::Tariff::TraffType>(xmlrpc_c::value_int(it->second).cvalue());
+    }
+
+if ((it = structVal.find("period")) != structVal.end())
+    {
+    data.tariffConf.period = STG::Tariff::parsePeriod(xmlrpc_c::value_string(it->second));
+    }
+
+if ((it = structVal.find("changePolicy")) != structVal.end())
+    {
+    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())
     }
 
 if ((it = structVal.find("dirprices")) != structVal.end())