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

"Estimated pending rewards" temporarily reset to zero while the payments server endpoint returns non HTTP_OK status response codes #15460

Closed
tmancey opened this issue Apr 23, 2021 · 1 comment · Fixed by brave/brave-core#8630
Assignees
Labels

Comments

@tmancey
Copy link
Contributor

tmancey commented Apr 23, 2021

Description

"Estimated pending rewards" temporarily reset to zero while the payments server endpoint returns non HTTP_OK status response codes

Steps to Reproduce

  1. Join Rewards
  2. View some ads
  3. Redeem unblinded payment tokens (by fast-forwarding the system clock)
  4. Quit the browser
  5. Rewrite status response code for GET /v1/confirmation/payment/{payment_id} to return a non 200 OK response.
  6. Launch the browser
  7. Visit brave://rewards (also check NTP Rewards widget)

Actual result:

"Estimated rewards pending" at brave://rewards and the NTP Rewards widget are reset to zero. "Estimated rewards pending" will correct itself after the server responds with a 200 OK.

Expected result:

"Estimated rewards pending" should use the cached value from ads_service/confirmations.json.

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Version/Channel Information:

  • Can you reproduce this issue with the current release? Yes
  • Can you reproduce this issue with the beta channel? Yes
  • Can you reproduce this issue with the nightly channel? Yes

Other Additional Information:

  • Does the issue resolve itself when disabling Brave Shields? N/A
  • Does the issue resolve itself when disabling Brave Rewards? N/A
  • Is the issue reproducible on the latest version of Chrome? N/A

Miscellaneous Information:

@tmancey tmancey added priority/P1 A very extremely bad problem. We might push a hotfix for it. QA/Yes release-notes/include feature/ads OS/Android Fixes related to Android browser functionality OS/Desktop labels Apr 23, 2021
@tmancey tmancey self-assigned this Apr 23, 2021
@tmancey tmancey changed the title Cashed-in ad rewards temporarily reset to zero while the payments server endpoint returns non HTTP_OK status response codes "Estimated pending rewards" temporarily reset to zero while the payments server endpoint returns non HTTP_OK status response codes Apr 23, 2021
@brave brave deleted a comment Apr 23, 2021
@brave brave deleted a comment Apr 23, 2021
@brave brave deleted a comment Apr 23, 2021
@tmancey tmancey added this to the 1.25.x - Nightly milestone Apr 26, 2021
@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Apr 28, 2021

Verification passed on


