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

Use new multi config edit command #41627

Merged
merged 15 commits into from
May 16, 2024

Conversation

aldo-expensify
Copy link
Contributor

@aldo-expensify aldo-expensify commented May 3, 2024

Details

Sometimes changing a connections configuration translate in multiple keys being edited. Currently, the existing command UpdatePolicyConnectionConfig only supports updating one key at a time, which eventually produced work arounds that break 1:1:1.

This PR is adding a new UpdateManyPolicyConnectionConfigurations command that takes a partial connection config object to edit multiple settings in one call. An example of this is:

  • If you change the Out-of-pocket account type from CHECK to BILL, then you also need to update the selected account.

Needs:

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/390731
PROPOSAL:

Tests

  1. Have a workspace with QBO connected.
  2. Go to "Export > Export out-of-pocket-expenses as"
  3. Change the "Export as" value between the 3 options
  4. Verify that the selected account updates choosing the first available from the new valid values
  5. Change the setting "Export company cards as" to "Credit Card"
  6. Verify that the account selected changed to a valid account
  7. Change the setting "Export company cards as" to "Vendor Bill"
  8. Verify that setting "Default vendor" appeared
  9. Verify that when "Default vendor" is toggled, you see the setting "Vendor"
  10. Verify that when "Default vendor" is toggled, "Vendor" gets the first value selected by default
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  • 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 the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • 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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2024-05-14.at.1.59.52.PM.mov
MacOS: Desktop

@hayata-suenaga
Copy link
Contributor

Just a heads-up, there is a PR to update screens related to the company card export options. If that PR is merged first, there might be quite a lot of merge conflicts on these pages 🙇

