Brave-browser: Change Brave Ads grants server end-point

Created on 22 Mar 2020  Â·  4Comments  Â·  Source: brave/brave-browser

Description

Change Brave Ads grants server end-point in AdsRewards::GetAdGrants() from GET /v2/wallet/{payment_id}/grants/ads to GET /v1/promotions/ads/grants/summary?paymentId={payment_id}

Test plan

See https://github.com/brave/brave-core/pull/5232

QA Pass-Linux QA Pass-Win64 QA Pass-macOS QTest-Plan-Specified QYes enhancement featurads good first issue prioritP3 release-noteexclude

Most helpful comment

Hello, I am interested in working on this issue. Not sure how I can assign it to myself

All 4 comments

Hello, I am interested in working on this issue. Not sure how I can assign it to myself

It is taking me longer than I assumed to set up the Brave Repo and get everything running. Currently I am stuck with 'npm run init' command giving me an error. I am getting the following error stack trace, seems like it is failing to apply some patches. I am running it on Mac OS and I have followed all the build guidelines. My npm version is 6.13.4 and my node version is 12.6.1.

Done running gclient sync.
Applying patches…

Getting patch data…events.js:288
throw er; // Unhandled ‘error’ event
^

Error: spawn git EAGAIN
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted ‘error’ event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: ‘EAGAIN’,
code: ‘EAGAIN’,
syscall: ‘spawn git’,
path: ‘git’,
spawnargs: [
‘apply’,
‘/Users/danishjalil/brave-browser/src/brave/patches/net-url_request-url_request_http_job.cc.patch’,
‘–numstat’,
‘-z’,
‘–ignore-space-change’,
‘–ignore-whitespace’
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] init: node ./scripts/sync.js --init
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] init script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@danishjalil2991 Apologies for the late reply, if you let me know your timezone and maybe we could have a screen share so I can help you get setup?

Verification passed on

Brave | 1.9.49 Chromium: 81.0.4044.129 (Official Build) dev (64-bit)
-- | --
Revision | 3d71af9f5704a40b85806f4d08925db24605ba25-refs/branch-heads/4044@{#979}
OS | Windows 10 OS Version 1803 (Build 17134.1006)

[2340:12688:0430/174544.873:INFO:ads_rewards.cc(162)] GetAdGrants
[2340:12688:0430/174544.873:INFO:ads_rewards.cc(164)] GET /v1/promotions/ads/grants/summary?paymentId={payment_id}
[2340:12688:0430/174544.873:INFO:ads_rewards.cc(167)] URL Request:
[2340:12688:0430/174544.873:INFO:ads_rewards.cc(170)]   URL: https://grant.rewards.brave.com/v1/promotions/ads/grants/summary?paymentId=ac198db6-d5f4-4fcf-a729-f285c36307e7
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(184)] OnGetAdGrants
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(186)] URL Request Response:
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(187)]   URL: https://grant.rewards.brave.com/v1/promotions/ads/grants/summary?paymentId=ac198db6-d5f4-4fcf-a729-f285c36307e7
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(188)]   Response Status Code: 204
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(189)]   Response: 
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(190)]   Headers:
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     accept-ranges: bytes
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     content-type: application/json
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     date: Thu, 30 Apr 2020 12:15:46 GMT
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     request-id: bqlc2sgkiei1rkdcg910
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     status: 204
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     via: 1.1 varnish
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     x-cache: MISS
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     x-cache-hits: 0
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     x-ratelimit-limit: 1
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     x-ratelimit-remaining: 0
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     x-ratelimit-reset: 1
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     x-request-id: E2EuaKbuHrKZuciJ
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(192)]     x-served-by: cache-sea4434-SEA
[2340:12688:0430/174545.151:INFO:ads_rewards.cc(231)] Successfully retrieved ads rewards

image


Verified passed with

