]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/rpcconfig/tariff_helper.cpp
Implemented charges for services.
[stg.git] / projects / stargazer / plugins / configuration / rpcconfig / tariff_helper.cpp
index 91f60062cb48e3b08ef609b386b38f239d5e0d62..26b4e993b719067fae180f47b9c1d1792b1da204 100644 (file)
@@ -1,3 +1,5 @@
+#include <ostream> // xmlrpc-c devs have missed something :)
+
 #include "tariff_helper.h"
 
 void TARIFF_HELPER::GetTariffInfo(xmlrpc_c::value * info) const
@@ -10,6 +12,7 @@ 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));
 
 std::vector<xmlrpc_c::value> prices(DIR_NUM);
 
@@ -60,7 +63,12 @@ if ((it = structVal.find("passivecost")) != structVal.end())
 
 if ((it = structVal.find("traffType")) != structVal.end())
     {
-    data.tariffConf.traffType = xmlrpc_c::value_int(it->second);
+    data.tariffConf.traffType = static_cast<TARIFF::TRAFF_TYPE>(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));
     }
 
 if ((it = structVal.find("dirprices")) != structVal.end())