From af161f3d850d153723ea6db1aa574d7de6757767 Mon Sep 17 00:00:00 2001 From: Adam Schwartz <77259180+aschwartz91@users.noreply.github.com> Date: Thu, 5 Feb 2026 17:48:03 -0500 Subject: [PATCH 1/3] fix: preserve QB default class on invoice line items by omitting ClassRef when unset When syncing invoices, we were always including ClassRef in the SalesItemLineDetail payload, even when undefined. This caused QB to clear the item's default class. Now we only include ClassRef when we have an actual value to send, allowing QB to apply its configured default class behavior. Co-Authored-By: Claude Opus 4.5 --- src/app/api/quickbooks/invoice/invoice.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/quickbooks/invoice/invoice.service.ts b/src/app/api/quickbooks/invoice/invoice.service.ts index 889e8e5..4d835ec 100644 --- a/src/app/api/quickbooks/invoice/invoice.service.ts +++ b/src/app/api/quickbooks/invoice/invoice.service.ts @@ -363,9 +363,9 @@ export class InvoiceService extends BaseService { // Doc reference: https://developer.intuit.com/app/developer/qbo/docs/workflows/manage-sales-tax-for-us-locales#specifying-sales-tax value: 'TAX', }, - // classrRef is optional. ClassRef to reference the associated class of the QB item. + // ClassRef is optional. Only include when we have a value, otherwise QB will use the item's default class. // Doc reference: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/class - ClassRef: itemRef.classRef, + ...(itemRef.classRef && { ClassRef: itemRef.classRef }), }, Description: typeof itemRef.productDescription === 'undefined' From 726e2a7194f0937b5266c50688a9aa94bde656b9 Mon Sep 17 00:00:00 2001 From: Adam Schwartz <77259180+aschwartz91@users.noreply.github.com> Date: Thu, 5 Feb 2026 17:55:45 -0500 Subject: [PATCH 2/3] fix: forward ClassRef for newly created/found-by-name QB items When items are created or found by name in QB (rather than by mapped ID), we had the qbItem with its ClassRef but weren't passing it through to the invoice line item payload. QB's API does not auto-apply an item's default class to invoice line items, so we must explicitly forward it. Co-Authored-By: Claude Opus 4.5 --- src/app/api/quickbooks/invoice/invoice.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/quickbooks/invoice/invoice.service.ts b/src/app/api/quickbooks/invoice/invoice.service.ts index 4d835ec..b436d57 100644 --- a/src/app/api/quickbooks/invoice/invoice.service.ts +++ b/src/app/api/quickbooks/invoice/invoice.service.ts @@ -326,7 +326,7 @@ export class InvoiceService extends BaseService { syncLogConditions, ) - return { ref: { value: qbItem.Id }, productDescription } + return { ref: { value: qbItem.Id }, productDescription, classRef: qbItem.ClassRef } } private async prepareLineItemPayload( From 7fcad0cabacc3f68bdbeaf79ce2bca817a53ebe9 Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Mon, 9 Feb 2026 13:44:09 +0545 Subject: [PATCH 3/3] refactor(OUT-3081): remove optional chaining --- src/app/api/quickbooks/invoice/invoice.service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/api/quickbooks/invoice/invoice.service.ts b/src/app/api/quickbooks/invoice/invoice.service.ts index b436d57..03a8600 100644 --- a/src/app/api/quickbooks/invoice/invoice.service.ts +++ b/src/app/api/quickbooks/invoice/invoice.service.ts @@ -219,7 +219,7 @@ export class InvoiceService extends BaseService { amount: parseFloat(itemAmount) / 100, productDescription: mapping.description || '', // classRef is optional. A classRef to the mapped QB item is checked every time for each item when creating an invoice. - classRef: intuitItem?.ClassRef, + classRef: intuitItem.ClassRef, } } } @@ -326,7 +326,11 @@ export class InvoiceService extends BaseService { syncLogConditions, ) - return { ref: { value: qbItem.Id }, productDescription, classRef: qbItem.ClassRef } + return { + ref: { value: qbItem.Id }, + productDescription, + classRef: qbItem.ClassRef, + } } private async prepareLineItemPayload(