@@ -49,19 +56,34 @@ function QuickbooksCompanyCardExpenseAccountSelectCardPage({policy}: WithPolicyC
value: CONST.QUICKBOOKS_NON_REIMBURSABLE_EXPORT_ACCOUNT_TYPE.VENDOR_BILL,
keyForList: CONST.QUICKBOOKS_NON_REIMBURSABLE_EXPORT_ACCOUNT_TYPE.VENDOR_BILL,
isSelected: CONST.QUICKBOOKS_NON_REIMBURSABLE_EXPORT_ACCOUNT_TYPE.VENDOR_BILL === nonReimbursableExpensesExportDestination,
accounts: accountPayable ?? [],
defaultVendor: vendors?.[0]?.id ?? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^ that's referring to the toggle for default vendor being off by default when you connect to QBO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes off -> NONE 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool yes, the toggle should be off (and the Vendor push input not shown) until the user toggles Default vendor on. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may be misunderstanding the code, this is the default value that will be used if the account type changes to VENDOR_BILL. I understand that in that case we should select the first vendor.

@@ -40,31 +42,45 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec
keyForList: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK,
isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK,
isShown: !isLocationsEnabled,
accounts: bankAccounts || [],
},
{
value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY,
text: translate(`workspace.qbo.accounts.journal_entry`),
keyForList: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY,
isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY,
isShown: !isTaxesEnabled || isLocationsEnabled,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
isShown: !isTaxesEnabled || isLocationsEnabled,
isShown: !isTaxesEnabled,

When syncTax is set to true, the Journal Entry option should not be displayed, even if Location import is enabled.

If we commit this change, however, there won't be any option displayed when both the tax import and location import are enabled. I think this is the expected behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds unrelated to this PR.

@hayata-suenaga hayata-suenaga changed the title Use new multi config edit command [HODL until May 10] Use new multi config edit command May 8, 2024
@hayata-suenaga hayata-suenaga changed the title [HODL until May 10] Use new multi config edit command Use new multi config edit command May 10, 2024
@aldo-expensify aldo-expensify self-assigned this May 14, 2024
@aldo-expensify aldo-expensify marked this pull request as ready for review May 14, 2024 21:04
@aldo-expensify aldo-expensify requested a review from a team as a code owner May 14, 2024 21:04
@melvin-bot melvin-bot bot removed the request for review from a team May 14, 2024 21:04
Copy link

melvin-bot bot commented May 14, 2024

@ishpaul777 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot requested a review from ishpaul777 May 14, 2024 21:04
@aldo-expensify
Copy link
Contributor Author

@trjExpensify @hayata-suenaga this is ready for review again. For details about translations, lets address them in a separate follow up. I don't want this running into conflicts and hold on unrelated already existing bugs.

@hayata-suenaga
Copy link
Contributor

hayata-suenaga commented May 15, 2024

is there any steps to get the "Accounts Payable"/ "Vendors" List @aldo-expensify

@ishpaul777, do you have Location import and tax import enabled at the same time?

@hayata-suenaga
Copy link
Contributor

if that happens (although very unlikely), there won't be any available option on the list of account options

@ishpaul777
Copy link
Contributor

ishpaul777 commented May 15, 2024

no Location import is disabled is disabled, where's tax import 🤔

Screenshot 2024-05-16 at 2 52 42 AM

@ishpaul777
Copy link
Contributor

is there any config i need to do in QBO account i just completed the onboarding for QBO

@ishpaul777
Copy link
Contributor

Code wise looks good to me!, just need to do thorough testing and complete videos, will check back again tomorrow in my morning

@aldo-expensify
Copy link
Contributor Author

is there any steps to get the "Accounts Payable"/ "Vendors" List @aldo-expensify

I get them without doing any extra action, but maybe it depends on the QBO account used for testing? I used qa@expensify.com

@aldo-expensify
Copy link
Contributor Author

is there any config i need to do in QBO account i just completed the onboarding for QBO

Sorry, I really have no idea of how to setup this account properly... I just use one that was already there.

@aldo-expensify
Copy link
Contributor Author

Code wise looks good to me!, just need to do thorough testing and complete videos, will check back again tomorrow in my morning

I would prefer ideally to not have to wait until tomorrow for testing this. @hayata-suenaga can you test this in web and then we merge?

@hayata-suenaga
Copy link
Contributor

testing now...

@hayata-suenaga
Copy link
Contributor

Tested well 🎉

Screen.Recording.2024-05-15.at.9.55.13.PM.mov

@hayata-suenaga
Copy link
Contributor

checked off the remaining items on the checklist

@hayata-suenaga hayata-suenaga merged commit e9cf0c5 into main May 16, 2024
15 checks passed
@hayata-suenaga hayata-suenaga deleted the aldo_use-new-multi-config-edit-command branch May 16, 2024 04:59
@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.

@aldo-expensify
Copy link
Contributor Author

Thank you @hayata-suenaga for the quick work 🙇

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/hayata-suenaga in version: 1.4.75-0 🚀

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

@hayata-suenaga
Copy link
Contributor

@trjExpensify
Copy link
Contributor

Commented here, wondering if this has introduced a regression: https://expensify.slack.com/archives/C036QM0SLJK/p1716547626337039?thread_ts=1716238564.568549&cid=C036QM0SLJK

@hayata-suenaga
Copy link
Contributor

Commented here, wondering if this has introduced a regression: https://expensify.slack.com/archives/C036QM0SLJK/p1716547626337039?thread_ts=1716238564.568549&cid=C036QM0SLJK

responded in Slack

also I think @rushatgabhane reverted this PR and tested and confirmed that this PR is not the cause for the issue

@rushatgabhane
Copy link
Member

@hayata-suenaga i wouldn't rely on my test because my account might have an issue

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.75-1 🚀

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

@s77rt s77rt mentioned this pull request May 31, 2024
49 tasks
@ishpaul777
Copy link
Contributor

hello @trjExpensify Can you please help with payment for this PR review i dont see a E/app issue associated with this PR

@aldo-expensify
Copy link
Contributor Author

@trjExpensify should I create an App issue just to handle the payment? or can we do it skipping that?

@trjExpensify
Copy link
Contributor

Ordinarily, but it's fine. I'll do it here.

Payment summary as follows:

Offer sent!

@trjExpensify
Copy link
Contributor

Paid!

@ishpaul777
Copy link
Contributor

Thank you!

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

Successfully merging this pull request may close these issues.

6 participants