Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

574 B
Raw Blame
import { SubscriberArgs, SubscriberConfig } from "@medusajs/framework"

import { MagentoWebhookEvents } from "../types"
import { deliverMagentoWebhookWorkflow } from "../workflows"

export default async function magentoWebhookDeliverOnCreateHandler({
  event,
  container,
}: SubscriberArgs<{ id: string }>) {
  await deliverMagentoWebhookWorkflow(container).run({
    input: { delivery_id: event.data.id },
  })
}

export const config: SubscriberConfig = {
  event: MagentoWebhookEvents.DELIVERY_CREATED,
  context: { subscriberId: "magento-webhook-deliver-on-create" },
}