[core][taxi] yango taxi is added

This commit is contained in:
Arsentiy Milchakov 2020-09-07 14:56:20 +03:00 committed by Aleksey Belousov
parent f94095173b
commit fb06901b67
8 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,44 @@
{
"disabled": {
"countries": [],
"mwms": []
},
"enabled": {
"countries": [
{
"cities": [
"Accra"
],
"id": "Ghana"
},
{
"cities": [
"Abidjan"
],
"id": "Cote dIvoire"
},
{
"cities": [
"Bucharest"
],
"id": "Romania"
},
{
"cities": [
"Helsinki"
],
"id": "Finland"
},
{
"cities": [
"Haifa",
"Ashkelon",
"Be'er Sheva",
"Tel Aviv-Yafo"
],
"id": "Israel Region"
}
],
"mwms": []
}
}

View file

@ -77,6 +77,8 @@ set(
utm.hpp
yandex_api.cpp
yandex_api.hpp
yango_api.cpp
yango_api.hpp
)
omim_add_library(${PROJECT_NAME} ${SRC})

View file

@ -6,6 +6,7 @@
#include "partners_api/taxi_places_loader.hpp"
#include "partners_api/uber_api.hpp"
#include "partners_api/yandex_api.hpp"
#include "partners_api/yango_api.hpp"
#include "geometry/latlon.hpp"
#include "geometry/mercator.hpp"
@ -120,6 +121,7 @@ Engine::Engine(std::vector<ProviderUrl> urls /* = {} */)
{
AddApi<yandex::Api>(urls, Provider::Type::Yandex);
AddApi<freenow::Api>(urls, Provider::Type::Freenow);
AddApi<yango::Api>(urls, Provider::Type::Yango);
}
void Engine::SetDelegate(std::unique_ptr<Delegate> delegate)

View file

@ -55,6 +55,7 @@ std::string Loader::GetFileNameByProvider(Provider::Type const type)
case Provider::Type::Uber: return "taxi_places/uber.json";
case Provider::Type::Yandex: return "taxi_places/yandex.json";
case Provider::Type::Freenow: return "taxi_places/freenow.json";
case Provider::Type::Yango: return "taxi_places/yango.json";
case Provider::Type::Count: LOG(LERROR, ("Incorrect taxi provider")); return "";
}
UNREACHABLE();

View file

@ -26,6 +26,7 @@ public:
Maxim,
Rutaxi,
Freenow,
Yango,
Count
};
@ -84,6 +85,7 @@ inline std::string DebugPrint(Provider::Type type)
case Provider::Type::Maxim: return "Maxim";
case Provider::Type::Rutaxi: return "Rutaxi";
case Provider::Type::Freenow: return "Freenow";
case Provider::Type::Yango: return "Yango";
case Provider::Type::Count: ASSERT(false, ()); return "";
}
UNREACHABLE();

View file

@ -0,0 +1,17 @@
#include "partners_api/yango_api.hpp"
namespace taxi::yango
{
RideRequestLinks Api::GetRideRequestLinks(std::string const & productId, ms::LatLon const & from,
ms::LatLon const & to) const
{
std::ostringstream link;
link << "https://2187871.redirect.appmetrica.yandex.com/route?start-lat=" << from.m_lat
<< "&start-lon=" << from.m_lon << "&end-lat=" << to.m_lat << "&end-lon=" << to.m_lon
<< "&utm_source=mapsme&utm_medium=none&ref=8d20bf0f9e4749c48822358cdaf6a6c7"
"&appmetrica_tracking_id=1179283486394045767&level=50";
return {link.str(), link.str()};;
}
} // namespace taxi::yango

View file

@ -0,0 +1,17 @@
#pragma once
#include "partners_api/taxi_base.hpp"
#include "partners_api/yandex_api.hpp"
namespace taxi::yango
{
class Api : public yandex::Api
{
public:
explicit Api(std::string const & baseUrl = yandex::kTaxiInfoUrl) : yandex::Api(baseUrl) {}
/// Returns link which allows you to launch the Yandex app.
RideRequestLinks GetRideRequestLinks(std::string const & productId, ms::LatLon const & from,
ms::LatLon const & to) const override;
};
} // namespace taxi::yango

View file

@ -299,30 +299,35 @@ PARTNERS_TAXI_INFO = """
"distance": 6888.846981748964,
"options": [
{
"class_level": 50,
"class_name": "econom",
"min_price": 129,
"price": 344,
"waiting_time": 527.8793726078095
},
{
"class_level": 70,
"class_name": "business",
"min_price": 239,
"price": 504,
"waiting_time": 76.37023611385494
},
{
"class_level": 100,
"class_name": "comfortplus",
"min_price": 239,
"price": 557,
"waiting_time": 99.0058955445591
},
{
"class_level": 200,
"class_name": "minivan",
"min_price": 239,
"price": 532,
"waiting_time": 322.77413167989687
},
{
"class_level": 300,
"class_name": "vip",
"min_price": 359,
"price": 799,