Class: Spree::TaxRate
- Includes:
- AdjustmentSource, CalculatedAdjustments
- Defined in:
- app/models/spree/tax_rate.rb
Instance Method Summary collapse
-
#adjust(_order_tax_zone, item) ⇒ Object
Creates necessary tax adjustments for the order.
-
#compute_amount(item) ⇒ Object
This method is used by Adjustment#update to recalculate the cost.
Methods included from AdjustmentSource
#deals_with_adjustments_for_deleted_source
Methods included from CalculatedAdjustments
#calculator_type, #calculator_type=
Methods inherited from Base
display_includes, #initialize_preference_defaults, page, preference
Methods included from Preferences::Preferable
#default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Instance Method Details
#adjust(_order_tax_zone, item) ⇒ Object
Creates necessary tax adjustments for the order.
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'app/models/spree/tax_rate.rb', line 75 def adjust(_order_tax_zone, item) amount = compute_amount(item) included = included_in_price && amount > 0 item.adjustments.create!( source: self, amount: amount, order_id: item.order_id, label: adjustment_label(amount), included: included ) end |
#compute_amount(item) ⇒ Object
This method is used by Adjustment#update to recalculate the cost.
90 91 92 |
# File 'app/models/spree/tax_rate.rb', line 90 def compute_amount(item) calculator.compute(item) end |