IO-256 Start add QBO Payables

This commit is contained in:
Patrick Fic
2021-09-15 16:14:01 -07:00
parent 38456cb213
commit 1942103985
5 changed files with 554 additions and 6 deletions

View File

@@ -36,7 +36,6 @@ exports.default = async (req, res) => {
});
oauthClient.setToken(response.associations[0].qbo_auth);
const getToken = oauthClient.getToken();
await refreshOauthToken(oauthClient, req);
@@ -48,6 +47,7 @@ exports.default = async (req, res) => {
Authorization: BearerToken,
},
});
logger.log("qbo-payable-create", "DEBUG", req.user.email, jobIds);
const result = await client
.setHeaders({ Authorization: BearerToken })
.request(queries.QUERY_JOBS_FOR_RECEIVABLES_EXPORT, {
@@ -111,6 +111,7 @@ exports.default = async (req, res) => {
res.sendStatus(200);
} catch (error) {
console.log(error);
logger.log("qbo-payable-create-error", "ERROR", req.user.email, { error });
res.status(400).json(error);
}
};
@@ -412,11 +413,7 @@ async function InsertInvoice(oauthClient, req, job, bodyshop, parentTierRef) {
}
}
// Labor Lines
if (
jobline.profitcenter_labor &&
jobline.mod_lb_hrs &&
jobline.mod_lb_hrs > 0
) {
if (jobline.profitcenter_labor && jobline.mod_lb_hrs) {
const DineroAmount = Dinero({
amount: Math.round(
job[`rate_${jobline.mod_lbr_ty.toLowerCase()}`] * 100