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..5e2160540f274 100644 --- a/components/quickbooks/actions/create-bill/create-bill.mjs +++ b/components/quickbooks/actions/create-bill/create-bill.mjs @@ -4,14 +4,18 @@ import quickbooks from "../../quickbooks.app.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", + propDefinition: [ + quickbooks, + "vendorIds", + ], type: "string", + label: "Vendor Ref Value", 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: { diff --git a/components/quickbooks/actions/create-customer/create-customer.mjs b/components/quickbooks/actions/create-customer/create-customer.mjs index a5d419c22de74..5f84441dc41a0 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, diff --git a/components/quickbooks/actions/create-invoice/create-invoice.mjs b/components/quickbooks/actions/create-invoice/create-invoice.mjs index 408be0eeacc87..36a0c5d1d0650 100644 --- a/components/quickbooks/actions/create-invoice/create-invoice.mjs +++ b/components/quickbooks/actions/create-invoice/create-invoice.mjs @@ -4,8 +4,8 @@ import quickbooks from "../../quickbooks.app.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, @@ -16,9 +16,10 @@ export default { ], }, 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`.", + propDefinition: [ + quickbooks, + "customer", + ], }, customerRefName: { propDefinition: [ diff --git a/components/quickbooks/actions/create-payment/create-payment.mjs b/components/quickbooks/actions/create-payment/create-payment.mjs index 01758a39a6827..ba0c30b1c9169 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,9 +14,10 @@ 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", + propDefinition: [ + quickbooks, + "customer", + ], }, customerRefName: { propDefinition: [ 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..4c585b6b3b0e5 100644 --- a/components/quickbooks/actions/create-purchase/create-purchase.mjs +++ b/components/quickbooks/actions/create-purchase/create-purchase.mjs @@ -4,14 +4,18 @@ import quickbooks from "../../quickbooks.app.mjs"; 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", + 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.", }, paymentType: { @@ -37,26 +41,25 @@ export default { 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, + propDefinition: [ + quickbooks, + "currencyRefValue", + ], }, currencyRefName: { - label: "Currency Reference Name", - type: "object", - description: "The full name of the currency.", - optional: true, + propDefinition: [ + quickbooks, + "currencyRefName", + ], }, - 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, + minorVersion: { + propDefinition: [ + quickbooks, + "minorVersion", + ], }, }, async run({ $ }) { - let parsedLineItems = parseOne(this.lineItems); const response = await this.quickbooks.createPurchase({ 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..a2e4b30492da5 100644 --- a/components/quickbooks/actions/create-sales-receipt/create-sales-receipt.mjs +++ b/components/quickbooks/actions/create-sales-receipt/create-sales-receipt.mjs @@ -5,7 +5,7 @@ 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, diff --git a/components/quickbooks/actions/delete-purchase/delete-purchase.mjs b/components/quickbooks/actions/delete-purchase/delete-purchase.mjs index 707d945323344..0be20dcff973e 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,18 @@ 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, + minorVersion: { + propDefinition: [ + quickbooks, + "minorVersion", + ], }, }, async run({ $ }) { const { quickbooks, purchaseId, - minorversion, + minorVersion, } = this; const [ @@ -40,7 +40,7 @@ export default { SyncToken, }, params: { - minorversion, + minorversion: minorVersion, operation: "delete", }, }); diff --git a/components/quickbooks/actions/get-bill/get-bill.mjs b/components/quickbooks/actions/get-bill/get-bill.mjs index afb7b60c592bd..0fce44cd4fe53 100644 --- a/components/quickbooks/actions/get-bill/get-bill.mjs +++ b/components/quickbooks/actions/get-bill/get-bill.mjs @@ -4,15 +4,16 @@ 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.", + propDefinition: [ + quickbooks, + "billId", + ], }, minorVersion: { propDefinition: [ diff --git a/components/quickbooks/actions/get-customer/get-customer.mjs b/components/quickbooks/actions/get-customer/get-customer.mjs index 6ea17e0340607..190046788266b 100644 --- a/components/quickbooks/actions/get-customer/get-customer.mjs +++ b/components/quickbooks/actions/get-customer/get-customer.mjs @@ -4,15 +4,16 @@ 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.", + propDefinition: [ + quickbooks, + "customer", + ], }, minorVersion: { propDefinition: [ diff --git a/components/quickbooks/actions/get-invoice/get-invoice.mjs b/components/quickbooks/actions/get-invoice/get-invoice.mjs index 898ee0495e57a..26f8145d70ab4 100644 --- a/components/quickbooks/actions/get-invoice/get-invoice.mjs +++ b/components/quickbooks/actions/get-invoice/get-invoice.mjs @@ -4,16 +4,16 @@ 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, + propDefinition: [ + quickbooks, + "invoiceId", + ], }, minorVersion: { propDefinition: [ 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..7a2a44887c548 100644 --- a/components/quickbooks/actions/get-my-company/get-my-company.mjs +++ b/components/quickbooks/actions/get-my-company/get-my-company.mjs @@ -3,14 +3,13 @@ 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({ $, }); 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..bbfec932cf87a --- /dev/null +++ b/components/quickbooks/actions/get-payment/get-payment.mjs @@ -0,0 +1,44 @@ +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", + ], + }, + minorVersion: { + propDefinition: [ + quickbooks, + "minorVersion", + ], + }, + }, + async run({ $ }) { + if (!this.paymentId) { + throw new ConfigurationError("Must provide paymentId parameter."); + } + + const response = await this.quickbooks.getPayment({ + $, + paymentId: this.paymentId, + params: { + minorversion: this.minorVersion, + }, + }); + + 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..90d7ca3c57ccf 100644 --- a/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs +++ b/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs @@ -4,15 +4,16 @@ 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.", + propDefinition: [ + quickbooks, + "purchaseOrderId", + ], }, minorVersion: { propDefinition: [ diff --git a/components/quickbooks/actions/get-purchase/get-purchase.mjs b/components/quickbooks/actions/get-purchase/get-purchase.mjs index d10339ef55fba..3cf88468da4b8 100644 --- a/components/quickbooks/actions/get-purchase/get-purchase.mjs +++ b/components/quickbooks/actions/get-purchase/get-purchase.mjs @@ -4,15 +4,16 @@ 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.", + propDefinition: [ + quickbooks, + "purchaseId", + ], }, minorVersion: { propDefinition: [ @@ -28,7 +29,7 @@ export default { const response = await this.quickbooks.getPurchase({ $, - purchaseId: this.purchaseId, + purchaseId: this.purchaseId?.value ?? this.purchaseId, params: { minorversion: this.minorVersion, }, 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..11ae01381ca61 100644 --- a/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs +++ b/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs @@ -4,15 +4,16 @@ 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.", + propDefinition: [ + quickbooks, + "salesReceiptId", + ], }, minorVersion: { propDefinition: [ 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..27170910b05c5 100644 --- a/components/quickbooks/actions/get-time-activity/get-time-activity.mjs +++ b/components/quickbooks/actions/get-time-activity/get-time-activity.mjs @@ -4,15 +4,16 @@ 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.", + propDefinition: [ + quickbooks, + "timeActivityId", + ], }, minorVersion: { propDefinition: [ diff --git a/components/quickbooks/actions/search-accounts/search-accounts.mjs b/components/quickbooks/actions/search-accounts/search-accounts.mjs index ebee75f17be3b..015084b87f94c 100644 --- a/components/quickbooks/actions/search-accounts/search-accounts.mjs +++ b/components/quickbooks/actions/search-accounts/search-accounts.mjs @@ -4,8 +4,8 @@ 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, @@ -53,22 +53,21 @@ export default { throw new ConfigurationError("Must provide includeClause, whereClause parameters."); } - 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}` || ""; } - //Prepares the request's query parameter const query = `select ${this.includeClause} from Account where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ diff --git a/components/quickbooks/actions/search-customers/search-customers.mjs b/components/quickbooks/actions/search-customers/search-customers.mjs index 2ec5f2752b675..6836ae8741486 100644 --- a/components/quickbooks/actions/search-customers/search-customers.mjs +++ b/components/quickbooks/actions/search-customers/search-customers.mjs @@ -4,8 +4,8 @@ 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, @@ -53,22 +53,21 @@ export default { throw new ConfigurationError("Must provide includeClause, whereClause parameters."); } - 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}` || ""; } - //Prepares the request's query parameter const query = `select ${this.includeClause} from Customer where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ diff --git a/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs b/components/quickbooks/actions/search-invoices/search-invoices.mjs similarity index 66% rename from components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs rename to components/quickbooks/actions/search-invoices/search-invoices.mjs index 164006f4750d8..2882011ac4685 100644 --- a/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs +++ b/components/quickbooks/actions/search-invoices/search-invoices.mjs @@ -2,10 +2,10 @@ import { ConfigurationError } from "@pipedream/platform"; import quickbooks from "../../quickbooks.app.mjs"; export default { - key: "quickbooks-sandbox-search-invoices", + key: "quickbooks-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", + 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.1.7", type: "action", props: { quickbooks, @@ -53,24 +53,18 @@ export default { 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}`; - } + 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 Invoice where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ diff --git a/components/quickbooks/actions/search-items/search-items.mjs b/components/quickbooks/actions/search-items/search-items.mjs index 1913190a94d4d..90413e3aaccdf 100644 --- a/components/quickbooks/actions/search-items/search-items.mjs +++ b/components/quickbooks/actions/search-items/search-items.mjs @@ -4,8 +4,8 @@ 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, @@ -53,22 +53,18 @@ export default { 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 Item where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ diff --git a/components/quickbooks/actions/search-products/search-products.mjs b/components/quickbooks/actions/search-products/search-products.mjs index 6abe33fefa886..8c3b34fee1d9d 100644 --- a/components/quickbooks/actions/search-products/search-products.mjs +++ b/components/quickbooks/actions/search-products/search-products.mjs @@ -4,8 +4,8 @@ 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, @@ -53,22 +53,18 @@ export default { 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 Item where Type = 'Inventory' and ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ diff --git a/components/quickbooks/actions/search-purchases/search-purchases.mjs b/components/quickbooks/actions/search-purchases/search-purchases.mjs index ac08e79571e04..08ab964c572af 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, @@ -41,26 +41,22 @@ export default { }, }, 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({ diff --git a/components/quickbooks/actions/search-query/search-query.mjs b/components/quickbooks/actions/search-query/search-query.mjs index 5515f8038650b..3b405f6cbf2d0 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, 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..e1b61476b2f08 --- /dev/null +++ b/components/quickbooks/actions/search-services/search-services.mjs @@ -0,0 +1,84 @@ +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, + includeClause: { + propDefinition: [ + quickbooks, + "includeClause", + ], + optional: false, + }, + 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", + ], + }, + minorVersion: { + propDefinition: [ + quickbooks, + "minorVersion", + ], + }, + }, + async run({ $ }) { + if (!this.include_clause || !this.where_clause) { + throw new ConfigurationError("Must provide include_clause, where_clause parameters."); + } + + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; + + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; + + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; + + const query = `select ${this.include_clause} from Item where Type = 'Service' and ${this.where_clause}${orderClause}${startPosition}${maxResults}`; + + const response = await this.quickbooks.query({ + $, + params: { + minorversion: this.minorVersion, + 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..2fd889604188e 100644 --- a/components/quickbooks/actions/search-time-activities/search-time-activities.mjs +++ b/components/quickbooks/actions/search-time-activities/search-time-activities.mjs @@ -4,8 +4,8 @@ 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, @@ -53,22 +53,18 @@ export default { 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 TimeActivity where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ diff --git a/components/quickbooks/actions/search-vendors/search-vendors.mjs b/components/quickbooks/actions/search-vendors/search-vendors.mjs index 20e4752e1d35c..0fd23852b224d 100644 --- a/components/quickbooks/actions/search-vendors/search-vendors.mjs +++ b/components/quickbooks/actions/search-vendors/search-vendors.mjs @@ -4,8 +4,8 @@ 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, @@ -53,22 +53,18 @@ export default { 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 response = await this.quickbooks.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..be716b6c7d334 100644 --- a/components/quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs +++ b/components/quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs @@ -5,8 +5,8 @@ import quickbooks from "../../quickbooks.app.mjs"; 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, diff --git a/components/quickbooks/actions/update-customer/update-customer.mjs b/components/quickbooks/actions/update-customer/update-customer.mjs index ab971febe78df..512dcac4e5205 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, @@ -183,11 +189,6 @@ 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", 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..6a75896b094f7 --- /dev/null +++ b/components/quickbooks/actions/update-item/update-item.mjs @@ -0,0 +1,363 @@ +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.", + }, + syncToken: { + type: "string", + label: "Sync Token", + description: "Version number of the entity. Required for the update operation.", + }, + 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.", + }, + sparseUpdate: { + type: "string", + label: "Sparse Update", + 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.", + }, + 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).", + optional: true, + }, + incomeAccountRefName: { + type: "string", + label: "Income Account Ref Name", + 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", + 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`.", + optional: true, + }, + assetAccountRefName: { + type: "string", + label: "Asset Account Ref Name", + 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, + }, + 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).", + optional: true, + }, + expenseAccountRefName: { + type: "string", + label: "Expense Account Ref Name", + 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", + 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: { + type: "string", + 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`.", + optional: true, + }, + salesTaxCodeRefName: { + type: "string", + label: "Sales Tax Code Ref Name", + 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, + }, + classRefValue: { + type: "string", + label: "Class Ref Value", + 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, + }, + classRefName: { + type: "string", + label: "Class Ref Name", + 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, + }, + 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", + optional: true, + }, + prefVendorRefName: { + type: "string", + label: "Pref Vendor Ref Name", + description: "Pref vendor ref name", + optional: true, + }, + 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: { + type: "string", + 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`.", + optional: true, + }, + purchaseTaxCodeRefName: { + type: "string", + label: "Purchase Tax Code Ref Name", + 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, + }, + 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: { + type: "string", + label: "Tax Classification Ref Value", + 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, + }, + taxClassificationRefName: { + type: "string", + label: "Tax Classification Ref Name", + 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, + }, + parentRefName: { + type: "string", + label: "Parent Ref Name", + 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, + }, + parentRefValue: { + type: "string", + 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, + }, + minorVersion: { + propDefinition: [ + quickbooks, + "minorVersion", + ], + }, + }, + async run({ $ }) { + if (!this.itemId + || !this.name + || !this.syncToken + || this.trackQtyOnHand === undefined + || this.sparseUpdate === undefined + ) { + throw new ConfigurationError("Must provide itemId, name, syncToken, and trackQtyOnHand parameters."); + } + + const data = { + sparse: this.sparseUpdate, + Id: this.itemId, + Name: this.name, + QtyOnHand: this.qtyOnHand, + SyncToken: this.syncToken, + IncomeAccountRef: { + value: this.incomeAccountRefValue, + name: this.incomeAccountRefName, + }, + Type: this.type, + AssetAccountRef: { + value: this.assetAccountRefValue, + name: this.assetAccountRefName, + }, + InvStartDate: this.invStartDate, + ExpenseAccountRef: { + value: this.expenseAccountRefValue, + name: this.expenseAccountRefName, + }, + Sku: this.sku, + SalesTaxIncluded: this.salesTaxIncluded, + TrackQtyOnHand: this.trackQtyOnHand, + SalesTaxCodeRef: { + value: this.salesTaxCodeRefValue, + name: this.salesTaxCodeRefName, + }, + ClassRef: { + value: this.classRefValue, + name: this.classRefName, + }, + 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: { + value: this.prefVendorRefValue, + name: this.prefVendorRefName, + }, + Active: this.active, + UQCId: this.UqcId, + PurchaseTaxCodeRef: { + value: this.purchaseTaxCodeRefValue, + name: this.purchaseTaxCodeRefName, + }, + ServiceType: this.serviceType, + PurchaseCost: this.purchaseCost, + UnitPrice: this.unitPrice, + TaxClassificationRef: { + value: this.taxClassificationRefValue, + name: this.taxClassificationRefName, + }, + }; + + if (this.parentRefValue || this.parentRefName) { + data["ParentRef"] = { + value: this.parentRefValue, + name: this.parentRefName, + }; + } + + const response = await this.quickbooks.updateItem({ + $, + data, + params: { + minorversion: this.minorVersion, + }, + }); + + if (response) { + $.export("summary", `Successfully updated item with id ${this.itemId}`); + } + + return response; + }, +}; diff --git a/components/quickbooks/package.json b/components/quickbooks/package.json index b53bc5fa84355..8da0524464043 100644 --- a/components/quickbooks/package.json +++ b/components/quickbooks/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/quickbooks", - "version": "0.3.0", + "version": "0.3.1", "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..42461d42fa4eb 100644 --- a/components/quickbooks/quickbooks.app.mjs +++ b/components/quickbooks/quickbooks.app.mjs @@ -11,21 +11,16 @@ export default { type: "string", 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: { @@ -44,24 +39,16 @@ export default { type: "string", description: "Reference to a customer or job. Query the Customer name list resource to determine the appropriate Customer object for this reference.", 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 records?.map(({ - Id: id, DisplayName: label, - }) => ({ - label, - value: JSON.stringify({ + return this.getPropOptions({ + page, + resource: "Customer", + mapper: ({ + Id: id, DisplayName: label, + }) => ({ + label, value: id, - name: label, }), - })) || []; + }); }, }, customerRefName: { @@ -76,24 +63,19 @@ export default { 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.", optional: true, 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: { @@ -167,26 +149,21 @@ export default { optional: true, }, purchaseId: { - label: "purchase Id", + 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 this.getPropOptions({ + page, + resource: "Purchase", + mapper: ({ + Id, PaymentType, SyncToken, + }) => ({ + label: `${Id} - ${PaymentType}`, + value: `${Id}|${SyncToken}`, + }), }); - - return records?.map(({ - Id, PaymentType, SyncToken, - }) => ({ - label: `${Id} - ${PaymentType}`, - value: `${Id}|${SyncToken}`, - })) || []; }, }, suffix: { @@ -217,20 +194,16 @@ export default { 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 this.getPropOptions({ + page, + resource: "Term", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), }); - return terms?.map(({ - Id: value, Name: label, - }) => ({ - value, - label, - })) || []; }, }, vendorIds: { @@ -239,20 +212,16 @@ export default { 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 this.getPropOptions({ + page, + resource: "Vendor", + mapper: ({ + Id: value, DisplayName: label, + }) => ({ + value, + label, + }), }); - return vendors?.map(({ - Id: value, DisplayName: label, - }) => ({ - value, - label, - })) || []; }, }, accountIds: { @@ -261,20 +230,16 @@ export default { 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 this.getPropOptions({ + page, + resource: "Account", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), }); - return accounts?.map(({ - Id: value, Name: label, - }) => ({ - value, - label, - })) || []; }, }, classIds: { @@ -283,20 +248,16 @@ export default { 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 this.getPropOptions({ + page, + resource: "Class", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), }); - return classes?.map(({ - Id: value, Name: label, - }) => ({ - value, - label, - })) || []; }, }, employeeIds: { @@ -305,20 +266,16 @@ export default { 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 this.getPropOptions({ + page, + resource: "Employee", + mapper: ({ + Id: value, DisplayName: label, + }) => ({ + value, + label, + }), }); - return employees?.map(({ - Id: value, DisplayName: label, - }) => ({ - value, - label, - })) || []; }, }, departmentIds: { @@ -327,20 +284,113 @@ export default { 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 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}`, + }), + }); + }, + }, + paymentId: { + type: "string", + 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}`, + }), }); - return departments?.map(({ - Id: value, Name: label, - }) => ({ - value, - label, - })) || []; }, }, }, @@ -354,7 +404,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 +416,181 @@ export default { Authorization: `Bearer ${this._accessToken()}`, accept: "application/json", }, - ...options, + ...opts, }); }; return await retryWithExponentialBackoff(requestFn); }, - async createPayment({ - $, data, + async getPropOptions({ + page, 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, - }, $); - }, - createPurchase({ - $, ...args - }) { - return this._makeRequest(`company/${this._companyId()}/purchase`, { - method: "POST", - ...args, - }, $); + ...opts, + }); }, - async createInvoice({ - $, data, params, - }) { - return this._makeRequest(`company/${this._companyId()}/invoice`, { + createPurchase(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/purchase`, method: "post", - data, - params, - }, $); + ...opts, + }); }, - async deletePurchase({ - $, ...args - }) { - return this._makeRequest(`company/${this._companyId()}/purchase`, { - method: "POST", - ...args, - }, $); - }, - async sparseUpdateInvoice({ - $, 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 getBill({ - $, billId, params, - }) { - return this._makeRequest(`company/${this._companyId()}/bill/${billId}`, { - params, - }, $); + deletePurchase(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/purchase`, + method: "post", + ...opts, + }); }, - async getCustomer({ - $, customerId, params, - }) { - return this._makeRequest(`company/${this._companyId()}/customer/${customerId}`, { - params, - }, $); + sparseUpdateInvoice(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/invoice`, + method: "post", + ...opts, + }); }, - async getInvoice({ - $, invoiceId, params, + getBill({ + billId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/invoice/${invoiceId}`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/bill/${billId}`, + ...opts, + }); }, - async getInvoices({ - $, params, + getCustomer({ + customerId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/query`, { - params, - }, $); - }, - async getMyCompany({ $ } = {}) { - return this._makeRequest(`company/${this._companyId()}/companyinfo/${this._companyId()}`, {}, $); + return this._makeRequest({ + path: `company/${this._companyId()}/customer/${customerId}`, + ...opts, + }); }, - async getPurchase({ - $, purchaseId, params, + getInvoice({ + invoiceId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/purchase/${purchaseId}`, { - params, - }, $); - }, - async getPurchaseOrder({ - $, purchaseOrderId, 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()}/purchaseorder/${purchaseOrderId}`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/purchase/${purchaseId}`, + ...opts, + }); }, - async getSalesReceipt({ - $, salesReceiptId, params, + getPurchaseOrder({ + purchaseOrderId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/salesreceipt/${salesReceiptId}`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/purchaseorder/${purchaseOrderId}`, + ...opts, + }); }, - async getTimeActivity({ - $, timeActivityId, params, + getSalesReceipt({ + salesReceiptId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/timeactivity/${timeActivityId}`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/salesreceipt/${salesReceiptId}`, + ...opts, + }); }, - async query({ - $, params, + getTimeActivity({ + timeActivityId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/query`, { - params, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/timeactivity/${timeActivityId}`, + ...opts, + }); }, - async updateCustomer({ - $, data, params, + getPayment({ + paymentId, ...opts }) { - return this._makeRequest(`company/${this._companyId()}/customer`, { + return this._makeRequest({ + path: `company/${this._companyId()}/payment/${paymentId}`, + ...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-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/common/utils.mjs b/components/quickbooks_sandbox/common/utils.mjs new file mode 100644 index 0000000000000..d42df055ddeb0 --- /dev/null +++ b/components/quickbooks_sandbox/common/utils.mjs @@ -0,0 +1,40 @@ +export function adjustPropDefinitions(props, app) { + return Object.fromEntries( + Object.entries(props).map(([ + key, + prop, + ]) => { + if (typeof prop === "string") return [ + key, + prop, + ]; + const { + propDefinition, ...otherValues + } = prop; + if (propDefinition) { + const [ + , ...otherDefs + ] = propDefinition; + return [ + key, + { + propDefinition: [ + app, + ...otherDefs, + ], + ...otherValues, + }, + ]; + } + return [ + key, + otherValues.type === "app" + ? null + : otherValues, + ]; + }) + .filter(([ + , value, + ]) => value), + ); +} diff --git a/components/quickbooks_sandbox/package.json b/components/quickbooks_sandbox/package.json new file mode 100644 index 0000000000000..3d9196f26d78c --- /dev/null +++ b/components/quickbooks_sandbox/package.json @@ -0,0 +1,15 @@ +{ + "name": "@pipedream/quickbooks_sandbox", + "version": "0.0.1", + "description": "Pipedream Quickbooks Sandbox Components", + "main": "quickbooks_sandbox.app.mjs", + "keywords": [ + "pipedream", + "quickbooks_sandbox" + ], + "homepage": "https://pipedream.com/apps/quickbooks_sandbox", + "author": "Pipedream (https://pipedream.com/)", + "publishConfig": { + "access": "public" + } +} diff --git a/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs b/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs index 8fc6bc9dc64db..c1ee8dd8f6498 100644 --- a/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs +++ b/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs @@ -1,11 +1,13 @@ +import common from "../quickbooks/quickbooks.app.mjs"; + export default { + ...common, type: "app", app: "quickbooks_sandbox", - propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + ...common.methods, + _apiUrl() { + return "https://quickbooks.api.intuit.com/v3"; }, }, }; 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-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 ff4c581e1cac3..ace1a7ddaaa69 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8161,6 +8161,9 @@ importers: dependencies: '@pipedream/platform': 3.0.0 + components/quickbooks_sandbox: + specifiers: {} + components/quickemailverification: specifiers: '@pipedream/platform': ^1.1.0