Sha256: ca6365088067f78c54eacaea02dd434bd9bbbdef3ff9cc02d5e7a2ccb6ac8f99

Contents?: true

Size: 475 Bytes

Versions: 6

Compression:

Stored size: 475 Bytes

Contents

class Calculator::FlatPercentItemTotal < Calculator
  preference :flat_percent, :decimal, :default => 0

  def self.description
    I18n.t("flat_percent")
  end

  def self.register
    super                                
    Coupon.register_calculator(self)
    ShippingMethod.register_calculator(self)
    ShippingRate.register_calculator(self)
  end
  
  def compute(order)
    return if order.nil?
    order.item_total * self.preferred_flat_percent / 100.0
  end  
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
spree-enriquez-0.9.4 app/models/calculator/flat_percent_item_total.rb
spree-0.9.4 app/models/calculator/flat_percent_item_total.rb
spree-0.9.3 app/models/calculator/flat_percent_item_total.rb
spree-0.9.2 app/models/calculator/flat_percent_item_total.rb
spree-0.9.1 app/models/calculator/flat_percent_item_total.rb
spree-0.9.0 app/models/calculator/flat_percent_item_total.rb