summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJared Norman <jared@super.gd>2019-04-24 16:53:03 -0700
committerJared Norman <jared@super.gd>2019-04-24 16:55:12 -0700
commitd98c103f6bc485d8398f5231bfe7917b772ec829 (patch)
tree0b95fc781ee20c3f400da27d8ffc805aff92920f /lib
parent0203766a9291ae2eca5a73c067530564e09f481d (diff)
More hacks to handle zero dollar orders
I have a plan for how to handle these better in v1.0 though!
Diffstat (limited to 'lib')
-rw-r--r--lib/super_good/solidus_taxjar/api_params.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/super_good/solidus_taxjar/api_params.rb b/lib/super_good/solidus_taxjar/api_params.rb
index ca346ff..53b2c81 100644
--- a/lib/super_good/solidus_taxjar/api_params.rb
+++ b/lib/super_good/solidus_taxjar/api_params.rb
@@ -85,7 +85,7 @@ module SuperGood
product_tax_code: line_item.tax_category&.tax_code,
unit_price: line_item.price,
discount: discount(line_item),
- sales_tax: line_item.additional_tax_total
+ sales_tax: line_item_sales_tax(line_item)
}
end
}
@@ -112,6 +112,12 @@ module SuperGood
order.additional_tax_total
end
+
+ def line_item_sales_tax(line_item)
+ return 0 if line_item.order.total.zero?
+
+ line_item.additional_tax_total
+ end
end
end
end