@medusajs/core-flows
Version:
Set of workflow definitions for Medusa
65 lines • 2.23 kB
TypeScript
import { FulfillmentDTO, OrderExchangeDTO, OrderWorkflow, ReturnDTO } from "@medusajs/framework/types";
/**
* The data to validate that an exchange can be canceled.
*/
export type CancelExchangeValidateOrderStepInput = {
/**
* The order exchange's details.
*/
orderExchange: OrderExchangeDTO;
/**
* The order return's details.
*/
orderReturn: ReturnDTO & {
fulfillments: FulfillmentDTO[];
};
/**
* The details of canceling the exchange.
*/
input: OrderWorkflow.CancelOrderExchangeWorkflowInput;
};
/**
* This step validates that an exchange can be canceled.
* If the exchange is canceled, or any of the fulfillments are not canceled, the step will throw an error.
*
* :::note
*
* You can retrieve an order exchange's details using [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query),
* or [useQueryGraphStep](https://docs.medusajs.com/resources/references/medusa-workflows/steps/useQueryGraphStep).
*
* :::
*
* @example
* const data = cancelExchangeValidateOrder({
* orderExchange: {
* id: "exchange_123",
* // other order exchange details...
* },
* input: {
* exchange_id: "exchange_123",
* }
* })
*/
export declare const cancelExchangeValidateOrder: import("@medusajs/framework/workflows-sdk").StepFunction<CancelExchangeValidateOrderStepInput, unknown>;
export declare const cancelOrderExchangeWorkflowId = "cancel-exchange";
/**
* This workflow cancels a confirmed exchange. It's used by the
* [Cancel Exchange Admin API Route](https://docs.medusajs.com/api/admin#exchanges_postexchangesidcancel).
*
* You can use this workflow within your customizations or your own custom workflows, allowing you to cancel an exchange
* for an order in your custom flow.
*
* @example
* const { result } = await cancelOrderExchangeWorkflow(container)
* .run({
* input: {
* exchange_id: "exchange_123",
* }
* })
*
* @summary
*
* Cancel an exchange for an order.
*/
export declare const cancelOrderExchangeWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<OrderWorkflow.CancelOrderExchangeWorkflowInput, unknown, any[]>;
//# sourceMappingURL=cancel-exchange.d.ts.map