Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-add-product-to-custom-collection",
version: "0.0.8",
version: "0.0.9",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-add-tags",
version: "0.0.8",
version: "0.0.9",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-article",
version: "0.0.10",
version: "0.0.11",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-blog",
version: "0.0.10",
version: "0.0.11",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-custom-collection",
version: "0.0.8",
version: "0.0.9",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "shopify_developer_app-create-customer",
name: "Create Customer",
description: "Create a new customer. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/customercreate)",
version: "0.0.8",
version: "0.0.9",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import shopify from "../../shopify_developer_app.app.mjs";

export default {
key: "shopify_developer_app-create-fulfillment",
name: "Create Fulfillment",
description: "Create a fulfillment. [See the documentation](https://shopify.dev/docs/api/admin-graphql/unstable/mutations/fulfillmentcreate)",
version: "0.0.1",
type: "action",
props: {
shopify,
fulfillmentOrderId: {
propDefinition: [
shopify,
"fulfillmentOrderId",
],
},
fulfillmentOrderLineItemIds: {
propDefinition: [
shopify,
"fulfillmentOrderLineItemIds",
(c) => ({
fulfillmentOrderId: c.fulfillmentOrderId,
}),
],
reloadProps: true,
},
notifyCustomer: {
type: "boolean",
label: "Notify Customer",
description: "Whether to notify the customer",
optional: true,
},
message: {
type: "string",
label: "Message",
description: "An optional message for the fulfillment request.",
optional: true,
},
},
async additionalProps() {
const props = {};
if (!this.fulfillmentOrderLineItemIds) {
return props;
}

for (const id of this.fulfillmentOrderLineItemIds) {
props[`quantity_${id}`] = {
type: "integer",
label: `Quantity for Line Item - ${id}`,
description: "The quantity of the line item to fulfill",
};
}
return props;
},
async run({ $ }) {
const fulfillment = await this.shopify.createFulfillment({
fulfillment: {
lineItemsByFulfillmentOrder: [
{
fulfillmentOrderId: this.fulfillmentOrderId,
fulfillmentOrderLineItems: this.fulfillmentOrderLineItemIds.map((id) => ({
id,
quantity: this[`quantity_${id}`],
})),
},
],
notifyCustomer: this.notifyCustomer,
},
message: this.message,
});
if (fulfillment.fulfillmentCreate.userErrors.length > 0) {
throw new Error(fulfillment.fulfillmentCreate.userErrors[0].message);
}
$.export("$summary", `Created fulfillment with ID: ${fulfillment.fulfillmentCreate.fulfillment.id}`);
return fulfillment;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
export default {
...others,
key: "shopify_developer_app-create-metafield",
version: "0.0.9",
version: "0.0.10",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-metaobject",
version: "0.0.10",
version: "0.0.11",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "shopify_developer_app-create-order",
name: "Create Order",
description: "Creates a new order. For full order object details [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/ordercreate)",
version: "0.0.8",
version: "0.0.9",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-page",
version: "0.0.10",
version: "0.0.11",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-product-variant",
version: "0.0.9",
version: "0.0.10",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-product",
version: "0.0.8",
version: "0.0.9",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-create-smart-collection",
version: "0.0.8",
version: "0.0.9",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-delete-article",
version: "0.0.10",
version: "0.0.11",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-delete-blog",
version: "0.0.10",
version: "0.0.11",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
export default {
...others,
key: "shopify_developer_app-delete-metafield",
version: "0.0.9",
version: "0.0.10",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-delete-page",
version: "0.0.10",
version: "0.0.11",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-get-articles",
version: "0.0.10",
version: "0.0.11",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const {

export default {
key: "shopify_developer_app-get-metafields",
version: "0.0.9",
version: "0.0.10",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-get-metaobjects",
version: "0.0.9",
version: "0.0.10",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "shopify_developer_app-get-order",
name: "Get Order",
description: "Retrieve an order by specifying the order ID. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/queries/order)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-get-pages",
version: "0.0.10",
version: "0.0.11",
name,
description,
type,
Expand Down
100 changes: 100 additions & 0 deletions components/shopify_developer_app/actions/refund-order/refund-order.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import shopify from "../../shopify_developer_app.app.mjs";
import { MAX_LIMIT } from "@pipedream/shopify/common/constants.mjs";

export default {
key: "shopify_developer_app-refund-order",
name: "Refund Order",
description: "Refund an order. [See the documentation](https://shopify.dev/docs/api/admin-graphql/unstable/mutations/refundcreate)",
version: "0.0.1",
type: "action",
props: {
shopify,
orderId: {
propDefinition: [
shopify,
"orderId",
],
},
note: {
type: "string",
label: "Note",
description: "An optional note that's attached to the refund",
optional: true,
},
lineItemIds: {
propDefinition: [
shopify,
"lineItemIds",
(c) => ({
orderId: c.orderId,
}),
],
reloadProps: true,
},
},
async additionalProps() {
const props = {};
if (!this.lineItemIds) {
return props;
}
const order = await this.shopify.getOrder({
id: this.orderId,
first: MAX_LIMIT,
});
for (const id of this.lineItemIds) {
const lineItem = order.order.lineItems.edges.find((item) => item.node.id === id);
props[`quantity_${id}`] = {
type: "integer",
label: `Quantity for line item - ${lineItem.node.title}`,
description: "The quantity of the line item to refund",
};
props[`restockType_${id}`] = {
type: "string",
label: `Restock type for line item - ${lineItem.node.title}`,
description: "The restock type for the line item",
options: [
"CANCEL",
"NO_RESTOCK",
"RETURN",
],
default: "RETURN",
};
props[`locationId_${id}`] = {
type: "string",
label: `Location ID for line item - ${lineItem.node.title}`,
description: "The location ID for the line item",
options: async ({ prevContext }) => {
return this.shopify.getPropOptions({
resourceFn: this.shopify.listLocations,
resourceKeys: [
"locations",
],
labelKey: "name",
prevContext,
});
},
};
}
return props;
},
async run({ $ }) {
const response = await this.shopify.refundOrder({
input: {
note: this.note,
orderId: this.orderId,
refundLineItems: this.lineItemIds.map((id) => ({
lineItemId: id,
quantity: this[`quantity_${id}`],
locationId: this[`locationId_${id}`],
restockType: this[`restockType_${id}`],
})),
},
});

if (response.refundCreate.userErrors.length > 0) {
throw new Error(response.refundCreate.userErrors[0].message);
}
$.export("$summary", `Refunded order with ID: ${this.orderId}`);
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = adjustPropDefinitions(others.props, shopify);
export default {
...others,
key: "shopify_developer_app-search-custom-collection-by-name",
version: "0.0.8",
version: "0.0.9",
name,
description,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "shopify_developer_app-search-customers",
name: "Search for Customers",
description: "Search for a customer or a list of customers. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/queries/customers)",
version: "0.0.8",
version: "0.0.9",
type: "action",
props: {
shopify,
Expand Down
Loading
Loading