bug fixing
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user