Skip to content

Add QuickBooks bill created and updated triggers #16649

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import common from "../common/base.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "quickbooks-new-bill-created",
name: "New Bill Created",
description: "Emit new event when a new Bill is created.",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
getQuery(lastDate) {
return `select * from Bill Where Metadata.CreateTime >= '${lastDate}' orderby Metadata.CreateTime desc`;
},
getFieldList() {
return "Bill";
},
getSummary(item) {
return `New Bill: ${item.Id}`;
},
},
sampleEmit,
};
59 changes: 59 additions & 0 deletions components/quickbooks/sources/new-bill-created/test-event.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// components/quickbooks/sources/new-bill-created/test-event.mjs

export default {
"Id": "123456",
"SyncToken": "0",
"MetaData": {
"CreateTime": "2023-04-15T10:30:00Z",
"LastUpdatedTime": "2023-04-15T10:30:00Z"
},
"VendorRef": {
"value": "56789",
"name": "Acme Supplies"
},
"APAccountRef": {
"value": "33",
"name": "Accounts Payable"
},
"TxnDate": "2023-04-15",
"CurrencyRef": {
"value": "CAD",
"name": "Canadian Dollar"
},
"PrivateNote": "Monthly office supplies",
"TotalAmt": 350.75,
"DueDate": "2023-05-15",
"sparse": false,
"Line": [
{
"Id": "1",
"LineNum": 1,
"Description": "Paper supplies",
"Amount": 150.50,
"DetailType": "ItemBasedExpenseLineDetail",
"ItemBasedExpenseLineDetail": {
"ItemRef": {
"value": "11",
"name": "Office Supplies"
},
"Qty": 5,
"UnitPrice": 30.10
}
},
{
"Id": "2",
"LineNum": 2,
"Description": "Printer ink",
"Amount": 200.25,
"DetailType": "ItemBasedExpenseLineDetail",
"ItemBasedExpenseLineDetail": {
"ItemRef": {
"value": "12",
"name": "Printing Supplies"
},
"Qty": 3,
"UnitPrice": 66.75
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import common from "../common/base.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "quickbooks-new-bill-updated",
name: "New Bill Updated",
description: "Emit new event when a bill is updated.",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
getQuery(lastDate) {
return `select * from Bill Where Metadata.LastUpdatedTime >= '${lastDate}' orderby Metadata.LastUpdatedTime desc`;
},
getFieldList() {
return "Bill";
},
getFieldDate() {
return "LastUpdatedTime";
},
getSummary(item) {
return `New Bill Updated: ${item.Id}`;
},
},
sampleEmit,
};
74 changes: 74 additions & 0 deletions components/quickbooks/sources/new-bill-updated/test-event.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// components/quickbooks/sources/new-bill-updated/test-event.mjs

export default {
"Id": "123456",
"SyncToken": "1", // Incremented because this is an update
"MetaData": {
"CreateTime": "2023-04-15T10:30:00Z",
"LastUpdatedTime": "2023-04-16T14:45:00Z" // Different update date
},
"VendorRef": {
"value": "56789",
"name": "Acme Supplies"
},
"APAccountRef": {
"value": "33",
"name": "Accounts Payable"
},
"TxnDate": "2023-04-15",
"CurrencyRef": {
"value": "CAD",
"name": "Canadian Dollar"
},
"PrivateNote": "Monthly office supplies - Updated with additional items",
"TotalAmt": 425.25, // Modified amount
"DueDate": "2023-05-15",
"sparse": true, // Indicates this is an update
"Line": [
{
"Id": "1",
"LineNum": 1,
"Description": "Paper supplies",
"Amount": 150.50,
"DetailType": "ItemBasedExpenseLineDetail",
"ItemBasedExpenseLineDetail": {
"ItemRef": {
"value": "11",
"name": "Office Supplies"
},
"Qty": 5,
"UnitPrice": 30.10
}
},
{
"Id": "2",
"LineNum": 2,
"Description": "Printer ink",
"Amount": 200.25,
"DetailType": "ItemBasedExpenseLineDetail",
"ItemBasedExpenseLineDetail": {
"ItemRef": {
"value": "12",
"name": "Printing Supplies"
},
"Qty": 3,
"UnitPrice": 66.75
}
},
{
"Id": "3", // New line added
"LineNum": 3,
"Description": "USB Cables",
"Amount": 74.50,
"DetailType": "ItemBasedExpenseLineDetail",
"ItemBasedExpenseLineDetail": {
"ItemRef": {
"value": "13",
"name": "Computer Accessories"
},
"Qty": 5,
"UnitPrice": 14.90
}
}
]
}