require "enumerize" module Falsify # An order is a customer's completed request to purchase one or more products from a shop. # See the [API documentation](https://help.shopify.com/en/api/reference/orders/order). # Required Fields: # - line_items class Order extend Enumerize # The ID of the app that created the order. # @return [String] attr_reader :app_id # The mailing address associated with the payment method. # This address is an optional field that won't be available on orders that do not require a payment method. # @return [Address] attr_accessor :billing_address # The IP address of the browser used by the customer when they placed the order. # @return [String] attr_reader :browser_ip # Whether the customer consented to receive email updates from the shop. # @return [Boolean] attr_accessor :buyer_accepts_marketing # @!attribute cancel_reason [rw] # The reason why the order was canceled. # - `:customer` - The customer canceled the order. # - `:fraud` - The order was fraudulent. # - `:inventory` - Items in the order were not in inventory. # - `:declined` - The payment was declined. # - `:other` - A reason not in this list. # # @return [:customer, :fraud, :inventory, :declined, :other] enumerize :cancel_reason, in: [:customer, :fraud, :inventory, :declined, :other] # The date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when the order was canceled. # @return [String] attr_reader :cancelled_at # The ID of the cart that's associated with the order. # @return [String] attr_reader :cart_token # Information about the browser that the customer used when they placed their order: # @return [ClientDetails] attr_reader :client_details # The date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when the order was closed. # @return [String] attr_reader :closed_at # The autogenerated date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when the order was created in Shopify. # The value for this property cannot be changed. # @return [String] attr_reader :created_at # The three-letter code ([ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format) for the shop currency. # @return [String] attr_accessor :currency # Information about the customer. # The order might not have a customer and apps should not depend on the existence of a `customer` object. # This value might be `null` if the order was created through Shopify POS. # For more information about the `customer` object, see the [Customer resource](https://help.shopify.com/en/api/reference/customers/customer). # @return [Customer,nil] attr_accessor :customer # The two or three-letter language code, optionally followed by a region modifier. # @return [String] attr_reader :customer_locale # @return [Array] attr_accessor :discount_applications # @return [Array] attr_accessor :discount_codes # The customer's email address. # @return [String] attr_accessor :email # The status of payments associated with the order. # Can only be set when the order is created. # - `:pending` - The payments are pending. Payment might fail in this state. Check again to confirm whether the payments have been paid successfully. # - `:authorized` - The payments have been authorized. # - `:partially_paid` - The order have been partially paid. # - `:paid` - The payments have been paid. # - `:partially_refunded` - The payments have been partially refunded. # - `:refunded` - The payments have been refunded. # - `:voided` - The payments have been voided. # @return [:pending, :authorized, :partially_paid, :paid, :partially_refunded, :refunded, :voided] enumerize :financial_status, in: [:pending, :authorized, :partially_paid, :paid, :partially_refunded, :refunded, :voided] # A list of fulfillments associated with the order. # For more information, see the [Fulfillment API](https://help.shopify.com/en/api/reference/shipping-and-fulfillment/fulfillment). # @return [Array] attr_accessor :fulfillments # @!attribute fulfillment_status [rw] # The order's status in terms of fulfilled line items. # - `:fulfilled` - Every line item in the order has been fulfilled. # - `:null` - None of the line items in the order have been fulfilled. # - `:partial` - At least one line item in the order has been fulfilled. # - `:restocked` - Every line item in the order has been restocked and the order canceled. # # @return [:null, :fulfilled, :partial, :restocked] enumerize :fulfillment_status, in: [:null, :fulfilled, :partial, :restocked] # The payment gateway used. # @deprecated Use the [Transaction resource](https://help.shopify.com/en/api/reference/orders/transaction) instead. # @return [String] attr_reader :gateway # The ID of the order, used for API purposes. # This is different from the `order_number` property, which is the ID used by the shop owner and customer. # @return [String] attr_reader :shopify_id # The URL for the page where the buyer landed when they entered the shop. # @return [String] attr_reader :landing_site # A list of line item objects, each containing information about an item in the order. # @return [Array] attr_accessor :line_items # The ID of the physical location where the order was processed. # @return [String] attr_accessor :location_id # The order name as represented by a number. # Must start with `#`. # @return [String] attr_reader :name # An optional note that a shop owner can attach to the order. # @return [String] attr_accessor :note # Extra information that is added to the order. # Appears in the **Additional details** section of an order details page. # Each array entry must contain a hash with `name` and `value` keys. # @return [Array] attr_accessor :note_attributes # For internal use only. # An ID unique to the shop. # Numbers are sequential and start at 1000. # @return [String] attr_reader :number # The ID of the order used by the shop owner and customer. # This is different from the `shopify_id` property, which is the ID of the order used by the API. # @return [String] attr_reader :order_number # An object containing information about the payment. # @deprecated Use the [Transaction resource](https://help.shopify.com/en/api/reference/orders/transaction) instead. # @return [String] attr_reader :payment_details # The list of payment gateways used for the order. # @return [Array] attr_reader :payment_gateway_names # The customer's phone number for receiving SMS notifications. # @return [String] attr_accessor :phone # The presentment currency that was used to display prices to the customer. # @return [String] attr_accessor :presentment_currency # The date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when an order was processed. # This value is the date that appears on your orders and that's used in the analytic reports. # By default, it matches the `created_at` value. # If you're importing orders from an app or another platform, then you can set `processed_at` to a date and time in the past to match when the original order was created. # @return [String] attr_accessor :processed_at # @!attribute processing_method [r] # How the payment was processed. # - `:checkout` - The order was processed using the Shopify checkout. # - `:direct` - The order was processed using a [direct payment provider](/en/manual/payments/third-party-providers/direct-and-external-providers). # - `:manual` - The order was processed using a [manual payment method](/en/manual/payments/manual-payments). # - `:offsite` - The order was processed by an [external payment provider](/en/manual/payments/third-party-providers/direct-and-external-providers) to the Shopify checkout. # - `:express` - The order was processed using [PayPal Express Checkout](/en/manual/payments/paypal). # - `:free` - The order was processed as a free order using a discount code. # # @return [:checkout, :direct, :manual, :offsite, :express, :free] enumerize :processing_method, in: [:checkout, :direct, :manual, :offsite, :express, :free] # The website where the customer clicked a link to the shop. # @return [String] attr_accessor :referring_site # A list of refunds applied to the order. # For more information, see the [Refund API](https://help.shopify.com/en/api/reference/orders/refund). # @return [Array] attr_reader :refunds # The mailing address to where the order will be shipped. # This address is optional and will not be available on orders that do not require shipping. # @return [Address] attr_accessor :shipping_address # An array of objects, each of which details a shipping method used. # @return [Array] attr_accessor :shipping_lines # Where the order originated. # Can be set only during order creation, and is not writeable afterwards. # Values for Shopify channels are protected and cannot be assigned by other API clients: `web`, `pos`, `shopify_draft_order`, `iphone`, and `android`. # Orders created via the API can be assigned any other string of your choice. # If unspecified, then new orders are assigned the value of your app's ID. # @return [String] attr_accessor :source_name # The price of the order in the shop currency after discounts but before shipping, taxes, and tips. # @return [String] attr_accessor :subtotal_price # The subtotal of the order in shop and presentment currencies. # @return [PriceSet] attr_accessor :subtotal_price_set # Tags attached to the order, formatted as a string of comma-separated values. # Tags are additional short descriptors, commonly used for filtering and searching. # Each individual tag is limited to 40 characters in length. # @return [String] attr_accessor :tags # An array of tax line objects, each of which details a tax applicable to the order. # @return [Array] attr_accessor :tax_lines # Whether taxes are included in the order subtotal. # @return [Boolean] attr_accessor :taxes_included # Whether this is a test order. # @return [Boolean] attr_accessor :test # A unique token for the order. # @return [String] attr_reader :token # The total discounts applied to the price of the order in the shop currency. # @return [String] attr_accessor :total_discounts # The total discounts applied to the price of the order in shop and presentment currencies. # @return [PriceSet] attr_accessor :total_discounts_set # The sum of all line item prices in the shop currency. # @return [String] attr_accessor :total_line_items_price # The total of all line item prices in shop and presentment currencies. # @return [String] attr_accessor :total_line_items_price_set # The sum of all line item prices, discounts, shipping, taxes, and tips in the shop currency. # Must be positive. # @return [String] attr_accessor :total_price # The total price of the order in shop and presentment currencies. # @return [PriceSet] attr_accessor :total_price_set # The sum of all the taxes applied to the order in the shop currency. # Must be positive. # @return [String] attr_accessor :total_tax # The total tax applied to the order in shop and presentment currencies. # @return [PriceSet] attr_accessor :total_tax_set # The sum of all the tips in the order in the shop currency. # @return [String] attr_accessor :total_tip_received # The sum of all line item weights in grams. # @return [String] attr_accessor :total_weight # The date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when the order was last modified. # Filtering orders by `updated_at` is not an effective method for fetching orders because its value can change when no visible fields of an order have been updated. # Use the [Webhook](https://help.shopify.com/en/api/reference/events/webhook) and [Event](https://help.shopify.com/en/api/reference/events/event) APIs to subscribe to order events instead. # @return [String] attr_reader :updated_at # The ID of the user logged into Shopify POS who processed the order, if applicable. # @return [String] attr_accessor :user_id # The URL pointing to the [order status web page](https://help.shopify.com/manual/orders/status-tracking), if applicable. # @return [String] attr_reader :order_status_url end end