OUT-3512: add customerType to support dual QBO customers per company#213
Merged
SandipBajracharya merged 1 commit intomasterfrom Apr 6, 2026
Merged
OUT-3512: add customerType to support dual QBO customers per company#213SandipBajracharya merged 1 commit intomasterfrom
SandipBajracharya merged 1 commit intomasterfrom
Conversation
…per company When useCompanyNameFlag is toggled, the system now creates separate QBO customers for client-detail and company-detail invoices instead of reusing a single record. Also adds a CompanyName guard to prevent cross-company customer reuse when the same client exists in multiple companies. Changes: - Add customer_type column (varchar, notNull, default 'client') to qb_customers - Update unique index to composite (portalId, clientCompanyId, customerType) - Thread customerType param through getByClientCompanyId, getExistingCustomer, ensureCustomerExistsAndSyncToken, and findOrCreateCustomer - Add CompanyName to QBO customer queries and validate on match Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
customer_typecolumn ('client' | 'company', default'client') toqb_customerswith a composite unique index on(portal_id, client_company_id, customer_type)to allow both client-detail and company-detail QBO customers to coexist for the same companycustomerTypethrough the customer lookup/create chain (getByClientCompanyId,getExistingCustomer,ensureCustomerExistsAndSyncToken,findOrCreateCustomer) so the correct record is matched based on the currentuseCompanyNameFlagsettingCompanyNameguard when searching QBO by email/display name to prevent cross-company customer reuse when the same client exists in multiple companiesTest plan
useCompanyNameFlag = false→ verify QBO customer created with client details (customerType = 'client')useCompanyNameFlag = true, create invoice to same company → verify a new QBO customer created with company details (customerType = 'company')false, create another invoice → verify it reuses the existing'client'customer, not the'company'one'client'Testing criteria
https://www.loom.com/share/734c58fdf6a849e5b91089758f60e74e
🤖 Generated with Claude Code