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

SKUs environment should be configurable via brave://flags #20557

Closed
bsclifton opened this issue Jan 19, 2022 · 11 comments · Fixed by brave/brave-core#11894
Closed

SKUs environment should be configurable via brave://flags #20557

bsclifton opened this issue Jan 19, 2022 · 11 comments · Fixed by brave/brave-core#11894

Comments

@bsclifton
Copy link
Member

bsclifton commented Jan 19, 2022

Test plan

  1. Fresh profile
  2. Visit brave://flags/#skus-environment
  3. On Windows and macOS, there should be a value here (Default, production, staging, development) and it should be configurable. Linux is not supported at this time
  4. Enable brave://flags/#skus-sdk - set this new value (brave://flags/#skus-environment) to development
  5. Exit the browser. Start Brave via command line making sure to add logging arguments --vmodule="*/skus/*"=1 --enable-logging=stderr
  6. Visit https://account.brave.software and log in (@bsclifton can help if basic auth is presented; creds are in 1PW4T or send a DM)
  7. Once logged in, buy VPN
  8. You should see (in the console where you started Brave) lots of JSON and output from calls which include refresh_order

There may still be environment issues preventing the credentials from being issued... but as long as the refresh_order has details, that means the environment specific part worked 😄

Description

We already have brave://flags entries for both VPN and SKU (dependent on each other for Desktop)
image

  • brave://flags/#brave-vpn
  • brave://flags/#skus-sdk

But at the moment, environment is defaulting to production for an official build (otherwise, it uses development).

There is a command line flag --skus-env which accepts the following values:

  • production
  • staging
  • development

It would be great to expose this in brave://flags. If Default, we can default to production. But if overridden, it can use the chosen environment.

simonhong added a commit to brave/brave-core that referenced this issue Jan 19, 2022
When one of option is selected except default, it's value is passed
via --skus-env command line switch.

fix brave/brave-browser#20557
@bsclifton bsclifton added this to the 1.36.x - Nightly milestone Jan 19, 2022
@stephendonner
Copy link

stephendonner commented Feb 4, 2022

Verified PASSED using

