Skip to content

Fix - QBO - Push input is not cleared when the export method is changed to an export method that has no accounts available. #58370

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

Conversation

FitseTLT
Copy link
Contributor

@FitseTLT FitseTLT commented Mar 13, 2025

Details

Fixed Issues

$ #57548
PROPOSAL: #57548 (comment)

Tests

Precondition:
You will test it a workspace with QBO integration which have an export destination with no account payable.

  1. Verify that RBR is shown all the way from Settings > Workspace > the linked workspace with the qbo connection > Accounting > Export > Export out of pocket expenses as
  2. Press Accounting > Export > Export out of pocket expenses as
  3. Verify that choose a valid account for the export error message is displayed
  4. Press on Export as
  5. Choose an export destination that has no account payable linked to it
  6. Verify that an error message is displayed and selecting it is forbidden
  7. Now choose an export destination with account payable linked to it
  8. Verify that it is selected and all the errors and RBR above disappear
  • Verify that no errors appear in the JS console

Offline tests

Same as above

QA Steps

Same as above

  • 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
    • 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 approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • 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(themeColors.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 form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label 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
a.mp4
Android: mWeb Chrome
aw.mp4
iOS: Native
i.mp4
iOS: mWeb Safari
iw.mp4
MacOS: Chrome / Safari
2025-03-12.21-16-30.mp4
MacOS: Desktop
d.mp4

@FitseTLT FitseTLT requested a review from a team as a code owner March 13, 2025 13:19
@melvin-bot melvin-bot bot requested review from hoangzinh and removed request for a team March 13, 2025 13:19
Copy link

melvin-bot bot commented Mar 13, 2025

@hoangzinh 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]

@hoangzinh
Copy link
Contributor

@FitseTLT just wanna confirm, is it PR ready for review?

@FitseTLT
Copy link
Contributor Author

Yes @hoangzinh It might also help to tag design team cc @trjExpensify

@trjExpensify trjExpensify requested a review from a team March 17, 2025 12:01
@trjExpensify
Copy link
Contributor

Yes @hoangzinh It might also help to tag design team cc @trjExpensify

Done. Your vid in the OP has a couple of notes that will be helpful to clarify probably, as they confused me initially as being a bit unexpected:

  • You had debug mode enabled. That's why we see that "extra" error in the bottom of the LHN.
  • You were also in offline mode, right? That's why we see the changed "Journal entry" values in 50% opacity once selected?

@FitseTLT
Copy link
Contributor Author

Yes @hoangzinh It might also help to tag design team cc @trjExpensify

Done. Your vid in the OP has a couple of notes that will be helpful to clarify probably, as they confused me initially as being a bit unexpected:

  • You had debug mode enabled. That's why we see that "extra" error in the bottom of the LHN.
  • You were also in offline mode, right? That's why we see the changed "Journal entry" values in 50% opacity once selected?

Yes but on android native its online test 👍

@shawnborton
Copy link
Contributor

@trjExpensify what are your thoughts on this one? I am very confused by the video tbh... like if you can't select anything here, than why is an option already selected?
CleanShot 2025-03-17 at 15 47 06@2x

@trjExpensify
Copy link
Contributor

It's possible that you had vendor bill selected as the export destination and then removed the A/P account in QBO after which would cause the error. I also think vendor bill export is the default export destination on initial connection, and so if you don't have an A/P account in QBO, you have the error as well.

The whole thing is a little edge casey, but I stumbled upon it when I joined a call with Ryan and a custy the other week. Without the logs and looking at OldDot, they had no way of knowing the config mishap as we weren't surfacing any errors in the NewDot front-end for it.

@shawnborton
Copy link
Contributor

Got it, thanks for the explanation. If you are cool with it, I think I am cool with it. I would love a clean video though that doesn't have the offline mode stuff, because that is really tripping me up when trying to evaluate the whole flow.

@FitseTLT
Copy link
Contributor Author

Here it is :

a.mp4

@shawnborton
Copy link
Contributor

shawnborton commented Mar 17, 2025

Why do we see the error under Accounts payable here:
CleanShot 2025-03-17 at 18 19 36@2x

But then as soon as you choose Export as > Journal entry, it looks like we populate that row with a value:
CleanShot 2025-03-17 at 18 21 18@2x

Just checking, is that expected? Again, I am not too familiar with what is going on here so just calling that out as it felt a bit odd to me. Thoughts @trjExpensify?

@trjExpensify
Copy link
Contributor

Yeah, it's expected. Different export destinations have different accounts that are valid for that type.

Why do we see the error under Accounts payable here:

When your export destination is Vendor bill, A/P accounts from QBO are returned in this field. The user doesn't have any A/P accounts in QBO and therefore we see the error.

But then as soon as you choose Export as > Journal entry, it looks like we populate that row with a value:

These are valid journal entry accounts for the Journal entry export destination. The user has some of these in QBO, so there's no error. IIRC, with both OldDot and NewDot, we populate the first account in the list of valid accounts returned. That part is untouched here anyhow.

@shawnborton
Copy link
Contributor

Okay cool, appreciate the explanation as always - I rest my case :) Let's move forward with getting this merged.

