[ads][core] mastercard-sberbank banner is added, tinkoff and skyeng banners are disabled.

This commit is contained in:
Arsentiy Milchakov 2020-08-06 12:55:17 +03:00 committed by Aleksandr Zatsepin
parent de6f53f736
commit 11464dc78e
8 changed files with 149 additions and 10 deletions

View file

@ -23,6 +23,8 @@ set(
ads/mts_ads.hpp
ads/rb_ads.cpp
ads/rb_ads.hpp
ads/mastercard_sber_ads.cpp
ads/mastercard_sber_ads.hpp
ads/skyeng_ads.cpp
ads/skyeng_ads.hpp
ads/tinkoff_allairlines_ads.cpp

View file

@ -2,13 +2,9 @@
#include "partners_api/ads/bookmark_catalog_ads.hpp"
#include "partners_api/ads/facebook_ads.hpp"
#include "partners_api/ads/google_ads.hpp"
#include "partners_api/ads/mastercard_sber_ads.hpp"
#include "partners_api/ads/mopub_ads.hpp"
#include "partners_api/ads/mts_ads.hpp"
#include "partners_api/ads/rb_ads.hpp"
#include "partners_api/ads/skyeng_ads.hpp"
#include "partners_api/ads/tinkoff_allairlines_ads.hpp"
#include "partners_api/ads/tinkoff_insurance_ads.hpp"
#include "indexer/feature_data.hpp"
@ -53,11 +49,8 @@ Engine::Engine(std::unique_ptr<Delegate> delegate)
m_searchBanners.emplace_back(Banner::Type::Facebook, std::make_unique<FacebookSearch>());
m_downloadOnMapBanners.emplace_back(Banner::Type::TinkoffAllAirlines,
std::make_unique<TinkoffAllAirlines>(*m_delegate));
m_downloadOnMapBanners.emplace_back(Banner::Type::TinkoffInsurance,
std::make_unique<TinkoffInsurance>(*m_delegate));
m_downloadOnMapBanners.emplace_back(Banner::Type::Skyeng, std::make_unique<Skyeng>(*m_delegate));
m_downloadOnMapBanners.emplace_back(Banner::Type::MastercardSberbank,
std::make_unique<MastercardSberbank>(*m_delegate));
m_downloadOnMapPromo.emplace_back(Banner::Type::BookmarkCatalog,
std::make_unique<BookmarkCatalog>(*m_delegate));
}

View file

@ -26,6 +26,7 @@ struct Banner
Mts = 6,
Skyeng = 7,
BookmarkCatalog = 8,
MastercardSberbank = 9,
};
Banner() = default;
@ -48,6 +49,7 @@ inline std::string DebugPrint(Banner::Type type)
case Banner::Type::Mts: return "Mts";
case Banner::Type::Skyeng: return "Skyeng";
case Banner::Type::BookmarkCatalog: return "BookmarkCatalog";
case Banner::Type::MastercardSberbank: return "MastercardSberbank";
}
UNREACHABLE();
}

View file

@ -0,0 +1,71 @@
#include "partners_api/ads/mastercard_sber_ads.hpp"
namespace
{
std::initializer_list<std::string> const kSupportedLanguages = {"ru"};
std::initializer_list<storage::CountryId> const kSupportedCountries = {
"Russian Federation",
"Italy",
"Germany",
"France",
"Ukraine",
"Poland",
"Spain",
"Belarus",
"Czech Republic",
"Turkey",
"Netherlands",
"Austria",
"Greece",
"Finland",
"Romania",
"Switzerland",
"Lithuania",
"Hungary",
"Thailand",
"Kazakhstan",
"Norway",
"Sweden",
"Estonia",
"Latvia",
"Portugal",
"Bulgaria",
"Cyprus",
"Croatia",
"Armenia",
"United Arab Emirates",
"Montenegro",
"Denmark",
"South Korea",
"Israel",
"Egypt",
"Kyrgyzstan",
"Tunisia",
"Saudi Arabia",
"Malta",
"Iceland",
"Gibraltar",
"United States of America",
"United Kingdom",
"Tanzania"
};
} // namespace
namespace ads
{
MastercardSberbank::MastercardSberbank(Delegate & delegate)
: DownloadOnMapContainer(delegate)
{
AppendSupportedUserLanguages(kSupportedLanguages);
AppendSupportedCountries(kSupportedCountries);
}
std::string MastercardSberbank::GetBannerInternal() const
{
return "https://ad.doubleclick.net/ddm/trackclk/"
"N144601.3594583MAPS.ME/B24472590.278434206;"
"dc_trk_aid=472553463;dc_trk_cid=135308154;"
"dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua";
}
} // namespace ads