Brave 1.36.84 Chromium: 98.0.4758.87 (Official Build) dev (x86_64)
Revision e4cd00f135fb4d8edc64c8aa6ecbe7cc79ebb3b2-refs/branch-heads/4758@{#1002}
OS macOS Version 11.6.1 (Build 20G224)

Followed the steps to reproduce from the test plan at brave/brave-core#11894 (comment).

Steps:

  1. launched Brave with fresh profile
  2. confirmed --skus-env cmd line switch was not used at brave://version
  3. chose production for Experimental SKU Environment via brave://flags and relaunched
  4. confirmed --skus-env=production switch was set at brave://version
example example example
Screen Shot 2022-02-03 at 4 57 01 PM Screen Shot 2022-02-03 at 4 57 26 PM Screen Shot 2022-02-03 at 4 57 47 PM

Verified PASSED using

Brave 1.36.86 Chromium: 98.0.4758.87 (Official Build) beta (64-bit)
Revision e4cd00f135fb4d8edc64c8aa6ecbe7cc79ebb3b2-refs/branch-heads/4758@{#1002}
OS Windows 10 Version 21H2 (Build 19044.1466)

Followed the steps to reproduce from the test plan at brave/brave-core#11894 (comment).

Steps:

  1. launched Brave with fresh profile
  2. confirmed --skus-env cmd line switch was not used at brave://version
  3. chose production for Experimental SKU Environment via brave://flags and relaunched
  4. confirmed --skus-env=production switch was set at brave://version
example example example
20557-1 20557-2 20557-3

@Uni-verse
Copy link
Contributor

Uni-verse commented Feb 7, 2022

Verification passed on S Galaxy S21 running Android 12 using build version:

1.36.86, Chromium 98.0.4758.87

Acceptance Criteria:

  • Experimental SKU environment dropdown enabled
  • User is able to select between default, staging, development and production from the menu via brave://flags
  • The correct switch state is reflected in brave://version as --skus-env={environment} after relaunch
  • if state is default, --skus-env flag will not be displayed
Flags Menu Version
Screenshot_20220208-013633_Brave - Beta Screenshot_20220208-014340_Brave - Beta Screenshot_20220208-024222_Brave - Beta

@stephendonner
Copy link

stephendonner commented Feb 7, 2022

This is apparently not available in Linux.

Brave 1.36.86 Chromium: 98.0.4758.87 (Official Build) beta (64-bit)
Revision e4cd00f135fb4d8edc64c8aa6ecbe7cc79ebb3b2-refs/branch-heads/4758@{#1002}
OS Linux

Screen Shot 2022-02-07 at 12 21 06 PM


I see the same on my Ubuntu VM:

Brave	1.36.93 Chromium: 98.0.4758.87 (Official Build) beta (64-bit) 
Revision	e4cd00f135fb4d8edc64c8aa6ecbe7cc79ebb3b2-refs/branch-heads/4758@{#1002}
OS	Linux

Screen Shot 2022-02-15 at 8 44 52 AM

@LaurenWags
Copy link
Member

Confirmed with @bsclifton that #20557 (comment) is expected on Linux for now 👍🏻

@LaurenWags
Copy link
Member

Removed QA Pass-Win64, QA Pass-macOS, QA Pass-Android ARM since @bsclifton updated test plan.

Please see revised test plan and re-check.

cc @stephendonner @Uni-verse

@stephendonner stephendonner added the QA/In-Progress Indicates that QA is currently in progress for that particular issue label Feb 17, 2022
@stephendonner
Copy link

stephendonner commented Feb 23, 2022

QA-status update on this: I've started testing, but have run into two (related?) issues:

  1. Stripe session errors on checkout (Expired) - not 100% of the time, but more than not
  2. Neither @bsclifton nor I are seeing fetch_order_credentials from the testplan, but we are seeing refresh_order calls, as expected.

@evq has offered to help take a look; thread here: https://bravesoftware.slack.com/archives/C021S0FN3V1/p1645063771631899

Being honest and marking QA/Blocked until the above two items (and any others further) are resolved. But we have a path forward 👍

@stephendonner
Copy link

Still blocked, but by a new bug!

Worked through 1) Stripe session errors, above and encountered and filed #21314.

@bsclifton
Copy link
Member Author

Updated test plan to mention just looking for refresh_order 👍 and noted about environment issues

@stephendonner
Copy link

stephendonner commented Feb 26, 2022

Verified PASSED using

Brave 1.36.106 Chromium: 99.0.4844.45 (Official Build) (x86_64)
Revision edbc0b8343c7b10fddb0e1b4efb280b0f6e38cab-refs/branch-heads/4844@{#788}
OS macOS Version 12.3 (Build 21E5222a)

Steps:

  1. Fresh profile
  2. Visit brave://flags/#skus-environment
  3. On Windows and macOS, there should be a value here (Default, production, staging, development) and it should be configurable. Linux is not supported at this time
  4. Enable brave://flags/#skus-sdk - set this new value (brave://flags/#skus-environment) to development
  5. Exit the browser. Start Brave via command line making sure to add logging arguments --vmodule="*/skus/*"=1 --enable-logging=stderr
  6. Visit https://account.brave.software and log in (@bsclifton can help if basic auth is presented; creds are in 1PW4T or send a DM)
  7. Once logged in, buy VPN
  8. You should see (in the console where you started Brave) lots of JSON and output from calls which include refresh_order

Confirmed I was able to choose and purchase the Brave VPN Subscription.

example example example
Screen Shot 2022-02-25 at 6 37 20 PM Screen Shot 2022-02-25 at 7 56 32 PM Screen Shot 2022-02-25 at 6 39 28 PM

Also confirmed the call via debug logs to refresh_order, below:

    in skus::http::fetch with req.parts=Parts { method: GET, uri: https://payment.rewards.brave.software/v1/orders/fd546c79-fcbf-4b6e-86b6-21d46d7f1aed, version: HTTP/1.1, headers: {} }
    in skus::sdk::orders::fetch_order with self=SDK order_id="fd546c79-fcbf-4b6e-86b6-21d46d7f1aed"
    in skus::sdk::orders::refresh_order with self=SDK order_id="fd546c79-fcbf-4b6e-86b6-21d46d7f1aed"
[23487:259:0225/183920.112162:VERBOSE1:http.rs(181)]   skus::http: recieved response, resp.parts: Parts { status: 200, version: HTTP/1.1, headers: {} }, resp.body: {
  "allowedPaymentMethods": [
    "stripe"
  ],
  "createdAt": "2022-02-25T01:28:54.880453Z",
  "currency": "USD",
  "expiresAt": "2022-03-25T01:29:19.643192Z",
  "id": "fd546c79-fcbf-4b6e-86b6-21d46d7f1aed",
  "items": [
    {
      "createdAt": "2022-02-25T01:28:54.880453Z",
      "credentialType": "time-limited",
      "currency": "USD",
      "description": "Brave Firewall + VPN",
      "id": "c17ff71d-ed15-4b14-af17-bee1190afbe5",
      "issuanceInterval": null,
      "location": "vpn.brave.software",

<snip>

      },
      "orderId": "fd546c79-fcbf-4b6e-86b6-21d46d7f1aed",
      "price": "9.99",
      "quantity": 1,
      "sku": "brave-firewall-vpn-premium",

<snip>

  "status": "paid",
  "totalPrice": "9.99",
  "updatedAt": "2022-02-25T01:29:19.64124Z",
  "validFor": 2419199999989529
}

@stephendonner
Copy link

Verified PASSED using

Brave 1.36.106 Chromium: 99.0.4844.45 (Official Build) (64-bit)
Revision edbc0b8343c7b10fddb0e1b4efb280b0f6e38cab-refs/branch-heads/4844@{#788}
OS Windows 10 Version 21H2 (Build 19044.1566)

Steps:

  1. Fresh profile
  2. Visit brave://flags/#skus-environment
  3. On Windows and macOS, there should be a value here (Default, production, staging, development) and it should be configurable. Linux is not supported at this time
  4. Enable brave://flags/#skus-sdk - set this new value (brave://flags/#skus-environment) to development
  5. Exit the browser. Start Brave via command line making sure to add logging arguments --vmodule="*/skus/*"=1 --enable-logging=stderr
  6. Visit https://account.brave.software and log in
  7. Once logged in, buy VPN
  8. You should see (in the console where you started Brave) lots of JSON and output from calls which include refresh_order

Confirmed I was able to choose and purchase the Brave VPN Subscription (but not complete payment, due to #21314).

example example example
20557-1 20557-2 20557-3

Also confirmed the call to refresh_order in the logs:

    in skus::sdk::orders::fetch_order with self=SDK order_id="7ba0d87b-cb67-44c9-967e-5a2d1d944a09"
    in skus::sdk::orders::refresh_order with self=SDK order_id="7ba0d87b-cb67-44c9-967e-5a2d1d944a09"
[17168:12544:0227/162926.106:VERBOSE1:http.rs(181)]   skus::http: recieved response, resp.parts: Parts { status: 200, version: HTTP/1.1, headers: {} }, resp.body: {
  "allowedPaymentMethods": [
    "stripe"
  ],
  "createdAt": "2022-02-26T03:56:36.806886Z",
  "currency": "USD",
  "expiresAt": null,
  "id": "7ba0d87b-cb67-44c9-967e-5a2d1d944a09",
  "items": [
    {
      "createdAt": "2022-02-26T03:56:36.806886Z",
      "credentialType": "time-limited",
      "currency": "USD",
      "description": "Brave Firewall + VPN",
      "id": "c0697134-8b50-473a-9f10-ceb16ce7d9c1",
      "issuanceInterval": null,
      "location": "vpn.brave.software",

<snip>

      "orderId": "7ba0d87b-cb67-44c9-967e-5a2d1d944a09",
      "price": "9.99",
      "quantity": 1,
      "sku": "brave-firewall-vpn-premium",

<snip>

  "status": "pending",
  "totalPrice": "9.99",
  "updatedAt": "2022-02-28T00:26:58.890252Z",
  "validFor": 2419199999988986
}

@stephendonner stephendonner added QA Pass-Win64 and removed QA/In-Progress Indicates that QA is currently in progress for that particular issue QA/Blocked labels Feb 28, 2022
@stephendonner
Copy link

Verified PASSED using Brave 1.36.107, Chromium 99.0.4844.45 on a Google Pixel XL running Android 9.0.

Steps:

  1. installed 1.36.107
  2. launched Brave
  3. set brave://flags/#skus-environment to development
  4. set brave://flags/#skus-sdk to Enabled
  5. shut down Brave
  6. via the QA Preferences screen, added logging arguments --vmodule="*/skus/*"=1 --enable-logging=stderr
  7. visited https://account.brave.software and logged in
  8. tapped on Buy now under Brave VPN Subscription

Confirmed I was able to choose and purchase the Brave VPN Subscription (but not complete payment, due to #21314).

example example example
Screenshot_20220228-153713 Screenshot_20220228-155417 Screenshot_20220228-154533

Confirmed the call to refresh_order in the logs:


in skus::http::fetch with req.parts=Parts { method: GET, uri: https://payment.rewards.brave.software/v1/orders/9ccf85c0-6326-48ae-b695-855848a133a5, version: HTTP/1.1, headers: {} }
in skus::sdk::orders::fetch_order with self=SDK order_id="9ccf85c0-6326-48ae-b695-855848a133a5"
in skus::sdk::orders::refresh_order with self=SDK order_id="9ccf85c0-6326-48ae-b695-855848a133a5"
2022-02-28 15:44:40.476 7926-7926/? V/chromium: [VERBOSE1:http.rs(181)]   skus::http: recieved response, resp.parts: Parts { status: 200, version: HTTP/1.1, headers: {} }, resp.body: {
"allowedPaymentMethods": [
"stripe"
],
"createdAt": "2022-02-28T02:31:32.993697Z",
"currency": "USD",
"expiresAt": "2022-03-28T02:32:14.110416Z",
"id": "9ccf85c0-6326-48ae-b695-855848a133a5",
"items": [
{
  "createdAt": "2022-02-28T02:31:32.993697Z",
  "credentialType": "time-limited",
  "currency": "USD",
  "description": "Brave Firewall + VPN",
  "id": "b98a53bc-7d8f-4246-a146-3d401fcf38ff",

 <snip>

  "orderId": "9ccf85c0-6326-48ae-b695-855848a133a5",
  "price": "9.99",
  "quantity": 1,
  "sku": "brave-firewall-vpn-premium",
  "subtotal": "9.99",
  "updatedAt": "2022-02-28T02:31:32.993697Z",
  "validFor": null,
  "validForIso": "P1M"
}
],
"lastPaidAt": "2022-02-28T02:32:14.110427Z",
"location": "vpn.brave.software",
"merchantId": "brave.com",
"metadata": {
"stripeSubscriptionId": "sub_1KXz1yHof20bphG62kI8dF36"
},
"status": "paid",
"totalPrice": "9.99",
"updatedAt": "2022-02-28T02:32:14.108498Z",
"validFor": 2419199999988623
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment