Skip to content

feat(quickbooks): add procurement integration - #6061

Open
BillLeoutsakosvl346 wants to merge 14 commits into
stagingfrom
add-quickbooks-procurement
Open

feat(quickbooks): add procurement integration#6061
BillLeoutsakosvl346 wants to merge 14 commits into
stagingfrom
add-quickbooks-procurement

Conversation

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor

Summary

  • Add QuickBooks Online OAuth support and procurement-focused query tools
  • Add QuickBooks block for vendors, purchase orders, bills, and custom queries
  • Generate integration docs and registry metadata

Type of Change

  • New feature

Testing

  • bun run scripts/generate-docs.ts
  • bun run lint
  • bun run test tools/quickbooks/quickbooks.test.ts lib/oauth/oauth.test.ts
  • bun run type-check
  • bun run check:api-validation:strict
  • bun run check:bare-icons
  • ship audit suite passed

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 30, 2026 4:30am

Request Review

@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
OAuth and accounting API access touch financial data and external Intuit APIs; attachment upload and CRUD/delete paths need correct realmId, SyncToken, and entity rules to avoid wrong-company or destructive operations.

Overview
Adds QuickBooks Online as an OAuth integration with a workflow block, ~20 tools, docs, and registry wiring for procurement and accounting automation.

OAuth & config: Intuit OAuth provider (QUICKBOOKS_CLIENT_ID / SECRET), token refresh with Basic auth, user-info with sandbox/production fallback, access-token validation (no header injection), and accounting scope com.intuit.quickbooks.accounting.

Workflow block: Operation-driven UI for CRUD on documented entities, SQL-like queries, financial reports, CDC sync, batch (≤10 ops), preferences and exchange rates, PDF download/send, attachment URLs, and file uploads—scoped by entity allowlists (locale/SKU-dependent types like TaxPayment, JournalCode, RecurringTransaction).

API surface: Shared QuickBooks helpers (URLs, query building, response parsing with size limits, fault handling on HTTP 200). Attachment uploads go through a dedicated POST /api/tools/quickbooks/upload-attachment route with file authorization, extension/content-type whitelist, and 25 MB cap.

Docs & discovery: New quickbooks.mdx, integration JSON entry, icons, and block templates/skills for vendor intake, PO monitoring, bill queues, and reconciliation.

Reviewed by Cursor Bugbot for commit db63eba. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread apps/sim/lib/auth/auth.ts
Comment thread apps/sim/tools/quickbooks/utils.ts Outdated
@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a full QuickBooks Online procurement integration (OAuth, block, tools, docs, and upload-attachment API).

  • OAuth provider wiring plus user-info helpers for QuickBooks
  • Block and tools for records, reports, attachments, CDC, batch, and list/query ops
  • Sandbox/production API host selection via apiEnvironment
  • Docs, registry, env, and contract coverage for the new surface

Confidence Score: 5/5

This PR appears safe to merge; prior review threads are resolved and no blocking failures remain.

The sandbox host issue is addressed end-to-end through apiEnvironment on URL builders, tools, the upload route, and tests. The realmId thread was accepted as an intentional v1 manual Company ID tradeoff. No remaining blocking failure was identified on the follow-up scope.

Important Files Changed

Filename Overview
apps/sim/tools/quickbooks/utils.ts Central URL/header helpers now switch production vs sandbox hosts via apiEnvironment with validation.
apps/sim/blocks/blocks/quickbooks.ts Block exposes Company ID and advanced Environment selector and maps apiEnvironment into tool params.
apps/sim/lib/auth/auth.ts Registers QuickBooks generic OAuth; realmId remains a manual Company ID input by design for v1.
apps/sim/app/api/tools/quickbooks/upload-attachment/route.ts Upload route forwards apiEnvironment into buildQuickBooksUploadUrl for sandbox-aware uploads.
apps/sim/tools/quickbooks/quickbooks.test.ts Tests cover sandbox host selection and invalid environment rejection.

Sequence Diagram

sequenceDiagram
  participant User
  participant Block as QuickBooksBlock
  participant Tool as tools/quickbooks/*
  participant QB as Intuit QBO API

  User->>Block: OAuth connect + Company ID + Environment
  Block->>Tool: operation params (realmId, apiEnvironment, ...)
  Tool->>Tool: getQuickBooksApiBase(apiEnvironment)
  Tool->>QB: HTTPS request to production or sandbox host
  QB-->>Tool: JSON / PDF / attachment response
  Tool-->>Block: normalized tool output
Loading

Reviews (9): Last reviewed commit: "fix(quickbooks): reject incomplete batch..." | Re-trigger Greptile

Comment thread apps/sim/lib/auth/auth.ts
Comment thread apps/sim/tools/quickbooks/utils.ts
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 75579c9. Configure here.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread apps/sim/blocks/blocks/quickbooks.ts Outdated
Comment thread apps/sim/tools/quickbooks/download_document.ts
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread apps/sim/tools/quickbooks/utils.ts
Comment thread apps/sim/app/api/tools/quickbooks/upload-attachment/route.ts
Comment thread apps/sim/app/api/tools/quickbooks/upload-attachment/route.ts
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread apps/sim/tools/quickbooks/utils.ts
Comment thread apps/sim/tools/quickbooks/create_record.ts
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5dc92de. Configure here.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 53b7c94. Configure here.

Bill Leoutsakos added 2 commits July 29, 2026 18:59
…curement

# Conflicts:
#	apps/docs/components/icons.tsx
#	apps/sim/components/icons.tsx
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread apps/sim/tools/quickbooks/batch.ts
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 78b2768. Configure here.

Comment thread apps/sim/tools/quickbooks/utils.ts
Comment thread apps/sim/lib/oauth/quickbooks.ts
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.

1 participant