ExShopify v0.2.0 ExShopify.Refund

Record of the money returned to the customer, and/or the return of any items on an order which may or may not have been restocked.

Summary

Types

refund_plural()
refund_plural() :: {:ok, [%ExShopify.Refund{created_at: term, id: term, note: term, refund_line_items: term, restock: term, transactions: term, user_id: term}], %ExShopify.Meta{api_call_limit: term}}
refund_singular()
refund_singular() :: {:ok, %ExShopify.Refund{created_at: term, id: term, note: term, refund_line_items: term, restock: term, transactions: term, user_id: term}, %ExShopify.Meta{api_call_limit: term}}

Functions

calculate(session, order_id, params)
calculate(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) :: refund_singular

Calculate a refund.

Examples

Calculate a refund for a partial amount of shipping

iex> params = %{
...>   shipping: %{
...>     amount: 2.0
...>   }
...> }

iex> ExShopify.Refund.calculate(session, 450789469, params)
{:ok, refund, meta}

Calculate a refund for a line item and shipping

iex> params = %{
...>   shipping: %{
...>     full_refund: true
...>   },
...>   refund_line_items: [
...>     %{
...>       line_item_id: 518995019,
...>       quantity: 1
...>     }
...>   ]
...> }

iex> ExShopify.Refund.calculate(session, 450789469, params)
{:ok, refund, meta}
create(session, order_id, params)
create(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  refund_singular |
  ExShopify.Resource.error

Create a refund.

Examples

Create a new refund for an order

iex> params = %{
...>   restock: true,
...>   notify: true,
...>   note: "wrong size",
...>   shipping: %{
...>     full_refund: true
...>   },
...>   refund_line_items: [
...>     %{
...>       line_item_id: 518995019,
...>       quantity: 1
...>     }
...>   ],
...>   transactions [
...>     %{
...>       parent_id: 801038806,
...>       amount: 199.65,
...>       kind: refund,
...>       gateway: "bogus"
...>     }
...>   ]
...> }

iex> ExShopify.Refund.create(session, 450789469, params)
{:ok, refund, meta}

Refunding a specific amount of shipping

iex> params = %{
...>   shipping: %{
...>     amount: 5.0
...>   },
...>   transactions [
...>     %{
...>       parent_id: 801038806,
...>       amount: 5.0,
...>       kind: refund,
...>       gateway: "bogus"
...>     }
...>   ]
...> }

iex> ExShopify.Refund.create(session, 450789469, params)
{:ok, refund, meta}
find(session, id, order_id)
find(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, integer | String.t) ::
  refund_singular |
  ExShopify.Resource.error
find(session, id, order_id, params)
find(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, integer | String.t, map) ::
  refund_singular |
  ExShopify.Resource.error

Receive a single refund.

Examples

iex> ExShopify.Refund.find(session, 509562969, 450789469)
{:ok, refund, meta}
list(session, order_id)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t) ::
  refund_plural |
  ExShopify.Resource.error
list(session, order_id, params)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  refund_plural |
  ExShopify.Resource.error

Retrieve a list of refunds for an order.

Examples

iex> ExShopify.Refund.list(session)
{:ok, refunds, meta}