Skip to content

[Payment due @mkhutornyi] Allow clearing the Default Vendor by re-selecting it (CC/DC export only)#96227

Open
Beamanator wants to merge 5 commits into
mainfrom
beaman-clear-default-vendor
Open

[Payment due @mkhutornyi] Allow clearing the Default Vendor by re-selecting it (CC/DC export only)#96227
Beamanator wants to merge 5 commits into
mainfrom
beaman-clear-default-vendor

Conversation

@Beamanator

@Beamanator Beamanator commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

On accounting integrations where the non-reimbursable export destination is Credit Card / Debit Card, blank Default Vendor has a defined UX — expenses without a vendor export to "Credit Card Misc". But once a Default Vendor is set on those export paths, there's no way to clear it: tapping the currently-selected row is a silent no-op that just navigates back. This blocks vendor-matching CC beta testers who need to reset workspaces between test scenarios.

This change lets the user re-tap the currently-selected vendor to clear it, but only on the CC/DC export paths:

  • QBO shared QuickbooksNonReimbursableVendorSelectPage: gated on configKey === 'nonReimbursableCreditCardDefaultVendor'. The Bill entry point of the same shared page keeps its existing behavior.
  • Sage Intacct DynamicSageIntacctDefaultVendorPage: gated on settingName === CONST.SAGE_INTACCT_CONFIG.NON_REIMBURSABLE_CREDIT_CARD_VENDOR. The Bill and reimbursable variants keep their existing behavior.

Vendor Bill export paths are intentionally out of scope — blank on those integrations means "use the report submitter" and is set by disabling the parent Default Vendor toggle rather than by clearing the vendor from this list. QBD, NetSuite, and Certinia only support Vendor Bill export, so they're not touched.

Xero doesn't have a Default Vendor selector today; it will be added as part of the broader vendor-matching project.

Backend paths verified end-to-end:

  • QBO'NONE' for nonReimbursableCreditCardDefaultVendor has an existing frontend precedent: DynamicQuickbooksCompanyCardExpenseAccountPage.tsx#L128-L135 already sends the NONE sentinel to clear the bill default vendor.
  • Sage Intacct — traced the empty-string write through all three layers:
    • Web-Expensify api.php:3361-3367: UpdateSageIntacctNonreimbursableExpensesCreditCardChargeExportDefaultVendor reads $_REQUEST['vendorID'] ?? '' and forwards to PolicyAPI::updateManyPolicyConnectionConfigurations — no validation.
    • PolicyAPI::updateManyPolicyConnectionConfigurations only special-cases autoSync.enabled; passes everything else through to Auth — no validation.
    • Auth's UpdateManyPolicyConnectionConfigurations enforces JSON-type consistency between current and new value. This field is typed string in Onyx and App only ever writes strings (real vendor ID or ''), so STRING → STRING passes the check. Persistence is a straight JSONB_PATCH — the empty string is stored as-is.

Known limitation — OldDot's Intacct export view clears this field by writing JSON null, not ''. If a workspace previously cleared the vendor from OldDot, the stored value is null and the NewDot clear (empty string) would fail Auth's type check with 400 Current value and new value are using different types. In practice this is rare — OldDot doesn't support vendor matching, so anyone actively using the CC/DC vendor default is already on NewDot — but flagging it as a known edge case.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/659748
PROPOSAL: https://github.com/Expensify/Expensify/issues/659748#issuecomment-4985966633

Tests

QBO — Credit Card export path:

  1. Open a workspace with QBO connected.
  2. Under the QBO Export settings, set the non-reimbursable export destination to Credit Card (or Debit Card).
  3. Enable the Default Vendor toggle and pick any vendor.
  4. Open the Default Vendor row again and tap the currently-selected vendor.
  5. Verify the vendor is now cleared — the row shows no default vendor and re-opening the selector shows no row highlighted.

QBO — Vendor Bill export path (regression check, should NOT toggle):

  1. Same workspace, change the non-reimbursable export destination to Vendor Bill.
  2. Enable the Default Vendor toggle and pick a vendor.
  3. Open the Default Vendor row and tap the currently-selected vendor.
  4. Verify tapping the currently-selected vendor does nothing — the vendor stays selected.

