Class: C2eCore::Drops::OrderDiscountDrop

Inherits:
BaseDrop
  • Object
show all
Includes:
Helpers::OrderConversions
Defined in:
/build/app/mailers/c2e_core/drops/order_discount_drop.rb

Instance Method Summary collapse

Methods included from Helpers::OrderConversions

#converted_price, #format_price

Constructor Details

#initialize(discount_hash, order) ⇒ OrderDiscountDrop

Returns a new instance of OrderDiscountDrop.



8
9
10
11
12
# File '/build/app/mailers/c2e_core/drops/order_discount_drop.rb', line 8

def initialize(discount_hash, order)
  super()
  @discount_hash = discount_hash
  @order = order
end

Instance Method Details

#descriptionString

Returns - Discount description. E.g.: “Sleva 10% na každou druhou pizzu.”.

Returns:

  • (String)
    • Discount description. E.g.: “Sleva 10% na každou druhou pizzu.”



20
21
22
# File '/build/app/mailers/c2e_core/drops/order_discount_drop.rb', line 20

def description
  C2eCore::JsonLocalization.locale_for(@discount_hash["description"]["full"], @order.language).to_s
end

#valueFloat

Returns - Discount value converted into order’s currency. E.g.: 19.90.

Returns:

  • (Float)
    • Discount value converted into order’s currency. E.g.: 19.90



15
16
17
# File '/build/app/mailers/c2e_core/drops/order_discount_drop.rb', line 15

def value
  converted_price @discount_hash["discounted_value"]
end