-
Notifications
You must be signed in to change notification settings - Fork 5.5k
18059 plentymarkets #18232
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
Merged
18059 plentymarkets #18232
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
32a4d13
Update PlentyONE component: Bump version to 0.1.0, add new actions fo…
luancazarine 93ab84c
pnpm update
luancazarine 313365e
Fix package.json formatting by adding a newline at the end of the file.
luancazarine 52ec33f
Add statusId prop definition to create-order action and implement get…
luancazarine 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
42 changes: 42 additions & 0 deletions
42
components/plentyone/actions/add-order-note/add-order-note.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,42 @@ | ||
| import plentyone from "../../plentyone.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "plentyone-add-order-note", | ||
| name: "Add Order Note", | ||
| description: "Adds a note to an order in PlentyONE. [See the documentation](https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Comment/post_rest_comments)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| plentyone, | ||
| orderId: { | ||
| propDefinition: [ | ||
| plentyone, | ||
| "orderId", | ||
| ], | ||
| }, | ||
| text: { | ||
| type: "string", | ||
| label: "Note Text", | ||
| description: "The text of the note to add.", | ||
| }, | ||
| isVisibleForContact: { | ||
| type: "boolean", | ||
| label: "Is Visible for Contact", | ||
| description: "Whether the note is visible to the contact.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.plentyone.addOrderNote({ | ||
| $, | ||
| data: { | ||
| referenceType: "order", | ||
| referenceValue: this.orderId, | ||
| text: this.text, | ||
| isVisibleForContact: this.isVisibleForContact, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully added note to order: ${this.orderId}`); | ||
| return response; | ||
| }, | ||
| }; |
97 changes: 97 additions & 0 deletions
97
components/plentyone/actions/create-order/create-order.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,97 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import { | ||
| LOCK_STATUS_OPTIONS, | ||
| ORDER_TYPE_OPTIONS, | ||
| } from "../../common/constants.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import plentyone from "../../plentyone.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "plentyone-create-order", | ||
| name: "Create Order", | ||
| description: "Creates a new order in PlentyONE. [See the documentation](https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Order/post_rest_orders)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| plentyone, | ||
| orderTypeId: { | ||
| type: "integer", | ||
| label: "Order Type ID", | ||
| description: "The ID of the order type.", | ||
| options: ORDER_TYPE_OPTIONS, | ||
| }, | ||
| plentyId: { | ||
| type: "integer", | ||
| label: "Plenty ID", | ||
| description: "The plenty ID of the client that the order belongs to.", | ||
| }, | ||
| statusId: { | ||
| propDefinition: [ | ||
| plentyone, | ||
| "statusId", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| ownerId: { | ||
| type: "integer", | ||
| label: "Owner ID", | ||
| description: "The user ID of the order's owner.", | ||
| optional: true, | ||
| }, | ||
| lockStatus: { | ||
| type: "string", | ||
| label: "Lock Status", | ||
| description: "The lock status of the order.", | ||
| options: LOCK_STATUS_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| orderItems: { | ||
| type: "string[]", | ||
| label: "Order Items", | ||
| description: "A list of objects of the order items. [See the documentation](https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Order/post_rest_orders) for more details.", | ||
| optional: true, | ||
| }, | ||
| properties: { | ||
| type: "string[]", | ||
| label: "Properties", | ||
| description: "A list of objects of the order properties. [See the documentation](https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Order/post_rest_orders) for more details.", | ||
| optional: true, | ||
| }, | ||
| addressRelations: { | ||
| type: "string[]", | ||
| label: "Address Relations", | ||
| description: "A list of objects of the order address relations. [See the documentation](https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Order/post_rest_orders) for more details.", | ||
| optional: true, | ||
| }, | ||
| relations: { | ||
| type: "string[]", | ||
| label: "Relations", | ||
| description: "A list of objects of the order relations. [See the documentation](https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Order/post_rest_orders) for more details.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
| const response = await this.plentyone.createOrder({ | ||
| $, | ||
| data: { | ||
| typeId: this.orderTypeId, | ||
| plentyId: this.plentyId, | ||
| statusId: this.statusId, | ||
| ownerId: this.ownerId, | ||
| lockStatus: this.lockStatus, | ||
| orderItems: parseObject(this.orderItems), | ||
| properties: parseObject(this.properties), | ||
| addressRelations: parseObject(this.addressRelations), | ||
| relations: parseObject(this.relations), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created order: ${response.id}`); | ||
| return response; | ||
| } catch (error) { | ||
| $.export("$summary", "Failed to create order"); | ||
| throw new ConfigurationError(error); | ||
| } | ||
| }, | ||
| }; | ||
29 changes: 29 additions & 0 deletions
29
components/plentyone/actions/get-order-documents/get-order-documents.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,29 @@ | ||
| import plentyone from "../../plentyone.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "plentyone-get-order-documents", | ||
| name: "Get Order Documents", | ||
| description: "Retrieves documents for a specific order from PlentyONE. [See the documentation](https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Document/get_rest_orders_documents_find)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| plentyone, | ||
| orderId: { | ||
| propDefinition: [ | ||
| plentyone, | ||
| "orderId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.plentyone.getOrderDocuments({ | ||
| $, | ||
| params: { | ||
| orderId: this.orderId, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${response.entries.length} documents for order: ${this.orderId}`); | ||
| return response; | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
35 changes: 35 additions & 0 deletions
35
components/plentyone/actions/get-order-items/get-order-items.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,35 @@ | ||
| import plentyone from "../../plentyone.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "plentyone-get-order-items", | ||
| name: "Get Order Items", | ||
| description: "Retrieves items for a specific order from PlentyONE [See the documentation](https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Order/get_rest_orders__orderId_)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| plentyone, | ||
| orderId: { | ||
| propDefinition: [ | ||
| plentyone, | ||
| "orderId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
| const response = await this.plentyone.getOrder({ | ||
| $, | ||
| orderId: this.orderId, | ||
| params: { | ||
| addOrderItems: true, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${response.orderItems.length} items for order: ${this.orderId}`); | ||
| return response.orderItems; | ||
| } catch (error) { | ||
| $.export("$summary", `No items found for order: ${this.orderId}`); | ||
| return {}; | ||
| } | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
27 changes: 27 additions & 0 deletions
27
components/plentyone/actions/get-order-properties/get-order-properties.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,27 @@ | ||
| import plentyone from "../../plentyone.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "plentyone-get-order-properties", | ||
| name: "Get Order Properties", | ||
| description: "Retrieves properties for a specific order from PlentyONE [See the documentation](https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Order/get_rest_orders__orderId_)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| plentyone, | ||
| orderId: { | ||
| propDefinition: [ | ||
| plentyone, | ||
| "orderId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.plentyone.getOrder({ | ||
| $, | ||
| orderId: this.orderId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved properties for order with ID: ${this.orderId}`); | ||
| return response.properties; | ||
| }, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
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,32 @@ | ||
| import plentyone from "../../plentyone.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "plentyone-get-order", | ||
| name: "Get Order", | ||
| description: "Retrieves a specific order by ID from PlentyONE. [See the documentation](https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Order/get_rest_orders__orderId_)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| plentyone, | ||
| orderId: { | ||
| propDefinition: [ | ||
| plentyone, | ||
| "orderId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
| const response = await this.plentyone.getOrder({ | ||
| $, | ||
| orderId: this.orderId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved order: ${this.orderId}`); | ||
| return response; | ||
| } catch (error) { | ||
| $.export("$summary", `No order found with ID: ${this.orderId}`); | ||
| return {}; | ||
| } | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
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.