brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.84k stars 2.33k forks source link

Duplicate/bad confirmations retry logic #9242

Closed tmancey closed 4 years ago

tmancey commented 4 years ago

Description

Duplicate/bad confirmations retry logic

Steps to Reproduce

  1. Duplicate failed confirmations in confirmations.json under confirmations/failed_confirmations

Actual result:

Duplicate confirmations are retried indefinitely

Expected result:

Duplicate confirmations should not be retried indefinitely

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Version/Channel Information:

Other Additional Information:

Miscellaneous Information:

GeetaSarvadnya commented 4 years ago

Verification passed on

Brave 1.7.98 Chromium: 81.0.4044.113 (Official Build) (64-bit)
Revision e3225dafb0475864a1812a374d73a92e391635ac-refs/branch-heads/4044@{#936}
OS Windows 10 OS Version 1803 (Build 17134.1006)

Test Case 1 (Create confirmation fails with 400 BAD REQUEST):

[13424:16932:0420/180259.801:INFO:redeem_token.cc(177)] OnCreateConfirmation
[13424:16932:0420/180259.801:INFO:redeem_token.cc(179)] URL Request Response:
[13424:16932:0420/180259.801:INFO:redeem_token.cc(180)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/2a97e788-07c0-40ad-b911-150a8e45fe30/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiSnNZNzRiRmxsaStBRWxueHVmdS9XYnd1OFV2RTdZN0p5VFRSUUFHYTlUTT1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiNDVkMzBkMWEtNDIzNy00M2ZmLWE2NmItNzZiYjE1Njc5YWFkXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoibXlqWE1URWUrU3Y4M2VmM0VUR3pIaktEcC94YWczZ3E4a0FIMDVjRzZBQlZlaGhiMmVIcTRXcTZEcE54eEFqM0lGNFlJSUZkRG8rMU9SSWhPT3FUb1E9PSIsInQiOiI1ZGsxKzZJbEswS2NQWnNJZTB6NHNYT2hvRyt6OXF0bWlzck1teXJNdHJJZzlmaXoxYUtpdTF5VUx0RTloa2IrWmNLcVIyWWdkMXYveUxMYlJ6TEFRUT09In0=
[13424:16932:0420/180259.801:INFO:redeem_token.cc(181)]   Response Status Code: 400
[13424:16932:0420/180259.801:INFO:redeem_token.cc(182)]   Response: {"id":"2a97e788-07c0-40ad-b911-150a8e45fe30","payload":{},"createdAt":"2020-04-20T12:33:20.265Z","type":"view","modifiedAt":"2020-04-20T12:33:20.265Z","creativeInstanceId":"45d30d1a-4237-43ff-a66b-76bb15679aad"}
[13424:16932:0420/180259.801:INFO:redeem_token.cc(183)]   Headers:
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     cache-control: no-cache
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     content-length: 211
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 12:33:20 GMT
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     expires: 0
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     status: 400
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     x-cache: MISS
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     x-powered-by: Express
[13424:16932:0420/180259.801:INFO:redeem_token.cc(185)]     x-served-by: cache-sea4446-SEA
[13424:16932:0420/180259.801:WARNING:redeem_token.cc(192)] Duplicate/bad confirmation
[13424:16932:0420/180259.801:INFO:redeem_token.cc(205)] FetchPaymentToken
[13424:16932:0420/180259.801:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken

Test Case 2 (Create confirmation fails with 500 INTERNAL SERVER ERROR):

[14800:13260:0420/181040.389:INFO:redeem_token.cc(181)]   Response Status Code: 500
[14800:13260:0420/181040.389:INFO:redeem_token.cc(182)]   Response: {"id":"078ba958-83b2-4a16-9a88-41ebd30d9789","payload":{},"createdAt":"2020-04-20T12:41:00.788Z","type":"view","modifiedAt":"2020-04-20T12:41:00.788Z","creativeInstanceId":"c1fce205-484e-4953-b546-650f5c963a42"}
[14800:13260:0420/181040.389:INFO:redeem_token.cc(183)]   Headers:
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     cache-control: no-cache
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     content-length: 211
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 12:41:01 GMT
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     expires: 0
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     status: 500
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     x-cache: MISS
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     x-powered-by: Express
[14800:13260:0420/181040.389:INFO:redeem_token.cc(185)]     x-served-by: cache-sea4460-SEA
[14800:13260:0420/181040.389:INFO:redeem_token.cc(205)] FetchPaymentToken
[14800:13260:0420/181040.390:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken

Test Case 3 (Create confirmation succeeds with 201 CREATED):

[14964:12396:0420/181516.393:INFO:redeem_token.cc(181)]   Response Status Code: 201
[14964:12396:0420/181516.393:INFO:redeem_token.cc(182)]   Response: {"id":"312f5fd3-3ca1-4508-8f7c-9f9db747476f","payload":{},"createdAt":"2020-04-20T12:45:36.840Z","type":"view","modifiedAt":"2020-04-20T12:45:36.840Z","creativeInstanceId":"bc6523ee-a790-487a-bb0e-7fda52b8af7e"}
[14964:12396:0420/181516.393:INFO:redeem_token.cc(183)]   Headers:
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     cache-control: no-cache
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     content-length: 211
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 12:45:37 GMT
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     expires: 0
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     status: 201
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     x-cache: MISS
[14964:12396:0420/181516.393:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[14964:12396:0420/181516.394:INFO:redeem_token.cc(185)]     x-powered-by: Express
[14964:12396:0420/181516.394:INFO:redeem_token.cc(185)]     x-served-by: cache-sea4441-SEA
[14964:12396:0420/181516.394:INFO:redeem_token.cc(205)] FetchPaymentToken
[14964:12396:0420/181516.394:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken

Test Case 4 (Fetch payment token fails with 404 NOT FOUND):

[1224:13072:0420/182513.308:INFO:redeem_token.cc(233)]   Response Status Code: 404
[1224:13072:0420/182513.308:INFO:redeem_token.cc(234)]   Response: {"id":"3c489894-c728-4d7f-a806-c449fa977e1e","createdAt":"2020-04-20T12:55:33.431Z","type":"view","modifiedAt":"2020-04-20T12:55:33.451Z","creativeInstanceId":"44e7eb81-595d-482d-a405-df4caa9a5584","paymentToken":{"publicKey":"bPE1QE65mkIgytffeu7STOfly+x10BXCGuk5pVlOHQU=","batchProof":"mD/G6jCq9OI2kNe6DeugIkyOsIGrERao/bn/XuYpjQTFGukvjEQFF+KTGrm0yXdMKFYMPq3yz0CqucWaSl1rCg==","signedTokens":["yhShXItTB5QgdpWrVvqn4+V0CLkl5LkeMcd23mJW93A="]}}
[1224:13072:0420/182513.308:INFO:redeem_token.cc(235)]   Headers:
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     accept-ranges: bytes
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     access-control-allow-origin: *
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     cache-control: no-cache
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     content-length: 442
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     content-type: application/json; charset=utf-8
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     date: Mon, 20 Apr 2020 12:55:33 GMT
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     expires: 0
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     status: 404
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     via: 1.1 varnish
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     x-cache: MISS
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     x-cache-hits: 0
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     x-powered-by: Express
[1224:13072:0420/182513.308:INFO:redeem_token.cc(237)]     x-served-by: cache-sea4449-SEA
[1224:13072:0420/182513.308:WARNING:redeem_token.cc(241)] Confirmation not found
[1224:13072:0420/182513.308:WARNING:redeem_token.cc(428)] Failed to redeem 3c489894-c728-4d7f-a806-c449fa977e1e confirmation id with 44e7eb81-595d-482d-a405-df4caa9a5584 creative instance id for view
[1224:13072:0420/182513.308:INFO:confirmations_impl.cc(743)] Saving confirmations state
[1224:13072:0420/182513.308:INFO:confirmations_impl.cc(743)] Saving confirmations state
[1224:13072:0420/182513.308:INFO:confirmations_impl.cc(905)] Added 0511523d-8ebe-40a4-927e-1739c05305f2 confirmation id with 44e7eb81-595d-482d-a405-df4caa9a5584 creative instance id for view to the confirmations queue

confirmations.json with failed confirmations

 "failed_confirmations": [
      {
        "blinded_payment_token": "ymW9emvuEf8oMKUcNDJ2rqIGy77yTyr9ypblOr1iECA=",
        "created": false,
        "creative_instance_id": "44e7eb81-595d-482d-a405-df4caa9a5584",
        "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwieW1XOWVtdnVFZjhvTUtVY05ESjJycUlHeTc3eVR5cjl5cGJsT3IxaUVDQT1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiNDRlN2ViODEtNTk1ZC00ODJkLWE0MDUtZGY0Y2FhOWE1NTg0XCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiMTZKbEhzeG1WTXptZ09OMzVFMHJGd1ZYck1ubUdGdGRPTGE1RlJrcjJJTE91eFlZU01wdnp2VDFSSVhMbDdTdXRnYXRXS2JDL3p2ZmdpbzFDd2I4cnc9PSIsInQiOiJzMVZtWm5pMThvOW9saWRQOWxFa0NvVnFGdTNMbFo1SnIwY3pvVWpiMUczOEtWbmFUZDQrMlBmV2R3QTRMVjJpazh4UFZMQU1tMUJZQUdtN3dJaE44UT09In0=",
        "id": "0511523d-8ebe-40a4-927e-1739c05305f2",
        "payment_token": "pOLt3oaZaDw64pU+mshrjqprgZjUGAoHq++zQRWXuRiYuJ+/HeGEkMXV7vYHvPi0RcYRp+JwWPmeQ3uYgQJm576qm+oW+/cV9+ZiG2Lk/cwX9UgKCZJkdG+WgjIo3xgG",
        "timestamp_in_seconds": "1587387313",
        "token_info": {
          "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
          "unblinded_token": "s1VmZni18o9olidP9lEkCoVqFu3LlZ5Jr0czoUjb1G38KVnaTd4+2PfWdwA4LV2ik8xPVLAMm1BYAGm7wIhN8cxdxPs099wNgrH3w/NZNf7FHVsQeYqFXmDt9jB0mqFl"
        },
        "type": "view"
      },
      {
        "blinded_payment_token": "miikHT5tLJ+AN6+zjnW3+F3svxd5Mtzfb9AZqNV0yH8=",
        "created": false,
        "creative_instance_id": "44e7eb81-595d-482d-a405-df4caa9a5584",
        "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwibWlpa0hUNXRMSitBTjYrempuVzMrRjNzdnhkNU10emZiOUFacU5WMHlIOD1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiNDRlN2ViODEtNTk1ZC00ODJkLWE0MDUtZGY0Y2FhOWE1NTg0XCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJjbGlja1wifSIsInNpZ25hdHVyZSI6IlE2dW1TVHNCeUdLeU5kbG8rb0lzYWF6UTB3UjFSM0dsUENXUnZFVWUwN25YdDVCcFpKSzVhaTNPRDZQT21iSjNtcm55OTVZRTNERldGVHlTckJFdkFnPT0iLCJ0IjoiUHRmcWVic0c2RytuNTVKaGlQYWRKd1JhRjFmbksvSEhibkw5NzlhdEJ6S2RtTW1zUjVjUHNIU3BkekJrVWhaNkF1NGFmY1YrWEJhb0x6VGY5cjBXQnc9PSJ9",
        "id": "0bbedcb4-3471-4b75-9c34-cea8f90b2ed4",
        "payment_token": "WtIK9BBVowPVBKW4lGSAUQ7vdo9Y9A56oOswMlwCkX1eXXOLKu8tVMyR9PlQcN/L0rkCnvoxDUYPWqn+s4Edpm3ivl9Ot8FOgLCA4iNdIWTz44l9HyOhOyXgsv4Jj3EI",
        "timestamp_in_seconds": "1587387315",
        "token_info": {
          "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
          "unblinded_token": "PtfqebsG6G+n55JhiPadJwRaF1fnK/HHbnL979atBzKdmMmsR5cPsHSpdzBkUhZ6Au4afcV+XBaoLzTf9r0WB55M/e3ADSnoqcZ3eLU0cSIBz4OrBqjXXuUjL+piN9ci"
        },
        "type": "click"
      }
    ]
  },

After disabling Charles overwrite. Confirmation was successfully redeemed

[6100:15432:0420/184410.479:INFO:confirmations_impl.cc(1276)] Start retrying failed confirmations in 161 seconds
[6100:15432:0420/184410.487:INFO:confirmations_impl.cc(759)] Successfully saved confirmations state
[6100:15432:0420/184411.821:INFO:redeem_token.cc(177)] OnCreateConfirmation
[6100:15432:0420/184411.821:INFO:redeem_token.cc(179)] URL Request Response:
[6100:15432:0420/184411.821:INFO:redeem_token.cc(180)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/ed23b543-7ea3-48d6-acd0-dc35d7f38f57/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwieXJhNFE5SjVRQUEwWXI3K1hFWFZMaGVTTHZkZFNmNkRMOVNycTdLL1RqTT1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiNjYzMjZiMTQtZTRmNC00NTk3LWEzNTgtYWU2MTM0ZWIyNmMxXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiNDQ1ZGd3RHVkcVJqVXhYY1QvOERyQUZuZmhXbFgzUzcxajJIaEFQNWhoVi9mL3RTSVZaSUx5TjRyYjVRNjlIb3VTSTJtU010TlVTTitCMDZRQjlPNEE9PSIsInQiOiI0TmNYZmxsRDFPV05WMmVLeExUeW5sV0UwUVRRYmNaaHFtbnh0UjBDYm16dDNUUlp3dEVCTEY2dTlGOThJZ016VytQTnh0MDIzU3Zidk1rR0F5T1RQQT09In0=
[6100:15432:0420/184411.821:INFO:redeem_token.cc(181)]   Response Status Code: 201
[6100:15432:0420/184411.821:INFO:redeem_token.cc(182)]   Response: {"id":"ed23b543-7ea3-48d6-acd0-dc35d7f38f57","payload":{},"createdAt":"2020-04-20T13:14:32.283Z","type":"view","modifiedAt":"2020-04-20T13:14:32.283Z","creativeInstanceId":"66326b14-e4f4-4597-a358-ae6134eb26c1"}
[6100:15432:0420/184411.821:INFO:redeem_token.cc(183)]   Headers:
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     content-length: 211
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 13:14:32 GMT
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     etag: W/"d3-wsrllGBkhoQK/UBiPUuk9xMFlqE"
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     status: 201
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     x-cache: MISS
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     x-powered-by: Express
[6100:15432:0420/184411.821:INFO:redeem_token.cc(185)]     x-served-by: cache-sea4435-SEA
[6100:15432:0420/184411.821:INFO:redeem_token.cc(205)] FetchPaymentToken
[6100:15432:0420/184411.821:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken
[6100:15432:0420/184411.821:INFO:redeem_token.cc(210)] URL Request:
[6100:15432:0420/184411.821:INFO:redeem_token.cc(213)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/ed23b543-7ea3-48d6-acd0-dc35d7f38f57/paymentToken
[6100:15432:0420/184412.148:INFO:redeem_token.cc(229)] OnFetchPaymentToken
[6100:15432:0420/184412.148:INFO:redeem_token.cc(231)] URL Request Response:
[6100:15432:0420/184412.148:INFO:redeem_token.cc(232)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/ed23b543-7ea3-48d6-acd0-dc35d7f38f57/paymentToken
[6100:15432:0420/184412.148:INFO:redeem_token.cc(233)]   Response Status Code: 200
[6100:15432:0420/184412.148:INFO:redeem_token.cc(234)]   Response: {"id":"ed23b543-7ea3-48d6-acd0-dc35d7f38f57","createdAt":"2020-04-20T13:14:32.283Z","type":"view","modifiedAt":"2020-04-20T13:14:32.301Z","creativeInstanceId":"66326b14-e4f4-4597-a358-ae6134eb26c1","paymentToken":{"publicKey":"bPE1QE65mkIgytffeu7STOfly+x10BXCGuk5pVlOHQU=","batchProof":"8xjO1VgV+n9+9UGlxRTOzggt9ymScwyYmto4yy/U5Aw9r9a6+5Da7kpBMiKOcCxoOKBXDHz3KbJNl8t5yUIzAw==","signedTokens":["PiNqslWJvrt/3PWgHD1MqKHcGwrisKcObnSR7ox3pQc="]}}
[6100:15432:0420/184412.148:INFO:redeem_token.cc(235)]   Headers:
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     accept-ranges: bytes
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     access-control-allow-origin: *
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     content-length: 442
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     content-type: application/json; charset=utf-8
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     date: Mon, 20 Apr 2020 13:14:32 GMT
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     etag: W/"1ba-AbtlBKoYl3IeK6M2FC8bJKD9sbI"
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     status: 200
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     via: 1.1 varnish
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     x-cache: MISS
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     x-cache-hits: 0
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     x-powered-by: Express
[6100:15432:0420/184412.148:INFO:redeem_token.cc(237)]     x-served-by: cache-sea4435-SEA
[6100:15432:0420/184412.148:INFO:confirmations_impl.cc(743)] Saving confirmations state
[6100:15432:0420/184412.149:INFO:redeem_token.cc(412)] Added 1 unblinded payment token with an estimated redemption value of 0.05 BAT, you now have 1 unblinded payment tokens
[6100:15432:0420/184412.149:INFO:confirmations_impl.cc(743)] Saving confirmations state
[6100:15432:0420/184412.149:INFO:redeem_token.cc(440)] Successfully redeemed ed23b543-7ea3-48d6-acd0-dc35d7f38f57 confirmation id with 66326b14-e4f4-4597-a358-ae6134eb26c1 creative instance id for view

confirmations.json failed confirmation queue becomes empty after successful confirmation

"confirmations": {
    "failed_confirmations": []
  },
  "next_token_redemption_date_in_seconds": "1587474698",
  "transaction_history": {
    "transactions": [
      {
        "confirmation_type": "view",
        "estimated_redemption_value": 0.05,
        "timestamp_in_seconds": "1587388452"
      },
      {
        "confirmation_type": "click",
        "estimated_redemption_value": 0,
        "timestamp_in_seconds": "1587388842"
      }
    ]
  },

Test Case 5 (Fetch payment token fails with 500 INTERNAL SERVER ERROR):

[14792:8876:0420/190410.274:INFO:redeem_token.cc(177)] OnCreateConfirmation
[14792:8876:0420/190410.274:INFO:redeem_token.cc(179)] URL Request Response:
[14792:8876:0420/190410.274:INFO:redeem_token.cc(180)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/5d42b023-fd2a-40e4-9500-d72c0b6c7d9f/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiVGo4SjVsejJkYXhYejJONWFBbVdEQ3g0WW12bGhxQzBqanErNU55MmNUZz1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiZTRjYzQ5Y2ItZTU4MS00MjFkLTk5YzgtMzBhNmMyYTQxYjg1XCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiUTFBTDhWU0FJWnIyOFV3c3pud1pyazh4cTh1dlVPbUxRY2NNRHZZdDhNSHkyeFdkdlBBYklSUzZWSVVnbkRJLzRBWjVlTklsUHNEMDJ3dVlPY1J2aXc9PSIsInQiOiJrQmhrTjZQZVlIYzlaLzFtK1JmbGxsVGdPWUd0LzlnNmJtVXNtSUFDa3NaejdaOElYZk9HTHJHY2xPMm13YklVUnpSSXBmb0lpWkpjNTl1VWkvT1k2UT09In0=
[14792:8876:0420/190410.274:INFO:redeem_token.cc(181)]   Response Status Code: 201
[14792:8876:0420/190410.274:INFO:redeem_token.cc(182)]   Response: {"id":"5d42b023-fd2a-40e4-9500-d72c0b6c7d9f","payload":{},"createdAt":"2020-04-20T13:34:30.726Z","type":"view","modifiedAt":"2020-04-20T13:34:30.726Z","creativeInstanceId":"e4cc49cb-e581-421d-99c8-30a6c2a41b85"}
[14792:8876:0420/190410.274:INFO:redeem_token.cc(183)]   Headers:
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     cache-control: no-cache
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     content-length: 211
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 13:34:30 GMT
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     expires: 0
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     status: 201
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     x-cache: MISS
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     x-powered-by: Express
[14792:8876:0420/190410.274:INFO:redeem_token.cc(185)]     x-served-by: cache-sea4450-SEA
[14792:8876:0420/190410.274:INFO:redeem_token.cc(205)] FetchPaymentToken
[14792:8876:0420/190410.274:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken
[14792:8876:0420/190410.274:INFO:redeem_token.cc(210)] URL Request:
[14792:8876:0420/190410.274:INFO:redeem_token.cc(213)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/5d42b023-fd2a-40e4-9500-d72c0b6c7d9f/paymentToken
[14792:8876:0420/190410.595:INFO:redeem_token.cc(229)] OnFetchPaymentToken
[14792:8876:0420/190410.595:INFO:redeem_token.cc(231)] URL Request Response:
[14792:8876:0420/190410.595:INFO:redeem_token.cc(232)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/5d42b023-fd2a-40e4-9500-d72c0b6c7d9f/paymentToken
[14792:8876:0420/190410.595:INFO:redeem_token.cc(233)]   Response Status Code: 500
[14792:8876:0420/190410.595:INFO:redeem_token.cc(234)]   Response: {"id":"5d42b023-fd2a-40e4-9500-d72c0b6c7d9f","createdAt":"2020-04-20T13:34:30.726Z","type":"view","modifiedAt":"2020-04-20T13:34:30.750Z","creativeInstanceId":"e4cc49cb-e581-421d-99c8-30a6c2a41b85","paymentToken":{"publicKey":"bPE1QE65mkIgytffeu7STOfly+x10BXCGuk5pVlOHQU=","batchProof":"heSOb7ZUvhWJUVIaxg46u41z8HQjhqhThg4FrEfIpwkN0We4yBJ2vtN0KQZyHwRX83Na/+nzvPerxbN9SkR0Dg==","signedTokens":["EKAl+oRkqhResgjpV47dmMFXZxQeH4wqqHDDPg7f1lI="]}}
[14792:8876:0420/190410.595:INFO:redeem_token.cc(235)]   Headers:
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     accept-ranges: bytes
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     access-control-allow-origin: *
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     cache-control: no-cache
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     content-length: 442
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     content-type: application/json; charset=utf-8
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     date: Mon, 20 Apr 2020 13:34:31 GMT
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     expires: 0
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     status: 500
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     via: 1.1 varnish
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     x-cache: MISS
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     x-cache-hits: 0
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     x-powered-by: Express
[14792:8876:0420/190410.595:INFO:redeem_token.cc(237)]     x-served-by: cache-sea4450-SEA
[14792:8876:0420/190410.595:ERROR:redeem_token.cc(257)] Failed to fetch payment token
[14792:8876:0420/190410.595:WARNING:redeem_token.cc(428)] Failed to redeem 5d42b023-fd2a-40e4-9500-d72c0b6c7d9f confirmation id with e4cc49cb-e581-421d-99c8-30a6c2a41b85 creative instance id for view
[14792:8876:0420/190410.595:INFO:confirmations_impl.cc(743)] Saving confirmations state
[14792:8876:0420/190410.595:INFO:confirmations_impl.cc(905)] Added 5d42b023-fd2a-40e4-9500-d72c0b6c7d9f confirmation id with e4cc49cb-e581-421d-99c8-30a6c2a41b85 creative instance id for view to the confirmations queue
"failed_confirmations": [
      {
        "blinded_payment_token": "Tj8J5lz2daxXz2N5aAmWDCx4YmvlhqC0jjq+5Ny2cTg=",
        "created": true,
        "creative_instance_id": "e4cc49cb-e581-421d-99c8-30a6c2a41b85",
        "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiVGo4SjVsejJkYXhYejJONWFBbVdEQ3g0WW12bGhxQzBqanErNU55MmNUZz1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiZTRjYzQ5Y2ItZTU4MS00MjFkLTk5YzgtMzBhNmMyYTQxYjg1XCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiUTFBTDhWU0FJWnIyOFV3c3pud1pyazh4cTh1dlVPbUxRY2NNRHZZdDhNSHkyeFdkdlBBYklSUzZWSVVnbkRJLzRBWjVlTklsUHNEMDJ3dVlPY1J2aXc9PSIsInQiOiJrQmhrTjZQZVlIYzlaLzFtK1JmbGxsVGdPWUd0LzlnNmJtVXNtSUFDa3NaejdaOElYZk9HTHJHY2xPMm13YklVUnpSSXBmb0lpWkpjNTl1VWkvT1k2UT09In0=",
        "id": "5d42b023-fd2a-40e4-9500-d72c0b6c7d9f",
        "payment_token": "q8ANMzCxDiRey/KEZNklfMw+iXtQZk28ftb3mIPEcqY74cQSpJySSuehzy14h50SoZ5bIwDsawuGlXyNOcMG7I0p9175ynrN5byIiwps/Fflfc3alJhQ8+4tZEa6WI8J",
        "timestamp_in_seconds": "1587389649",
        "token_info": {
          "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
          "unblinded_token": "kBhkN6PeYHc9Z/1m+RflllTgOYGt/9g6bmUsmIACksZz7Z8IXfOGLrGclO2mwbIURzRIpfoIiZJc59uUi/OY6cK34btG2tMiSVWjg7azQfcMlfPeTljZSMNtU92+5f9M"
        },
        "type": "view"
      },
      {
        "blinded_payment_token": "Tp8fW13oAGz0kpGyk+118SA+Ecu3AP6w07ENpzMSdR4=",
        "created": true,
        "creative_instance_id": "e4cc49cb-e581-421d-99c8-30a6c2a41b85",
        "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiVHA4ZlcxM29BR3owa3BHeWsrMTE4U0ErRWN1M0FQNncwN0VOcHpNU2RSND1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiZTRjYzQ5Y2ItZTU4MS00MjFkLTk5YzgtMzBhNmMyYTQxYjg1XCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJjbGlja1wifSIsInNpZ25hdHVyZSI6IkkwakZHTkRVbnlYWGsvbFFHWmZEOW1pZUlRNjRQeVZYUEdGaUozWkJKWkhPVkF0aEorMUFRK0E1U2J0VlVTMlNHS1Fmdm82UDlxTE9sZVZieGs5OUV3PT0iLCJ0IjoiZzBaZktDQ2lrMVI5YUNBM2MzaGRnMXVDYjVZb2VKRU1RaTlxKzF4ZkZxUnpxcVNzdmFaeitROEpZb2FML2N3TWZGK0NrN1lBUTVpOG85WE1LTEt4aFE9PSJ9",
        "id": "60b369c9-59ff-4b4f-a421-8b24d0840786",
        "payment_token": "jPO/N1jqx9jc75WrPDG2u7U61fYrF2xlEI7PGDTF3+LpEMPy628bDafHaJHsjfMZHuiJ7Rhdcj0bCzoTN67xQ9U0ntSxs+g0ijALxIC+Ff6r+9UMAUA40JP5ZCubs1YK",
        "timestamp_in_seconds": "1587389651",
        "token_info": {
          "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
          "unblinded_token": "g0ZfKCCik1R9aCA3c3hdg1uCb5YoeJEMQi9q+1xfFqRzqqSsvaZz+Q8JYoaL/cwMfF+Ck7YAQ5i8o9XMKLKxhULqxcjzgPWH0aMOWopaHUTNjGeU7eUf3D1nunQkl5xA"
        },
        "type": "click"
      }
    ]
  },

confirmations.json - After successful retry, failed confirmation queue becomes empty and estimated BAT value will be assigned to view type confirmation and Estimated pending rewards and Ad notifications received this month values will be reflected in Ads panel in the browser

 "confirmations": {
    "failed_confirmations": []
  },
  "next_token_redemption_date_in_seconds": "1587476461",
  "transaction_history": {
    "transactions": [
      {
        "confirmation_type": "view",
        "estimated_redemption_value": 0.05,
        "timestamp_in_seconds": "1587390519"
      },
      {
        "confirmation_type": "click",
        "estimated_redemption_value": 0,
        "timestamp_in_seconds": "1587390763"
      }
    ]
  },

Test Case 6:

[2208:9568:0420/200554.745:INFO:refill_tokens.cc(300)] Added 42 unblinded tokens, you now have 50 unblinded tokens

Test Case 7 (Fetch payment token succeeds with 200 OK):

[16996:6376:0420/193337.883:INFO:refill_tokens.cc(300)] Added 50 unblinded tokens, you now have 50 unblinded tokens
[16996:6376:0420/193515.805:INFO:redeem_token.cc(440)] Successfully redeemed d3f01a0d-59eb-4543-81f8-abe85d8fee47 confirmation id with e4cc49cb-e581-421d-99c8-30a6c2a41b85 creative instance id for view

Verified passed with

Brave 1.7.98 Chromium: 81.0.4044.113 (Official Build) (64-bit)
Revision e3225dafb0475864a1812a374d73a92e391635ac-refs/branch-heads/4044@{#936}
OS macOS Version 10.14.6 (Build 18G3020)

Test Case 1 - PASSED

[5861:775:0420/092905.997422:INFO:redeem_token.cc(177)] OnCreateConfirmation
[5861:775:0420/092905.997464:INFO:redeem_token.cc(179)] URL Request Response:
[5861:775:0420/092905.997477:INFO:redeem_token.cc(180)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/53e619af-fd36-4141-8908-f0e614aab2f2/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiSXZJSGRKR3p4S0NUaElTb2hzQ3lEMGZPNWV4V2FSUCtVTGVOS2VxVGxBUT1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiYzQ3YWE3YjgtNzg0Zi00MjdjLTg1ODUtOWFhOGVlNDY1MDYwXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiY25BK3JxTnl1c2t2cHVKQ0MvZE12Qk9xNzZsOFlFelU5d09kU2RSc2pKbDh0V2k2ZEJOVGd4YjR6YTJHNTdJdVdoY24wNWhjSEdmMm5aemdIMEx1UVE9PSIsInQiOiJMclpHM1VmZGxqSmttRmZBK1NxclRWQmhSQXo2V0t5dHFKQnVZSUxJZW95SVdzY3Z0NEFlNFJpQ3VOZzkwZU9MeXZMQUJmQklwTTRLbXdieXJUV2Nidz09In0=
[5861:775:0420/092905.997489:INFO:redeem_token.cc(181)]   Response Status Code: 400
[5861:775:0420/092905.997499:INFO:redeem_token.cc(182)]   Response: {"id":"53e619af-fd36-4141-8908-f0e614aab2f2","payload":{},"createdAt":"2020-04-20T13:29:05.693Z","type":"view","modifiedAt":"2020-04-20T13:29:05.693Z","creativeInstanceId":"c47aa7b8-784f-427c-8585-9aa8ee465060"}
[5861:775:0420/092905.997509:INFO:redeem_token.cc(183)]   Headers:
[5861:775:0420/092905.997541:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[5861:775:0420/092905.997556:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[5861:775:0420/092905.997568:INFO:redeem_token.cc(185)]     cache-control: no-cache
[5861:775:0420/092905.997577:INFO:redeem_token.cc(185)]     content-length: 211
[5861:775:0420/092905.997585:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[5861:775:0420/092905.997627:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 13:29:05 GMT
[5861:775:0420/092905.997639:INFO:redeem_token.cc(185)]     expires: 0
[5861:775:0420/092905.997648:INFO:redeem_token.cc(185)]     status: 400
[5861:775:0420/092905.997657:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[5861:775:0420/092905.997693:INFO:redeem_token.cc(185)]     x-cache: MISS
[5861:775:0420/092905.997727:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[5861:775:0420/092905.997760:INFO:redeem_token.cc(185)]     x-powered-by: Express
[5861:775:0420/092905.997776:INFO:redeem_token.cc(185)]     x-served-by: cache-ewr18127-EWR
[5861:775:0420/092905.997784:WARNING:redeem_token.cc(192)] Duplicate/bad confirmation
[5861:775:0420/092905.997794:INFO:redeem_token.cc(205)] FetchPaymentToken
[5861:775:0420/092905.997802:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken

Test Case 2 - PASSED

[5903:775:0420/093554.933252:INFO:redeem_token.cc(177)] OnCreateConfirmation
[5903:775:0420/093554.933294:INFO:redeem_token.cc(179)] URL Request Response:
[5903:775:0420/093554.933308:INFO:redeem_token.cc(180)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/4809b23b-221b-4604-b7de-51f531e08981/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiSklralRaaXR2UXZoTFRsckRuTzRWTFRXc2ZmR2ppN1BTOXJjOEVuWFRsaz1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMGFlM2M0ODYtMTNmMi00ZWM3LTkzNzYtNTU3OGQ3YjBkY2Q4XCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoibkd3U3JVbWQxRHZSRTMrS1JpaTJvME1lb2VZdEhYNzZwTWRHOUVGSUJhdlhsVU5WS0lwNUh1Szg2WS90SjJHa3JVWllMdVJoeFljSGxUdlVpeW04WFE9PSIsInQiOiJYOUxQRFgyTG1FclllQWFneGFqNExHWXFFd0liTWRQM1orcHA0d2NuTFRFd2JaaVJxK0FVamwxeFNZd1huNGxEZU9YeTVVZjJZbXpOTHpnZTVwVHRMZz09In0=
[5903:775:0420/093554.933321:INFO:redeem_token.cc(181)]   Response Status Code: 500
[5903:775:0420/093554.933331:INFO:redeem_token.cc(182)]   Response: {"id":"4809b23b-221b-4604-b7de-51f531e08981","payload":{},"createdAt":"2020-04-20T13:35:54.698Z","type":"view","modifiedAt":"2020-04-20T13:35:54.698Z","creativeInstanceId":"0ae3c486-13f2-4ec7-9376-5578d7b0dcd8"}
[5903:775:0420/093554.933343:INFO:redeem_token.cc(183)]   Headers:
[5903:775:0420/093554.933359:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[5903:775:0420/093554.933369:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[5903:775:0420/093554.933378:INFO:redeem_token.cc(185)]     cache-control: no-cache
[5903:775:0420/093554.933387:INFO:redeem_token.cc(185)]     content-length: 211
[5903:775:0420/093554.933397:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[5903:775:0420/093554.933407:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 13:35:54 GMT
[5903:775:0420/093554.933418:INFO:redeem_token.cc(185)]     expires: 0
[5903:775:0420/093554.933427:INFO:redeem_token.cc(185)]     status: 500
[5903:775:0420/093554.933437:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[5903:775:0420/093554.933446:INFO:redeem_token.cc(185)]     x-cache: MISS
[5903:775:0420/093554.933455:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[5903:775:0420/093554.933464:INFO:redeem_token.cc(185)]     x-powered-by: Express
[5903:775:0420/093554.933473:INFO:redeem_token.cc(185)]     x-served-by: cache-ewr18139-EWR
[5903:775:0420/093554.933484:INFO:redeem_token.cc(205)] FetchPaymentToken
[5903:775:0420/093554.933493:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken

Test Case 3 - PASSED

[6310:775:0420/103927.015443:INFO:redeem_token.cc(177)] OnCreateConfirmation
[6310:775:0420/103927.015494:INFO:redeem_token.cc(179)] URL Request Response:
[6310:775:0420/103927.015510:INFO:redeem_token.cc(180)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/8ed5c1aa-ae6d-4ca7-a7af-f6f8ca5a66c8/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiL3RjOSt2UnMxRFRXY0wyNjNTZk9HMWhMb21ESUkybm1WQThaQ3gvM3lCcz1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMWJmYjAyZWMtMGQyYi00ZDE3LTk3MjctZWFiZjAwYTc3Yjc1XCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiVWw3WDVpRkVXQytlS3R4SVFoVnpkTkVnT3hhOWtuMDJxODgzOEx6SGl5Z2NkSHFHcnN2REExTzlhbTY1NjZ5WEYyc2NZMVJVNVZ3bmpPM2gwMU5YRkE9PSIsInQiOiJXdkxyMCsxSGpmNVMrTHJpSElwWDNURU9TblpSbjNpcVBqTFdPeVFINWYzRUJJb2dtWDF5bTJWYzFHOGovdnkyY0IyaHJPTmhKSUFTL0RURXpYLzU5Zz09In0=
[6310:775:0420/103927.015528:INFO:redeem_token.cc(181)]   Response Status Code: 201
[6310:775:0420/103927.015541:INFO:redeem_token.cc(182)]   Response: {"id":"8ed5c1aa-ae6d-4ca7-a7af-f6f8ca5a66c8","payload":{},"createdAt":"2020-04-20T14:39:26.765Z","type":"view","modifiedAt":"2020-04-20T14:39:26.765Z","creativeInstanceId":"1bfb02ec-0d2b-4d17-9727-eabf00a77b75"}
[6310:775:0420/103927.015555:INFO:redeem_token.cc(183)]   Headers:
[6310:775:0420/103927.015602:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[6310:775:0420/103927.015617:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[6310:775:0420/103927.015630:INFO:redeem_token.cc(185)]     content-length: 211
[6310:775:0420/103927.015642:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[6310:775:0420/103927.015657:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 14:39:27 GMT
[6310:775:0420/103927.015670:INFO:redeem_token.cc(185)]     etag: W/"d3-VdTKFx/ZPe+CAN1Hb6BcDCYaIJw"
[6310:775:0420/103927.015682:INFO:redeem_token.cc(185)]     status: 201
[6310:775:0420/103927.015694:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[6310:775:0420/103927.015707:INFO:redeem_token.cc(185)]     x-cache: MISS
[6310:775:0420/103927.015718:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[6310:775:0420/103927.015730:INFO:redeem_token.cc(185)]     x-powered-by: Express
[6310:775:0420/103927.015742:INFO:redeem_token.cc(185)]     x-served-by: cache-ewr18149-EWR
[6310:775:0420/103927.015757:INFO:redeem_token.cc(205)] FetchPaymentToken
[6310:775:0420/103927.015769:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken

Test Case 4 - PASSED 404's while Charles rewrite rule enabled:

[6513:775:0420/135408.091458:INFO:redeem_token.cc(229)] OnFetchPaymentToken
[6513:775:0420/135408.091545:INFO:redeem_token.cc(231)] URL Request Response:
[6513:775:0420/135408.091578:INFO:redeem_token.cc(232)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/aed35ce5-04b6-4c93-a294-715ac715d477/paymentToken
[6513:775:0420/135408.091600:INFO:redeem_token.cc(233)]   Response Status Code: 404
[6513:775:0420/135408.091619:INFO:redeem_token.cc(234)]   Response: {"id":"aed35ce5-04b6-4c93-a294-715ac715d477","createdAt":"2020-04-20T17:54:07.594Z","type":"view","modifiedAt":"2020-04-20T17:54:07.616Z","creativeInstanceId":"4bafa8e2-e5f6-434a-9cfe-cf1cf8e80d32","paymentToken":{"publicKey":"bPE1QE65mkIgytffeu7STOfly+x10BXCGuk5pVlOHQU=","batchProof":"19NoFuoRm+4gNvlooIT9d7lXEzpU8YbTbUB2MqV+BgQg3HgbGXYcR2TUPGnGuu039E7X2nfQkZ4NPQO/ySckCQ==","signedTokens":["IpyiR3fTsdoa2iCIl+KDQsLfXEuLoZlg41JlWo18Z1Q="]}}
[6513:775:0420/135408.091645:INFO:redeem_token.cc(235)]   Headers:
[6513:775:0420/135408.091666:INFO:redeem_token.cc(237)]     accept-ranges: bytes
[6513:775:0420/135408.091683:INFO:redeem_token.cc(237)]     access-control-allow-origin: *
[6513:775:0420/135408.091695:INFO:redeem_token.cc(237)]     cache-control: no-cache
[6513:775:0420/135408.091810:INFO:redeem_token.cc(237)]     content-length: 442
[6513:775:0420/135408.091840:INFO:redeem_token.cc(237)]     content-type: application/json; charset=utf-8
[6513:775:0420/135408.091866:INFO:redeem_token.cc(237)]     date: Mon, 20 Apr 2020 17:54:08 GMT
[6513:775:0420/135408.091886:INFO:redeem_token.cc(237)]     expires: 0
[6513:775:0420/135408.091905:INFO:redeem_token.cc(237)]     status: 404
[6513:775:0420/135408.091918:INFO:redeem_token.cc(237)]     via: 1.1 varnish
[6513:775:0420/135408.091943:INFO:redeem_token.cc(237)]     x-cache: MISS
[6513:775:0420/135408.091977:INFO:redeem_token.cc(237)]     x-cache-hits: 0
[6513:775:0420/135408.092119:INFO:redeem_token.cc(237)]     x-powered-by: Express
[6513:775:0420/135408.092148:INFO:redeem_token.cc(237)]     x-served-by: cache-ewr18122-EWR
[6513:775:0420/135408.092157:WARNING:redeem_token.cc(241)] Confirmation not found
[6513:775:0420/135408.092274:WARNING:redeem_token.cc(428)] Failed to redeem aed35ce5-04b6-4c93-a294-715ac715d477 confirmation id with 4bafa8e2-e5f6-434a-9cfe-cf1cf8e80d32 creative instance id for view

Failed Confirmations Queue:

  "confirmations": {
    "failed_confirmations": [
      {
        "blinded_payment_token": "OiR/7TV+AC/Vu0/mCGkGXpFrbDihB2nlumy4tdzbQzk=",
        "created": false,
        "creative_instance_id": "4bafa8e2-e5f6-434a-9cfe-cf1cf8e80d32",
        "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiT2lSLzdUVitBQy9WdTAvbUNHa0dYcEZyYkRpaEIybmx1bXk0dGR6YlF6az1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiNGJhZmE4ZTItZTVmNi00MzRhLTljZmUtY2YxY2Y4ZTgwZDMyXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiUllNTDZldlhsTmJYYTFQd1VtWTljMGcrYk1UaUxyaExqNFBLWVhxb1pzTVlKVzRTNWFieWhVWHdWcWhYc3pWdVNtQ3dHMU9mTFVGaTlPOEsxdFB4Wmc9PSIsInQiOiJtYW9wNjNIcCt1VHdtVUdKQXN3S3k5TnE5T2tUYW5hV2VFc1BDeUdBZWpZUUpKa0NUTTZYbUdQdjVaSzJSQ3JXdXBHRDZLemZZakZ5WkVWaTZFcENTZz09In0=",
        "id": "ab37718e-ef03-4de2-8f76-74847c1de140",
        "payment_token": "0/fTBAyp+vsKtPftsvtTv3IKxPECKj6BvGMjcscOnuFdQkrDIQk84bPUqEyaax0IFbfSD+ant8KQTyXcj252CpBN42+WcReweNVE1qhtbJeC+mpwDPY7DI2wMkPi/jMC",
        "timestamp_in_seconds": "1587405248",
        "token_info": {
          "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
          "unblinded_token": "maop63Hp+uTwmUGJAswKy9Nq9OkTanaWeEsPCyGAejYQJJkCTM6XmGPv5ZK2RCrWupGD6KzfYjFyZEVi6EpCSh6elFMe54MI2rIfni/039mnrKFuxyiEBHk30MMiLM4e"
        },
        "type": "view"
      },
      {
        "blinded_payment_token": "YEa1FPN8+foHjr6Aonl++aYDb9uTAqQ8dFl0nS3xMAE=",
        "created": false,
        "creative_instance_id": "4bafa8e2-e5f6-434a-9cfe-cf1cf8e80d32",
        "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiWUVhMUZQTjgrZm9IanI2QW9ubCsrYVlEYjl1VEFxUThkRmwwblMzeE1BRT1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiNGJhZmE4ZTItZTVmNi00MzRhLTljZmUtY2YxY2Y4ZTgwZDMyXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJkaXNtaXNzXCJ9Iiwic2lnbmF0dXJlIjoiWGEwNlkzMlNmMm9UdjRxNDZxTW14TGVBQkNZRlZxclRPbmZ0alU2SUVrYUR0UXdUNjE5a0ZrRVlkSEtzWEljcHpEWDNlcGdyY2wzeThJams2dnRxNXc9PSIsInQiOiJNcUdQVVVjZ0RkWVhNdDZlZll3d0ViOXQ2YnZMUXIzTGg0QjcveGd3VjNkSmpsY1J2ajJiS3lyWEFOWkdicEVpMm44SEhOYXh5OGMxUTJtbWJTZDFDUT09In0=",
        "id": "1ba3342a-c576-4047-b190-bc93f0eaf169",
        "payment_token": "bDcoOczJHgpp1R/e2+UpRm0PjUYJn7XeRF9NkJdmczFmhudSUc08IDUSvMZlHbQ/Za8ntsZR1BDvmj34ieBZrNRVC24FL4lZu6i+2gYlHj0CCLybysendj9XaClADncG",
        "timestamp_in_seconds": "1587405266",
        "token_info": {
          "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
          "unblinded_token": "MqGPUUcgDdYXMt6efYwwEb9t6bvLQr3Lh4B7/xgwV3dJjlcRvj2bKyrXANZGbpEi2n8HHNaxy8c1Q2mmbSd1CSzugGiRPf8o1GPzd94G3jqrHONN+UyraOZ0Tsmtts51"
        },
        "type": "dismiss"
      }
    ]
  },

First item in the queue was retried successfully:

  "confirmations": {
    "failed_confirmations": [
      {
        "blinded_payment_token": "YEa1FPN8+foHjr6Aonl++aYDb9uTAqQ8dFl0nS3xMAE=",
        "created": false,
        "creative_instance_id": "4bafa8e2-e5f6-434a-9cfe-cf1cf8e80d32",
        "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiWUVhMUZQTjgrZm9IanI2QW9ubCsrYVlEYjl1VEFxUThkRmwwblMzeE1BRT1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiNGJhZmE4ZTItZTVmNi00MzRhLTljZmUtY2YxY2Y4ZTgwZDMyXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJkaXNtaXNzXCJ9Iiwic2lnbmF0dXJlIjoiWGEwNlkzMlNmMm9UdjRxNDZxTW14TGVBQkNZRlZxclRPbmZ0alU2SUVrYUR0UXdUNjE5a0ZrRVlkSEtzWEljcHpEWDNlcGdyY2wzeThJams2dnRxNXc9PSIsInQiOiJNcUdQVVVjZ0RkWVhNdDZlZll3d0ViOXQ2YnZMUXIzTGg0QjcveGd3VjNkSmpsY1J2ajJiS3lyWEFOWkdicEVpMm44SEhOYXh5OGMxUTJtbWJTZDFDUT09In0=",
        "id": "1ba3342a-c576-4047-b190-bc93f0eaf169",
        "payment_token": "bDcoOczJHgpp1R/e2+UpRm0PjUYJn7XeRF9NkJdmczFmhudSUc08IDUSvMZlHbQ/Za8ntsZR1BDvmj34ieBZrNRVC24FL4lZu6i+2gYlHj0CCLybysendj9XaClADncG",
        "timestamp_in_seconds": "1587405266",
        "token_info": {
          "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
          "unblinded_token": "MqGPUUcgDdYXMt6efYwwEb9t6bvLQr3Lh4B7/xgwV3dJjlcRvj2bKyrXANZGbpEi2n8HHNaxy8c1Q2mmbSd1CSzugGiRPf8o1GPzd94G3jqrHONN+UyraOZ0Tsmtts51"
        },
        "type": "dismiss"
      }
    ]
  },
  "next_token_redemption_date_in_seconds": "1587491556",
  "transaction_history": {
    "transactions": [
      {
        "confirmation_type": "view",
        "estimated_redemption_value": 0.05,
        "timestamp_in_seconds": "1587405676"
      }
    ]
  },

Second item in queue retried successfully as well:

  "confirmations": {
    "failed_confirmations": []
  },
  "next_token_redemption_date_in_seconds": "1587491556",
  "transaction_history": {
    "transactions": [
      {
        "confirmation_type": "view",
        "estimated_redemption_value": 0.05,
        "timestamp_in_seconds": "1587405676"
      },
      {
        "confirmation_type": "dismiss",
        "estimated_redemption_value": 0.0,
        "timestamp_in_seconds": "1587405937"
      }
    ]
  },

Test Case 5 - PASSED

[6594:775:0420/142037.316494:INFO:redeem_token.cc(229)] OnFetchPaymentToken
[6594:775:0420/142037.316533:INFO:redeem_token.cc(231)] URL Request Response:
[6594:775:0420/142037.316545:INFO:redeem_token.cc(232)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/107c73cb-e061-4d22-af78-115caa7885da/paymentToken
[6594:775:0420/142037.316556:INFO:redeem_token.cc(233)]   Response Status Code: 500
[6594:775:0420/142037.316566:INFO:redeem_token.cc(234)]   Response: {"id":"107c73cb-e061-4d22-af78-115caa7885da","createdAt":"2020-04-20T18:20:36.876Z","type":"view","modifiedAt":"2020-04-20T18:20:36.898Z","creativeInstanceId":"0ae3c486-13f2-4ec7-9376-5578d7b0dcd8","paymentToken":{"publicKey":"bPE1QE65mkIgytffeu7STOfly+x10BXCGuk5pVlOHQU=","batchProof":"FopcIRWGtaCch08LdIjS6DtQ4WvXbOa9rv2wZZImpQYzFVApU/GEmW14tXz1lbpAB99iF0XRJBVAaSeGrbPHBw==","signedTokens":["vBGo5qdLxpTRi1GMRoc5Z45WFCobNg8CoOJG1m5B1l8="]}}
[6594:775:0420/142037.316579:INFO:redeem_token.cc(235)]   Headers:
[6594:775:0420/142037.316588:INFO:redeem_token.cc(237)]     accept-ranges: bytes
[6594:775:0420/142037.316598:INFO:redeem_token.cc(237)]     access-control-allow-origin: *
[6594:775:0420/142037.316607:INFO:redeem_token.cc(237)]     cache-control: no-cache
[6594:775:0420/142037.316616:INFO:redeem_token.cc(237)]     content-length: 442
[6594:775:0420/142037.316625:INFO:redeem_token.cc(237)]     content-type: application/json; charset=utf-8
[6594:775:0420/142037.316635:INFO:redeem_token.cc(237)]     date: Mon, 20 Apr 2020 18:20:37 GMT
[6594:775:0420/142037.316645:INFO:redeem_token.cc(237)]     expires: 0
[6594:775:0420/142037.316655:INFO:redeem_token.cc(237)]     status: 500
[6594:775:0420/142037.316664:INFO:redeem_token.cc(237)]     via: 1.1 varnish
[6594:775:0420/142037.316673:INFO:redeem_token.cc(237)]     x-cache: MISS
[6594:775:0420/142037.316682:INFO:redeem_token.cc(237)]     x-cache-hits: 0
[6594:775:0420/142037.316691:INFO:redeem_token.cc(237)]     x-powered-by: Express
[6594:775:0420/142037.316700:INFO:redeem_token.cc(237)]     x-served-by: cache-ewr18152-EWR
[6594:775:0420/142037.316709:ERROR:redeem_token.cc(257)] Failed to fetch payment token
[6594:775:0420/142037.316724:WARNING:redeem_token.cc(428)] Failed to redeem 107c73cb-e061-4d22-af78-115caa7885da confirmation id with 0ae3c486-13f2-4ec7-9376-5578d7b0dcd8 creative instance id for view
  "confirmations": {
    "failed_confirmations": [
      {
        "blinded_payment_token": "Ar2BN/RFr35Ag+0SzjhynupP+8INfefB8KAc7L66Zhw=",
        "created": true,
        "creative_instance_id": "0ae3c486-13f2-4ec7-9376-5578d7b0dcd8",
        "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiQXIyQk4vUkZyMzVBZyswU3pqaHludXBQKzhJTmZlZkI4S0FjN0w2Nlpodz1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMGFlM2M0ODYtMTNmMi00ZWM3LTkzNzYtNTU3OGQ3YjBkY2Q4XCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiOENlR0hIN3hXOU5oRndPYWdZRUx0MkFBVlhOUzFPTlZYQ0VGNkNBTjhYS0Ewd3RXdXhtZ2hWZTMrZjNzamcwVmxCdG1mRFlLYUttbzBrRjJldDNyMUE9PSIsInQiOiJHZ0picURqbk5hdTVQVE50T2hBR0RKZ1pkMEM1NENiVzFjQzQwU0ZXcUs4WW50TXllbm40YzJNcko1MWVOYVFDdjZuTTZMNGU1bmdkZFRNZHY1bitFdz09In0=",
        "id": "107c73cb-e061-4d22-af78-115caa7885da",
        "payment_token": "uGCLI4VKfRv0nHnkRVGvXCihosCRZiBDaWb1WToNdWyXyZdRNfKwnsVtaA4YFEveuAKfgPQYBaY4VPpikqGvEXgtPeewNmm1b/BQ7yzUK78rCRPekTMJybYnrQps+3sM",
        "timestamp_in_seconds": "1587406836",
        "token_info": {
          "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
          "unblinded_token": "GgJbqDjnNau5PTNtOhAGDJgZd0C54CbW1cC40SFWqK8YntMyenn4c2MrJ51eNaQCv6nM6L4e5ngddTMdv5n+E7JHQNk5zXdnh59PZVzHxRIsMgrS+wtJidi05hNuPpw0"
        },
        "type": "view"
      },
      {
        "blinded_payment_token": "CFlLcMFaIk0rG0UHiKuxWkhpbcyMqKTyYiHkqDZF5l0=",
        "created": true,
        "creative_instance_id": "0ae3c486-13f2-4ec7-9376-5578d7b0dcd8",
        "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiQ0ZsTGNNRmFJazByRzBVSGlLdXhXa2hwYmN5TXFLVHlZaUhrcURaRjVsMD1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMGFlM2M0ODYtMTNmMi00ZWM3LTkzNzYtNTU3OGQ3YjBkY2Q4XCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJkaXNtaXNzXCJ9Iiwic2lnbmF0dXJlIjoiM3R0VFRBRHA0UHkzS0hZMzQrUEhLNkhBQ08wNHdoOTJuMm5jQ0dEZGppOENjSll1L293RGFXem5Dei9hRm11eFdMZDdjOVp4eUQ2Umo4VWVvR1YrN3c9PSIsInQiOiJTS2dTWkpWV09Ra2JFNDFCR2RIV3lUeXJPaEFLcjBEaWhCVHdPajhGVXFBM1lwWHZJNWFuQW1pK3BJeGZJeXdBT0RPMHZQWWxUZjh2amVQV09XWWNEQT09In0=",
        "id": "03d5efd6-aed7-46d9-8b4b-773ac3e82ddd",
        "payment_token": "rUCukGLCFdHPUaJYdO4jsJpZxNe1RSUU3lQd0Hu92Y/7Md7lFab9EOirj13r6oLZGin8DrEcv3Zd6hm/iktS7KDWnRDMSltLXNc03TrwlJdgjtFP6GVLTuj/Jykuj9YL",
        "timestamp_in_seconds": "1587406866",
        "token_info": {
          "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
          "unblinded_token": "SKgSZJVWOQkbE41BGdHWyTyrOhAKr0DihBTwOj8FUqA3YpXvI5anAmi+pIxfIywAODO0vPYlTf8vjePWOWYcDD6a2BbrQ9OjxyKl8ZqGKYBLUcNKrMVjJ9dejN/E+uUU"
        },
        "type": "dismiss"
      }
    ]
  },

All failed confirmations retried successfully:

  "confirmations": {
    "failed_confirmations": []
  },
  "next_token_redemption_date_in_seconds": "1587493170",
  "transaction_history": {
    "transactions": [
      {
        "confirmation_type": "view",
        "estimated_redemption_value": 0.05,
        "timestamp_in_seconds": "1587407162"
      },
      {
        "confirmation_type": "dismiss",
        "estimated_redemption_value": 0.0,
        "timestamp_in_seconds": "1587407171"
      }
    ]
  },

Test Case 6 - PASSED

[6697:775:0420/172056.669070:INFO:refill_tokens.cc(300)] Added 31 unblinded tokens, you now have 50 unblinded tokens
[6697:775:0420/172056.669105:INFO:confirmations_impl.cc(743)] Saving confirmations state
[6697:775:0420/172056.669808:INFO:refill_tokens.cc(325)] Successfully refilled tokens

Test Case 7 - PASSED

[6697:775:0420/150408.969035:INFO:confirmations_impl.cc(743)] Saving confirmations state
[6697:775:0420/150408.969506:INFO:redeem_token.cc(440)] Successfully redeemed d180628b-008f-4d6f-9d99-bcd2666fd3b0 confirmation id with 015663f8-b84c-4f58-aaad-5180479798ac creative instance id for view

Verification passed on

Brave 1.7.98 Chromium: 81.0.4044.113 (Official Build) (64-bit)
Revision e3225dafb0475864a1812a374d73a92e391635ac-refs/branch-heads/4044@{#936}
OS Ubuntu 18.04 LTS

Verified test plan from https://github.com/brave/brave-core/pull/5260

Verified Test Case 1 (Create confirmation fails with 400 BAD REQUEST):

[1013:1013:0420/215430.045725:INFO:redeem_token.cc(177)] OnCreateConfirmation
[1013:1013:0420/215430.045745:INFO:redeem_token.cc(179)] URL Request Response:
[1013:1013:0420/215430.045751:INFO:redeem_token.cc(180)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/46204def-d241-43a4-8da0-3374cab1c408/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwib0dKM2JSSmI3MjJpdjd5RElLRmlacG1rN0dUMlNhdGVoRXNZWE03QUxRZz1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMzZjODRmY2ItNjM4OC00NWQ4LTgxZWQtNWE1ZDk4NmNkN2VmXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiTzg2ZERyNWExU1VNTWQwazB4R1JWVVc4WUo1Q3ZYODV0QUVYU3BBcW45Y2hZTC95dEdrUko0VHBFaDBXMFV1ejI4K0xuc1JWNktWYzdUMWhzTmQ0aWc9PSIsInQiOiJwcHorMzFYa1VkeFNRWk0rNXBxS1EvZ1RHaGR1bzVrQnJsVkxDRXZLZzRxc2hHdXJvVlJ3NmtBWm1tSVU3bi9oeFQ2QWVpc3U1cGpkQjA5WmJrUi9aUT09In0=
[1013:1013:0420/215430.045758:INFO:redeem_token.cc(181)]   Response Status Code: 400
[1013:1013:0420/215430.045764:INFO:redeem_token.cc(182)]   Response: {"id":"46204def-d241-43a4-8da0-3374cab1c408","payload":{},"createdAt":"2020-04-20T19:54:29.753Z","type":"view","modifiedAt":"2020-04-20T19:54:29.753Z","creativeInstanceId":"36c84fcb-6388-45d8-81ed-5a5d986cd7ef"}
[1013:1013:0420/215430.045770:INFO:redeem_token.cc(183)]   Headers:
[1013:1013:0420/215430.045775:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[1013:1013:0420/215430.045781:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[1013:1013:0420/215430.045785:INFO:redeem_token.cc(185)]     cache-control: no-cache
[1013:1013:0420/215430.045790:INFO:redeem_token.cc(185)]     content-length: 211
[1013:1013:0420/215430.045795:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[1013:1013:0420/215430.045800:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 19:54:30 GMT
[1013:1013:0420/215430.045805:INFO:redeem_token.cc(185)]     expires: 0
[1013:1013:0420/215430.045810:INFO:redeem_token.cc(185)]     status: 400
[1013:1013:0420/215430.045814:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[1013:1013:0420/215430.045819:INFO:redeem_token.cc(185)]     x-cache: MISS
[1013:1013:0420/215430.045824:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[1013:1013:0420/215430.045828:INFO:redeem_token.cc(185)]     x-powered-by: Express
[1013:1013:0420/215430.045833:INFO:redeem_token.cc(185)]     x-served-by: cache-hhn4055-HHN
[1013:1013:0420/215430.045838:WARNING:redeem_token.cc(192)] Duplicate/bad confirmation
[1013:1013:0420/215430.045844:INFO:redeem_token.cc(205)] FetchPaymentToken
[1013:1013:0420/215430.045849:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken

Test Case 2 (Create confirmation fails with 500 INTERNAL SERVER ERROR):

[1559:1559:0420/215922.126254:INFO:redeem_token.cc(177)] OnCreateConfirmation
[1559:1559:0420/215922.126318:INFO:redeem_token.cc(179)] URL Request Response:
[1559:1559:0420/215922.126331:INFO:redeem_token.cc(180)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/eb5866d1-88c9-44c9-b078-f93e74ca035d/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiZEFrV2l4dFV5UkQyLzBFYWxKNFArVE5ZbDVzSnRtMUVZT01Gd2YxZjJnND1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMGQ4N2RkNzEtZWNhNS00NjkxLTlkYmMtZmE3ZWViOTU4MGRiXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoic3pwczBSUjJVdWlhcE50U2o2WTR1SjFPQVZoNFRQZTMvOXBuRmgzYlNXdm5PN2NpeFJ3VWp1NERSeThqTFVPaW1GVGhHQnY3ek5LYUZYaTZnajY3a2c9PSIsInQiOiJVbGczQzMrTDVhdStVbFVPYkR3NWM1R3ZjYUkrNmhQRmZ3dEovRGxmTUdzd0VlbThzT1QyUzFFeFhVcTY5Um45WFo1Si9jaGdjdG1jL3JyY0pkNUcxZz09In0=
[1559:1559:0420/215922.126346:INFO:redeem_token.cc(181)]   Response Status Code: 500
[1559:1559:0420/215922.126356:INFO:redeem_token.cc(182)]   Response: {"id":"eb5866d1-88c9-44c9-b078-f93e74ca035d","payload":{},"createdAt":"2020-04-20T19:59:21.812Z","type":"view","modifiedAt":"2020-04-20T19:59:21.812Z","creativeInstanceId":"0d87dd71-eca5-4691-9dbc-fa7eeb9580db"}
[1559:1559:0420/215922.126368:INFO:redeem_token.cc(183)]   Headers:
[1559:1559:0420/215922.126378:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[1559:1559:0420/215922.126388:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[1559:1559:0420/215922.126397:INFO:redeem_token.cc(185)]     cache-control: no-cache
[1559:1559:0420/215922.126406:INFO:redeem_token.cc(185)]     content-length: 211
[1559:1559:0420/215922.126415:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[1559:1559:0420/215922.126425:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 19:59:22 GMT
[1559:1559:0420/215922.126434:INFO:redeem_token.cc(185)]     expires: 0
[1559:1559:0420/215922.126444:INFO:redeem_token.cc(185)]     status: 500
[1559:1559:0420/215922.126453:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[1559:1559:0420/215922.126462:INFO:redeem_token.cc(185)]     x-cache: MISS
[1559:1559:0420/215922.126471:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[1559:1559:0420/215922.126481:INFO:redeem_token.cc(185)]     x-powered-by: Express
[1559:1559:0420/215922.126491:INFO:redeem_token.cc(185)]     x-served-by: cache-ams21028-AMS
[1559:1559:0420/215922.126504:INFO:redeem_token.cc(205)] FetchPaymentToken
[1559:1559:0420/215922.126514:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken

Test Case 3 (Create confirmation succeeds with 201 CREATED):

[2066:2066:0420/220922.056490:INFO:redeem_token.cc(177)] OnCreateConfirmation
[2066:2066:0420/220922.056520:INFO:redeem_token.cc(179)] URL Request Response:
[2066:2066:0420/220922.056526:INFO:redeem_token.cc(180)]   URL: https://ads-serve.bravesoftware.com/v1/confirmation/46861761-1470-4ced-927e-46b9f67ee6a2/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwickoxMmZRQm0yWVZ6R29MWWt0NExrVStPWGRnKzlSYlZsbFoveTYxNVVGZz1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMGQ4N2RkNzEtZWNhNS00NjkxLTlkYmMtZmE3ZWViOTU4MGRiXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiaFZlNmxIdlRKdG1BQ0hvMjU5YzdPZG5pYWFHQTQ3NE4xT3pPK3NSUkVGd0lhR1FlaTl5Mkk2ZEszUjNPM3FGV1l1SjVsOG4xREtHazJGTitlamV1ZkE9PSIsInQiOiJRRlZ0UEhZOGNkN0F4WVpoODhhTEd3VlFRNHA2UGlSRkl2RUJkWXlIeGZGbW5rclBUOUhzUDduLzF2OXdXdlZiaXYyVjVVSVp5ZmJveC9iNGNBdFZkdz09In0=
[2066:2066:0420/220922.056535:INFO:redeem_token.cc(181)]   Response Status Code: 201
[2066:2066:0420/220922.056540:INFO:redeem_token.cc(182)]   Response: {"id":"46861761-1470-4ced-927e-46b9f67ee6a2","payload":{},"createdAt":"2020-04-20T20:09:21.735Z","type":"view","modifiedAt":"2020-04-20T20:09:21.735Z","creativeInstanceId":"0d87dd71-eca5-4691-9dbc-fa7eeb9580db"}
[2066:2066:0420/220922.056547:INFO:redeem_token.cc(183)]   Headers:
[2066:2066:0420/220922.056552:INFO:redeem_token.cc(185)]     accept-ranges: bytes
[2066:2066:0420/220922.056557:INFO:redeem_token.cc(185)]     access-control-allow-origin: *
[2066:2066:0420/220922.056562:INFO:redeem_token.cc(185)]     cache-control: no-cache
[2066:2066:0420/220922.056567:INFO:redeem_token.cc(185)]     content-length: 211
[2066:2066:0420/220922.056572:INFO:redeem_token.cc(185)]     content-type: application/json; charset=utf-8
[2066:2066:0420/220922.056577:INFO:redeem_token.cc(185)]     date: Mon, 20 Apr 2020 20:09:22 GMT
[2066:2066:0420/220922.056582:INFO:redeem_token.cc(185)]     expires: 0
[2066:2066:0420/220922.056587:INFO:redeem_token.cc(185)]     status: 201
[2066:2066:0420/220922.056592:INFO:redeem_token.cc(185)]     via: 1.1 varnish
[2066:2066:0420/220922.056596:INFO:redeem_token.cc(185)]     x-cache: MISS
[2066:2066:0420/220922.056601:INFO:redeem_token.cc(185)]     x-cache-hits: 0
[2066:2066:0420/220922.056606:INFO:redeem_token.cc(185)]     x-powered-by: Express
[2066:2066:0420/220922.056610:INFO:redeem_token.cc(185)]     x-served-by: cache-ams21050-AMS
[2066:2066:0420/220922.056617:INFO:redeem_token.cc(205)] FetchPaymentToken
[2066:2066:0420/220922.056622:INFO:redeem_token.cc(207)] GET /v1/confirmation/{confirmation_id}/paymentToken

Test Case 4 (Fetch payment token fails with 404 NOT FOUND):

confirmations.json with failed confirmations

    "confirmations": {
        "failed_confirmations": [{
                "blinded_payment_token": "pudl6C66xabxNs2bDEhOfsw7vpUzvyyFBYHe+glPmV4=",
                "created": false,
                "creative_instance_id": "36c84fcb-6388-45d8-81ed-5a5d986cd7ef",
                "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwicHVkbDZDNjZ4YWJ4TnMyYkRFaE9mc3c3dnBVenZ5eUZCWUhlK2dsUG1WND1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMzZjODRmY2ItNjM4OC00NWQ4LTgxZWQtNWE1ZDk4NmNkN2VmXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoidjdxS3BvdU9ERERKZXZuYnRnZU15ZE8zQ3NsOVU5T1JxR1FObnY4bi9XeTZQbSs2UWRYY0d0WkY3VTdjYjFmZ1FLNEU0dzRMRFlpc0psU2laZVpKQXc9PSIsInQiOiI3K1lVUWtkSzZRaitjT3A4bzZGSTlQY2hEN29uMEVOWnh4Z3lkK0hqVDNWdUdpRlQ3eTJUa0QvL3krUHVTVjRaeWMwams3K3luOWc5VWpRZFcySURqZz09In0=",
                "id": "a4388deb-a712-4856-b48b-390b489df7bb",
                "payment_token": "+GYAkTrcezwvMGdfQcMRBZhAkdZ/IjnsjhzefMhoO4D6ZSpO5tybpUIUbwF7e/TLhMPrPy1sZZlxXm0vFSncRiFR3W+YolLrjfDK6kz3PVQfwfenQXh7jG88let6rfwP",
                "timestamp_in_seconds": "1587414396",
                "token_info": {
                    "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
                    "unblinded_token": "7+YUQkdK6Qj+cOp8o6FI9PchD7on0ENZxxgyd+HjT3VuGiFT7y2TkD//y+PuSV4Zyc0jk7+yn9g9UjQdW2IDjrpeJ70ywEakNRphbV5DwFD5G/ecvWI7bgAiNkqeOYJ8"
                },
                "type": "view"
            }, {
                "blinded_payment_token": "zpF8+jiJAs2uVbzqX9N7gna2pf3mov5s55HOZfQUsEo=",
                "created": false,
                "creative_instance_id": "36c84fcb-6388-45d8-81ed-5a5d986cd7ef",
                "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwienBGOCtqaUpBczJ1VmJ6cVg5TjdnbmEycGYzbW92NXM1NUhPWmZRVXNFbz1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMzZjODRmY2ItNjM4OC00NWQ4LTgxZWQtNWE1ZDk4NmNkN2VmXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJkaXNtaXNzXCJ9Iiwic2lnbmF0dXJlIjoiRWV2dytlaXhDMmlVYzRoanNnUGdMNTNhQ1VabGF0eEIzdmdiNFNYWVR5NGFLNkc3UW8vSGpnZmxtVzRLZjBLTmtXM1NHWWs1WFBSbFhVdWZkZHE4Qmc9PSIsInQiOiIxV3FRSHcvNkdEa3pKRHBIajQyaC9WU1FzdEp4ODFoaWQ0NWJnK2twR2xDL3k0N3NOTXRYTWJxeWtOeG5RWjc5S09BQ2o2ZnBIWlM5QkUzYVhHQUliZz09In0=",
                "id": "07c2a062-cc7b-4d8f-85e7-a52a71b8c900",
                "payment_token": "9nQu5StxTgsbYsckJr17T5eqF44iJLQcEMKlHujHw3U0GWt0JxR3ypDyhti45yhaxHGC/HrpOG2/msoUKZz/ISHrigtpPGhoKtt7Rx7Ik6KsehB9Y/BoLFyDVAHQjGoJ",
                "timestamp_in_seconds": "1587414425",
                "token_info": {
                    "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
                    "unblinded_token": "1WqQHw/6GDkzJDpHj42h/VSQstJx81hid45bg+kpGlC/y47sNMtXMbqykNxnQZ79KOACj6fpHZS9BE3aXGAIbg5E2SAUN5tmgvOTPqQRKJ+pjzvklD+sKThyD1RAe/4D"
                },
                "type": "dismiss"
            }
        ]
    }

After disabling Charles overwrite. Confirmation was successfully redeemed confirmations.json after successful confirmation

    "confirmations": {
        "failed_confirmations": []
    },
    "next_token_redemption_date_in_seconds": "1587500699",
    "transaction_history": {
        "transactions": [{
                "confirmation_type": "view",
                "estimated_redemption_value": 0.05,
                "timestamp_in_seconds": "1587414864"
            }, {
                "confirmation_type": "dismiss",
                "estimated_redemption_value": 0.0,
                "timestamp_in_seconds": "1587415052"
            }
        ]
    },
    "unblinded_payment_tokens": [{
            "public_key": "bPE1QE65mkIgytffeu7STOfly+x10BXCGuk5pVlOHQU=",
            "unblinded_token": "+GYAkTrcezwvMGdfQcMRBZhAkdZ/IjnsjhzefMhoO4D6ZSpO5tybpUIUbwF7e/TLhMPrPy1sZZlxXm0vFSncRtTC2mrG0oPGJu7BHFtODedrQ/tTA9saXFFp1USr+fQq"
        }, {
            "public_key": "lLO5tErGoTK0askrALab6pKGAnBHqELSyw/evqZRwH8=",
            "unblinded_token": "9nQu5StxTgsbYsckJr17T5eqF44iJLQcEMKlHujHw3U0GWt0JxR3ypDyhti45yhaxHGC/HrpOG2/msoUKZz/IWgTpDsTEtrzyoDyVDVISC/RWKNF/VI9q6uEc2Wfp3Qx"
        }
    ],

Test Case 5 (Fetch payment token fails with 500 INTERNAL SERVER ERROR): confirmations.json with failed confirmations

    "confirmations": {
        "failed_confirmations": [{
                "blinded_payment_token": "8sI4LaSNjyEjpbM4ocrB7I2tXsu95q8iSL83JxZtqS8=",
                "created": true,
                "creative_instance_id": "36c84fcb-6388-45d8-81ed-5a5d986cd7ef",
                "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiOHNJNExhU05qeUVqcGJNNG9jckI3STJ0WHN1OTVxOGlTTDgzSnhadHFTOD1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMzZjODRmY2ItNjM4OC00NWQ4LTgxZWQtNWE1ZDk4NmNkN2VmXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJ2aWV3XCJ9Iiwic2lnbmF0dXJlIjoiM29ubkV2TGh3ZEhGOEdtdWxHVGtydjdFS1Q2WjA4Y1JEVTJBNmhqRGtiek5aelpoSXVHNlV5b0c5ZG5KaHhJZ0FnczBNa09zZGN0Rk1mS1RFZGpxeGc9PSIsInQiOiJHU2hnbGNydmh4elNsRlg1cEwxTTBzSHU2YURxdFk1VW1vMHRPb3R1aS95dmZlS0lxS0JlQXlmQ1BhczJEaEhLY2R3NVQ0aGVtWHUzL2g0bE1LRDFsQT09In0=",
                "id": "d46d6fd3-6716-452d-b1bd-b1a18685782b",
                "payment_token": "V7VT2l+QSrQGG39N0+7oJrlgkYPS5H9EphKfJJe92kNNGi9wAq5fNBbvQDxvTgTltBw3vsrUJxqg/AbLYgK6n/FpuualaL5NSkVFNs/IUiwjbR42jOZNOV45HshCBUAO",
                "timestamp_in_seconds": "1587149659",
                "token_info": {
                    "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
                    "unblinded_token": "GShglcrvhxzSlFX5pL1M0sHu6aDqtY5Umo0tOotui/yvfeKIqKBeAyfCPas2DhHKcdw5T4hemXu3/h4lMKD1lDLO6vHvXyw3MP7MXOZZ4t+a78gZo91TLOJ+oVU2VPdJ"
                },
                "type": "view"
            }, {
                "blinded_payment_token": "Jq/LW3qPKxOZqL1KfPT+s09k8+FYWzpmHhrVe7t3Jlk=",
                "created": true,
                "creative_instance_id": "36c84fcb-6388-45d8-81ed-5a5d986cd7ef",
                "credential": "eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlblwiOlwiSnEvTFczcVBLeE9acUwxS2ZQVCtzMDlrOCtGWVd6cG1IaHJWZTd0M0psaz1cIixcImNyZWF0aXZlSW5zdGFuY2VJZFwiOlwiMzZjODRmY2ItNjM4OC00NWQ4LTgxZWQtNWE1ZDk4NmNkN2VmXCIsXCJwYXlsb2FkXCI6e30sXCJ0eXBlXCI6XCJkaXNtaXNzXCJ9Iiwic2lnbmF0dXJlIjoiTU9FVmlCR0pEemZUMWhrc1BnUitwelR3UWpOcmZ3YzJISUdiRTdqRHRpRjhsZXM1bzJkSWJKQjE1OUpBT2ZkbnZLNG1XY2tPaE00VUZuZXpEM2ZDZVE9PSIsInQiOiJtMkhFbGpjWXRxaDVjUi94YWI2V2tqekdNOXErMVNjQk5kc1NlN0ZqaVRTVUZwNlI0YmtNekZJMi9wZ3RKZ004RTZqRk5VaXZXU2hVWlluYnZOaWN0dz09In0=",
                "id": "89aacf71-356f-4cc6-ac62-5485afb6c1c8",
                "payment_token": "mf5s1tMHCIVI2FcT354RDSsROONPIWMIvVeLSRKJb19SRJOoWb9mST0yXN+CESe0kDn7odktQsKo4ovb2rSMX7hAUDkUcOtR30b29hIG8x8EL30uRt/MYx2GBH4uBloH",
                "timestamp_in_seconds": "1587149777",
                "token_info": {
                    "public_key": "crDVI1R6xHQZ4D9cQu4muVM5MaaM1QcOT4It8Y/CYlw=",
                    "unblinded_token": "m2HEljcYtqh5cR/xab6WkjzGM9q+1ScBNdsSe7FjiTSUFp6R4bkMzFI2/pgtJgM8E6jFNUivWShUZYnbvNict2AGtBW1UyHgfHzfp8i/HJWDlO2NFrRD/fiqhHELgIkg"
                },
                "type": "dismiss"
            }
        ]
    },

After disabling Charles overwrite. Confirmation was successfully redeemed confirmations.json after successful confirmation

    "transaction_history": {
        "transactions": [{
                "confirmation_type": "dismiss",
                "estimated_redemption_value": 0.0,
                "timestamp_in_seconds": "1587155658"
            }, {
                "confirmation_type": "view",
                "estimated_redemption_value": 0.05,
                "timestamp_in_seconds": "1587156077"
            }
        ]
    },

Test Case 6

[3513:1:0420/223737.966517:INFO:refill_tokens.cc(294)] Added 39 unblinded tokens, you now have 50 unblinded tokens

Test Case 7 (Fetch payment token succeeds with 200 OK):

[3936:3936:0420/224110.874629:INFO:refill_tokens.cc(294)] Added 50 unblinded tokens, you now have 50 unblinded tokens
[3936:3936:0420/224510.124626:INFO:redeem_token.cc(412)] Successfully redeemed e9ad44e5-51dc-4fa2-94b1-50012224f484 confirmation id with 36c84fcb-6388-45d8-81ed-5a5d986cd7ef creative instance id for view