Sha256: f5cd07b735c37adf4031b05f91a423433ace9fab582924fbdf23da8be259a4cc

Contents?: true

Size: 772 Bytes

Versions: 11

Compression:

Stored size: 772 Bytes

Contents

module Spree
  module Tax
    # Used to build shipping rate taxes
    class ShippingRateTaxer
      # Build shipping rate taxes for a shipping rate
      # Modifies the passed-in shipping rate with associated shipping rate taxes.
      # @param [Spree::ShippingRate] shipping_rate The shipping rate to add taxes to.
      #   This parameter will be modified.
      # @return [Spree::ShippingRate] The shipping rate with associated tax objects
      def tax(shipping_rate)
        taxes = Spree::Config.shipping_rate_tax_calculator_class.new(shipping_rate).calculate
        taxes.each do |tax|
          shipping_rate.taxes.build(
            amount: tax.amount,
            tax_rate: tax.tax_rate
          )
        end
        shipping_rate
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
solidus_core-2.4.2 app/models/spree/tax/shipping_rate_taxer.rb
solidus_core-2.3.1 app/models/spree/tax/shipping_rate_taxer.rb
solidus_core-2.4.1 app/models/spree/tax/shipping_rate_taxer.rb
solidus_core-2.4.0 app/models/spree/tax/shipping_rate_taxer.rb
solidus_core-2.4.0.rc1 app/models/spree/tax/shipping_rate_taxer.rb
solidus_core-2.4.0.beta1 app/models/spree/tax/shipping_rate_taxer.rb
solidus_core-2.3.0 app/models/spree/tax/shipping_rate_taxer.rb
solidus_core-2.3.0.rc3 app/models/spree/tax/shipping_rate_taxer.rb
solidus_core-2.3.0.rc2 app/models/spree/tax/shipping_rate_taxer.rb
solidus_core-2.3.0.rc1 app/models/spree/tax/shipping_rate_taxer.rb
solidus_core-2.3.0.beta1 app/models/spree/tax/shipping_rate_taxer.rb