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

WS plan type and upgrade common features view Pages #53343

Merged

Conversation

jayeshmangwani
Copy link
Contributor

@jayeshmangwani jayeshmangwani commented Nov 30, 2024

Explanation of Change

Fixed Issues

$ #51768
PROPOSAL:

Tests

Test 1: Plan Type

  1. Go to Workspaces -> Workspace -> Profile.
  2. If the user has admin access, they will see the Plan Type tab under the Company address menu item.
  3. Click on Plan Type to open a new RHP screen for Plan Type
  4. Verify that the current workspace plan is preselected.

Test 2: For Locked Plan Type

Precondition: The user must have an active annual Control Plan subscription and must have been billed at least once.

  1. Navigate to Workspaces -> Workspace -> Profile.
  2. If the user has admin access, they will see the Plan Type tab located under the Company Address menu item.
  3. Click on Plan Type to open a new RHP screen for Plan Type
  4. Verify that user can see the Locked Plan Type UI.
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as Tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android.mov
Android: mWeb Chrome
mweb-chrome.mov
iOS: Native
ios.mov
iOS: mWeb Safari
mweb-safari.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov

@DylanDylann
Copy link
Contributor

@jayeshmangwani @carlosmiceli How can we handle this PR to get it merged? Should we create a flag to hide this feature and only display these pages when all done

@jayeshmangwani
Copy link
Contributor Author

Should we create a flag to hide this feature and only display these pages when all done

Yes, that sounds correct to me. We can either hide this feature by hardcoding it
OR
Do not merge this PR until our downgrade logic is implemented. In that case, you would need to create a new branch from this PR to reuse the WS plan type page.

@jayeshmangwani
Copy link
Contributor Author

Hi @carlosmiceli , Following this discussion https://expensify.slack.com/archives/C02NK2DQWUX/p1731682677445059 , we concluded that we will display the locked plan UI only if the user has an annual control plan and their first billing is completed. I'll need your help to determine from the backend whether the first billing has been completed for the user.

Which parameter would be best to use to get this status? I noticed the retry_billing_success NVP, but I wanted to confirm if this can be used for this purpose or if there's another NVP that would be more suitable.

@carlosmiceli
Copy link
Contributor

Gotcha! Let me find that for you and report back.

@DylanDylann
Copy link
Contributor

@carlosmiceli we also need to confirm the next step on this problem

@DylanDylann
Copy link
Contributor

Yes, that sounds correct to me. We can either hide this feature by hardcoding it

this option looks fine to me because of simpleness

@carlosmiceli
Copy link
Contributor

this option looks fine to me because of simpleness

Sounds good, once it's all ready to be tested in dev we can change the hardcoded code. Let's make sure to add a comment where we do it.

@jayeshmangwani jayeshmangwani marked this pull request as ready for review December 3, 2024 16:18
@jayeshmangwani jayeshmangwani requested a review from a team as a code owner December 3, 2024 16:18
@jayeshmangwani
Copy link
Contributor Author

Great @carlosmiceli @DylanDylann!
I've added a function to hide the plan type button. We'll enable it for testing, and once the downgrade API is implemented and tested, we'll remove this function altogether and display the button.

@carlosmiceli
Copy link
Contributor

@jayeshmangwani it's looking like this will need a BE change, and we can send a firstBilling bool to show/hide the UI. Which API's response would we need to modify?

@carlosmiceli
Copy link
Contributor

@jayeshmangwani bump ☝️

@jayeshmangwani
Copy link
Contributor Author

@carlosmiceli I'm not entirely sure, but in my opinion, we may need to create a new command for this. The command would return the firstBilling value under the nvp_private_subscription key, similar to how we've implemented the OpenSubscriptionPage. What do you think about creating a new command, OpenWorkspacePlanPage, which would return the current nvp_private_subscription value with the new firstBilling key included?

@carlosmiceli
Copy link
Contributor

@jayeshmangwani I like that idea, just asked in Slack for some feedback in case there's some risk I'm not seeing, will report back.

@carlosmiceli
Copy link
Contributor

carlosmiceli commented Dec 7, 2024

@jayeshmangwani a couple of questions to confirm, I'm building the new command:

  • Is firstBilling a date, or is it a bool and it should be called something like isFirstBillingComplete?
  • You don't need the placeholder values for this text to come back in the response, right? How are we getting those values?

@carlosmiceli carlosmiceli self-requested a review December 7, 2024 18:12
@jayeshmangwani
Copy link
Contributor Author

@carlosmiceli

  1. Yes, it should be a boolean value, and isFirstBillingComplete will work.
  2. Currently, we are retrieving the endDate value from the nvp_private_subscription key. This data is provided by the ReconnectApp and OpenApp APIs, and it is also updated via the OpenSubscriptionPage command.

I’m attaching the responses below from the ReconnectApp and OpenSubscriptionPage for the nvp_private_subscription key.

