Sha256: 1546907c2cb3d60a4b7e5f1ad1af4421f32f11ad23d8336aca78586f5d88c9d6

Contents?: true

Size: 479 Bytes

Versions: 23

Compression:

Stored size: 479 Bytes

Contents

require_dependency 'spree/calculator'

module Spree
  class Calculator::FlatRate < Calculator
    preference :amount, :decimal, default: 0
    preference :currency, :string, default: -> { Spree::Store.default.default_currency }

    def self.description
      Spree.t(:flat_rate_per_order)
    end

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

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
spree_core-4.8.3 app/models/spree/calculator/flat_rate.rb
spree_core-4.8.2 app/models/spree/calculator/flat_rate.rb
spree_core-4.7.3 app/models/spree/calculator/flat_rate.rb
spree_core-4.6.6 app/models/spree/calculator/flat_rate.rb
spree_core-4.5.5 app/models/spree/calculator/flat_rate.rb
spree_core-4.4.1 app/models/spree/calculator/flat_rate.rb
spree_core-4.5.4 app/models/spree/calculator/flat_rate.rb
spree_core-4.6.5 app/models/spree/calculator/flat_rate.rb
spree_core-4.7.2 app/models/spree/calculator/flat_rate.rb
spree_core-4.7.1 app/models/spree/calculator/flat_rate.rb
spree_core-4.6.4 app/models/spree/calculator/flat_rate.rb
spree_core-4.7.0 app/models/spree/calculator/flat_rate.rb
spree_core-4.6.3 app/models/spree/calculator/flat_rate.rb
spree_core-4.6.2 app/models/spree/calculator/flat_rate.rb
spree_core-4.6.1 app/models/spree/calculator/flat_rate.rb
spree_core-4.6.0 app/models/spree/calculator/flat_rate.rb
spree_core-4.5.3 app/models/spree/calculator/flat_rate.rb
spree_core-4.5.2 app/models/spree/calculator/flat_rate.rb
spree_core-4.5.1 app/models/spree/calculator/flat_rate.rb
spree_core-4.5.0 app/models/spree/calculator/flat_rate.rb