Sha256: 6864a9d1d8f1a5418efe6c2d843fa987f0c93b1bb484522ee52fd6442292fa61

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

module ShopifyAPI
  class Order < Base
    include Events
    include Metafields

    def close
      load_attributes_from_response(post(:close, {}, only_id))
    end

    def open
      load_attributes_from_response(post(:open, {}, only_id))
    end

    def cancel(options = {})
      load_attributes_from_response(post(:cancel, {}, options.to_json))
    end

    def transactions
      Transaction.find(:all, :params => { :order_id => id })
    end

    def capture(amount = "", currency: nil)
      capture_transaction = {
        amount: amount,
        kind: "capture",
        order_id: id,
      }
      capture_transaction[:currency] = currency if currency

      Transaction.create(capture_transaction)
    end

    def fulfillment_orders(options = {})
      ShopifyAPI::Base.version_validation!(FulfillmentOrder::MINIMUM_VERSION)

      fulfillment_order_hashes = get(:fulfillment_orders, options)
      fulfillment_order_hashes.map { |fulfillment_order_hash| FulfillmentOrder.new(fulfillment_order_hash) }
    end

    class ClientDetails < Base
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shopify_api-9.2.0 lib/shopify_api/resources/order.rb
shopify_api-9.1.0 lib/shopify_api/resources/order.rb
shopify_api-9.0.4 lib/shopify_api/resources/order.rb
shopify_api-9.0.3 lib/shopify_api/resources/order.rb
shopify_api-9.0.2 lib/shopify_api/resources/order.rb
shopify_api-9.0.1 lib/shopify_api/resources/order.rb
shopify_api-9.0.0 lib/shopify_api/resources/order.rb