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:



8
9
10
# File 'app/models/spree/tax/order_adjuster.rb', line 8

def initialize(order)
  @order = order
end

Instance Attribute Details

#orderObject (readonly)

Returns the value of attribute order



5
6
7
# File 'app/models/spree/tax/order_adjuster.rb', line 5

def order
  @order
end

Instance Method Details

#adjust!Object

Creates tax adjustments for all taxable items (shipments and line items) in the given order.



14
15
16
17
# File 'app/models/spree/tax/order_adjuster.rb', line 14

def adjust!
  taxes = Spree::Config.tax_calculator_class.new(order).calculate
  Spree::OrderTaxation.new(order).apply(taxes)
end