Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor supported regions, large anonymity country codes and other country codes to use std::set #9205

Closed
tmancey opened this issue Apr 14, 2020 · 2 comments · Fixed by brave/brave-core#5443

Comments

@tmancey
Copy link
Contributor

tmancey commented Apr 14, 2020

Refactor supported regions, large anonymity country codes and other country codes to use std::set for:

Change const std::map<int, std::vector<std::string>> kSupportedRegionsSchemas to const std::map<int, std::set<std::string>> kSupportedRegionsSchemas

Change const std::map<std::string, bool> kLargeAnonymityCountryCodes to const std::set<std::string> kLargeAnonymityCountryCodes

Change const std::map<std::string, bool> kOtherCountryCodes to const std::set<std::string> kOtherCountryCodes

@kjozwiak
Copy link
Member

kjozwiak commented Jun 12, 2020

Verification PASSED on macOS 10.15.5 x64 using the following build:

Brave | 1.10.90 Chromium: 83.0.4103.97 (Official Build) (64-bit)
-- | --
Revision | 326d148b9655369b86498d9ecca39f63dd2bdd2d-refs/branch-heads/4103@{#657}
OS | macOS Version 10.15.5 (Build 19F101)
  • ensured that you can enable/view ads in the following supported regions
    • Canada, USA, Poland, Russia
  • ensured that ads are disabled for unsupported regions like Iran

Screen Shot 1399-03-23 at 15 35 46

Ensured that "buildChannel":"release" and "platform":"macos" are being appended in /v1/confirmation/{confirmation_id}/{credential} requests as per the following:

INFO:redeem_token.cc(111)] CreateConfirmation
INFO:redeem_token.cc(113)] POST /v1/confirmation/{confirmation_id}/{credential}
INFO:redeem_token.cc(116)] URL Request:
INFO:redeem_token.cc(119)]   URL: https://ads-serve.brave.com/v1/confirmation/333c3ace-0f51-4a9f-aab9-7a431d987d67/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwibmx3d2l5eWpiMGFQclhZUTE1aGVCVDlTcFJGdUpVRERQWjcvWVFlbmNEST1cIixcImJ1aWxkQ2hhbm5lbFwiOlwicmVsZWFzZVwiLFwiY3JlYXRpdmVJbnN0YW5jZUlkXCI6XCI3YWMyMGFiZS05ZDY0LTQ1ZjMtYjA5NS1mODJlMTExZWE0N2NcIixcInBheWxvYWRcIjp7fSxcInBsYXRmb3JtXCI6XCJtYWNvc1wiLFwidHlwZVwiOlwidmlld1wifSIsInNpZ25hdHVyZSI6IkJzbzE2aGp6V01qRFlpenJpeHVVNm5mUGlQcUhmaHloNXRUT1RkcGVHTmlma2JuZVptMHpPRXFoeTRnZDRzM0RLVStEeU9pSVREQ2dsdldrdEtmS0FBPT0iLCJ0IjoiZ3l2V0xROVNscVgxR3M1STdHZVdsRzRBMlpjcFNQVk03dHFUakdEOTQrUWt1SVdLdmlSZFNmUlZGV2t3aFN3bjRDTUduc2NzL3pJVnpYV21TaXgyZWc9PSJ9
INFO:redeem_token.cc(131)]   Body: {"blindedPaymentToken":"nlwwiyyjb0aPrXYQ15heBT9SpRFuJUDDPZ7/YQencDI=","buildChannel":"release","creativeInstanceId":"7ac20abe-9d64-45f3-b095-f82e111ea47c","payload":{},"platform":"macos","type":"view"}
INFO:redeem_token.cc(134)]   Headers:
INFO:redeem_token.cc(136)]     accept: application/json
INFO:redeem_token.cc(140)]   Content_type: application/json

As per the STR via brave/brave-core#5067 (comment), /v1/confirmation/{confirmation_id}/{credential} requests should have the following being listed:

  • "buildChannel":"release"
  • "platform":"macos"
  • CountryCode

However, as per #9823, the CountryCode isn't available in 1.10.x and will be fixed in 1.11.x.


Verification passed on