Sage Intacct — Credit Card Charge path:

  1. Open a workspace with Sage Intacct connected.
  2. Set the non-reimbursable export type to Credit Card Charge.
  3. Pick any Default Vendor.
  4. Re-open the Default Vendor list and tap the currently-selected vendor.
  5. Verify the vendor is now cleared.

Sage Intacct — Vendor Bill / Reimbursable paths (regression check, should NOT toggle):

  1. Same workspace, switch to non-reimbursable Vendor Bill (or open the reimbursable Default Vendor selector).
  2. Pick a Default Vendor and then tap it again in the selector.
  3. Verify the vendor stays selected — no clear.
  • Verify that no errors appear in the JS console

Offline tests

  1. On QBO with CC/DC export, set a Default Vendor while online.
  2. Turn off network connection.
  3. Tap the currently-selected vendor.
  4. Verify the row updates optimistically to a cleared state.
  5. Turn network back on and verify the change persists.

QA Steps

Same as tests - tag me & @heyjennahay to perform these and the rest of the Vendor Matching for CC Expenses flows

  • 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 (Vendor Bill regression check ensures the Bill path is untouched)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions
  • 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
  • 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 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 that was added to the app is grammatically correct in English.
  • 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
  • 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
  • If new assets were added or existing ones were modified
  • If the PR modifies code that runs when editing or sending messages
  • If the PR modifies a generic component
  • If the PR modifies a component related to any of the existing Storybook stories
  • If the PR modifies a component or page that can be accessed by a direct deeplink
  • If the PR modifies the UI or modifies the form input styles
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user 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.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Tapping the currently-selected vendor on any accounting integration's
Default Vendor selector now clears it. Previously the guarded update
call skipped this case, leaving no path to unset the field from the UI.

QBO and QBD send CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE; Sage Intacct,
Certinia, and NetSuite send an empty string.

Fixes Expensify/Expensify#659748
@Beamanator
Beamanator requested review from a team as code owners July 15, 2026 22:51
@melvin-bot
melvin-bot Bot requested a review from Eskalifer1 July 15, 2026 22:51
@melvin-bot

melvin-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

@Eskalifer1 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 review from trjExpensify and removed request for a team July 15, 2026 22:51
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...port/QuickbooksNonReimbursableVendorSelectPage.tsx 0.00% <0.00%> (ø)
...cct/export/DynamicSageIntacctDefaultVendorPage.tsx 0.00% <0.00%> (ø)
... and 96 files with indirect coverage changes

Comment thread src/pages/workspace/accounting/certinia/export/CertiniaDefaultVendorPage.tsx Outdated
@Beamanator

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: f037fc3d1b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Beamanator Beamanator added the InternalQA This pull request required internal QA label Jul 15, 2026
@Beamanator

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 9c7dcfdcec

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Eskalifer1

Copy link
Copy Markdown
Contributor

Hi @Beamanator, let me know when this is ready for review, thank you!

@Beamanator

Copy link
Copy Markdown
Contributor Author

Sounds good @Eskalifer1 - actually this requires being added to the vendorMatching beta and setting up an accounting integration, have you done that before? :D If not i can ask someone else!

@Eskalifer1

Copy link
Copy Markdown
Contributor

Oh, i hadn't done it before. Feel free to reassign. Thank you!

@Beamanator
Beamanator requested review from mkhutornyi and removed request for Eskalifer1 July 16, 2026 14:22
@Beamanator

Copy link
Copy Markdown
Contributor Author

Thanks for the quick response @Eskalifer1 , and thanks @mkhutornyi for volunteering to take over!

@trjExpensify trjExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm, not sure about this. For export with vendor bills, you must have a vendor chosen for export. So I don't know why we'd let you deselect a vendor to have no vendor selected. CC: @heyjennahay

@Beamanator

Copy link
Copy Markdown
Contributor Author

minnnnteresting - @trjExpensify i'll tag you in slack here :D https://expensify.slack.com/archives/C03TME82F/p1784118449309309

