Class: Spree::Tax::OrderAdjuster

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(order) ⇒ OrderAdjuster

Returns a new instance of OrderAdjuster

Parameters:



10
11
12
# File 'app/models/spree/tax/order_adjuster.rb', line 10

def initialize(order)
  @order = order
end

Instance Attribute Details

#orderObject (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