Brave | 1.9.55 Chromium: 81.0.4044.129 (Official Build) dev (64-bit)
-- | --
Revision | 3d71af9f5704a40b85806f4d08925db24605ba25-refs/branch-heads/4044@{#979}
OS | macOS Version 10.14.6 (Build 18G3020)

Reproduced on 1.8.90 using staging:

[16864:775:0505/162737.501993:INFO:ads_rewards.cc(161)] GetAdGrants
[16864:775:0505/162737.502016:INFO:ads_rewards.cc(163)] GET /v2/wallet/{payment_id}/grants/ads
[16864:775:0505/162737.502030:INFO:ads_rewards.cc(166)] URL Request:
[16864:775:0505/162737.502045:INFO:ads_rewards.cc(169)]   URL: https://ledger-staging.mercury.basicattentiontoken.org/v2/wallet/c1bdf548-ffaf-48eb-9697-6a3ac88b5bed/grants/ads

Confirmed change on 1.9.x upgrade profile on staging:

[16919:775:0505/171228.888966:INFO:ads_rewards.cc(161)] GetAdGrants
[16919:775:0505/171228.888983:INFO:ads_rewards.cc(163)] GET /v1/promotions/ads/grants/summary?paymentId={payment_id}
[16919:775:0505/171228.888994:INFO:ads_rewards.cc(166)] URL Request:
[16919:775:0505/171228.889005:INFO:ads_rewards.cc(169)]   URL: https://grant.rewards.bravesoftware.com/v1/promotions/ads/grants/summary?paymentId=c1bdf548-ffaf-48eb-9697-6a3ac88b5bed

Upgrade profile:

  • Confirmed data in Ads panel from 1.8.x was displayed as expected in 1.9.x
  • Confirmed able to view an Ad on 1.9.x and ad panel data updated as expected
  • Confirmed able to redeem tokens

Clean profile:

  • Confirmed able to view an Ad on 1.9.x and ad panel data updated as expected
[17031:775:0505/164802.397851:INFO:ads_rewards.cc(161)] GetAdGrants
[17031:775:0505/164802.397875:INFO:ads_rewards.cc(163)] GET /v1/promotions/ads/grants/summary?paymentId={payment_id}
[17031:775:0505/164802.397889:INFO:ads_rewards.cc(166)] URL Request:
[17031:775:0505/164802.397904:INFO:ads_rewards.cc(169)]   URL: https://grant.rewards.bravesoftware.com/v1/promotions/ads/grants/summary?paymentId=7dc09dee-c393-4def-aac0-6e9aeff45a13

Screen Shot 2020-05-05 at 4 50 51 PM


Verification passed on

Brave | 1.9.55 Chromium: 81.0.4044.129 (Official Build) dev (64-bit)
-- | --
Revision | 3d71af9f5704a40b85806f4d08925db24605ba25-refs/branch-heads/4044@{#979}
OS | Ubuntu 18.04 LTS

[10369:10369:0506/014533.089026:INFO:ads_rewards.cc(183)] OnGetAdGrants
[10369:10369:0506/014533.089061:INFO:ads_rewards.cc(185)] URL Request Response:
[10369:10369:0506/014533.089073:INFO:ads_rewards.cc(186)]   URL: https://grant.rewards.bravesoftware.com/v1/promotions/ads/grants/summary?paymentId=f5f57f1e-f549-4450-bcb8-a5bd61282529
[10369:10369:0506/014533.089085:INFO:ads_rewards.cc(187)]   Response Status Code: 204
[10369:10369:0506/014533.089097:INFO:ads_rewards.cc(188)]   Response: 
[10369:10369:0506/014533.089108:INFO:ads_rewards.cc(189)]   Headers:
[10369:10369:0506/014533.089119:INFO:ads_rewards.cc(191)]     accept-ranges: bytes
[10369:10369:0506/014533.089130:INFO:ads_rewards.cc(191)]     content-type: application/json
[10369:10369:0506/014533.089141:INFO:ads_rewards.cc(191)]     date: Tue, 05 May 2020 23:45:33 GMT
[10369:10369:0506/014533.089153:INFO:ads_rewards.cc(191)]     request-id: bqovl7f4705s5gd8gc7g
[10369:10369:0506/014533.089164:INFO:ads_rewards.cc(191)]     status: 204
[10369:10369:0506/014533.089175:INFO:ads_rewards.cc(191)]     via: 1.1 varnish
[10369:10369:0506/014533.089186:INFO:ads_rewards.cc(191)]     x-cache: MISS
[10369:10369:0506/014533.089197:INFO:ads_rewards.cc(191)]     x-cache-hits: 0
[10369:10369:0506/014533.089208:INFO:ads_rewards.cc(191)]     x-ratelimit-limit: 1
[10369:10369:0506/014533.089218:INFO:ads_rewards.cc(191)]     x-ratelimit-remaining: 0
[10369:10369:0506/014533.089229:INFO:ads_rewards.cc(191)]     x-ratelimit-reset: 1
[10369:10369:0506/014533.089240:INFO:ads_rewards.cc(191)]     x-request-id: 4aHyKWyycX2z8CXM
[10369:10369:0506/014533.089250:INFO:ads_rewards.cc(191)]     x-served-by: cache-lga21931-LGA
[10369:10369:0506/014533.089262:INFO:ads_rewards.cc(230)] Successfully retrieved ads rewards

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kjozwiak picture kjozwiak  Â·  3Comments

jonathansampson picture jonathansampson  Â·  3Comments

AlexeyBarabash picture AlexeyBarabash  Â·  3Comments

GeetaSarvadnya picture GeetaSarvadnya  Â·  3Comments

kerry-perret picture kerry-perret  Â·  3Comments