Sha256: c416aa1ce281585d7e4394320e4a232759a5535b84360a1bc97bcf51dd894fc4

Contents?: true

Size: 388 Bytes

Versions: 26

Compression:

Stored size: 388 Bytes

Contents

require_dependency 'spree/calculator'

module Spree
  class Calculator::FlatRate < Calculator
    preference :amount, :decimal, default: 0
    preference :currency, :string, default: ->{ Spree::Config[:currency] }

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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
solidus_core-2.5.2 app/models/spree/calculator/flat_rate.rb
solidus_core-2.5.1 app/models/spree/calculator/flat_rate.rb
solidus_core-2.5.0 app/models/spree/calculator/flat_rate.rb
solidus_core-2.5.0.rc1 app/models/spree/calculator/flat_rate.rb
solidus_core-2.5.0.beta2 app/models/spree/calculator/flat_rate.rb
solidus_core-2.5.0.beta1 app/models/spree/calculator/flat_rate.rb
solidus_core-2.4.2 app/models/spree/calculator/flat_rate.rb
solidus_core-2.3.1 app/models/spree/calculator/flat_rate.rb
solidus_core-2.4.1 app/models/spree/calculator/flat_rate.rb
solidus_core-2.2.2 app/models/spree/calculator/flat_rate.rb
solidus_core-2.1.1 app/models/spree/calculator/flat_rate.rb
solidus_core-2.4.0 app/models/spree/calculator/flat_rate.rb
solidus_core-2.4.0.rc1 app/models/spree/calculator/flat_rate.rb
solidus_core-2.4.0.beta1 app/models/spree/calculator/flat_rate.rb
solidus_core-2.3.0 app/models/spree/calculator/flat_rate.rb
solidus_core-2.3.0.rc3 app/models/spree/calculator/flat_rate.rb
solidus_core-2.3.0.rc2 app/models/spree/calculator/flat_rate.rb
solidus_core-2.3.0.rc1 app/models/spree/calculator/flat_rate.rb
solidus_core-2.3.0.beta1 app/models/spree/calculator/flat_rate.rb
solidus_core-2.2.1 app/models/spree/calculator/flat_rate.rb