Class: Falsify::DiscountApplication
- Inherits:
-
Object
- Object
- Falsify::DiscountApplication
- Extended by:
- Enumerize
- Defined in:
- lib/falsify/models/order/discount_application.rb
Overview
An ordered list of stacked discount applications.
The discount_applications
property includes 3 types: discount_code
, manual
, and script
.
All 3 types share a common structure and have some type specific attributes.
Instance Attribute Summary collapse
-
#allocation_method ⇒ :across, ...
The method by which the discount application value has been allocated to entitled lines.
-
#code ⇒ String
The discount code that was used to apply the discount.
-
#description ⇒ String
The description of the discount application, as defined by the merchant or the Shopify Script.
-
#target_selection ⇒ :all, ...
The lines on the order, of the type defined by
target_type
, that the discount is allocated over. -
#target_type ⇒ :line_item, :shipping_line
The type of line on the order that the discount is applicable on.
-
#title ⇒ String
The title of the discount application, as defined by the merchant.
-
#type ⇒ :manual, ...
The discount application type.
-
#value ⇒ String
The value of the discount application as a decimal.
-
#value_type ⇒ :fixed_amount, :percentage
The type of the value.
Instance Attribute Details
#allocation_method ⇒ :across, ...
The method by which the discount application value has been allocated to entitled lines.
across
: The value is spread across all entitled lines.each
: The value is applied onto every entitled line.one
: The value is applied onto a single line.
15 |
# File 'lib/falsify/models/order/discount_application.rb', line 15 enumerize :allocation_method, in: [:across, :each, :one] |
#code ⇒ String
The discount code that was used to apply the discount. Available only for discount code applications.
19 20 21 |
# File 'lib/falsify/models/order/discount_application.rb', line 19 def code @code end |
#description ⇒ String
The description of the discount application, as defined by the merchant or the Shopify Script. Available only for manual and script discount applications.
23 24 25 |
# File 'lib/falsify/models/order/discount_application.rb', line 23 def description @description end |
#target_selection ⇒ :all, ...
The lines on the order, of the type defined by target_type
, that the discount is allocated over.
all
: The discount is allocated onto all lines,entitled
: The discount is allocated only onto lines it is entitled for.explicit
: The discount is allocated onto explicitly selected lines.
30 |
# File 'lib/falsify/models/order/discount_application.rb', line 30 enumerize :target_selection, in: [:all, :entitled, :explicit] |
#target_type ⇒ :line_item, :shipping_line
The type of line on the order that the discount is applicable on. Valid values:
line_item
: The discount applies to line items.shipping_line
: The discount applies to shipping lines.
37 |
# File 'lib/falsify/models/order/discount_application.rb', line 37 enumerize :target_selection, in: [:line_item, :shipping_line] |
#title ⇒ String
The title of the discount application, as defined by the merchant. Available only for manual discount applications.
41 42 43 |
# File 'lib/falsify/models/order/discount_application.rb', line 41 def title @title end |
#type ⇒ :manual, ...
The discount application type.
manual
: The discount was manually applied by the merchant (for example, by using an app or creating a draft order).script
: The discount was applied by a Shopify Script.discount_code
: The discount was applied by a discount code.
48 |
# File 'lib/falsify/models/order/discount_application.rb', line 48 enumerize :type, in: [:manual, :script, :discount_code] |
#value ⇒ String
The value of the discount application as a decimal.
This represents the intention of the discount application.
For example, if the intent was to apply a 20% discount, then the value will be 20.0
.
If the intent was to apply a $15 discount, then the value will be 15.0
.
54 55 56 |
# File 'lib/falsify/models/order/discount_application.rb', line 54 def value @value end |
#value_type ⇒ :fixed_amount, :percentage
The type of the value.
fixed_amount
: A fixed amount discount value in the currency of the order.percentage
: A percentage discount value.
60 |
# File 'lib/falsify/models/order/discount_application.rb', line 60 enumerize :value_type, in: [:fixed_amount, :percentage] |