From 59a40fe2d6b63686447c4d5e4adb59a78396ad69 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Mon, 18 Nov 2024 15:50:32 -0500 Subject: [PATCH 01/11] refactoring --- .../actions/create-bill/create-bill.mjs | 2 +- .../create-customer/create-customer.mjs | 2 +- .../actions/create-invoice/create-invoice.mjs | 2 +- .../actions/create-payment/create-payment.mjs | 2 +- .../create-purchase/create-purchase.mjs | 2 +- .../delete-purchase/delete-purchase.mjs | 2 +- .../quickbooks/actions/get-bill/get-bill.mjs | 2 +- .../actions/get-customer/get-customer.mjs | 2 +- .../actions/get-invoice/get-invoice.mjs | 2 +- .../actions/get-my-company/get-my-company.mjs | 2 +- .../get-purchase-order/get-purchase-order.mjs | 2 +- .../actions/get-purchase/get-purchase.mjs | 2 +- .../get-sales-receipt/get-sales-receipt.mjs | 2 +- .../get-time-activity/get-time-activity.mjs | 2 +- .../sandbox-search-invoices.mjs | 2 +- .../search-accounts/search-accounts.mjs | 2 +- .../search-customers/search-customers.mjs | 2 +- .../actions/search-items/search-items.mjs | 2 +- .../search-products/search-products.mjs | 2 +- .../actions/search-query/search-query.mjs | 2 +- .../search-time-activities.mjs | 2 +- .../actions/search-vendors/search-vendors.mjs | 2 +- .../sparse-update-invoice.mjs | 2 +- .../update-customer/update-customer.mjs | 2 +- components/quickbooks/package.json | 2 +- components/quickbooks/quickbooks.app.mjs | 247 +++++++++--------- components/quickbooks/sources/common/base.mjs | 12 + .../new-customer-created.mjs | 5 +- .../new-customer-updated.mjs | 2 +- .../new-invoice-created.mjs | 3 - .../new-item-created/new-item-created.mjs | 3 - 31 files changed, 161 insertions(+), 161 deletions(-) diff --git a/components/quickbooks/actions/create-bill/create-bill.mjs b/components/quickbooks/actions/create-bill/create-bill.mjs index bb2bb2fed3ae2..3be36a36fd4d7 100644 --- a/components/quickbooks/actions/create-bill/create-bill.mjs +++ b/components/quickbooks/actions/create-bill/create-bill.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/create-customer/create-customer.mjs b/components/quickbooks/actions/create-customer/create-customer.mjs index a5d419c22de74..0f6c4ff8d4e94 100644 --- a/components/quickbooks/actions/create-customer/create-customer.mjs +++ b/components/quickbooks/actions/create-customer/create-customer.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/create-invoice/create-invoice.mjs b/components/quickbooks/actions/create-invoice/create-invoice.mjs index 408be0eeacc87..72dd5aed7c3e4 100644 --- a/components/quickbooks/actions/create-invoice/create-invoice.mjs +++ b/components/quickbooks/actions/create-invoice/create-invoice.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/create-payment/create-payment.mjs b/components/quickbooks/actions/create-payment/create-payment.mjs index 01758a39a6827..2321f5fc1430e 100644 --- a/components/quickbooks/actions/create-payment/create-payment.mjs +++ b/components/quickbooks/actions/create-payment/create-payment.mjs @@ -3,7 +3,7 @@ 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)", + 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.5", type: "action", props: { diff --git a/components/quickbooks/actions/create-purchase/create-purchase.mjs b/components/quickbooks/actions/create-purchase/create-purchase.mjs index fcf186c2cd465..950ccdec8cc10 100644 --- a/components/quickbooks/actions/create-purchase/create-purchase.mjs +++ b/components/quickbooks/actions/create-purchase/create-purchase.mjs @@ -4,7 +4,7 @@ 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)", + 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.4", type: "action", props: { diff --git a/components/quickbooks/actions/delete-purchase/delete-purchase.mjs b/components/quickbooks/actions/delete-purchase/delete-purchase.mjs index 707d945323344..74bc04d2d29aa 100644 --- a/components/quickbooks/actions/delete-purchase/delete-purchase.mjs +++ b/components/quickbooks/actions/delete-purchase/delete-purchase.mjs @@ -3,7 +3,7 @@ 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)", + 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.4", type: "action", props: { diff --git a/components/quickbooks/actions/get-bill/get-bill.mjs b/components/quickbooks/actions/get-bill/get-bill.mjs index afb7b60c592bd..08b5dc5d770d3 100644 --- a/components/quickbooks/actions/get-bill/get-bill.mjs +++ b/components/quickbooks/actions/get-bill/get-bill.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/get-customer/get-customer.mjs b/components/quickbooks/actions/get-customer/get-customer.mjs index 6ea17e0340607..3c95809cf39a5 100644 --- a/components/quickbooks/actions/get-customer/get-customer.mjs +++ b/components/quickbooks/actions/get-customer/get-customer.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/get-invoice/get-invoice.mjs b/components/quickbooks/actions/get-invoice/get-invoice.mjs index 898ee0495e57a..f6e5c2b4185cd 100644 --- a/components/quickbooks/actions/get-invoice/get-invoice.mjs +++ b/components/quickbooks/actions/get-invoice/get-invoice.mjs @@ -4,7 +4,7 @@ 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)", + 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.7", type: "action", props: { 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..9292f7c821ba8 100644 --- a/components/quickbooks/actions/get-my-company/get-my-company.mjs +++ b/components/quickbooks/actions/get-my-company/get-my-company.mjs @@ -3,7 +3,7 @@ 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)", + 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.6", type: "action", props: { 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..170f748db7d0f 100644 --- a/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs +++ b/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/get-purchase/get-purchase.mjs b/components/quickbooks/actions/get-purchase/get-purchase.mjs index d10339ef55fba..de50f8bd32a3e 100644 --- a/components/quickbooks/actions/get-purchase/get-purchase.mjs +++ b/components/quickbooks/actions/get-purchase/get-purchase.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { 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..2c3dbbca67a90 100644 --- a/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs +++ b/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { 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..756c4add8a764 100644 --- a/components/quickbooks/actions/get-time-activity/get-time-activity.mjs +++ b/components/quickbooks/actions/get-time-activity/get-time-activity.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs b/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs index 164006f4750d8..b58503cfed862 100644 --- a/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs +++ b/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs @@ -4,7 +4,7 @@ import quickbooks from "../../quickbooks.app.mjs"; export default { key: "quickbooks-sandbox-search-invoices", name: "Search Invoices", - description: "Searches for invoices. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#query-an-invoice)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/search-accounts/search-accounts.mjs b/components/quickbooks/actions/search-accounts/search-accounts.mjs index ebee75f17be3b..d5c23a9ca2c4f 100644 --- a/components/quickbooks/actions/search-accounts/search-accounts.mjs +++ b/components/quickbooks/actions/search-accounts/search-accounts.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/search-customers/search-customers.mjs b/components/quickbooks/actions/search-customers/search-customers.mjs index 2ec5f2752b675..3863f0a2792b8 100644 --- a/components/quickbooks/actions/search-customers/search-customers.mjs +++ b/components/quickbooks/actions/search-customers/search-customers.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/search-items/search-items.mjs b/components/quickbooks/actions/search-items/search-items.mjs index 1913190a94d4d..009489c4d628e 100644 --- a/components/quickbooks/actions/search-items/search-items.mjs +++ b/components/quickbooks/actions/search-items/search-items.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/search-products/search-products.mjs b/components/quickbooks/actions/search-products/search-products.mjs index 6abe33fefa886..cbe25d9e6f3a7 100644 --- a/components/quickbooks/actions/search-products/search-products.mjs +++ b/components/quickbooks/actions/search-products/search-products.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/search-query/search-query.mjs b/components/quickbooks/actions/search-query/search-query.mjs index 5515f8038650b..d54c48680cc60 100644 --- a/components/quickbooks/actions/search-query/search-query.mjs +++ b/components/quickbooks/actions/search-query/search-query.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { 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..0aa56d8c7e987 100644 --- a/components/quickbooks/actions/search-time-activities/search-time-activities.mjs +++ b/components/quickbooks/actions/search-time-activities/search-time-activities.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { diff --git a/components/quickbooks/actions/search-vendors/search-vendors.mjs b/components/quickbooks/actions/search-vendors/search-vendors.mjs index 20e4752e1d35c..4d1edf2acc9f5 100644 --- a/components/quickbooks/actions/search-vendors/search-vendors.mjs +++ b/components/quickbooks/actions/search-vendors/search-vendors.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { 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..695e4eb636073 100644 --- a/components/quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs +++ b/components/quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs @@ -5,7 +5,7 @@ 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)", + 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.4", type: "action", props: { diff --git a/components/quickbooks/actions/update-customer/update-customer.mjs b/components/quickbooks/actions/update-customer/update-customer.mjs index ab971febe78df..76e03b2209653 100644 --- a/components/quickbooks/actions/update-customer/update-customer.mjs +++ b/components/quickbooks/actions/update-customer/update-customer.mjs @@ -4,7 +4,7 @@ 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)", + 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.6", type: "action", props: { 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..c7618238da5cb 100644 --- a/components/quickbooks/quickbooks.app.mjs +++ b/components/quickbooks/quickbooks.app.mjs @@ -354,7 +354,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 +366,152 @@ export default { Authorization: `Bearer ${this._accessToken()}`, accept: "application/json", }, - ...options, + ...opts, }); }; return await retryWithExponentialBackoff(requestFn); }, - async createPayment({ - $, data, - }) { - return this._makeRequest(`company/${this._companyId()}/payment`, { + 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, - }, $); - }, - async deletePurchase({ - $, ...args - }) { - return this._makeRequest(`company/${this._companyId()}/purchase`, { - method: "POST", - ...args, - }, $); + ...opts, + }); }, - 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, - }, $); + return this._makeRequest({ + path: `company/${this._companyId()}/customer/${customerId}`, + ...opts, + }); }, - async getMyCompany({ $ } = {}) { - return this._makeRequest(`company/${this._companyId()}/companyinfo/${this._companyId()}`, {}, $); - }, - 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, - }, $); - }, - async updateCustomer({ - $, data, params, - }) { - return this._makeRequest(`company/${this._companyId()}/customer`, { + return this._makeRequest({ + path: `company/${this._companyId()}/timeactivity/${timeActivityId}`, + ...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, - }, $); - }, - getProfitLossReport({ - $, params, - }) { - return this._makeRequest(`company/${this._companyId()}/reports/ProfitAndLoss`, { - params, - }, $); + ...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..9a8bb766a1aa3 100644 --- a/components/quickbooks/sources/new-customer-created/new-customer-created.mjs +++ b/components/quickbooks/sources/new-customer-created/new-customer-created.mjs @@ -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..84c4817515440 100644 --- a/components/quickbooks/sources/new-customer-updated/new-customer-updated.mjs +++ b/components/quickbooks/sources/new-customer-updated/new-customer-updated.mjs @@ -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..d234c78995cc1 100644 --- a/components/quickbooks/sources/new-invoice-created/new-invoice-created.mjs +++ b/components/quickbooks/sources/new-invoice-created/new-invoice-created.mjs @@ -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-item-created/new-item-created.mjs b/components/quickbooks/sources/new-item-created/new-item-created.mjs index e0f890385281e..adcdf4db7d249 100644 --- a/components/quickbooks/sources/new-item-created/new-item-created.mjs +++ b/components/quickbooks/sources/new-item-created/new-item-created.mjs @@ -17,9 +17,6 @@ export default { getFieldList() { return "Item"; }, - getFieldDate() { - return "CreateTime"; - }, getSummary(item) { return `New Item: ${item.Id}`; }, From f7f3a1d2fe586aa457317ccb868a68a6cb6e0048 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 21 Nov 2024 14:57:16 -0500 Subject: [PATCH 02/11] quickbooks_sandbox components --- .../search-invoices.mjs} | 2 +- .../search-services/search-services.mjs | 86 +++++ .../actions/update-item/update-item.mjs | 321 +++++++++++++++++ .../create-ap-aging-report.mjs | 22 ++ .../actions/create-bill/create-bill.mjs | 22 ++ .../create-customer/create-customer.mjs | 89 +---- .../actions/create-invoice/create-invoice.mjs | 85 +---- .../actions/create-payment/create-payment.mjs | 131 +------ .../create-pl-report/create-pl-report.mjs | 22 ++ .../create-purchase/create-purchase.mjs | 95 +---- .../create-sales-receipt.mjs | 22 ++ .../delete-purchase/delete-purchase.mjs | 22 ++ .../actions/get-bill/get-bill.mjs | 22 ++ .../actions/get-customer/get-customer.mjs | 53 +-- .../actions/get-invoice/get-invoice.mjs | 54 +-- .../actions/get-my-company/get-my-company.mjs | 22 ++ .../actions/get-payment/get-payment.mjs | 53 +-- .../get-purchase-order/get-purchase-order.mjs | 22 ++ .../actions/get-purchase/get-purchase.mjs | 22 ++ .../get-sales-receipt/get-sales-receipt.mjs | 22 ++ .../get-time-activity/get-time-activity.mjs | 22 ++ .../actions/search-account/search-account.mjs | 84 ----- .../search-accounts/search-accounts.mjs | 22 ++ .../search-customers/search-customers.mjs | 94 +---- .../search-invoices/search-invoices.mjs | 94 +---- .../actions/search-items/search-items.mjs | 22 ++ .../search-products/search-products.mjs | 22 ++ .../search-purchases/search-purchases.mjs | 22 ++ .../actions/search-query/search-query.mjs | 22 ++ .../search-services/search-services.mjs | 94 +---- .../search-time-activities.mjs | 22 ++ .../actions/search-vendors/search-vendors.mjs | 22 ++ .../sparse-update-invoice.mjs | 22 ++ .../update-customer/update-customer.mjs | 22 ++ .../actions/update-item/update-item.mjs | 329 +----------------- .../quickbooks_sandbox/common/utils.mjs | 40 +++ components/quickbooks_sandbox/package.json | 15 + .../quickbooks_sandbox.app.mjs | 10 +- .../new-customer-created.mjs | 22 ++ .../new-customer-updated.mjs | 22 ++ .../new-invoice-created.mjs | 22 ++ .../new-invoice-updated.mjs | 22 ++ .../new-item-created/new-item-created.mjs | 22 ++ .../new-item-updated/new-item-updated.mjs | 22 ++ 44 files changed, 1217 insertions(+), 1084 deletions(-) rename components/quickbooks/actions/{sandbox-search-invoices/sandbox-search-invoices.mjs => search-invoices/search-invoices.mjs} (98%) create mode 100644 components/quickbooks/actions/search-services/search-services.mjs create mode 100644 components/quickbooks/actions/update-item/update-item.mjs create mode 100644 components/quickbooks_sandbox/actions/create-ap-aging-report/create-ap-aging-report.mjs create mode 100644 components/quickbooks_sandbox/actions/create-bill/create-bill.mjs create mode 100644 components/quickbooks_sandbox/actions/create-pl-report/create-pl-report.mjs create mode 100644 components/quickbooks_sandbox/actions/create-sales-receipt/create-sales-receipt.mjs create mode 100644 components/quickbooks_sandbox/actions/delete-purchase/delete-purchase.mjs create mode 100644 components/quickbooks_sandbox/actions/get-bill/get-bill.mjs create mode 100644 components/quickbooks_sandbox/actions/get-my-company/get-my-company.mjs create mode 100644 components/quickbooks_sandbox/actions/get-purchase-order/get-purchase-order.mjs create mode 100644 components/quickbooks_sandbox/actions/get-purchase/get-purchase.mjs create mode 100644 components/quickbooks_sandbox/actions/get-sales-receipt/get-sales-receipt.mjs create mode 100644 components/quickbooks_sandbox/actions/get-time-activity/get-time-activity.mjs delete mode 100644 components/quickbooks_sandbox/actions/search-account/search-account.mjs create mode 100644 components/quickbooks_sandbox/actions/search-accounts/search-accounts.mjs create mode 100644 components/quickbooks_sandbox/actions/search-items/search-items.mjs create mode 100644 components/quickbooks_sandbox/actions/search-products/search-products.mjs create mode 100644 components/quickbooks_sandbox/actions/search-purchases/search-purchases.mjs create mode 100644 components/quickbooks_sandbox/actions/search-query/search-query.mjs create mode 100644 components/quickbooks_sandbox/actions/search-time-activities/search-time-activities.mjs create mode 100644 components/quickbooks_sandbox/actions/search-vendors/search-vendors.mjs create mode 100644 components/quickbooks_sandbox/actions/sparse-update-invoice/sparse-update-invoice.mjs create mode 100644 components/quickbooks_sandbox/actions/update-customer/update-customer.mjs create mode 100644 components/quickbooks_sandbox/common/utils.mjs create mode 100644 components/quickbooks_sandbox/package.json create mode 100644 components/quickbooks_sandbox/sources/new-customer-created/new-customer-created.mjs create mode 100644 components/quickbooks_sandbox/sources/new-customer-updated/new-customer-updated.mjs create mode 100644 components/quickbooks_sandbox/sources/new-invoice-created/new-invoice-created.mjs create mode 100644 components/quickbooks_sandbox/sources/new-invoice-updated/new-invoice-updated.mjs create mode 100644 components/quickbooks_sandbox/sources/new-item-created/new-item-created.mjs create mode 100644 components/quickbooks_sandbox/sources/new-item-updated/new-item-updated.mjs diff --git a/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs b/components/quickbooks/actions/search-invoices/search-invoices.mjs similarity index 98% rename from components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs rename to components/quickbooks/actions/search-invoices/search-invoices.mjs index b58503cfed862..850f55bbbfed7 100644 --- a/components/quickbooks/actions/sandbox-search-invoices/sandbox-search-invoices.mjs +++ b/components/quickbooks/actions/search-invoices/search-invoices.mjs @@ -2,7 +2,7 @@ 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 the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#query-an-invoice)", version: "0.1.6", 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..1d1360621a25f --- /dev/null +++ b/components/quickbooks/actions/search-services/search-services.mjs @@ -0,0 +1,86 @@ +import quickbooks from "../../quickbooks.app.mjs"; + +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 Error("Must provide include_clause, where_clause parameters."); + } + + 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}` || ""; + } + + 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/update-item/update-item.mjs b/components/quickbooks/actions/update-item/update-item.mjs new file mode 100644 index 0000000000000..d21b0a0cd6ae1 --- /dev/null +++ b/components/quickbooks/actions/update-item/update-item.mjs @@ -0,0 +1,321 @@ +import quickbooks from "../../quickbooks.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "quickbooks_sandbox-update-item", + name: "Update Item", + description: "Updates an item.", + version: "0.0.1", + type: "action", + props: { + quickbooks, + 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, + }, + }); + }, +}; 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..b9c67c97dcdfd --- /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-plreport/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..80cf5c066d291 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.mehtods, + _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..b3b6adadb9404 --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-customer-created/new-customer-created.mjs @@ -0,0 +1,22 @@ +import app from "../../monday_oauth.app.mjs"; +import common from "../../../monday/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: { + monday: 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..b6d8ce2dc3a14 --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-customer-updated/new-customer-updated.mjs @@ -0,0 +1,22 @@ +import app from "../../monday_oauth.app.mjs"; +import common from "../../../monday/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: { + monday: 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..755104c6d78cf --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-invoice-created/new-invoice-created.mjs @@ -0,0 +1,22 @@ +import app from "../../monday_oauth.app.mjs"; +import common from "../../../monday/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: { + monday: 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..db858e8a82fbd --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-invoice-updated/new-invoice-updated.mjs @@ -0,0 +1,22 @@ +import app from "../../monday_oauth.app.mjs"; +import common from "../../../monday/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: { + monday: 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..0f7fd105304ee --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-item-created/new-item-created.mjs @@ -0,0 +1,22 @@ +import app from "../../monday_oauth.app.mjs"; +import common from "../../../monday/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: { + monday: 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..bcf3aacf648eb --- /dev/null +++ b/components/quickbooks_sandbox/sources/new-item-updated/new-item-updated.mjs @@ -0,0 +1,22 @@ +import app from "../../monday_oauth.app.mjs"; +import common from "../../../monday/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: { + monday: app, + ...props, + }, +}; From dbaed7e91d936685e3abd70a7169ff500d693e21 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 21 Nov 2024 15:28:17 -0500 Subject: [PATCH 03/11] update update-item --- .../actions/update-item/update-item.mjs | 244 ++++++++++-------- components/quickbooks/quickbooks.app.mjs | 28 ++ 2 files changed, 171 insertions(+), 101 deletions(-) diff --git a/components/quickbooks/actions/update-item/update-item.mjs b/components/quickbooks/actions/update-item/update-item.mjs index d21b0a0cd6ae1..db51fbe3f73a8 100644 --- a/components/quickbooks/actions/update-item/update-item.mjs +++ b/components/quickbooks/actions/update-item/update-item.mjs @@ -1,51 +1,61 @@ import quickbooks from "../../quickbooks.app.mjs"; -import { axios } from "@pipedream/platform"; +import { ConfigurationError } from "@pipedream/platform"; export default { key: "quickbooks_sandbox-update-item", name: "Update Item", - description: "Updates an 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, - item_id: { - type: "string", - description: "Id of the item to update.", + itemId: { + propDefinition: [ + quickbooks, + "itemId", + ], }, name: { type: "string", + label: "Name", description: "Name of the item. This value must be unique.", }, - sync_token: { + syncToken: { type: "string", + label: "Sync Token", description: "Version number of the entity. Required for the update operation.", }, - track_qty_on_hand: { + 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.", }, - sparse_update: { + 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.", }, - qty_on_hand: { + 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, }, - income_account_ref_value: { + 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, }, - income_account_ref_name: { + 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: [ @@ -55,267 +65,299 @@ export default { "NonInventory", ], }, - asset_account_ref_value: { + 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, }, - asset_account_ref_name: { + 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, }, - inv_start_date: { + 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, }, - expense_account_ref_value: { + 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, }, - expense_account_ref_name: { + 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: { + 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, }, - sales_tax_included: { + salesTaxIncluded: { type: "string", + 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, }, - sales_tax_code_ref_value: { + 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, }, - sales_tax_code_ref_name: { + 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, }, - class_ref_value: { + 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, }, - class_ref_name: { + 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, }, - purchase_tax_tncluded: { + 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, }, - abatement_rate: { + abatementRate: { type: "string", + label: "Abatement Rate", description: "Sales tax abatement rate for India locales.", optional: true, }, - reverse_charge_rate: { + reverseChargeRate: { type: "string", + label: "Reverse Charge Rate", description: "Sales tax reverse charge rate for India locales.", optional: true, }, - sub_item: { + 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, }, - UQC_display_text: { + 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, }, - reorder_point: { + 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, }, - purchase_desc: { + purchaseDesc: { type: "string", + label: "Purchase Description", description: "Purchase description for the item.", optional: true, }, - pref_vendor_ref_value: { + prefVendorRefValue: { type: "string", + label: "Pref Vendor Ref Value", + description: "Pref vendor ref value", optional: true, }, - pref_vendor_ref_name: { + 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, }, - UQC_id: { + 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, }, - purchase_tax_code_ref_value: { + 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, }, - purchase_tax_code_ref_name: { + 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, }, - service_type: { + serviceType: { type: "string", + label: "Service Type", description: "Sales tax service type for India locales.", optional: true, }, - purchase_cost: { + purchaseCost: { type: "string", + label: "Purchase Cost", description: "Amount paid when buying or ordering the item, as expressed in the home currency.", optional: true, }, - unit_price: { + 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, }, - tax_classification_ref_value: { + 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, }, - tax_classification_ref_name: { + 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, }, - parent_ref_name: { + 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, }, - parent_ref_value: { + 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: { - 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({ $ }) { - //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 + if (!this.itemId || !this.name - || !this.sync_token - || this.track_qty_on_hand === undefined - || this.sparse_update === undefined + || !this.syncToken + || this.trackQtyOnHand === undefined + || this.sparseUpdate === undefined ) { - throw new Error("Must provide item_id, name, sync_token, and track_qty_on_hand parameters."); + throw new ConfigurationError("Must provide itemId, name, syncToken, and trackQtyOnHand parameters."); } - //Prepares the request body - var data = { - sparse: this.sparse_update, - Id: this.item_id, + const data = { + sparse: this.sparseUpdate, + Id: this.itemId, Name: this.name, - QtyOnHand: this.qty_on_hand, - SyncToken: this.sync_token, + QtyOnHand: this.qtyOnHand, + SyncToken: this.syncToken, IncomeAccountRef: { - value: this.income_account_ref_value, - name: this.income_account_ref_name, + value: this.incomeAccountRefValue, + name: this.incomeAccountRefName, }, Type: this.type, AssetAccountRef: { - value: this.asset_account_ref_value, - name: this.asset_account_ref_name, + value: this.assetAccountRefValue, + name: this.assetAccountRefName, }, - InvStartDate: this.inv_start_date, + InvStartDate: this.invStartDate, ExpenseAccountRef: { - value: this.expense_account_ref_value, - name: this.expense_account_ref_name, + value: this.expenseAccountRefValue, + name: this.expenseAccountRefName, }, - Sku: this.Sku, - SalesTaxIncluded: this.sales_tax_included, - TrackQtyOnHand: this.track_qty_on_hand, + Sku: this.sku, + SalesTaxIncluded: this.salesTaxIncluded, + TrackQtyOnHand: this.trackQtyOnHand, SalesTaxCodeRef: { - value: this.sales_tax_code_ref_value, - name: this.sales_tax_code_ref_name, + value: this.salesTaxCodeRefValue, + name: this.salesTaxCodeRefName, }, ClassRef: { - value: this.class_ref_value, - name: this.class_ref_name, + value: this.classRefValue, + name: this.classRefName, }, - PurchaseTaxIncluded: this.purchase_tax_tncluded, + PurchaseTaxIncluded: this.purchaseTaxIncluded, Description: this.description, - AbatementRate: this.abatement_rate, - ReverseChargeRate: this.reverse_charge_rate, - SubItem: this.sub_item, + AbatementRate: this.abatementRate, + ReverseChargeRate: this.reverseChargeRate, + SubItem: this.subItem, Taxable: this.taxable, - UQCDisplayText: this.UQC_display_text, - ReorderPoint: this.reorder_point, - PurchaseDesc: this.purchase_desc, + UQCDisplayText: this.UqcDisplayText, + ReorderPoint: this.reorderPoint, + PurchaseDesc: this.purchaseDesc, PrefVendorRef: { - value: this.pref_vendor_ref_value, - name: this.pref_vendor_ref_name, + value: this.prefVendorRefValue, + name: this.prefVendorRefName, }, Active: this.active, - UQCId: this.UQC_id, + UQCId: this.UqcId, PurchaseTaxCodeRef: { - value: this.purchase_tax_code_ref_value, - name: this.purchase_tax_code_ref_name, + value: this.purchaseTaxCodeRefValue, + name: this.purchaseTaxCodeRefName, }, - ServiceType: this.service_type, - PurchaseCost: this.purchase_cost, - UnitPrice: this.unit_price, + ServiceType: this.serviceType, + PurchaseCost: this.purchaseCost, + UnitPrice: this.unitPrice, TaxClassificationRef: { - value: this.tax_classification_ref_value, - name: this.tax_classification_ref_name, + value: this.taxClassificationRefValue, + name: this.taxClassificationRefName, }, }; - if (this.pref_vendor_ref_value || this.parent_ref_name) { + if (this.prefVendorRefValue || this.parentRefName) { data["ParentRef"] = { - value: this.parent_ref_value, - name: this.parent_ref_name, + value: this.parentRefValue, + name: this.parentRefName, }; } - //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", - }, + 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/quickbooks.app.mjs b/components/quickbooks/quickbooks.app.mjs index c7618238da5cb..eee151752eec1 100644 --- a/components/quickbooks/quickbooks.app.mjs +++ b/components/quickbooks/quickbooks.app.mjs @@ -343,6 +343,27 @@ export default { })) || []; }, }, + itemId: { + type: "string", + label: "Item Id", + description: "The identifier of an item", + async options({ page }) { + const position = 1 + (page * 10); + const { QueryResponse: { Item: items } } = await this.query({ + params: { + query: `select * from item maxresults 10 ${page + ? `startposition ${position}` + : ""} `, + }, + }); + return items?.map(({ + Id: value, Name: label, + }) => ({ + value, + label, + })) || []; + }, + }, }, methods: { _companyId() { @@ -501,6 +522,13 @@ export default { ...opts, }); }, + updateItem(opts = {}) { + return this._makeRequest({ + path: `company/${this._companyId()}/item`, + method: "post", + ...opts, + }); + }, getApAgingReport(opts = {}) { return this._makeRequest({ path: `company/${this._companyId()}/reports/AgedPayableDetail`, From e1586a6efb6725a657b4b1477e7f5745c8a90718 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 21 Nov 2024 15:35:42 -0500 Subject: [PATCH 04/11] minor updates --- .../actions/create-purchase/create-purchase.mjs | 1 - .../quickbooks/actions/get-my-company/get-my-company.mjs | 1 - .../actions/search-accounts/search-accounts.mjs | 7 +++---- .../actions/search-customers/search-customers.mjs | 7 +++---- .../actions/search-invoices/search-invoices.mjs | 7 +++---- .../quickbooks/actions/search-items/search-items.mjs | 7 +++---- .../actions/search-products/search-products.mjs | 7 +++---- .../actions/search-purchases/search-purchases.mjs | 6 +++--- .../actions/search-services/search-services.mjs | 9 +++++---- .../search-time-activities/search-time-activities.mjs | 7 +++---- .../quickbooks/actions/search-vendors/search-vendors.mjs | 7 +++---- 11 files changed, 29 insertions(+), 37 deletions(-) diff --git a/components/quickbooks/actions/create-purchase/create-purchase.mjs b/components/quickbooks/actions/create-purchase/create-purchase.mjs index 950ccdec8cc10..8400451ef725d 100644 --- a/components/quickbooks/actions/create-purchase/create-purchase.mjs +++ b/components/quickbooks/actions/create-purchase/create-purchase.mjs @@ -56,7 +56,6 @@ export default { }, }, async run({ $ }) { - let parsedLineItems = parseOne(this.lineItems); const response = await this.quickbooks.createPurchase({ 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 9292f7c821ba8..cbd19efdbe294 100644 --- a/components/quickbooks/actions/get-my-company/get-my-company.mjs +++ b/components/quickbooks/actions/get-my-company/get-my-company.mjs @@ -10,7 +10,6 @@ export default { quickbooks, }, async run({ $ }) { - const response = await this.quickbooks.getMyCompany({ $, }); diff --git a/components/quickbooks/actions/search-accounts/search-accounts.mjs b/components/quickbooks/actions/search-accounts/search-accounts.mjs index d5c23a9ca2c4f..263ac46b154ee 100644 --- a/components/quickbooks/actions/search-accounts/search-accounts.mjs +++ b/components/quickbooks/actions/search-accounts/search-accounts.mjs @@ -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 3863f0a2792b8..4cf5bf956bcfd 100644 --- a/components/quickbooks/actions/search-customers/search-customers.mjs +++ b/components/quickbooks/actions/search-customers/search-customers.mjs @@ -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/search-invoices/search-invoices.mjs b/components/quickbooks/actions/search-invoices/search-invoices.mjs index 850f55bbbfed7..82ea42a052a4e 100644 --- a/components/quickbooks/actions/search-invoices/search-invoices.mjs +++ b/components/quickbooks/actions/search-invoices/search-invoices.mjs @@ -55,22 +55,21 @@ export default { //Prepares OrderBy clause,start position, max results // parameters to be used in the request's query parameter. - var orderClause = ""; + let orderClause = ""; if (this.orderClause) { orderClause = ` ORDERBY ${this.orderClause}`; } - var startPosition = ""; + let startPosition = ""; if (this.startPosition) { startPosition = ` STARTPOSITION ${this.startPosition}`; } - var maxResults = ""; + let maxResults = ""; if (this.maxResults) { maxResults = ` MAXRESULTS ${this.maxResults}` || ""; } - //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 009489c4d628e..8ae7528c9dcca 100644 --- a/components/quickbooks/actions/search-items/search-items.mjs +++ b/components/quickbooks/actions/search-items/search-items.mjs @@ -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 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 cbe25d9e6f3a7..9bf85d66592ee 100644 --- a/components/quickbooks/actions/search-products/search-products.mjs +++ b/components/quickbooks/actions/search-products/search-products.mjs @@ -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 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..be7afa20a25d7 100644 --- a/components/quickbooks/actions/search-purchases/search-purchases.mjs +++ b/components/quickbooks/actions/search-purchases/search-purchases.mjs @@ -46,17 +46,17 @@ export default { whereClause = ` WHERE ${this.whereClause}`; } - 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}` || ""; } diff --git a/components/quickbooks/actions/search-services/search-services.mjs b/components/quickbooks/actions/search-services/search-services.mjs index 1d1360621a25f..369c1b4855465 100644 --- a/components/quickbooks/actions/search-services/search-services.mjs +++ b/components/quickbooks/actions/search-services/search-services.mjs @@ -1,4 +1,5 @@ import quickbooks from "../../quickbooks.app.mjs"; +import { ConfigurationError } from "@pipedream/platform"; export default { key: "quickbooks-search-services", @@ -49,20 +50,20 @@ export default { }, async run({ $ }) { if (!this.include_clause || !this.where_clause) { - throw new Error("Must provide include_clause, where_clause parameters."); + throw new ConfigurationError("Must provide include_clause, where_clause parameters."); } - var orderClause = ""; + let orderClause = ""; if (this.order_clause) { orderClause = ` ORDERBY ${this.order_clause}`; } - var startPosition = ""; + let startPosition = ""; if (this.start_position) { startPosition = ` STARTPOSITION ${this.start_position}`; } - var maxResults = ""; + let maxResults = ""; if (this.max_results) { maxResults = ` MAXRESULTS ${this.max_results}` || ""; } 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 0aa56d8c7e987..2cd6c66f30268 100644 --- a/components/quickbooks/actions/search-time-activities/search-time-activities.mjs +++ b/components/quickbooks/actions/search-time-activities/search-time-activities.mjs @@ -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 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 4d1edf2acc9f5..f4115c13229f7 100644 --- a/components/quickbooks/actions/search-vendors/search-vendors.mjs +++ b/components/quickbooks/actions/search-vendors/search-vendors.mjs @@ -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 Vendor where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; const response = await this.quickbooks.query({ From 4b0016bf6c013dcb281e123a275a7a3c87b5e6c8 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 21 Nov 2024 16:14:30 -0500 Subject: [PATCH 05/11] add async options --- .../actions/create-bill/create-bill.mjs | 6 +- .../actions/create-invoice/create-invoice.mjs | 7 +- .../actions/create-payment/create-payment.mjs | 7 +- .../create-purchase/create-purchase.mjs | 32 ++++---- .../delete-purchase/delete-purchase.mjs | 10 +-- .../quickbooks/actions/get-bill/get-bill.mjs | 7 +- .../actions/get-customer/get-customer.mjs | 7 +- .../actions/get-invoice/get-invoice.mjs | 8 +- .../get-purchase-order/get-purchase-order.mjs | 7 +- .../actions/get-purchase/get-purchase.mjs | 9 ++- .../get-sales-receipt/get-sales-receipt.mjs | 7 +- .../get-time-activity/get-time-activity.mjs | 7 +- .../search-invoices/search-invoices.mjs | 23 +++--- .../actions/search-items/search-items.mjs | 21 +++-- .../search-products/search-products.mjs | 21 +++-- .../search-purchases/search-purchases.mjs | 30 +++---- .../search-services/search-services.mjs | 21 +++-- .../search-time-activities.mjs | 21 +++-- .../actions/search-vendors/search-vendors.mjs | 21 +++-- .../update-customer/update-customer.mjs | 11 +-- components/quickbooks/quickbooks.app.mjs | 79 +++++++++++++++++++ 21 files changed, 217 insertions(+), 145 deletions(-) diff --git a/components/quickbooks/actions/create-bill/create-bill.mjs b/components/quickbooks/actions/create-bill/create-bill.mjs index 3be36a36fd4d7..d9fe37f9f3970 100644 --- a/components/quickbooks/actions/create-bill/create-bill.mjs +++ b/components/quickbooks/actions/create-bill/create-bill.mjs @@ -10,8 +10,12 @@ export default { 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-invoice/create-invoice.mjs b/components/quickbooks/actions/create-invoice/create-invoice.mjs index 72dd5aed7c3e4..3cf0cce381fd9 100644 --- a/components/quickbooks/actions/create-invoice/create-invoice.mjs +++ b/components/quickbooks/actions/create-invoice/create-invoice.mjs @@ -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 2321f5fc1430e..4404ff82dc8bd 100644 --- a/components/quickbooks/actions/create-payment/create-payment.mjs +++ b/components/quickbooks/actions/create-payment/create-payment.mjs @@ -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-purchase/create-purchase.mjs b/components/quickbooks/actions/create-purchase/create-purchase.mjs index 8400451ef725d..ffb0db0e4d701 100644 --- a/components/quickbooks/actions/create-purchase/create-purchase.mjs +++ b/components/quickbooks/actions/create-purchase/create-purchase.mjs @@ -10,8 +10,12 @@ export default { 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,22 +41,22 @@ 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({ $ }) { diff --git a/components/quickbooks/actions/delete-purchase/delete-purchase.mjs b/components/quickbooks/actions/delete-purchase/delete-purchase.mjs index 74bc04d2d29aa..afa3c5a275171 100644 --- a/components/quickbooks/actions/delete-purchase/delete-purchase.mjs +++ b/components/quickbooks/actions/delete-purchase/delete-purchase.mjs @@ -14,11 +14,11 @@ export default { "purchaseId", ], }, - minorversion: { - label: "Minor Version", - type: "string", - description: "Use the minorversion query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company//journalentry/entityId?minorversion=1`", - optional: true, + minorVersion: { + propDefinition: [ + quickbooks, + "minorVersion", + ], }, }, async run({ $ }) { diff --git a/components/quickbooks/actions/get-bill/get-bill.mjs b/components/quickbooks/actions/get-bill/get-bill.mjs index 08b5dc5d770d3..b6c0259ddf81f 100644 --- a/components/quickbooks/actions/get-bill/get-bill.mjs +++ b/components/quickbooks/actions/get-bill/get-bill.mjs @@ -10,9 +10,10 @@ export default { 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 3c95809cf39a5..92b0af02ea0bd 100644 --- a/components/quickbooks/actions/get-customer/get-customer.mjs +++ b/components/quickbooks/actions/get-customer/get-customer.mjs @@ -10,9 +10,10 @@ export default { 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 f6e5c2b4185cd..353771d5b2c3c 100644 --- a/components/quickbooks/actions/get-invoice/get-invoice.mjs +++ b/components/quickbooks/actions/get-invoice/get-invoice.mjs @@ -10,10 +10,10 @@ export default { 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-purchase-order/get-purchase-order.mjs b/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs index 170f748db7d0f..e152daea54558 100644 --- a/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs +++ b/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs @@ -10,9 +10,10 @@ export default { 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 de50f8bd32a3e..899a94fcc975d 100644 --- a/components/quickbooks/actions/get-purchase/get-purchase.mjs +++ b/components/quickbooks/actions/get-purchase/get-purchase.mjs @@ -10,9 +10,10 @@ export default { 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 2c3dbbca67a90..ec71a3156e0cb 100644 --- a/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs +++ b/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs @@ -10,9 +10,10 @@ export default { 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 756c4add8a764..b19cabf0772a6 100644 --- a/components/quickbooks/actions/get-time-activity/get-time-activity.mjs +++ b/components/quickbooks/actions/get-time-activity/get-time-activity.mjs @@ -10,9 +10,10 @@ export default { 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-invoices/search-invoices.mjs b/components/quickbooks/actions/search-invoices/search-invoices.mjs index 82ea42a052a4e..fbc54cdd957f2 100644 --- a/components/quickbooks/actions/search-invoices/search-invoices.mjs +++ b/components/quickbooks/actions/search-invoices/search-invoices.mjs @@ -53,22 +53,17 @@ 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. - let orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - let startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; - let maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; const query = `select ${this.includeClause} from Invoice where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; diff --git a/components/quickbooks/actions/search-items/search-items.mjs b/components/quickbooks/actions/search-items/search-items.mjs index 8ae7528c9dcca..a9cc83fa7c9a8 100644 --- a/components/quickbooks/actions/search-items/search-items.mjs +++ b/components/quickbooks/actions/search-items/search-items.mjs @@ -53,20 +53,17 @@ export default { throw new ConfigurationError("Must provide includeClause, whereClause parameters."); } - let orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - let startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; - let maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; const query = `select ${this.includeClause} from Item where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; diff --git a/components/quickbooks/actions/search-products/search-products.mjs b/components/quickbooks/actions/search-products/search-products.mjs index 9bf85d66592ee..4db7a0472e3e3 100644 --- a/components/quickbooks/actions/search-products/search-products.mjs +++ b/components/quickbooks/actions/search-products/search-products.mjs @@ -53,20 +53,17 @@ export default { throw new ConfigurationError("Must provide includeClause, whereClause parameters."); } - let orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - let startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; - let maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; const query = `select ${this.includeClause} from Item where Type = 'Inventory' and ${this.whereClause}${orderClause}${startPosition}${maxResults}`; diff --git a/components/quickbooks/actions/search-purchases/search-purchases.mjs b/components/quickbooks/actions/search-purchases/search-purchases.mjs index be7afa20a25d7..b66c7694d63d8 100644 --- a/components/quickbooks/actions/search-purchases/search-purchases.mjs +++ b/components/quickbooks/actions/search-purchases/search-purchases.mjs @@ -41,26 +41,22 @@ export default { }, }, async run({ $ }) { - let whereClause = ""; - if (this.whereClause) { - whereClause = ` WHERE ${this.whereClause}`; - } + const whereClause = this.whereClause + ? ` WHERE ${this.whereClause}` + : ""; - let orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - let startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; + + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; - let 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-services/search-services.mjs b/components/quickbooks/actions/search-services/search-services.mjs index 369c1b4855465..e1b61476b2f08 100644 --- a/components/quickbooks/actions/search-services/search-services.mjs +++ b/components/quickbooks/actions/search-services/search-services.mjs @@ -53,20 +53,17 @@ export default { throw new ConfigurationError("Must provide include_clause, where_clause parameters."); } - let orderClause = ""; - if (this.order_clause) { - orderClause = ` ORDERBY ${this.order_clause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - let startPosition = ""; - if (this.start_position) { - startPosition = ` STARTPOSITION ${this.start_position}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; - let maxResults = ""; - if (this.max_results) { - maxResults = ` MAXRESULTS ${this.max_results}` || ""; - } + 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}`; 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 2cd6c66f30268..c02bcd127c026 100644 --- a/components/quickbooks/actions/search-time-activities/search-time-activities.mjs +++ b/components/quickbooks/actions/search-time-activities/search-time-activities.mjs @@ -53,20 +53,17 @@ export default { throw new ConfigurationError("Must provide includeClause, whereClause parameters."); } - let orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - let startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; - let maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; const query = `select ${this.includeClause} from TimeActivity where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; diff --git a/components/quickbooks/actions/search-vendors/search-vendors.mjs b/components/quickbooks/actions/search-vendors/search-vendors.mjs index f4115c13229f7..c79a12bc2c83f 100644 --- a/components/quickbooks/actions/search-vendors/search-vendors.mjs +++ b/components/quickbooks/actions/search-vendors/search-vendors.mjs @@ -53,20 +53,17 @@ export default { throw new ConfigurationError("Must provide includeClause, whereClause parameters."); } - let orderClause = ""; - if (this.orderClause) { - orderClause = ` ORDERBY ${this.orderClause}`; - } + const orderClause = this.orderClause + ? ` ORDERBY ${this.orderClause}` + : ""; - let startPosition = ""; - if (this.startPosition) { - startPosition = ` STARTPOSITION ${this.startPosition}`; - } + const startPosition = this.startPosition + ? ` STARTPOSITION ${this.startPosition}` + : ""; - let maxResults = ""; - if (this.maxResults) { - maxResults = ` MAXRESULTS ${this.maxResults}` || ""; - } + const maxResults = this.maxResults + ? ` MAXRESULTS ${this.maxResults}` + : ""; const query = `select ${this.includeClause} from Vendor where ${this.whereClause}${orderClause}${startPosition}${maxResults}`; diff --git a/components/quickbooks/actions/update-customer/update-customer.mjs b/components/quickbooks/actions/update-customer/update-customer.mjs index 76e03b2209653..22de4309589f9 100644 --- a/components/quickbooks/actions/update-customer/update-customer.mjs +++ b/components/quickbooks/actions/update-customer/update-customer.mjs @@ -9,6 +9,12 @@ export default { 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/quickbooks.app.mjs b/components/quickbooks/quickbooks.app.mjs index eee151752eec1..f178f3776a637 100644 --- a/components/quickbooks/quickbooks.app.mjs +++ b/components/quickbooks/quickbooks.app.mjs @@ -364,6 +364,85 @@ export default { })) || []; }, }, + billId: { + type: "string", + label: "Bill Id", + description: "The identifier of a bill", + async options({ page }) { + const position = 1 + (page * 10); + const { QueryResponse: { Bill: bills } } = await this.query({ + params: { + query: `select * from bill maxresults 10 ${page + ? `startposition ${position}` + : ""} `, + }, + }); + return bills?.map(({ Id: id }) => id ) || []; + }, + }, + purchaseOrderId: { + type: "string", + label: "Item Id", + description: "The identifier of a purchase order", + async options({ page }) { + const position = 1 + (page * 10); + const { QueryResponse: { PurchaseOrder: purchaseOrders } } = await this.query({ + params: { + query: `select * from purchaseorder maxresults 10 ${page + ? `startposition ${position}` + : ""} `, + }, + }); + return purchaseOrders?.map(({ + Id: value, DocNumber, + }) => ({ + value, + label: DocNumber ?? value, + })) || []; + }, + }, + salesReceiptId: { + type: "string", + label: "Sales Receipt Id", + description: "The identifier of a sales receipt", + async options({ page }) { + const position = 1 + (page * 10); + const { QueryResponse: { SalesReceipt: salesReceipts } } = await this.query({ + params: { + query: `select * from salesreceipt maxresults 10 ${page + ? `startposition ${position}` + : ""} `, + }, + }); + return salesReceipts?.map(({ + Id: value, DocNumber, + }) => ({ + value, + label: DocNumber ?? value, + })) || []; + }, + }, + timeActivityId: { + type: "string", + label: "Time Activity Id", + description: "The identifier of a time activity", + async options({ page }) { + const position = 1 + (page * 10); + const { QueryResponse: { TimeActivity: timeActivities } } = await this.query({ + params: { + query: `select * from timeactivity maxresults 10 ${page + ? `startposition ${position}` + : ""} `, + }, + }); + return timeActivities?.map(({ + Id: value, NameOf: nameOf, Description: description, + }) => ({ + value, + label: `${nameOf} ${description}`, + })) || []; + }, + }, }, methods: { _companyId() { From 1fec87f47a54f9af6b41ee08113a2d2ae2c5652a Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 21 Nov 2024 16:55:17 -0500 Subject: [PATCH 06/11] refactor props --- components/quickbooks/quickbooks.app.mjs | 345 ++++++++++------------- 1 file changed, 146 insertions(+), 199 deletions(-) diff --git a/components/quickbooks/quickbooks.app.mjs b/components/quickbooks/quickbooks.app.mjs index f178f3776a637..d86b9fe8b05ae 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: { @@ -172,21 +154,16 @@ export default { 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,16 @@ 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, + }), }); - return departments?.map(({ - Id: value, Name: label, - }) => ({ - value, - label, - })) || []; }, }, itemId: { @@ -348,20 +301,16 @@ export default { label: "Item Id", description: "The identifier of an item", async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Item: items } } = await this.query({ - params: { - query: `select * from item maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, + return this.getPropOptions({ + page, + resource: "Item", + mapper: ({ + Id: value, Name: label, + }) => ({ + value, + label, + }), }); - return items?.map(({ - Id: value, Name: label, - }) => ({ - value, - label, - })) || []; }, }, billId: { @@ -369,15 +318,11 @@ export default { label: "Bill Id", description: "The identifier of a bill", async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { Bill: bills } } = await this.query({ - params: { - query: `select * from bill maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, + return this.getPropOptions({ + page, + resource: "Bill", + mapper: ({ Id: id }) => id, }); - return bills?.map(({ Id: id }) => id ) || []; }, }, purchaseOrderId: { @@ -385,20 +330,16 @@ export default { label: "Item Id", description: "The identifier of a purchase order", async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { PurchaseOrder: purchaseOrders } } = await this.query({ - params: { - query: `select * from purchaseorder maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, + return this.getPropOptions({ + page, + resource: "PurchaseOrder", + mapper: ({ + Id: value, DocNumber, + }) => ({ + value, + label: DocNumber ?? value, + }), }); - return purchaseOrders?.map(({ - Id: value, DocNumber, - }) => ({ - value, - label: DocNumber ?? value, - })) || []; }, }, salesReceiptId: { @@ -406,20 +347,16 @@ export default { label: "Sales Receipt Id", description: "The identifier of a sales receipt", async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { SalesReceipt: salesReceipts } } = await this.query({ - params: { - query: `select * from salesreceipt maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, + return this.getPropOptions({ + page, + resource: "SalesReceipt", + mapper: ({ + Id: value, DocNumber, + }) => ({ + value, + label: DocNumber ?? value, + }), }); - return salesReceipts?.map(({ - Id: value, DocNumber, - }) => ({ - value, - label: DocNumber ?? value, - })) || []; }, }, timeActivityId: { @@ -427,20 +364,16 @@ export default { label: "Time Activity Id", description: "The identifier of a time activity", async options({ page }) { - const position = 1 + (page * 10); - const { QueryResponse: { TimeActivity: timeActivities } } = await this.query({ - params: { - query: `select * from timeactivity maxresults 10 ${page - ? `startposition ${position}` - : ""} `, - }, + return this.getPropOptions({ + page, + resource: "TimeActivity", + mapper: ({ + Id: value, NameOf: nameOf, Description: description, + }) => ({ + value, + label: `${nameOf} ${description}`, + }), }); - return timeActivities?.map(({ - Id: value, NameOf: nameOf, Description: description, - }) => ({ - value, - label: `${nameOf} ${description}`, - })) || []; }, }, }, @@ -471,6 +404,20 @@ export default { }; return await retryWithExponentialBackoff(requestFn); }, + async getPropOptions({ + page, resource, mapper, + }) { + 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`, From 3917f8dd7f7bcc2f93cca5e44d832169339f87d7 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 21 Nov 2024 16:58:18 -0500 Subject: [PATCH 07/11] pnpm-lock.yaml --- pnpm-lock.yaml | 3 +++ 1 file changed, 3 insertions(+) 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 From 27272a3750f4e15977e198e7a120b47afed91914 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 21 Nov 2024 17:10:02 -0500 Subject: [PATCH 08/11] update versions --- .../actions/create-ap-aging-report/create-ap-aging-report.mjs | 2 +- components/quickbooks/actions/create-bill/create-bill.mjs | 2 +- .../quickbooks/actions/create-customer/create-customer.mjs | 2 +- components/quickbooks/actions/create-invoice/create-invoice.mjs | 2 +- components/quickbooks/actions/create-payment/create-payment.mjs | 2 +- .../quickbooks/actions/create-pl-report/create-pl-report.mjs | 2 +- .../quickbooks/actions/create-purchase/create-purchase.mjs | 2 +- .../actions/create-sales-receipt/create-sales-receipt.mjs | 2 +- .../quickbooks/actions/delete-purchase/delete-purchase.mjs | 2 +- components/quickbooks/actions/get-bill/get-bill.mjs | 2 +- components/quickbooks/actions/get-customer/get-customer.mjs | 2 +- components/quickbooks/actions/get-invoice/get-invoice.mjs | 2 +- components/quickbooks/actions/get-my-company/get-my-company.mjs | 2 +- .../actions/get-purchase-order/get-purchase-order.mjs | 2 +- components/quickbooks/actions/get-purchase/get-purchase.mjs | 2 +- .../quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs | 2 +- .../quickbooks/actions/get-time-activity/get-time-activity.mjs | 2 +- .../quickbooks/actions/search-accounts/search-accounts.mjs | 2 +- .../quickbooks/actions/search-customers/search-customers.mjs | 2 +- .../quickbooks/actions/search-invoices/search-invoices.mjs | 2 +- components/quickbooks/actions/search-items/search-items.mjs | 2 +- .../quickbooks/actions/search-products/search-products.mjs | 2 +- .../quickbooks/actions/search-purchases/search-purchases.mjs | 2 +- components/quickbooks/actions/search-query/search-query.mjs | 2 +- .../actions/search-time-activities/search-time-activities.mjs | 2 +- components/quickbooks/actions/search-vendors/search-vendors.mjs | 2 +- .../actions/sparse-update-invoice/sparse-update-invoice.mjs | 2 +- .../quickbooks/actions/update-customer/update-customer.mjs | 2 +- .../sources/new-customer-created/new-customer-created.mjs | 2 +- .../sources/new-customer-updated/new-customer-updated.mjs | 2 +- .../sources/new-invoice-created/new-invoice-created.mjs | 2 +- .../sources/new-invoice-updated/new-invoice-updated.mjs | 2 +- .../quickbooks/sources/new-item-created/new-item-created.mjs | 2 +- .../quickbooks/sources/new-item-updated/new-item-updated.mjs | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) 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 d9fe37f9f3970..5e2160540f274 100644 --- a/components/quickbooks/actions/create-bill/create-bill.mjs +++ b/components/quickbooks/actions/create-bill/create-bill.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-create-bill", name: "Create Bill", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/create-customer/create-customer.mjs b/components/quickbooks/actions/create-customer/create-customer.mjs index 0f6c4ff8d4e94..5f84441dc41a0 100644 --- a/components/quickbooks/actions/create-customer/create-customer.mjs +++ b/components/quickbooks/actions/create-customer/create-customer.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-create-customer", name: "Create Customer", 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.6", + 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 3cf0cce381fd9..36a0c5d1d0650 100644 --- a/components/quickbooks/actions/create-invoice/create-invoice.mjs +++ b/components/quickbooks/actions/create-invoice/create-invoice.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-create-invoice", name: "Create Invoice", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/create-payment/create-payment.mjs b/components/quickbooks/actions/create-payment/create-payment.mjs index 4404ff82dc8bd..ba0c30b1c9169 100644 --- a/components/quickbooks/actions/create-payment/create-payment.mjs +++ b/components/quickbooks/actions/create-payment/create-payment.mjs @@ -4,7 +4,7 @@ export default { key: "quickbooks-create-payment", name: "Create Payment", 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.5", + version: "0.0.6", type: "action", props: { quickbooks, 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 ffb0db0e4d701..4c585b6b3b0e5 100644 --- a/components/quickbooks/actions/create-purchase/create-purchase.mjs +++ b/components/quickbooks/actions/create-purchase/create-purchase.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-create-purchase", name: "Create Purchase", 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.4", + version: "0.0.5", type: "action", props: { quickbooks, 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 afa3c5a275171..ba6b7c71cb54a 100644 --- a/components/quickbooks/actions/delete-purchase/delete-purchase.mjs +++ b/components/quickbooks/actions/delete-purchase/delete-purchase.mjs @@ -4,7 +4,7 @@ export default { key: "quickbooks-delete-purchase", name: "Delete Purchase", 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.4", + version: "0.0.5", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/get-bill/get-bill.mjs b/components/quickbooks/actions/get-bill/get-bill.mjs index b6c0259ddf81f..0fce44cd4fe53 100644 --- a/components/quickbooks/actions/get-bill/get-bill.mjs +++ b/components/quickbooks/actions/get-bill/get-bill.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-get-bill", name: "Get Bill", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/get-customer/get-customer.mjs b/components/quickbooks/actions/get-customer/get-customer.mjs index 92b0af02ea0bd..190046788266b 100644 --- a/components/quickbooks/actions/get-customer/get-customer.mjs +++ b/components/quickbooks/actions/get-customer/get-customer.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-get-customer", name: "Get Customer", 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.6", + version: "0.3.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/get-invoice/get-invoice.mjs b/components/quickbooks/actions/get-invoice/get-invoice.mjs index 353771d5b2c3c..26f8145d70ab4 100644 --- a/components/quickbooks/actions/get-invoice/get-invoice.mjs +++ b/components/quickbooks/actions/get-invoice/get-invoice.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-get-invoice", name: "Get Invoice", 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.7", + version: "0.2.8", type: "action", props: { quickbooks, 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 cbd19efdbe294..7a2a44887c548 100644 --- a/components/quickbooks/actions/get-my-company/get-my-company.mjs +++ b/components/quickbooks/actions/get-my-company/get-my-company.mjs @@ -4,7 +4,7 @@ export default { key: "quickbooks-get-my-company", name: "Get My Company", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, 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 e152daea54558..90d7ca3c57ccf 100644 --- a/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs +++ b/components/quickbooks/actions/get-purchase-order/get-purchase-order.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-get-purchase-order", name: "Get Purchase Order", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/get-purchase/get-purchase.mjs b/components/quickbooks/actions/get-purchase/get-purchase.mjs index 899a94fcc975d..3cf88468da4b8 100644 --- a/components/quickbooks/actions/get-purchase/get-purchase.mjs +++ b/components/quickbooks/actions/get-purchase/get-purchase.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-get-purchase", name: "Get Purchase", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, 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 ec71a3156e0cb..11ae01381ca61 100644 --- a/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs +++ b/components/quickbooks/actions/get-sales-receipt/get-sales-receipt.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-get-sales-receipt", name: "Get Sales Receipt", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, 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 b19cabf0772a6..27170910b05c5 100644 --- a/components/quickbooks/actions/get-time-activity/get-time-activity.mjs +++ b/components/quickbooks/actions/get-time-activity/get-time-activity.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-get-time-activity", name: "Get Time Activity", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/search-accounts/search-accounts.mjs b/components/quickbooks/actions/search-accounts/search-accounts.mjs index 263ac46b154ee..015084b87f94c 100644 --- a/components/quickbooks/actions/search-accounts/search-accounts.mjs +++ b/components/quickbooks/actions/search-accounts/search-accounts.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-search-accounts", name: "Search Accounts", 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.6", + version: "0.2.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/search-customers/search-customers.mjs b/components/quickbooks/actions/search-customers/search-customers.mjs index 4cf5bf956bcfd..6836ae8741486 100644 --- a/components/quickbooks/actions/search-customers/search-customers.mjs +++ b/components/quickbooks/actions/search-customers/search-customers.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-search-customers", name: "Search Customers", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/search-invoices/search-invoices.mjs b/components/quickbooks/actions/search-invoices/search-invoices.mjs index fbc54cdd957f2..2882011ac4685 100644 --- a/components/quickbooks/actions/search-invoices/search-invoices.mjs +++ b/components/quickbooks/actions/search-invoices/search-invoices.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-search-invoices", name: "Search Invoices", description: "Searches for invoices. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#query-an-invoice)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/search-items/search-items.mjs b/components/quickbooks/actions/search-items/search-items.mjs index a9cc83fa7c9a8..90413e3aaccdf 100644 --- a/components/quickbooks/actions/search-items/search-items.mjs +++ b/components/quickbooks/actions/search-items/search-items.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-search-items", name: "Search Items", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/search-products/search-products.mjs b/components/quickbooks/actions/search-products/search-products.mjs index 4db7a0472e3e3..8c3b34fee1d9d 100644 --- a/components/quickbooks/actions/search-products/search-products.mjs +++ b/components/quickbooks/actions/search-products/search-products.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-search-products", name: "Search Products", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/search-purchases/search-purchases.mjs b/components/quickbooks/actions/search-purchases/search-purchases.mjs index b66c7694d63d8..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, diff --git a/components/quickbooks/actions/search-query/search-query.mjs b/components/quickbooks/actions/search-query/search-query.mjs index d54c48680cc60..3b405f6cbf2d0 100644 --- a/components/quickbooks/actions/search-query/search-query.mjs +++ b/components/quickbooks/actions/search-query/search-query.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-search-query", name: "Search Query", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, 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 c02bcd127c026..2fd889604188e 100644 --- a/components/quickbooks/actions/search-time-activities/search-time-activities.mjs +++ b/components/quickbooks/actions/search-time-activities/search-time-activities.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-search-time-activities", name: "Search Time Activities", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, diff --git a/components/quickbooks/actions/search-vendors/search-vendors.mjs b/components/quickbooks/actions/search-vendors/search-vendors.mjs index c79a12bc2c83f..0fd23852b224d 100644 --- a/components/quickbooks/actions/search-vendors/search-vendors.mjs +++ b/components/quickbooks/actions/search-vendors/search-vendors.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-search-vendors", name: "Search Vendors", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, 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 695e4eb636073..be716b6c7d334 100644 --- a/components/quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs +++ b/components/quickbooks/actions/sparse-update-invoice/sparse-update-invoice.mjs @@ -6,7 +6,7 @@ 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 the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#sparse-update-an-invoice)", - version: "0.1.4", + 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 22de4309589f9..512dcac4e5205 100644 --- a/components/quickbooks/actions/update-customer/update-customer.mjs +++ b/components/quickbooks/actions/update-customer/update-customer.mjs @@ -5,7 +5,7 @@ export default { key: "quickbooks-update-customer", name: "Update Customer", 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.6", + version: "0.1.7", type: "action", props: { quickbooks, 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 9a8bb766a1aa3..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: { 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 84c4817515440..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: { 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 d234c78995cc1..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: { 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 adcdf4db7d249..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: { 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: { From 52adecd16664a5820158eaf3e857479bbf4c0cfe Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 21 Nov 2024 17:29:26 -0500 Subject: [PATCH 09/11] fixes --- .../actions/delete-purchase/delete-purchase.mjs | 4 ++-- components/quickbooks/actions/update-item/update-item.mjs | 8 ++++---- components/quickbooks/quickbooks.app.mjs | 2 +- components/quickbooks_sandbox/quickbooks_sandbox.app.mjs | 2 +- .../sources/new-customer-created/new-customer-created.mjs | 6 +++--- .../sources/new-customer-updated/new-customer-updated.mjs | 6 +++--- .../sources/new-invoice-created/new-invoice-created.mjs | 6 +++--- .../sources/new-invoice-updated/new-invoice-updated.mjs | 6 +++--- .../sources/new-item-created/new-item-created.mjs | 6 +++--- .../sources/new-item-updated/new-item-updated.mjs | 6 +++--- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/components/quickbooks/actions/delete-purchase/delete-purchase.mjs b/components/quickbooks/actions/delete-purchase/delete-purchase.mjs index ba6b7c71cb54a..0be20dcff973e 100644 --- a/components/quickbooks/actions/delete-purchase/delete-purchase.mjs +++ b/components/quickbooks/actions/delete-purchase/delete-purchase.mjs @@ -25,7 +25,7 @@ export default { 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/update-item/update-item.mjs b/components/quickbooks/actions/update-item/update-item.mjs index db51fbe3f73a8..6a75896b094f7 100644 --- a/components/quickbooks/actions/update-item/update-item.mjs +++ b/components/quickbooks/actions/update-item/update-item.mjs @@ -2,7 +2,7 @@ import quickbooks from "../../quickbooks.app.mjs"; import { ConfigurationError } from "@pipedream/platform"; export default { - key: "quickbooks_sandbox-update-item", + 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", @@ -102,7 +102,7 @@ export default { optional: true, }, salesTaxIncluded: { - type: "string", + 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, @@ -339,7 +339,7 @@ export default { }, }; - if (this.prefVendorRefValue || this.parentRefName) { + if (this.parentRefValue || this.parentRefName) { data["ParentRef"] = { value: this.parentRefValue, name: this.parentRefName, @@ -350,7 +350,7 @@ export default { $, data, params: { - minorversion: this.minorversion, + minorversion: this.minorVersion, }, }); diff --git a/components/quickbooks/quickbooks.app.mjs b/components/quickbooks/quickbooks.app.mjs index d86b9fe8b05ae..55d74558f571e 100644 --- a/components/quickbooks/quickbooks.app.mjs +++ b/components/quickbooks/quickbooks.app.mjs @@ -327,7 +327,7 @@ export default { }, purchaseOrderId: { type: "string", - label: "Item Id", + label: "Purchase Order Id", description: "The identifier of a purchase order", async options({ page }) { return this.getPropOptions({ diff --git a/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs b/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs index 80cf5c066d291..c1ee8dd8f6498 100644 --- a/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs +++ b/components/quickbooks_sandbox/quickbooks_sandbox.app.mjs @@ -5,7 +5,7 @@ export default { type: "app", app: "quickbooks_sandbox", methods: { - ...common.mehtods, + ...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 index b3b6adadb9404..5e49436884362 100644 --- a/components/quickbooks_sandbox/sources/new-customer-created/new-customer-created.mjs +++ b/components/quickbooks_sandbox/sources/new-customer-created/new-customer-created.mjs @@ -1,5 +1,5 @@ -import app from "../../monday_oauth.app.mjs"; -import common from "../../../monday/sources/new-customer-created/new-customer-created.mjs"; +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"; @@ -16,7 +16,7 @@ export default { description, type, props: { - monday: app, + 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 index b6d8ce2dc3a14..1a29d984d3675 100644 --- a/components/quickbooks_sandbox/sources/new-customer-updated/new-customer-updated.mjs +++ b/components/quickbooks_sandbox/sources/new-customer-updated/new-customer-updated.mjs @@ -1,5 +1,5 @@ -import app from "../../monday_oauth.app.mjs"; -import common from "../../../monday/sources/new-customer-updated/new-customer-updated.mjs"; +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"; @@ -16,7 +16,7 @@ export default { description, type, props: { - monday: app, + 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 index 755104c6d78cf..e569f8efce424 100644 --- a/components/quickbooks_sandbox/sources/new-invoice-created/new-invoice-created.mjs +++ b/components/quickbooks_sandbox/sources/new-invoice-created/new-invoice-created.mjs @@ -1,5 +1,5 @@ -import app from "../../monday_oauth.app.mjs"; -import common from "../../../monday/sources/new-invoice-created/new-invoice-created.mjs"; +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"; @@ -16,7 +16,7 @@ export default { description, type, props: { - monday: app, + 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 index db858e8a82fbd..11082efbf92a5 100644 --- a/components/quickbooks_sandbox/sources/new-invoice-updated/new-invoice-updated.mjs +++ b/components/quickbooks_sandbox/sources/new-invoice-updated/new-invoice-updated.mjs @@ -1,5 +1,5 @@ -import app from "../../monday_oauth.app.mjs"; -import common from "../../../monday/sources/new-invoice-updated/new-invoice-updated.mjs"; +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"; @@ -16,7 +16,7 @@ export default { description, type, props: { - monday: app, + 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 index 0f7fd105304ee..a255e518526cf 100644 --- a/components/quickbooks_sandbox/sources/new-item-created/new-item-created.mjs +++ b/components/quickbooks_sandbox/sources/new-item-created/new-item-created.mjs @@ -1,5 +1,5 @@ -import app from "../../monday_oauth.app.mjs"; -import common from "../../../monday/sources/new-item-created/new-item-created.mjs"; +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"; @@ -16,7 +16,7 @@ export default { description, type, props: { - monday: app, + 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 index bcf3aacf648eb..9551cc13c1181 100644 --- a/components/quickbooks_sandbox/sources/new-item-updated/new-item-updated.mjs +++ b/components/quickbooks_sandbox/sources/new-item-updated/new-item-updated.mjs @@ -1,5 +1,5 @@ -import app from "../../monday_oauth.app.mjs"; -import common from "../../../monday/sources/new-item-updated/new-item-updated.mjs"; +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"; @@ -16,7 +16,7 @@ export default { description, type, props: { - monday: app, + quickbooks: app, ...props, }, }; From 92a5c92f348eb6ed17ed7c15c425e70cbcb2f11f Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 21 Nov 2024 17:42:22 -0500 Subject: [PATCH 10/11] fix path --- .../actions/create-pl-report/create-pl-report.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index b9c67c97dcdfd..5c1102af61302 100644 --- a/components/quickbooks_sandbox/actions/create-pl-report/create-pl-report.mjs +++ b/components/quickbooks_sandbox/actions/create-pl-report/create-pl-report.mjs @@ -1,5 +1,5 @@ import app from "../../quickbooks_sandbox.app.mjs"; -import common from "../../../quickbooks/actions/create-plreport/create-pl-report.mjs"; +import common from "../../../quickbooks/actions/create-pl-report/create-pl-report.mjs"; import { adjustPropDefinitions } from "../../common/utils.mjs"; From 01761c2870d7b5c3bbdbb5149cbd856a14f13f90 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Fri, 22 Nov 2024 15:29:18 -0500 Subject: [PATCH 11/11] add get-payment --- .../actions/get-payment/get-payment.mjs | 44 +++++++++++++++++++ components/quickbooks/quickbooks.app.mjs | 27 +++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 components/quickbooks/actions/get-payment/get-payment.mjs 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/quickbooks.app.mjs b/components/quickbooks/quickbooks.app.mjs index 55d74558f571e..42461d42fa4eb 100644 --- a/components/quickbooks/quickbooks.app.mjs +++ b/components/quickbooks/quickbooks.app.mjs @@ -149,7 +149,7 @@ export default { optional: true, }, purchaseId: { - label: "purchase Id", + label: "Purchase Id", type: "string", description: "Id of the purchase.", withLabel: true, @@ -376,6 +376,23 @@ export default { }); }, }, + 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}`, + }), + }); + }, + }, }, methods: { _companyId() { @@ -535,6 +552,14 @@ export default { ...opts, }); }, + getPayment({ + paymentId, ...opts + }) { + return this._makeRequest({ + path: `company/${this._companyId()}/payment/${paymentId}`, + ...opts, + }); + }, query(opts = {}) { return this._makeRequest({ path: `company/${this._companyId()}/query`,