Class: Falsify::Order

Inherits:
Object
  • Object
show all
Extended by:
Enumerize
Defined in:
lib/falsify/models/order/order.rb

Overview

An order is a customer's completed request to purchase one or more products from a shop. See the API documentation. Required Fields:

  • line_items

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_idString (readonly)

The ID of the app that created the order.

Returns:

  • (String)


12
13
14
# File 'lib/falsify/models/order/order.rb', line 12

def app_id
  @app_id
end

#billing_addressAddress

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.

Returns:



16
17
18
# File 'lib/falsify/models/order/order.rb', line 16

def billing_address
  @billing_address
end

#browser_ipString (readonly)

The IP address of the browser used by the customer when they placed the order.

Returns:

  • (String)


19
20
21
# File 'lib/falsify/models/order/order.rb', line 19

def browser_ip
  @browser_ip
end

#buyer_accepts_marketingBoolean

Whether the customer consented to receive email updates from the shop.

Returns:

  • (Boolean)


22
23
24
# File 'lib/falsify/models/order/order.rb', line 22

def buyer_accepts_marketing
  @buyer_accepts_marketing
end

#cancel_reason:customer, ...

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.

Returns:

  • (:customer, :fraud, :inventory, :declined, :other)


32
# File 'lib/falsify/models/order/order.rb', line 32

enumerize :cancel_reason, in: [:customer, :fraud, :inventory, :declined, :other]

#cancelled_atString (readonly)

The date and time (ISO 8601 format) when the order was canceled.

Returns:

  • (String)


35
36
37
# File 'lib/falsify/models/order/order.rb', line 35

def cancelled_at
  @cancelled_at
end

#cart_tokenString (readonly)

The ID of the cart that's associated with the order.

Returns:

  • (String)


38
39
40
# File 'lib/falsify/models/order/order.rb', line 38

def cart_token
  @cart_token
end

#client_detailsClientDetails (readonly)

Information about the browser that the customer used when they placed their order:

Returns:



41
42
43
# File 'lib/falsify/models/order/order.rb', line 41

def client_details
  @client_details
end

#closed_atString (readonly)

The date and time (ISO 8601 format) when the order was closed.

Returns:

  • (String)


44
45
46
# File 'lib/falsify/models/order/order.rb', line 44

def closed_at
  @closed_at
end

#created_atString (readonly)

The autogenerated date and time (ISO 8601 format) when the order was created in Shopify. The value for this property cannot be changed.

Returns:

  • (String)


48
49
50
# File 'lib/falsify/models/order/order.rb', line 48

def created_at
  @created_at
end

#currencyString

The three-letter code (ISO 4217 format) for the shop currency.

Returns:

  • (String)


51
52
53
# File 'lib/falsify/models/order/order.rb', line 51

def currency
  @currency
end

#customerCustomer?

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.

Returns:



57
58
59
# File 'lib/falsify/models/order/order.rb', line 57

def customer
  @customer
end

#customer_localeString (readonly)

The two or three-letter language code, optionally followed by a region modifier.

Returns:

  • (String)


60
61
62
# File 'lib/falsify/models/order/order.rb', line 60

def customer_locale
  @customer_locale
end

#discount_applicationsArray<DiscountApplication>

Returns:



62
63
64
# File 'lib/falsify/models/order/order.rb', line 62

def discount_applications
  @discount_applications
end

#discount_codesArray<DiscountCode>

Returns:



64
65
66
# File 'lib/falsify/models/order/order.rb', line 64

def discount_codes
  @discount_codes
end

#emailString

The customer's email address.

Returns:

  • (String)


67
68
69
# File 'lib/falsify/models/order/order.rb', line 67

def email
  @email
end

#fulfillment_status:null, ...

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.

Returns:

  • (:null, :fulfilled, :partial, :restocked)


91
# File 'lib/falsify/models/order/order.rb', line 91

enumerize :fulfillment_status, in: [:null, :fulfilled, :partial, :restocked]

#fulfillmentsArray<Fulfillment>

A list of fulfillments associated with the order. For more information, see the Fulfillment API.

Returns:



82
83
84
# File 'lib/falsify/models/order/order.rb', line 82

def fulfillments
  @fulfillments
end

#gatewayString (readonly)

Deprecated.

Use the Transaction resource instead.

The payment gateway used.

Returns:

  • (String)


95
96
97
# File 'lib/falsify/models/order/order.rb', line 95

def gateway
  @gateway
end

#landing_siteString (readonly)

