ExShopify v0.2.0 ExShopify.Order

An order is a customer’s completed request to purchase one or more products from a shop. An order is created when a customer completes the checkout process, during which time s/he provides an email address, billing address and payment information.

Summary

Functions

Cancel an order

Close an order

Retrieve a count of all the orders

Create a new order

Delete an order

Retrieve a specific order

Retrieve a list of orders

Re-open a closed order

Update an order

Types

order_plural()
order_plural() :: {:ok, [%ExShopify.Order{subtotal_price: term, updated_at: term, line_items: term, payment_gateway_names: term, token: term, processed_at: term, refunds: term, name: term, number: term, cart_token: term, note: term, client_details: term, customer: term, browser_ip: term, source_name: term, taxes_included: term, tax_lines: term, order_number: term, referring_site: term, total_price: term, created_at: term, buyer_accepts_marketing: term, total_line_items_price: term, closed_at: term, landing_site: term, total_weight: term, total_discounts: term, order_status_url: term, tags: term, processing_method: term, id: term, total_tax: term, cancel_reason: term, financial_status: term, currency: term, user_id: term, discount_codes: term, shipping_lines: term, fulfillment_status: term, shipping_address: term, billing_address: term, note_attributes: term, fulfillments: term, email: term, cancelled_at: term, location_id: term}], %ExShopify.Meta{api_call_limit: term}}
order_singular()
order_singular() :: {:ok, %ExShopify.Order{subtotal_price: term, updated_at: term, line_items: term, payment_gateway_names: term, token: term, processed_at: term, refunds: term, name: term, number: term, cart_token: term, note: term, client_details: term, customer: term, browser_ip: term, source_name: term, taxes_included: term, tax_lines: term, order_number: term, referring_site: term, total_price: term, created_at: term, buyer_accepts_marketing: term, total_line_items_price: term, closed_at: term, landing_site: term, total_weight: term, total_discounts: term, order_status_url: term, tags: term, processing_method: term, id: term, total_tax: term, cancel_reason: term, financial_status: term, currency: term, user_id: term, discount_codes: term, shipping_lines: term, fulfillment_status: term, shipping_address: term, billing_address: term, note_attributes: term, fulfillments: term, email: term, cancelled_at: term, location_id: term}, %ExShopify.Meta{api_call_limit: term}}

Functions

cancel(session, id)
cancel(%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) ::
  order_singular |
  ExShopify.Resource.error
cancel(session, id, params)
cancel(%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) ::
  order_singular |
  ExShopify.Resource.error

Cancel an order.

Examples

Canceling an order

iex> ExShopify.Order.cancel(session, 450789469)
{:ok, order, meta}

Canceling and refunding an order using the refund parameter

iex> params = %{
...>   refund: %{
...>     restock: true,
...>     note: "Broke in shipping",
...>     shipping: %{
...>       full_refund: true
...>     },
...>     refund_line_items: [
...>       %{line_item_id: 466157049, quantity: 1}
...>     ],
...>     transactions: [
...>       %{
...>          parent_id: 1068278472,
...>          amount: "10.00",
...>          kind: "refund",
...>          gateway: "bogus"
...>        },
...>       %{
...>          parent_id: 1068278473,
...>          amount: "100.00",
...>          kind: "refund",
...>          gateway: "bogus"
...>        }
...>     ]
...>   }
...> }

iex> ExShopify.Order.cancel(session, 450789469, params)
{:ok, order, meta}
close(session, id)
close(%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) ::
  order_singular |
  ExShopify.Resource.error

Close an order.

Examples

iex> ExShopify.Order.close(session, 450789469)
{:ok, order, meta}
count(session)
count(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}) ::
  ExShopify.Resource.count |
  ExShopify.Resource.error
count(session, params)
count(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, map) ::
  ExShopify.Resource.count |
  ExShopify.Resource.error

Retrieve a count of all the orders.

Examples

iex> ExShopify.Order.count(session)
{:ok, order, meta}
create(session, params)
create(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, map) ::
  order_singular |
  ExShopify.Resource.error

Create a new order.

Examples

Create a simple order without sending order/fulfillment receipt

iex> params = %ExShopify.Order {
...>   email: "foo@example.com",
...>   fulfillment_status: "fulfilled",
...>   line_items: [
...>     %{
...>       variant_id: 447654529,
...>       quantity: 1
...>     }
...>   ]
...> }

iex> ExShopify.Order.create(session, params)
{:ok, order, meta}

Create a partially paid order with a new customer and addresses

iex> params = %ExShopify.Order {
...>   line_items: [
...>     %{
...>       variant_id: 447654529,
...>       quantity: 1
...>     }
...>   ],
...>   customer: %{
...>     first_name: "Paul",
...>     last_name: "Norman",
...>     email: "paul.norman@example.com"
...>   },
...>   billing_address: %{
...>     first_name: "John",
...>     last_name: "Smith",
...>     address1: "123 Fake Street",
...>     phone: "777-777-7777",
...>     city: "Fakecity",
...>     province: "Ontario",
...>     country: "Canada",
...>     zip: "K2P 1L4"
...>   },
...>   email: "jane@example.com",
...>   transactions: [
...>     %{
...>       kind: "authorization",
...>       status: "success",
...>       amount: 50.0
...>     }
...>   ],
...>   financial_status: "partially_paid"
...> }

iex> ExShopify.Order.create(session, params)
{:ok, order, meta}
delete(session, id)
delete(%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) ::
  ExShopify.Resource.only_meta |
  ExShopify.Resource.error

Delete an order.

Examples

iex> ExShopify.Order.delete(session, 450789469)
{:ok, meta}
find(session, 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) ::
  order_singular |
  ExShopify.Resource.error
find(session, 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, map) ::
  order_singular |
  ExShopify.Resource.error

Retrieve a specific order.

iex> ExShopify.Order.find(session, 450789469)
{:ok, order, meta}
list(session)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}) ::
  order_plural |
  ExShopify.Resource.error
list(session, params)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, map) ::
  order_plural |
  ExShopify.Resource.error

Retrieve a list of orders.

Examples

iex> ExShopify.Order.list(session)
{:ok, orders, meta}
open(session, id)
open(%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) ::
  order_singular |
  ExShopify.Resource.error

Re-open a closed order.

Examples

iex> ExShopify.Order.open(session, 450789469)
{:ok, order, meta}
update(session, id, params)
update(%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) ::
  order_singular |
  ExShopify.Resource.error

Update an order.

Examples

iex> params = %{
...>   email: "a-different@email.com"
...> }

iex> ExShopify.Order.update(session, params)
{:ok, order, meta}