Validate Promo Codes to Remove Step (steps/validate-promo-codes-to-remove.ts)

medusa · packages/core/core-flows/src/draft-order/steps/validate-promo-codes-to-remove.ts · typescript · MIT
automation, payments, tag:medusa, tag:promo-code, tag:validation

Workflow step that verifies promo codes exist before removing them from a draft order in Medusa e-commerce.

// Source: https://github.com/medusajs/medusa | License: MIT | Copyright 2021 Medusajs
// Provided via justclaw.it.com; keep this notice with the code.
import { createStep } from "@medusajs/framework/workflows-sdk"
import type { PromotionDTO } from "@medusajs/framework/types"
import { throwIfCodesAreMissing } from "../utils/validation"

export const validatePromoCodesToRemoveId = "validate-promo-codes-to-remove"

/**
 * The details of the promo codes removal to validate.
 */
export interface ValidatePromoCodesToRemoveStepInput {
  /**
   * The promo codes to remove from the draft order.
   */
  promo_codes: string[]
  /**
   * The promotions to remove from the draft order.
   */
  promotions: PromotionDTO[]
}

/**
 * This step validates that the promo codes can be removed from a draft orde

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key