The URL for the page where the buyer landed when they entered the shop.

Returns:

  • (String)


102
103
104
# File 'lib/falsify/models/order/order.rb', line 102

def landing_site
  @landing_site
end

#line_itemsArray<LineItem>

A list of line item objects, each containing information about an item in the order.

Returns:

  • (Array<LineItem>)


105
106
107
# File 'lib/falsify/models/order/order.rb', line 105

def line_items
  @line_items
end

#location_idString

The ID of the physical location where the order was processed.

Returns:

  • (String)


108
109
110
# File 'lib/falsify/models/order/order.rb', line 108

def location_id
  @location_id
end

#nameString (readonly)

The order name as represented by a number. Must start with #.

Returns:

  • (String)


112
113
114
# File 'lib/falsify/models/order/order.rb', line 112

def name
  @name
end

#noteString

An optional note that a shop owner can attach to the order.

Returns:

  • (String)


115
116
117
# File 'lib/falsify/models/order/order.rb', line 115

def note
  @note
end

#note_attributesArray<Hash>

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.

Returns:

  • (Array<Hash>)


120
121
122
# File 'lib/falsify/models/order/order.rb', line 120

def note_attributes
  @note_attributes
end

#numberString (readonly)

For internal use only. An ID unique to the shop. Numbers are sequential and start at 1000.

Returns:

  • (String)


125
126
127
# File 'lib/falsify/models/order/order.rb', line 125

def number
  @number
end

#order_numberString (readonly)

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.

Returns:

  • (String)


129
130
131
# File 'lib/falsify/models/order/order.rb', line 129

def order_number
  @order_number
end

#order_status_urlString (readonly)

The URL pointing to the order status web page, if applicable.

Returns:

  • (String)


246
247
248
# File 'lib/falsify/models/order/order.rb', line 246

def order_status_url
  @order_status_url
end

#payment_detailsString (readonly)

Deprecated.

Use the Transaction resource instead.

An object containing information about the payment.

Returns:

  • (String)


133
134
135
# File 'lib/falsify/models/order/order.rb', line 133

def payment_details
  @payment_details
end

#payment_gateway_namesArray<String> (readonly)

The list of payment gateways used for the order.

Returns:

  • (Array<String>)


136
137
138
# File 'lib/falsify/models/order/order.rb', line 136

def payment_gateway_names
  @payment_gateway_names
end

#phoneString

The customer's phone number for receiving SMS notifications.

Returns:

  • (String)


139
140
141
# File 'lib/falsify/models/order/order.rb', line 139

def phone
  @phone
end

#presentment_currencyString

The presentment currency that was used to display prices to the customer.

Returns:

  • (String)


142
143
144
# File 'lib/falsify/models/order/order.rb', line 142

def presentment_currency
  @presentment_currency
end

#processed_atString

