From b5792989cd8122196a7a07ab4fcff5729e2dccc2 Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Tue, 10 Feb 2026 14:46:41 +0545 Subject: [PATCH] fix(OUT-3111): use copilot product price instead of QB price --- src/app/api/quickbooks/invoice/invoice.service.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/app/api/quickbooks/invoice/invoice.service.ts b/src/app/api/quickbooks/invoice/invoice.service.ts index 03a8600..9378484 100644 --- a/src/app/api/quickbooks/invoice/invoice.service.ts +++ b/src/app/api/quickbooks/invoice/invoice.service.ts @@ -134,26 +134,22 @@ export class InvoiceService extends BaseService { } private async handleItemAmount({ - unitPrice, copilotUnitPrice, priceId, mappingId, productService, }: { - unitPrice: string | null copilotUnitPrice: string | null priceId: string mappingId: string productService: ProductService }) { - console.log('Checking if QB item unit price is available and not zero.') - // if unitPrice (QB unit price) is null, return copilot unit price. - let itemAmount = - unitPrice && unitPrice !== '0' ? unitPrice : copilotUnitPrice + console.log( + 'Checking if Assembly item unit price is available and not zero.', + ) + if (copilotUnitPrice && copilotUnitPrice !== '0') return copilotUnitPrice // fetch price amount from copilot if copilotUnitPrice is null - if (itemAmount && itemAmount !== '0') return itemAmount - console.info( 'Copilot product price not found in mapping table. Fetching from copilot SDK', ) @@ -163,7 +159,7 @@ export class InvoiceService extends BaseService { httpStatus.NOT_FOUND, 'Price not found. Id: ' + priceId, ) - itemAmount = copilotPriceRes.amount.toFixed() + const itemAmount = copilotPriceRes.amount.toFixed() // update the price amount in our DB const priceUpdatePayload = { @@ -201,7 +197,6 @@ export class InvoiceService extends BaseService { console.info('InvoiceService#getInvoiceItemRef | Product map found') const itemAmount = await this.handleItemAmount({ - unitPrice: mapping.unitPrice, copilotUnitPrice: mapping.copilotUnitPrice, priceId, mappingId: mapping.id,