11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/super_good/solidus_taxjar/tax_calculator.rb', line 11
def calculate
return no_tax if SuperGood::SolidusTaxjar.test_mode
return no_tax if incomplete_address?(order.tax_address) || order.line_items.none?
return no_tax unless taxable_order? order
return no_tax unless taxable_address? order.tax_address
cache do
next no_tax unless taxjar_breakdown
::Spree::Tax::OrderTax.new(
order_id: order.id,
line_item_taxes: line_item_taxes,
shipment_taxes: shipment_taxes
)
end
rescue => e
exception_handler.call(e)
no_tax
end
|