errorRowStyles={[styles.ph5, styles.pv3]}
onClose={() => clearQBOErrorField(policyID, CONST.QUICKBOOKS_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION)}
onClose={() => {
setSelectedAccountError(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to clear selectedAccountError state on close here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Otherwise the selected account error wouldn't be cancelable.

@hoangzinh
Copy link
Contributor

hoangzinh commented Mar 18, 2025

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (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
    • 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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • 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.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • 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.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native
Screen.Recording.2025-03-19.at.18.58.53.android.mov
Android: mWeb Chrome
Screen.Recording.2025-03-19.at.18.47.50.android.chrome.mov
iOS: Native
Screen.Recording.2025-03-19.at.19.10.42.mov
iOS: mWeb Safari
Screen.Recording.2025-03-19.at.19.01.52.ios.safari.mov
MacOS: Chrome / Safari
Screen.Recording.2025-03-19.at.17.58.08.web.mov
MacOS: Desktop
Screen.Recording.2025-03-19.at.18.34.45.desktop.mov

@hoangzinh
Copy link
Contributor

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:

@FitseTLT can you complete this checklist? Thank you.

@FitseTLT
Copy link
Contributor Author

Done @hoangzinh

Copy link
Contributor

@hoangzinh hoangzinh left a comment

Choose a reason for hiding this comment

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

LGTM

@melvin-bot melvin-bot bot requested a review from yuwenmemon March 19, 2025 23:37
@yuwenmemon yuwenmemon merged commit 524c4e8 into Expensify:main Mar 20, 2025
18 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.

Copy link
Contributor

🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.1.16-0 🚀

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

@IuliiaHerets
Copy link

Hello @FitseTLT. Can you please help us, should we use some specific account or did some preconditions for checking this PR?
We don't have a "not configured" or "no account payable" at - Settings > Workspace > the linked workspace with the qbo connection > Accounting > Export > Export out of pocket expenses as using expensifail account

bandicam.2025-03-21.12-34-46-457.mp4

@FitseTLT
Copy link
Contributor Author

Yeah @IuliiaHerets it looks like all the export destinations in your video have payable accounts. But for me it is easy to reproduce; In OD I integrate any workspace with QBO and I will not finish the final settings part in OD because it will not allow me a destination without A/P. Now opening ND will have no export destination selected and selecting a destination without A/P will show an error. cc @trjExpensify

2025-03-21.15-25-51.mp4

@hoangzinh
Copy link
Contributor

@IuliiaHerets we can set it in OD. Here are steps:

  1. Go to OD
  2. Go to a WS that connected to QBO
  3. Open Chrome dev tool
  4. Type in console
p = Policy.getCurrent()
p.policy.connections.quickbooksOnline.config.reimbursableExpensesAccount = null;
p.save();
  1. Go back to ND to continue test

(Note: Sometimes, it will make QBO integration broken and we can't update Export out-of-pocket expenses, please try to disconnect and reconnect again to auto fix)

Screen.Recording.2025-03-21.at.19.26.44.mov

@IuliiaHerets
Copy link

@FitseTLT @hoangzinh QA team can only complete the PR steps from 1 - 4. Number 5 triggers the mentioned issue (Note: Sometimes, it will make QBO integration broken and we can't update Export out-of-pocket expenses, please try to disconnect and reconnect again to auto fix)
We have tried disconnecting and reconnecting 7-8 times now. Reconnecting clears the RBR so the expected error in step 6 isn't appearing. If we do the console trick in OD, we are breaking the QBO connection again.

bandicam.2025-03-21.14-07-01-985.mp4

@FitseTLT
Copy link
Contributor Author

In that case I think you guys need a brand new QBO connection/company that doesn't have Account Payable linked to some of the export destinations. That's exactly the target of the PR so you can't test it on QBO company which has A/P linked to all export destinations.

@hoangzinh
Copy link
Contributor

or you can try on a new/another workspace @IuliiaHerets

@IuliiaHerets
Copy link

IuliiaHerets commented Mar 21, 2025

@FitseTLT @hoangzinh Tester has already tested with a new WS and a brand new Gmail account but he got the same results.
There's only one company that he can connect to when setting up the QBO connection and that one has A/P options linked. How we can connected to another company?

bandicam.2025-03-21.19-08-08-513.mp4

Copy link
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 9.1.16-4 🚀

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

@hoangzinh
Copy link
Contributor

@IuliiaHerets just wanna confirm if you still can't update Export out-of-pocket expenses even though you tried on a brand new account or WS, can you?

@IuliiaHerets
Copy link

@hoangzinh yes, we can't

@hoangzinh
Copy link
Contributor

@yuwenmemon are you available to help us in this case? @IuliiaHerets found it hard to set up a WS that has A/P as null, then I suggested a trick here, it worked fine in my end (for Contributor Plus QBO account). @IuliiaHerets tried the same but then her QBO integration got broken (her recording here). Can you take a look and suggest to @IuliiaHerets what she should do to fix it? Thank you.

@yuwenmemon
Copy link
Contributor

Sorry - don't think we have to worry about getting them set up to test it. It's an edge case bug anyway. Let's just move on 👍

@hoangzinh hoangzinh mentioned this pull request Apr 8, 2025
50 tasks
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.

7 participants