Class: Spree::ReimbursementTaxCalculator

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/reimbursement_tax_calculator.rb

Overview

Tax calculation is broken out at this level to allow easy integration with 3rd party taxation systems. Those systems are usually geared toward calculating all items at once rather than one at a time.

To use an alternative tax calculator do this:

Spree::ReturnAuthorization.reimbursement_tax_calculator = calculator_object

where ‘calculator_object` is an object that responds to “call” and accepts a reimbursement object

Class Method Summary collapse

Class Method Details

.call(reimbursement) ⇒ Object



12
13
14
15
16
# File 'app/models/spree/reimbursement_tax_calculator.rb', line 12

def call(reimbursement)
  reimbursement.return_items.includes(:inventory_unit).each do |return_item|
    set_tax!(return_item)
  end
end