-
Notifications
You must be signed in to change notification settings - Fork 5.5k
feat(quickbooks): Add missing invoice, estimate, and purchase order actions #16908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
michelle0927
merged 11 commits into
PipedreamHQ:master
from
krikera:add-quickbooks-missing-actions
Jun 11, 2025
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c969b5c
feat(quickbooks): Add missing invoice, estimate, and purchase order a…
krikera 1009642
refactor(quickbooks): Improve code quality and address review feedbac…
krikera 98347b0
feat: add input validation and error handling to QuickBooks utilities…
krikera b4ab376
Merge branch 'master' into add-quickbooks-missing-actions
krikera 9dec00a
updates
michelle0927 11f850e
pnpm-lock.yaml
michelle0927 173e907
versions
michelle0927 b3f86da
update lineitems prop descriptions
michelle0927 cf16225
update address props
michelle0927 390c8a4
Merge remote-tracking branch 'upstream/master' into add-quickbooks-mi…
michelle0927 bc60bcf
pnpm-lock.yaml
michelle0927 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
205 changes: 205 additions & 0 deletions
205
components/quickbooks/actions/create-estimate/create-estimate.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import quickbooks from "../../quickbooks.app.mjs"; | ||
| import { | ||
| parseLineItems, | ||
| buildSalesLineItems, | ||
| parseObject, | ||
| } from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "quickbooks-create-estimate", | ||
| name: "Create Estimate", | ||
| description: "Creates an estimate. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/estimate#create-an-estimate)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| quickbooks, | ||
| customerRefValue: { | ||
| propDefinition: [ | ||
| quickbooks, | ||
| "customer", | ||
| ], | ||
| }, | ||
| billEmail: { | ||
| type: "string", | ||
| label: "Bill Email", | ||
| description: "Email address where the estimate should be sent", | ||
| optional: true, | ||
| }, | ||
| expirationDate: { | ||
| type: "string", | ||
| label: "Expiration Date", | ||
| description: "Date when the estimate expires (YYYY-MM-DD)", | ||
| optional: true, | ||
| }, | ||
| acceptedBy: { | ||
| type: "string", | ||
| label: "Accepted By", | ||
| description: "Name of the customer who accepted the estimate", | ||
| optional: true, | ||
| }, | ||
| acceptedDate: { | ||
| type: "string", | ||
| label: "Accepted Date", | ||
| description: "Date when the estimate was accepted (YYYY-MM-DD)", | ||
| optional: true, | ||
| }, | ||
| currencyRefValue: { | ||
| propDefinition: [ | ||
| quickbooks, | ||
| "currency", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| docNumber: { | ||
| type: "string", | ||
| label: "Document Number", | ||
| description: "Reference number for the transaction", | ||
| optional: true, | ||
| }, | ||
| billAddr: { | ||
| type: "object", | ||
| label: "Billing Address", | ||
| description: "Billing address details. Example: `{ \"Line1\": \"123 Elm St.\", \"City\": \"Springfield\", \"CountrySubDivisionCode\": \"IL\", \"PostalCode\": \"62701\" }`", | ||
| optional: true, | ||
| }, | ||
| shipAddr: { | ||
| type: "object", | ||
| label: "Shipping Address", | ||
| description: "Shipping address details. Example: `{ \"Line1\": \"456 Oak St.\", \"City\": \"Springfield\", \"CountrySubDivisionCode\": \"IL\", \"PostalCode\": \"62701\" }`", | ||
| optional: true, | ||
| }, | ||
| privateNote: { | ||
| type: "string", | ||
| label: "Private Note", | ||
| description: "Private note for internal use", | ||
| optional: true, | ||
| }, | ||
| customerMemo: { | ||
| type: "string", | ||
| label: "Customer Memo", | ||
| description: "Memo visible to customer", | ||
| optional: true, | ||
| }, | ||
| taxCodeId: { | ||
| propDefinition: [ | ||
| quickbooks, | ||
| "taxCodeId", | ||
| ], | ||
| }, | ||
| lineItemsAsObjects: { | ||
| propDefinition: [ | ||
| quickbooks, | ||
| "lineItemsAsObjects", | ||
| ], | ||
| reloadProps: true, | ||
| }, | ||
| }, | ||
| async additionalProps() { | ||
| const props = {}; | ||
| if (this.lineItemsAsObjects) { | ||
| props.lineItems = { | ||
| type: "string[]", | ||
| label: "Line Items", | ||
| description: "Line items of an estimate. Set DetailType to `SalesItemLineDetail`, `GroupLineDetail`, or `DescriptionOnly`. Example: `{ \"DetailType\": \"SalesItemLineDetail\", \"Amount\": 100.0, \"SalesItemLineDetail\": { \"ItemRef\": { \"name\": \"Services\", \"value\": \"1\" } } }`", | ||
| }; | ||
| return props; | ||
| } | ||
| props.numLineItems = { | ||
| type: "integer", | ||
| label: "Number of Line Items", | ||
| description: "The number of line items to enter", | ||
| reloadProps: true, | ||
| }; | ||
| if (!this.numLineItems) { | ||
| return props; | ||
| } | ||
| for (let i = 1; i <= this.numLineItems; i++) { | ||
| props[`item_${i}`] = { | ||
| type: "string", | ||
| label: `Line ${i} - Item ID`, | ||
| options: async ({ page }) => { | ||
| return this.quickbooks.getPropOptions({ | ||
| page, | ||
| resource: "Item", | ||
| mapper: ({ | ||
| Id: value, Name: label, | ||
| }) => ({ | ||
| value, | ||
| label, | ||
| }), | ||
| }); | ||
| }, | ||
| }; | ||
| props[`amount_${i}`] = { | ||
| type: "string", | ||
| label: `Line ${i} - Amount`, | ||
| }; | ||
| } | ||
| return props; | ||
| }, | ||
| methods: { | ||
| buildLineItems() { | ||
| return buildSalesLineItems(this.numLineItems, this); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| if ((!this.numLineItems && !this.lineItemsAsObjects) || !this.customerRefValue) { | ||
| throw new ConfigurationError("Must provide lineItems and customerRefValue parameters."); | ||
| } | ||
|
|
||
| const lines = this.lineItemsAsObjects | ||
| ? parseLineItems(this.lineItems) | ||
| : this.buildLineItems(); | ||
|
|
||
| lines.forEach((line, index) => { | ||
| if (line.DetailType !== "SalesItemLineDetail" && line.DetailType !== "GroupLineDetail" && line.DetailType !== "DescriptionOnly") { | ||
| throw new ConfigurationError(`Line Item at index ${index + 1} has invalid DetailType '${line.DetailType}'. Must be 'SalesItemLineDetail', 'GroupLineDetail', or 'DescriptionOnly'`); | ||
| } | ||
| }); | ||
|
|
||
| const params = {}; | ||
| const data = { | ||
| Line: lines, | ||
| CustomerRef: { | ||
| value: this.customerRefValue, | ||
| }, | ||
| ExpirationDate: this.expirationDate, | ||
| AcceptedBy: this.acceptedBy, | ||
| AcceptedDate: this.acceptedDate, | ||
| DocNumber: this.docNumber, | ||
| BillAddr: parseObject(this.billAddr), | ||
| ShipAddr: parseObject(this.shipAddr), | ||
| PrivateNote: this.privateNote, | ||
| }; | ||
|
|
||
| if (this.billEmail) { | ||
| params.include = "estimateLink"; | ||
| data.BillEmail = { | ||
| Address: this.billEmail, | ||
| }; | ||
| } | ||
| if (this.currencyRefValue) { | ||
| data.CurrencyRef = { | ||
| value: this.currencyRefValue, | ||
| }; | ||
| } | ||
| if (this.customerMemo) { | ||
| data.CustomerMemo = { | ||
| value: this.customerMemo, | ||
| }; | ||
| } | ||
|
|
||
| const response = await this.quickbooks.createEstimate({ | ||
| $, | ||
| params, | ||
| data, | ||
| }); | ||
|
|
||
| if (response) { | ||
| $.export("$summary", `Successfully created estimate with ID ${response.Estimate.Id}`); | ||
| } | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.