diff --git a/components/quickbooks/actions/create-ap-aging-report/create-ap-aging-report.mjs b/components/quickbooks/actions/create-ap-aging-report/create-ap-aging-report.mjs index a93338dc8b751..4a884cf0d3329 100644 --- a/components/quickbooks/actions/create-ap-aging-report/create-ap-aging-report.mjs +++ b/components/quickbooks/actions/create-ap-aging-report/create-ap-aging-report.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-create-ap-aging-report", name: "Create AP Aging Detail Report", description: "Creates an AP aging report in Quickbooks Online. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/apagingdetail#query-a-report)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/create-bill/create-bill.mjs b/components/quickbooks/actions/create-bill/create-bill.mjs index bb2bb2fed3ae2..931adc8a90a3b 100644 --- a/components/quickbooks/actions/create-bill/create-bill.mjs +++ b/components/quickbooks/actions/create-bill/create-bill.mjs @@ -1,84 +1,129 @@ import { ConfigurationError } from "@pipedream/platform"; import quickbooks from "../../quickbooks.app.mjs"; +import { parseLineItems } from "../../common/utils.mjs"; export default { key: "quickbooks-create-bill", name: "Create Bill", - description: "Creates a bill. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/bill#create-a-bill)", - version: "0.1.6", + description: "Creates a bill. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/bill#create-a-bill)", + version: "0.1.7", type: "action", props: { quickbooks, vendorRefValue: { - label: "Vendor Ref Value", - type: "string", - description: "Reference to the vendor for this transaction. Query the Vendor name list resource to determine the appropriate Vendor object for this reference. Use `Vendor.Id` from that object for `VendorRef.value`.", - }, - lineItems: { - description: "Individual line items of a transaction. Valid Line types include: `ItemBasedExpenseLine` and `AccountBasedExpenseLine`. One minimum line item required for the request to succeed. E.g `[ { \"DetailType\": \"AccountBasedExpenseLineDetail\", \"Amount\": 200.0, \"AccountBasedExpenseLineDetail\": { \"AccountRef\": { \"value\": \"1\" } } } ]`", propDefinition: [ quickbooks, - "lineItems", + "vendorIds", ], - }, - vendorRefName: { - label: "Vendor Reference Name", type: "string", - description: "Reference to the vendor for this transaction. Query the Vendor name list resource to determine the appropriate Vendor object for this reference. Use `Vendor.Name` from that object for `VendorRef.name`.", - optional: true, + label: "Vendor ID", + description: "Reference to the vendor for this transaction", + optional: false, }, currencyRefValue: { propDefinition: [ quickbooks, - "currencyRefValue", + "currency", ], }, - currencyRefName: { + lineItemsAsObjects: { propDefinition: [ quickbooks, - "currencyRefName", + "lineItemsAsObjects", ], + reloadProps: true, }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], + }, + async additionalProps() { + const props = {}; + if (this.lineItemsAsObjects) { + props.lineItems = { + type: "string[]", + label: "Line Items", + description: "Line items of a bill. Set DetailType to `AccountBasedExpenseLineDetail`. Example: `{ \"DetailType\": \"AccountBasedExpenseLineDetail\", \"Amount\": 100.0, \"AccountBasedExpenseLineDetail\": { \"AccountRef\": { \"name\": \"Advertising\", \"value\": \"1\" } } }`", + }; + return props; + } + props.numLineItems = { + type: "integer", + label: "Number of Line Items", + description: "The number of line items to enter", + reloadProps: true, + }; + if (!this.numLineItems) { + return props; + } + for (let i = 1; i <= this.numLineItems; i++) { + props[`account_${i}`] = { + type: "string", + label: `Line ${i} - Account ID`, + options: async ({ page }) => { + return this.quickbooks.getPropOptions({ + page, + resource: "Account", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, + }; + props[`amount_${i}`] = { + type: "string", + label: `Line ${i} - Amount`, + }; + } + return props; + }, + methods: { + buildLineItems() { + const lineItems = []; + for (let i = 1; i <= this.numLineItems; i++) { + lineItems.push({ + DetailType: "AccountBasedExpenseLineDetail", + Amount: this[`amount_${i}`], + AccountBasedExpenseLineDetail: { + AccountRef: { + value: this[`account_${i}`], + }, + }, + }); + } + return lineItems; }, }, async run({ $ }) { - if (!this.vendorRefValue || !this.lineItems) { + if (!this.vendorRefValue || (!this.numLineItems && !this.lineItemsAsObjects)) { throw new ConfigurationError("Must provide vendorRefValue, and lineItems parameters."); } - try { - this.lineItems = this.lineItems.map((lineItem) => typeof lineItem === "string" - ? JSON.parse(lineItem) - : lineItem); - } catch (error) { - throw new ConfigurationError(`We got an error trying to parse the LineItems. Error: ${error}`); - } + const lines = this.lineItemsAsObjects + ? parseLineItems(this.lineItems) + : this.buildLineItems(); + + lines.forEach((line) => { + if (line.DetailType !== "AccountBasedExpenseLineDetail") { + throw new ConfigurationError("Line Item DetailType must be `AccountBasedExpenseLineDetail`"); + } + }); const response = await this.quickbooks.createBill({ $, data: { VendorRef: { value: this.vendorRefValue, - name: this.vendorRefName, }, - Line: this.lineItems, + Line: lines, CurrencyRef: { value: this.currencyRefValue, - name: this.currencyRefName, }, }, - params: { - minorversion: this.minorVersion, - }, }); if (response) { - $.export("summary", `Successfully created bill with id ${response.Bill.Id}`); + $.export("summary", `Successfully created bill with ID ${response.Bill.Id}`); } return response; diff --git a/components/quickbooks/actions/create-customer/create-customer.mjs b/components/quickbooks/actions/create-customer/create-customer.mjs index a5d419c22de74..7d2569c86eb4a 100644 --- a/components/quickbooks/actions/create-customer/create-customer.mjs +++ b/components/quickbooks/actions/create-customer/create-customer.mjs @@ -4,8 +4,8 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-create-customer", name: "Create Customer", - description: "Creates a customer. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#create-a-customer)", - version: "0.1.6", + description: "Creates a customer. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#create-a-customer)", + version: "0.1.7", type: "action", props: { quickbooks, @@ -45,12 +45,6 @@ export default { "suffix", ], }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], - }, }, async run({ $ }) { if ( @@ -70,13 +64,10 @@ export default { FamilyName: this.familyName, GivenName: this.givenName, }, - params: { - minorversion: this.minorVersion, - }, }); if (response) { - $.export("summary", `Successfully created customer with id ${response.Customer.Id}`); + $.export("summary", `Successfully created customer with ID ${response.Customer.Id}`); } return response; diff --git a/components/quickbooks/actions/create-invoice/create-invoice.mjs b/components/quickbooks/actions/create-invoice/create-invoice.mjs index 408be0eeacc87..01370ba853db0 100644 --- a/components/quickbooks/actions/create-invoice/create-invoice.mjs +++ b/components/quickbooks/actions/create-invoice/create-invoice.mjs @@ -1,83 +1,125 @@ import { ConfigurationError } from "@pipedream/platform"; import quickbooks from "../../quickbooks.app.mjs"; +import { parseLineItems } from "../../common/utils.mjs"; export default { key: "quickbooks-create-invoice", name: "Create Invoice", - description: "Creates an invoice. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#create-an-invoice)", - version: "0.1.6", + description: "Creates an invoice. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#create-an-invoice)", + version: "0.1.7", type: "action", props: { quickbooks, - lineItems: { - propDefinition: [ - quickbooks, - "lineItems", - ], - }, customerRefValue: { - label: "Customer Reference Value", - type: "string", - description: "Reference to a customer or job. Query the Customer name list resource to determine the appropriate Customer object for this reference. Use `Customer.Id` from that object for `CustomerRef.value`.", - }, - customerRefName: { propDefinition: [ quickbooks, - "customerRefName", + "customer", ], }, currencyRefValue: { propDefinition: [ quickbooks, - "currencyRefValue", + "currency", ], }, - currencyRefName: { + lineItemsAsObjects: { propDefinition: [ quickbooks, - "currencyRefName", + "lineItemsAsObjects", ], + reloadProps: true, }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], + }, + async additionalProps() { + const props = {}; + if (this.lineItemsAsObjects) { + props.lineItems = { + type: "string[]", + label: "Line Items", + description: "Line items of an invoice. Set DetailType to `SalesItemLineDetail`, `GroupLineDetail`, or `DescriptionOnly`. Example: `{ \"DetailType\": \"SalesItemLineDetail\", \"Amount\": 100.0, \"SalesItemLineDetail\": { \"ItemRef\": { \"name\": \"Services\", \"value\": \"1\" } } }`", + }; + return props; + } + props.numLineItems = { + type: "integer", + label: "Number of Line Items", + description: "The number of line items to enter", + reloadProps: true, + }; + if (!this.numLineItems) { + return props; + } + for (let i = 1; i <= this.numLineItems; i++) { + props[`item_${i}`] = { + type: "string", + label: `Line ${i} - Item ID`, + options: async ({ page }) => { + return this.quickbooks.getPropOptions({ + page, + resource: "Item", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, + }; + props[`amount_${i}`] = { + type: "string", + label: `Line ${i} - Amount`, + }; + } + return props; + }, + methods: { + buildLineItems() { + const lineItems = []; + for (let i = 1; i <= this.numLineItems; i++) { + lineItems.push({ + DetailType: "SalesItemLineDetail", + Amount: this[`amount_${i}`], + SalesItemLineDetail: { + ItemRef: { + value: this[`item_${i}`], + }, + }, + }); + } + return lineItems; }, }, async run({ $ }) { - if (!this.lineItems || !this.customerRefValue) { + if ((!this.numLineItems && !this.lineItemsAsObjects) || !this.customerRefValue) { throw new ConfigurationError("Must provide lineItems, and customerRefValue parameters."); } - try { - this.lineItems = this.lineItems.map((lineItem) => typeof lineItem === "string" - ? JSON.parse(lineItem) - : lineItem); - } catch (error) { - throw new ConfigurationError(`We got an error trying to parse the LineItems. Error: ${error}`); - } + const lines = this.lineItemsAsObjects + ? parseLineItems(this.lineItems) + : this.buildLineItems(); + + lines.forEach((line) => { + if (line.DetailType !== "SalesItemLineDetail" && line.DetailType !== "GroupLineDetail" && line.DetailType !== "DescriptionOnly") { + throw new ConfigurationError("Line Item DetailType must be `SalesItemLineDetail`, `GroupLineDetail`, or `DescriptionOnly`"); + } + }); const response = await this.quickbooks.createInvoice({ $, data: { - Line: this.lineItems, + Line: lines, CustomerRef: { value: this.customerRefValue, - name: this.customerRefName, }, CurrencyRef: { value: this.currencyRefValue, - name: this.currencyRefName, }, }, - params: { - minorversion: this.minorVersion, - }, }); if (response) { - $.export("summary", `Successfully created invoice with id ${response.Invoice.Id}`); + $.export("summary", `Successfully created invoice with ID ${response.Invoice.Id}`); } return response; diff --git a/components/quickbooks/actions/create-payment/create-payment.mjs b/components/quickbooks/actions/create-payment/create-payment.mjs index 01758a39a6827..bc0c3b7b92acc 100644 --- a/components/quickbooks/actions/create-payment/create-payment.mjs +++ b/components/quickbooks/actions/create-payment/create-payment.mjs @@ -3,8 +3,8 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-create-payment", name: "Create Payment", - description: "Creates a payment. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/payment#create-a-payment)", - version: "0.0.5", + description: "Creates a payment. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/payment#create-a-payment)", + version: "0.0.6", type: "action", props: { quickbooks, @@ -14,26 +14,15 @@ export default { type: "string", }, customerRefValue: { - label: "Customer Reference Value", - description: "Reference to a customer or job. Query the Customer name list resource to determine the appropriate Customer object for this reference. Use `Customer.Id` from that object for `CustomerRef.value`.", - type: "string", - }, - customerRefName: { propDefinition: [ quickbooks, - "customerRefName", + "customer", ], }, currencyRefValue: { propDefinition: [ quickbooks, - "currencyRefValue", - ], - }, - currencyRefName: { - propDefinition: [ - quickbooks, - "currencyRefName", + "currency", ], }, }, @@ -44,17 +33,15 @@ export default { TotalAmt: this.totalAmount, CustomerRef: { value: this.customerRefValue, - name: this.customerRefName, }, CurrencyRef: { value: this.currencyRefValue, - name: this.currencyRefName, }, }, }); if (response) { - $.export("summary", `Successfully created payment with id ${response.Payment.Id}`); + $.export("summary", `Successfully created payment with ID ${response.Payment.Id}`); } return response; diff --git a/components/quickbooks/actions/create-pl-report/create-pl-report.mjs b/components/quickbooks/actions/create-pl-report/create-pl-report.mjs index 54cf14deec88d..a5d6319aea029 100644 --- a/components/quickbooks/actions/create-pl-report/create-pl-report.mjs +++ b/components/quickbooks/actions/create-pl-report/create-pl-report.mjs @@ -7,7 +7,7 @@ export default { key: "quickbooks-create-pl-report", name: "Create Profit and Loss Detail Report", description: "Creates a profit and loss report in Quickbooks Online. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/profitandloss#query-a-report)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/create-purchase/create-purchase.mjs b/components/quickbooks/actions/create-purchase/create-purchase.mjs index fcf186c2cd465..c4322afbc521a 100644 --- a/components/quickbooks/actions/create-purchase/create-purchase.mjs +++ b/components/quickbooks/actions/create-purchase/create-purchase.mjs @@ -1,18 +1,24 @@ -import { parseOne } from "../../common/utils.mjs"; import quickbooks from "../../quickbooks.app.mjs"; +import { parseLineItems } from "../../common/utils.mjs"; +import { ConfigurationError } from "@pipedream/platform"; export default { key: "quickbooks-create-purchase", name: "Create Purchase", - description: "Creates a new purchase. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchase#create-a-purchase)", - version: "0.0.4", + description: "Creates a new purchase. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchase#create-a-purchase)", + version: "0.0.5", type: "action", props: { quickbooks, accountRefValue: { - label: "Account Reference Value", + propDefinition: [ + quickbooks, + "accountIds", + ], type: "string", - description: "Specifies the id of the account reference. Check must specify bank account, CreditCard must specify credit card account. Validation Rules:Valid and Active Account Reference of an appropriate type.", + label: "Account Reference Value", + description: "Specifies the ID of the account reference. Check must specify bank account, CreditCard must specify credit card account. Validation Rules:Valid and Active Account Reference of an appropriate type.", + optional: false, }, paymentType: { label: "Payment Type", @@ -24,64 +30,106 @@ export default { "CreditCard", ], }, - lineItems: { + currencyRefValue: { propDefinition: [ quickbooks, - "lineItems", + "currency", ], }, - accountRefName: { - label: "Account Reference Name", - type: "string", - description: "Specifies the name of the account reference. Check must specify bank account, CreditCard must specify credit card account. Validation Rules:Valid and Active Account Reference of an appropriate type.", - optional: true, - }, - currencyRefValue: { - label: "Currency Reference Value", - type: "string", - description: "A three letter string representing the ISO 4217 code for the currency. For example, `USD`, `AUD`, `EUR`, and so on. This must be defined if multicurrency is enabled for the company.\nMulticurrency is enabled for the company if `Preferences.MultiCurrencyEnabled` is set to `true`. Read more about multicurrency support [here](https://developer.intuit.com/docs?RedirectID=MultCurrencies). Required if multicurrency is enabled for the company.", - optional: true, - }, - currencyRefName: { - label: "Currency Reference Name", - type: "object", - description: "The full name of the currency.", - optional: true, + lineItemsAsObjects: { + propDefinition: [ + quickbooks, + "lineItemsAsObjects", + ], + reloadProps: true, }, - minorversion: { - label: "Minor Version", - type: "string", - description: "Use the minorversion query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, + }, + async additionalProps() { + const props = {}; + if (this.lineItemsAsObjects) { + props.lineItems = { + type: "string[]", + label: "Line Items", + description: "Line items of a purchase. Set DetailType to `AccountBasedExpenseLineDetail`. Example: `{ \"DetailType\": \"AccountBasedExpenseLineDetail\", \"Amount\": 100.0, \"AccountBasedExpenseLineDetail\": { \"AccountRef\": { \"name\": \"Advertising\", \"value\": \"1\" } } }`", + }; + return props; + } + props.numLineItems = { + type: "integer", + label: "Number of Line Items", + description: "The number of line items to enter", + reloadProps: true, + }; + if (!this.numLineItems) { + return props; + } + for (let i = 1; i <= this.numLineItems; i++) { + props[`account_${i}`] = { + type: "string", + label: `Line ${i} - Account ID`, + options: async ({ page }) => { + return this.quickbooks.getPropOptions({ + page, + resource: "Account", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, + }; + props[`amount_${i}`] = { + type: "string", + label: `Line ${i} - Amount`, + }; + } + return props; + }, + methods: { + buildLineItems() { + const lineItems = []; + for (let i = 1; i <= this.numLineItems; i++) { + lineItems.push({ + DetailType: "AccountBasedExpenseLineDetail", + Amount: this[`amount_${i}`], + AccountBasedExpenseLineDetail: { + AccountRef: { + value: this[`account_${i}`], + }, + }, + }); + } + return lineItems; }, }, async run({ $ }) { + const lines = this.lineItemsAsObjects + ? parseLineItems(this.lineItems) + : this.buildLineItems(); - let parsedLineItems = parseOne(this.lineItems); - + lines.forEach((line) => { + if (line.DetailType !== "AccountBasedExpenseLineDetail") { + throw new ConfigurationError("Line Item DetailType must be `AccountBasedExpenseLineDetail`"); + } + }); const response = await this.quickbooks.createPurchase({ $, data: { PaymentType: this.paymentType, AccountRef: { value: this.accountRefValue, - name: this.accountRefName, }, - Line: parsedLineItems.length - ? parsedLineItems.map((item) => parseOne(item)) - : [], + Line: lines, CurrencyRef: { value: this.currencyRefValue, - name: this.currencyRefName, }, }, - params: { - minorversion: this.minorVersion, - }, }); if (response) { - $.export("summary", `Successfully created purchase with id ${response.Purchase.Id}`); + $.export("summary", `Successfully created purchase with ID ${response.Purchase.Id}`); } return response; diff --git a/components/quickbooks/actions/create-sales-receipt/create-sales-receipt.mjs b/components/quickbooks/actions/create-sales-receipt/create-sales-receipt.mjs index 02d9f84627e96..8f7c0de62fb4e 100644 --- a/components/quickbooks/actions/create-sales-receipt/create-sales-receipt.mjs +++ b/components/quickbooks/actions/create-sales-receipt/create-sales-receipt.mjs @@ -1,71 +1,113 @@ -import { ConfigurationError } from "@pipedream/platform"; import quickbooks from "../../quickbooks.app.mjs"; +import { parseLineItems } from "../../common/utils.mjs"; +import { ConfigurationError } from "@pipedream/platform"; export default { key: "quickbooks-create-sales-receipt", name: "Create Sales Receipt", description: "Creates a sales receipt. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/salesreceipt#create-a-salesreceipt)", - version: "0.0.5", + version: "0.0.6", type: "action", props: { quickbooks, - lineItems: { + lineItemsAsObjects: { propDefinition: [ quickbooks, - "lineItems", + "lineItemsAsObjects", ], + reloadProps: true, }, currencyRefValue: { propDefinition: [ quickbooks, - "currencyRefValue", - ], - optional: true, - }, - currencyRefName: { - propDefinition: [ - quickbooks, - "currencyRefName", + "currency", ], optional: true, }, }, + async additionalProps() { + const props = {}; + if (this.lineItemsAsObjects) { + props.lineItems = { + type: "string[]", + label: "Line Items", + description: "Line items of a sales receipt. Set DetailType to `SalesItemLineDetail` or `GroupLineDetail`. Example: `{ \"DetailType\": \"SalesItemLineDetail\", \"Amount\": 100.0, \"SalesItemLineDetail\": { \"ItemRef\": { \"name\": \"Services\", \"value\": \"1\" } } }`", + }; + return props; + } + props.numLineItems = { + type: "integer", + label: "Number of Line Items", + description: "The number of line items to enter", + reloadProps: true, + }; + if (!this.numLineItems) { + return props; + } + for (let i = 1; i <= this.numLineItems; i++) { + props[`item_${i}`] = { + type: "string", + label: `Line ${i} - Item ID`, + options: async ({ page }) => { + return this.quickbooks.getPropOptions({ + page, + resource: "Item", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, + }; + props[`amount_${i}`] = { + type: "string", + label: `Line ${i} - Amount`, + }; + } + return props; + }, methods: { - async createSalesReceipt({ - $, data, - }) { - return this.quickbooks._makeRequest(`company/${this.quickbooks._companyId()}/salesreceipt`, { - method: "post", - data, - }, $); + buildLineItems() { + const lineItems = []; + for (let i = 1; i <= this.numLineItems; i++) { + lineItems.push({ + DetailType: "SalesItemLineDetail", + Amount: this[`amount_${i}`], + SalesItemLineDetail: { + ItemRef: { + value: this[`item_${i}`], + }, + }, + }); + } + return lineItems; }, }, async run({ $ }) { - try { - if (typeof (this.lineItems) === "string") { - this.lineItems = JSON.parse(this.lineItems); - } else { - this.lineItems = this.lineItems.map((lineItem) => typeof lineItem === "string" - ? JSON.parse(lineItem) - : lineItem); + const lines = this.lineItemsAsObjects + ? parseLineItems(this.lineItems) + : this.buildLineItems(); + + lines.forEach((line) => { + if (line.DetailType !== "SalesItemLineDetail" && line.DetailType !== "GroupLineDetail") { + throw new ConfigurationError("Line Item DetailType must be `SalesItemLineDetail` or `GroupLineDetail`"); } - } catch (error) { - throw new ConfigurationError(`An error occurred while trying to parse the LineItems. Error: ${error}`); - } + }); - const response = await this.createSalesReceipt({ + const response = await this.quickbooks.createSalesReceipt({ $, data: { - Line: this.lineItems, + Line: lines, CurrencyRef: this.currencyRefValue && { value: this.currencyRefValue, - name: this.currencyRefName, }, }, }); if (response) { - $.export("summary", `Successfully created sales receipt with id ${response.SalesReceipt.Id}`); + $.export("summary", `Successfully created sales receipt with ID ${response.SalesReceipt.Id}`); } return response; diff --git a/components/quickbooks/actions/delete-purchase/delete-purchase.mjs b/components/quickbooks/actions/delete-purchase/delete-purchase.mjs index 707d945323344..9967a38273458 100644 --- a/components/quickbooks/actions/delete-purchase/delete-purchase.mjs +++ b/components/quickbooks/actions/delete-purchase/delete-purchase.mjs @@ -3,8 +3,8 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-delete-purchase", name: "Delete Purchase", - description: "Delete a specific purchase. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchase#delete-a-purchase)", - version: "0.0.4", + description: "Delete a specific purchase. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchase#delete-a-purchase)", + version: "0.0.5", type: "action", props: { quickbooks, @@ -14,18 +14,11 @@ export default { "purchaseId", ], }, - minorversion: { - label: "Minor Version", - type: "string", - description: "Use the minorversion query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, }, async run({ $ }) { const { quickbooks, purchaseId, - minorversion, } = this; const [ @@ -40,13 +33,12 @@ export default { SyncToken, }, params: { - minorversion, operation: "delete", }, }); if (response) { - $.export("summary", `Successfully deleted purchase with id ${Id}`); + $.export("summary", `Successfully deleted purchase with ID ${Id}`); } return response; diff --git a/components/quickbooks/actions/get-bill/get-bill.mjs b/components/quickbooks/actions/get-bill/get-bill.mjs index afb7b60c592bd..89d775c545a29 100644 --- a/components/quickbooks/actions/get-bill/get-bill.mjs +++ b/components/quickbooks/actions/get-bill/get-bill.mjs @@ -4,20 +4,15 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-get-bill", name: "Get Bill", - description: "Returns info about a bill. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/bill#read-a-bill)", - version: "0.1.6", + description: "Returns info about a bill. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/bill#read-a-bill)", + version: "0.1.7", type: "action", props: { quickbooks, billId: { - label: "Bill ID", - type: "string", - description: "Id of the bill to get details of.", - }, - minorVersion: { propDefinition: [ quickbooks, - "minorVersion", + "billId", ], }, }, @@ -29,13 +24,10 @@ export default { const response = await this.quickbooks.getBill({ $, billId: this.billId, - params: { - minorversion: this.minorVersion, - }, }); if (response) { - $.export("summary", `Successfully retrieved bill with id ${response.Bill.Id}`); + $.export("summary", `Successfully retrieved bill with ID ${response.Bill.Id}`); } return response; diff --git a/components/quickbooks/actions/get-customer/get-customer.mjs b/components/quickbooks/actions/get-customer/get-customer.mjs index 6ea17e0340607..731b12a646d19 100644 --- a/components/quickbooks/actions/get-customer/get-customer.mjs +++ b/components/quickbooks/actions/get-customer/get-customer.mjs @@ -4,20 +4,15 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-get-customer", name: "Get Customer", - description: "Returns info about a customer. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/customer#read-a-customer)", - version: "0.3.6", + description: "Returns info about a customer. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/customer#read-a-customer)", + version: "0.3.7", type: "action", props: { quickbooks, customerId: { - label: "Customer ID", - type: "string", - description: "Id of the account to get details of.", - }, - minorVersion: { propDefinition: [ quickbooks, - "minorVersion", + "customer", ], }, }, @@ -29,13 +24,10 @@ export default { const response = await this.quickbooks.getCustomer({ $, customerId: this.customerId, - params: { - minorversion: this.minorVersion, - }, }); if (response) { - $.export("summary", `Successfully retrieved customer with id ${response.Customer.Id}`); + $.export("summary", `Successfully retrieved customer with ID ${response.Customer.Id}`); } return response; diff --git a/components/quickbooks/actions/get-invoice/get-invoice.mjs b/components/quickbooks/actions/get-invoice/get-invoice.mjs index 898ee0495e57a..37314345cf2da 100644 --- a/components/quickbooks/actions/get-invoice/get-invoice.mjs +++ b/components/quickbooks/actions/get-invoice/get-invoice.mjs @@ -4,21 +4,15 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-get-invoice", name: "Get Invoice", - description: "Returns info about an invoice. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#read-an-invoice)", - version: "0.2.7", + description: "Returns info about an invoice. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#read-an-invoice)", + version: "0.2.8", type: "action", props: { quickbooks, invoiceId: { - label: "Invoice ID", - type: "string", - description: "Id of the invoice to get details of.", - optional: true, - }, - minorVersion: { propDefinition: [ quickbooks, - "minorVersion", + "invoiceId", ], }, }, @@ -30,13 +24,10 @@ export default { const response = await this.quickbooks.getInvoice({ $, invoiceId: this.invoiceId, - params: { - minorversion: this.minorVersion, - }, }); if (response) { - $.export("summary", `Successfully retrieved invoice with id ${response.Invoice.Id}`); + $.export("summary", `Successfully retrieved invoice with ID ${response.Invoice.Id}`); } return response; diff --git a/components/quickbooks/actions/get-my-company/get-my-company.mjs b/components/quickbooks/actions/get-my-company/get-my-company.mjs index 334150777e38a..dc56afda5b900 100644 --- a/components/quickbooks/actions/get-my-company/get-my-company.mjs +++ b/components/quickbooks/actions/get-my-company/get-my-company.mjs @@ -3,20 +3,19 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-get-my-company", name: "Get My Company", - description: "Gets info about a company. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/companyinfo)", - version: "0.1.6", + description: "Gets info about a company. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/companyinfo)", + version: "0.1.7", type: "action", props: { quickbooks, }, async run({ $ }) { - const response = await this.quickbooks.getMyCompany({ $, }); if (response) { - $.export("summary", `Successfully retrieved company with id ${response.CompanyInfo.Id}`); + $.export("summary", `Successfully retrieved company with ID ${response.CompanyInfo.Id}`); } return response; diff --git a/components/quickbooks/actions/get-payment/get-payment.mjs b/components/quickbooks/actions/get-payment/get-payment.mjs new file mode 100644 index 0000000000000..df3ca845badf3 --- /dev/null +++ b/components/quickbooks/actions/get-payment/get-payment.mjs @@ -0,0 +1,35 @@ +import { ConfigurationError } from "@pipedream/platform"; +import quickbooks from "../../quickbooks.app.mjs"; + +export default { + key: "quickbooks-get-payment", + name: "Get Payment", + description: "Returns info about a payment. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/payment#read-a-payment)", + version: "0.0.1", + type: "action", + props: { + quickbooks, + paymentId: { + propDefinition: [ + quickbooks, + "paymentId", + ], + }, + }, + async run({ $ }) { + if (!this.paymentId) { + throw new ConfigurationError("Must provide paymentId parameter."); + } + + const response = await this.quickbooks.getPayment({ + $, + paymentId: this.paymentId, + }); + + if (response) { + $.export("summary", `Successfully retrieved payment with ID ${response.Payment.Id}`); + } + + return response; + }, +}; diff --git a/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs b/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs index 5bdfc45477ac4..c3de216fd870e 100644 --- a/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs +++ b/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs @@ -4,20 +4,15 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-get-purchase-order", name: "Get Purchase Order", - description: "Returns details about a purchase order. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchaseorder#read-a-purchase-order)", - version: "0.1.6", + description: "Returns details about a purchase order. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchaseorder#read-a-purchase-order)", + version: "0.1.7", type: "action", props: { quickbooks, purchaseOrderId: { - label: "Purchase Order ID", - type: "string", - description: "Id of the purchase order to get details of.", - }, - minorVersion: { propDefinition: [ quickbooks, - "minorVersion", + "purchaseOrderId", ], }, }, @@ -29,13 +24,11 @@ export default { const response = await this.quickbooks.getPurchaseOrder({ $, purchaseOrderId: this.purchaseOrderId, - params: { - minorversion: this.minorVersion, - }, + params: {}, }); if (response) { - $.export("summary", `Successfully retrieved purchase order with id ${response.PurchaseOrder.Id}`); + $.export("summary", `Successfully retrieved purchase order with ID ${response.PurchaseOrder.Id}`); } return response; diff --git a/components/quickbooks/actions/get-purchase/get-purchase.mjs b/components/quickbooks/actions/get-purchase/get-purchase.mjs index d10339ef55fba..4b394660c9d89 100644 --- a/components/quickbooks/actions/get-purchase/get-purchase.mjs +++ b/components/quickbooks/actions/get-purchase/get-purchase.mjs @@ -4,20 +4,15 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-get-purchase", name: "Get Purchase", - description: "Returns info about a purchase. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchase#read-a-purchase)", - version: "0.1.6", + description: "Returns info about a purchase. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchase#read-a-purchase)", + version: "0.1.7", type: "action", props: { quickbooks, purchaseId: { - label: "Purchase ID", - type: "string", - description: "Id of the purchase to get details of.", - }, - minorVersion: { propDefinition: [ quickbooks, - "minorVersion", + "purchaseId", ], }, }, @@ -28,14 +23,11 @@ export default { const response = await this.quickbooks.getPurchase({ $, - purchaseId: this.purchaseId, - params: { - minorversion: this.minorVersion, - }, + purchaseId: this.purchaseId?.value ?? this.purchaseId, }); if (response) { - $.export("summary", `Successfully retrieved purchase with id ${response.Purchase.Id}`); + $.export("summary", `Successfully retrieved purchase with ID ${response.Purchase.Id}`); } return response; diff --git a/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs b/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs index c630ea1e62c6e..64e8c29d001e7 100644 --- a/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs +++ b/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs @@ -4,20 +4,15 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-get-sales-receipt", name: "Get Sales Receipt", - description: "Returns details about a sales receipt. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/salesreceipt#read-a-salesreceipt)", - version: "0.1.6", + description: "Returns details about a sales receipt. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/salesreceipt#read-a-salesreceipt)", + version: "0.1.7", type: "action", props: { quickbooks, salesReceiptId: { - label: "sales Receipt ID", - type: "string", - description: "Id of the sales receipt to get details of.", - }, - minorVersion: { propDefinition: [ quickbooks, - "minorVersion", + "salesReceiptId", ], }, }, @@ -29,13 +24,10 @@ export default { const response = await this.quickbooks.getSalesReceipt({ $, salesReceiptId: this.salesReceiptId, - params: { - minorversion: this.minorVersion, - }, }); if (response) { - $.export("summary", `Successfully retrieved sales receipt with id ${response.SalesReceipt.Id}`); + $.export("summary", `Successfully retrieved sales receipt with ID ${response.SalesReceipt.Id}`); } return response; diff --git a/components/quickbooks/actions/get-time-activity/get-time-activity.mjs b/components/quickbooks/actions/get-time-activity/get-time-activity.mjs index 6b6ad07ffb380..e9f45b43d7ae0 100644 --- a/components/quickbooks/actions/get-time-activity/get-time-activity.mjs +++ b/components/quickbooks/actions/get-time-activity/get-time-activity.mjs @@ -4,20 +4,15 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-get-time-activity", name: "Get Time Activity", - description: "Returns info about an activity. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/timeactivity#read-a-timeactivity-object)", - version: "0.1.6", + description: "Returns info about an activity. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/timeactivity#read-a-timeactivity-object)", + version: "0.1.7", type: "action", props: { quickbooks, timeActivityId: { - label: "Time Activity ID", - type: "string", - description: "Id of the time activity object to get details of.", - }, - minorVersion: { propDefinition: [ quickbooks, - "minorVersion", + "timeActivityId", ], }, }, @@ -29,13 +24,11 @@ export default { const response = await this.quickbooks.getTimeActivity({ $, timeActivityId: this.timeActivityId, - params: { - minorversion: this.minorVersion, - }, + params: {}, }); if (response) { - $.export("summary", `Successfully retrieved time activity with id ${response.TimeActivity.Id}`); + $.export("summary", `Successfully retrieved time activity with ID ${response.TimeActivity.Id}`); } return response; diff --git a/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs b/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs deleted file mode 100644 index 164006f4750d8..0000000000000 --- a/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs +++ /dev/null @@ -1,90 +0,0 @@ -import { ConfigurationError } from "@pipedream/platform"; -import quickbooks from "../../quickbooks.app.mjs"; - -export default { - key: "quickbooks-sandbox-search-invoices", - name: "Search Invoices", - description: "Searches for invoices. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#query-an-invoice)", - version: "0.1.6", - type: "action", - props: { - quickbooks, - includeClause: { - propDefinition: [ - quickbooks, - "includeClause", - ], - optional: false, - }, - maxResults: { - propDefinition: [ - quickbooks, - "maxResults", - ], - }, - orderClause: { - propDefinition: [ - quickbooks, - "orderClause", - ], - }, - startPosition: { - description: "The starting count of the response for pagination.", - label: "Start Position", - optional: true, - type: "string", - }, - whereClause: { - propDefinition: [ - quickbooks, - "whereClause", - ], - optional: false, - }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], - }, - }, - async run({ $ }) { - if (!this.includeClause || !this.whereClause) { - throw new ConfigurationError("Must provide includeClause, whereClause parameters."); - } - - //Prepares OrderBy clause,start position, max results - // parameters to be used in the request's query parameter. - var orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } - - var startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } - - var maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } - - //Prepares the request's query parameter - const query = `select ${this.includeClause} from Invoice where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; - - const response = await this.quickbooks.query({ - $, - params: { - minorversion: this.minorVersion, - query, - }, - }); - - if (response) { - $.export("summary", "Successfully retrieved invoices"); - } - - return response; - }, -}; diff --git a/components/quickbooks/actions/search-accounts/search-accounts.mjs b/components/quickbooks/actions/search-accounts/search-accounts.mjs index ebee75f17be3b..107254935be5c 100644 --- a/components/quickbooks/actions/search-accounts/search-accounts.mjs +++ b/components/quickbooks/actions/search-accounts/search-accounts.mjs @@ -4,18 +4,11 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-search-accounts", name: "Search Accounts", - description: "Search for accounts. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/account#query-an-account)", - version: "0.2.6", + description: "Search for accounts. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/account#query-an-account)", + version: "0.2.7", type: "action", props: { quickbooks, - includeClause: { - propDefinition: [ - quickbooks, - "includeClause", - ], - optional: false, - }, maxResults: { propDefinition: [ quickbooks, @@ -41,40 +34,32 @@ export default { ], optional: false, }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], - }, }, async run({ $ }) { - if (!this.includeClause || !this.whereClause) { - throw new ConfigurationError("Must provide includeClause, whereClause parameters."); + if (!this.whereClause) { + throw new ConfigurationError("Must provide whereClause parameter."); } - var orderClause = ""; + let orderClause = ""; if (this.orderClause) { orderClause = ` ORDERBY ${this.orderClause}`; } - var startPosition = ""; + let startPosition = ""; if (this.startPosition) { startPosition = ` STARTPOSITION ${this.startPosition}`; } - var maxResults = ""; + let maxResults = ""; if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; + maxResults = ` MAXRESULTS ${this.maxResults}`; } - //Prepares the request's query parameter - const query = `select ${this.includeClause} from Account where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; + const query = `select * from Account where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ $, params: { - minorversion: this.minorVersion, query, }, }); diff --git a/components/quickbooks/actions/search-customers/search-customers.mjs b/components/quickbooks/actions/search-customers/search-customers.mjs index 2ec5f2752b675..db6fe1a34300e 100644 --- a/components/quickbooks/actions/search-customers/search-customers.mjs +++ b/components/quickbooks/actions/search-customers/search-customers.mjs @@ -4,18 +4,11 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-search-customers", name: "Search Customers", - description: "Searches for customers. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#query-a-customer)", - version: "0.1.6", + description: "Searches for customers. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#query-a-customer)", + version: "0.1.7", type: "action", props: { quickbooks, - includeClause: { - propDefinition: [ - quickbooks, - "includeClause", - ], - optional: false, - }, maxResults: { propDefinition: [ quickbooks, @@ -41,40 +34,32 @@ export default { ], optional: false, }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], - }, }, async run({ $ }) { - if (!this.includeClause || !this.whereClause) { - throw new ConfigurationError("Must provide includeClause, whereClause parameters."); + if (!this.whereClause) { + throw new ConfigurationError("Must provide whereClause parameter."); } - var orderClause = ""; + let orderClause = ""; if (this.orderClause) { orderClause = ` ORDERBY ${this.orderClause}`; } - var startPosition = ""; + let startPosition = ""; if (this.startPosition) { startPosition = ` STARTPOSITION ${this.startPosition}`; } - var maxResults = ""; + let maxResults = ""; if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; + maxResults = ` MAXRESULTS ${this.maxResults}`; } - //Prepares the request's query parameter - const query = `select ${this.includeClause} from Customer where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; + const query = `select * from Customer where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ $, params: { - minorversion: this.minorVersion, query, }, }); diff --git a/components/quickbooks/actions/search-invoices/search-invoices.mjs b/components/quickbooks/actions/search-invoices/search-invoices.mjs new file mode 100644 index 0000000000000..0c9c332f80ebd --- /dev/null +++ b/components/quickbooks/actions/search-invoices/search-invoices.mjs @@ -0,0 +1,70 @@ +import { ConfigurationError } from "@pipedream/platform"; +import quickbooks from "../../quickbooks.app.mjs"; + +export default { + key: "quickbooks-search-invoices", + name: "Search Invoices", + description: "Searches for invoices. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#query-an-invoice)", + version: "0.0.1", + type: "action", + props: { + quickbooks, + maxResults: { + propDefinition: [ + quickbooks, + "maxResults", + ], + }, + orderClause: { + propDefinition: [ + quickbooks, + "orderClause", + ], + }, + startPosition: { + description: "The starting count of the response for pagination.", + label: "Start Position", + optional: true, + type: "string", + }, + whereClause: { + propDefinition: [ + quickbooks, + "whereClause", + ], + optional: false, + }, + }, + async run({ $ }) { + if (!this.whereClause) { + throw new ConfigurationError("Must provide whereClause parameter."); + } + + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; + + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; + + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; + + const query = `select * from Invoice where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; + + const response = await this.quickbooks.query({ + $, + params: { + query, + }, + }); + + if (response) { + $.export("summary", "Successfully retrieved invoices"); + } + + return response; + }, +}; diff --git a/components/quickbooks/actions/search-items/search-items.mjs b/components/quickbooks/actions/search-items/search-items.mjs index 1913190a94d4d..a25cd3ffb25fd 100644 --- a/components/quickbooks/actions/search-items/search-items.mjs +++ b/components/quickbooks/actions/search-items/search-items.mjs @@ -4,18 +4,11 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-search-items", name: "Search Items", - description: "Searches for items. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#query-an-item)", - version: "0.1.6", + description: "Searches for items. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#query-an-item)", + version: "0.1.7", type: "action", props: { quickbooks, - includeClause: { - propDefinition: [ - quickbooks, - "includeClause", - ], - optional: false, - }, maxResults: { propDefinition: [ quickbooks, @@ -41,40 +34,29 @@ export default { ], optional: false, }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], - }, }, async run({ $ }) { - if (!this.includeClause || !this.whereClause) { - throw new ConfigurationError("Must provide includeClause, whereClause parameters."); + if (!this.whereClause) { + throw new ConfigurationError("Must provide whereClause parameter."); } - var orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - var startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; - var maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; - //Prepares the request's query parameter - const query = `select ${this.includeClause} from Item where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; + const query = `select * from Item where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ $, params: { - minorversion: this.minorVersion, query, }, }); diff --git a/components/quickbooks/actions/search-products/search-products.mjs b/components/quickbooks/actions/search-products/search-products.mjs index 6abe33fefa886..e6cc84a1da496 100644 --- a/components/quickbooks/actions/search-products/search-products.mjs +++ b/components/quickbooks/actions/search-products/search-products.mjs @@ -4,18 +4,11 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-search-products", name: "Search Products", - description: "Search for products. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#query-an-item)", - version: "0.1.6", + description: "Search for products. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#query-an-item)", + version: "0.1.7", type: "action", props: { quickbooks, - includeClause: { - propDefinition: [ - quickbooks, - "includeClause", - ], - optional: false, - }, maxResults: { propDefinition: [ quickbooks, @@ -41,40 +34,29 @@ export default { ], optional: false, }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], - }, }, async run({ $ }) { - if (!this.includeClause || !this.whereClause) { - throw new ConfigurationError("Must provide includeClause, whereClause parameters."); + if (!this.whereClause) { + throw new ConfigurationError("Must provide whereClause parameter."); } - var orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - var startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; - var maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; - //Prepares the request's query parameter - const query = `select ${this.includeClause} from Item where Type = 'Inventory' and ${this.whereClause}${orderClause}${startPosition}${maxResults}`; + const query = `select * from Item where Type = 'Inventory' and ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ $, params: { - minorversion: this.minorVersion, query, }, }); diff --git a/components/quickbooks/actions/search-purchases/search-purchases.mjs b/components/quickbooks/actions/search-purchases/search-purchases.mjs index ac08e79571e04..41e7c2fe42ff2 100644 --- a/components/quickbooks/actions/search-purchases/search-purchases.mjs +++ b/components/quickbooks/actions/search-purchases/search-purchases.mjs @@ -4,7 +4,7 @@ export default { key: "quickbooks-search-purchases", name: "Search Purchases", description: "Searches for purchases. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchase#query-a-purchase)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { quickbooks, @@ -33,40 +33,29 @@ export default { ], optional: true, }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], - }, }, async run({ $ }) { - let whereClause = ""; - if (this.whereClause) { - whereClause = ` WHERE ${this.whereClause}`; - } + const whereClause = this.whereClause + ? ` WHERE ${this.whereClause}` + : ""; - var orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - var startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; + + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; - var maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } - //Prepares the request's query parameter const query = `select * from Purchase ${whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ $, params: { - minorversion: this.minorVersion, query, }, }); diff --git a/components/quickbooks/actions/search-query/search-query.mjs b/components/quickbooks/actions/search-query/search-query.mjs index 5515f8038650b..d92eff6a2ab38 100644 --- a/components/quickbooks/actions/search-query/search-query.mjs +++ b/components/quickbooks/actions/search-query/search-query.mjs @@ -4,8 +4,8 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-search-query", name: "Search Query", - description: "Performs a search query against a Quickbooks entity. [See docs here](https://developer.intuit.com/app/develophttps://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries)", - version: "0.1.6", + description: "Performs a search query against a Quickbooks entity. [See the documentation](https://developer.intuit.com/app/develophttps://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries)", + version: "0.1.7", type: "action", props: { quickbooks, @@ -14,12 +14,6 @@ export default { type: "string", description: "A search query against a Quickbooks entity. See query language syntax, limitations, and other specifications on [Data queries](https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries)", }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], - }, }, async run({ $ }) { if (!this.searchQuery) { @@ -29,7 +23,6 @@ export default { const response = await this.quickbooks.query({ $, params: { - minorversion: this.minorVersion, query: this.searchQuery, }, }); @@ -37,5 +30,6 @@ export default { if (response) { $.export("summary", "Successfully retrieved query results"); } + return response; }, }; diff --git a/components/quickbooks/actions/search-services/search-services.mjs b/components/quickbooks/actions/search-services/search-services.mjs new file mode 100644 index 0000000000000..e8bd5dca67a30 --- /dev/null +++ b/components/quickbooks/actions/search-services/search-services.mjs @@ -0,0 +1,70 @@ +import quickbooks from "../../quickbooks.app.mjs"; +import { ConfigurationError } from "@pipedream/platform"; + +export default { + key: "quickbooks-search-services", + name: "Search Services", + description: "Search for services. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#query-an-item)", + version: "0.0.1", + type: "action", + props: { + quickbooks, + whereClause: { + propDefinition: [ + quickbooks, + "whereClause", + ], + optional: false, + }, + orderClause: { + propDefinition: [ + quickbooks, + "orderClause", + ], + }, + startPosition: { + description: "The starting count of the response for pagination.", + label: "Start Position", + optional: true, + type: "string", + }, + maxResults: { + propDefinition: [ + quickbooks, + "maxResults", + ], + }, + }, + async run({ $ }) { + if (!this.whereClause) { + throw new ConfigurationError("Must provide whereClause parameter."); + } + + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; + + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; + + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; + + const query = `select * from Item where Type = 'Service' and ${this.whereClause}${orderClause}${startPosition}${maxResults}`; + + const response = await this.quickbooks.query({ + $, + params: { + query, + }, + }); + + if (response) { + $.export("summary", "Successfully retrieved services"); + } + + return response; + }, +}; diff --git a/components/quickbooks/actions/search-time-activities/search-time-activities.mjs b/components/quickbooks/actions/search-time-activities/search-time-activities.mjs index 4f52319d3c300..93e06ecd4a109 100644 --- a/components/quickbooks/actions/search-time-activities/search-time-activities.mjs +++ b/components/quickbooks/actions/search-time-activities/search-time-activities.mjs @@ -4,18 +4,11 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-search-time-activities", name: "Search Time Activities", - description: "Searches for time activities. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/timeactivity#query-a-timeactivity-object)", - version: "0.1.6", + description: "Searches for time activities. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/timeactivity#query-a-timeactivity-object)", + version: "0.1.7", type: "action", props: { quickbooks, - includeClause: { - propDefinition: [ - quickbooks, - "includeClause", - ], - optional: false, - }, maxResults: { propDefinition: [ quickbooks, @@ -41,40 +34,29 @@ export default { ], optional: false, }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], - }, }, async run({ $ }) { - if (!this.includeClause || !this.whereClause) { - throw new ConfigurationError("Must provide includeClause, whereClause parameters."); + if (!this.whereClause) { + throw new ConfigurationError("Must provide whereClause parameter."); } - var orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - var startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; - var maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; - //Prepares the request's query parameter - const query = `select ${this.includeClause} from TimeActivity where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; + const query = `select * from TimeActivity where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ $, params: { - minorversion: this.minorVersion, query, }, }); diff --git a/components/quickbooks/actions/search-vendors/search-vendors.mjs b/components/quickbooks/actions/search-vendors/search-vendors.mjs index 20e4752e1d35c..321b228a1ed49 100644 --- a/components/quickbooks/actions/search-vendors/search-vendors.mjs +++ b/components/quickbooks/actions/search-vendors/search-vendors.mjs @@ -4,18 +4,11 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-search-vendors", name: "Search Vendors", - description: "Searches for vendors. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/vendor#query-a-vendor)", - version: "0.1.6", + description: "Searches for vendors. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/vendor#query-a-vendor)", + version: "0.1.7", type: "action", props: { quickbooks, - includeClause: { - propDefinition: [ - quickbooks, - "includeClause", - ], - optional: false, - }, maxResults: { propDefinition: [ quickbooks, @@ -41,40 +34,29 @@ export default { ], optional: false, }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], - }, }, async run({ $ }) { - if (!this.includeClause || !this.whereClause) { + if (!this.whereClause) { throw new ConfigurationError("Must provide includeClause, whereClause parameters."); } - var orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - var startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; - var maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; - //Prepares the request's query parameter - const query = `select ${this.includeClause} from Vendor where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; + const query = `select * from Vendor where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ $, params: { - minorversion: this.minorVersion, query, }, }); diff --git a/components/quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs b/components/quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs index 9495fc93a8d89..31ccf5d7e06f3 100644 --- a/components/quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs +++ b/components/quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs @@ -1,12 +1,12 @@ -import { ConfigurationError } from "@pipedream/platform"; -import { parseOne } from "../../common/utils.mjs"; +import { parseLineItems } from "../../common/utils.mjs"; import quickbooks from "../../quickbooks.app.mjs"; +import { ConfigurationError } from "@pipedream/platform"; export default { key: "quickbooks-sparse-update-invoice", name: "Sparse Update Invoice", - description: "Sparse updating provides the ability to update a subset of properties for a given object; only elements specified in the request are updated. Missing elements are left untouched. The ID of the object to update is specified in the request body.​ [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#sparse-update-an-invoice)", - version: "0.1.4", + description: "Sparse updating provides the ability to update a subset of properties for a given object; only elements specified in the request are updated. Missing elements are left untouched. The ID of the object to update is specified in the request body.​ [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#sparse-update-an-invoice)", + version: "0.1.5", type: "action", props: { quickbooks, @@ -16,12 +16,6 @@ export default { "invoiceId", ], }, - lineItems: { - propDefinition: [ - quickbooks, - "lineItems", - ], - }, customer: { propDefinition: [ quickbooks, @@ -34,42 +28,110 @@ export default { "currency", ], }, - minorVersion: { + lineItemsAsObjects: { propDefinition: [ quickbooks, - "minorVersion", + "lineItemsAsObjects", ], + reloadProps: true, }, }, - async run({ $ }) { - try { - this.lineItems = this.lineItems.map((lineItem) => typeof lineItem === "string" - ? JSON.parse(lineItem) - : lineItem); - } catch (error) { - throw new ConfigurationError(`We got an error trying to parse the Line Items prop. Error: ${error}`); + async additionalProps() { + const props = {}; + if (this.lineItemsAsObjects) { + props.lineItems = { + type: "string[]", + label: "Line Items", + description: "Line items of an invoice. Set DetailType to `SalesItemLineDetail`, `GroupLineDetail`, `DescriptionOnly`, `DiscountLineDetail`, or `SubTotalLineDetail`. Example: `{ \"DetailType\": \"SalesItemLineDetail\", \"Amount\": 100.0, \"SalesItemLineDetail\": { \"ItemRef\": { \"name\": \"Services\", \"value\": \"1\" } } }`", + }; + return props; + } + props.numLineItems = { + type: "integer", + label: "Number of Line Items", + description: "The number of line items to enter", + reloadProps: true, + }; + if (!this.numLineItems) { + return props; } + for (let i = 1; i <= this.numLineItems; i++) { + props[`item_${i}`] = { + type: "string", + label: `Line ${i} - Item ID`, + options: async ({ page }) => { + return this.quickbooks.getPropOptions({ + page, + resource: "Item", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, + }; + props[`amount_${i}`] = { + type: "string", + label: `Line ${i} - Amount`, + }; + } + return props; + }, + methods: { + buildLineItems() { + const lineItems = []; + for (let i = 1; i <= this.numLineItems; i++) { + lineItems.push({ + DetailType: "SalesItemLineDetail", + Amount: this[`amount_${i}`], + SalesItemLineDetail: { + ItemRef: { + value: this[`item_${i}`], + }, + }, + }); + } + return lineItems; + }, + }, + async run({ $ }) { + const lines = this.lineItemsAsObjects + ? parseLineItems(this.lineItems) + : this.buildLineItems(); + + lines.forEach((line) => { + if (line.DetailType !== "SalesItemLineDetail" && line.DetailType !== "GroupLineDetail" && line.DetailType !== "DescriptionOnly" && line.DetailType !== "DiscountLineDetail" && line.DetailType !== "SubTotalLineDetail") { + throw new ConfigurationError("Line Item DetailType must be `SalesItemLineDetail`, `GroupLineDetail`, `DescriptionOnly`, `DiscountLineDetail`, or `SubTotalLineDetail`"); + } + }); - const { Invoice } = await this.quickbooks.getInvoice({ + const { Invoice: invoice } = await this.quickbooks.getInvoice({ $, invoiceId: this.invoiceId, }); - if (this.lineItems.length) Invoice.Line?.push(...this.lineItems); - - Invoice.CurrencyRef = parseOne(this.currency); - Invoice.CustomerRef = parseOne(this.customer); + if (lines?.length) invoice.Line?.push(lines); const response = await this.quickbooks.sparseUpdateInvoice({ $, - data: Invoice, - params: { - minorversion: this.minorVersion, + data: { + sparse: true, + Id: this.invoiceId, + SyncToken: invoice.SyncToken, + CurrencyRef: this.currencyRefValue && { + value: this.currencyRefValue, + }, + CustomerRef: { + value: this.customer, + }, + Line: invoice.Line, }, }); if (response) { - $.export("summary", `Successfully updated invoice with id ${response.Invoice.Id}`); + $.export("summary", `Successfully updated invoice with ID ${response.Invoice.Id}`); } return response; diff --git a/components/quickbooks/actions/update-customer/update-customer.mjs b/components/quickbooks/actions/update-customer/update-customer.mjs index ab971febe78df..23381476c4615 100644 --- a/components/quickbooks/actions/update-customer/update-customer.mjs +++ b/components/quickbooks/actions/update-customer/update-customer.mjs @@ -4,11 +4,17 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-update-customer", name: "Update Customer", - description: "Updates a customer. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#full-update-a-customer)", - version: "0.1.6", + description: "Updates a customer. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#full-update-a-customer)", + version: "0.1.7", type: "action", props: { quickbooks, + customerId: { + propDefinition: [ + quickbooks, + "customer", + ], + }, displayName: { propDefinition: [ quickbooks, @@ -48,20 +54,14 @@ export default { currencyRefValue: { propDefinition: [ quickbooks, - "currencyRefValue", - ], - }, - currencyRefName: { - propDefinition: [ - quickbooks, - "currencyRefName", + "currency", ], }, active: { description: "If true, this entity is currently enabled for use by QuickBooks. If there is an amount in `Customer.Balance` when setting this Customer object to inactive through the QuickBooks UI, a CreditMemo balancing transaction is created for the amount.", label: "Active", optional: true, - type: "string", + type: "boolean", }, alternatePhoneFreeFormNumber: { description: "Specifies the alternate phone number in free form.", @@ -69,29 +69,14 @@ export default { optional: true, type: "string", }, - arAccountRefName: { - description: "Name of the accounts receivable account to be used for this customer. Each customer must have his own AR account. Applicable for France companies, only. Available when endpoint is evoked with the minorversion=3 query parameter. Query the Account name list resource to determine the appropriate Account object for this reference, where Account.AccountType=Accounts Receivable. Use `Account.Name` from that object for `ARAccountRef.name`.", - label: "Ar Account Ref Name", - optional: true, - type: "string", - }, arAccountRefValue: { - description: "Id of the accounts receivable account to be used for this customer. Each customer must have his own AR account. Applicable for France companies, only. Available when endpoint is evoked with the minorversion=3 query parameter. Query the Account name list resource to determine the appropriate Account object for this reference, where Account.AccountType=Accounts Receivable. Use `Account.Id` from that object for `ARAccountRef.value`.", - label: "Ar Account Ref Value", - optional: true, - type: "string", - }, - balance: { - description: "Specifies the open balance amount or the amount unpaid by the customer. For the create operation, this represents the opening balance for the customer. When returned in response to the query request it represents the current open balance (unpaid amount) for that customer. Write-on-create.", - label: "Balance", - optional: true, - type: "string", - }, - balanceWithJob: { - description: "Cumulative open balance amount for the Customer (or Job) and all its sub-jobs. Cannot be written to QuickBooks.", - label: "Balance With Job", - optional: true, + description: "ID of the accounts receivable account to be used for this customer. Each customer must have his own AR account. Applicable for France companies, only. Available when endpoint is evoked with the minorversion=3 query parameter. Query the Account name list resource to determine the appropriate Account object for this reference, where Account.AccountType=Accounts Receivable. Use `Account.Id` from that object for `ARAccountRef.value`.", + label: "AR Account Ref Value", type: "string", + propDefinition: [ + quickbooks, + "accountIds", + ], }, billAddrCity: { description: "City name for the billing address.", @@ -111,12 +96,6 @@ export default { optional: true, type: "string", }, - billAddrId: { - description: "Unique identifier of the QuickBooks object for the billing address, used for modifying the address. \nThe BillAddr object represents the default billing address. If a physical address is updated from within the transaction object, the QuickBooks Online API flows individual address components differently into the Line elements of the transaction response then when the transaction was first created:\n* `Line1` and `Line2` elements are populated with the customer name and company name.\n* Original `Line1` through `Line5` contents, `City`, `SubDivisionCode`, and `PostalCode` flow into `Line3` through `Line5` as a free format strings.", - label: "Bill Addr Id", - optional: true, - type: "string", - }, billAddrLate: { description: "Latitude coordinate of Geocode (Geospacial Entity Object Code). `INVALID` is returned for invalid addresses.", label: "Bill Addr Late", @@ -183,25 +162,14 @@ export default { optional: true, type: "string", }, - customerId: { - description: "Unique identifier for the customer object to be updated.", - label: "Customer Id", - type: "string", - }, customerTypeRefValue: { - description: "Id referencing to the customer type assigned to a customer. This field is only returned if the customer is assigned a customer type.", - label: "Customer Type Ref Value", - optional: true, - type: "string", - }, - defaultTaxCodeName: { - description: "Id of the default tax code associated with this Customer object. Reference is valid if `Customer.Taxable` is set to true; otherwise, it is ignored. If automated sales tax is enabled (`Preferences.TaxPrefs.PartnerTaxEnabled` is set to true) the default tax code is set by the system and can not be overridden. Query the `TaxCode` name list resource to determine the appropriate `TaxCode` object for this reference. Use `TaxCode.Name` from that object for `DefaultTaxCodeRef.name`.", - label: "Default Tax Code Name", - optional: true, - type: "string", + propDefinition: [ + quickbooks, + "customerType", + ], }, defaultTaxCodeValue: { - description: "Id of the default tax code associated with this Customer object. Reference is valid if `Customer.Taxable` is set to true; otherwise, it is ignored. If automated sales tax is enabled (`Preferences.TaxPrefs.PartnerTaxEnabled` is set to true) the default tax code is set by the system and can not be overridden. Query the `TaxCode` name list resource to determine the appropriate `TaxCode` object for this reference. Use `TaxCode.Id` from that object for `DefaultTaxCodeRef.value`.", + description: "ID of the default tax code associated with this Customer object. Reference is valid if `Customer.Taxable` is set to true; otherwise, it is ignored. If automated sales tax is enabled (`Preferences.TaxPrefs.PartnerTaxEnabled` is set to true) the default tax code is set by the system and can not be overridden. Query the `TaxCode` name list resource to determine the appropriate `TaxCode` object for this reference. Use `TaxCode.Id` from that object for `DefaultTaxCodeRef.value`.", label: "Default Tax Code Value", optional: true, type: "string", @@ -233,12 +201,6 @@ export default { ], type: "string", }, - isProject: { - description: "If true, indicates this is a Project.", - label: "Is Project", - optional: true, - type: "boolean", - }, job: { description: "If true, this is a Job or sub-customer. If false or null, this is a top level customer, not a Job or sub-customer.", label: "Job", @@ -257,35 +219,11 @@ export default { optional: true, type: "string", }, - openBalanceDate: { - description: "Date of the Open Balance for the create operation. Write-on-create.", - label: "Open Balance Date", - optional: true, - type: "string", - }, - parentRefName: { - description: "Name referencing to a Customer object that is the immediate parent of the Sub-Customer/Job in the hierarchical Customer:Job list. Required for the create operation if this object is a sub-customer or Job. Query the Customer name list resource to determine the appropriate Customer object for this reference. Use `Customer.Name` from that object for `ParentRef.name`.", - label: "Parent Ref Name", - optional: true, - type: "string", - }, - parentRefValue: { - description: "Id referencing to a Customer object that is the immediate parent of the Sub-Customer/Job in the hierarchical Customer:Job list. Required for the create operation if this object is a sub-customer or Job. Query the Customer name list resource to determine the appropriate Customer object for this reference. Use `Customer.Id` from that object for `ParentRef.value`.", - label: "Parent Ref Value", - optional: true, - type: "string", - }, - paymentMethodRefName: { - description: "Id referencing a PaymentMethod object associated with this Customer object. Query the PaymentMethod name list resource to determine the appropriate PaymentMethod object for this reference. Use `PaymentMethod.Name` from that object for `PaymentMethodRef.name`.", - label: "Payment Method Ref Name", - optional: true, - type: "string", - }, paymentMethodRefValue: { - description: "Id referencing a PaymentMethod object associated with this Customer object. Query the PaymentMethod name list resource to determine the appropriate PaymentMethod object for this reference. Use `PaymentMethod.Id` from that object for `PaymentMethodRef.value`.", - label: "Payment Method Ref Value", - optional: true, - type: "string", + propDefinition: [ + quickbooks, + "paymentMethod", + ], }, preferredDeliveryMethod: { description: "Preferred delivery method. Values are `Print`, `Email`, or `None`.", @@ -328,17 +266,13 @@ export default { optional: true, type: "string", }, - saleTermRefName: { - description: "Name of a SalesTerm object associated with this Customer object. Query the Term name list resource to determine the appropriate Term object for this reference. Use `Term.Name` from that object for `SalesTermRef.name`.", - label: "Sale Term Ref Name", - optional: true, - type: "string", - }, saleTermRefValue: { - description: "Id of a SalesTerm object associated with this Customer object. Query the Term name list resource to determine the appropriate Term object for this reference. Use `Term.Id` from that object for `SalesTermRef.value`.", - label: "Sale Term Ref Value", - optional: true, + description: "ID of a SalesTerm object associated with this Customer object. Query the Term name list resource to determine the appropriate Term object for this reference. Use `Term.Id` from that object for `SalesTermRef.value`.", type: "string", + propDefinition: [ + quickbooks, + "termIds", + ], }, secondaryTaxIdentifier: { description: "Also called UTR No. in ( UK ) , CST Reg No. ( IN ) also represents the tax registration number of the Person or Organization. This value is masked in responses, exposing only last five characters. For example, the ID of `123-45-6789` is returned as `XXXXXX56789`", @@ -418,21 +352,11 @@ export default { optional: true, type: "string", }, - sparseUpdate: { - description: "When set to `true`, sparse updating provides the ability to update a subset of properties for a given object; only elements specified in the request are updated. Missing elements are left untouched.", - label: "Sparse Update", - type: "string", - }, - syncToken: { - description: "Version number of the object. It is used to lock an object for use by one app at a time. As soon as an application modifies an object, its SyncToken is incremented. Attempts to modify an object specifying an older SyncToken fails. Only the latest version of the object is maintained by QuickBooks Online.", - label: "Sync Token", - type: "string", - }, taxable: { description: "If true, transactions for this customer are taxable. Default behavior with minor version 10 and above: true, if `DefaultTaxCodeRef` is defined or false if `TaxExemptionReasonId` is set.", label: "Taxable", optional: true, - type: "string", + type: "boolean", }, taxExemptionReasonId: { label: "Tax Exemption Reason Id", @@ -463,28 +387,54 @@ export default { optional: true, type: "string", }, - minorVersion: { - propDefinition: [ - quickbooks, - "minorVersion", - ], + }, + methods: { + async getSyncToken($) { + const { Customer: customer } = await this.quickbooks.getCustomer({ + $, + customerId: this.customerId, + }); + return customer.SyncToken; }, }, async run({ $ }) { - //See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#full-update-a-customer - if ( !this.displayName && (!this.title && !this.givenName && !this.middleName && !this.familyName && !this.suffix) || - !this.customerId || !this.syncToken || this.sparseUpdate === undefined + !this.customerId ) { - throw new ConfigurationError("Must provide displayName or at least one of title, givenName, middleName, familyName, or suffix, and customerId, syncToken parameters."); + throw new ConfigurationError("Must provide displayName or at least one of title, givenName, middleName, familyName, or suffix, and customerId parameters."); } + const hasBillingAddress = this.billAddrPostalCode + || this.billAddrCity + || this.billAddrCountry + || this.billAddrLine5 + || this.billAddrLine4 + || this.billAddrLine3 + || this.billAddrLine2 + || this.billAddrLine1 + || this.billAddrLate + || this.billAddrLong + || this.billAddrCountrySubDivisionCode; + + const hasShippingAddress = this.shipAddrId + || this.shipAddrPostalCode + || this.shipAddrCity + || this.shipAddrCountry + || this.shipAddrLine5 + || this.shipAddrLine4 + || this.shipAddrLine3 + || this.shipAddrLine2 + || this.shipAddrLine1 + || this.shipAddrLate + || this.shipAddrLong + || this.shipAddrCountrySubDivisionCode; + const response = await this.quickbooks.updateCustomer({ $, data: { - sparse: this.sparseUpdate, + sparse: true, Id: this.customerId, DisplayName: this.displayName, Suffix: this.suffix, @@ -492,58 +442,49 @@ export default { MiddleName: this.middleName, FamilyName: this.familyName, GivenName: this.givenName, - SyncToken: this.syncToken, - PrimaryEmailAddr: this.primaryEmailAddr, + SyncToken: await this.getSyncToken($), + PrimaryEmailAddr: this.primaryEmailAddr && { + Address: this.primaryEmailAddr, + }, ResaleNum: this.resaleNum, SecondaryTaxIdentifier: this.secondaryTaxIdentifier, - ARAccountRef: { + ARAccountRef: this.arAccountRefValue && { value: this.arAccountRefValue, - name: this.arAccountRefName, }, - DefaultTaxCodeRef: { + DefaultTaxCodeRef: this.defaultTaxCodeValue && { value: this.defaultTaxCodeValue, - name: this.defaultTaxCodeName, }, PreferredDeliveryMethod: this.preferredDeliveryMethod, GSTIN: this.GSTIN, - SalesTermRef: { + SalesTermRef: this.saleTermRefValue && { value: this.saleTermRefValue, - name: this.saleRermRefName, }, - CustomerTypeRef: { - value: this.customerRypeRefValue, + CustomerTypeRef: this.customerTypeRefValue && { + value: this.customerTypeRefValue, }, - Fax: { + Fax: this.faxFreeFormNumber && { FreeFormNumber: this.faxFreeFormNumber, }, BusinessNumber: this.businessNumber, BillWithParent: this.billWithParent, - CurrencyRef: { + CurrencyRef: this.currencyRefValue && { value: this.currencyRefValue, - name: this.currencyRefName, }, - Mobile: { + Mobile: this.mobileFreeFormNumber && { FreeFormNumber: this.mobileFreeFormNumber, }, Job: this.job, - BalanceWithJobs: this.balanceWithJob, - PrimaryPhone: { + PrimaryPhone: this.primaryPhoneFreeFormNumber && { FreeFormNumber: this.primaryPhoneFreeFormNumber, }, - OpenBalanceDate: this.openBalanceDate, Taxable: this.taxable, - AlternatePhone: { + AlternatePhone: this.alternatePhoneFreeFormNumber && { FreeFormNumber: this.alternatePhoneFreeFormNumber, }, - ParentRef: { - value: this.parentRefValue, - name: this.parentRefName, - }, Notes: this.notes, WebAddr: this.webAddr, Active: this.active, - Balance: this.balance, - ShipAddr: { + ShipAddr: hasShippingAddress && { Id: this.shipAddrId, PostalCode: this.shipAddrPostalCode, City: this.shipAddrCity, @@ -557,17 +498,14 @@ export default { Long: this.shipAddrLong, CountrySubDivisionCode: this.shipAddrCountrySubDivisionCode, }, - PaymentMethodRef: { + PaymentMethodRef: this.paymentMethodRefValue && { value: this.paymentMethodRefValue, - name: this.paymentMethodRefName, }, - IsProject: this.isProject, CompanyName: this.companyName, PrimaryTaxIdentifier: this.primaryTaxIdentifier, GSTRegistrationType: this.gstRegistrationType, PrintOnCheckName: this.printOnCheckName, - BillAddr: { - Id: this.billAddrId, + BillAddr: hasBillingAddress && { PostalCode: this.billAddrPostalCode, City: this.billAddrCity, Country: this.billAddrCountry, @@ -582,13 +520,10 @@ export default { }, TaxExemptionReasonId: this.taxExemptionReasonId, }, - params: { - minorversion: this.minorVersion, - }, }); if (response) { - $.export("summary", `Successfully updated customer with id ${this.customerId}`); + $.export("summary", `Successfully updated customer with ID ${this.customerId}`); } return response; diff --git a/components/quickbooks/actions/update-item/update-item.mjs b/components/quickbooks/actions/update-item/update-item.mjs new file mode 100644 index 0000000000000..ad28ecbf8bc10 --- /dev/null +++ b/components/quickbooks/actions/update-item/update-item.mjs @@ -0,0 +1,297 @@ +import quickbooks from "../../quickbooks.app.mjs"; +import { ConfigurationError } from "@pipedream/platform"; + +export default { + key: "quickbooks-update-item", + name: "Update Item", + description: "Updates an item. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#full-update-an-item)", + version: "0.0.1", + type: "action", + props: { + quickbooks, + itemId: { + propDefinition: [ + quickbooks, + "itemId", + ], + }, + name: { + type: "string", + label: "Name", + description: "Name of the item. This value must be unique.", + }, + trackQtyOnHand: { + type: "boolean", + label: "Track Quantity on Hand", + description: "True if there is quantity on hand to be tracked. Once this value is true, it cannot be updated to false. Applicable for items of type `Inventory`. Not applicable for `Service` or `NonInventory` item types.", + optional: true, + }, + qtyOnHand: { + type: "string", + label: "Quantity on Hand", + description: "Current quantity of the `Inventory` items available for sale. Not used for `Service` or `NonInventory` type items. Required for `Inventory` type items.", + optional: true, + }, + incomeAccountRefValue: { + type: "string", + label: "Income Account Ref Value", + description: "Reference to the posting account, that is, the account that records the proceeds from the sale of this item. Must be an account with account type of `Sales of Product Income`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Id` from that object for `IncomeAccountRef.value`. See specifications for the IncomeAccountRef parameters in the [Create an item page](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#create-an-item).", + propDefinition: [ + quickbooks, + "accountIds", + ], + }, + type: { + type: "string", + label: "Type", + description: "Classification that specifies the use of this item. See the description at the top of the [Item entity page](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item) for details about supported item types. See specifications for the type parameter in the [Create an item page](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#create-an-item).", + optional: true, + options: [ + "Inventory", + "Group", + "Service", + "NonInventory", + ], + }, + assetAccountRefValue: { + type: "string", + label: "Asset Account Ref Value", + description: "Required for Inventory item types. Reference to the Inventory Asset account that tracks the current value of the inventory. If the same account is used for all inventory items, the current balance of this account will represent the current total value of the inventory. Must be an account with account type of `Other Current Asset`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Id` from that object for `AssetAccountRef.value`.", + propDefinition: [ + quickbooks, + "accountIds", + ], + }, + invStartDate: { + type: "string", + label: "Inventory Start Date", + description: "Date of opening balance for the inventory transaction. Required when creating an `Item.Type=Inventory`. Required for `Inventory` item types.", + optional: true, + }, + expenseAccountRefValue: { + type: "string", + label: "Expense Account Ref Value", + description: "Reference to the expense account used to pay the vendor for this item. Must be an account with account type of `Cost of Goods Sold`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Id` from that object for `ExpenseAccountRef.value`. See specifications for the ExpenseAccountRef parameters in the [Create an item page](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#create-an-item).", + propDefinition: [ + quickbooks, + "accountIds", + ], + }, + sku: { + type: "string", + label: "Sku", + description: "The stock keeping unit (SKU) for this Item. This is a company-defined identifier for an item or product used in tracking inventory.", + optional: true, + }, + salesTaxIncluded: { + type: "boolean", + label: "Sales Tax Included", + description: "True if the sales tax is included in the item amount, and therefore is not calculated for the transaction.", + optional: true, + }, + salesTaxCodeRefValue: { + label: "Sales Tax Code Ref Value", + description: "ID of the referenced sales tax code for the Sales item. Applicable to Service and Sales item types only. Query the TaxCode name list resource to determine the appropriate TaxCode object for this reference. Use `TaxCode.Id` from that object for `SalesTaxCodeRef.value`.", + propDefinition: [ + quickbooks, + "taxCodeId", + ], + }, + purchaseTaxIncluded: { + type: "boolean", + label: "Purchase Tax Included", + description: "True if the purchase tax is included in the item amount, and therefore is not calculated for the transaction.", + optional: true, + }, + description: { + type: "string", + label: "Description", + description: "Description of the item.", + optional: true, + }, + abatementRate: { + type: "string", + label: "Abatement Rate", + description: "Sales tax abatement rate for India locales.", + optional: true, + }, + reverseChargeRate: { + type: "string", + label: "Reverse Charge Rate", + description: "Sales tax reverse charge rate for India locales.", + optional: true, + }, + subItem: { + type: "boolean", + label: "Sub Item", + description: "If true, this is a sub item. If false or null, this is a top-level item. Creating inventory hierarchies with traditional inventory items is being phased out in lieu of using categories and sub categories.", + optional: true, + }, + taxable: { + type: "boolean", + label: "Taxable", + description: "If true, transactions for this item are taxable. Applicable to US companies, only.", + optional: true, + }, + UqcDisplayText: { + type: "string", + label: "UQC Display Text", + description: "Text to be displayed on customer's invoice to denote the Unit of Measure (instead of the standard code).", + optional: true, + }, + reorderPoint: { + type: "string", + label: "Reorder Point", + description: "The minimum quantity of a particular inventory item that you need to restock at any given time. The ReorderPoint value cannot be set to null for sparse updates(sparse=true). It can be set to null only for full updates.", + optional: true, + }, + purchaseDesc: { + type: "string", + label: "Purchase Description", + description: "Purchase description for the item.", + optional: true, + }, + prefVendorRefValue: { + type: "string", + label: "Pref Vendor Ref Value", + description: "Pref vendor ref value", + propDefinition: [ + quickbooks, + "vendorIds", + ], + }, + active: { + type: "boolean", + label: "Active", + description: "If true, the object is currently enabled for use by QuickBooks.", + optional: true, + }, + UqcId: { + type: "string", + label: "UQC ID", + description: "ID of Standard Unit of Measure (UQC:Unique Quantity Code) of the item according to GST rule.", + optional: true, + }, + purchaseTaxCodeRefValue: { + label: "Purchase Tax Code Ref Value", + description: "The ID for the referenced purchase tax code object as found in the Id field of the object payload. \n\nReference to the purchase tax code for the item. Applicable to Service, Other Charge, and Product (Non-Inventory) item types. Query the TaxCode name list resource to determine the appropriate TaxCode object for this reference. Use `TaxCode.Id` from that object for `PurchaseTaxCodeRef.value`.", + propDefinition: [ + quickbooks, + "taxCodeId", + ], + }, + serviceType: { + type: "string", + label: "Service Type", + description: "Sales tax service type for India locales.", + optional: true, + }, + purchaseCost: { + type: "string", + label: "Purchase Cost", + description: "Amount paid when buying or ordering the item, as expressed in the home currency.", + optional: true, + }, + unitPrice: { + type: "string", + label: "Unit Price", + description: "Corresponds to the Price/Rate column on the QuickBooks Online UI to specify either unit price, a discount, or a tax rate for item. If used for unit price, the monetary value of the service or product, as expressed in the home currency. If used for a discount or tax rate, express the percentage as a fraction. For example, specify `0.4` for 40% tax", + optional: true, + }, + taxClassificationRefValue: { + description: "The ID for the referenced Tax classification object as found in the Id field of the object payload.\n\nTax classification segregates different items into different classifications and the tax classification is one of the key parameters to determine appropriate tax on transactions involving items. Tax classifications are sourced by either tax governing authorities as in India/Malaysia or externally like Exactor. 'Fuel', 'Garments' and 'Soft drinks' are a few examples of tax classification in layman terms. User can choose a specific tax classification for an item while creating it. A level 1 tax classification cannot be associated to an Item", + propDefinition: [ + quickbooks, + "taxClassificationId", + ], + }, + parentRefValue: { + label: "Parent Ref Value", + description: "The ID for the referenced parent item object as found in the Id field of the object payload. \n\nThe immediate parent of the sub item in the hierarchical Category:Sub-category list. If SubItem is true, then ParenRef is required. Query the Item name list resource to determine the appropriate object for this reference. Use `Item.Id` from that object for `ParentRef.value`.", + optional: true, + propDefinition: [ + quickbooks, + "itemId", + ], + }, + }, + methods: { + async getSyncToken($) { + const { Item: item } = await this.quickbooks.getItem({ + $, + itemId: this.itemId, + }); + return item.SyncToken; + }, + }, + async run({ $ }) { + if (!this.itemId || !this.name) { + throw new ConfigurationError("Must provide itemId and name parameters."); + } + + const data = { + sparse: true, + Id: this.itemId, + Name: this.name, + QtyOnHand: this.qtyOnHand, + SyncToken: await this.getSyncToken($), + IncomeAccountRef: this.incomeAccountRefValue && { + value: this.incomeAccountRefValue, + }, + Type: this.type, + AssetAccountRef: this.assetAccountRefValue && { + value: this.assetAccountRefValue, + }, + InvStartDate: this.invStartDate, + ExpenseAccountRef: this.expenseAccountRefValue && { + value: this.expenseAccountRefValue, + }, + Sku: this.sku, + SalesTaxIncluded: this.salesTaxIncluded, + TrackQtyOnHand: this.trackQtyOnHand, + SalesTaxCodeRef: this.salesTaxCodeRefValue && { + value: this.salesTaxCodeRefValue, + }, + PurchaseTaxIncluded: this.purchaseTaxIncluded, + Description: this.description, + AbatementRate: this.abatementRate, + ReverseChargeRate: this.reverseChargeRate, + SubItem: this.subItem, + Taxable: this.taxable, + UQCDisplayText: this.UqcDisplayText, + ReorderPoint: this.reorderPoint, + PurchaseDesc: this.purchaseDesc, + PrefVendorRef: this.prefVendorRefValue && { + value: this.prefVendorRefValue, + }, + Active: this.active, + UQCId: this.UqcId, + PurchaseTaxCodeRef: this.purchaseTaxCodeRefValue && { + value: this.purchaseTaxCodeRefValue, + }, + ServiceType: this.serviceType, + PurchaseCost: this.purchaseCost, + UnitPrice: this.unitPrice, + TaxClassificationRef: this.taxClassificationRefValue && { + value: this.taxClassificationRefValue, + }, + }; + + if (this.parentRefValue || this.parentRefName) { + data["ParentRef"] = { + value: this.parentRefValue, + }; + } + + const response = await this.quickbooks.updateItem({ + $, + data, + }); + + if (response) { + $.export("summary", `Successfully updated item with ID ${this.itemId}`); + } + + return response; + }, +}; diff --git a/components/quickbooks/common/utils.mjs b/components/quickbooks/common/utils.mjs index c763da9d89e79..fb0d909f06b08 100644 --- a/components/quickbooks/common/utils.mjs +++ b/components/quickbooks/common/utils.mjs @@ -2,6 +2,7 @@ import { MAX_RETRIES, INITIAL_BACKOFF_MILLISECONDS, } from "./constants.mjs"; +import { ConfigurationError } from "@pipedream/platform"; export const parseOne = (obj) => { let parsed; @@ -27,3 +28,19 @@ export async function retryWithExponentialBackoff( throw error; } } + +export function parseLineItems(arr) { + if (!arr) { + return undefined; + } + try { + if (typeof arr === "string") { + return JSON.parse(arr); + } + return arr.map((lineItem) => typeof lineItem === "string" + ? JSON.parse(lineItem) + : lineItem); + } catch (error) { + throw new ConfigurationError(`We got an error trying to parse the LineItems. Error: ${error}`); + } +} diff --git a/components/quickbooks/package.json b/components/quickbooks/package.json index 20ca1373bdcc8..29c6ffff7652d 100644 --- a/components/quickbooks/package.json +++ b/components/quickbooks/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/quickbooks", - "version": "0.4.0", + "version": "0.5.0", "description": "Pipedream Quickbooks Components", "main": "quickbooks.app.mjs", "keywords": [ diff --git a/components/quickbooks/quickbooks.app.mjs b/components/quickbooks/quickbooks.app.mjs index 9f5c38b071291..3ee699c2a1c72 100644 --- a/components/quickbooks/quickbooks.app.mjs +++ b/components/quickbooks/quickbooks.app.mjs @@ -9,109 +9,358 @@ export default { invoiceId: { label: "Invoice ID", type: "string", - description: "Id of the invoice to get details of.", + description: "Id of the invoice to get details of", async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Invoice: records } } = await this.query({ - params: { - query: `select * from invoice maxresults 10${page - ? `startposition ${position}` - : ""} `, - }, + return this.getPropOptions({ + page, + resource: "Invoice", + mapper: ({ + Id: value, DocNumber: docNumber, CustomerRef: customerRef, + }) => ({ + label: `(${docNumber}) ${customerRef.name}`, + value, + }), }); - - return records?.map(({ - Id: value, DocNumber: docNumber, CustomerRef: customerRef, - }) => ({ - label: `(${docNumber}) ${customerRef.name}`, - value, - })) || []; }, }, - minorVersion: { - label: "Minor Version", - type: "string", - description: "Use the `minorversion` query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - lineItems: { - label: "Line Items", - type: "string[]", - description: "Individual line items of a transaction. Valid Line types include: `ItemBasedExpenseLine` and `AccountBasedExpenseLine`. One minimum line item required for the request to succeed. E.g `[ { \"DetailType\": \"AccountBasedExpenseLineDetail\", \"Amount\": 100.0, \"AccountBasedExpenseLineDetail\": { \"AccountRef\": { \"name\": \"Meals and Entertainment\", \"value\": \"10\" } } } ]`", - }, customer: { label: "Customer Reference", type: "string", - description: "Reference to a customer or job. Query the Customer name list resource to determine the appropriate Customer object for this reference.", + description: "Reference to a customer or job", async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Customer: records } } = await this.query({ - params: { - query: `select * from Customer maxresults 10${page - ? `startposition ${position}` - : ""} `, - }, + return this.getPropOptions({ + page, + resource: "Customer", + mapper: ({ + Id: id, DisplayName: label, + }) => ({ + label, + value: id, + }), }); - - return records?.map(({ - Id: id, DisplayName: label, - }) => ({ - label, - value: JSON.stringify({ + }, + }, + customerType: { + label: "Customer Type", + type: "string", + description: "ID referencing the customer type assigned to a customer", + optional: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "CustomerType", + mapper: ({ + Id: id, Name: label, + }) => ({ + label, value: id, - name: label, }), - })) || []; + }); }, }, - customerRefName: { - label: "Customer Reference Name", + paymentMethod: { + label: "Payment Method", type: "string", - description: "Reference to a customer or job. Query the Customer name list resource to determine the appropriate Customer object for this reference. Use `Customer.DisplayName ` from that object for `CustomerRef.name`.", + description: "ID referencing a PaymentMethod object associated with this Customer object", optional: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Payment Method", + mapper: ({ + Id: id, Name: label, + }) => ({ + label, + value: id, + }), + }); + }, }, currency: { - label: "Currency Reference", + label: "Currency Code", type: "string", - description: "This must be defined if multicurrency is enabled for the company.\nMulticurrency is enabled for the company if `Preferences.MultiCurrencyEnabled` is set to `true`. Read more about multicurrency support [here](https://developer.intuit.com/docs?RedirectID=MultCurrencies). Required if multicurrency is enabled for the company.", + description: "A three letter string representing the ISO 4217 code for the currency. For example, `USD`, `AUD`, `EUR`, and so on. This must be defined if multicurrency is enabled for the company.\nMulticurrency is enabled for the company if `Preferences.MultiCurrencyEnabled` is set to `true`. Read more about multicurrency support [here](https://developer.intuit.com/docs?RedirectID=MultCurrencies). Required if multicurrency is enabled for the company.", optional: true, + default: "USD", async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { CompanyCurrency: records } } = await this.query({ - params: { - query: `select * from companycurrency maxresults 10${page - ? `startposition ${position}` - : ""} `, - }, - }); - - return records?.map(({ - Code: code, Name: name, - }) => ({ - label: `${code} - ${name}`, - value: JSON.stringify({ - value: code, - name: name, + return this.getPropOptions({ + page, + resource: "CompanyCurrency", + mapper: ({ + Code: code, Name: name, + }) => ({ + label: `${code} - ${name}`, + value: JSON.stringify({ + value: code, + name: name, + }), }), - })) || []; + }); }, }, - currencyRefValue: { - label: "Currency Reference Value", + purchaseId: { + label: "Purchase ID", type: "string", - description: "A three letter string representing the ISO 4217 code for the currency. For example, `USD`, `AUD`, `EUR`, and so on. This must be defined if multicurrency is enabled for the company.\nMulticurrency is enabled for the company if `Preferences.MultiCurrencyEnabled` is set to `true`. Read more about multicurrency support [here](https://developer.intuit.com/docs?RedirectID=MultCurrencies). Required if multicurrency is enabled for the company.", + description: "ID of the purchase.", + withLabel: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Purchase", + mapper: ({ + Id, PaymentType, TxnDate, + }) => ({ + label: `${Id} - ${PaymentType} - ${TxnDate}`, + value: Id, + }), + }); + }, + }, + termIds: { + type: "string[]", + label: "Term IDs", + description: "Filters report contents based on term or terms supplied", optional: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Term", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, + }, + vendorIds: { + type: "string[]", + label: "Vendor IDs", + description: "Filters report contents to include information for specified vendors", + optional: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Vendor", + mapper: ({ + Id: value, DisplayName: label, + }) => ({ + value, + label, + }), + }); + }, + }, + accountIds: { + type: "string[]", + label: "Account IDs", + description: "Filters report contents to include information for specified accounts", + optional: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Account", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, + }, + classIds: { + type: "string[]", + label: "Class IDs", + description: "Filters report contents to include information for specified classes if so configured in the company file", + optional: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Class", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, + }, + employeeIds: { + type: "string[]", + label: "Employee IDs", + description: "Filters report contents to include information for specified employees", + optional: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Employee", + mapper: ({ + Id: value, DisplayName: label, + }) => ({ + value, + label, + }), + }); + }, + }, + departmentIds: { + type: "string[]", + label: "Department IDs", + description: "Filters report contents to include information for specified departments if so configured in the company file", + optional: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Department", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, + }, + itemId: { + type: "string", + label: "Item ID", + description: "The identifier of an item", + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Item", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, + }, + billId: { + type: "string", + label: "Bill ID", + description: "The identifier of a bill", + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Bill", + mapper: ({ Id: id }) => id, + }); + }, + }, + purchaseOrderId: { + type: "string", + label: "Purchase Order ID", + description: "The identifier of a purchase order", + async options({ page }) { + return this.getPropOptions({ + page, + resource: "PurchaseOrder", + mapper: ({ + Id: value, DocNumber, + }) => ({ + value, + label: DocNumber ?? value, + }), + }); + }, + }, + salesReceiptId: { + type: "string", + label: "Sales Receipt ID", + description: "The identifier of a sales receipt", + async options({ page }) { + return this.getPropOptions({ + page, + resource: "SalesReceipt", + mapper: ({ + Id: value, DocNumber, + }) => ({ + value, + label: DocNumber ?? value, + }), + }); + }, + }, + timeActivityId: { + type: "string", + label: "Time Activity ID", + description: "The identifier of a time activity", + async options({ page }) { + return this.getPropOptions({ + page, + resource: "TimeActivity", + mapper: ({ + Id: value, NameOf: nameOf, Description: description, + }) => ({ + value, + label: `${nameOf} ${description}`, + }), + }); + }, }, - currencyRefName: { - label: "Currency Reference Name", + paymentId: { type: "string", - description: "The full name of the currency.", + label: "Payment ID", + description: "The identifier of a payment", + async options({ page }) { + return this.getPropOptions({ + page, + resource: "Payment", + mapper: ({ + Id: value, CustomerRef: customerRef, TotalAmt: totalAmt, TxnDate: txnDate, + }) => ({ + value, + label: `${customerRef.name} - Amount: ${totalAmt} - ${txnDate}`, + }), + }); + }, + }, + taxCodeId: { + type: "string", + label: "Tax Code ID", + description: "The identifier of a tax code", optional: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "TaxCode", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), + }); + }, }, - includeClause: { - description: "Fields to use in the select clause of the data query. See query language syntax, limitations, and other specifications on [Data queries](https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries)", - label: "Include Clause", + taxClassificationId: { type: "string", + label: "Tax Classification ID", + description: "The identifier of a tax classification", + optional: true, + async options({ page }) { + return this.getPropOptions({ + page, + resource: "TaxClassification", + mapper: ({ + id: value, name: label, + }) => ({ + value, + label, + }), + }); + }, + }, + lineItemsAsObjects: { + type: "boolean", + label: "Enter Line Items as Objects", + description: "Enter line items as an array of objects", }, maxResults: { description: "The number of entity elements in the response.", @@ -166,29 +415,6 @@ export default { description: "Family name or the last name of the person. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, or `Suffix` attributes is required for object create.", optional: true, }, - purchaseId: { - label: "purchase Id", - type: "string", - description: "Id of the purchase.", - withLabel: true, - async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Purchase: records } } = await this.query({ - params: { - query: `select * from Purchase maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, - }); - - return records?.map(({ - Id, PaymentType, SyncToken, - }) => ({ - label: `${Id} - ${PaymentType}`, - value: `${Id}|${SyncToken}`, - })) || []; - }, - }, suffix: { label: "Suffix", type: "string", @@ -211,138 +437,6 @@ export default { description: "Column types to be shown in the report", optional: true, }, - termIds: { - type: "string[]", - label: "Term Ids", - description: "Filters report contents based on term or terms supplied", - optional: true, - async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Term: terms } } = await this.query({ - params: { - query: `select * from term maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, - }); - return terms?.map(({ - Id: value, Name: label, - }) => ({ - value, - label, - })) || []; - }, - }, - vendorIds: { - type: "string[]", - label: "Vendor Ids", - description: "Filters report contents to include information for specified vendors", - optional: true, - async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Vendor: vendors } } = await this.query({ - params: { - query: `select * from vendor maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, - }); - return vendors?.map(({ - Id: value, DisplayName: label, - }) => ({ - value, - label, - })) || []; - }, - }, - accountIds: { - type: "string[]", - label: "Account Ids", - description: "Filters report contents to include information for specified accounts", - optional: true, - async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Account: accounts } } = await this.query({ - params: { - query: `select * from account maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, - }); - return accounts?.map(({ - Id: value, Name: label, - }) => ({ - value, - label, - })) || []; - }, - }, - classIds: { - type: "string[]", - label: "Class Ids", - description: "Filters report contents to include information for specified classes if so configured in the company file", - optional: true, - async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Class: classes } } = await this.query({ - params: { - query: `select * from class maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, - }); - return classes?.map(({ - Id: value, Name: label, - }) => ({ - value, - label, - })) || []; - }, - }, - employeeIds: { - type: "string[]", - label: "Employee Ids", - description: "Filters report contents to include information for specified employees", - optional: true, - async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Employee: employees } } = await this.query({ - params: { - query: `select * from employee maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, - }); - return employees?.map(({ - Id: value, DisplayName: label, - }) => ({ - value, - label, - })) || []; - }, - }, - departmentIds: { - type: "string[]", - label: "Department Ids", - description: "Filters report contents to include information for specified departments if so configured in the company file", - optional: true, - async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Department: departments } } = await this.query({ - params: { - query: `select * from department maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, - }); - return departments?.map(({ - Id: value, Name: label, - }) => ({ - value, - label, - })) || []; - }, - }, }, methods: { _companyId() { @@ -354,7 +448,11 @@ export default { _apiUrl() { return "https://quickbooks.api.intuit.com/v3"; }, - async _makeRequest(path, options = {}, $ = this) { + async _makeRequest({ + $ = this, + path, + ...opts + }) { const requestFn = async () => { return await axios($, { url: `${this._apiUrl()}/${path}`, @@ -362,159 +460,196 @@ export default { Authorization: `Bearer ${this._accessToken()}`, accept: "application/json", }, - ...options, + ...opts, }); }; return await retryWithExponentialBackoff(requestFn); }, - async createPayment({ - $, data, + async getPropOptions({ + page = 0, resource, mapper, }) { - return this._makeRequest(`company/${this._companyId()}/payment`, { + const position = 1 + (page * 10); + const { QueryResponse: queryResponse } = await this.query({ + params: { + query: `select * from ${resource} maxresults 10${page + ? `startposition ${position}` + : ""} `, + }, + }); + const items = queryResponse[resource]; + return items?.map(mapper) || []; + }, + createPayment(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/payment`, method: "post", - data, - }, $); + ...opts, + }); }, - async createBill({ - $, data, params, - }) { - return this._makeRequest(`company/${this._companyId()}/bill`, { + createBill(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/bill`, method: "post", - data, - params, - }, $); + ...opts, + }); }, - async createCustomer({ - $, data, params, - }) { - return this._makeRequest(`company/${this._companyId()}/customer`, { + createCustomer(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/customer`, method: "post", - data, - params, - }, $); + ...opts, + }); }, - createPurchase({ - $, ...args - }) { - return this._makeRequest(`company/${this._companyId()}/purchase`, { - method: "POST", - ...args, - }, $); + createPurchase(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/purchase`, + method: "post", + ...opts, + }); }, - async createInvoice({ - $, data, params, - }) { - return this._makeRequest(`company/${this._companyId()}/invoice`, { + createInvoice(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/invoice`, method: "post", - data, - params, - }, $); + ...opts, + }); }, - async deletePurchase({ - $, ...args - }) { - return this._makeRequest(`company/${this._companyId()}/purchase`, { - method: "POST", - ...args, - }, $); + createSalesReceipt(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/salesreceipt`, + method: "post", + ...opts, + }); }, - async sparseUpdateInvoice({ - $, data, params, - }) { - return this._makeRequest(`company/${this._companyId()}/invoice`, { + deletePurchase(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/purchase`, method: "post", - data, - params, - }, $); + ...opts, + }); }, - async getBill({ - $, billId, params, - }) { - return this._makeRequest(`company/${this._companyId()}/bill/${billId}`, { - params, - }, $); + sparseUpdateInvoice(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/invoice`, + method: "post", + ...opts, + }); }, - async getCustomer({ - $, customerId, params, + getBill({ + billId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/customer/${customerId}`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/bill/${billId}`, + ...opts, + }); }, - async getInvoice({ - $, invoiceId, params, + getCustomer({ + customerId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/invoice/${invoiceId}`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/customer/${customerId}`, + ...opts, + }); }, - async getInvoices({ - $, params, + getInvoice({ + invoiceId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/query`, { - params, - }, $); - }, - async getMyCompany({ $ } = {}) { - return this._makeRequest(`company/${this._companyId()}/companyinfo/${this._companyId()}`, {}, $); - }, - async getPurchase({ - $, purchaseId, params, + return this._makeRequest({ + path: `company/${this._companyId()}/invoice/${invoiceId}`, + ...opts, + }); + }, + getInvoices(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/query`, + ...opts, + }); + }, + getMyCompany(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/companyinfo/${this._companyId()}`, + ...opts, + }); + }, + getPurchase({ + purchaseId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/purchase/${purchaseId}`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/purchase/${purchaseId}`, + ...opts, + }); }, - async getPurchaseOrder({ - $, purchaseOrderId, params, + getPurchaseOrder({ + purchaseOrderId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/purchaseorder/${purchaseOrderId}`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/purchaseorder/${purchaseOrderId}`, + ...opts, + }); }, - async getSalesReceipt({ - $, salesReceiptId, params, + getSalesReceipt({ + salesReceiptId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/salesreceipt/${salesReceiptId}`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/salesreceipt/${salesReceiptId}`, + ...opts, + }); }, - async getTimeActivity({ - $, timeActivityId, params, + getTimeActivity({ + timeActivityId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/timeactivity/${timeActivityId}`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/timeactivity/${timeActivityId}`, + ...opts, + }); }, - async query({ - $, params, + getPayment({ + paymentId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/query`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/payment/${paymentId}`, + ...opts, + }); }, - async updateCustomer({ - $, data, params, + getItem({ + itemId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/customer`, { + return this._makeRequest({ + path: `company/${this._companyId()}/item/${itemId}`, + ...opts, + }); + }, + query(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/query`, + ...opts, + }); + }, + updateCustomer(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/customer`, method: "post", - data, - params, - }, $); - }, - getApAgingReport({ - $, params, - }) { - return this._makeRequest(`company/${this._companyId()}/reports/AgedPayableDetail`, { - params, - }, $); + ...opts, + }); }, - getProfitLossReport({ - $, params, - }) { - return this._makeRequest(`company/${this._companyId()}/reports/ProfitAndLoss`, { - params, - }, $); + updateItem(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/item`, + method: "post", + ...opts, + }); + }, + getApAgingReport(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/reports/AgedPayableDetail`, + ...opts, + }); + }, + getProfitLossReport(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/reports/ProfitAndLoss`, + ...opts, + }); }, async *paginate({ fn, params = {}, fieldList, query, maxResults = null, ...opts diff --git a/components/quickbooks/sources/common/base.mjs b/components/quickbooks/sources/common/base.mjs index 394ec76386496..4e1eec220dfbe 100644 --- a/components/quickbooks/sources/common/base.mjs +++ b/components/quickbooks/sources/common/base.mjs @@ -47,6 +47,18 @@ export default { }); } }, + getFieldDate() { + return "CreateTime"; + }, + getQuery() { + throw new Error("getQuery is not implemented"); + }, + getFieldList() { + throw new Error("getFieldList is not implemented"); + }, + getSummary() { + throw new Error("getSummary is not implemented"); + }, }, hooks: { async deploy() { diff --git a/components/quickbooks/sources/new-customer-created/new-customer-created.mjs b/components/quickbooks/sources/new-customer-created/new-customer-created.mjs index 1e4d533c14d38..3a7fbc0afbc8c 100644 --- a/components/quickbooks/sources/new-customer-created/new-customer-created.mjs +++ b/components/quickbooks/sources/new-customer-created/new-customer-created.mjs @@ -6,7 +6,7 @@ export default { key: "quickbooks-new-customer-created", name: "New Customer Created", description: "Emit new event when a new customer is created.", - version: "0.0.3", + version: "0.0.4", type: "source", dedupe: "unique", methods: { @@ -17,11 +17,8 @@ export default { getFieldList() { return "Customer"; }, - getFieldDate() { - return "CreateTime"; - }, getSummary(item) { - return `New Customer: ${item.Id}`; + return `New Customer: ${item.DisplayName}`; }, }, sampleEmit, diff --git a/components/quickbooks/sources/new-customer-updated/new-customer-updated.mjs b/components/quickbooks/sources/new-customer-updated/new-customer-updated.mjs index 9525dbdd22ca2..48c8ccb2455f1 100644 --- a/components/quickbooks/sources/new-customer-updated/new-customer-updated.mjs +++ b/components/quickbooks/sources/new-customer-updated/new-customer-updated.mjs @@ -6,7 +6,7 @@ export default { key: "quickbooks-new-customer-updated", name: "New Customer Updated", description: "Emit new event when a customer is updated.", - version: "0.0.3", + version: "0.0.4", type: "source", dedupe: "unique", methods: { @@ -21,7 +21,7 @@ export default { return "LastUpdatedTime"; }, getSummary(item) { - return `New Customer Updated: ${item.Id}`; + return `New Customer Updated: ${item.DisplayName}`; }, }, sampleEmit, diff --git a/components/quickbooks/sources/new-employee-created/new-employee-created.mjs b/components/quickbooks/sources/new-employee-created/new-employee-created.mjs index 5e919de6c754c..5c31af1d76ddb 100644 --- a/components/quickbooks/sources/new-employee-created/new-employee-created.mjs +++ b/components/quickbooks/sources/new-employee-created/new-employee-created.mjs @@ -6,7 +6,7 @@ export default { key: "quickbooks-new-employee-created", name: "New Employee Created", description: "Emit new event when a new employee is created.", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/components/quickbooks/sources/new-employee-updated/new-employee-updated.mjs b/components/quickbooks/sources/new-employee-updated/new-employee-updated.mjs index 717840c9e022f..85565a3d86430 100644 --- a/components/quickbooks/sources/new-employee-updated/new-employee-updated.mjs +++ b/components/quickbooks/sources/new-employee-updated/new-employee-updated.mjs @@ -6,7 +6,7 @@ export default { key: "quickbooks-new-employee-updated", name: "New Employee Updated", description: "Emit new event when an employee is updated.", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/components/quickbooks/sources/new-invoice-created/new-invoice-created.mjs b/components/quickbooks/sources/new-invoice-created/new-invoice-created.mjs index b59049a23143b..10f85fcfd6882 100644 --- a/components/quickbooks/sources/new-invoice-created/new-invoice-created.mjs +++ b/components/quickbooks/sources/new-invoice-created/new-invoice-created.mjs @@ -6,7 +6,7 @@ export default { key: "quickbooks-new-invoice-created", name: "New Invoice Created", description: "Emit new event when a new invoice is created.", - version: "0.0.3", + version: "0.0.4", type: "source", dedupe: "unique", methods: { @@ -17,9 +17,6 @@ export default { getFieldList() { return "Invoice"; }, - getFieldDate() { - return "CreateTime"; - }, getSummary(item) { return `New Invoice: ${item.Id}`; }, diff --git a/components/quickbooks/sources/new-invoice-updated/new-invoice-updated.mjs b/components/quickbooks/sources/new-invoice-updated/new-invoice-updated.mjs index f9d2f68c20417..a72b770e9c70a 100644 --- a/components/quickbooks/sources/new-invoice-updated/new-invoice-updated.mjs +++ b/components/quickbooks/sources/new-invoice-updated/new-invoice-updated.mjs @@ -6,7 +6,7 @@ export default { key: "quickbooks-new-invoice-updated", name: "New Invoice Updated", description: "Emit new event when an invoice is updated.", - version: "0.0.3", + version: "0.0.4", type: "source", dedupe: "unique", methods: { diff --git a/components/quickbooks/sources/new-item-created/new-item-created.mjs b/components/quickbooks/sources/new-item-created/new-item-created.mjs index e0f890385281e..eb78a15a6d7b5 100644 --- a/components/quickbooks/sources/new-item-created/new-item-created.mjs +++ b/components/quickbooks/sources/new-item-created/new-item-created.mjs @@ -6,7 +6,7 @@ export default { key: "quickbooks-new-item-created", name: "New Item Created", description: "Emit new event when a new item is created.", - version: "0.0.3", + version: "0.0.4", type: "source", dedupe: "unique", methods: { @@ -17,9 +17,6 @@ export default { getFieldList() { return "Item"; }, - getFieldDate() { - return "CreateTime"; - }, getSummary(item) { return `New Item: ${item.Id}`; }, diff --git a/components/quickbooks/sources/new-item-updated/new-item-updated.mjs b/components/quickbooks/sources/new-item-updated/new-item-updated.mjs index 02a64206cb400..6aa670c1e1efe 100644 --- a/components/quickbooks/sources/new-item-updated/new-item-updated.mjs +++ b/components/quickbooks/sources/new-item-updated/new-item-updated.mjs @@ -6,7 +6,7 @@ export default { key: "quickbooks-new-item-updated", name: "New Item Updated", description: "Emit new event when an item is updated.", - version: "0.0.3", + version: "0.0.4", type: "source", dedupe: "unique", methods: { diff --git a/components/quickbooks_sandbox/actions/create-ap-aging-report/create-ap-aging-report.mjs b/components/quickbooks_sandbox/actions/create-ap-aging-report/create-ap-aging-report.mjs new file mode 100644 index 0000000000000..6f5de002f4a93 --- /dev/null +++ b/components/quickbooks_sandbox/actions/create-ap-aging-report/create-ap-aging-report.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/create-ap-aging-report/create-ap-aging-report.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-create-ap-aging-report", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/create-bill/create-bill.mjs b/components/quickbooks_sandbox/actions/create-bill/create-bill.mjs new file mode 100644 index 0000000000000..278dc219fd4b3 --- /dev/null +++ b/components/quickbooks_sandbox/actions/create-bill/create-bill.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/create-bill/create-bill.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-create-bill", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/create-customer/create-customer.mjs b/components/quickbooks_sandbox/actions/create-customer/create-customer.mjs index 4779837b795b2..2b7db24c57ba2 100644 --- a/components/quickbooks_sandbox/actions/create-customer/create-customer.mjs +++ b/components/quickbooks_sandbox/actions/create-customer/create-customer.mjs @@ -1,79 +1,22 @@ -// legacy_hash_id: a_EVi7zr -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/create-customer/create-customer.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-create-customer", - name: "Create Customer", - description: "Creates a customer.", - version: "0.1.1", - type: "action", + version: "0.1.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - display_name: { - type: "string", - description: "The name of the person or organization as displayed. Must be unique across all Customer, Vendor, and Employee objects. Cannot be removed with sparse update. If not supplied, the system generates DisplayName by concatenating customer name components supplied in the request from the following list: `Title`, `GivenName`, `MiddleName`, `FamilyName`, and `Suffix`.", - optional: true, - }, - title: { - type: "string", - description: "Title of the person. This tag supports i18n, all locales. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, `Suffix`, or `FullyQualifiedName` attributes are required during create.", - optional: true, - }, - given_name: { - type: "string", - description: "Given name or first name of a person. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, or `Suffix` attributes is required for object create.", - optional: true, - }, - middle_name: { - type: "string", - description: "Middle name of the person. The person can have zero or more middle names. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, or `Suffix` attributes is required for object create.", - optional: true, - }, - family_name: { - type: "string", - description: "Family name or the last name of the person. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, or `Suffix` attributes is required for object create.", - optional: true, - }, - suffix: { - type: "string", - description: "Suffix of the name. For example, `Jr`. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, or `Suffix` attributes is required for object create.", - optional: true, - }, - minorversion: { - type: "string", - description: "Use the minorversion query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - //See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#create-a-customer - - if (!this.display_name && (!this.title && !this.given_name && !this.middle_name && !this.family_name && !this.suffix)) { - throw new Error("Must provide display_name or at least one of title, given_name, middle_name, family_name, or suffix parameters."); - } - - return await axios($, { - method: "post", - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/customer`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "accept": "application/json", - "content-type": "application/json", - }, - data: { - DisplayName: this.display_name, - Suffix: this.suffix, - Title: this.title, - MiddleName: this.middle_name, - FamilyName: this.family_name, - GivenName: this.given_name, - }, - params: { - minorversion: this.minorversion, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/actions/create-invoice/create-invoice.mjs b/components/quickbooks_sandbox/actions/create-invoice/create-invoice.mjs index 8cb1799149c6c..dc3bf7e98cb1a 100644 --- a/components/quickbooks_sandbox/actions/create-invoice/create-invoice.mjs +++ b/components/quickbooks_sandbox/actions/create-invoice/create-invoice.mjs @@ -1,75 +1,22 @@ -// legacy_hash_id: a_gniWe7 -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/create-invoice/create-invoice.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-create-invoice", - name: "Create Invoice", - description: "Creates an invoice.", - version: "0.1.1", - type: "action", + version: "0.1.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - line_items: { - type: "any", - description: "The minimum line item required for the request is one of the following: \n* `SalesItemLine` type\n* `GroupLine` type\nand Inline subtotal using `DescriptionOnlyLine`", - }, - customer_ref_value: { - type: "string", - description: "Reference to a customer or job. Query the Customer name list resource to determine the appropriate Customer object for this reference. Use `Customer.Id` from that object for `CustomerRef.value`.", - }, - customer_ref_name: { - type: "string", - description: "Reference to a customer or job. Query the Customer name list resource to determine the appropriate Customer object for this reference. Use `Customer.DisplayName ` from that object for `CustomerRef.name`.", - optional: true, - }, - currency_ref_value: { - type: "string", - description: "A three letter string representing the ISO 4217 code for the currency. For example, `USD`, `AUD`, `EUR`, and so on. This must be defined if multicurrency is enabled for the company.\nMulticurrency is enabled for the company if `Preferences.MultiCurrencyEnabled` is set to `true`. Read more about multicurrency support [here](https://developer.intuit.com/docs?RedirectID=MultCurrencies). Required if multicurrency is enabled for the company.", - optional: true, - }, - currency_ref_name: { - type: "object", - description: "The full name of the currency.", - optional: true, - }, - minorversion: { - type: "string", - description: "Use the minorversion query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - // See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#create-an-invoice - - if (!this.line_items || !this.customer_ref_value) { - throw new Error("Must provide line_items, and customer_ref_value parameters."); - } - - return await axios($, { - method: "post", - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/invoice`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "accept": "application/json", - "content-type": "application/json", - }, - data: { - Line: this.line_items, - CustomerRef: { - value: this.customer_ref_value, - name: this.customer_ref_name, - }, - CurrencyRef: { - value: this.currency_ref_value, - name: this.currency_ref_name, - }, - }, - params: { - minorversion: this.minorversion, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/actions/create-payment/create-payment.mjs b/components/quickbooks_sandbox/actions/create-payment/create-payment.mjs index 0f646fd99888c..9c3438cbe3f7d 100644 --- a/components/quickbooks_sandbox/actions/create-payment/create-payment.mjs +++ b/components/quickbooks_sandbox/actions/create-payment/create-payment.mjs @@ -1,121 +1,22 @@ -// legacy_hash_id: a_l0i8d0 -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/create-payment/create-payment.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-create-payment", - name: "Create Bill Payment", - description: "Creates a bill payment.", - version: "0.1.1", - type: "action", + version: "0.1.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - total_amt: { - type: "string", - description: "Indicates the total amount of the associated with this payment. This includes the total of all the payments from the BillPayment Details.", - }, - vendor_ref_value: { - type: "string", - description: "The id of the vendor reference for this transaction.", - }, - line: { - type: "any", - description: "Individual line items representing zero or more `Bill`, `VendorCredit`, and `JournalEntry` objects linked to this BillPayment object.. Valid Line type for create: `LinkedTxnLine`.", - }, - pay_type: { - type: "string", - description: "The payment type. Valid values include: `Check`, `CreditCard`", - options: [ - "Check", - "CreditCard", - ], - }, - vendor_ref_name: { - type: "string", - description: "The name of the vendor reference for this transaction.", - optional: true, - }, - currency_ref_value: { - type: "string", - description: "A three letter string representing the ISO 4217 code for the currency. For example, `USD`, `AUD`, `EUR`, and so on. This must be defined if multicurrency is enabled for the company.\nMulticurrency is enabled for the company if `Preferences.MultiCurrencyEnabled` is set to `true`. Read more about multicurrency support [here](https://developer.intuit.com/docs?RedirectID=MultCurrencies). Required if multicurrency is enabled for the company.", - optional: true, - }, - currency_ref_name: { - type: "object", - description: "The full name of the currency.", - optional: true, - }, - cc_account_ref_value: { - type: "string", - description: "The id of the credit card account reference. Required when `PayType` is `CreditCard`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Id` from that object for `CCAccountRef.value`. The specified account must have `Account.AccountType` set to `Credit Card` and `Account.AccountSubType` set to `CreditCard`. Inject with data only if the payment was transacted through Intuit Payments API.", - optional: true, - }, - cc_account_ref_name: { - type: "string", - description: "The name of the credit card account reference. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Name` from that object for `CCAccountRef.name`. The specified account must have `Account.AccountType` set to `Credit Card` and `Account.AccountSubType` set to `CreditCard`. Inject with data only if the payment was transacted through Intuit Payments API.", - optional: true, - }, - bank_account_ref_value: { - type: "string", - description: "The id of the bank account reference. Required when `PayType` is `Check`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Id` from that object for `APAccountRef.value`. The specified account must have `Account.AccountType` set to `Bank` and `Account.AccountSubType` set to `Checking`.", - optional: true, - }, - bank_account_ref_name: { - type: "string", - description: "The name of the bank account reference. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Name` from that object for `APAccountRef.name`. The specified account must have `Account.AccountType` set to `Bank` and `Account.AccountSubType` set to `Checking`.", - optional: true, - }, - minorversion: { - type: "string", - description: "Use the minorversion query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - // See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/billpayment#create-a-billpayment - - if (!this.total_amt || !this.vendor_ref_value || !this.line || !this.pay_type) { - throw new Error("Must provide total_amt, and vendor_ref_value, line, and pay_type parameters."); - } - - return await axios($, { - method: "post", - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/billpayment`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "accept": "application/json", - "content-type": "application/json", - }, - data: { - TotalAmt: this.total_amt, - VendorRef: { - value: this.vendor_ref_value, - name: this.vendor_ref_name, - }, - Line: this.line, - PayType: this.pay_type, - CurrencyRef: { - value: this.currency_ref_value, - name: this.currency_ref_name, - }, - CreditCardPayment: { - CCAccountRef: { - value: this.cc_account_ref_value, - name: this.cc_account_ref_name, - }, - }, - CheckPayment: { - BankAccountRef: { - value: this.bank_account_ref_value, - name: this.bank_account_ref_name, - }, - }, - }, - params: { - minorversion: this.minorversion, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/actions/create-pl-report/create-pl-report.mjs b/components/quickbooks_sandbox/actions/create-pl-report/create-pl-report.mjs new file mode 100644 index 0000000000000..5c1102af61302 --- /dev/null +++ b/components/quickbooks_sandbox/actions/create-pl-report/create-pl-report.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/create-pl-report/create-pl-report.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-create-pl-report", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/create-purchase/create-purchase.mjs b/components/quickbooks_sandbox/actions/create-purchase/create-purchase.mjs index 4f13c5ace47bb..ca97c9733ddb1 100644 --- a/components/quickbooks_sandbox/actions/create-purchase/create-purchase.mjs +++ b/components/quickbooks_sandbox/actions/create-purchase/create-purchase.mjs @@ -1,85 +1,22 @@ -// legacy_hash_id: a_G1iL4w -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/create-purchase/create-purchase.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-create-purchase", - name: "Create Purchase", - description: "Creates a purchase.", - version: "0.1.1", - type: "action", + version: "0.1.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - line_items: { - type: "any", - description: "Individual line items of a transaction. Valid `Line` type for create: `AccountBasedExpenseLine`", - }, - account_ref_value: { - type: "string", - description: "Specifies the id of the account reference. Check must specify bank account, CreditCard must specify credit card account. Validation Rules:Valid and Active Account Reference of an appropriate type.", - }, - payment_type: { - type: "string", - description: "Payment Type can be: `Cash`, `Check`, or `CreditCard`.", - options: [ - "Cash", - "Check", - "CreditCard", - ], - }, - account_ref_name: { - type: "string", - description: "Specifies the name of the account reference. Check must specify bank account, CreditCard must specify credit card account. Validation Rules:Valid and Active Account Reference of an appropriate type.", - optional: true, - }, - currency_ref_value: { - type: "string", - description: "A three letter string representing the ISO 4217 code for the currency. For example, `USD`, `AUD`, `EUR`, and so on. This must be defined if multicurrency is enabled for the company.\nMulticurrency is enabled for the company if `Preferences.MultiCurrencyEnabled` is set to `true`. Read more about multicurrency support [here](https://developer.intuit.com/docs?RedirectID=MultCurrencies). Required if multicurrency is enabled for the company.", - optional: true, - }, - currency_ref_name: { - type: "object", - description: "The full name of the currency.", - optional: true, - }, - minorversion: { - type: "string", - description: "Use the minorversion query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - // See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#create-an-invoice - - if (!this.line_items || !this.account_ref_value) { - throw new Error("Must provide line_items, and account_ref_value parameters."); - } - - return await axios($, { - method: "post", - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/purchase`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "accept": "application/json", - "content-type": "application/json", - }, - data: { - PaymentType: this.payment_type, - AccountRef: { - value: this.account_ref_value, - name: this.account_ref_name, - }, - Line: this.line_items, - CurrencyRef: { - value: this.currency_ref_value, - name: this.currency_ref_name, - }, - }, - params: { - minorversion: this.minorversion, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/actions/create-sales-receipt/create-sales-receipt.mjs b/components/quickbooks_sandbox/actions/create-sales-receipt/create-sales-receipt.mjs new file mode 100644 index 0000000000000..8ecbf839fc88d --- /dev/null +++ b/components/quickbooks_sandbox/actions/create-sales-receipt/create-sales-receipt.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/create-sales-receipt/create-sales-receipt.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-create-sales-receipt", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/delete-purchase/delete-purchase.mjs b/components/quickbooks_sandbox/actions/delete-purchase/delete-purchase.mjs new file mode 100644 index 0000000000000..19889ba472539 --- /dev/null +++ b/components/quickbooks_sandbox/actions/delete-purchase/delete-purchase.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/delete-purchase/delete-purchase.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-delete-purchase", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/get-bill/get-bill.mjs b/components/quickbooks_sandbox/actions/get-bill/get-bill.mjs new file mode 100644 index 0000000000000..1912d8f4a7be7 --- /dev/null +++ b/components/quickbooks_sandbox/actions/get-bill/get-bill.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/get-bill/get-bill.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-get-bill", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/get-customer/get-customer.mjs b/components/quickbooks_sandbox/actions/get-customer/get-customer.mjs index 2ddb78c66ed88..d8a04334d786d 100644 --- a/components/quickbooks_sandbox/actions/get-customer/get-customer.mjs +++ b/components/quickbooks_sandbox/actions/get-customer/get-customer.mjs @@ -1,43 +1,22 @@ -// legacy_hash_id: a_vgidgN -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/get-customer/get-customer.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-get-customer", - name: "Get Customer", - description: "Returns info about a customer.", - version: "0.1.1", - type: "action", + version: "0.1.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - customer_id: { - type: "string", - description: "Id of the customer to get details of.", - }, - minorversion: { - type: "string", - description: "Use the `minorversion` query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - // See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/customer#read-a-customer - - if (!this.customer_id) { - throw new Error("Must provide customer_id parameter."); - } - - return await axios($, { - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/customer/${this.customer_id}`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "content-type": "application/json", - }, - params: { - minorversion: this.minorversion, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/actions/get-invoice/get-invoice.mjs b/components/quickbooks_sandbox/actions/get-invoice/get-invoice.mjs index 8cfca67a443da..f33101f947369 100644 --- a/components/quickbooks_sandbox/actions/get-invoice/get-invoice.mjs +++ b/components/quickbooks_sandbox/actions/get-invoice/get-invoice.mjs @@ -1,44 +1,22 @@ -// legacy_hash_id: a_Q3ix1Q -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/get-invoice/get-invoice.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-get-invoice", - name: "Get Invoice", - description: "Returns info about an invoice.", - version: "0.1.1", - type: "action", + version: "0.1.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - invoice_id: { - type: "string", - description: "Id of the invoice to get details of.", - }, - minorversion: { - type: "string", - description: "Use the `minorversion` query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - // See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#read-an-invoice - - if (!this.invoice_id) { - throw new Error("Must provide invoice_id parameter."); - } - - return await axios($, { - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/invoice/${this.invoice_id}`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "accept": "application/json", - "content-type": "application/json", - }, - params: { - minorversion: this.minorversion, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/actions/get-my-company/get-my-company.mjs b/components/quickbooks_sandbox/actions/get-my-company/get-my-company.mjs new file mode 100644 index 0000000000000..b3c8b48513066 --- /dev/null +++ b/components/quickbooks_sandbox/actions/get-my-company/get-my-company.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/get-my-company/get-my-company.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-get-my-company", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/get-payment/get-payment.mjs b/components/quickbooks_sandbox/actions/get-payment/get-payment.mjs index a57162263dff3..c64c8cd24a3ad 100644 --- a/components/quickbooks_sandbox/actions/get-payment/get-payment.mjs +++ b/components/quickbooks_sandbox/actions/get-payment/get-payment.mjs @@ -1,43 +1,22 @@ -// legacy_hash_id: a_0Mi7LY -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/get-payment/get-payment.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-get-payment", - name: "Get Payment", - description: "Returns info about a payment.", - version: "0.1.1", - type: "action", + version: "0.1.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - payment_id: { - type: "string", - description: "Id of the item to get details of.", - }, - minorversion: { - type: "string", - description: "Use the `minorversion` query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - //See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/payment#read-a-payment - - if (!this.payment_id) { - throw new Error("Must provide payment_id parameter."); - } - - return await axios($, { - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/payment/${this.payment_id}`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "content-type": "application/json", - }, - params: { - minorversion: this.minorversion, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/actions/get-purchase-order/get-purchase-order.mjs b/components/quickbooks_sandbox/actions/get-purchase-order/get-purchase-order.mjs new file mode 100644 index 0000000000000..0473c476e2149 --- /dev/null +++ b/components/quickbooks_sandbox/actions/get-purchase-order/get-purchase-order.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/get-purchase-order/get-purchase-order.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-get-purchase-order", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/get-purchase/get-purchase.mjs b/components/quickbooks_sandbox/actions/get-purchase/get-purchase.mjs new file mode 100644 index 0000000000000..9af7bfe745148 --- /dev/null +++ b/components/quickbooks_sandbox/actions/get-purchase/get-purchase.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/get-purchase/get-purchase.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-get-purchase", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/get-sales-receipt/get-sales-receipt.mjs b/components/quickbooks_sandbox/actions/get-sales-receipt/get-sales-receipt.mjs new file mode 100644 index 0000000000000..adeb14ae7714a --- /dev/null +++ b/components/quickbooks_sandbox/actions/get-sales-receipt/get-sales-receipt.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-get-sales-receipt", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/get-time-activity/get-time-activity.mjs b/components/quickbooks_sandbox/actions/get-time-activity/get-time-activity.mjs new file mode 100644 index 0000000000000..5235e9ded1dbf --- /dev/null +++ b/components/quickbooks_sandbox/actions/get-time-activity/get-time-activity.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/get-time-activity/get-time-activity.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-get-time-activity", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/search-account/search-account.mjs b/components/quickbooks_sandbox/actions/search-account/search-account.mjs deleted file mode 100644 index fcad08115820f..0000000000000 --- a/components/quickbooks_sandbox/actions/search-account/search-account.mjs +++ /dev/null @@ -1,84 +0,0 @@ -// legacy_hash_id: a_vgid15 -import { axios } from "@pipedream/platform"; - -export default { - key: "quickbooks_sandbox-search-account", - name: "Search Account", - description: "Searches for accounts.", - version: "0.1.1", - type: "action", - props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - include_clause: { - type: "string", - description: "Fields to use in the include clause of the Account data query. See query language syntax, limitations, and other specifications on [Data queries](https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries)", - }, - where_clause: { - type: "string", - description: "Filters to use in the where clause of the Account data query. Note: Multiple clauses (filters) are AND'd. The OR operation is not supported.", - }, - order_clause: { - type: "string", - description: "The `order_clause` is for sorting the result. Include the Account property to sort by. The default sort order is ascending; to indicate descending sort order, include DESC, for example: `Name DESC`", - optional: true, - }, - start_position: { - type: "string", - description: "The starting count of the response for pagination.", - optional: true, - }, - max_results: { - type: "string", - description: "The number of Account entity elements in the response.", - optional: true, - }, - minorversion: { - type: "string", - description: "Use the `minorversion` query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - //See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/account#query-an-account - - if (!this.include_clause || !this.where_clause) { - throw new Error("Must provide include_clause, where_clause parameters."); - } - - //Prepares OrderBy clause,start position, max results parameters to be used in the request's query parameter. - var orderClause = ""; - if (this.order_clause) { - orderClause = ` ORDERBY ${this.order_clause}`; - } - - var startPosition = ""; - if (this.start_position) { - startPosition = ` STARTPOSITION ${this.start_position}`; - } - - var maxResults = ""; - if (this.max_results) { - maxResults = ` MAXRESULTS ${this.max_results}` || ""; - } - - //Prepares the request's query parameter - const query = `select ${this.include_clause} from Account where ${this.where_clause}${orderClause}${startPosition}${maxResults}`; - - //Sends the request against Quickbooks API - return await axios($, { - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/query`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "accept": "application/json", - "content-type": "application/octet-stream", - }, - params: { - minorversion: this.minorversion, - query, - }, - }); - }, -}; diff --git a/components/quickbooks_sandbox/actions/search-accounts/search-accounts.mjs b/components/quickbooks_sandbox/actions/search-accounts/search-accounts.mjs new file mode 100644 index 0000000000000..35ce9c2e8f18e --- /dev/null +++ b/components/quickbooks_sandbox/actions/search-accounts/search-accounts.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/search-accounts/search-accounts.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-search-accounts", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/search-customers/search-customers.mjs b/components/quickbooks_sandbox/actions/search-customers/search-customers.mjs index b4d284cbbe780..b733d1dd9cceb 100644 --- a/components/quickbooks_sandbox/actions/search-customers/search-customers.mjs +++ b/components/quickbooks_sandbox/actions/search-customers/search-customers.mjs @@ -1,84 +1,22 @@ -// legacy_hash_id: a_Xzi4P0 -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/search-customers/search-customers.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-search-customers", - name: "Search Customers", - description: "Searches for customers.", - version: "0.1.1", - type: "action", + version: "0.1.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - include_clause: { - type: "string", - description: "Fields to use in the select clause of the Customer data query. See query language syntax, limitations, and other specifications on [Data queries](https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries)", - }, - where_clause: { - type: "string", - description: "Filters to use in the where clause of the Customer data query. Note: Multiple clauses (filters) are AND'd. The OR operation is not supported.", - }, - order_clause: { - type: "string", - description: "The `order_clause` is for sorting the result. Include the Customer property to sort by. The default sort order is ascending; to indicate descending sort order, include DESC, for example: `Name DESC`", - optional: true, - }, - start_position: { - type: "string", - description: "The starting count of the response for pagination.", - optional: true, - }, - max_results: { - type: "string", - description: "The number of Customer entity elements in the response.", - optional: true, - }, - minorversion: { - type: "string", - description: "Use the `minorversion` query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - //See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#query-a-customer - - if (!this.include_clause || !this.where_clause) { - throw new Error("Must provide include_clause, where_clause parameters."); - } - - //Prepares OrderBy clause,start position, max results parameters to be used in the request's query parameter. - var orderClause = ""; - if (this.order_clause) { - orderClause = ` ORDERBY ${this.order_clause}`; - } - - var startPosition = ""; - if (this.start_position) { - startPosition = ` STARTPOSITION ${this.start_position}`; - } - - var maxResults = ""; - if (this.max_results) { - maxResults = ` MAXRESULTS ${this.max_results}` || ""; - } - - //Prepares the request's query parameter - const query = `select ${this.include_clause} from Customer where ${this.where_clause}${orderClause}${startPosition}${maxResults}`; - - //Sends the request against Quickbooks API - return await axios($, { - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/query`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "accept": "application/json", - "content-type": "application/octet-stream", - }, - params: { - minorversion: this.minorversion, - query, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/actions/search-invoices/search-invoices.mjs b/components/quickbooks_sandbox/actions/search-invoices/search-invoices.mjs index 80e92dc14c889..183f735d93880 100644 --- a/components/quickbooks_sandbox/actions/search-invoices/search-invoices.mjs +++ b/components/quickbooks_sandbox/actions/search-invoices/search-invoices.mjs @@ -1,84 +1,22 @@ -// legacy_hash_id: a_1Wi7KO -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/search-invoices/search-invoices.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-search-invoices", - name: "Search Invoices", - description: "Searches for invoices.", - version: "0.1.1", - type: "action", + version: "0.1.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - include_clause: { - type: "string", - description: "Fields to use in the select clause of the Invoice data query. See query language syntax, limitations, and other specifications on [Data queries](https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries)", - }, - where_clause: { - type: "string", - description: "Filters to use in the where clause of the Invoice data query. Note: Multiple clauses (filters) are AND'd. The OR operation is not supported.", - }, - order_clause: { - type: "string", - description: "The `order_clause` is for sorting the result. Include the Invoice property to sort by. The default sort order is ascending; to indicate descending sort order, include DESC, for example: `Name DESC`", - optional: true, - }, - start_position: { - type: "string", - description: "The starting count of the response for pagination.", - optional: true, - }, - max_results: { - type: "string", - description: "The number of Invoice entity elements in the response.", - optional: true, - }, - minorversion: { - type: "string", - description: "Use the `minorversion` query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - //See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#query-an-invoice - - if (!this.include_clause || !this.where_clause) { - throw new Error("Must provide include_clause, where_clause parameters."); - } - - //Prepares OrderBy clause,start position, max results parameters to be used in the request's query parameter. - var orderClause = ""; - if (this.order_clause) { - orderClause = ` ORDERBY ${this.order_clause}`; - } - - var startPosition = ""; - if (this.start_position) { - startPosition = ` STARTPOSITION ${this.start_position}`; - } - - var maxResults = ""; - if (this.max_results) { - maxResults = ` MAXRESULTS ${this.max_results}` || ""; - } - - //Prepares the request's query parameter - const query = `select ${this.include_clause} from Invoice where ${this.where_clause}${orderClause}${startPosition}${maxResults}`; - - //Sends the request against Quickbooks API - return await axios($, { - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/query`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "accept": "application/json", - "content-type": "application/octet-stream", - }, - params: { - minorversion: this.minorversion, - query, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/actions/search-items/search-items.mjs b/components/quickbooks_sandbox/actions/search-items/search-items.mjs new file mode 100644 index 0000000000000..7d7954938e36f --- /dev/null +++ b/components/quickbooks_sandbox/actions/search-items/search-items.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/search-items/search-items.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-search-items", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/search-products/search-products.mjs b/components/quickbooks_sandbox/actions/search-products/search-products.mjs new file mode 100644 index 0000000000000..2ac05d85ff936 --- /dev/null +++ b/components/quickbooks_sandbox/actions/search-products/search-products.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/search-products/search-products.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-search-products", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/search-purchases/search-purchases.mjs b/components/quickbooks_sandbox/actions/search-purchases/search-purchases.mjs new file mode 100644 index 0000000000000..134da0ebf300d --- /dev/null +++ b/components/quickbooks_sandbox/actions/search-purchases/search-purchases.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/search-purchases/search-purchases.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-search-purchases", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/search-query/search-query.mjs b/components/quickbooks_sandbox/actions/search-query/search-query.mjs new file mode 100644 index 0000000000000..bfaab5e46f91c --- /dev/null +++ b/components/quickbooks_sandbox/actions/search-query/search-query.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/search-query/search-query.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-search-query", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/search-services/search-services.mjs b/components/quickbooks_sandbox/actions/search-services/search-services.mjs index e5d765df8f20e..a1a78dbca5d1f 100644 --- a/components/quickbooks_sandbox/actions/search-services/search-services.mjs +++ b/components/quickbooks_sandbox/actions/search-services/search-services.mjs @@ -1,84 +1,22 @@ -// legacy_hash_id: a_B0i8lr -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/search-services/search-services.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-search-services", - name: "Search Services", - description: "Search for services.", - version: "0.1.1", - type: "action", + version: "0.1.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - include_clause: { - type: "string", - description: "Fields to use in the select clause of the Item data query. See query language syntax, limitations, and other specifications on [Data queries](https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries)", - }, - where_clause: { - type: "string", - description: "Filters to use in the where clause of the Item data query. Note: Multiple clauses (filters) are AND'd. The OR operation is not supported.", - }, - order_clause: { - type: "string", - description: "The `order_clause` is for sorting the result. Include the Item property to sort by. The default sort order is ascending; to indicate descending sort order, include DESC, for example: `Name DESC`", - optional: true, - }, - start_position: { - type: "string", - description: "The starting count of the response for pagination.", - optional: true, - }, - max_results: { - type: "string", - description: "The number of Item entity elements in the response.", - optional: true, - }, - minorversion: { - type: "string", - description: "Use the `minorversion` query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - //See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#query-an-item - - if (!this.include_clause || !this.where_clause) { - throw new Error("Must provide include_clause, where_clause parameters."); - } - - //Prepares OrderBy clause,start position, max results parameters to be used in the request's query parameter. - var orderClause = ""; - if (this.order_clause) { - orderClause = ` ORDERBY ${this.order_clause}`; - } - - var startPosition = ""; - if (this.start_position) { - startPosition = ` STARTPOSITION ${this.start_position}`; - } - - var maxResults = ""; - if (this.max_results) { - maxResults = ` MAXRESULTS ${this.max_results}` || ""; - } - - //Prepares the request's query parameter - const query = `select ${this.include_clause} from Item where Type = 'Service' and ${this.where_clause}${orderClause}${startPosition}${maxResults}`; - - //Sends the request against Quickbooks API - return await axios($, { - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/query`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "accept": "application/json", - "content-type": "application/octet-stream", - }, - params: { - minorversion: this.minorversion, - query, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/actions/search-time-activities/search-time-activities.mjs b/components/quickbooks_sandbox/actions/search-time-activities/search-time-activities.mjs new file mode 100644 index 0000000000000..6ce38b1dfc640 --- /dev/null +++ b/components/quickbooks_sandbox/actions/search-time-activities/search-time-activities.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/search-time-activities/search-time-activities.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-search-time-activities", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/search-vendors/search-vendors.mjs b/components/quickbooks_sandbox/actions/search-vendors/search-vendors.mjs new file mode 100644 index 0000000000000..08c22b3f82236 --- /dev/null +++ b/components/quickbooks_sandbox/actions/search-vendors/search-vendors.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/search-vendors/search-vendors.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-search-vendors", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/sparse-update-invoice/sparse-update-invoice.mjs b/components/quickbooks_sandbox/actions/sparse-update-invoice/sparse-update-invoice.mjs new file mode 100644 index 0000000000000..e35de29d7e9ab --- /dev/null +++ b/components/quickbooks_sandbox/actions/sparse-update-invoice/sparse-update-invoice.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-sparse-update-invoice", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/update-customer/update-customer.mjs b/components/quickbooks_sandbox/actions/update-customer/update-customer.mjs new file mode 100644 index 0000000000000..03bb9b39bc6e1 --- /dev/null +++ b/components/quickbooks_sandbox/actions/update-customer/update-customer.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/update-customer/update-customer.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-update-customer", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/actions/update-item/update-item.mjs b/components/quickbooks_sandbox/actions/update-item/update-item.mjs index 20ed4528da3aa..1837b6a17c70c 100644 --- a/components/quickbooks_sandbox/actions/update-item/update-item.mjs +++ b/components/quickbooks_sandbox/actions/update-item/update-item.mjs @@ -1,319 +1,22 @@ -// legacy_hash_id: a_bKil4n -import { axios } from "@pipedream/platform"; +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/actions/update-item/update-item.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); export default { + ...others, key: "quickbooks_sandbox-update-item", - name: "Update Item", - description: "Updates an item.", - version: "0.2.1", - type: "action", + version: "0.2.2", + name, + description, + type, props: { - quickbooks_sandbox: { - type: "app", - app: "quickbooks_sandbox", - }, - item_id: { - type: "string", - description: "Id of the item to update.", - }, - name: { - type: "string", - description: "Name of the item. This value must be unique.", - }, - sync_token: { - type: "string", - description: "Version number of the entity. Required for the update operation.", - }, - track_qty_on_hand: { - type: "boolean", - description: "True if there is quantity on hand to be tracked. Once this value is true, it cannot be updated to false. Applicable for items of type `Inventory`. Not applicable for `Service` or `NonInventory` item types.", - }, - sparse_update: { - type: "string", - description: "When set to `true`, sparse updating provides the ability to update a subset of properties for a given object; only elements specified in the request are updated. Missing elements are left untouched.", - }, - qty_on_hand: { - type: "string", - description: "Current quantity of the `Inventory` items available for sale. Not used for `Service` or `NonInventory` type items. Required for `Inventory` type items.", - optional: true, - }, - income_account_ref_value: { - type: "string", - description: "Reference to the posting account, that is, the account that records the proceeds from the sale of this item. Must be an account with account type of `Sales of Product Income`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Id` from that object for `IncomeAccountRef.value`. See specifications for the IncomeAccountRef parameters in the [Create an item page](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#create-an-item).", - optional: true, - }, - income_account_ref_name: { - type: "string", - description: "Reference to the posting account, that is, the account that records the proceeds from the sale of this item. Must be an account with account type of `Sales of Product Income`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Name` from that object for `IncomeAccountRef.name`. See specifications for the IncomeAccountRef parameters in the [Create an item page](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#create-an-item).", - optional: true, - }, - type: { - type: "string", - description: "Classification that specifies the use of this item. See the description at the top of the [Item entity page](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item) for details about supported item types. See specifications for the type parameter in the [Create an item page](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#create-an-item).", - optional: true, - options: [ - "Inventory", - "Group", - "Service", - "NonInventory", - ], - }, - asset_account_ref_value: { - type: "string", - description: "Required for Inventory item types. Reference to the Inventory Asset account that tracks the current value of the inventory. If the same account is used for all inventory items, the current balance of this account will represent the current total value of the inventory. Must be an account with account type of `Other Current Asset`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Id` from that object for `AssetAccountRef.value`.", - optional: true, - }, - asset_account_ref_name: { - type: "string", - description: "Required for Inventory item types. Reference to the Inventory Asset account that tracks the current value of the inventory. If the same account is used for all inventory items, the current balance of this account will represent the current total value of the inventory. Must be an account with account type of `Other Current Asset`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Name` from that object for `AssetAccountRef.name`.", - optional: true, - }, - inv_start_date: { - type: "string", - description: "Date of opening balance for the inventory transaction. Required when creating an `Item.Type=Inventory`. Required for `Inventory` item types.", - optional: true, - }, - expense_account_ref_value: { - type: "string", - description: "Reference to the expense account used to pay the vendor for this item. Must be an account with account type of `Cost of Goods Sold`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Id` from that object for `ExpenseAccountRef.value`. See specifications for the ExpenseAccountRef parameters in the [Create an item page](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#create-an-item).", - optional: true, - }, - expense_account_ref_name: { - type: "string", - description: "Reference to the expense account used to pay the vendor for this item. Must be an account with account type of `Cost of Goods Sold`. Query the Account name list resource to determine the appropriate Account object for this reference. Use `Account.Name` from that object for `ExpenseAccountRef.name`. See specifications for the ExpenseAccountRef parameters in the [Create an item page](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#create-an-item).", - optional: true, - }, - Sku: { - type: "string", - description: "The stock keeping unit (SKU) for this Item. This is a company-defined identifier for an item or product used in tracking inventory.", - optional: true, - }, - sales_tax_included: { - type: "string", - description: "True if the sales tax is included in the item amount, and therefore is not calculated for the transaction.", - optional: true, - }, - sales_tax_code_ref_value: { - type: "string", - description: "Id of the referenced sales tax code for the Sales item. Applicable to Service and Sales item types only. Query the TaxCode name list resource to determine the appropriate TaxCode object for this reference. Use `TaxCode.Id` from that object for `SalesTaxCodeRef.value`.", - optional: true, - }, - sales_tax_code_ref_name: { - type: "string", - description: "Name of the referenced sales tax code for the Sales item. Applicable to Service and Sales item types only. Query the TaxCode name list resource to determine the appropriate TaxCode object for this reference. Use `TaxCode.Name` from that object for `SalesTaxCodeRef.name`.", - optional: true, - }, - class_ref_value: { - type: "string", - description: "Id of the referenced Class for the item. Query the Class name list resource to determine the appropriate object for this reference. Use `Class.Id` from that object for `ClassRef.value`.", - optional: true, - }, - class_ref_name: { - type: "string", - description: "Name of the referenced Class for the item. Query the Class name list resource to determine the appropriate object for this reference. Use `Class.Name` from that object for `ClassRef.name`.", - optional: true, - }, - purchase_tax_tncluded: { - type: "boolean", - description: "True if the purchase tax is included in the item amount, and therefore is not calculated for the transaction.", - optional: true, - }, - description: { - type: "string", - description: "Description of the item.", - optional: true, - }, - abatement_rate: { - type: "string", - description: "Sales tax abatement rate for India locales.", - optional: true, - }, - reverse_charge_rate: { - type: "string", - description: "Sales tax reverse charge rate for India locales.", - optional: true, - }, - sub_item: { - type: "boolean", - description: "If true, this is a sub item. If false or null, this is a top-level item. Creating inventory hierarchies with traditional inventory items is being phased out in lieu of using categories and sub categories.", - optional: true, - }, - taxable: { - type: "boolean", - description: "If true, transactions for this item are taxable. Applicable to US companies, only.", - optional: true, - }, - UQC_display_text: { - type: "string", - description: "Text to be displayed on customer's invoice to denote the Unit of Measure (instead of the standard code).", - optional: true, - }, - reorder_point: { - type: "string", - description: "The minimum quantity of a particular inventory item that you need to restock at any given time. The ReorderPoint value cannot be set to null for sparse updates(sparse=true). It can be set to null only for full updates.", - optional: true, - }, - purchase_desc: { - type: "string", - description: "Purchase description for the item.", - optional: true, - }, - pref_vendor_ref_value: { - type: "string", - optional: true, - }, - pref_vendor_ref_name: { - type: "string", - optional: true, - }, - active: { - type: "boolean", - description: "If true, the object is currently enabled for use by QuickBooks.", - optional: true, - }, - UQC_id: { - type: "string", - description: "Id of Standard Unit of Measure (UQC:Unique Quantity Code) of the item according to GST rule.", - optional: true, - }, - purchase_tax_code_ref_value: { - type: "string", - description: "The ID for the referenced purchase tax code object as found in the Id field of the object payload. \n\nReference to the purchase tax code for the item. Applicable to Service, Other Charge, and Product (Non-Inventory) item types. Query the TaxCode name list resource to determine the appropriate TaxCode object for this reference. Use `TaxCode.Id` from that object for `PurchaseTaxCodeRef.value`.", - optional: true, - }, - purchase_tax_code_ref_name: { - type: "string", - description: "An identifying name for the purchase tax code object being referenced by value and is derived from the field that holds the common name of that object. \n\nReference to the purchase tax code for the item. Applicable to Service, Other Charge, and Product (Non-Inventory) item types. Query the TaxCode name list resource to determine the appropriate TaxCode object for this reference. Use `TaxCode.Name` from that object for `PurchaseTaxCodeRef.name`.", - optional: true, - }, - service_type: { - type: "string", - description: "Sales tax service type for India locales.", - optional: true, - }, - purchase_cost: { - type: "string", - description: "Amount paid when buying or ordering the item, as expressed in the home currency.", - optional: true, - }, - unit_price: { - type: "string", - description: "Corresponds to the Price/Rate column on the QuickBooks Online UI to specify either unit price, a discount, or a tax rate for item. If used for unit price, the monetary value of the service or product, as expressed in the home currency. If used for a discount or tax rate, express the percentage as a fraction. For example, specify `0.4` for 40% tax", - optional: true, - }, - tax_classification_ref_value: { - type: "string", - description: "The ID for the referenced Tax classification object as found in the Id field of the object payload.\n\nTax classification segregates different items into different classifications and the tax classification is one of the key parameters to determine appropriate tax on transactions involving items. Tax classifications are sourced by either tax governing authorities as in India/Malaysia or externally like Exactor. 'Fuel', 'Garments' and 'Soft drinks' are a few examples of tax classification in layman terms. User can choose a specific tax classification for an item while creating it. A level 1 tax classification cannot be associated to an Item", - optional: true, - }, - tax_classification_ref_name: { - type: "string", - description: "An identifying name for the Tax classification object being referenced by value and is derived from the field that holds the common name of that object.", - optional: true, - }, - parent_ref_name: { - type: "string", - description: "An identifying name for the parent item object being referenced by `value` and is derived from the field that holds the common name of that object.\n\nThe immediate parent of the sub item in the hierarchical Category:Sub-category list. If SubItem is true, then ParenRef is required. Query the Item name list resource to determine the appropriate object for this reference. Use `Item.Id` from that object for `ParentRef.value`.", - optional: true, - }, - parent_ref_value: { - type: "string", - description: "The ID for the referenced parent item object as found in the Id field of the object payload. \n\nThe immediate parent of the sub item in the hierarchical Category:Sub-category list. If SubItem is true, then ParenRef is required. Query the Item name list resource to determine the appropriate object for this reference. Use `Item.Id` from that object for `ParentRef.value`.", - optional: true, - }, - minorversion: { - type: "string", - description: "Use the minorversion query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, - }, - }, - async run({ $ }) { - //See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#full-update-an-item - - if (!this.item_id || !this.name || !this.sync_token || this.track_qty_on_hand === undefined || this.sparse_update === undefined) { - throw new Error("Must provide item_id, name, sync_token, and track_qty_on_hand parameters."); - } - - //Prepares the request body - var data = { - sparse: this.sparse_update, - Id: this.item_id, - Name: this.name, - QtyOnHand: this.qty_on_hand, - SyncToken: this.sync_token, - IncomeAccountRef: { - value: this.income_account_ref_value, - name: this.income_account_ref_name, - }, - Type: this.type, - AssetAccountRef: { - value: this.asset_account_ref_value, - name: this.asset_account_ref_name, - }, - InvStartDate: this.inv_start_date, - ExpenseAccountRef: { - value: this.expense_account_ref_value, - name: this.expense_account_ref_name, - }, - Sku: this.Sku, - SalesTaxIncluded: this.sales_tax_included, - TrackQtyOnHand: this.track_qty_on_hand, - SalesTaxCodeRef: { - value: this.sales_tax_code_ref_value, - name: this.sales_tax_code_ref_name, - }, - ClassRef: { - value: this.class_ref_value, - name: this.class_ref_name, - }, - PurchaseTaxIncluded: this.purchase_tax_tncluded, - Description: this.description, - AbatementRate: this.abatement_rate, - ReverseChargeRate: this.reverse_charge_rate, - SubItem: this.sub_item, - Taxable: this.taxable, - UQCDisplayText: this.UQC_display_text, - ReorderPoint: this.reorder_point, - PurchaseDesc: this.purchase_desc, - PrefVendorRef: { - value: this.pref_vendor_ref_value, - name: this.pref_vendor_ref_name, - }, - Active: this.active, - UQCId: this.UQC_id, - PurchaseTaxCodeRef: { - value: this.purchase_tax_code_ref_value, - name: this.purchase_tax_code_ref_name, - }, - ServiceType: this.service_type, - PurchaseCost: this.purchase_cost, - UnitPrice: this.unit_price, - TaxClassificationRef: { - value: this.tax_classification_ref_value, - name: this.tax_classification_ref_name, - }, - }; - - if (this.pref_vendor_ref_value || this.parent_ref_name) { - data["ParentRef"] = { - value: this.parent_ref_value, - name: this.parent_ref_name, - }; - } - - //Sends the request against Quickbooks Sandbox API - return await axios($, { - method: "post", - url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/item`, - headers: { - "Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`, - "accept": "application/json", - "content-type": "application/json", - }, - data, - params: { - minorversion: this.minorversion, - }, - }); + quickbooks: app, + ...props, }, }; diff --git a/components/quickbooks_sandbox/package.json b/components/quickbooks_sandbox/package.json index 3d9196f26d78c..e1635aa04092b 100644 --- a/components/quickbooks_sandbox/package.json +++ b/components/quickbooks_sandbox/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/quickbooks_sandbox", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Quickbooks Sandbox Components", "main": "quickbooks_sandbox.app.mjs", "keywords": [ diff --git a/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs b/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs index 5dd4b8dc33e63..eb67fa0cd8dc1 100644 --- a/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs +++ b/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs @@ -1,6 +1,7 @@ import common from "../quickbooks/quickbooks.app.mjs"; export default { + ...common, type: "app", app: "quickbooks_sandbox", methods: { diff --git a/components/quickbooks_sandbox/sources/new-customer-created/new-customer-created.mjs b/components/quickbooks_sandbox/sources/new-customer-created/new-customer-created.mjs new file mode 100644 index 0000000000000..5e49436884362 --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-customer-created/new-customer-created.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/sources/new-customer-created/new-customer-created.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-new-customer-created", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/sources/new-customer-updated/new-customer-updated.mjs b/components/quickbooks_sandbox/sources/new-customer-updated/new-customer-updated.mjs new file mode 100644 index 0000000000000..1a29d984d3675 --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-customer-updated/new-customer-updated.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/sources/new-customer-updated/new-customer-updated.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-new-customer-updated", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/sources/new-employee-created/new-employee-created.mjs b/components/quickbooks_sandbox/sources/new-employee-created/new-employee-created.mjs index 4527818a02fed..78f8321c7f90d 100644 --- a/components/quickbooks_sandbox/sources/new-employee-created/new-employee-created.mjs +++ b/components/quickbooks_sandbox/sources/new-employee-created/new-employee-created.mjs @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, app); export default { ...others, key: "quickbooks_sandbox-new-employee-created", - version: "0.0.1", + version: "0.0.2", name, description, type, diff --git a/components/quickbooks_sandbox/sources/new-employee-updated/new-employee-updated.mjs b/components/quickbooks_sandbox/sources/new-employee-updated/new-employee-updated.mjs index bffbfa3781f6b..bbb6619508377 100644 --- a/components/quickbooks_sandbox/sources/new-employee-updated/new-employee-updated.mjs +++ b/components/quickbooks_sandbox/sources/new-employee-updated/new-employee-updated.mjs @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, app); export default { ...others, key: "quickbooks_sandbox-new-employee-updated", - version: "0.0.1", + version: "0.0.2", name, description, type, diff --git a/components/quickbooks_sandbox/sources/new-invoice-created/new-invoice-created.mjs b/components/quickbooks_sandbox/sources/new-invoice-created/new-invoice-created.mjs new file mode 100644 index 0000000000000..e569f8efce424 --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-invoice-created/new-invoice-created.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/sources/new-invoice-created/new-invoice-created.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-new-invoice-created", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/sources/new-invoice-updated/new-invoice-updated.mjs b/components/quickbooks_sandbox/sources/new-invoice-updated/new-invoice-updated.mjs new file mode 100644 index 0000000000000..11082efbf92a5 --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-invoice-updated/new-invoice-updated.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/sources/new-invoice-updated/new-invoice-updated.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-new-invoice-updated", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/sources/new-item-created/new-item-created.mjs b/components/quickbooks_sandbox/sources/new-item-created/new-item-created.mjs new file mode 100644 index 0000000000000..a255e518526cf --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-item-created/new-item-created.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/sources/new-item-created/new-item-created.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-new-item-created", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/components/quickbooks_sandbox/sources/new-item-updated/new-item-updated.mjs b/components/quickbooks_sandbox/sources/new-item-updated/new-item-updated.mjs new file mode 100644 index 0000000000000..9551cc13c1181 --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-item-updated/new-item-updated.mjs @@ -0,0 +1,22 @@ +import app from "../../quickbooks_sandbox.app.mjs"; +import common from "../../../quickbooks/sources/new-item-updated/new-item-updated.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "quickbooks_sandbox-new-item-updated", + version: "0.0.1", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b63ea3ed13242..ee9dabcfb2d81 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40842,7 +40842,7 @@ snapshots: path-scurry@1.11.1: dependencies: lru-cache: 10.4.3 - minipass: 5.0.0 + minipass: 7.1.2 path-to-regexp@6.3.0: {}