Class: Spree::Tax::OrderAdjuster
- Inherits:
-
Object
- Object
- Spree::Tax::OrderAdjuster
- Defined in:
- app/models/spree/tax/order_adjuster.rb
Overview
Add tax adjustments to all line items and shipments in an order
Instance Attribute Summary collapse
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Instance Method Summary collapse
-
#adjust! ⇒ Object
Creates tax adjustments for all taxable items (shipments and line items) in the given order.
-
#initialize(order) ⇒ OrderAdjuster
constructor
A new instance of OrderAdjuster.
Constructor Details
#initialize(order) ⇒ OrderAdjuster
Returns a new instance of OrderAdjuster.
10 11 12 |
# File 'app/models/spree/tax/order_adjuster.rb', line 10 def initialize(order) @order = order end |
Instance Attribute Details
#order ⇒ Object (readonly)
Returns the value of attribute order.
7 8 9 |
# File 'app/models/spree/tax/order_adjuster.rb', line 7 def order @order end |
Instance Method Details
#adjust! ⇒ Object
Creates tax adjustments for all taxable items (shipments and line items) in the given order.
16 17 18 19 |
# File 'app/models/spree/tax/order_adjuster.rb', line 16 def adjust! taxes = Spree::Config.tax_calculator_class.new(order).calculate Spree::OrderTaxation.new(order).apply(taxes) end |