bug fixing

This commit is contained in:
2026-03-04 15:19:40 -06:00
parent 7226883a2e
commit 0fbb298e89
5 changed files with 181 additions and 184 deletions

View File

@@ -11,8 +11,7 @@ const { getNextInvoiceNumber } = require('../utils/numberGenerators');
const { formatDate, formatMoney } = require('../utils/helpers');
const { getBrowser, generatePdfFromHtml, getLogoHtml, renderInvoiceItems, formatAddressLines } = require('../services/pdf-service');
const { exportInvoiceToQbo, syncInvoiceToQbo } = require('../services/qbo-service');
const { getOAuthClient, getQboBaseUrl } = require('../config/qbo');
const { makeQboApiCall } = require('../../qbo_helper');
const { getOAuthClient, getQboBaseUrl, makeQboApiCall } = require('../config/qbo');
// GET all invoices
router.get('/', async (req, res) => {
@@ -133,7 +132,7 @@ router.post('/', async (req, res) => {
// Auto QBO Export
let qboResult = null;
try {
qboResult = await exportInvoiceToQbo(invoiceId, pool);
qboResult = await exportInvoiceToQbo(invoiceId, client);
if (qboResult.skipped) {
console.log(` Invoice ${invoiceId} not exported to QBO: ${qboResult.reason}`);
}
@@ -224,9 +223,9 @@ router.put('/:id', async (req, res) => {
const hasQboId = !!checkRes.rows[0]?.qbo_id;
if (hasQboId) {
qboResult = await syncInvoiceToQbo(id, pool);
qboResult = await syncInvoiceToQbo(id, client);
} else {
qboResult = await exportInvoiceToQbo(id, pool);
qboResult = await exportInvoiceToQbo(id, client);
}
if (qboResult.skipped) {