Duffel.OrderCancellations (Duffel v0.1.0)

Copy Markdown View Source

Cancel orders in two steps: create a pending cancellation to see the refund amount, then confirm it.

Only the most recent pending cancellation for an order can be confirmed.

See the Duffel documentation.

Summary

Functions

Confirms a pending order cancellation. This actually cancels the order and cannot be undone.

Creates a pending order cancellation, returning the refund details.

Retrieves a single order cancellation by ID.

Lists one page of order cancellations.

Lazily streams all order cancellations across pages.

Functions

confirm(client, id)

@spec confirm(Duffel.Client.t(), String.t()) ::
  {:ok, map()} | {:error, Duffel.Error.t()}

Confirms a pending order cancellation. This actually cancels the order and cannot be undone.

create(client, params, opts \\ [])

@spec create(Duffel.Client.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Duffel.Error.t()}

Creates a pending order cancellation, returning the refund details.

Examples

Duffel.OrderCancellations.create(client, %{order_id: "ord_123"})

get(client, id)

@spec get(Duffel.Client.t(), String.t()) :: {:ok, map()} | {:error, Duffel.Error.t()}

Retrieves a single order cancellation by ID.

list(client, params \\ [])

@spec list(Duffel.Client.t(), keyword() | map()) ::
  {:ok, Duffel.Page.t()} | {:error, Duffel.Error.t()}

Lists one page of order cancellations.

Parameters

  • :order_id - filter by order
  • :limit / :after / :before - pagination (see Duffel.Page)

stream(client, params \\ [])

@spec stream(Duffel.Client.t(), keyword() | map()) :: Enumerable.t()

Lazily streams all order cancellations across pages.

Takes the same parameters as list/2. Raises Duffel.Error if a page request fails.