[taxi] guard is added for freenow no fare and no eta cases + freenow territories fix.

This commit is contained in:
Arsentiy Milchakov 2020-04-06 11:27:02 +03:00 committed by Vladimir Byko-Ianko
parent 8a4584c429
commit fb65cf4f87
2 changed files with 12 additions and 6 deletions

View file

@ -60,7 +60,7 @@
"Glasgow",
"London",
"Manchester",
"City of Nottingham",
"Nottingham",
"Oxford",
"Reading"
],

View file

@ -175,13 +175,19 @@ std::vector<taxi::Product> MakeProductsFromJson(std::string const & src)
FromJSONObjectOptionalField(item, "displayName", product.m_name);
auto const eta = json_object_get(item, "eta");
uint64_t time = 0;
FromJSONObjectOptionalField(eta, "value", time);
product.m_time = strings::to_string(time);
if (json_is_object(eta))
{
uint64_t time = 0;
FromJSONObjectOptionalField(eta, "value", time);
product.m_time = strings::to_string(time);
}
auto const fare = json_object_get(item, "fare");
FromJSONObjectOptionalField(fare, "displayValue", product.m_price);
FromJSONObjectOptionalField(fare, "currencyCode", product.m_currency);
if (json_is_object(fare))
{
FromJSONObjectOptionalField(fare, "displayValue", product.m_price);
FromJSONObjectOptionalField(fare, "currencyCode", product.m_currency);
}
if (product.m_name.empty() || product.m_time.empty() || product.m_price.empty())
continue;