Brave | 1.23.75 Chromium: 90.0.4430.93 (Official Build) (64-bit)
-- | --
Revision | 4df112c29cfe9a2c69b14195c0275faed4e997a7-refs/branch-heads/4430@{#1348}
OS | Windows 10 OS Version 2004 (Build 19041.928)


Test case 1
  • Verified Estimated rewards pending & Ads received this month were correctly updated in Ads panel after viewing an AD
    image

  • Ensured Estimated rewards pending & Ads received this month is shown correctly after redeeming token

[7612:18264:0428/200930.416:VERBOSE1:redeem_unblinded_payment_tokens.cc(108)] OnRedeemUnblindedPaymentTokens
[7612:18264:0428/200930.416:VERBOSE6:redeem_unblinded_payment_tokens.cc(110)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/b5e72c59-8778-462d-aa55-6b515ba42ebf
  Response Status Code: 200
  Response: {"status":"ok"}
[7612:18264:0428/200930.421:VERBOSE1:account.cc(182)] Successfully redeemed unblinded payment tokens
[7612:18264:0428/200930.430:VERBOSE1:ad_rewards.cc(246)] Reconcile ad rewards
[7612:18264:0428/200930.431:VERBOSE1:ad_rewards.cc(254)] GetPayments
[7612:18264:0428/200930.432:VERBOSE2:ad_rewards.cc(255)] GET /v1/confirmation/payment/{payment_id}
[7612:18264:0428/200930.433:VERBOSE5:ad_rewards.cc(259)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/b5e72c59-8778-462d-aa55-6b515ba42ebf
  Method: BraveAdsUrlRequestMethod::GET
[7612:18264:0428/200930.434:VERBOSE1:redeem_unblinded_payment_tokens.cc(72)] Redeem unblinded payment tokens in 8 hours, 27 minutes, 34 seconds at 4:37 AM
[7612:18264:0428/200930.781:VERBOSE1:ad_rewards.cc(268)] OnGetPayments
[7612:18264:0428/200930.781:VERBOSE6:ad_rewards.cc(270)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/b5e72c59-8778-462d-aa55-6b515ba42ebf
  Response Status Code: 200
  Response: [{"month":"2021-04","transactionCount":"1","balance":"0.025"}]
  • Enforce Response status to 500 by rewriting rule in Charles proxy
  • Ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
[11832:13260:0428/202400.814:VERBOSE1:ad_rewards.cc(246)] Reconcile ad rewards
[11832:13260:0428/202400.814:VERBOSE1:ad_rewards.cc(254)] GetPayments
[11832:13260:0428/202400.814:VERBOSE2:ad_rewards.cc(255)] GET /v1/confirmation/payment/{payment_id}
[11832:13260:0428/202400.814:VERBOSE5:ad_rewards.cc(259)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/b5e72c59-8778-462d-aa55-6b515ba42ebf
  Method: BraveAdsUrlRequestMethod::GET
[11832:13260:0428/202401.154:VERBOSE1:ad_rewards.cc(268)] OnGetPayments
[11832:13260:0428/202401.154:VERBOSE6:ad_rewards.cc(270)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/b5e72c59-8778-462d-aa55-6b515ba42ebf
  Response Status Code: 500
  Response: [{"month":"2021-04","transactionCount":"1","balance":"0.025"}]
[11832:13260:0428/202401.169:VERBOSE1:ad_rewards.cc(274)] Failed to get payment balance
[11832:13260:0428/202401.169:VERBOSE1:ad_rewards.cc(353)] Failed to reconcile ad rewards
  • once Failed to get payment balance occurred, closed Brave and disabled the Write rule for Charles and launched Brave
  • after launching Brave, ensured that Successfully reconciled ad rewards
  • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
[15152:15684:0428/202844.695:VERBOSE1:ad_rewards.cc(268)] OnGetPayments
[15152:15684:0428/202844.695:VERBOSE6:ad_rewards.cc(270)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/b5e72c59-8778-462d-aa55-6b515ba42ebf
  Response Status Code: 200
  Response: [{"month":"2021-04","transactionCount":"1","balance":"0.025"}]
[15152:15684:0428/202845.802:VERBOSE1:ad_rewards.cc(338)] Successfully reconciled ad rewards
Test case 2
  • Verified Estimated rewards pending & Ads received this month were correctly updated in Ads panel after viewing an AD
    image

  • Ensured Estimated rewards pending & Ads received this month is shown correctly after redeeming a token

[8876:1688:0428/204131.149:VERBOSE1:redeem_unblinded_payment_tokens.cc(108)] OnRedeemUnblindedPaymentTokens
[8876:1688:0428/204131.149:VERBOSE6:redeem_unblinded_payment_tokens.cc(110)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/b39319ce-a943-437a-8aff-a20dc716cd88
  Response Status Code: 200
  Response: {"status":"ok"}
[8876:1688:0428/204131.151:VERBOSE1:account.cc(182)] Successfully redeemed unblinded payment tokens
[8876:1688:0428/204131.152:VERBOSE1:ad_rewards.cc(246)] Reconcile ad rewards
[8876:1688:0428/204131.160:VERBOSE1:ad_rewards.cc(254)] GetPayments
[8876:1688:0428/204131.163:VERBOSE2:ad_rewards.cc(255)] GET /v1/confirmation/payment/{payment_id}
[8876:1688:0428/204131.175:VERBOSE5:ad_rewards.cc(259)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/b39319ce-a943-437a-8aff-a20dc716cd88
  Method: BraveAdsUrlRequestMethod::GET
[8876:1688:0428/204131.177:VERBOSE1:redeem_unblinded_payment_tokens.cc(72)] Redeem unblinded payment tokens in 2 hours, 31 minutes, 27 seconds at 11:12 PM
[8876:1688:0428/204131.525:VERBOSE1:ad_rewards.cc(268)] OnGetPayments
[8876:1688:0428/204131.526:VERBOSE6:ad_rewards.cc(270)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/b39319ce-a943-437a-8aff-a20dc716cd88
  Response Status Code: 200
  Response: [{"month":"2021-04","transactionCount":"1","balance":"0.025"}]
  • Enforce Response status to 500 by rewriting rule in Charles proxy
  • Ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
[18320:2276:0428/211510.082:VERBOSE1:ad_rewards.cc(295)] GetAdGrants
[18320:2276:0428/211510.086:VERBOSE2:ad_rewards.cc(296)] GET /v1/promotions/ads/grants/summary?paymentId={payment_id}
[18320:2276:0428/211510.087:VERBOSE5:ad_rewards.cc(300)] URL Request:
  URL: https://grant.rewards.bravesoftware.com/v1/promotions/ads/grants/summary?paymentId=b39319ce-a943-437a-8aff-a20dc716cd88
  Method: BraveAdsUrlRequestMethod::GET
[18320:2276:0428/211510.394:VERBOSE1:ad_rewards.cc(309)] OnGetAdGrants
[18320:2276:0428/211510.395:VERBOSE6:ad_rewards.cc(311)] URL Response:
  URL: https://grant.rewards.bravesoftware.com/v1/promotions/ads/grants/summary?paymentId=b39319ce-a943-437a-8aff-a20dc716cd88
  Response Status Code: 500
  Response:
[18320:2276:0428/211510.398:VERBOSE1:ad_rewards.cc(321)] Failed to get ad grants
[18320:2276:0428/211510.402:VERBOSE1:ad_rewards.cc(353)] Failed to reconcile ad rewards
  • once Failed to get payment balance occurred, closed Brave and disabled the Write rule for Charles and launched Brave
  • after launching Brave, ensured that Successfully reconciled ad rewards
  • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
[15612:11684:0428/211808.170:VERBOSE1:ad_rewards.cc(309)] OnGetAdGrants
[15612:11684:0428/211808.171:VERBOSE6:ad_rewards.cc(311)] URL Response:
  URL: https://grant.rewards.bravesoftware.com/v1/promotions/ads/grants/summary?paymentId=b39319ce-a943-437a-8aff-a20dc716cd88
  Response Status Code: 204
  Response:
[15612:11684:0428/211808.173:VERBOSE1:ad_rewards.cc(338)] Successfully reconciled ad rewards

Verification in progress with

Brave	1.23.75 Chromium: 90.0.4430.93 (Official Build) (x86_64)
Revision	4df112c29cfe9a2c69b14195c0275faed4e997a7-refs/branch-heads/4430@{#1348}
OS	macOS Version 10.15.7 (Build 19H524)
Test Case 1, 3
  • launched 1.23.75 on staging and viewed an ad
  • once viewed, ensured that Estimated rewards pending & Ads received this month were correctly updated
  • closed Brave and moved the date/time on the machine forward ~1 day
  • re-launched Brave and ensured that the above token was redeemed
  • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
[60253:775:0501/111747.763517:VERBOSE1:redeem_unblinded_payment_tokens.cc(80)] RedeemUnblindedPaymentTokens
[60253:775:0501/111747.763626:VERBOSE2:redeem_unblinded_payment_tokens.cc(89)] PUT /v1/confirmation/payment/{payment_id}
[60253:775:0501/111747.763680:VERBOSE5:redeem_unblinded_payment_tokens.cc(99)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/39c16217-1ed3-4da6-9d02-e041eaeb6341
  Content: {"payload":"{\"paymentId\":\"39c16217-1ed3-4da6-9d02-e041eaeb6341\"}","paymentCredentials":[{"credential":{"signature":"ROK85kcljNOOTpFYaJfVywpxUVeYlTEG/MjSgGRg/RbgCWFPRvkBnBeILO8aOrdL4hEvHZIESFCl0OwdYQBLWA==","t":"y3GUvYly+By+Zyl8qWszj/lrIEiRhGFx8kHoMMloAqaG2/EiuuJaX209s+N4a2velISaqR/Z2tOglXCLRQNwPQ=="},"publicKey":"CrQLMWmUuYog6Q93nScS8Lo1HHSex8WM2Qxij7qhjkQ="},{"credential":{"signature":"yBTONlnRj+M1rDXZoWFzwlN4NSdI69BpLf9PviEi9BUVvhLddR42yfsvBFttK9dNSgZXrs6EE2CmqIYblxhc0A==","t":"CNASWn8LA6Lo0xbGgUUFqNxmYnNamvB9abxWBjud43zmMyQudLBQ01hzNuoWfMN6FtvEpui4q2oBdG41P7kTLw=="},"publicKey":"lLO5tErGoTK0askrALab6pKGAnBHqELSyw/evqZRwH8="}]}
  Content Type: application/json
  Method: BraveAdsUrlRequestMethod::PUT
[60253:775:0501/111748.370883:VERBOSE1:redeem_unblinded_payment_tokens.cc(108)] OnRedeemUnblindedPaymentTokens
[60253:775:0501/111748.371026:VERBOSE6:redeem_unblinded_payment_tokens.cc(110)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/39c16217-1ed3-4da6-9d02-e041eaeb6341
  Response Status Code: 200
  Response: {"status":"ok"}
[60253:775:0501/111748.371164:VERBOSE1:account.cc(182)] Successfully redeemed unblinded payment tokens
  • Once the token was redeemed, closed Brave
  • added a Write rule via Charles for GET /v1/confirmation/payment/{payment_id}
  • once the Write was enabled via Charles, launched Brave
  • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
[60411:775:0501/112414.911219:VERBOSE1:ad_rewards.cc(246)] Reconcile ad rewards
[60411:775:0501/112414.911259:VERBOSE1:ad_rewards.cc(254)] GetPayments
[60411:775:0501/112414.911295:VERBOSE2:ad_rewards.cc(255)] GET /v1/confirmation/payment/{payment_id}
[60411:775:0501/112414.912718:VERBOSE5:ad_rewards.cc(259)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/39c16217-1ed3-4da6-9d02-e041eaeb6341
  Method: BraveAdsUrlRequestMethod::GET
[60411:775:0501/112415.029688:VERBOSE1:ad_rewards.cc(268)] OnGetPayments
[60411:775:0501/112415.029795:VERBOSE6:ad_rewards.cc(270)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/39c16217-1ed3-4da6-9d02-e041eaeb6341
  Response Status Code: 500
  Response: [{"month":"2021-04","transactionCount":"1","balance":"0.025"}]
[60411:775:0501/112415.029881:VERBOSE1:ad_rewards.cc(274)] Failed to get payment balance
[60411:775:0501/112415.029930:VERBOSE1:ad_rewards.cc(353)] Failed to reconcile ad rewards
  • once Failed to get payment balance occurred, closed Brave and disabled the Write rule for Charles and launched Brave
  • after launching Brave, ensured that Successfully reconciled ad rewards
  • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
[60496:775:0501/142718.100136:VERBOSE1:ad_rewards.cc(268)] OnGetPayments
[60496:775:0501/142718.100228:VERBOSE6:ad_rewards.cc(270)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/39c16217-1ed3-4da6-9d02-e041eaeb6341
  Response Status Code: 200
  Response: [{"month":"2021-04","transactionCount":"1","balance":"0.025"}]
Test Case 2, 3
  • launched 1.23.75 on staging and viewed an ad
  • once viewed, ensured that Estimated rewards pending & Ads received this month were correctly updated
  • closed Brave and moved the date/time on the machine forward ~1 day
  • re-launched Brave and ensured that the above token was redeemed
  • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
[61372:775:0429/134735.429916:VERBOSE1:redeem_unblinded_payment_tokens.cc(80)] RedeemUnblindedPaymentTokens
[61372:775:0429/134735.430113:VERBOSE2:redeem_unblinded_payment_tokens.cc(89)] PUT /v1/confirmation/payment/{payment_id}
[61372:775:0429/134735.430218:VERBOSE5:redeem_unblinded_payment_tokens.cc(99)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/1c816f8e-67c9-4528-af4a-fd744edfb37c
  Content: {"payload":"{\"paymentId\":\"1c816f8e-67c9-4528-af4a-fd744edfb37c\"}","paymentCredentials":[{"credential":{"signature":"+VKrHiXDVqRmx2iBmvmMrBi/DOmt9m2C+3JpsRXWFcgp3nmAPqKrArk3zAbVIg3U0ZGOaHmsDVj15JoVX7JCTA==","t":"apvFP2gbDaFc4jUN58MTug3lxBUfCT9Lauc0M0V0cqH94CI181NQBjzLvG3I0oe0k1lIBWVUjzJ/cdfJZMwQFQ=="},"publicKey":"CrQLMWmUuYog6Q93nScS8Lo1HHSex8WM2Qxij7qhjkQ="},{"credential":{"signature":"bhoY0o6jJ4XTaeYKqVApNgze0zNBtDxdqlJRDLntG0r89ZCvTYsYk6qNM4+1Ocd5c6ZQ0QcvGRiZ3dWFldaFYw==","t":"8TL3OVb5tKDAWNZMwfn30k432yRKVom43YHHWvQymfKbLG7+iFubuUIJOAJ2eqoxaSn4TTSr62o7HLHGC8GUgA=="},"publicKey":"lLO5tErGoTK0askrALab6pKGAnBHqELSyw/evqZRwH8="}]}
  Content Type: application/json
  Method: BraveAdsUrlRequestMethod::PUT
[61372:775:0429/134735.866009:VERBOSE1:redeem_unblinded_payment_tokens.cc(108)] OnRedeemUnblindedPaymentTokens
[61372:775:0429/134735.866127:VERBOSE6:redeem_unblinded_payment_tokens.cc(110)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/1c816f8e-67c9-4528-af4a-fd744edfb37c
  Response Status Code: 200
  Response: {"status":"ok"}
[61372:775:0429/134735.866246:VERBOSE1:account.cc(182)] Successfully redeemed unblinded payment tokens
  • Once the token was redeemed, closed Brave
  • added a Write rule via Charles for /v1/promotions/ads/grants/summary?paymentId={payment_id}
  • once the Write was enabled via Charles, launched Brave
  • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
[61661:775:0429/135943.385433:VERBOSE1:ad_rewards.cc(295)] GetAdGrants
[61661:775:0429/135943.385494:VERBOSE2:ad_rewards.cc(296)] GET /v1/promotions/ads/grants/summary?paymentId={payment_id}
[61661:775:0429/135943.385537:VERBOSE5:ad_rewards.cc(300)] URL Request:
  URL: https://grant.rewards.bravesoftware.com/v1/promotions/ads/grants/summary?paymentId=1c816f8e-67c9-4528-af4a-fd744edfb37c
  Method: BraveAdsUrlRequestMethod::GET
[61661:775:0429/135943.427143:VERBOSE1:browser_manager.cc(48)] Browser window is active
[61661:775:0429/135943.427387:VERBOSE6:user_activity.cc(41)] Triggered event: 16 (0.5:2:3600 s)
[61661:775:0429/135943.849739:VERBOSE1:ad_rewards.cc(309)] OnGetAdGrants
[61661:775:0429/135943.849840:VERBOSE6:ad_rewards.cc(311)] URL Response:
  URL: https://grant.rewards.bravesoftware.com/v1/promotions/ads/grants/summary?paymentId=1c816f8e-67c9-4528-af4a-fd744edfb37c
  Response Status Code: 500
  Response: 
[61661:775:0429/135943.849935:VERBOSE1:ad_rewards.cc(321)] Failed to get ad grants
[61661:775:0429/135943.849986:VERBOSE1:ad_rewards.cc(353)] Failed to reconcile ad rewards
  • once Failed to get payment balance occurred, closed Brave and disabled the Write rule for Charles and launched Brave
  • after launching Brave, ensured that Successfully reconciled ad rewards
  • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
[61729:775:0429/140301.691979:VERBOSE1:ad_rewards.cc(309)] OnGetAdGrants
[61729:775:0429/140301.692079:VERBOSE6:ad_rewards.cc(311)] URL Response:
  URL: https://grant.rewards.bravesoftware.com/v1/promotions/ads/grants/summary?paymentId=1c816f8e-67c9-4528-af4a-fd744edfb37c
  Response Status Code: 204
  Response: 
[61729:775:0429/140301.692493:VERBOSE1:ad_rewards.cc(338)] Successfully reconciled ad rewards

Verification passed on

Brave 1.23.75 Chromium: 90.0.4430.93 (Official Build) (64-bit)
Revision 4df112c29cfe9a2c69b14195c0275faed4e997a7-refs/branch-heads/4430@{#1348}
OS Ubuntu 18.04 LTS

Verified test plan from brave/brave-core#8630

Test Case 1 (Payment balance endpoint failure):

Verified Failed to reconcile ad rewards appeared in the log:

[10061:10061:0428/181337.752430:VERBOSE1:ad_rewards.cc(268)] OnGetPayments
[10061:10061:0428/181337.752629:VERBOSE6:ad_rewards.cc(270)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/payment/6f681cb7-9879-4058-bbb6-0ffc6719f878
  Response Status Code: 404
  Response: [{"balance":"0","month":"2021-04","transactionCount":"0"}]
[10061:10061:0428/181337.752899:VERBOSE1:ad_rewards.cc(274)] Failed to get payment balance
[10061:10061:0428/181337.752991:VERBOSE1:ad_rewards.cc(353)] Failed to reconcile ad rewards

Verified "Estimated pending rewards" / "Next payment date" is not changed
image

Test Case 2 (Ad grant balance endpoint failure):

``` [15647:15647:0428/194652.553206:VERBOSE1:ad_rewards.cc(309)] OnGetAdGrants [15647:15647:0428/194652.553280:VERBOSE6:ad_rewards.cc(311)] URL Response: URL: https://grant.rewards.bravesoftware.com/v1/promotions/ads/grants/summary?paymentId=09622bc9-8091-43dc-bbd2-51e58009c363 Response Status Code: 404 Response: [15647:15647:0428/194652.553341:VERBOSE1:ad_rewards.cc(321)] Failed to get ad grants [15647:15647:0428/194652.553395:VERBOSE1:ad_rewards.cc(353)] Failed to reconcile ad rewards ``` Verified "Estimated pending rewards" / "Next payment date" is not changed ![image](https://user-images.githubusercontent.com/34715963/116442353-b147f600-a852-11eb-9703-90ef491c8c90.png)

Test Case 3

Verified `Successfully reconciled ad rewards` appeared
[3758:3758:0428/212740.359872:VERBOSE1:ad_rewards.cc(338)] Successfully reconciled ad rewards

image


Verification PASSED on Samsung S10+ running Android 11 using the following build:

1.23.76 Chromium: 90.0.4430.93

Test Case 1, 2 & 3

GET /v1/confirmation/payment/{payment_id} & GET /v1/promotions/ads/grants/summary?paymentId={payment_id}
  • launched 1.23.76 Chromium: 90.0.4430.93 on production and claimed an ad
  • once claimed, ensured that Estimated rewards pending & Ads received this month were correctly updated
  • closed Brave and moved the date/time on the machine forward ~3 day
  • re-launched Brave and ensured that the token was redeemed
  • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
  • 2021-05-07 23:39:43.729 12117-12117/? V/chromium: [VERBOSE1:redeem_unblinded_payment_tokens.cc(80)] RedeemUnblindedPaymentTokens
    2021-05-07 23:39:43.729 12117-12117/? V/chromium: [VERBOSE2:redeem_unblinded_payment_tokens.cc(89)] PUT /v1/confirmation/payment/{payment_id}
    2021-05-07 23:39:43.729 12117-12117/? V/chromium: [VERBOSE5:redeem_unblinded_payment_tokens.cc(99)] URL Request:
          URL: https://ads-serve.brave.com/v1/confirmation/payment/17e60947-b3f0-4305-bf06-9993d8652ced
          Content: {"payload":"{\"paymentId\":\"17e60947-b3f0-4305-bf06-9993d8652ced\"}","paymentCredentials":[{"credential":{"signature":"k/7Gs/Fxb5lHiyqEDD3CGc7WnVv9UIAzfjP55eIS0tDlmt1okeM0lAdFMQh7aUU3W98YxRXzkKwJcdpzFfagSg==","t":"QsYQTOP2g92+mvcFPBanQXWEuWYElS0uOdXmsPPepdS62ZJrBThGPZoasWXhj7W/AxY5/URxo+bQQ+KAsZzs0A=="},"publicKey":"QNtxqL+tAbSoISEAr0oSWwzUliccLDv2KoZWXeXeHiU="},{"credential":{"signature":"sNEkXGc8ylK+64RReMHjj/U9QxRevqPxjMDsTluIINSQFZ0CzHCI2AbcAH1yp5Wjzw5p8tgHe3OQ3+FUYY+vTg==","t":"ppHJLbaA1CDN6pA6S8tEQRm05r3G67S6hf7mt41gHpGrBYLSwoFA3m2UVLZrHFFJjjI6UpbRzespOF60tmQrhA=="},"publicKey":"uor3AzFj4OmdCxwetsYD1TxPXZSw40t3j/VOCUyC7Rs="},{"credential":{"signature":"7V12s8VCGYZo3ndDfIUpEMPM/uXGuii5ztXlujlEQTdSomtCSYy4x41H7OcbiSDMRDDbFTiddxzXCMwtFRbLNA==","t":"3/YehNcnr4mJniUmhH8HD+BXkJcLvAEJHD+DFP6vW9oyPe6kTmhrF0/GcH+UqBotLlVZM8MU9cjYqFDspd3kKg=="},"publicKey":"uor3AzFj4OmdCxwetsYD1TxPXZSw40t3j/VOCUyC7Rs="},{"credential":{"signature":"qkkydoS5y0RJrvQA06uxEHONf08swWTCUxCGUU6XfhCr1DDZPupIj1Js4/oEUJhsYaYipOh9kV0EQhxErNQpnA==","t":"BPpZ8fnTEmphooCBfWk1GigMedcrhY2nvMJBHHlFsYsjLRm4jY3whOnVYZKBWfS+ZspKlrRc9McAYvP0S2VbxA=="},"publicKey":"QNtxqL+tAbSoISEAr0oSWwzUliccLDv2KoZWXeXeHiU="}]}
          Content Type: application/json
          Method: BraveAdsUrlRequestMethod::PUT
    2021-05-07 23:39:43.904 12117-12117/? V/chromium: [VERBOSE1:redeem_unblinded_payment_tokens.cc(108)] OnRedeemUnblindedPaymentTokens
    2021-05-07 23:39:43.904 12117-12117/? V/chromium: [VERBOSE6:redeem_unblinded_payment_tokens.cc(110)] URL Response:
          URL: https://ads-serve.brave.com/v1/confirmation/payment/17e60947-b3f0-4305-bf06-9993d8652ced
          Response Status Code: 200
          Response: {"status":"ok"}
    2021-05-07 23:39:43.904 12117-12117/? V/chromium: [VERBOSE1:account.cc(182)] Successfully redeemed unblinded payment tokens
    
    • Once the token was redeemed, closed Brave
    • added a Write rule via Charles for GET /v1/confirmation/payment/{payment_id} & /v1/promotions/ads/grants/summary?paymentId={payment_id}
    • once the Write was enabled via Charles, launched Brave
    • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
    2021-05-08 00:01:49.386 24935-24935/? V/chromium: [VERBOSE1:ad_rewards.cc(268)] OnGetPayments
    2021-05-08 00:01:49.386 24935-24935/? V/chromium: [VERBOSE6:ad_rewards.cc(270)] URL Response:
          URL: https://ads-serve.brave.com/v1/confirmation/payment/17e60947-b3f0-4305-bf06-9993d8652ced
          Response Status Code: -1
          Response: 
    2021-05-08 00:01:49.386 24935-24935/? V/chromium: [VERBOSE1:ad_rewards.cc(274)] Failed to get payment balance
    2021-05-08 00:01:49.386 24935-24935/? V/chromium: [VERBOSE1:ad_rewards.cc(353)] Failed to reconcile ad rewards
    
    • once Failed to get payment balance occurred, closed Brave and disabled the Write rule for Charles and launched Brave
    • after launching Brave, ensured that Successfully reconciled ad rewards
    • ensured that Estimated rewards pending & Ads received this month was still correctly being displayed
    2021-05-08 00:02:37.713 25300-25300/? V/chromium: [VERBOSE1:ad_rewards.cc(246)] Reconcile ad rewards
    2021-05-08 00:02:37.713 25300-25300/? V/chromium: [VERBOSE1:ad_rewards.cc(254)] GetPayments
    2021-05-08 00:02:37.714 25300-25300/? V/chromium: [VERBOSE2:ad_rewards.cc(255)] GET /v1/confirmation/payment/{payment_id}
    2021-05-08 00:02:37.718 25300-25300/? V/chromium: [VERBOSE5:ad_rewards.cc(259)] URL Request:
          URL: https://ads-serve.brave.com/v1/confirmation/payment/17e60947-b3f0-4305-bf06-9993d8652ced
          Method: BraveAdsUrlRequestMethod::GET
    2021-05-08 00:02:37.949 25300-25300/? V/chromium: [VERBOSE1:ad_rewards.cc(268)] OnGetPayments
    2021-05-08 00:02:37.949 25300-25300/? V/chromium: [VERBOSE6:ad_rewards.cc(270)] URL Response:
          URL: https://ads-serve.brave.com/v1/confirmation/payment/17e60947-b3f0-4305-bf06-9993d8652ced
          Response Status Code: 200
          Response: [{"month":"2021-04","transactionCount":"2","balance":"0.01"}]
    2021-05-08 00:02:38.175 25300-25300/? V/chromium: [VERBOSE1:ad_rewards.cc(338)] Successfully reconciled ad rewards
    

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