Skip to content

Commit 3dae124

Browse files
committed
feat: add Shopify webhook payload and event classes for fulfillments and orders
1 parent f2903e4 commit 3dae124

16 files changed

Lines changed: 269 additions & 1 deletion
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Identifier, Name, Schema} from "@code0-tech/hercules";
2+
import {schemaForWebhook} from "shopify-webhook-schemas";
3+
import { z } from "zod";
4+
5+
const schema = schemaForWebhook("2026-04", "fulfillments/create");
6+
const ShopifyFulfillmentsCreatePayloadSchema = z.fromJSONSchema(schema);
7+
8+
@Identifier("ShopifyFulfillmentsCreateWebhookPayload")
9+
@Name({ code: "en-US", content: "ShopifyFulfillmentsCreateWebhookPayload" })
10+
@Schema(ShopifyFulfillmentsCreatePayloadSchema)
11+
export class ShopifyFulfillmentsCreateWebhookPayload {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Identifier, Name, Schema} from "@code0-tech/hercules";
2+
import {schemaForWebhook} from "shopify-webhook-schemas";
3+
import { z } from "zod";
4+
5+
const schema = schemaForWebhook("2026-04", "fulfillments/update");
6+
const ShopifyFulfillmentsUpdatePayloadSchema = z.fromJSONSchema(schema);
7+
8+
@Identifier("ShopifyFulfillmentsUpdateWebhookPayload")
9+
@Name({ code: "en-US", content: "ShopifyFulfillmentsUpdateWebhookPayload" })
10+
@Schema(ShopifyFulfillmentsUpdatePayloadSchema)
11+
export class ShopifyFulfillmentsUpdateWebhookPayload {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Identifier, Name, Schema} from "@code0-tech/hercules";
2+
import {schemaForWebhook} from "shopify-webhook-schemas";
3+
import { z } from "zod";
4+
5+
const schema = schemaForWebhook("2026-04", "orders/cancelled");
6+
const ShopifyOrdersCancelledPayloadSchema = z.fromJSONSchema(schema);
7+
8+
@Identifier("ShopifyOrdersCancelledWebhookPayload")
9+
@Name({ code: "en-US", content: "ShopifyOrdersCancelledWebhookPayload" })
10+
@Schema(ShopifyOrdersCancelledPayloadSchema)
11+
export class ShopifyOrdersCancelledWebhookPayload {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Identifier, Name, Schema} from "@code0-tech/hercules";
2+
import {schemaForWebhook} from "shopify-webhook-schemas";
3+
import { z } from "zod";
4+
5+
const schema = schemaForWebhook("2026-04", "orders/fulfilled");
6+
const ShopifyOrdersFulfilledPayloadSchema = z.fromJSONSchema(schema);
7+
8+
@Identifier("ShopifyOrdersFulfilledWebhookPayload")
9+
@Name({ code: "en-US", content: "ShopifyOrdersFulfilledWebhookPayload" })
10+
@Schema(ShopifyOrdersFulfilledPayloadSchema)
11+
export class ShopifyOrdersFulfilledWebhookPayload {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Identifier, Name, Schema} from "@code0-tech/hercules";
2+
import {schemaForWebhook} from "shopify-webhook-schemas";
3+
import { z } from "zod";
4+
5+
const schema = schemaForWebhook("2026-04", "orders/paid");
6+
const ShopifyOrdersPaidPayloadSchema = z.fromJSONSchema(schema);
7+
8+
@Identifier("ShopifyOrdersPaidWebhookPayload")
9+
@Name({ code: "en-US", content: "ShopifyOrdersPaidWebhookPayload" })
10+
@Schema(ShopifyOrdersPaidPayloadSchema)
11+
export class ShopifyOrdersPaidWebhookPayload {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Identifier, Name, Schema} from "@code0-tech/hercules";
2+
import {schemaForWebhook} from "shopify-webhook-schemas";
3+
import { z } from "zod";
4+
5+
const schema = schemaForWebhook("2026-04", "orders/updated");
6+
const ShopifyOrdersUpdatedPayloadSchema = z.fromJSONSchema(schema);
7+
8+
@Identifier("ShopifyOrdersUpdatedWebhookPayload")
9+
@Name({ code: "en-US", content: "ShopifyOrdersUpdatedWebhookPayload" })
10+
@Schema(ShopifyOrdersUpdatedPayloadSchema)
11+
export class ShopifyOrdersUpdatedWebhookPayload {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Identifier, Name, Schema} from "@code0-tech/hercules";
2+
import {schemaForWebhook} from "shopify-webhook-schemas";
3+
import { z } from "zod";
4+
5+
const schema = schemaForWebhook("2026-04", "refunds/create");
6+
const ShopifyRefundsCreatePayloadSchema = z.fromJSONSchema(schema);
7+
8+
@Identifier("ShopifyRefundsCreateWebhookPayload")
9+
@Name({ code: "en-US", content: "ShopifyRefundsCreateWebhookPayload" })
10+
@Schema(ShopifyRefundsCreatePayloadSchema)
11+
export class ShopifyRefundsCreateWebhookPayload {}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import {Description, DisplayIcon, DisplayMessage, EventSetting, Identifier, Name, Rest, Signature} from "@code0-tech/hercules";
2+
3+
@Identifier("ShopifyFulfillmentsCreateWebhook")
4+
@DisplayIcon("simple:shopify")
5+
@Name({ code: "en-US", content: "Shopify fulfillments create" })
6+
@Description({ code: "en-US", content: "Triggered when a fulfillment is created in Shopify." })
7+
@DisplayMessage({ code: "en-US", content: "Shopify fulfillments create on ${httpURL}" })
8+
@Signature("<A extends REST_AUTH_TYPE>(httpSchema: HTTP_SCHEMA, httpURL: HTTP_URL, httpMethod: HTTP_METHOD, httpAuth: A, httpAuthValue: REST_AUTH_VALUE<A>, input_schema?: ShopifyFulfillmentsCreateWebhookPayload): REST_ADAPTER_INPUT<ShopifyFulfillmentsCreateWebhookPayload>")
9+
@EventSetting({
10+
identifier: "input_schema",
11+
hidden: true
12+
})
13+
@EventSetting({
14+
identifier: "httpMethod",
15+
hidden: true,
16+
defaultValue: "POST"
17+
})
18+
@EventSetting({
19+
identifier: "httpSchema",
20+
hidden: true,
21+
defaultValue: "application/json"
22+
})
23+
export class ShopifyFulfillmentsCreateWebhook extends Rest {}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import {Description, DisplayIcon, DisplayMessage, EventSetting, Identifier, Name, Rest, Signature} from "@code0-tech/hercules";
2+
3+
@Identifier("ShopifyFulfillmentsUpdateWebhook")
4+
@DisplayIcon("simple:shopify")
5+
@Name({ code: "en-US", content: "Shopify fulfillments update" })
6+
@Description({ code: "en-US", content: "Triggered when a fulfillment is updated in Shopify." })
7+
@DisplayMessage({ code: "en-US", content: "Shopify fulfillments update on ${httpURL}" })
8+
@Signature("<A extends REST_AUTH_TYPE>(httpSchema: HTTP_SCHEMA, httpURL: HTTP_URL, httpMethod: HTTP_METHOD, httpAuth: A, httpAuthValue: REST_AUTH_VALUE<A>, input_schema?: ShopifyFulfillmentsUpdateWebhookPayload): REST_ADAPTER_INPUT<ShopifyFulfillmentsUpdateWebhookPayload>")
9+
@EventSetting({
10+
identifier: "input_schema",
11+
hidden: true
12+
})
13+
@EventSetting({
14+
identifier: "httpMethod",
15+
hidden: true,
16+
defaultValue: "POST"
17+
})
18+
@EventSetting({
19+
identifier: "httpSchema",
20+
hidden: true,
21+
defaultValue: "application/json"
22+
})
23+
export class ShopifyFulfillmentsUpdateWebhook extends Rest {}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import {Description, DisplayIcon, DisplayMessage, EventSetting, Identifier, Name, Rest, Signature} from "@code0-tech/hercules";
2+
3+
@Identifier("ShopifyOrdersCancelledWebhook")
4+
@DisplayIcon("simple:shopify")
5+
@Name({ code: "en-US", content: "Shopify orders cancelled" })
6+
@Description({ code: "en-US", content: "Triggered when an order is cancelled in Shopify." })
7+
@DisplayMessage({ code: "en-US", content: "Shopify orders cancelled on ${httpURL}" })
8+
@Signature("<A extends REST_AUTH_TYPE>(httpSchema: HTTP_SCHEMA, httpURL: HTTP_URL, httpMethod: HTTP_METHOD, httpAuth: A, httpAuthValue: REST_AUTH_VALUE<A>, input_schema?: ShopifyOrdersCancelledWebhookPayload): REST_ADAPTER_INPUT<ShopifyOrdersCancelledWebhookPayload>")
9+
@EventSetting({
10+
identifier: "input_schema",
11+
hidden: true
12+
})
13+
@EventSetting({
14+
identifier: "httpMethod",
15+
hidden: true,
16+
defaultValue: "POST"
17+
})
18+
@EventSetting({
19+
identifier: "httpSchema",
20+
hidden: true,
21+
defaultValue: "application/json"
22+
})
23+
export class ShopifyOrdersCancelledWebhook extends Rest {}

0 commit comments

Comments
 (0)