Skip to content

fix: sync invoices created from draft state to QuickBooks#205

Draft
aschwartz91 wants to merge 1 commit intomasterfrom
fix/sync-invoice-sent-to-quickbooks
Draft

fix: sync invoices created from draft state to QuickBooks#205
aschwartz91 wants to merge 1 commit intomasterfrom
fix/sync-invoice-sent-to-quickbooks

Conversation

@aschwartz91
Copy link
Collaborator

Summary

  • Adds INVOICE_SENT = 'invoice.sent' to the WebhookEvents enum
  • Adds a case WebhookEvents.INVOICE_SENT to the webhook switch statement
  • Adds handleInvoiceSent private method that parses with InvoiceCreatedResponseSchema and delegates to invoiceService.webhookInvoiceCreated()

Context

When a user duplicates an invoice in Assembly, it's saved as a draft first, then finalized/sent. The backend fires invoice.created with status: draft — which is correctly skipped. When finalized, the backend fires invoice.sent, but there was no handler for it, so it hit the default case and was silently ignored. The invoice was never synced to QuickBooks.

The webhookInvoiceCreated method is safe to reuse here because it already has duplicate detection (getInvoiceByNumber() returns early if the invoice exists in qb_invoice_sync).

Test plan

  • Create an invoice in Assembly, save as draft
  • Finalize and send the invoice
  • Confirm a QB invoice is created (check QB and the qb_invoice_sync table)
  • Confirm no duplicate is created if the flow is triggered twice

Handle invoice.sent webhook event so invoices that are first saved as
drafts and later finalized/sent are synced to QuickBooks. Previously
the event hit the default case and was silently ignored.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 18, 2026

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

Project Deployment Actions Updated (UTC)
quickbooks-sync Error Error Mar 18, 2026 3:08pm

Request Review

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