Class: Spree::TaxCalculator::Default
- Inherits:
-
Object
- Object
- Spree::TaxCalculator::Default
- Includes:
- Spree::Tax::TaxHelpers
- Defined in:
- app/models/spree/tax_calculator/default.rb
Overview
Note:
This API is currently in development and likely to change. Specifically, the input format is not yet finalized.
Default implementation for tax calculations. Will go through all line items and shipments and calculate their tax based on tax rates in the DB.
The class used for tax calculation is configurable, so that the calculation can easily be pushed to third-party services. Users looking to provide their own calculator should adhere to the API of this class.
Instance Method Summary collapse
-
#calculate ⇒ Spree::Tax::OrderTax
Calculate taxes for an order.
-
#initialize(order) ⇒ Spree::TaxCalculator::Default
constructor
Create a new tax calculator.
Constructor Details
#initialize(order) ⇒ Spree::TaxCalculator::Default
Create a new tax calculator.
20 21 22 |
# File 'app/models/spree/tax_calculator/default.rb', line 20 def initialize(order) @order = order end |
Instance Method Details
#calculate ⇒ Spree::Tax::OrderTax
Calculate taxes for an order.
27 28 29 30 31 32 33 |
# File 'app/models/spree/tax_calculator/default.rb', line 27 def calculate Spree::Tax::OrderTax.new( order_id: order.id, line_item_taxes: line_item_rates, shipment_taxes: shipment_rates ) end |