Class: SpreeAvatax::Calculator

Inherits:
Spree::Calculator
  • Object
show all
Defined in:
app/models/spree_avatax/calculator.rb

Overview

This is a no-op calculator that just returns the existing value. We hook our tax calculations in SpreeAvatax::TaxComputer at the order level instead of here at the line item level

Defined Under Namespace

Classes: DoNotUseCompute, TooManyPossibleAdjustments

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.descriptionObject



12
13
14
# File 'app/models/spree_avatax/calculator.rb', line 12

def self.description
  Spree.t(:avatax_description)
end

Instance Method Details

#compute(computable) ⇒ Object

Raises:



16
17
18
# File 'app/models/spree_avatax/calculator.rb', line 16

def compute(computable)
  raise DoNotUseCompute.new("The avatax calculator should never use #compute")
end

#compute_shipping_rate(shipping_rate) ⇒ Object



20
21
22
23
24
# File 'app/models/spree_avatax/calculator.rb', line 20

def compute_shipping_rate(shipping_rate)
  # always return zero here.  we'll take care of calculating this ourselves at different points
  # via hooks into the order
  0
end