Brave 1.10.90 Chromium: 83.0.4103.97 (Official Build) (64-bit)
Revision 326d148b9655369b86498d9ecca39f63dd2bdd2d-refs/branch-heads/4103@{# 657}
OS Linux
  • Verified Ads can be enabled for supported countries eg: US/CA/UK
  • Verified Sorry! Ads is not supported message is shown for unsupported countries eg: Iran
  • Verified"buildChannel":"release" and "platform":"linux" is shown in logs for confirmations
    image

Verification passed on


Brave | 1.10.90 Chromium: 83.0.4103.97 (Official Build) (64-bit)
-- | --
Revision | 326d148b9655369b86498d9ecca39f63dd2bdd2d-refs/branch-heads/4103@{#657}
OS | Windows 10 OS Version 1903 (Build 18362.30)

  • Verified Ads can be enabled for supported countries eg: US/CA/UK
  • Verified Sorry! Ads is not supported message is shown for unsupported countries eg: Iran
  • Verified"buildChannel":"release" and "platform":"windows" is shown in logs for confirmations
[2020:2024:0615/184145.060:INFO:redeem_token.cc(111)] CreateConfirmation
[2020:2024:0615/184145.060:INFO:redeem_token.cc(113)] POST /v1/confirmation/{confirmation_id}/{credential}
[2020:2024:0615/184145.060:INFO:redeem_token.cc(116)] URL Request:
[2020:2024:0615/184145.060:INFO:redeem_token.cc(119)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/96ac4650-a2dd-4c0e-b6c2-57993ac163c9/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiOElRTnI5Vkd5WDRnZUg0dU11NmNycm1nU0llaWIydmxVQWVDU1o4WjUzbz1cIixcImJ1aWxkQ2hhbm5lbFwiOlwicmVsZWFzZVwiLFwiY3JlYXRpdmVJbnN0YW5jZUlkXCI6XCJlNGNjNDljYi1lNTgxLTQyMWQtOTljOC0zMGE2YzJhNDFiODVcIixcInBheWxvYWRcIjp7fSxcInBsYXRmb3JtXCI6XCJ3aW5kb3dzXCIsXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiZWhNUkdtQkRoanlLdWVlOHQzMFpGQzZuVTBWMEttWGZHNUlkMFptMVZjbXlDMjRTKzA1bEZoS2xrTzhlRXpTc0IvMnUvcGkzbTBZanFJRGVXSlY5ZEE9PSIsInQiOiI4NmNVaU91ZGFhZ3A2SXFBY09vd3JJYkFnZFc2OHJLRiswRyt2SlBFc1NUSmdMbHlDRDVEQzhYQ2k4VHBVQ1pYNTRjeFFCMHBpOWgxcG1GNDFSeXp6UT09In0=
[2020:2024:0615/184145.060:INFO:redeem_token.cc(131)]   Body: {"blindedPaymentToken":"8IQNr9VGyX4geH4uMu6crrmgSIeib2vlUAeCSZ8Z53o=","buildChannel":"release","creativeInstanceId":"e4cc49cb-e581-421d-99c8-30a6c2a41b85","payload":{},"platform":"windows","type":"view"}
[2020:2024:0615/184145.060:INFO:redeem_token.cc(134)]   Headers:
[2020:2024:0615/184145.060:INFO:redeem_token.cc(136)]     accept: application/json
[2020:2024:0615/184145.060:INFO:redeem_token.cc(140)]   Content_type: application/json

Verification passed on

Brave 1.10.90 Chromium: 83.0.4103.97 (Official Build) (64-bit)
Revision 326d148b9655369b86498d9ecca39f63dd2bdd2d-refs/branch-heads/4103@{#657}
OS Ubuntu 18.04 LTS
  • Verified Ads can be enabled for supported countries eg: US, PL
  • Verified Sorry! Ads is not supported message is shown for unsupported countries eg: Iran
  • Verified"buildChannel":"release" and "platform":"linux" is shown in logs for confirmations
[3110:3110:0615/160400.574869:INFO:redeem_token.cc(111)] CreateConfirmation
[3110:3110:0615/160400.574890:INFO:redeem_token.cc(113)] POST /v1/confirmation/{confirmation_id}/{credential}
[3110:3110:0615/160400.574898:INFO:redeem_token.cc(116)] URL Request:
[3110:3110:0615/160400.574906:INFO:redeem_token.cc(119)]   URL: https://ads-serve.brave.com/v1/confirmation/fe4c4a00-4427-411d-8169-35e8975afb31/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwib3J0b1pwMFI1N0ttdC9TSDZqekJZNTQzTWtmdjEvcHQrbXM5bnJpVkpoMD1cIixcImJ1aWxkQ2hhbm5lbFwiOlwicmVsZWFzZVwiLFwiY3JlYXRpdmVJbnN0YW5jZUlkXCI6XCI1ZDg0ZTAxZi00NjgwLTQzNGEtOWNiNS1jMGY1ZGE3Zjc5YmVcIixcInBheWxvYWRcIjp7fSxcInBsYXRmb3JtXCI6XCJsaW51eFwiLFwidHlwZVwiOlwidmlld1wifSIsInNpZ25hdHVyZSI6IkFLeHVIM0ZYU1p5WEh2Rmp4LzZqaUpkMkRURnI1b3ZWZ3E0MlprUVR3ZXllNVlhaFBVVmxLM0p4YUNjdk9iZUhWSXFtY3ZGSkxjYjZuRVM3VDdoQ0dnPT0iLCJ0IjoiNXJSejBuOUdSVkE0OFFMR09mZGU3OXBCaW1QN3BPVHlsV1RXTGhjb3RFVFhWRzJseEJGS0JMNG1uckRXdU9zZU1VU090YkVZSXZRaHVGL2R1cTEvRFE9PSJ9
[3110:3110:0615/160400.580850:INFO:redeem_token.cc(131)]   Body: {"blindedPaymentToken":"ortoZp0R57Kmt/SH6jzBY543Mkfv1/pt+ms9nriVJh0=","buildChannel":"release","creativeInstanceId":"5d84e01f-4680-434a-9cb5-c0f5da7f79be","payload":{},"platform":"linux","type":"view"}
[3110:3110:0615/160400.580904:INFO:redeem_token.cc(134)]   Headers:
[3110:3110:0615/160400.580926:INFO:redeem_token.cc(136)]     accept: application/json
[3110:3110:0615/160400.580940:INFO:redeem_token.cc(140)]   Content_type: application/json

image

@kjozwiak
Copy link
Member

@jsecretan @tmancey assuming CountryCode missing from 1.10.x and being included in 1.11.x is fine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
4 participants