Class: Falsify::DiscountCode
- Inherits:
-
Object
- Object
- Falsify::DiscountCode
- Extended by:
- Enumerize
- Defined in:
- lib/falsify/models/order/discount_code.rb
Overview
Discount codes to be applied to an order.
Instance Attribute Summary collapse
-
#amount ⇒ String
The value of the discount to be deducted from the order total.
-
#code ⇒ String
The discount code.
-
#type ⇒ :fixed_amount, ...
The type of discount.
Instance Attribute Details
#amount ⇒ String
The value of the discount to be deducted from the order total.
The type
field determines how this value is calculated.
After an order is created, this field returns the calculated amount.
11 12 13 |
# File 'lib/falsify/models/order/discount_code.rb', line 11 def amount @amount end |
#code ⇒ String
The discount code.
14 15 16 |
# File 'lib/falsify/models/order/discount_code.rb', line 14 def code @code end |
#type ⇒ :fixed_amount, ...
The type of discount.
Default value: fixed_amount
.
Valid values:
fixed_amount
: Appliesamount
as a unit of the store's currency. For example, ifamount
is 30 and the store's currency is USD, then 30 USD is deducted from the order total when the discount is applied.percentage
: Applies a discount ofamount
as a percentage of the order total.shipping
: Applies a free shipping discount on orders that have a shipping rate less than or equal toamount
. For example, ifamount
is 30, then the discount will give the customer free shipping for any shipping rate that is less than or equal to $30.
24 |
# File 'lib/falsify/models/order/discount_code.rb', line 24 enumerize :status, in: [:fixed_amount, :percentage, :shipping] |