IO-256 Resolve QBO issues.

This commit is contained in:
Patrick Fic
2021-10-22 10:46:03 -07:00
parent 9d4a59ca16
commit 37c898d3ce
5 changed files with 21515 additions and 12 deletions

View File

@@ -40,7 +40,7 @@ export function PayableExportAll({
setLoading(true); setLoading(true);
if (!!loadingCallback) loadingCallback(true); if (!!loadingCallback) loadingCallback(true);
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
PartnerResponse = await axios.post(`/qbo/receivables`, { PartnerResponse = await axios.post(`/qbo/payables`, {
bills: billids, bills: billids,
}); });
} else { } else {

File diff suppressed because one or more lines are too long

View File

@@ -41,7 +41,7 @@ exports.default = async (req, res) => {
res.status(401).json({ error: "No company associated." }); res.status(401).json({ error: "No company associated." });
return; return;
} }
await refreshOauthToken(oauthClient, qbo_realmId, req); await refreshOauthToken(oauthClient, req);
const BearerToken = req.headers.authorization; const BearerToken = req.headers.authorization;
const { bills: billsToQuery } = req.body; const { bills: billsToQuery } = req.body;
@@ -67,7 +67,6 @@ exports.default = async (req, res) => {
vendorRecord = await QueryVendorRecord( vendorRecord = await QueryVendorRecord(
oauthClient, oauthClient,
qbo_realmId, qbo_realmId,
qbo_realmId,
req, req,
bill bill
); );
@@ -96,7 +95,7 @@ exports.default = async (req, res) => {
success: false, success: false,
errorMessage: errorMessage:
(error && error.authResponse && error.authResponse.body) || (error && error.authResponse && error.authResponse.body) ||
JSON.stringify(error), (error && error.message),
}); });
} }
} }
@@ -133,7 +132,7 @@ async function QueryVendorRecord(oauthClient, qbo_realmId, req, bill) {
logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, { logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, {
error: error:
(error && error.authResponse && error.authResponse.body) || (error && error.authResponse && error.authResponse.body) ||
JSON.stringify(error), (error && error.message),
method: "QueryVendorRecord", method: "QueryVendorRecord",
}); });
throw error; throw error;
@@ -158,7 +157,7 @@ async function InsertVendorRecord(oauthClient, qbo_realmId, req, bill) {
logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, { logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, {
error: error:
(error && error.authResponse && error.authResponse.body) || (error && error.authResponse && error.authResponse.body) ||
JSON.stringify(error), (error && error.message),
method: "InsertVendorRecord", method: "InsertVendorRecord",
}); });
throw error; throw error;
@@ -217,7 +216,7 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) {
logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, { logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, {
error: error:
(error && error.authResponse && error.authResponse.body) || (error && error.authResponse && error.authResponse.body) ||
JSON.stringify(error), (error && error.message),
method: "InsertBill", method: "InsertBill",
}); });
throw error; throw error;

View File

@@ -48,7 +48,7 @@ exports.default = async (req, res) => {
res.status(401).json({ error: "No company associated." }); res.status(401).json({ error: "No company associated." });
return; return;
} }
await refreshOauthToken(oauthClient, qbo_realmId, req); await refreshOauthToken(oauthClient, req);
const BearerToken = req.headers.authorization; const BearerToken = req.headers.authorization;
const { payments: paymentsToQuery } = req.body; const { payments: paymentsToQuery } = req.body;
@@ -141,7 +141,7 @@ exports.default = async (req, res) => {
logger.log("qbo-payment-create-error", "ERROR", req.user.email, { logger.log("qbo-payment-create-error", "ERROR", req.user.email, {
error: error:
(error && error.authResponse && error.authResponse.body) || (error && error.authResponse && error.authResponse.body) ||
JSON.stringify(error), (error && error.message),
}); });
ret.push({ ret.push({
@@ -149,7 +149,7 @@ exports.default = async (req, res) => {
success: false, success: false,
errorMessage: errorMessage:
(error && error.authResponse && error.authResponse.body) || (error && error.authResponse && error.authResponse.body) ||
JSON.stringify(error), (error && error.message),
}); });
} }
} }
@@ -229,7 +229,7 @@ async function InsertPayment(
return result && result.Bill; return result && result.Bill;
} catch (error) { } catch (error) {
logger.log("qbo-payables-error", "DEBUG", req.user.email, payment.id, { logger.log("qbo-payables-error", "DEBUG", req.user.email, payment.id, {
error: JSON.stringify(error), error: error && error.message,
method: "InsertPayment", method: "InsertPayment",
}); });
throw error; throw error;

View File

@@ -145,7 +145,7 @@ exports.default = async (req, res) => {
success: false, success: false,
errorMessage: errorMessage:
(error && error.authResponse && error.authResponse.body) || (error && error.authResponse && error.authResponse.body) ||
JSON.stringify(error), (error && error.message),
}); });
} }
} }