The date and time (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.

Returns:

  • (String)


148
149
150
# File 'lib/falsify/models/order/order.rb', line 148

def processed_at
  @processed_at
end

#processing_method:checkout, ... (readonly)

How the payment was processed.

Returns:

  • (:checkout, :direct, :manual, :offsite, :express, :free)


159
# File 'lib/falsify/models/order/order.rb', line 159

enumerize :processing_method, in: [:checkout, :direct, :manual, :offsite, :express, :free]

#referring_siteString

The website where the customer clicked a link to the shop.

Returns:

  • (String)


162
163
164
# File 'lib/falsify/models/order/order.rb', line 162

def referring_site
  @referring_site
end

#refundsArray<Refund> (readonly)

A list of refunds applied to the order. For more information, see the Refund API.

Returns:



166
167
168
# File 'lib/falsify/models/order/order.rb', line 166

def refunds
  @refunds
end

#shipping_addressAddress

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.

Returns:



170
171
172
# File 'lib/falsify/models/order/order.rb', line 170

def shipping_address
  @shipping_address
end

#shipping_linesArray<ShippingLine>

An array of objects, each of which details a shipping method used.

Returns:



173
174
175
# File 'lib/falsify/models/order/order.rb', line 173

def shipping_lines
  @shipping_lines
end

#shopify_idString (readonly)

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.

Returns:

  • (String)


99
100
101
# File 'lib/falsify/models/order/order.rb', line 99

def shopify_id
  @shopify_id
end

#source_nameString

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.

Returns:

  • (String)


180
181
182
# File 'lib/falsify/models/order/order.rb', line 180

def source_name
  @source_name
end

#subtotal_priceString

The price of the order in the shop currency after discounts but before shipping, taxes, and tips.

Returns:

  • (String)


183
184
185
# File 'lib/falsify/models/order/order.rb', line 183

def subtotal_price
  @subtotal_price
end

#subtotal_price_setPriceSet

The subtotal of the order in shop and presentment currencies.

Returns:



186
187
188
# File 'lib/falsify/models/order/order.rb', line 186

def subtotal_price_set
  @subtotal_price_set
end

#tagsString

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.

Returns:

  • (String)


191
192
193
# File 'lib/falsify/models/order/order.rb', line 191

def tags
  @tags
end

#tax_linesArray<TaxLine>

An array of tax line objects, each of which details a tax applicable to the order.

Returns:



194
195
196
# File 'lib/falsify/models/order/order.rb', line 194

def tax_lines
  @tax_lines
end

#taxes_includedBoolean

Whether taxes are included in the order subtotal.

Returns:

  • (Boolean)


197
198
199
# File 'lib/falsify/models/order/order.rb', line 197

def taxes_included
  @taxes_included
end

#testBoolean

Whether this is a test order.

Returns:

  • (Boolean)


200
201
202
# File 'lib/falsify/models/order/order.rb', line 200

def test
  @test
end

#tokenString (readonly)

A unique token for the order.

Returns:

  • (String)


203
204
205
# File 'lib/falsify/models/order/order.rb', line 203

def token
  @token
end

#total_discountsString

The total discounts applied to the price of the order in the shop currency.

Returns:

  • (String)


206
207
208
# File 'lib/falsify/models/order/order.rb', line 206

def total_discounts
  @total_discounts
end

#total_discounts_setPriceSet

The total discounts applied to the price of the order in shop and presentment currencies.

Returns:



209
210
211
# File 'lib/falsify/models/order/order.rb', line 209

def total_discounts_set
  @total_discounts_set
end

#total_line_items_priceString

The sum of all line item prices in the shop currency.

Returns:

  • (String)


212
213
214
# File 'lib/falsify/models/order/order.rb', line 212

def total_line_items_price
  @total_line_items_price
end

#total_line_items_price_setString

The total of all line item prices in shop and presentment currencies.

Returns:

  • (String)


215
216
217
# File 'lib/falsify/models/order/order.rb', line 215

def total_line_items_price_set
  @total_line_items_price_set
end

#total_priceString

The sum of all line item prices, discounts, shipping, taxes, and tips in the shop currency. Must be positive.

Returns:

  • (String)


219
220
221
# File 'lib/falsify/models/order/order.rb', line 219

def total_price
  @total_price
end

#total_price_setPriceSet

The total price of the order in shop and presentment currencies.

Returns:



222
223
224
# File 'lib/falsify/models/order/order.rb', line 222

def total_price_set
  @total_price_set
end

#total_taxString

The sum of all the taxes applied to the order in the shop currency. Must be positive.

Returns:

  • (String)


226
227
228
# File 'lib/falsify/models/order/order.rb', line 226

def total_tax
  @total_tax
end

#total_tax_setPriceSet

The total tax applied to the order in shop and presentment currencies.

Returns:



229
230
231
# File 'lib/falsify/models/order/order.rb', line 229

def total_tax_set
  @total_tax_set
end

#total_tip_receivedString

The sum of all the tips in the order in the shop currency.

Returns:

  • (String)


232
233
234
# File 'lib/falsify/models/order/order.rb', line 232

def total_tip_received
  @total_tip_received
end

#total_weightString

The sum of all line item weights in grams.

Returns:

  • (String)


235
236
237
# File 'lib/falsify/models/order/order.rb', line 235

def total_weight
  @total_weight
end

#updated_atString (readonly)

The date and time (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 and Event APIs to subscribe to order events instead.

Returns:

  • (String)


240
241
242
# File 'lib/falsify/models/order/order.rb', line 240

def updated_at
  @updated_at
end

#user_idString

The ID of the user logged into Shopify POS who processed the order, if applicable.

Returns:

  • (String)


243
244
245
# File 'lib/falsify/models/order/order.rb', line 243

def user_id
  @user_id
end

Instance Method Details

#financial_status:pending, ...

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.

Returns:

  • (:pending, :authorized, :partially_paid, :paid, :partially_refunded, :refunded, :voided)


78
# File 'lib/falsify/models/order/order.rb', line 78

enumerize :financial_status, in: [:pending, :authorized, :partially_paid, :paid, :partially_refunded, :refunded, :voided]