Class: Spree::Tax::ShippingRateTaxer Private

Inherits:
Object
  • Object
show all
Includes:
TaxHelpers
Defined in:
app/models/spree/tax/shipping_rate_taxer.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Used to build shipping rate taxes

Instance Method Summary (collapse)

Instance Method Details

- (Spree::ShippingRate) tax(shipping_rate)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Build shipping rate taxes for a shipping rate Modifies the passed-in shipping rate with associated shipping rate taxes.

Parameters:

  • shipping_rate (Spree::ShippingRate)

    The shipping rate to add taxes to. This parameter will be modified.

Returns:



12
13
14
15
16
17
18
19
20
# File 'app/models/spree/tax/shipping_rate_taxer.rb', line 12

def tax(shipping_rate)
  tax_rates_for_shipping_rate(shipping_rate).each do |tax_rate|
    shipping_rate.taxes.build(
      amount: tax_rate.compute_amount(shipping_rate),
      tax_rate: tax_rate
    )
  end
  shipping_rate
end