View file

@ -0,0 +1,15 @@
#pragma once
#include "partners_api/ads/ads_base.hpp"
namespace ads
{
class MastercardSberbank : public DownloadOnMapContainer
{
public:
explicit MastercardSberbank(Delegate & delegate);
private:
std::string GetBannerInternal() const override;
};
} // namespace ads

View file

@ -12,6 +12,7 @@ set(
freenow_tests.cpp
google_tests.cpp
guides_on_map_tests.cpp
mastercard_sberbank_tests.cpp
# Maxim taxi project is disabled.
# maxim_tests.cpp
# Megafon project is disabled until the contract is renewed or extended.

View file

@ -0,0 +1,43 @@
#include "testing/testing.hpp"
#include "partners_api/partners_api_tests/download_on_map_container_delegate.hpp"
#include "partners_api/ads/mastercard_sber_ads.hpp"
UNIT_TEST(MastercardSberbank_GetBanner)
{
DownloadOnMapContainerDelegateForTesting delegate;
ads::MastercardSberbank masterSber(delegate);
m2::PointD point;
{
delegate.SetTopmostParent("Russian Federation");
auto const banner = masterSber.GetBanner("Russia_Tambov Oblast", point, "ru");
TEST(!banner.empty(), ());
}
{
delegate.SetTopmostParent("United States of America");
auto const banner = masterSber.GetBanner("US_North Carolina_Raleigh", point, "ru");
TEST(!banner.empty(), ());
}
{
delegate.SetTopmostParent("Russian Federation");
auto const banner = masterSber.GetBanner("Russia_Tambov Oblast", point, "en");
TEST(banner.empty(), ());
}
{
delegate.SetTopmostParent("United States of America");
auto const banner = masterSber.GetBanner("US_North Carolina_Raleigh", point, "en");
TEST(banner.empty(), ());
}
{
delegate.SetTopmostParent("Cote dIvoire");
auto const banner = masterSber.GetBanner("Cote dIvoire", point, "ru");
TEST(banner.empty(), ());
}
{
delegate.SetTopmostParent("Cote dIvoire");
auto const banner = masterSber.GetBanner("Cote dIvoire", point, "en");
TEST(banner.empty(), ());
}
}

View file

@ -78,6 +78,9 @@
3DCAC69524D1CFE900518E8B /* booking_ordering_params.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3DCAC69324D1CFE800518E8B /* booking_ordering_params.cpp */; };
3DCD415320DAB33700143533 /* booking_block_params.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3DCD415120DAB33700143533 /* booking_block_params.cpp */; };
3DCD415420DAB33700143533 /* booking_block_params.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3DCD415220DAB33700143533 /* booking_block_params.hpp */; };
3DCF64A824DC0A0300C49963 /* mastercard_sber_ads.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3DCF64A624DC0A0200C49963 /* mastercard_sber_ads.hpp */; };
3DCF64A924DC0A0300C49963 /* mastercard_sber_ads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3DCF64A724DC0A0200C49963 /* mastercard_sber_ads.cpp */; };
3DCF64AB24DC0A2300C49963 /* mastercard_sberbank_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3DCF64AA24DC0A2300C49963 /* mastercard_sberbank_tests.cpp */; };
3DF01C2D20652463005DDF8C /* taxi_places.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3DF01C2A20652462005DDF8C /* taxi_places.cpp */; };
3DF01C2E20652463005DDF8C /* taxi_places.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3DF01C2B20652463005DDF8C /* taxi_places.hpp */; };
3DF9C219207CAC3000DA0793 /* taxi_places_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3DF9C218207CAC3000DA0793 /* taxi_places_tests.cpp */; };
@ -197,6 +200,9 @@
3DCAC69324D1CFE800518E8B /* booking_ordering_params.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = booking_ordering_params.cpp; sourceTree = "<group>"; };
3DCD415120DAB33700143533 /* booking_block_params.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = booking_block_params.cpp; sourceTree = "<group>"; };
3DCD415220DAB33700143533 /* booking_block_params.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = booking_block_params.hpp; sourceTree = "<group>"; };
3DCF64A624DC0A0200C49963 /* mastercard_sber_ads.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = mastercard_sber_ads.hpp; sourceTree = "<group>"; };
3DCF64A724DC0A0200C49963 /* mastercard_sber_ads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mastercard_sber_ads.cpp; sourceTree = "<group>"; };
3DCF64AA24DC0A2300C49963 /* mastercard_sberbank_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mastercard_sberbank_tests.cpp; sourceTree = "<group>"; };
3DF01C2A20652462005DDF8C /* taxi_places.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = taxi_places.cpp; sourceTree = "<group>"; };
3DF01C2B20652463005DDF8C /* taxi_places.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = taxi_places.hpp; sourceTree = "<group>"; };
3DF9C218207CAC3000DA0793 /* taxi_places_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = taxi_places_tests.cpp; sourceTree = "<group>"; };
@ -282,6 +288,8 @@
3DBD7BE524251BF000ED9FE8 /* ads */ = {
isa = PBXGroup;
children = (
3DCF64A724DC0A0200C49963 /* mastercard_sber_ads.cpp */,
3DCF64A624DC0A0200C49963 /* mastercard_sber_ads.hpp */,
3DBD7BE624251BF000ED9FE8 /* bookmark_catalog_ads.cpp */,
3DBD7BE724251BF000ED9FE8 /* google_ads.hpp */,
3DBD7BE824251BF000ED9FE8 /* banner.hpp */,
@ -391,6 +399,7 @@
F6B536441DA521060067EEA5 /* partners_api_tests */ = {
isa = PBXGroup;
children = (
3DCF64AA24DC0A2300C49963 /* mastercard_sberbank_tests.cpp */,
3D035CA4245195EF00C21B57 /* guides_on_map_tests.cpp */,
3DBD7C1C24251C1100ED9FE8 /* bookmark_catalog_ads_tests.cpp */,
3DBD7C1A24251C1000ED9FE8 /* download_on_map_container_delegate.hpp */,
@ -489,6 +498,7 @@
45AC338F22C4F449004DC574 /* utm.hpp in Headers */,
4566605120D91FEE0085E8C1 /* megafon_countries.hpp in Headers */,
F6B536431DA520E40067EEA5 /* uber_api.hpp in Headers */,
3DCF64A824DC0A0300C49963 /* mastercard_sber_ads.hpp in Headers */,
3D035CA2245195E600C21B57 /* guides_on_map_api.hpp in Headers */,
3DBD7C0424251BF000ED9FE8 /* mopub_ads.hpp in Headers */,
3DBD7C1224251BF000ED9FE8 /* ads_utils.hpp in Headers */,
@ -624,6 +634,7 @@
3DBD7C0724251BF000ED9FE8 /* mts_ads.cpp in Sources */,
F67E75251DB8F06F00D6741F /* opentable_api.cpp in Sources */,
3DBD7C1F24251C1100ED9FE8 /* mts_tests.cpp in Sources */,
3DCF64A924DC0A0300C49963 /* mastercard_sber_ads.cpp in Sources */,
3D18DC4422956E0900A583A6 /* promo_tests.cpp in Sources */,
3DBD7C2324251C1100ED9FE8 /* tinkoff_airlines_tests.cpp in Sources */,
BB1956E61F543D7C003ECE6C /* locals_api.cpp in Sources */,
@ -635,6 +646,7 @@
3DBD7C1724251BF000ED9FE8 /* tinkoff_insurance_ads.cpp in Sources */,
3DFEBFA31EFBFC2300317D5C /* taxi_engine_tests.cpp in Sources */,
F6B536401DA520E40067EEA5 /* booking_api.cpp in Sources */,
3DCF64AB24DC0A2300C49963 /* mastercard_sberbank_tests.cpp in Sources */,
3D47B29A1F054C89000828D2 /* taxi_base.cpp in Sources */,
349CFD0D2045720700569949 /* maxim_tests.cpp in Sources */,
3DFEBF9E1EFBFC1500317D5C /* yandex_api.cpp in Sources */,