-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
[Components] americommerce #14229
Merged
jcortes
merged 1 commit into
PipedreamHQ:master
from
jcortes:americommerce-new-componets
Oct 10, 2024
Merged
[Components] americommerce #14229
Changes from all commits
Commits
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
132 changes: 132 additions & 0 deletions
132
components/americommerce/actions/change-order-status/change-order-status.mjs
This file contains 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,132 @@ | ||
import app from "../../americommerce.app.mjs"; | ||
|
||
export default { | ||
key: "americommerce-change-order-status", | ||
name: "Change Order Status", | ||
description: "Changes the status of an existing order. [See the documentation](https://developers.cart.com/docs/rest-api/6898d9f254dfb-update-an-order-status).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
orderStatusId: { | ||
optional: false, | ||
propDefinition: [ | ||
app, | ||
"orderStatusId", | ||
], | ||
}, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "The name of the order status.", | ||
optional: true, | ||
}, | ||
isOpen: { | ||
type: "boolean", | ||
label: "Is Open", | ||
description: "Indicates whether the order status is open.", | ||
optional: true, | ||
}, | ||
isDeclined: { | ||
type: "boolean", | ||
label: "Is Declined", | ||
description: "Indicates whether the order status is declined.", | ||
optional: true, | ||
}, | ||
isCancelled: { | ||
type: "boolean", | ||
label: "Is Cancelled", | ||
description: "Indicates whether the order status is cancelled.", | ||
optional: true, | ||
}, | ||
isShipped: { | ||
type: "boolean", | ||
label: "Is Shipped", | ||
description: "Indicates whether the order status is shipped.", | ||
optional: true, | ||
}, | ||
color: { | ||
type: "string", | ||
label: "Color", | ||
description: "The color of the order status.", | ||
optional: true, | ||
}, | ||
emailTemplateId: { | ||
propDefinition: [ | ||
app, | ||
"emailTemplateId", | ||
], | ||
}, | ||
isFullyRefunded: { | ||
type: "boolean", | ||
label: "Is Fully Refunded", | ||
description: "Indicates whether the order status is fully refunded.", | ||
optional: true, | ||
}, | ||
isPartiallyRefunded: { | ||
type: "boolean", | ||
label: "Is Partially Refunded", | ||
description: "Indicates whether the order status is partially refunded.", | ||
optional: true, | ||
}, | ||
isQuoteStatus: { | ||
type: "boolean", | ||
label: "Is Quote Status", | ||
description: "Indicates whether the order status is a quote status.", | ||
optional: true, | ||
}, | ||
isPartiallyShipped: { | ||
type: "boolean", | ||
label: "Is Partially Shipped", | ||
description: "Indicates whether the order status is partially shipped.", | ||
optional: true, | ||
}, | ||
GTFalcao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
methods: { | ||
changeOrderStatus({ | ||
orderStatusId, ...args | ||
} = {}) { | ||
return this.app.put({ | ||
path: `/order_statuses/${orderStatusId}`, | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
changeOrderStatus, | ||
orderStatusId, | ||
name, | ||
isOpen, | ||
isDeclined, | ||
isCancelled, | ||
isShipped, | ||
color, | ||
emailTemplateId, | ||
isFullyRefunded, | ||
isPartiallyRefunded, | ||
isQuoteStatus, | ||
isPartiallyShipped, | ||
} = this; | ||
|
||
const response = await changeOrderStatus({ | ||
$, | ||
orderStatusId, | ||
data: { | ||
name, | ||
is_open: isOpen, | ||
is_declined: isDeclined, | ||
is_cancelled: isCancelled, | ||
is_shipped: isShipped, | ||
color, | ||
email_template_id: emailTemplateId, | ||
is_fully_refunded: isFullyRefunded, | ||
is_partially_refunded: isPartiallyRefunded, | ||
is_quote_status: isQuoteStatus, | ||
is_partially_shipped: isPartiallyShipped, | ||
}, | ||
}); | ||
$.export("$summary", `Successfully changed the order status with ID \`${response.id}\`.`); | ||
return response; | ||
}, | ||
GTFalcao 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.