Sha256: 51f0f061e1bbdb77258c1f4ec3b878b01c42b351972252ccbb99d5e69e09138f

Contents?: true

Size: 780 Bytes

Versions: 3

Compression:

Stored size: 780 Bytes

Contents

module Spree
  Stock::Estimator.class_eval do

    def calculate_shipping_rates(package, ui_filter)
      shipping_methods(package, ui_filter).map do |shipping_method|
        calculator = shipping_method.calculator
        cost = calculator.compute(package)

        timing_info = if calculator.respond_to? :timing_info
                        calculator.timing_info(package) || {}
                      else
                        {}
                      end

        shipping_method.shipping_rates.new(
          cost: gross_amount(cost, taxation_options_for(shipping_method)),
          tax_rate: first_tax_rate_for(shipping_method.tax_category),
          days: timing_info[:days],
          info: timing_info[:info]
        ) if cost

      end.compact
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_correios_shipping-1.1.4 app/models/spree/stock/estimator_decorator.rb
spree_correios_shipping-1.1.3 app/models/spree/stock/estimator_decorator.rb
spree_correios_shipping-1.1.2 app/models/spree/stock/estimator_decorator.rb