diff --git a/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx b/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx index ed3a7b24c..71939895e 100644 --- a/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx +++ b/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx @@ -28,7 +28,7 @@ export default connect( mapDispatchToProps )(AccountingPayablesTableComponent); -export function AccountingPayablesTableComponent({ bodyshop, loading, bills }) { +export function AccountingPayablesTableComponent({ bodyshop, loading, bills, refetch }) { const { t } = useTranslation(); const [selectedBills, setSelectedBills] = useState([]); const [transInProgress, setTransInProgress] = useState(false); @@ -149,6 +149,7 @@ export function AccountingPayablesTableComponent({ bodyshop, loading, bills }) { disabled={transInProgress || !!record.exported} loadingCallback={setTransInProgress} setSelectedBills={setSelectedBills} + refetch={refetch} /> ), @@ -181,6 +182,7 @@ export function AccountingPayablesTableComponent({ bodyshop, loading, bills }) { disabled={transInProgress || selectedBills.length === 0} loadingCallback={setTransInProgress} completedCallback={setSelectedBills} + refetch={refetch} /> {bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && ( diff --git a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx index 3a8c0c6b4..05e5277dd 100644 --- a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx +++ b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx @@ -32,6 +32,7 @@ export function AccountingPayablesTableComponent({ bodyshop, loading, payments, + refetch, }) { const { t } = useTranslation(); const [selectedPayments, setSelectedPayments] = useState([]); @@ -147,6 +148,7 @@ export function AccountingPayablesTableComponent({ disabled={transInProgress || !!record.exportedat} loadingCallback={setTransInProgress} setSelectedPayments={setSelectedPayments} + refetch={refetch} /> ), }, @@ -187,6 +189,7 @@ export function AccountingPayablesTableComponent({ disabled={transInProgress || selectedPayments.length === 0} loadingCallback={setTransInProgress} completedCallback={setSelectedPayments} + refetch={refetch} /> {bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && ( diff --git a/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx b/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx index d954448d4..082d42da2 100644 --- a/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx +++ b/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx @@ -31,6 +31,7 @@ export function AccountingReceivablesTableComponent({ bodyshop, loading, jobs, + refetch, }) { const { t } = useTranslation(); const [selectedJobs, setSelectedJobs] = useState([]); @@ -155,6 +156,7 @@ export function AccountingReceivablesTableComponent({ jobId={record.id} disabled={!!record.date_exported} setSelectedJobs={setSelectedJobs} + refetch={refetch} /> @@ -205,6 +207,7 @@ export function AccountingReceivablesTableComponent({ disabled={transInProgress || selectedJobs.length === 0} loadingCallback={setTransInProgress} completedCallback={setSelectedJobs} + refetch={refetch} /> )} {bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && ( diff --git a/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx b/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx index 8d783557e..1c95b9975 100644 --- a/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx +++ b/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx @@ -15,7 +15,6 @@ import { logImEXEvent } from "../../firebase/firebase.utils"; import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries"; import { useHistory } from "react-router-dom"; - const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, currentUser: selectCurrentUser, @@ -27,6 +26,7 @@ export function JobsCloseExportButton({ jobId, disabled, setSelectedJobs, + refetch, }) { const history = useHistory(); const { t } = useTranslation(); @@ -46,13 +46,10 @@ export function JobsCloseExportButton({ //Check if it's a QBO Setup. let PartnerResponse; if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { - PartnerResponse = await axios.post( - `/qbo/receivables`, - { - jobIds: [jobId], - }, - - ); + PartnerResponse = await axios.post(`/qbo/receivables`, { + jobIds: [jobId], + elgen: true, + }); } else { //Default is QBD @@ -117,58 +114,64 @@ export function JobsCloseExportButton({ }); }); - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - jobid: jobId, - successful: false, - message: JSON.stringify( - failedTransactions.map((ft) => ft.errorMessage) - ), - useremail: currentUser.email, - }, - ], - }, - }); + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + jobid: jobId, + successful: false, + message: JSON.stringify( + failedTransactions.map((ft) => ft.errorMessage) + ), + useremail: currentUser.email, + }, + ], + }, + }); + } } else { //Insert success export log. - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - jobid: jobId, - successful: true, - useremail: currentUser.email, - }, - ], - }, - }); - - const jobUpdateResponse = await updateJob({ - variables: { - jobId: jobId, - job: { - status: bodyshop.md_ro_statuses.default_exported || "Exported*", - date_exported: new Date(), + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + jobid: jobId, + successful: true, + useremail: currentUser.email, + }, + ], }, - }, - }); + }); - if (!jobUpdateResponse.errors) { - notification.open({ - type: "success", - key: "jobsuccessexport", - message: t("jobs.successes.exported"), - }); - } else { - notification["error"]({ - message: t("jobs.errors.exporting", { - error: JSON.stringify(jobUpdateResponse.error), - }), + const jobUpdateResponse = await updateJob({ + variables: { + jobId: jobId, + job: { + status: bodyshop.md_ro_statuses.default_exported || "Exported*", + date_exported: new Date(), + }, + }, }); + + if (!jobUpdateResponse.errors) { + notification.open({ + type: "success", + key: "jobsuccessexport", + message: t("jobs.successes.exported"), + }); + } else { + notification["error"]({ + message: t("jobs.errors.exporting", { + error: JSON.stringify(jobUpdateResponse.error), + }), + }); + } } if (setSelectedJobs) { setSelectedJobs((selectedJobs) => { @@ -176,7 +179,7 @@ export function JobsCloseExportButton({ }); } } - + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); setLoading(false); }; diff --git a/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx b/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx index 80aa92f7f..f4effbe2c 100644 --- a/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx +++ b/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx @@ -26,6 +26,7 @@ export function JobsExportAllButton({ disabled, loadingCallback, completedCallback, + refetch, }) { const { t } = useTranslation(); const [updateJob] = useMutation(UPDATE_JOBS); @@ -39,6 +40,7 @@ export function JobsExportAllButton({ if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { PartnerResponse = await axios.post(`/qbo/receivables`, { jobIds: jobIds, + elgen: true, }); } else { let QbXmlResponse; @@ -83,6 +85,7 @@ export function JobsExportAllButton({ return; } } + console.log("PartnerResponse", PartnerResponse); const groupedData = _.groupBy( PartnerResponse.data, @@ -106,61 +109,70 @@ export function JobsExportAllButton({ }); //Call is not awaited as it is not critical to finish before proceeding. }); - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - jobid: key, - successful: false, - message: JSON.stringify( - failedTransactions.map((ft) => ft.errorMessage) - ), - useremail: currentUser.email, - }, - ], - }, - }); - } else { - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - jobid: key, - successful: true, - useremail: currentUser.email, - }, - ], - }, - }); - const jobUpdateResponse = await updateJob({ - variables: { - jobIds: [key], - fields: { - status: bodyshop.md_ro_statuses.default_exported || "Exported*", - date_exported: new Date(), + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + jobid: key, + successful: false, + message: JSON.stringify( + failedTransactions.map((ft) => ft.errorMessage) + ), + useremail: currentUser.email, + }, + ], }, - }, - }); + }); + } + } else { + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + jobid: key, + successful: true, + useremail: currentUser.email, + }, + ], + }, + }); - if (!jobUpdateResponse.errors) { - notification.open({ - type: "success", - key: "jobsuccessexport", - message: t("jobs.successes.exported"), - }); - } else { - notification["error"]({ - message: t("jobs.errors.exporting", { - error: JSON.stringify(jobUpdateResponse.error), - }), + const jobUpdateResponse = await updateJob({ + variables: { + jobIds: [key], + fields: { + status: + bodyshop.md_ro_statuses.default_exported || "Exported*", + date_exported: new Date(), + }, + }, }); + + if (!jobUpdateResponse.errors) { + notification.open({ + type: "success", + key: "jobsuccessexport", + message: t("jobs.successes.exported"), + }); + } else { + notification["error"]({ + message: t("jobs.errors.exporting", { + error: JSON.stringify(jobUpdateResponse.error), + }), + }); + } } } }) ); + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); if (!!completedCallback) completedCallback([]); if (!!loadingCallback) loadingCallback(false); diff --git a/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx b/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx index 0cfe607df..fdebc2335 100644 --- a/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx +++ b/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx @@ -27,6 +27,7 @@ export function PayableExportAll({ disabled, loadingCallback, completedCallback, + refetch, }) { const { t } = useTranslation(); const [updateBill] = useMutation(UPDATE_BILLS); @@ -42,6 +43,7 @@ export function PayableExportAll({ if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { PartnerResponse = await axios.post(`/qbo/payables`, { bills: billids, + elgen: true, }); } else { let QbXmlResponse; @@ -104,57 +106,62 @@ export function PayableExportAll({ }), }) ); - - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - billid: key, - successful: false, - message: JSON.stringify( - failedTransactions.map((ft) => ft.errorMessage) - ), - useremail: currentUser.email, - }, - ], - }, - }); - } else { - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - billid: key, - successful: true, - useremail: currentUser.email, - }, - ], - }, - }); - - const billUpdateResponse = await updateBill({ - variables: { - billIdList: [key], - bill: { - exported: true, - exported_at: new Date(), + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + billid: key, + successful: false, + message: JSON.stringify( + failedTransactions.map((ft) => ft.errorMessage) + ), + useremail: currentUser.email, + }, + ], }, - }, - }); - if (!!!billUpdateResponse.errors) { - notification.open({ - type: "success", - key: "billsuccessexport", - message: t("bills.successes.exported"), }); - } else { - notification["error"]({ - message: t("bills.errors.exporting", { - error: JSON.stringify(billUpdateResponse.error), - }), + } + } else { + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + billid: key, + successful: true, + useremail: currentUser.email, + }, + ], + }, }); + + const billUpdateResponse = await updateBill({ + variables: { + billIdList: [key], + bill: { + exported: true, + exported_at: new Date(), + }, + }, + }); + if (!!!billUpdateResponse.errors) { + notification.open({ + type: "success", + key: "billsuccessexport", + message: t("bills.successes.exported"), + }); + } else { + notification["error"]({ + message: t("bills.errors.exporting", { + error: JSON.stringify(billUpdateResponse.error), + }), + }); + } } } })() @@ -164,6 +171,8 @@ export function PayableExportAll({ await Promise.all(proms); if (!!completedCallback) completedCallback([]); if (!!loadingCallback) loadingCallback(false); + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); + setLoading(false); }; diff --git a/client/src/components/payable-export-button/payable-export-button.component.jsx b/client/src/components/payable-export-button/payable-export-button.component.jsx index 17a2acedb..6f24d0a59 100644 --- a/client/src/components/payable-export-button/payable-export-button.component.jsx +++ b/client/src/components/payable-export-button/payable-export-button.component.jsx @@ -26,6 +26,7 @@ export function PayableExportButton({ disabled, loadingCallback, setSelectedBills, + refetch, }) { const { t } = useTranslation(); const [updateBill] = useMutation(UPDATE_BILLS); @@ -43,6 +44,7 @@ export function PayableExportButton({ if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { PartnerResponse = await axios.post(`/qbo/payables`, { bills: [billId], + elgen: true, }); } else { //Default is QBD @@ -100,64 +102,72 @@ export function PayableExportButton({ }), }) ); - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - billid: billId, - successful: false, - message: JSON.stringify( - failedTransactions.map((ft) => ft.errorMessage) - ), - useremail: currentUser.email, - }, - ], - }, - }); - } - if (successfulTransactions.length > 0) { - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - billid: billId, - successful: true, - useremail: currentUser.email, - }, - ], - }, - }); - const billUpdateResponse = await updateBill({ - variables: { - billIdList: successfulTransactions.map( - (st) => - st[ - bodyshop.accountingconfig && bodyshop.accountingconfig.qbo - ? "billid" - : "id" - ] - ), - bill: { - exported: true, - exported_at: new Date(), + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + billid: billId, + successful: false, + message: JSON.stringify( + failedTransactions.map((ft) => ft.errorMessage) + ), + useremail: currentUser.email, + }, + ], }, - }, - }); - if (!!!billUpdateResponse.errors) { - notification.open({ - type: "success", - key: "billsuccessexport", - message: t("bills.successes.exported"), - }); - } else { - notification["error"]({ - message: t("bills.errors.exporting", { - error: JSON.stringify(billUpdateResponse.error), - }), }); } + } + if (successfulTransactions.length > 0) { + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + billid: billId, + successful: true, + useremail: currentUser.email, + }, + ], + }, + }); + const billUpdateResponse = await updateBill({ + variables: { + billIdList: successfulTransactions.map( + (st) => + st[ + bodyshop.accountingconfig && bodyshop.accountingconfig.qbo + ? "billid" + : "id" + ] + ), + bill: { + exported: true, + exported_at: new Date(), + }, + }, + }); + if (!!!billUpdateResponse.errors) { + notification.open({ + type: "success", + key: "billsuccessexport", + message: t("bills.successes.exported"), + }); + } else { + notification["error"]({ + message: t("bills.errors.exporting", { + error: JSON.stringify(billUpdateResponse.error), + }), + }); + } + } + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); + if (setSelectedBills) { setSelectedBills((selectedBills) => { return selectedBills.filter((i) => i !== billId); diff --git a/client/src/components/payment-export-button/payment-export-button.component.jsx b/client/src/components/payment-export-button/payment-export-button.component.jsx index 0d50032c4..5e5868579 100644 --- a/client/src/components/payment-export-button/payment-export-button.component.jsx +++ b/client/src/components/payment-export-button/payment-export-button.component.jsx @@ -26,6 +26,7 @@ export function PaymentExportButton({ disabled, loadingCallback, setSelectedPayments, + refetch, }) { const { t } = useTranslation(); const [updatePayment] = useMutation(UPDATE_PAYMENTS); @@ -40,6 +41,7 @@ export function PaymentExportButton({ if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { PartnerResponse = await axios.post(`/qbo/payments`, { payments: [paymentId], + elgen: true, }); } else { //Default is QBD @@ -100,63 +102,68 @@ export function PaymentExportButton({ }), }) ); - - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - paymentid: paymentId, - successful: false, - message: JSON.stringify( - failedTransactions.map((ft) => ft.errorMessage) - ), - useremail: currentUser.email, - }, - ], - }, - }); - } else { - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - paymentid: paymentId, - successful: true, - useremail: currentUser.email, - }, - ], - }, - }); - - const paymentUpdateResponse = await updatePayment({ - variables: { - paymentIdList: successfulTransactions.map( - (st) => - st[ - bodyshop.accountingconfig && bodyshop.accountingconfig.qbo - ? "paymentid" - : "id" - ] - ), - payment: { - exportedat: new Date(), + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + paymentid: paymentId, + successful: false, + message: JSON.stringify( + failedTransactions.map((ft) => ft.errorMessage) + ), + useremail: currentUser.email, + }, + ], }, - }, - }); - if (!!!paymentUpdateResponse.errors) { - notification.open({ - type: "success", - key: "paymentsuccessexport", - message: t("payments.successes.exported"), }); - } else { - notification["error"]({ - message: t("payments.errors.exporting", { - error: JSON.stringify(paymentUpdateResponse.error), - }), + } + } else { + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + paymentid: paymentId, + successful: true, + useremail: currentUser.email, + }, + ], + }, }); + + const paymentUpdateResponse = await updatePayment({ + variables: { + paymentIdList: successfulTransactions.map( + (st) => + st[ + bodyshop.accountingconfig && bodyshop.accountingconfig.qbo + ? "paymentid" + : "id" + ] + ), + payment: { + exportedat: new Date(), + }, + }, + }); + if (!!!paymentUpdateResponse.errors) { + notification.open({ + type: "success", + key: "paymentsuccessexport", + message: t("payments.successes.exported"), + }); + } else { + notification["error"]({ + message: t("payments.errors.exporting", { + error: JSON.stringify(paymentUpdateResponse.error), + }), + }); + } } if (setSelectedPayments) { @@ -165,7 +172,7 @@ export function PaymentExportButton({ }); } } - + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); if (!!loadingCallback) loadingCallback(false); setLoading(false); }; diff --git a/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx b/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx index b24536210..3f9d7fffd 100644 --- a/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx +++ b/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx @@ -25,6 +25,7 @@ export function PaymentsExportAllButton({ disabled, loadingCallback, completedCallback, + refetch }) { const { t } = useTranslation(); const [updatePayments] = useMutation(UPDATE_PAYMENTS); @@ -38,6 +39,7 @@ export function PaymentsExportAllButton({ if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { PartnerResponse = await axios.post(`/qbo/payments`, { payments: paymentIds, + elgen: true, }); } else { let QbXmlResponse; @@ -92,54 +94,61 @@ export function PaymentsExportAllButton({ }), }) ); - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - paymentid: key, - successful: false, - message: JSON.stringify( - failedTransactions.map((ft) => ft.errorMessage) - ), - useremail: currentUser.email, - }, - ], - }, - }); - } else { - await insertExportLog({ - variables: { - logs: [ - { - bodyshopid: bodyshop.id, - paymentid: key, - successful: true, - useremail: currentUser.email, - }, - ], - }, - }); - const paymentUpdateResponse = await updatePayments({ - variables: { - paymentIdList: [key], - payment: { - exportedat: new Date(), + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + paymentid: key, + successful: false, + message: JSON.stringify( + failedTransactions.map((ft) => ft.errorMessage) + ), + useremail: currentUser.email, + }, + ], }, - }, - }); - if (!!!paymentUpdateResponse.errors) { - notification.open({ - type: "success", - key: "paymentsuccessexport", - message: t("payments.successes.exported"), }); - } else { - notification["error"]({ - message: t("payments.errors.exporting", { - error: JSON.stringify(paymentUpdateResponse.error), - }), + } + } else { + if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) { + //QBO Logs are handled server side. + + await insertExportLog({ + variables: { + logs: [ + { + bodyshopid: bodyshop.id, + paymentid: key, + successful: true, + useremail: currentUser.email, + }, + ], + }, }); + const paymentUpdateResponse = await updatePayments({ + variables: { + paymentIdList: [key], + payment: { + exportedat: new Date(), + }, + }, + }); + if (!!!paymentUpdateResponse.errors) { + notification.open({ + type: "success", + key: "paymentsuccessexport", + message: t("payments.successes.exported"), + }); + } else { + notification["error"]({ + message: t("payments.errors.exporting", { + error: JSON.stringify(paymentUpdateResponse.error), + }), + }); + } } } })() @@ -148,6 +157,7 @@ export function PaymentsExportAllButton({ await Promise.all(proms); if (!!completedCallback) completedCallback([]); if (!!loadingCallback) loadingCallback(false); + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); setLoading(false); }; diff --git a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx index 4774c6810..c8e37a688 100644 --- a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx +++ b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx @@ -237,7 +237,11 @@ export function TimeTicketModalComponent({ return Promise.reject( t("timetickets.validation.clockoffwithoutclockon") ); - if (value && !value.isSameOrAfter(clockon)) + if ( + value && + value.isSameOrAfter && + !value.isSameOrAfter(clockon) + ) return Promise.reject( t("timetickets.validation.clockoffmustbeafterclockon") ); diff --git a/client/src/pages/accounting-payables/accounting-payables.container.jsx b/client/src/pages/accounting-payables/accounting-payables.container.jsx index b9e2a1a1e..b9e92d875 100644 --- a/client/src/pages/accounting-payables/accounting-payables.container.jsx +++ b/client/src/pages/accounting-payables/accounting-payables.container.jsx @@ -45,7 +45,7 @@ export function AccountingPayablesContainer({ checkPartnerStatus(bodyshop, true); }, [t, setBreadcrumbs, setSelectedHeader, bodyshop]); - const { loading, error, data } = useQuery(QUERY_BILLS_FOR_EXPORT, { + const { loading, error, data, refetch } = useQuery(QUERY_BILLS_FOR_EXPORT, { fetchPolicy: "network-only", nextFetchPolicy: "network-only", }); @@ -73,6 +73,7 @@ export function AccountingPayablesContainer({ diff --git a/client/src/pages/accounting-payments/accounting-payments.container.jsx b/client/src/pages/accounting-payments/accounting-payments.container.jsx index dadecdd5a..e74194e06 100644 --- a/client/src/pages/accounting-payments/accounting-payments.container.jsx +++ b/client/src/pages/accounting-payments/accounting-payments.container.jsx @@ -44,10 +44,13 @@ export function AccountingPaymentsContainer({ checkPartnerStatus(bodyshop, true); }, [t, setBreadcrumbs, setSelectedHeader, bodyshop]); - const { loading, error, data } = useQuery(QUERY_PAYMENTS_FOR_EXPORT, { - fetchPolicy: "network-only", - nextFetchPolicy: "network-only", - }); + const { loading, error, data, refetch } = useQuery( + QUERY_PAYMENTS_FOR_EXPORT, + { + fetchPolicy: "network-only", + nextFetchPolicy: "network-only", + } + ); if (error) return ; const noPath = @@ -70,6 +73,7 @@ export function AccountingPaymentsContainer({ diff --git a/client/src/pages/accounting-receivables/accounting-receivables.container.jsx b/client/src/pages/accounting-receivables/accounting-receivables.container.jsx index 8fec8fce7..485800a00 100644 --- a/client/src/pages/accounting-receivables/accounting-receivables.container.jsx +++ b/client/src/pages/accounting-receivables/accounting-receivables.container.jsx @@ -44,7 +44,7 @@ export function AccountingReceivablesContainer({ checkPartnerStatus(bodyshop, true); }, [t, setBreadcrumbs, setSelectedHeader, bodyshop]); - const { loading, error, data } = useQuery(QUERY_JOBS_FOR_EXPORT, { + const { loading, error, data, refetch } = useQuery(QUERY_JOBS_FOR_EXPORT, { variables: { invoicedStatus: bodyshop.md_ro_statuses.default_invoiced || "Invoiced*", }, @@ -75,6 +75,7 @@ export function AccountingReceivablesContainer({ diff --git a/logs/oAuthClient-log.log b/logs/oAuthClient-log.log index baf797a2e..298b005ad 100644 --- a/logs/oAuthClient-log.log +++ b/logs/oAuthClient-log.log @@ -63137,3 +63137,1161 @@ }, "intuit_tid": "1-6245e644-6da8a1203f695e1b43a64c85" } +2022-05-03T16:49:35.968Z info: Refresh Token () response is : { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..VGsSwWZTU-60cqrGD_-I3A.6PwjwjsQ-MKm_JYZt2Jix0h0DZhLUQgtmEd8XYN30kDdQ8LHBoGtM89D0rMlBcThr23bPo7OoHEt-crdN2tsCyFZHseU_-xfxphs5_CiE9m8-E4umHhWWkx7wzPd2kmf3xaLEyTZhJ6ZA8WQ6LJ1Wt57x_ZBq3a5Xhlu3mGQnjVjzxUW8Yy42YWpHXmZ9Qv2kC2OPJ1k-zMoD1XH8RAA33SMC2cR9LFUtbA0sLEjD6cRaDESq3GHEkNkY76y7xGsPX_JoZNuiwc_pbxILWWeU3JlELnZy6V4eT6udAP6Yx-V_Vwbor37WqDSQSTxV3ZLtMMXJqRZU7ZDOwumYOeZCrtPqupvqfsDXei1CkLO32_KdsV9V0woNgcLdJ_1Zw45D14Khq1bICx6LLccC1dfqzKeBZBBZqsJk6RKM7Rhel1lF-iI4Otny3Vm0LYCnPSBP3eOvAsoWClRBAi-02e1KLM1H_G3ksJxid72kTsICJ_tC8fW6Wawf26ShRHPyXTMxDstyLU8Mt3RzpdLMRitH_cvWvwxIDuP5pqF4m32jXgOnGu3wJpdjWIL_spqSZI_rGC7bL-4NFYNh5NnmrmEkUquNK5UMibUysG7Zg7SnIzlJnLUQuc_7PNW17h1MA4GI-NnACemHif_y4Jfdpjn0b31BMNi7wmPv6T0A8397lzxQFQ-FND-eRyIPLheK3FmdZvdSvwFNJC001aCEohnQF0BgJH5xzi8P2E8bXqqA0U3_aa3mFkMr4wzRmqAUHyt5lgs1jmYS3Ic748GicKU3Zp2bWHm1U8p3-I9DEoR_DrSdvxkP_GcYvnqWPGQquJWsxGjtfwiCodgtB-IkHZP7Q.rtHqphdewPG8e7nwcTCJSQ", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725424, + "id_token": "", + "latency": 60000, + "createdAt": 1651596575967 + }, + "response": { + "url": "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer", + "headers": { + "date": "Tue, 03 May 2022 16:49:33 GMT", + "content-type": "application/json;charset=utf-8", + "content-length": "1114", + "connection": "close", + "intuit_tid": "1-62715d1d-2a96a60d27838f1504791b82", + "x-spanid": "c5cb5cc8-82b1-4382-8ee0-79ee0264820c", + "x-amzn-trace-id": "Root=1-62715d1d-2a96a60d27838f1504791b82", + "x-content-type-options": "nosniff", + "server": "envoy", + "cache-control": "no-cache, no-store", + "pragma": "no-cache", + "x-frame-options": "SAMEORIGIN", + "x-xss-protection": "1; mode=block", + "x-envoy-upstream-service-time": "36", + "strict-transport-security": "max-age=31536000" + }, + "body": "{\"x_refresh_token_expires_in\":8725424,\"refresh_token\":\"AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz\",\"access_token\":\"eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..VGsSwWZTU-60cqrGD_-I3A.6PwjwjsQ-MKm_JYZt2Jix0h0DZhLUQgtmEd8XYN30kDdQ8LHBoGtM89D0rMlBcThr23bPo7OoHEt-crdN2tsCyFZHseU_-xfxphs5_CiE9m8-E4umHhWWkx7wzPd2kmf3xaLEyTZhJ6ZA8WQ6LJ1Wt57x_ZBq3a5Xhlu3mGQnjVjzxUW8Yy42YWpHXmZ9Qv2kC2OPJ1k-zMoD1XH8RAA33SMC2cR9LFUtbA0sLEjD6cRaDESq3GHEkNkY76y7xGsPX_JoZNuiwc_pbxILWWeU3JlELnZy6V4eT6udAP6Yx-V_Vwbor37WqDSQSTxV3ZLtMMXJqRZU7ZDOwumYOeZCrtPqupvqfsDXei1CkLO32_KdsV9V0woNgcLdJ_1Zw45D14Khq1bICx6LLccC1dfqzKeBZBBZqsJk6RKM7Rhel1lF-iI4Otny3Vm0LYCnPSBP3eOvAsoWClRBAi-02e1KLM1H_G3ksJxid72kTsICJ_tC8fW6Wawf26ShRHPyXTMxDstyLU8Mt3RzpdLMRitH_cvWvwxIDuP5pqF4m32jXgOnGu3wJpdjWIL_spqSZI_rGC7bL-4NFYNh5NnmrmEkUquNK5UMibUysG7Zg7SnIzlJnLUQuc_7PNW17h1MA4GI-NnACemHif_y4Jfdpjn0b31BMNi7wmPv6T0A8397lzxQFQ-FND-eRyIPLheK3FmdZvdSvwFNJC001aCEohnQF0BgJH5xzi8P2E8bXqqA0U3_aa3mFkMr4wzRmqAUHyt5lgs1jmYS3Ic748GicKU3Zp2bWHm1U8p3-I9DEoR_DrSdvxkP_GcYvnqWPGQquJWsxGjtfwiCodgtB-IkHZP7Q.rtHqphdewPG8e7nwcTCJSQ\",\"token_type\":\"bearer\",\"expires_in\":3600}", + "status": 200, + "statusText": "OK" + }, + "body": "{\"x_refresh_token_expires_in\":8725424,\"refresh_token\":\"AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz\",\"access_token\":\"eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..VGsSwWZTU-60cqrGD_-I3A.6PwjwjsQ-MKm_JYZt2Jix0h0DZhLUQgtmEd8XYN30kDdQ8LHBoGtM89D0rMlBcThr23bPo7OoHEt-crdN2tsCyFZHseU_-xfxphs5_CiE9m8-E4umHhWWkx7wzPd2kmf3xaLEyTZhJ6ZA8WQ6LJ1Wt57x_ZBq3a5Xhlu3mGQnjVjzxUW8Yy42YWpHXmZ9Qv2kC2OPJ1k-zMoD1XH8RAA33SMC2cR9LFUtbA0sLEjD6cRaDESq3GHEkNkY76y7xGsPX_JoZNuiwc_pbxILWWeU3JlELnZy6V4eT6udAP6Yx-V_Vwbor37WqDSQSTxV3ZLtMMXJqRZU7ZDOwumYOeZCrtPqupvqfsDXei1CkLO32_KdsV9V0woNgcLdJ_1Zw45D14Khq1bICx6LLccC1dfqzKeBZBBZqsJk6RKM7Rhel1lF-iI4Otny3Vm0LYCnPSBP3eOvAsoWClRBAi-02e1KLM1H_G3ksJxid72kTsICJ_tC8fW6Wawf26ShRHPyXTMxDstyLU8Mt3RzpdLMRitH_cvWvwxIDuP5pqF4m32jXgOnGu3wJpdjWIL_spqSZI_rGC7bL-4NFYNh5NnmrmEkUquNK5UMibUysG7Zg7SnIzlJnLUQuc_7PNW17h1MA4GI-NnACemHif_y4Jfdpjn0b31BMNi7wmPv6T0A8397lzxQFQ-FND-eRyIPLheK3FmdZvdSvwFNJC001aCEohnQF0BgJH5xzi8P2E8bXqqA0U3_aa3mFkMr4wzRmqAUHyt5lgs1jmYS3Ic748GicKU3Zp2bWHm1U8p3-I9DEoR_DrSdvxkP_GcYvnqWPGQquJWsxGjtfwiCodgtB-IkHZP7Q.rtHqphdewPG8e7nwcTCJSQ\",\"token_type\":\"bearer\",\"expires_in\":3600}", + "json": { + "x_refresh_token_expires_in": 8725424, + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..VGsSwWZTU-60cqrGD_-I3A.6PwjwjsQ-MKm_JYZt2Jix0h0DZhLUQgtmEd8XYN30kDdQ8LHBoGtM89D0rMlBcThr23bPo7OoHEt-crdN2tsCyFZHseU_-xfxphs5_CiE9m8-E4umHhWWkx7wzPd2kmf3xaLEyTZhJ6ZA8WQ6LJ1Wt57x_ZBq3a5Xhlu3mGQnjVjzxUW8Yy42YWpHXmZ9Qv2kC2OPJ1k-zMoD1XH8RAA33SMC2cR9LFUtbA0sLEjD6cRaDESq3GHEkNkY76y7xGsPX_JoZNuiwc_pbxILWWeU3JlELnZy6V4eT6udAP6Yx-V_Vwbor37WqDSQSTxV3ZLtMMXJqRZU7ZDOwumYOeZCrtPqupvqfsDXei1CkLO32_KdsV9V0woNgcLdJ_1Zw45D14Khq1bICx6LLccC1dfqzKeBZBBZqsJk6RKM7Rhel1lF-iI4Otny3Vm0LYCnPSBP3eOvAsoWClRBAi-02e1KLM1H_G3ksJxid72kTsICJ_tC8fW6Wawf26ShRHPyXTMxDstyLU8Mt3RzpdLMRitH_cvWvwxIDuP5pqF4m32jXgOnGu3wJpdjWIL_spqSZI_rGC7bL-4NFYNh5NnmrmEkUquNK5UMibUysG7Zg7SnIzlJnLUQuc_7PNW17h1MA4GI-NnACemHif_y4Jfdpjn0b31BMNi7wmPv6T0A8397lzxQFQ-FND-eRyIPLheK3FmdZvdSvwFNJC001aCEohnQF0BgJH5xzi8P2E8bXqqA0U3_aa3mFkMr4wzRmqAUHyt5lgs1jmYS3Ic748GicKU3Zp2bWHm1U8p3-I9DEoR_DrSdvxkP_GcYvnqWPGQquJWsxGjtfwiCodgtB-IkHZP7Q.rtHqphdewPG8e7nwcTCJSQ", + "token_type": "bearer", + "expires_in": 3600 + }, + "intuit_tid": "1-62715d1d-2a96a60d27838f1504791b82" +} +2022-05-03T16:49:36.745Z info: The makeAPICall () response is : { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..VGsSwWZTU-60cqrGD_-I3A.6PwjwjsQ-MKm_JYZt2Jix0h0DZhLUQgtmEd8XYN30kDdQ8LHBoGtM89D0rMlBcThr23bPo7OoHEt-crdN2tsCyFZHseU_-xfxphs5_CiE9m8-E4umHhWWkx7wzPd2kmf3xaLEyTZhJ6ZA8WQ6LJ1Wt57x_ZBq3a5Xhlu3mGQnjVjzxUW8Yy42YWpHXmZ9Qv2kC2OPJ1k-zMoD1XH8RAA33SMC2cR9LFUtbA0sLEjD6cRaDESq3GHEkNkY76y7xGsPX_JoZNuiwc_pbxILWWeU3JlELnZy6V4eT6udAP6Yx-V_Vwbor37WqDSQSTxV3ZLtMMXJqRZU7ZDOwumYOeZCrtPqupvqfsDXei1CkLO32_KdsV9V0woNgcLdJ_1Zw45D14Khq1bICx6LLccC1dfqzKeBZBBZqsJk6RKM7Rhel1lF-iI4Otny3Vm0LYCnPSBP3eOvAsoWClRBAi-02e1KLM1H_G3ksJxid72kTsICJ_tC8fW6Wawf26ShRHPyXTMxDstyLU8Mt3RzpdLMRitH_cvWvwxIDuP5pqF4m32jXgOnGu3wJpdjWIL_spqSZI_rGC7bL-4NFYNh5NnmrmEkUquNK5UMibUysG7Zg7SnIzlJnLUQuc_7PNW17h1MA4GI-NnACemHif_y4Jfdpjn0b31BMNi7wmPv6T0A8397lzxQFQ-FND-eRyIPLheK3FmdZvdSvwFNJC001aCEohnQF0BgJH5xzi8P2E8bXqqA0U3_aa3mFkMr4wzRmqAUHyt5lgs1jmYS3Ic748GicKU3Zp2bWHm1U8p3-I9DEoR_DrSdvxkP_GcYvnqWPGQquJWsxGjtfwiCodgtB-IkHZP7Q.rtHqphdewPG8e7nwcTCJSQ", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725424, + "id_token": "", + "latency": 60000, + "createdAt": 1651596575967 + }, + "response": { + "url": "https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365180784560/query?query=select%20*%20From%20vendor%20where%20DisplayName%20%3D%20%27Test%5C%27s%20Vendor%27", + "headers": { + "date": "Tue, 03 May 2022 16:49:33 GMT", + "content-type": "application/json;charset=utf-8", + "transfer-encoding": "chunked", + "connection": "close", + "intuit_tid": "1-62715d1d-7ebcfb9e4ee7a668595e333d", + "x-spanid": "0df4aee0-3e20-49ad-a04f-cf3dd00c1454", + "x-amzn-trace-id": "Root=1-62715d1d-7ebcfb9e4ee7a668595e333d", + "x-content-type-options": "nosniff", + "x-xss-protection": "1; mode=block", + "qbo-version": "1979.197", + "service-time": "total=119, db=43", + "expires": "0", + "content-encoding": "gzip", + "cache-control": "max-age=0, no-cache, no-store, must-revalidate, private", + "x-envoy-upstream-service-time": "154", + "strict-transport-security": "max-age=31536000", + "server": "envoy" + }, + "body": "{\"QueryResponse\":{\"Vendor\":[{\"Balance\":352.80,\"Vendor1099\":false,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"60\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-31T09:54:54-07:00\",\"LastUpdatedTime\":\"2022-03-31T10:35:00-07:00\"},\"DisplayName\":\"Test's Vendor\",\"PrintOnCheckName\":\"Test's Vendor\",\"Active\":true}],\"startPosition\":1,\"maxResults\":1},\"time\":\"2022-05-03T09:49:33.854-07:00\"}", + "status": 200, + "statusText": "OK" + }, + "body": "{\"QueryResponse\":{\"Vendor\":[{\"Balance\":352.80,\"Vendor1099\":false,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"60\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-31T09:54:54-07:00\",\"LastUpdatedTime\":\"2022-03-31T10:35:00-07:00\"},\"DisplayName\":\"Test's Vendor\",\"PrintOnCheckName\":\"Test's Vendor\",\"Active\":true}],\"startPosition\":1,\"maxResults\":1},\"time\":\"2022-05-03T09:49:33.854-07:00\"}", + "json": { + "QueryResponse": { + "Vendor": [ + { + "Balance": 352.8, + "Vendor1099": false, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "60", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2022-03-31T09:54:54-07:00", + "LastUpdatedTime": "2022-03-31T10:35:00-07:00" + }, + "DisplayName": "Test's Vendor", + "PrintOnCheckName": "Test's Vendor", + "Active": true + } + ], + "startPosition": 1, + "maxResults": 1 + }, + "time": "2022-05-03T09:49:33.854-07:00" + }, + "intuit_tid": "1-62715d1d-7ebcfb9e4ee7a668595e333d" +} +2022-05-03T16:49:36.848Z info: The makeAPICall () response is : { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..VGsSwWZTU-60cqrGD_-I3A.6PwjwjsQ-MKm_JYZt2Jix0h0DZhLUQgtmEd8XYN30kDdQ8LHBoGtM89D0rMlBcThr23bPo7OoHEt-crdN2tsCyFZHseU_-xfxphs5_CiE9m8-E4umHhWWkx7wzPd2kmf3xaLEyTZhJ6ZA8WQ6LJ1Wt57x_ZBq3a5Xhlu3mGQnjVjzxUW8Yy42YWpHXmZ9Qv2kC2OPJ1k-zMoD1XH8RAA33SMC2cR9LFUtbA0sLEjD6cRaDESq3GHEkNkY76y7xGsPX_JoZNuiwc_pbxILWWeU3JlELnZy6V4eT6udAP6Yx-V_Vwbor37WqDSQSTxV3ZLtMMXJqRZU7ZDOwumYOeZCrtPqupvqfsDXei1CkLO32_KdsV9V0woNgcLdJ_1Zw45D14Khq1bICx6LLccC1dfqzKeBZBBZqsJk6RKM7Rhel1lF-iI4Otny3Vm0LYCnPSBP3eOvAsoWClRBAi-02e1KLM1H_G3ksJxid72kTsICJ_tC8fW6Wawf26ShRHPyXTMxDstyLU8Mt3RzpdLMRitH_cvWvwxIDuP5pqF4m32jXgOnGu3wJpdjWIL_spqSZI_rGC7bL-4NFYNh5NnmrmEkUquNK5UMibUysG7Zg7SnIzlJnLUQuc_7PNW17h1MA4GI-NnACemHif_y4Jfdpjn0b31BMNi7wmPv6T0A8397lzxQFQ-FND-eRyIPLheK3FmdZvdSvwFNJC001aCEohnQF0BgJH5xzi8P2E8bXqqA0U3_aa3mFkMr4wzRmqAUHyt5lgs1jmYS3Ic748GicKU3Zp2bWHm1U8p3-I9DEoR_DrSdvxkP_GcYvnqWPGQquJWsxGjtfwiCodgtB-IkHZP7Q.rtHqphdewPG8e7nwcTCJSQ", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725424, + "id_token": "", + "latency": 60000, + "createdAt": 1651596575967 + }, + "response": { + "url": "https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365180784560/query?query=select%20*%20From%20Account%20where%20AccountType%20in%20(%27Cost%20of%20Goods%20Sold%27%2C%20%27Other%20Current%20Liability%27)", + "headers": { + "date": "Tue, 03 May 2022 16:49:33 GMT", + "content-type": "application/json;charset=utf-8", + "transfer-encoding": "chunked", + "connection": "close", + "intuit_tid": "1-62715d1d-56b34bcb44559842064d8e9b", + "x-spanid": "a267f976-99c3-4c84-92a5-a68b66fb24ce", + "x-amzn-trace-id": "Root=1-62715d1d-56b34bcb44559842064d8e9b", + "x-content-type-options": "nosniff", + "x-xss-protection": "1; mode=block", + "qbo-version": "1979.197", + "service-time": "total=34, db=27", + "expires": "0", + "content-encoding": "gzip", + "cache-control": "max-age=0, no-cache, no-store, must-revalidate, private", + "x-envoy-upstream-service-time": "58", + "strict-transport-security": "max-age=31536000", + "server": "envoy" + }, + "body": "{\"QueryResponse\":{\"Account\":[{\"Name\":\"Arizona Dept. of Revenue Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Arizona Dept. of Revenue Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"89\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-30T13:05:01-07:00\"}},{\"Name\":\"BC Minister of Finance Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"BC Minister of Finance Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"91\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-29T17:07:57-07:00\",\"LastUpdatedTime\":\"2022-03-30T16:45:29-07:00\"}},{\"Name\":\"Board of Equalization Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Board of Equalization Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":-370.94,\"CurrentBalanceWithSubAccounts\":-370.94,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"90\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-30T13:16:17-07:00\"}},{\"Name\":\"Cost of Goods Sold\",\"SubAccount\":false,\"FullyQualifiedName\":\"Cost of Goods Sold\",\"Active\":true,\"Classification\":\"Expense\",\"AccountType\":\"Cost of Goods Sold\",\"AccountSubType\":\"SuppliesMaterialsCogs\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"80\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-27T10:36:04-07:00\",\"LastUpdatedTime\":\"2021-07-27T10:36:04-07:00\"}},{\"Name\":\"Federal Income Tax Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Federal Income Tax Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"FederalIncomeTaxPayable\",\"CurrentBalance\":16.80,\"CurrentBalanceWithSubAccounts\":16.80,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"92\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-31T10:18:57-07:00\",\"LastUpdatedTime\":\"2022-03-31T10:35:00-07:00\"}},{\"Name\":\"Loan Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Loan Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"OtherCurrentLiabilities\",\"CurrentBalance\":-4000.00,\"CurrentBalanceWithSubAccounts\":-4000.00,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"43\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-27T10:03:25-07:00\",\"LastUpdatedTime\":\"2021-07-27T10:03:25-07:00\"}}],\"startPosition\":1,\"maxResults\":6},\"time\":\"2022-05-03T09:49:33.962-07:00\"}", + "status": 200, + "statusText": "OK" + }, + "body": "{\"QueryResponse\":{\"Account\":[{\"Name\":\"Arizona Dept. of Revenue Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Arizona Dept. of Revenue Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"89\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-30T13:05:01-07:00\"}},{\"Name\":\"BC Minister of Finance Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"BC Minister of Finance Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"91\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-29T17:07:57-07:00\",\"LastUpdatedTime\":\"2022-03-30T16:45:29-07:00\"}},{\"Name\":\"Board of Equalization Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Board of Equalization Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":-370.94,\"CurrentBalanceWithSubAccounts\":-370.94,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"90\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-30T13:16:17-07:00\"}},{\"Name\":\"Cost of Goods Sold\",\"SubAccount\":false,\"FullyQualifiedName\":\"Cost of Goods Sold\",\"Active\":true,\"Classification\":\"Expense\",\"AccountType\":\"Cost of Goods Sold\",\"AccountSubType\":\"SuppliesMaterialsCogs\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"80\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-27T10:36:04-07:00\",\"LastUpdatedTime\":\"2021-07-27T10:36:04-07:00\"}},{\"Name\":\"Federal Income Tax Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Federal Income Tax Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"FederalIncomeTaxPayable\",\"CurrentBalance\":16.80,\"CurrentBalanceWithSubAccounts\":16.80,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"92\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-31T10:18:57-07:00\",\"LastUpdatedTime\":\"2022-03-31T10:35:00-07:00\"}},{\"Name\":\"Loan Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Loan Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"OtherCurrentLiabilities\",\"CurrentBalance\":-4000.00,\"CurrentBalanceWithSubAccounts\":-4000.00,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"43\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-27T10:03:25-07:00\",\"LastUpdatedTime\":\"2021-07-27T10:03:25-07:00\"}}],\"startPosition\":1,\"maxResults\":6},\"time\":\"2022-05-03T09:49:33.962-07:00\"}", + "json": { + "QueryResponse": { + "Account": [ + { + "Name": "Arizona Dept. of Revenue Payable", + "SubAccount": false, + "FullyQualifiedName": "Arizona Dept. of Revenue Payable", + "Active": true, + "Classification": "Liability", + "AccountType": "Other Current Liability", + "AccountSubType": "GlobalTaxPayable", + "CurrentBalance": 0, + "CurrentBalanceWithSubAccounts": 0, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "89", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-29T12:17:04-07:00", + "LastUpdatedTime": "2021-07-30T13:05:01-07:00" + } + }, + { + "Name": "BC Minister of Finance Payable", + "SubAccount": false, + "FullyQualifiedName": "BC Minister of Finance Payable", + "Active": true, + "Classification": "Liability", + "AccountType": "Other Current Liability", + "AccountSubType": "GlobalTaxPayable", + "CurrentBalance": 0, + "CurrentBalanceWithSubAccounts": 0, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "91", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2022-03-29T17:07:57-07:00", + "LastUpdatedTime": "2022-03-30T16:45:29-07:00" + } + }, + { + "Name": "Board of Equalization Payable", + "SubAccount": false, + "FullyQualifiedName": "Board of Equalization Payable", + "Active": true, + "Classification": "Liability", + "AccountType": "Other Current Liability", + "AccountSubType": "GlobalTaxPayable", + "CurrentBalance": -370.94, + "CurrentBalanceWithSubAccounts": -370.94, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "90", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-29T12:17:04-07:00", + "LastUpdatedTime": "2021-07-30T13:16:17-07:00" + } + }, + { + "Name": "Cost of Goods Sold", + "SubAccount": false, + "FullyQualifiedName": "Cost of Goods Sold", + "Active": true, + "Classification": "Expense", + "AccountType": "Cost of Goods Sold", + "AccountSubType": "SuppliesMaterialsCogs", + "CurrentBalance": 0, + "CurrentBalanceWithSubAccounts": 0, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "80", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-27T10:36:04-07:00", + "LastUpdatedTime": "2021-07-27T10:36:04-07:00" + } + }, + { + "Name": "Federal Income Tax Payable", + "SubAccount": false, + "FullyQualifiedName": "Federal Income Tax Payable", + "Active": true, + "Classification": "Liability", + "AccountType": "Other Current Liability", + "AccountSubType": "FederalIncomeTaxPayable", + "CurrentBalance": 16.8, + "CurrentBalanceWithSubAccounts": 16.8, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "92", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2022-03-31T10:18:57-07:00", + "LastUpdatedTime": "2022-03-31T10:35:00-07:00" + } + }, + { + "Name": "Loan Payable", + "SubAccount": false, + "FullyQualifiedName": "Loan Payable", + "Active": true, + "Classification": "Liability", + "AccountType": "Other Current Liability", + "AccountSubType": "OtherCurrentLiabilities", + "CurrentBalance": -4000, + "CurrentBalanceWithSubAccounts": -4000, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "43", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-27T10:03:25-07:00", + "LastUpdatedTime": "2021-07-27T10:03:25-07:00" + } + } + ], + "startPosition": 1, + "maxResults": 6 + }, + "time": "2022-05-03T09:49:33.962-07:00" + }, + "intuit_tid": "1-62715d1d-56b34bcb44559842064d8e9b" +} +2022-05-03T16:49:36.981Z info: The makeAPICall () response is : { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..VGsSwWZTU-60cqrGD_-I3A.6PwjwjsQ-MKm_JYZt2Jix0h0DZhLUQgtmEd8XYN30kDdQ8LHBoGtM89D0rMlBcThr23bPo7OoHEt-crdN2tsCyFZHseU_-xfxphs5_CiE9m8-E4umHhWWkx7wzPd2kmf3xaLEyTZhJ6ZA8WQ6LJ1Wt57x_ZBq3a5Xhlu3mGQnjVjzxUW8Yy42YWpHXmZ9Qv2kC2OPJ1k-zMoD1XH8RAA33SMC2cR9LFUtbA0sLEjD6cRaDESq3GHEkNkY76y7xGsPX_JoZNuiwc_pbxILWWeU3JlELnZy6V4eT6udAP6Yx-V_Vwbor37WqDSQSTxV3ZLtMMXJqRZU7ZDOwumYOeZCrtPqupvqfsDXei1CkLO32_KdsV9V0woNgcLdJ_1Zw45D14Khq1bICx6LLccC1dfqzKeBZBBZqsJk6RKM7Rhel1lF-iI4Otny3Vm0LYCnPSBP3eOvAsoWClRBAi-02e1KLM1H_G3ksJxid72kTsICJ_tC8fW6Wawf26ShRHPyXTMxDstyLU8Mt3RzpdLMRitH_cvWvwxIDuP5pqF4m32jXgOnGu3wJpdjWIL_spqSZI_rGC7bL-4NFYNh5NnmrmEkUquNK5UMibUysG7Zg7SnIzlJnLUQuc_7PNW17h1MA4GI-NnACemHif_y4Jfdpjn0b31BMNi7wmPv6T0A8397lzxQFQ-FND-eRyIPLheK3FmdZvdSvwFNJC001aCEohnQF0BgJH5xzi8P2E8bXqqA0U3_aa3mFkMr4wzRmqAUHyt5lgs1jmYS3Ic748GicKU3Zp2bWHm1U8p3-I9DEoR_DrSdvxkP_GcYvnqWPGQquJWsxGjtfwiCodgtB-IkHZP7Q.rtHqphdewPG8e7nwcTCJSQ", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725424, + "id_token": "", + "latency": 60000, + "createdAt": 1651596575967 + }, + "response": { + "url": "https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365180784560/query?query=select%20*%20From%20TaxCode", + "headers": { + "date": "Tue, 03 May 2022 16:49:34 GMT", + "content-type": "application/json;charset=utf-8", + "transfer-encoding": "chunked", + "connection": "close", + "intuit_tid": "1-62715d1e-25b58da2061993e5079d9dda", + "x-spanid": "b3efea55-ea84-4210-9d68-bd4430a67061", + "x-amzn-trace-id": "Root=1-62715d1e-25b58da2061993e5079d9dda", + "x-content-type-options": "nosniff", + "x-xss-protection": "1; mode=block", + "qbo-version": "1979.197", + "service-time": "total=54, db=47", + "expires": "0", + "content-encoding": "gzip", + "cache-control": "max-age=0, no-cache, no-store, must-revalidate, private", + "x-envoy-upstream-service-time": "90", + "strict-transport-security": "max-age=31536000", + "server": "envoy" + }, + "body": "{\"QueryResponse\":{\"TaxCode\":[{\"Name\":\"TAX\",\"Description\":\"TAX\",\"Taxable\":true,\"TaxGroup\":false,\"Id\":\"TAX\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"NON\",\"Description\":\"NON\",\"Taxable\":false,\"TaxGroup\":false,\"Id\":\"NON\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"CustomSalesTax\",\"Description\":\"CustomSalesTax\",\"Taxable\":true,\"TaxGroup\":true,\"Id\":\"CustomSalesTax\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"California\",\"Description\":\"California\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"3\",\"name\":\"California\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"2\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-29T12:17:04-07:00\"}},{\"Name\":\"PST\",\"Description\":\"PST\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"6\",\"name\":\"PST\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"4\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-29T17:07:57-07:00\",\"LastUpdatedTime\":\"2022-03-29T17:07:57-07:00\"}},{\"Name\":\"Tucson\",\"Description\":\"Tucson\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"1\",\"name\":\"AZ State tax\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0},{\"TaxRateRef\":{\"value\":\"2\",\"name\":\"Tucson City\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"3\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-29T12:17:04-07:00\"}}],\"startPosition\":1,\"maxResults\":6,\"totalCount\":6},\"time\":\"2022-05-03T09:49:34.078-07:00\"}", + "status": 200, + "statusText": "OK" + }, + "body": "{\"QueryResponse\":{\"TaxCode\":[{\"Name\":\"TAX\",\"Description\":\"TAX\",\"Taxable\":true,\"TaxGroup\":false,\"Id\":\"TAX\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"NON\",\"Description\":\"NON\",\"Taxable\":false,\"TaxGroup\":false,\"Id\":\"NON\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"CustomSalesTax\",\"Description\":\"CustomSalesTax\",\"Taxable\":true,\"TaxGroup\":true,\"Id\":\"CustomSalesTax\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"California\",\"Description\":\"California\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"3\",\"name\":\"California\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"2\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-29T12:17:04-07:00\"}},{\"Name\":\"PST\",\"Description\":\"PST\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"6\",\"name\":\"PST\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"4\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-29T17:07:57-07:00\",\"LastUpdatedTime\":\"2022-03-29T17:07:57-07:00\"}},{\"Name\":\"Tucson\",\"Description\":\"Tucson\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"1\",\"name\":\"AZ State tax\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0},{\"TaxRateRef\":{\"value\":\"2\",\"name\":\"Tucson City\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"3\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-29T12:17:04-07:00\"}}],\"startPosition\":1,\"maxResults\":6,\"totalCount\":6},\"time\":\"2022-05-03T09:49:34.078-07:00\"}", + "json": { + "QueryResponse": { + "TaxCode": [ + { + "Name": "TAX", + "Description": "TAX", + "Taxable": true, + "TaxGroup": false, + "Id": "TAX", + "MetaData": { + "CreateTime": "2021-08-25T12:52:52-07:00", + "LastUpdatedTime": "2021-08-25T12:52:52-07:00" + } + }, + { + "Name": "NON", + "Description": "NON", + "Taxable": false, + "TaxGroup": false, + "Id": "NON", + "MetaData": { + "CreateTime": "2021-08-25T12:52:52-07:00", + "LastUpdatedTime": "2021-08-25T12:52:52-07:00" + } + }, + { + "Name": "CustomSalesTax", + "Description": "CustomSalesTax", + "Taxable": true, + "TaxGroup": true, + "Id": "CustomSalesTax", + "MetaData": { + "CreateTime": "2021-08-25T12:52:52-07:00", + "LastUpdatedTime": "2021-08-25T12:52:52-07:00" + } + }, + { + "Name": "California", + "Description": "California", + "Active": true, + "Taxable": true, + "TaxGroup": true, + "SalesTaxRateList": { + "TaxRateDetail": [ + { + "TaxRateRef": { + "value": "3", + "name": "California" + }, + "TaxTypeApplicable": "TaxOnAmount", + "TaxOrder": 0 + } + ] + }, + "PurchaseTaxRateList": { + "TaxRateDetail": [] + }, + "domain": "QBO", + "sparse": false, + "Id": "2", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-29T12:17:04-07:00", + "LastUpdatedTime": "2021-07-29T12:17:04-07:00" + } + }, + { + "Name": "PST", + "Description": "PST", + "Active": true, + "Taxable": true, + "TaxGroup": true, + "SalesTaxRateList": { + "TaxRateDetail": [ + { + "TaxRateRef": { + "value": "6", + "name": "PST" + }, + "TaxTypeApplicable": "TaxOnAmount", + "TaxOrder": 0 + } + ] + }, + "PurchaseTaxRateList": { + "TaxRateDetail": [] + }, + "domain": "QBO", + "sparse": false, + "Id": "4", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2022-03-29T17:07:57-07:00", + "LastUpdatedTime": "2022-03-29T17:07:57-07:00" + } + }, + { + "Name": "Tucson", + "Description": "Tucson", + "Active": true, + "Taxable": true, + "TaxGroup": true, + "SalesTaxRateList": { + "TaxRateDetail": [ + { + "TaxRateRef": { + "value": "1", + "name": "AZ State tax" + }, + "TaxTypeApplicable": "TaxOnAmount", + "TaxOrder": 0 + }, + { + "TaxRateRef": { + "value": "2", + "name": "Tucson City" + }, + "TaxTypeApplicable": "TaxOnAmount", + "TaxOrder": 0 + } + ] + }, + "PurchaseTaxRateList": { + "TaxRateDetail": [] + }, + "domain": "QBO", + "sparse": false, + "Id": "3", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-29T12:17:04-07:00", + "LastUpdatedTime": "2021-07-29T12:17:04-07:00" + } + } + ], + "startPosition": 1, + "maxResults": 6, + "totalCount": 6 + }, + "time": "2022-05-03T09:49:34.078-07:00" + }, + "intuit_tid": "1-62715d1e-25b58da2061993e5079d9dda" +} +2022-05-03T16:49:37.086Z info: The makeAPICall () response is : { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..VGsSwWZTU-60cqrGD_-I3A.6PwjwjsQ-MKm_JYZt2Jix0h0DZhLUQgtmEd8XYN30kDdQ8LHBoGtM89D0rMlBcThr23bPo7OoHEt-crdN2tsCyFZHseU_-xfxphs5_CiE9m8-E4umHhWWkx7wzPd2kmf3xaLEyTZhJ6ZA8WQ6LJ1Wt57x_ZBq3a5Xhlu3mGQnjVjzxUW8Yy42YWpHXmZ9Qv2kC2OPJ1k-zMoD1XH8RAA33SMC2cR9LFUtbA0sLEjD6cRaDESq3GHEkNkY76y7xGsPX_JoZNuiwc_pbxILWWeU3JlELnZy6V4eT6udAP6Yx-V_Vwbor37WqDSQSTxV3ZLtMMXJqRZU7ZDOwumYOeZCrtPqupvqfsDXei1CkLO32_KdsV9V0woNgcLdJ_1Zw45D14Khq1bICx6LLccC1dfqzKeBZBBZqsJk6RKM7Rhel1lF-iI4Otny3Vm0LYCnPSBP3eOvAsoWClRBAi-02e1KLM1H_G3ksJxid72kTsICJ_tC8fW6Wawf26ShRHPyXTMxDstyLU8Mt3RzpdLMRitH_cvWvwxIDuP5pqF4m32jXgOnGu3wJpdjWIL_spqSZI_rGC7bL-4NFYNh5NnmrmEkUquNK5UMibUysG7Zg7SnIzlJnLUQuc_7PNW17h1MA4GI-NnACemHif_y4Jfdpjn0b31BMNi7wmPv6T0A8397lzxQFQ-FND-eRyIPLheK3FmdZvdSvwFNJC001aCEohnQF0BgJH5xzi8P2E8bXqqA0U3_aa3mFkMr4wzRmqAUHyt5lgs1jmYS3Ic748GicKU3Zp2bWHm1U8p3-I9DEoR_DrSdvxkP_GcYvnqWPGQquJWsxGjtfwiCodgtB-IkHZP7Q.rtHqphdewPG8e7nwcTCJSQ", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725424, + "id_token": "", + "latency": 60000, + "createdAt": 1651596575967 + }, + "response": { + "url": "https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365180784560/query?query=select%20*%20From%20Class", + "headers": { + "date": "Tue, 03 May 2022 16:49:34 GMT", + "content-type": "application/json;charset=utf-8", + "transfer-encoding": "chunked", + "connection": "close", + "intuit_tid": "1-62715d1e-6a6c64930d5fa5d83aa92649", + "x-spanid": "d7c1f640-ead1-4c72-a204-34329051ddc7", + "x-amzn-trace-id": "Root=1-62715d1e-6a6c64930d5fa5d83aa92649", + "x-content-type-options": "nosniff", + "x-xss-protection": "1; mode=block", + "qbo-version": "1979.197", + "service-time": "total=35, db=32", + "expires": "0", + "content-encoding": "gzip", + "cache-control": "max-age=0, no-cache, no-store, must-revalidate, private", + "x-envoy-upstream-service-time": "60", + "strict-transport-security": "max-age=31536000", + "server": "envoy" + }, + "body": "{\"QueryResponse\":{},\"time\":\"2022-05-03T09:49:34.201-07:00\"}", + "status": 200, + "statusText": "OK" + }, + "body": "{\"QueryResponse\":{},\"time\":\"2022-05-03T09:49:34.201-07:00\"}", + "json": { + "QueryResponse": {}, + "time": "2022-05-03T09:49:34.201-07:00" + }, + "intuit_tid": "1-62715d1e-6a6c64930d5fa5d83aa92649" +} +2022-05-03T16:49:37.206Z error: Get makeAPICall () threw an exception : { + "authResponse": { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..VGsSwWZTU-60cqrGD_-I3A.6PwjwjsQ-MKm_JYZt2Jix0h0DZhLUQgtmEd8XYN30kDdQ8LHBoGtM89D0rMlBcThr23bPo7OoHEt-crdN2tsCyFZHseU_-xfxphs5_CiE9m8-E4umHhWWkx7wzPd2kmf3xaLEyTZhJ6ZA8WQ6LJ1Wt57x_ZBq3a5Xhlu3mGQnjVjzxUW8Yy42YWpHXmZ9Qv2kC2OPJ1k-zMoD1XH8RAA33SMC2cR9LFUtbA0sLEjD6cRaDESq3GHEkNkY76y7xGsPX_JoZNuiwc_pbxILWWeU3JlELnZy6V4eT6udAP6Yx-V_Vwbor37WqDSQSTxV3ZLtMMXJqRZU7ZDOwumYOeZCrtPqupvqfsDXei1CkLO32_KdsV9V0woNgcLdJ_1Zw45D14Khq1bICx6LLccC1dfqzKeBZBBZqsJk6RKM7Rhel1lF-iI4Otny3Vm0LYCnPSBP3eOvAsoWClRBAi-02e1KLM1H_G3ksJxid72kTsICJ_tC8fW6Wawf26ShRHPyXTMxDstyLU8Mt3RzpdLMRitH_cvWvwxIDuP5pqF4m32jXgOnGu3wJpdjWIL_spqSZI_rGC7bL-4NFYNh5NnmrmEkUquNK5UMibUysG7Zg7SnIzlJnLUQuc_7PNW17h1MA4GI-NnACemHif_y4Jfdpjn0b31BMNi7wmPv6T0A8397lzxQFQ-FND-eRyIPLheK3FmdZvdSvwFNJC001aCEohnQF0BgJH5xzi8P2E8bXqqA0U3_aa3mFkMr4wzRmqAUHyt5lgs1jmYS3Ic748GicKU3Zp2bWHm1U8p3-I9DEoR_DrSdvxkP_GcYvnqWPGQquJWsxGjtfwiCodgtB-IkHZP7Q.rtHqphdewPG8e7nwcTCJSQ", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725424, + "id_token": "", + "latency": 60000, + "createdAt": 1651596575967 + }, + "response": { + "url": "https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365180784560/bill", + "headers": { + "date": "Tue, 03 May 2022 16:49:34 GMT", + "content-type": "application/json", + "content-length": "321", + "connection": "close", + "intuit_tid": "1-62715d1e-267e95c9412095a65dbabeee", + "x-spanid": "d517244f-2373-447b-922c-c196aa46e611", + "x-amzn-trace-id": "Root=1-62715d1e-267e95c9412095a65dbabeee", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "66", + "strict-transport-security": "max-age=31536000", + "server": "envoy" + }, + "body": "{\"Fault\":{\"Error\":[{\"Message\":\"Required param missing, need to supply the required value for the API\",\"Detail\":\"Required parameter Line.AccountBasedExpenseLineDetail is missing in the request\",\"code\":\"2020\",\"element\":\"Line.AccountBasedExpenseLineDetail\"}],\"type\":\"ValidationFault\"},\"time\":\"2022-05-03T09:49:34.336-07:00\"}", + "status": 400, + "statusText": "Bad Request" + }, + "body": "{\"Fault\":{\"Error\":[{\"Message\":\"Required param missing, need to supply the required value for the API\",\"Detail\":\"Required parameter Line.AccountBasedExpenseLineDetail is missing in the request\",\"code\":\"2020\",\"element\":\"Line.AccountBasedExpenseLineDetail\"}],\"type\":\"ValidationFault\"},\"time\":\"2022-05-03T09:49:34.336-07:00\"}", + "json": { + "Fault": { + "Error": [ + { + "Message": "Required param missing, need to supply the required value for the API", + "Detail": "Required parameter Line.AccountBasedExpenseLineDetail is missing in the request", + "code": "2020", + "element": "Line.AccountBasedExpenseLineDetail" + } + ], + "type": "ValidationFault" + }, + "time": "2022-05-03T09:49:34.336-07:00" + }, + "intuit_tid": "1-62715d1e-267e95c9412095a65dbabeee" + }, + "originalMessage": "Response has an Error", + "error": "Bad Request", + "error_description": "Bad Request", + "intuit_tid": "1-62715d1e-267e95c9412095a65dbabeee" +} +2022-05-03T16:50:26.461Z info: Refresh Token () response is : { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..-3MteSIdRG4apOikC2ba7w.fc1lxoSYu5sxYgdxqAXXDH_890s9kFgFeSBD7rJPM44r2liJuHlgKTjolqzWP8MBe6BX__r32CVFyS2KGUmHxXTw-UMnjiDYWGE_5RzUDxexW6Oym0ubCEcgVS6RnNWFAov6c7nzeXMSdNhfTumfMavcgkjcoFddb9kxGNJ8U2aHSQ7Ydct9JwTCUB5EegI5M4z6_IvJqTT7x3nnyH7KSsR7EGEQjOJwaOd267sM00ZQm9MBDFt0bVhQiYJsaBZI5A5pH4-VuC5rBrWyDU4CmKkObGQKLmKh4nW1EDC8sAtZF1qTyfxe-aV8eKEiLfPNQfCe3VTPpuP_U74UjKPramRUym09OZHP2E3jvMi_3v1Vg1v6Hn3uPxlJu2r5tDKLCBbJlct1yvpeuYmrwmuAhHKApIjaiyyd9n5XHewRPXSih8VMVHTKEmZ6qphg3k-L2_eW4nzLpsjdBKfRPzk-esQMSF-w1QLvAspnWm1aP9Gfd79BFFsgRdyU58TkOSSUCLyxknZAI-GU2lbEX-TyWyosz80BUyN_x_jaR7IEIBvIjOe-SPA-AhbrxPlSthUs2Yk-MhyMBlhfA6Ee0DJjgL2GQSCQDYhs6i-hfbBkkwxoN608x_C65WrvIjeIV54IW3QMAhrvPTd2wEH0bzk3QhfhhcVnLkihEodlj_CkYex3hhe8Wy8kCzjdlr4b43WgYboOzrL5gU19Q5JjbsGzMvKUYy8e_UYMN5f0OfUnEZbeN3f36Spt8M4xb2qhcU38nXjaYPysFu-TZafmVzCaWMslTG0p33Ay4AjDBdubQgKxau7taQG6r5yGQFM0wo_eUQZ6YfGF9awgmGag-1YrFA.9KzzGgD3rMd5-nuIZQ6shg", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725373, + "id_token": "", + "latency": 60000, + "createdAt": 1651596626461 + }, + "response": { + "url": "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer", + "headers": { + "date": "Tue, 03 May 2022 16:50:23 GMT", + "content-type": "application/json;charset=utf-8", + "content-length": "1114", + "connection": "close", + "intuit_tid": "1-62715d4f-2ca2e76540831c797d395519", + "x-spanid": "ad0e9a88-2583-4eb2-a573-b6563bf8493f", + "x-amzn-trace-id": "Root=1-62715d4f-2ca2e76540831c797d395519", + "x-content-type-options": "nosniff", + "server": "envoy", + "cache-control": "no-cache, no-store", + "pragma": "no-cache", + "x-frame-options": "SAMEORIGIN", + "x-xss-protection": "1; mode=block", + "x-envoy-upstream-service-time": "23", + "strict-transport-security": "max-age=31536000" + }, + "body": "{\"x_refresh_token_expires_in\":8725373,\"access_token\":\"eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..-3MteSIdRG4apOikC2ba7w.fc1lxoSYu5sxYgdxqAXXDH_890s9kFgFeSBD7rJPM44r2liJuHlgKTjolqzWP8MBe6BX__r32CVFyS2KGUmHxXTw-UMnjiDYWGE_5RzUDxexW6Oym0ubCEcgVS6RnNWFAov6c7nzeXMSdNhfTumfMavcgkjcoFddb9kxGNJ8U2aHSQ7Ydct9JwTCUB5EegI5M4z6_IvJqTT7x3nnyH7KSsR7EGEQjOJwaOd267sM00ZQm9MBDFt0bVhQiYJsaBZI5A5pH4-VuC5rBrWyDU4CmKkObGQKLmKh4nW1EDC8sAtZF1qTyfxe-aV8eKEiLfPNQfCe3VTPpuP_U74UjKPramRUym09OZHP2E3jvMi_3v1Vg1v6Hn3uPxlJu2r5tDKLCBbJlct1yvpeuYmrwmuAhHKApIjaiyyd9n5XHewRPXSih8VMVHTKEmZ6qphg3k-L2_eW4nzLpsjdBKfRPzk-esQMSF-w1QLvAspnWm1aP9Gfd79BFFsgRdyU58TkOSSUCLyxknZAI-GU2lbEX-TyWyosz80BUyN_x_jaR7IEIBvIjOe-SPA-AhbrxPlSthUs2Yk-MhyMBlhfA6Ee0DJjgL2GQSCQDYhs6i-hfbBkkwxoN608x_C65WrvIjeIV54IW3QMAhrvPTd2wEH0bzk3QhfhhcVnLkihEodlj_CkYex3hhe8Wy8kCzjdlr4b43WgYboOzrL5gU19Q5JjbsGzMvKUYy8e_UYMN5f0OfUnEZbeN3f36Spt8M4xb2qhcU38nXjaYPysFu-TZafmVzCaWMslTG0p33Ay4AjDBdubQgKxau7taQG6r5yGQFM0wo_eUQZ6YfGF9awgmGag-1YrFA.9KzzGgD3rMd5-nuIZQ6shg\",\"refresh_token\":\"AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz\",\"token_type\":\"bearer\",\"expires_in\":3600}", + "status": 200, + "statusText": "OK" + }, + "body": "{\"x_refresh_token_expires_in\":8725373,\"access_token\":\"eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..-3MteSIdRG4apOikC2ba7w.fc1lxoSYu5sxYgdxqAXXDH_890s9kFgFeSBD7rJPM44r2liJuHlgKTjolqzWP8MBe6BX__r32CVFyS2KGUmHxXTw-UMnjiDYWGE_5RzUDxexW6Oym0ubCEcgVS6RnNWFAov6c7nzeXMSdNhfTumfMavcgkjcoFddb9kxGNJ8U2aHSQ7Ydct9JwTCUB5EegI5M4z6_IvJqTT7x3nnyH7KSsR7EGEQjOJwaOd267sM00ZQm9MBDFt0bVhQiYJsaBZI5A5pH4-VuC5rBrWyDU4CmKkObGQKLmKh4nW1EDC8sAtZF1qTyfxe-aV8eKEiLfPNQfCe3VTPpuP_U74UjKPramRUym09OZHP2E3jvMi_3v1Vg1v6Hn3uPxlJu2r5tDKLCBbJlct1yvpeuYmrwmuAhHKApIjaiyyd9n5XHewRPXSih8VMVHTKEmZ6qphg3k-L2_eW4nzLpsjdBKfRPzk-esQMSF-w1QLvAspnWm1aP9Gfd79BFFsgRdyU58TkOSSUCLyxknZAI-GU2lbEX-TyWyosz80BUyN_x_jaR7IEIBvIjOe-SPA-AhbrxPlSthUs2Yk-MhyMBlhfA6Ee0DJjgL2GQSCQDYhs6i-hfbBkkwxoN608x_C65WrvIjeIV54IW3QMAhrvPTd2wEH0bzk3QhfhhcVnLkihEodlj_CkYex3hhe8Wy8kCzjdlr4b43WgYboOzrL5gU19Q5JjbsGzMvKUYy8e_UYMN5f0OfUnEZbeN3f36Spt8M4xb2qhcU38nXjaYPysFu-TZafmVzCaWMslTG0p33Ay4AjDBdubQgKxau7taQG6r5yGQFM0wo_eUQZ6YfGF9awgmGag-1YrFA.9KzzGgD3rMd5-nuIZQ6shg\",\"refresh_token\":\"AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz\",\"token_type\":\"bearer\",\"expires_in\":3600}", + "json": { + "x_refresh_token_expires_in": 8725373, + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..-3MteSIdRG4apOikC2ba7w.fc1lxoSYu5sxYgdxqAXXDH_890s9kFgFeSBD7rJPM44r2liJuHlgKTjolqzWP8MBe6BX__r32CVFyS2KGUmHxXTw-UMnjiDYWGE_5RzUDxexW6Oym0ubCEcgVS6RnNWFAov6c7nzeXMSdNhfTumfMavcgkjcoFddb9kxGNJ8U2aHSQ7Ydct9JwTCUB5EegI5M4z6_IvJqTT7x3nnyH7KSsR7EGEQjOJwaOd267sM00ZQm9MBDFt0bVhQiYJsaBZI5A5pH4-VuC5rBrWyDU4CmKkObGQKLmKh4nW1EDC8sAtZF1qTyfxe-aV8eKEiLfPNQfCe3VTPpuP_U74UjKPramRUym09OZHP2E3jvMi_3v1Vg1v6Hn3uPxlJu2r5tDKLCBbJlct1yvpeuYmrwmuAhHKApIjaiyyd9n5XHewRPXSih8VMVHTKEmZ6qphg3k-L2_eW4nzLpsjdBKfRPzk-esQMSF-w1QLvAspnWm1aP9Gfd79BFFsgRdyU58TkOSSUCLyxknZAI-GU2lbEX-TyWyosz80BUyN_x_jaR7IEIBvIjOe-SPA-AhbrxPlSthUs2Yk-MhyMBlhfA6Ee0DJjgL2GQSCQDYhs6i-hfbBkkwxoN608x_C65WrvIjeIV54IW3QMAhrvPTd2wEH0bzk3QhfhhcVnLkihEodlj_CkYex3hhe8Wy8kCzjdlr4b43WgYboOzrL5gU19Q5JjbsGzMvKUYy8e_UYMN5f0OfUnEZbeN3f36Spt8M4xb2qhcU38nXjaYPysFu-TZafmVzCaWMslTG0p33Ay4AjDBdubQgKxau7taQG6r5yGQFM0wo_eUQZ6YfGF9awgmGag-1YrFA.9KzzGgD3rMd5-nuIZQ6shg", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "token_type": "bearer", + "expires_in": 3600 + }, + "intuit_tid": "1-62715d4f-2ca2e76540831c797d395519" +} +2022-05-03T16:50:27.047Z info: The makeAPICall () response is : { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..-3MteSIdRG4apOikC2ba7w.fc1lxoSYu5sxYgdxqAXXDH_890s9kFgFeSBD7rJPM44r2liJuHlgKTjolqzWP8MBe6BX__r32CVFyS2KGUmHxXTw-UMnjiDYWGE_5RzUDxexW6Oym0ubCEcgVS6RnNWFAov6c7nzeXMSdNhfTumfMavcgkjcoFddb9kxGNJ8U2aHSQ7Ydct9JwTCUB5EegI5M4z6_IvJqTT7x3nnyH7KSsR7EGEQjOJwaOd267sM00ZQm9MBDFt0bVhQiYJsaBZI5A5pH4-VuC5rBrWyDU4CmKkObGQKLmKh4nW1EDC8sAtZF1qTyfxe-aV8eKEiLfPNQfCe3VTPpuP_U74UjKPramRUym09OZHP2E3jvMi_3v1Vg1v6Hn3uPxlJu2r5tDKLCBbJlct1yvpeuYmrwmuAhHKApIjaiyyd9n5XHewRPXSih8VMVHTKEmZ6qphg3k-L2_eW4nzLpsjdBKfRPzk-esQMSF-w1QLvAspnWm1aP9Gfd79BFFsgRdyU58TkOSSUCLyxknZAI-GU2lbEX-TyWyosz80BUyN_x_jaR7IEIBvIjOe-SPA-AhbrxPlSthUs2Yk-MhyMBlhfA6Ee0DJjgL2GQSCQDYhs6i-hfbBkkwxoN608x_C65WrvIjeIV54IW3QMAhrvPTd2wEH0bzk3QhfhhcVnLkihEodlj_CkYex3hhe8Wy8kCzjdlr4b43WgYboOzrL5gU19Q5JjbsGzMvKUYy8e_UYMN5f0OfUnEZbeN3f36Spt8M4xb2qhcU38nXjaYPysFu-TZafmVzCaWMslTG0p33Ay4AjDBdubQgKxau7taQG6r5yGQFM0wo_eUQZ6YfGF9awgmGag-1YrFA.9KzzGgD3rMd5-nuIZQ6shg", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725373, + "id_token": "", + "latency": 60000, + "createdAt": 1651596626461 + }, + "response": { + "url": "https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365180784560/query?query=select%20*%20From%20vendor%20where%20DisplayName%20%3D%20%27Test%5C%27s%20Vendor%27", + "headers": { + "date": "Tue, 03 May 2022 16:50:24 GMT", + "content-type": "application/json;charset=utf-8", + "transfer-encoding": "chunked", + "connection": "close", + "intuit_tid": "1-62715d50-5fc29c8b605eae8d02755ef7", + "x-spanid": "9b97114d-cf41-430a-bd8b-b0b8ceed5bb3", + "x-amzn-trace-id": "Root=1-62715d50-5fc29c8b605eae8d02755ef7", + "x-content-type-options": "nosniff", + "x-xss-protection": "1; mode=block", + "qbo-version": "1979.197", + "service-time": "total=38, db=32", + "expires": "0", + "content-encoding": "gzip", + "cache-control": "max-age=0, no-cache, no-store, must-revalidate, private", + "x-envoy-upstream-service-time": "62", + "strict-transport-security": "max-age=31536000", + "server": "envoy" + }, + "body": "{\"QueryResponse\":{\"Vendor\":[{\"Balance\":352.80,\"Vendor1099\":false,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"60\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-31T09:54:54-07:00\",\"LastUpdatedTime\":\"2022-03-31T10:35:00-07:00\"},\"DisplayName\":\"Test's Vendor\",\"PrintOnCheckName\":\"Test's Vendor\",\"Active\":true}],\"startPosition\":1,\"maxResults\":1},\"time\":\"2022-05-03T09:50:24.155-07:00\"}", + "status": 200, + "statusText": "OK" + }, + "body": "{\"QueryResponse\":{\"Vendor\":[{\"Balance\":352.80,\"Vendor1099\":false,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"60\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-31T09:54:54-07:00\",\"LastUpdatedTime\":\"2022-03-31T10:35:00-07:00\"},\"DisplayName\":\"Test's Vendor\",\"PrintOnCheckName\":\"Test's Vendor\",\"Active\":true}],\"startPosition\":1,\"maxResults\":1},\"time\":\"2022-05-03T09:50:24.155-07:00\"}", + "json": { + "QueryResponse": { + "Vendor": [ + { + "Balance": 352.8, + "Vendor1099": false, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "60", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2022-03-31T09:54:54-07:00", + "LastUpdatedTime": "2022-03-31T10:35:00-07:00" + }, + "DisplayName": "Test's Vendor", + "PrintOnCheckName": "Test's Vendor", + "Active": true + } + ], + "startPosition": 1, + "maxResults": 1 + }, + "time": "2022-05-03T09:50:24.155-07:00" + }, + "intuit_tid": "1-62715d50-5fc29c8b605eae8d02755ef7" +} +2022-05-03T16:50:27.138Z info: The makeAPICall () response is : { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..-3MteSIdRG4apOikC2ba7w.fc1lxoSYu5sxYgdxqAXXDH_890s9kFgFeSBD7rJPM44r2liJuHlgKTjolqzWP8MBe6BX__r32CVFyS2KGUmHxXTw-UMnjiDYWGE_5RzUDxexW6Oym0ubCEcgVS6RnNWFAov6c7nzeXMSdNhfTumfMavcgkjcoFddb9kxGNJ8U2aHSQ7Ydct9JwTCUB5EegI5M4z6_IvJqTT7x3nnyH7KSsR7EGEQjOJwaOd267sM00ZQm9MBDFt0bVhQiYJsaBZI5A5pH4-VuC5rBrWyDU4CmKkObGQKLmKh4nW1EDC8sAtZF1qTyfxe-aV8eKEiLfPNQfCe3VTPpuP_U74UjKPramRUym09OZHP2E3jvMi_3v1Vg1v6Hn3uPxlJu2r5tDKLCBbJlct1yvpeuYmrwmuAhHKApIjaiyyd9n5XHewRPXSih8VMVHTKEmZ6qphg3k-L2_eW4nzLpsjdBKfRPzk-esQMSF-w1QLvAspnWm1aP9Gfd79BFFsgRdyU58TkOSSUCLyxknZAI-GU2lbEX-TyWyosz80BUyN_x_jaR7IEIBvIjOe-SPA-AhbrxPlSthUs2Yk-MhyMBlhfA6Ee0DJjgL2GQSCQDYhs6i-hfbBkkwxoN608x_C65WrvIjeIV54IW3QMAhrvPTd2wEH0bzk3QhfhhcVnLkihEodlj_CkYex3hhe8Wy8kCzjdlr4b43WgYboOzrL5gU19Q5JjbsGzMvKUYy8e_UYMN5f0OfUnEZbeN3f36Spt8M4xb2qhcU38nXjaYPysFu-TZafmVzCaWMslTG0p33Ay4AjDBdubQgKxau7taQG6r5yGQFM0wo_eUQZ6YfGF9awgmGag-1YrFA.9KzzGgD3rMd5-nuIZQ6shg", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725373, + "id_token": "", + "latency": 60000, + "createdAt": 1651596626461 + }, + "response": { + "url": "https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365180784560/query?query=select%20*%20From%20Account%20where%20AccountType%20in%20(%27Cost%20of%20Goods%20Sold%27%2C%20%27Other%20Current%20Liability%27)", + "headers": { + "date": "Tue, 03 May 2022 16:50:24 GMT", + "content-type": "application/json;charset=utf-8", + "transfer-encoding": "chunked", + "connection": "close", + "intuit_tid": "1-62715d50-60e4aaa4278101b4060a8ca8", + "x-spanid": "56494074-1199-4e8b-b8d2-385ed82a8839", + "x-amzn-trace-id": "Root=1-62715d50-60e4aaa4278101b4060a8ca8", + "x-content-type-options": "nosniff", + "x-xss-protection": "1; mode=block", + "qbo-version": "1979.197", + "service-time": "total=18, db=7", + "expires": "0", + "content-encoding": "gzip", + "cache-control": "max-age=0, no-cache, no-store, must-revalidate, private", + "x-envoy-upstream-service-time": "48", + "strict-transport-security": "max-age=31536000", + "server": "envoy" + }, + "body": "{\"QueryResponse\":{\"Account\":[{\"Name\":\"Arizona Dept. of Revenue Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Arizona Dept. of Revenue Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"89\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-30T13:05:01-07:00\"}},{\"Name\":\"BC Minister of Finance Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"BC Minister of Finance Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"91\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-29T17:07:57-07:00\",\"LastUpdatedTime\":\"2022-03-30T16:45:29-07:00\"}},{\"Name\":\"Board of Equalization Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Board of Equalization Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":-370.94,\"CurrentBalanceWithSubAccounts\":-370.94,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"90\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-30T13:16:17-07:00\"}},{\"Name\":\"Cost of Goods Sold\",\"SubAccount\":false,\"FullyQualifiedName\":\"Cost of Goods Sold\",\"Active\":true,\"Classification\":\"Expense\",\"AccountType\":\"Cost of Goods Sold\",\"AccountSubType\":\"SuppliesMaterialsCogs\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"80\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-27T10:36:04-07:00\",\"LastUpdatedTime\":\"2021-07-27T10:36:04-07:00\"}},{\"Name\":\"Federal Income Tax Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Federal Income Tax Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"FederalIncomeTaxPayable\",\"CurrentBalance\":16.80,\"CurrentBalanceWithSubAccounts\":16.80,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"92\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-31T10:18:57-07:00\",\"LastUpdatedTime\":\"2022-03-31T10:35:00-07:00\"}},{\"Name\":\"Loan Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Loan Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"OtherCurrentLiabilities\",\"CurrentBalance\":-4000.00,\"CurrentBalanceWithSubAccounts\":-4000.00,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"43\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-27T10:03:25-07:00\",\"LastUpdatedTime\":\"2021-07-27T10:03:25-07:00\"}}],\"startPosition\":1,\"maxResults\":6},\"time\":\"2022-05-03T09:50:24.260-07:00\"}", + "status": 200, + "statusText": "OK" + }, + "body": "{\"QueryResponse\":{\"Account\":[{\"Name\":\"Arizona Dept. of Revenue Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Arizona Dept. of Revenue Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"89\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-30T13:05:01-07:00\"}},{\"Name\":\"BC Minister of Finance Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"BC Minister of Finance Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"91\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-29T17:07:57-07:00\",\"LastUpdatedTime\":\"2022-03-30T16:45:29-07:00\"}},{\"Name\":\"Board of Equalization Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Board of Equalization Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"GlobalTaxPayable\",\"CurrentBalance\":-370.94,\"CurrentBalanceWithSubAccounts\":-370.94,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"90\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-30T13:16:17-07:00\"}},{\"Name\":\"Cost of Goods Sold\",\"SubAccount\":false,\"FullyQualifiedName\":\"Cost of Goods Sold\",\"Active\":true,\"Classification\":\"Expense\",\"AccountType\":\"Cost of Goods Sold\",\"AccountSubType\":\"SuppliesMaterialsCogs\",\"CurrentBalance\":0,\"CurrentBalanceWithSubAccounts\":0,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"80\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-27T10:36:04-07:00\",\"LastUpdatedTime\":\"2021-07-27T10:36:04-07:00\"}},{\"Name\":\"Federal Income Tax Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Federal Income Tax Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"FederalIncomeTaxPayable\",\"CurrentBalance\":16.80,\"CurrentBalanceWithSubAccounts\":16.80,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"92\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-31T10:18:57-07:00\",\"LastUpdatedTime\":\"2022-03-31T10:35:00-07:00\"}},{\"Name\":\"Loan Payable\",\"SubAccount\":false,\"FullyQualifiedName\":\"Loan Payable\",\"Active\":true,\"Classification\":\"Liability\",\"AccountType\":\"Other Current Liability\",\"AccountSubType\":\"OtherCurrentLiabilities\",\"CurrentBalance\":-4000.00,\"CurrentBalanceWithSubAccounts\":-4000.00,\"CurrencyRef\":{\"value\":\"USD\",\"name\":\"United States Dollar\"},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"43\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-27T10:03:25-07:00\",\"LastUpdatedTime\":\"2021-07-27T10:03:25-07:00\"}}],\"startPosition\":1,\"maxResults\":6},\"time\":\"2022-05-03T09:50:24.260-07:00\"}", + "json": { + "QueryResponse": { + "Account": [ + { + "Name": "Arizona Dept. of Revenue Payable", + "SubAccount": false, + "FullyQualifiedName": "Arizona Dept. of Revenue Payable", + "Active": true, + "Classification": "Liability", + "AccountType": "Other Current Liability", + "AccountSubType": "GlobalTaxPayable", + "CurrentBalance": 0, + "CurrentBalanceWithSubAccounts": 0, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "89", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-29T12:17:04-07:00", + "LastUpdatedTime": "2021-07-30T13:05:01-07:00" + } + }, + { + "Name": "BC Minister of Finance Payable", + "SubAccount": false, + "FullyQualifiedName": "BC Minister of Finance Payable", + "Active": true, + "Classification": "Liability", + "AccountType": "Other Current Liability", + "AccountSubType": "GlobalTaxPayable", + "CurrentBalance": 0, + "CurrentBalanceWithSubAccounts": 0, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "91", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2022-03-29T17:07:57-07:00", + "LastUpdatedTime": "2022-03-30T16:45:29-07:00" + } + }, + { + "Name": "Board of Equalization Payable", + "SubAccount": false, + "FullyQualifiedName": "Board of Equalization Payable", + "Active": true, + "Classification": "Liability", + "AccountType": "Other Current Liability", + "AccountSubType": "GlobalTaxPayable", + "CurrentBalance": -370.94, + "CurrentBalanceWithSubAccounts": -370.94, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "90", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-29T12:17:04-07:00", + "LastUpdatedTime": "2021-07-30T13:16:17-07:00" + } + }, + { + "Name": "Cost of Goods Sold", + "SubAccount": false, + "FullyQualifiedName": "Cost of Goods Sold", + "Active": true, + "Classification": "Expense", + "AccountType": "Cost of Goods Sold", + "AccountSubType": "SuppliesMaterialsCogs", + "CurrentBalance": 0, + "CurrentBalanceWithSubAccounts": 0, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "80", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-27T10:36:04-07:00", + "LastUpdatedTime": "2021-07-27T10:36:04-07:00" + } + }, + { + "Name": "Federal Income Tax Payable", + "SubAccount": false, + "FullyQualifiedName": "Federal Income Tax Payable", + "Active": true, + "Classification": "Liability", + "AccountType": "Other Current Liability", + "AccountSubType": "FederalIncomeTaxPayable", + "CurrentBalance": 16.8, + "CurrentBalanceWithSubAccounts": 16.8, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "92", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2022-03-31T10:18:57-07:00", + "LastUpdatedTime": "2022-03-31T10:35:00-07:00" + } + }, + { + "Name": "Loan Payable", + "SubAccount": false, + "FullyQualifiedName": "Loan Payable", + "Active": true, + "Classification": "Liability", + "AccountType": "Other Current Liability", + "AccountSubType": "OtherCurrentLiabilities", + "CurrentBalance": -4000, + "CurrentBalanceWithSubAccounts": -4000, + "CurrencyRef": { + "value": "USD", + "name": "United States Dollar" + }, + "domain": "QBO", + "sparse": false, + "Id": "43", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-27T10:03:25-07:00", + "LastUpdatedTime": "2021-07-27T10:03:25-07:00" + } + } + ], + "startPosition": 1, + "maxResults": 6 + }, + "time": "2022-05-03T09:50:24.260-07:00" + }, + "intuit_tid": "1-62715d50-60e4aaa4278101b4060a8ca8" +} +2022-05-03T16:50:27.259Z info: The makeAPICall () response is : { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..-3MteSIdRG4apOikC2ba7w.fc1lxoSYu5sxYgdxqAXXDH_890s9kFgFeSBD7rJPM44r2liJuHlgKTjolqzWP8MBe6BX__r32CVFyS2KGUmHxXTw-UMnjiDYWGE_5RzUDxexW6Oym0ubCEcgVS6RnNWFAov6c7nzeXMSdNhfTumfMavcgkjcoFddb9kxGNJ8U2aHSQ7Ydct9JwTCUB5EegI5M4z6_IvJqTT7x3nnyH7KSsR7EGEQjOJwaOd267sM00ZQm9MBDFt0bVhQiYJsaBZI5A5pH4-VuC5rBrWyDU4CmKkObGQKLmKh4nW1EDC8sAtZF1qTyfxe-aV8eKEiLfPNQfCe3VTPpuP_U74UjKPramRUym09OZHP2E3jvMi_3v1Vg1v6Hn3uPxlJu2r5tDKLCBbJlct1yvpeuYmrwmuAhHKApIjaiyyd9n5XHewRPXSih8VMVHTKEmZ6qphg3k-L2_eW4nzLpsjdBKfRPzk-esQMSF-w1QLvAspnWm1aP9Gfd79BFFsgRdyU58TkOSSUCLyxknZAI-GU2lbEX-TyWyosz80BUyN_x_jaR7IEIBvIjOe-SPA-AhbrxPlSthUs2Yk-MhyMBlhfA6Ee0DJjgL2GQSCQDYhs6i-hfbBkkwxoN608x_C65WrvIjeIV54IW3QMAhrvPTd2wEH0bzk3QhfhhcVnLkihEodlj_CkYex3hhe8Wy8kCzjdlr4b43WgYboOzrL5gU19Q5JjbsGzMvKUYy8e_UYMN5f0OfUnEZbeN3f36Spt8M4xb2qhcU38nXjaYPysFu-TZafmVzCaWMslTG0p33Ay4AjDBdubQgKxau7taQG6r5yGQFM0wo_eUQZ6YfGF9awgmGag-1YrFA.9KzzGgD3rMd5-nuIZQ6shg", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725373, + "id_token": "", + "latency": 60000, + "createdAt": 1651596626461 + }, + "response": { + "url": "https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365180784560/query?query=select%20*%20From%20TaxCode", + "headers": { + "date": "Tue, 03 May 2022 16:50:24 GMT", + "content-type": "application/json;charset=utf-8", + "transfer-encoding": "chunked", + "connection": "close", + "intuit_tid": "1-62715d50-4316bd092db359475390bbf8", + "x-spanid": "1c2e2d11-c167-450c-b32e-961e1dce01f7", + "x-amzn-trace-id": "Root=1-62715d50-4316bd092db359475390bbf8", + "x-content-type-options": "nosniff", + "x-xss-protection": "1; mode=block", + "qbo-version": "1979.197", + "service-time": "total=44, db=37", + "expires": "0", + "content-encoding": "gzip", + "cache-control": "max-age=0, no-cache, no-store, must-revalidate, private", + "x-envoy-upstream-service-time": "74", + "strict-transport-security": "max-age=31536000", + "server": "envoy" + }, + "body": "{\"QueryResponse\":{\"TaxCode\":[{\"Name\":\"TAX\",\"Description\":\"TAX\",\"Taxable\":true,\"TaxGroup\":false,\"Id\":\"TAX\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"NON\",\"Description\":\"NON\",\"Taxable\":false,\"TaxGroup\":false,\"Id\":\"NON\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"CustomSalesTax\",\"Description\":\"CustomSalesTax\",\"Taxable\":true,\"TaxGroup\":true,\"Id\":\"CustomSalesTax\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"California\",\"Description\":\"California\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"3\",\"name\":\"California\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"2\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-29T12:17:04-07:00\"}},{\"Name\":\"PST\",\"Description\":\"PST\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"6\",\"name\":\"PST\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"4\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-29T17:07:57-07:00\",\"LastUpdatedTime\":\"2022-03-29T17:07:57-07:00\"}},{\"Name\":\"Tucson\",\"Description\":\"Tucson\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"1\",\"name\":\"AZ State tax\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0},{\"TaxRateRef\":{\"value\":\"2\",\"name\":\"Tucson City\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"3\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-29T12:17:04-07:00\"}}],\"startPosition\":1,\"maxResults\":6,\"totalCount\":6},\"time\":\"2022-05-03T09:50:24.361-07:00\"}", + "status": 200, + "statusText": "OK" + }, + "body": "{\"QueryResponse\":{\"TaxCode\":[{\"Name\":\"TAX\",\"Description\":\"TAX\",\"Taxable\":true,\"TaxGroup\":false,\"Id\":\"TAX\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"NON\",\"Description\":\"NON\",\"Taxable\":false,\"TaxGroup\":false,\"Id\":\"NON\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"CustomSalesTax\",\"Description\":\"CustomSalesTax\",\"Taxable\":true,\"TaxGroup\":true,\"Id\":\"CustomSalesTax\",\"MetaData\":{\"CreateTime\":\"2021-08-25T12:52:52-07:00\",\"LastUpdatedTime\":\"2021-08-25T12:52:52-07:00\"}},{\"Name\":\"California\",\"Description\":\"California\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"3\",\"name\":\"California\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"2\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-29T12:17:04-07:00\"}},{\"Name\":\"PST\",\"Description\":\"PST\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"6\",\"name\":\"PST\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"4\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2022-03-29T17:07:57-07:00\",\"LastUpdatedTime\":\"2022-03-29T17:07:57-07:00\"}},{\"Name\":\"Tucson\",\"Description\":\"Tucson\",\"Active\":true,\"Taxable\":true,\"TaxGroup\":true,\"SalesTaxRateList\":{\"TaxRateDetail\":[{\"TaxRateRef\":{\"value\":\"1\",\"name\":\"AZ State tax\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0},{\"TaxRateRef\":{\"value\":\"2\",\"name\":\"Tucson City\"},\"TaxTypeApplicable\":\"TaxOnAmount\",\"TaxOrder\":0}]},\"PurchaseTaxRateList\":{\"TaxRateDetail\":[]},\"domain\":\"QBO\",\"sparse\":false,\"Id\":\"3\",\"SyncToken\":\"0\",\"MetaData\":{\"CreateTime\":\"2021-07-29T12:17:04-07:00\",\"LastUpdatedTime\":\"2021-07-29T12:17:04-07:00\"}}],\"startPosition\":1,\"maxResults\":6,\"totalCount\":6},\"time\":\"2022-05-03T09:50:24.361-07:00\"}", + "json": { + "QueryResponse": { + "TaxCode": [ + { + "Name": "TAX", + "Description": "TAX", + "Taxable": true, + "TaxGroup": false, + "Id": "TAX", + "MetaData": { + "CreateTime": "2021-08-25T12:52:52-07:00", + "LastUpdatedTime": "2021-08-25T12:52:52-07:00" + } + }, + { + "Name": "NON", + "Description": "NON", + "Taxable": false, + "TaxGroup": false, + "Id": "NON", + "MetaData": { + "CreateTime": "2021-08-25T12:52:52-07:00", + "LastUpdatedTime": "2021-08-25T12:52:52-07:00" + } + }, + { + "Name": "CustomSalesTax", + "Description": "CustomSalesTax", + "Taxable": true, + "TaxGroup": true, + "Id": "CustomSalesTax", + "MetaData": { + "CreateTime": "2021-08-25T12:52:52-07:00", + "LastUpdatedTime": "2021-08-25T12:52:52-07:00" + } + }, + { + "Name": "California", + "Description": "California", + "Active": true, + "Taxable": true, + "TaxGroup": true, + "SalesTaxRateList": { + "TaxRateDetail": [ + { + "TaxRateRef": { + "value": "3", + "name": "California" + }, + "TaxTypeApplicable": "TaxOnAmount", + "TaxOrder": 0 + } + ] + }, + "PurchaseTaxRateList": { + "TaxRateDetail": [] + }, + "domain": "QBO", + "sparse": false, + "Id": "2", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-29T12:17:04-07:00", + "LastUpdatedTime": "2021-07-29T12:17:04-07:00" + } + }, + { + "Name": "PST", + "Description": "PST", + "Active": true, + "Taxable": true, + "TaxGroup": true, + "SalesTaxRateList": { + "TaxRateDetail": [ + { + "TaxRateRef": { + "value": "6", + "name": "PST" + }, + "TaxTypeApplicable": "TaxOnAmount", + "TaxOrder": 0 + } + ] + }, + "PurchaseTaxRateList": { + "TaxRateDetail": [] + }, + "domain": "QBO", + "sparse": false, + "Id": "4", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2022-03-29T17:07:57-07:00", + "LastUpdatedTime": "2022-03-29T17:07:57-07:00" + } + }, + { + "Name": "Tucson", + "Description": "Tucson", + "Active": true, + "Taxable": true, + "TaxGroup": true, + "SalesTaxRateList": { + "TaxRateDetail": [ + { + "TaxRateRef": { + "value": "1", + "name": "AZ State tax" + }, + "TaxTypeApplicable": "TaxOnAmount", + "TaxOrder": 0 + }, + { + "TaxRateRef": { + "value": "2", + "name": "Tucson City" + }, + "TaxTypeApplicable": "TaxOnAmount", + "TaxOrder": 0 + } + ] + }, + "PurchaseTaxRateList": { + "TaxRateDetail": [] + }, + "domain": "QBO", + "sparse": false, + "Id": "3", + "SyncToken": "0", + "MetaData": { + "CreateTime": "2021-07-29T12:17:04-07:00", + "LastUpdatedTime": "2021-07-29T12:17:04-07:00" + } + } + ], + "startPosition": 1, + "maxResults": 6, + "totalCount": 6 + }, + "time": "2022-05-03T09:50:24.361-07:00" + }, + "intuit_tid": "1-62715d50-4316bd092db359475390bbf8" +} +2022-05-03T16:50:27.369Z info: The makeAPICall () response is : { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..-3MteSIdRG4apOikC2ba7w.fc1lxoSYu5sxYgdxqAXXDH_890s9kFgFeSBD7rJPM44r2liJuHlgKTjolqzWP8MBe6BX__r32CVFyS2KGUmHxXTw-UMnjiDYWGE_5RzUDxexW6Oym0ubCEcgVS6RnNWFAov6c7nzeXMSdNhfTumfMavcgkjcoFddb9kxGNJ8U2aHSQ7Ydct9JwTCUB5EegI5M4z6_IvJqTT7x3nnyH7KSsR7EGEQjOJwaOd267sM00ZQm9MBDFt0bVhQiYJsaBZI5A5pH4-VuC5rBrWyDU4CmKkObGQKLmKh4nW1EDC8sAtZF1qTyfxe-aV8eKEiLfPNQfCe3VTPpuP_U74UjKPramRUym09OZHP2E3jvMi_3v1Vg1v6Hn3uPxlJu2r5tDKLCBbJlct1yvpeuYmrwmuAhHKApIjaiyyd9n5XHewRPXSih8VMVHTKEmZ6qphg3k-L2_eW4nzLpsjdBKfRPzk-esQMSF-w1QLvAspnWm1aP9Gfd79BFFsgRdyU58TkOSSUCLyxknZAI-GU2lbEX-TyWyosz80BUyN_x_jaR7IEIBvIjOe-SPA-AhbrxPlSthUs2Yk-MhyMBlhfA6Ee0DJjgL2GQSCQDYhs6i-hfbBkkwxoN608x_C65WrvIjeIV54IW3QMAhrvPTd2wEH0bzk3QhfhhcVnLkihEodlj_CkYex3hhe8Wy8kCzjdlr4b43WgYboOzrL5gU19Q5JjbsGzMvKUYy8e_UYMN5f0OfUnEZbeN3f36Spt8M4xb2qhcU38nXjaYPysFu-TZafmVzCaWMslTG0p33Ay4AjDBdubQgKxau7taQG6r5yGQFM0wo_eUQZ6YfGF9awgmGag-1YrFA.9KzzGgD3rMd5-nuIZQ6shg", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725373, + "id_token": "", + "latency": 60000, + "createdAt": 1651596626461 + }, + "response": { + "url": "https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365180784560/query?query=select%20*%20From%20Class", + "headers": { + "date": "Tue, 03 May 2022 16:50:24 GMT", + "content-type": "application/json;charset=utf-8", + "transfer-encoding": "chunked", + "connection": "close", + "intuit_tid": "1-62715d50-12994ac54d68220b658d3e98", + "x-spanid": "2c33dcdc-bd47-4bc7-bf2a-fb76c1ca02f3", + "x-amzn-trace-id": "Root=1-62715d50-12994ac54d68220b658d3e98", + "x-content-type-options": "nosniff", + "x-xss-protection": "1; mode=block", + "qbo-version": "1979.197", + "service-time": "total=34, db=29", + "expires": "0", + "content-encoding": "gzip", + "cache-control": "max-age=0, no-cache, no-store, must-revalidate, private", + "x-envoy-upstream-service-time": "69", + "strict-transport-security": "max-age=31536000", + "server": "envoy" + }, + "body": "{\"QueryResponse\":{},\"time\":\"2022-05-03T09:50:24.482-07:00\"}", + "status": 200, + "statusText": "OK" + }, + "body": "{\"QueryResponse\":{},\"time\":\"2022-05-03T09:50:24.482-07:00\"}", + "json": { + "QueryResponse": {}, + "time": "2022-05-03T09:50:24.482-07:00" + }, + "intuit_tid": "1-62715d50-12994ac54d68220b658d3e98" +} +2022-05-03T16:50:27.463Z error: Get makeAPICall () threw an exception : { + "authResponse": { + "token": { + "realmId": "", + "token_type": "bearer", + "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..-3MteSIdRG4apOikC2ba7w.fc1lxoSYu5sxYgdxqAXXDH_890s9kFgFeSBD7rJPM44r2liJuHlgKTjolqzWP8MBe6BX__r32CVFyS2KGUmHxXTw-UMnjiDYWGE_5RzUDxexW6Oym0ubCEcgVS6RnNWFAov6c7nzeXMSdNhfTumfMavcgkjcoFddb9kxGNJ8U2aHSQ7Ydct9JwTCUB5EegI5M4z6_IvJqTT7x3nnyH7KSsR7EGEQjOJwaOd267sM00ZQm9MBDFt0bVhQiYJsaBZI5A5pH4-VuC5rBrWyDU4CmKkObGQKLmKh4nW1EDC8sAtZF1qTyfxe-aV8eKEiLfPNQfCe3VTPpuP_U74UjKPramRUym09OZHP2E3jvMi_3v1Vg1v6Hn3uPxlJu2r5tDKLCBbJlct1yvpeuYmrwmuAhHKApIjaiyyd9n5XHewRPXSih8VMVHTKEmZ6qphg3k-L2_eW4nzLpsjdBKfRPzk-esQMSF-w1QLvAspnWm1aP9Gfd79BFFsgRdyU58TkOSSUCLyxknZAI-GU2lbEX-TyWyosz80BUyN_x_jaR7IEIBvIjOe-SPA-AhbrxPlSthUs2Yk-MhyMBlhfA6Ee0DJjgL2GQSCQDYhs6i-hfbBkkwxoN608x_C65WrvIjeIV54IW3QMAhrvPTd2wEH0bzk3QhfhhcVnLkihEodlj_CkYex3hhe8Wy8kCzjdlr4b43WgYboOzrL5gU19Q5JjbsGzMvKUYy8e_UYMN5f0OfUnEZbeN3f36Spt8M4xb2qhcU38nXjaYPysFu-TZafmVzCaWMslTG0p33Ay4AjDBdubQgKxau7taQG6r5yGQFM0wo_eUQZ6YfGF9awgmGag-1YrFA.9KzzGgD3rMd5-nuIZQ6shg", + "refresh_token": "AB11660321996b8nw4KMF6ci01btHpb0k7NM5A2BW7DYF9tEgz", + "expires_in": 3600, + "x_refresh_token_expires_in": 8725373, + "id_token": "", + "latency": 60000, + "createdAt": 1651596626461 + }, + "response": { + "url": "https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365180784560/bill", + "headers": { + "date": "Tue, 03 May 2022 16:50:24 GMT", + "content-type": "application/json", + "content-length": "321", + "connection": "close", + "intuit_tid": "1-62715d50-27cece202eba8ce505c9d8a6", + "x-spanid": "fac7f75b-492f-445b-9553-7cbde874d6bb", + "x-amzn-trace-id": "Root=1-62715d50-27cece202eba8ce505c9d8a6", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "45", + "strict-transport-security": "max-age=31536000", + "server": "envoy" + }, + "body": "{\"Fault\":{\"Error\":[{\"Message\":\"Required param missing, need to supply the required value for the API\",\"Detail\":\"Required parameter Line.AccountBasedExpenseLineDetail is missing in the request\",\"code\":\"2020\",\"element\":\"Line.AccountBasedExpenseLineDetail\"}],\"type\":\"ValidationFault\"},\"time\":\"2022-05-03T09:50:24.591-07:00\"}", + "status": 400, + "statusText": "Bad Request" + }, + "body": "{\"Fault\":{\"Error\":[{\"Message\":\"Required param missing, need to supply the required value for the API\",\"Detail\":\"Required parameter Line.AccountBasedExpenseLineDetail is missing in the request\",\"code\":\"2020\",\"element\":\"Line.AccountBasedExpenseLineDetail\"}],\"type\":\"ValidationFault\"},\"time\":\"2022-05-03T09:50:24.591-07:00\"}", + "json": { + "Fault": { + "Error": [ + { + "Message": "Required param missing, need to supply the required value for the API", + "Detail": "Required parameter Line.AccountBasedExpenseLineDetail is missing in the request", + "code": "2020", + "element": "Line.AccountBasedExpenseLineDetail" + } + ], + "type": "ValidationFault" + }, + "time": "2022-05-03T09:50:24.591-07:00" + }, + "intuit_tid": "1-62715d50-27cece202eba8ce505c9d8a6" + }, + "originalMessage": "Response has an Error", + "error": "Bad Request", + "error_description": "Bad Request", + "intuit_tid": "1-62715d50-27cece202eba8ce505c9d8a6" +} diff --git a/server/accounting/qbo/qbo-callback.js b/server/accounting/qbo/qbo-callback.js index b65d98978..422d1a19f 100644 --- a/server/accounting/qbo/qbo-callback.js +++ b/server/accounting/qbo/qbo-callback.js @@ -71,7 +71,7 @@ exports.default = async (req, res) => { exports.refresh = async (oauthClient, req) => { try { - logger.log("qbo-token-refresh", "DEBUG", req.user.email, null, null); + // logger.log("qbo-token-refresh", "DEBUG", req.user.email, null, null); const authResponse = await oauthClient.refresh(); await client.request(queries.SET_QBO_AUTH, { email: req.user.email, @@ -85,7 +85,7 @@ exports.refresh = async (oauthClient, req) => { }; exports.setNewRefreshToken = async (email, apiResponse) => { - logger.log("qbo-token-updated", "DEBUG", email, null, null); + //logger.log("qbo-token-updated", "DEBUG", email, null, null); await client.request(queries.SET_QBO_AUTH, { email, diff --git a/server/accounting/qbo/qbo-payables.js b/server/accounting/qbo/qbo-payables.js index e2eb6be82..03113611d 100644 --- a/server/accounting/qbo/qbo-payables.js +++ b/server/accounting/qbo/qbo-payables.js @@ -45,7 +45,7 @@ exports.default = async (req, res) => { await refreshOauthToken(oauthClient, req); const BearerToken = req.headers.authorization; - const { bills: billsToQuery } = req.body; + const { bills: billsToQuery, elgen } = req.body; //Query Job Info const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, { headers: { @@ -59,8 +59,9 @@ exports.default = async (req, res) => { bills: billsToQuery, }); - const { bills } = result; + const { bills, bodyshops } = result; const ret = []; + const bodyshop = bodyshops[0]; for (const bill of bills) { try { @@ -86,9 +87,31 @@ exports.default = async (req, res) => { qbo_realmId, req, bill, - vendorRecord + vendorRecord, + bodyshop ); + // //No error. Mark the job exported & insert export log. + if (elgen) { + const result = await client + .setHeaders({ Authorization: BearerToken }) + .request(queries.QBO_MARK_BILL_EXPORTED, { + billId: bill.id, + bill: { + exported: true, + exported_at: moment().tz(bodyshop.timezone), + }, + logs: [ + { + bodyshopid: bodyshop.id, + billid: bill.id, + successful: true, + useremail: req.user.email, + }, + ], + }); + } + ret.push({ billid: bill.id, success: true }); } catch (error) { ret.push({ @@ -98,6 +121,26 @@ exports.default = async (req, res) => { (error && error.authResponse && error.authResponse.body) || (error && error.message), }); + + //Add the export log error. + if (elgen) { + const result = await client + .setHeaders({ Authorization: BearerToken }) + .request(queries.INSERT_EXPORT_LOG, { + logs: [ + { + bodyshopid: bodyshop.id, + billid: bill.id, + successful: false, + message: JSON.stringify([ + (error && error.authResponse && error.authResponse.body) || + (error && error.message), + ]), + useremail: req.user.email, + }, + ], + }); + } } } @@ -167,7 +210,14 @@ async function InsertVendorRecord(oauthClient, qbo_realmId, req, bill) { } } -async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) { +async function InsertBill( + oauthClient, + qbo_realmId, + req, + bill, + vendor, + bodyshop +) { const { accounts, taxCodes, classes } = await QueryMetaData( oauthClient, qbo_realmId, @@ -179,20 +229,20 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) { il, accounts, bill.job.class, - bill.job.bodyshop.md_responsibility_centers.sales_tax_codes, + bodyshop.md_responsibility_centers.sales_tax_codes, classes, taxCodes, - bill.job.bodyshop.md_responsibility_centers.costs + bodyshop.md_responsibility_centers.costs ) ); //QB USA with GST //This was required for the No. 1 Collision Group. if ( - bill.job.bodyshop.accountingconfig && - bill.job.bodyshop.accountingconfig.qbo && - bill.job.bodyshop.accountingconfig.qbo_usa && - bill.job.bodyshop.region_config.includes("CA_") + bodyshop.accountingconfig && + bodyshop.accountingconfig.qbo && + bodyshop.accountingconfig.qbo_usa && + bodyshop.region_config.includes("CA_") ) { lines.push({ DetailType: "AccountBasedExpenseLineDetail", @@ -204,8 +254,7 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) { AccountRef: { value: accounts[ - bill.job.bodyshop.md_responsibility_centers.taxes.federal - .accountdesc + bodyshop.md_responsibility_centers.taxes.federal.accountdesc ], }, }, @@ -239,7 +288,18 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) { }), DocNumber: bill.invoice_number, //...(bill.job.class ? { ClassRef: { Id: classes[bill.job.class] } } : {}), - + ...(!( + bodyshop.accountingconfig && + bodyshop.accountingconfig.qbo && + bodyshop.accountingconfig.qbo_usa && + bodyshop.region_config.includes("CA_") + ) + ? { GlobalTaxCalculation: "TaxExcluded" } + : {}), + ...(bodyshop.accountingconfig.qbo_departmentid && + bodyshop.accountingconfig.qbo_departmentid.trim() !== "" && { + DepartmentRef: { value: bodyshop.accountingconfig.qbo_departmentid }, + }), PrivateNote: `RO ${bill.job.ro_number || ""}`, Line: lines, }; diff --git a/server/accounting/qbo/qbo-payments.js b/server/accounting/qbo/qbo-payments.js index f943b57f3..ccbb3cf4a 100644 --- a/server/accounting/qbo/qbo-payments.js +++ b/server/accounting/qbo/qbo-payments.js @@ -52,7 +52,7 @@ exports.default = async (req, res) => { await refreshOauthToken(oauthClient, req); const BearerToken = req.headers.authorization; - const { payments: paymentsToQuery } = req.body; + const { payments: paymentsToQuery, elgen } = req.body; //Query Job Info const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, { headers: { @@ -155,6 +155,27 @@ exports.default = async (req, res) => { bodyshop ); } + + // //No error. Mark the payment exported & insert export log. + if (elgen) { + const result = await client + .setHeaders({ Authorization: BearerToken }) + .request(queries.QBO_MARK_PAYMENT_EXPORTED, { + paymentId: payment.id, + payment: { + exportedat: moment().tz(bodyshop.timezone), + }, + logs: [ + { + bodyshopid: bodyshop.id, + paymentid: payment.id, + successful: true, + useremail: req.user.email, + }, + ], + }); + } + ret.push({ paymentid: payment.id, success: true }); } catch (error) { logger.log("qbo-payment-create-error", "ERROR", req.user.email, { @@ -162,6 +183,25 @@ exports.default = async (req, res) => { (error && error.authResponse && error.authResponse.body) || (error && error.message), }); + //Add the export log error. + if (elgen) { + const result = await client + .setHeaders({ Authorization: BearerToken }) + .request(queries.INSERT_EXPORT_LOG, { + logs: [ + { + bodyshopid: bodyshop.id, + paymentid: payment.id, + successful: false, + message: JSON.stringify([ + (error && error.authResponse && error.authResponse.body) || + (error && error.message), + ]), + useremail: req.user.email, + }, + ], + }); + } ret.push({ paymentid: payment.id, diff --git a/server/accounting/qbo/qbo-receivables.js b/server/accounting/qbo/qbo-receivables.js index ca581b9d2..108da861a 100644 --- a/server/accounting/qbo/qbo-receivables.js +++ b/server/accounting/qbo/qbo-receivables.js @@ -46,7 +46,7 @@ exports.default = async (req, res) => { await refreshOauthToken(oauthClient, req); const BearerToken = req.headers.authorization; - const { jobIds } = req.body; + const { jobIds, elgen } = req.body; //Query Job Info const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, { headers: { @@ -139,6 +139,28 @@ exports.default = async (req, res) => { bodyshop, jobTier ); + + // //No error. Mark the job exported & insert export log. + if (elgen) { + const result = await client + .setHeaders({ Authorization: BearerToken }) + .request(queries.QBO_MARK_JOB_EXPORTED, { + jobId: job.id, + job: { + status: + bodyshop.md_ro_statuses.default_exported || "Exported*", + date_exported: moment().tz(bodyshop.timezone), + }, + logs: [ + { + bodyshopid: bodyshop.id, + jobid: job.id, + successful: true, + useremail: req.user.email, + }, + ], + }); + } } ret.push({ jobid: job.id, success: true }); } catch (error) { @@ -149,6 +171,25 @@ exports.default = async (req, res) => { (error && error.authResponse && error.authResponse.body) || (error && error.message), }); + //Add the export log error. + if (elgen) { + const result = await client + .setHeaders({ Authorization: BearerToken }) + .request(queries.INSERT_EXPORT_LOG, { + logs: [ + { + bodyshopid: bodyshop.id, + jobid: job.id, + successful: false, + message: JSON.stringify([ + (error && error.authResponse && error.authResponse.body) || + (error && error.message), + ]), + useremail: req.user.email, + }, + ], + }); + } } } diff --git a/server/accounting/qbxml/qbxml-payables.js b/server/accounting/qbxml/qbxml-payables.js index 28e7ba2cd..99e4d37ba 100644 --- a/server/accounting/qbxml/qbxml-payables.js +++ b/server/accounting/qbxml/qbxml-payables.js @@ -37,14 +37,15 @@ exports.default = async (req, res) => { .request(queries.QUERY_BILLS_FOR_PAYABLES_EXPORT, { bills: billsToQuery, }); - const { bills } = result; + const { bills, bodyshops } = result; + const bodyshop = bodyshops[0]; const QbXmlToExecute = []; bills.map((i) => { QbXmlToExecute.push({ id: i.id, okStatusCodes: ["0"], - qbxml: generateBill(i), + qbxml: generateBill(i, bodyshop), }); }); @@ -62,7 +63,7 @@ exports.default = async (req, res) => { } }; -const generateBill = (bill) => { +const generateBill = (bill, bodyshop) => { const billQbxmlObj = { QBXML: { QBXMLMsgsRq: { @@ -87,7 +88,7 @@ const generateBill = (bill) => { ExpenseLineAdd: bill.billlines.map((il) => generateBillLine( il, - bill.job.bodyshop.md_responsibility_centers, + bodyshop.md_responsibility_centers, bill.job.class ) ), diff --git a/server/graphql-client/queries.js b/server/graphql-client/queries.js index 9ff253e93..972651008 100644 --- a/server/graphql-client/queries.js +++ b/server/graphql-client/queries.js @@ -217,6 +217,7 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) { accountingconfig md_ins_cos timezone + md_ro_statuses } } `; @@ -408,6 +409,13 @@ query QUERY_JOBS_FOR_PBS_EXPORT($id: uuid!) { exports.QUERY_BILLS_FOR_PAYABLES_EXPORT = ` query QUERY_BILLS_FOR_PAYABLES_EXPORT($bills: [uuid!]!) { + bodyshops(where: {associations: {active: {_eq: true}}}) { + id + md_responsibility_centers + timezone + region_config + accountingconfig + } bills(where: {id: {_in: $bills}}) { id date @@ -424,12 +432,6 @@ query QUERY_BILLS_FOR_PAYABLES_EXPORT($bills: [uuid!]!) { ownr_ln ownr_co_nm class - bodyshop{ - md_responsibility_centers - timezone - region_config - accountingconfig - } } billlines{ id @@ -1482,6 +1484,7 @@ mutation MARK_JOB_EXPORTED($jobId: uuid!, $job: jobs_set_input!, $log: exportlog } } `; + exports.INSERT_EXPORT_LOG = ` mutation INSERT_EXPORT_LOG($log: exportlog_insert_input!) { insert_exportlog_one(object: $log) { @@ -1534,4 +1537,52 @@ exports.QUERY_JOB_ID_MIXDATA = `query QUERY_JOB_ID_MIXDATA($roNumbers: [String!] } } -`; \ No newline at end of file +`; + +exports.QBO_MARK_JOB_EXPORTED = ` +mutation QBO_MARK_JOB_EXPORTED($jobId: uuid!, $job: jobs_set_input!, $logs: [exportlog_insert_input!]!) { + insert_exportlog(objects: $logs) { + affected_rows + } + update_jobs(where: {id: {_eq: $jobId}}, _set: $job) { + returning { + id + + } + } +} + +`; +exports.QBO_MARK_BILL_EXPORTED = ` +mutation QBO_MARK_BILL_EXPORTED($billId: uuid!, $bill: bills_set_input!, $logs: [exportlog_insert_input!]!) { + insert_exportlog(objects: $logs) { + affected_rows + } + update_bills(where: { id: { _eq: $billId } }, _set: $bill) { + returning { + id + } + } +} + +`; + +exports.QBO_MARK_PAYMENT_EXPORTED = ` +mutation QBO_MARK_PAYMENT_EXPORTED($paymentId: uuid!, $payment: payments_set_input!, $logs: [exportlog_insert_input!]!) { + insert_exportlog(objects: $logs) { + affected_rows + } + update_payments(where: {id: {_eq: $paymentId}}, _set: $payment) { + returning { + id + } + } +}`; + +exports.INSERT_EXPORT_LOG = ` + mutation INSERT_EXPORT_LOG($logs: [exportlog_insert_input!]!) { + insert_exportlog(objects: $logs) { + affected_rows + } + } +`;