ReconnectApp Response
{
  "key": "nvp_private_subscription",
  "onyxMethod": "merge",
  "value": {
      "autoRenew": true,
      "autoRenewLastChangedDate": "2024-12-04 06:41:53",
      "endDate": "2025-12-01",
      "startDate": "2024-12-01",
      "type": "yearly2018"
  }
},
OpenSubscriptionPage Response
{
  "accountID": 12685249,
  "authToken": "659A2AF019C7E6EDCF97155BDBA5FD7B64C7065A4FF42E993A3DE454E16BF899E0E39ABA9D72BA0B31DC0677DE570A580C20F31F915E62F5DEE7131EAF29075741EAD2A2D3518AD76C63F30FD1B8B0AB15BD4ACABDE076DB3C9BB91EAED7A4C84AFDBA2261E80EBB663803BAC09D0B0E515C94FD4ADE2310F3752232BDA5C62B35169405D888CB15ACBB9E707B063CA69D4AC3F8558F9F9CBB2913628A59A9128E51E4E498D2A930FB0AFAECA5F5BB2E24A2DCE238AC0A9FF305D701F93BF37A0C9A0CE54E9887EAE296B65F9608012A66AABF993433A38F28EB2FC7CB74273845251C601D4EE7F16E54A28698FDF6AEAE03B14D1A972506D7DF224FF000C7D07EA6F3799373A991B6D794AD3136B43BD1ED6E1CF154B3E2AF16E4951BA0F6892A3886697C5B89684124112C3E8D5E5347AB683EF5501A9C9F3BB6626DFDE1858E4115C5F1A2349292CF6E175C920546304530AC4F0FE85E6108CF440A87F862",
  "email": "[email protected]",
  "onyxData": [
      {
          "key": "nvp_private_subscription",
          "onyxMethod": "merge",
          "value": {
              "autoRenew": true,
              "autoRenewLastChangedDate": "2024-12-04 06:41:53",
              "endDate": "2025-12-01",
              "startDate": "2024-12-01",
              "type": "yearly2018"
          }
      },
      {
          "key": "nvp_private_amountOwed",
          "onyxMethod": "merge",
          "value": 2000
      },
      {
          "key": "nvp_private_stripeCustomerID",
          "onyxMethod": "merge",
          "value": null
      },
      {
          "key": "nvp_private_billingDisputePending",
          "onyxMethod": "merge",
          "value": null
      },
      {
          "key": "nvp_private_billingStatus",
          "onyxMethod": "merge",
          "value": {
              "action": "failed",
              "periodMonth": 10,
              "periodYear": 2024
          }
      },
      {
          "key": "nvp_private_billingGracePeriodEnd",
          "onyxMethod": "merge",
          "value": 1730903003
      },
      {
          "key": "nvp_private_disableAutoRenewReasons",
          "onyxMethod": "merge",
          "value": null
      },
      {
          "key": "nvp_private_cancellationDetails",
          "onyxMethod": "merge",
          "value": null
      },
      {
          "key": "account",
          "onyxMethod": "merge",
          "value": {
              "canDowngrade": true,
              "hasPurchases": true,
              "isApprovedAccountant": false,
              "isApprovedAccountantClient": false,
              "isEligibleForRefund": false
          }
      },
      {
          "key": "fundList",
          "onyxMethod": "merge",
          "value": {}
      }
  ],
  "httpCode": 200,
  "jsonCode": 200,
  "authResponseMessage": "200 OK",
  "requestID": "8eea18b36e7f3b8b-BOM"
}

@carlosmiceli carlosmiceli changed the title WS plan type and upgrade common features view Pages [HOLD #44691] WS plan type and upgrade common features view Pages Dec 9, 2024
@carlosmiceli
Copy link
Contributor

@jayeshmangwani both BE PRs are now in review, but here's how it works so you can make the changes to this and other PRs that need this command:

  • The command name is OpenWorkspacePlanPage.
  • You'll need to send the policyID so we can confirm the user is admin.
  • The response will include a canDowngrade key instead of firstBilling.

@jayeshmangwani
Copy link
Contributor Author

@carlosmiceli @DylanDylann, New command was added to the PR, but now many files are failing ESLint due to this new rule default-value-for-inexistent-IDs. We've already made changes to 20+ files on this PR and several of them failing ESLint. Currently, I’m working on fixing these ESLint issues.

@carlosmiceli
Copy link
Contributor

Thanks for the update Jayesh! Let us know if you need more help.

@jayeshmangwani
Copy link
Contributor Author

@DylanDylann I've resolved the ESLint errors in our PR related to the default string. Feel free to review the changes and share your feedback.

@DylanDylann
Copy link
Contributor

@jayeshmangwani All good. But we got conflict

@jayeshmangwani
Copy link
Contributor Author

Thanks for review @DylanDylann 🙌 , I've merged the main and resolved the conflicts.

@DylanDylann
Copy link
Contributor

@carlosmiceli All yours

@carlosmiceli carlosmiceli merged commit 154a485 into Expensify:main Dec 19, 2024
16 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@jayeshmangwani
Copy link
Contributor Author

Note: QA won't be able to test this feature yet, as it's still ongoing. We need to implement the downgrade API before it's ready for testing.

Copy link
Contributor

🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 cancelled 🔪
🖥 desktop 🖥 cancelled 🔪
🍎 iOS 🍎 cancelled 🔪
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 cancelled 🔪
🍎🔄 iOS HybridApp 🍎🔄 cancelled 🔪

Copy link
Contributor

🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 success ✅

2 similar comments
Copy link
Contributor

🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Copy link
Contributor

🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Copy link
Contributor

🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 success ✅
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Copy link
Contributor

🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 success ✅
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Copy link
Contributor

🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 success ✅
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Copy link
Contributor

🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.78-6 🚀

platform result
🤖 android 🤖 true ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants