-
Notifications
You must be signed in to change notification settings - Fork 5.6k
WICS - new components #19362
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
WICS - new components #19362
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
41 changes: 41 additions & 0 deletions
41
components/wics/actions/delete-order-line/delete-order-line.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,41 @@ | ||
| import wics from "../../wics.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "wics-delete-order-line", | ||
| name: "Delete Order Line", | ||
| description: "Delete a line from an order. [See the documentation](https://docs.wics.nl/test-environment.html#orders-delete-order-line)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| wics, | ||
| orderReference: { | ||
| propDefinition: [ | ||
| wics, | ||
| "orderReference", | ||
| ], | ||
| }, | ||
| lineNumber: { | ||
| propDefinition: [ | ||
| wics, | ||
| "lineNumber", | ||
| (c) => ({ | ||
| orderReference: c.orderReference, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { data } = await this.wics.deleteOrderLine({ | ||
| $, | ||
| orderReference: this.orderReference, | ||
| lineNumber: this.lineNumber, | ||
| }); | ||
| $.export("$summary", `Successfully deleted line ${this.lineNumber} from order ${this.orderReference}`); | ||
| return data; | ||
| }, | ||
| }; |
37 changes: 37 additions & 0 deletions
37
...ents/wics/actions/get-order-by-additional-reference/get-order-by-additional-reference.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,37 @@ | ||
| import wics from "../../wics.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "wics-get-order-by-additional-reference", | ||
| name: "Get Order by Additional Reference", | ||
| description: "Get an order by its additional reference. [See the documentation](https://docs.wics.nl/test-environment.html#orders-list-orders)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| wics, | ||
| additionalReference: { | ||
| propDefinition: [ | ||
| wics, | ||
| "additionalReference", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { data } = await this.wics.listOrders({ | ||
| $, | ||
| params: { | ||
| additionalReference: this.additionalReference, | ||
| }, | ||
| }); | ||
| if (!data?.length) { | ||
| $.export("$summary", "No order found"); | ||
| return; | ||
| } | ||
| $.export("$summary", `Successfully retrieved order with additional reference: ${this.additionalReference}`); | ||
| return data[0]; | ||
| }, | ||
| }; | ||
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,240 @@ | ||
| import wics from "../../wics.app.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "wics-update-order", | ||
| name: "Update Order", | ||
| description: "Update an order. [See the documentation](https://docs.wics.nl/test-environment.html#orders-update-order)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| wics, | ||
| orderReference: { | ||
| propDefinition: [ | ||
| wics, | ||
| "orderReference", | ||
| ], | ||
| }, | ||
| deliveryDate: { | ||
| type: "string", | ||
| label: "Delivery Date", | ||
| description: "The date that the order should be delivered. Format: YYYY-MM-DD", | ||
| optional: true, | ||
| }, | ||
| webshopId: { | ||
| type: "integer", | ||
| label: "Webshop ID", | ||
| description: "The identifier that corresponds to the webshop account of Transmart or Paazl", | ||
| optional: true, | ||
| }, | ||
| warehouseCode: { | ||
| type: "string", | ||
| label: "Warehouse Code", | ||
| description: "The warehouse used for this order", | ||
| optional: true, | ||
| }, | ||
| note: { | ||
| type: "string", | ||
| label: "Note", | ||
| description: "A note that will shown alongside the order", | ||
| optional: true, | ||
| }, | ||
| tag: { | ||
| type: "string", | ||
| label: "Tag", | ||
| description: "A shippingTag or tag that is linked with a shipment option in WICS.", | ||
| optional: true, | ||
| }, | ||
| pickupPoint: { | ||
| type: "string", | ||
| label: "Pickup Point", | ||
| description: "A place for picking up the order", | ||
| optional: true, | ||
| }, | ||
| termsOfDelivery: { | ||
| type: "string", | ||
| label: "Terms of Delivery", | ||
| description: "The delivery condition", | ||
| optional: true, | ||
| }, | ||
| type: { | ||
| type: "string", | ||
| label: "Type", | ||
| description: "The order type of the order", | ||
| optional: true, | ||
| }, | ||
| invoiceAddressName: { | ||
| type: "string", | ||
| label: "Invoice Address Name", | ||
| description: "The name of the invoice address", | ||
| optional: true, | ||
| }, | ||
| invoiceAddressStreetNumber: { | ||
| type: "string", | ||
| label: "Invoice Address Street Number", | ||
| description: "The street number of the invoice address", | ||
| optional: true, | ||
| }, | ||
| invoiceAddressStreet: { | ||
| type: "string", | ||
| label: "Invoice Address Street Name", | ||
| description: "The street name of the invoice address", | ||
| optional: true, | ||
| }, | ||
| invoiceAddressCity: { | ||
| type: "string", | ||
| label: "Invoice Address City", | ||
| description: "The city of the invoice address", | ||
| optional: true, | ||
| }, | ||
| invoiceAddressState: { | ||
| type: "string", | ||
| label: "Invoice Address State", | ||
| description: "The state of the invoice address", | ||
| optional: true, | ||
| }, | ||
| invoiceAddressZipcode: { | ||
| type: "string", | ||
| label: "Invoice Address Zipcode", | ||
| description: "The zipcode of the invoice address", | ||
| optional: true, | ||
| }, | ||
| invoiceAddressCountry: { | ||
| type: "string", | ||
| label: "Invoice Address Country", | ||
| description: "The country of the invoice address", | ||
| optional: true, | ||
| }, | ||
| invoiceEmail: { | ||
| type: "string", | ||
| label: "Invoice Email", | ||
| description: "The email of the invoice address", | ||
| optional: true, | ||
| }, | ||
| deliveryAddressName: { | ||
| type: "string", | ||
| label: "Delivery Address Name", | ||
| description: "The name of the delivery address", | ||
| optional: true, | ||
| }, | ||
| deliveryAddressStreetNumber: { | ||
| type: "string", | ||
| label: "Delivery Address Street Number", | ||
| description: "The street number of the delivery address", | ||
| optional: true, | ||
| }, | ||
| deliveryAddressStreet: { | ||
| type: "string", | ||
| label: "Delivery Address Street Name", | ||
| description: "The street name of the delivery address", | ||
| optional: true, | ||
| }, | ||
| deliveryAddressCity: { | ||
| type: "string", | ||
| label: "Delivery Address City", | ||
| description: "The city of the delivery address", | ||
| optional: true, | ||
| }, | ||
| deliveryAddressState: { | ||
| type: "string", | ||
| label: "Delivery Address State", | ||
| description: "The state of the delivery address", | ||
| optional: true, | ||
| }, | ||
| deliveryAddressZipcode: { | ||
| type: "string", | ||
| label: "Delivery Address Zipcode", | ||
| description: "The zipcode of the delivery address", | ||
| optional: true, | ||
| }, | ||
| deliveryAddressCountry: { | ||
| type: "string", | ||
| label: "Delivery Address Country", | ||
| description: "The country of the delivery address", | ||
| optional: true, | ||
| }, | ||
| deliveryEmail: { | ||
| type: "string", | ||
| label: "Delivery Email", | ||
| description: "The email of the delivery address", | ||
| optional: true, | ||
| }, | ||
| lines: { | ||
| type: "string[]", | ||
| label: "Lines", | ||
| description: "The lines of the order as an array of objects including the key `lineNumber`. Example: `[{ \"lineNumber\": 20002, \"itemCode\": \"16084\", \"itemDescription\": \"Speaker kabel\", \"quantity\": 5 }]` [See the documentation](https://docs.wics.nl/test-environment.html#orders-update-order) for additional information", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { data: order } = await this.wics.getOrder({ | ||
| $, | ||
| orderReference: this.orderReference, | ||
| }); | ||
|
|
||
| // add in updated lines | ||
| const lines = []; | ||
| const newLines = parseObject(this.lines); | ||
| for (const line of order.lines) { | ||
| const newLine = newLines.find((l) => l.lineNumber === line.lineNumber); | ||
| if (newLine) { | ||
| lines.push(newLine); | ||
| } else { | ||
| lines.push(line); | ||
| } | ||
| } | ||
|
|
||
| // add in new lines | ||
| for (const line of newLines) { | ||
| if (!lines.find((l) => l.lineNumber === line.lineNumber)) { | ||
| lines.push(line); | ||
| } | ||
| } | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const { data } = await this.wics.updateOrder({ | ||
| $, | ||
| orderReference: this.orderReference, | ||
| data: { | ||
| ...order, | ||
| deliveryDate: this.deliveryDate, | ||
| webshopId: this.webshopId, | ||
| warehouseCode: this.warehouseCode, | ||
| note: this.note, | ||
| tag: this.tag, | ||
| pickupPoint: this.pickupPoint, | ||
| termsOfDelivery: this.termsOfDelivery, | ||
| type: this.type, | ||
| invoiceAddress: { | ||
| ...order.invoiceAddress, | ||
| name: this.invoiceAddressName, | ||
| streetNumber: this.invoiceAddressStreetNumber, | ||
| street: this.invoiceAddressStreet, | ||
| city: this.invoiceAddressCity, | ||
| state: this.invoiceAddressState, | ||
| zipcode: this.invoiceAddressZipcode, | ||
| country: this.invoiceAddressCountry, | ||
| email: this.invoiceEmail, | ||
| }, | ||
| deliveryAddress: { | ||
| ...order.deliveryAddress, | ||
| name: this.deliveryAddressName, | ||
| streetNumber: this.deliveryAddressStreetNumber, | ||
| street: this.deliveryAddressStreet, | ||
| city: this.deliveryAddressCity, | ||
| state: this.deliveryAddressState, | ||
| zipcode: this.deliveryAddressZipcode, | ||
| country: this.deliveryAddressCountry, | ||
| email: this.deliveryEmail, | ||
| }, | ||
| lines, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully updated order ${this.orderReference}`); | ||
| return data; | ||
| }, | ||
| }; | ||
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.