Duffel.OrderChanges (Duffel v0.1.0)

Copy Markdown View Source

Apply a selected order change offer to an order: create a pending order change, then confirm it (with payment if change_total_amount is positive).

See the Duffel documentation.

Summary

Functions

Confirms a pending order change. This applies the change to the order and cannot be undone.

Creates a pending order change from a selected order change offer.

Retrieves a single order change by ID.

Functions

confirm(client, id, params \\ %{}, opts \\ [])

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

Confirms a pending order change. This applies the change to the order and cannot be undone.

params must include a payment when the change's change_total_amount is greater than zero; it may be omitted when the amount is zero or negative (refunds go to refund_to).

Examples

Duffel.OrderChanges.confirm(client, "oce_123", %{
  payment: %{type: "balance", currency: "GBP", amount: "125.00"}
})

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

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

Creates a pending order change from a selected order change offer.

Examples

Duffel.OrderChanges.create(client, %{selected_order_change_offer: "oco_123"})

get(client, id)

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

Retrieves a single order change by ID.