Class: SolidusFriendlyPromotions::Calculators::FlatRate

Inherits:
Spree::Calculator
  • Object
show all
Includes:
PromotionCalculator
Defined in:
app/models/solidus_friendly_promotions/calculators/flat_rate.rb

Instance Method Summary collapse

Methods included from PromotionCalculator

#description

Instance Method Details

#compute(object = nil) ⇒ Object



13
14
15
16
17
18
19
20
# File 'app/models/solidus_friendly_promotions/calculators/flat_rate.rb', line 13

def compute(object = nil)
  currency = object.order.currency
  if object && preferred_currency.casecmp(currency).zero?
    preferred_amount
  else
    0
  end
end