if (row.value !== nonReimbursableBillDefaultVendor) {
updateQuickbooksDesktopNonReimbursableBillDefaultVendor(policyID, row.value, nonReimbursableBillDefaultVendor);
}
const newValue = row.value === nonReimbursableBillDefaultVendor ? (CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE as string) : row.value;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

as string cast here looks unnecessary.

@Beamanator

Beamanator commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@mkhutornyi i'm so sorry, i just asked you to review but can you pause reviewing this one for now? Just will we get @trjExpensify 's comment(s) sorted 🙏 [we're discussing in slack]

@heyjennahay

Copy link
Copy Markdown
Contributor

My understanding of the way it works:

  1. if you have vendor bills selected as your export method and you leave the default vendor disabled (i.e. blank) then your export will use the report submitter as the vendor
  2. if you have credit card or debit card selected as your export method and you leave the default vendor blank then your expenses without a vendor will export to Credit Card Misc

So the system is actually built to handle no vendor being set for both export types and in fact, default vendor is disabled by default for vendor bills

image

Blank default vendor has a defined UX only on the CC/DC export path
(falls back to "Credit Card Misc"). For Vendor Bill export, blank
falls back to the report submitter and is set by disabling the parent
toggle, so re-tapping to clear is out of scope. Per team alignment on
https://expensify.slack.com/archives/C03TME82F/p1784118449309309, the
PR now covers:

- QBO shared page: gated on configKey === 'nonReimbursableCreditCardDefaultVendor'
- Sage Intacct: gated on settingName === NON_REIMBURSABLE_CREDIT_CARD_VENDOR

Reverts the QBD, NetSuite, and Certinia changes — those integrations
only support Vendor Bill export, not CC/DC.
@Beamanator Beamanator changed the title Allow clearing the Default Vendor by re-selecting it Allow clearing the Default Vendor by re-selecting it (CC/DC export only) Jul 16, 2026
@Beamanator

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: c429fc2e87

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mkhutornyi

Copy link
Copy Markdown
Contributor

@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Reviewed the diff. The change is clean, minimal, and correctly scoped to the CC/DC export paths. One backend item to confirm before merge, plus a minor consistency nit.

✅ Looks good

⚠️ Confirm before merge — Sage Intacct empty-string persistence

The Sage clear sends vendorID: ''. The optimistic Onyx update handles '' fine, but unlike the QBO 'NONE' path there's no existing precedent for sending an empty vendor ID here. As the PR description already notes, the UpdateSageIntacctNonReimbursableExpensesCreditCardChargeExportDefaultVendor command needs to be confirmed to actually persist the cleared value on the backend — otherwise it'll optimistically clear and then silently revert on successData. Worth verifying against the API before this ships.

💡 Minor — use the constant for the QBO gate

The Sage side compares against a CONST, but the QBO side uses a bare string literal 'nonReimbursableCreditCardDefaultVendor'. There's already a matching constant — CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_CREDIT_CARD_DEFAULT_VENDOR — so using it keeps the two integrations consistent and stays in sync if the key is ever renamed. It's type-checked today, so this is low priority.

💡 Optional — tests

No unit tests were added (checklist item is unchecked). The three-way branch (clear on gated path / set / no-op on ungated path) is exactly the kind of logic a small test would lock in against regressions.

@Beamanator

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 400be4703e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Beamanator

Beamanator commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Ok I believe we're good to go here now @mkhutornyi 🙏 (ready for another review)

@mkhutornyi

mkhutornyi commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • 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 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)
  • 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)
  • 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.
  • 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: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov

@melvin-bot
melvin-bot Bot requested a review from mjasikowski July 17, 2026 20:19
@melvin-bot

melvin-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

@mjasikowski 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 changed the title Allow clearing the Default Vendor by re-selecting it (CC/DC export only) [Payment due @mkhutornyi] Allow clearing the Default Vendor by re-selecting it (CC/DC export only) Jul 17, 2026
@melvin-bot

melvin-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🎯 @mkhutornyi, thanks for reviewing and testing this PR! 🎉

A payment issue will be created for your review once this PR is deployed to production.
E/E issue linked to the PR - https://www.github.com/Expensify/Expensify/issues/659748.

If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created.

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

Labels

InternalQA This pull request required internal QA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants