IO-1489 Resolve payables memo for QBO.

This commit is contained in:
Patrick Fic
2021-10-25 17:25:29 -07:00
parent b718f49071
commit 9c3e4b7b83
2 changed files with 7 additions and 4 deletions

1
.gitignore vendored
View File

@@ -112,3 +112,4 @@ firebase/.env
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
logs/oAuthClient-log.log

View File

@@ -180,9 +180,9 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) {
DocNumber: bill.invoice_number,
...(bill.job.class ? { ClassRef: { Id: classes[bill.job.class] } } : {}),
Memo: `RO ${bill.job.ro_number || ""} OWNER ${bill.job.ownr_fn || ""} ${
bill.job.ownr_ln || ""
} ${bill.job.ownr_co_nm || ""}`,
PrivateNote: `RO ${bill.job.ro_number || ""} OWNER ${
bill.job.ownr_fn || ""
} ${bill.job.ownr_ln || ""} ${bill.job.ownr_co_nm || ""}`,
Line: bill.billlines.map((il) =>
generateBillLine(
il,
@@ -211,7 +211,7 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) {
body: JSON.stringify(billQbo),
});
setNewRefreshToken(req.user.email, result);
return result && result.Bill;
return result && result.json && result.json.Bill;
} catch (error) {
logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, {
error:
@@ -245,6 +245,8 @@ const generateBillLine = (
costCenters
) => {
const account = costCenters.find((c) => c.name === billLine.cost_center);
console.log(account.accountname, accounts[account.accountname]);
return {
DetailType: "AccountBasedExpenseLineDetail",