From d98c103f6bc485d8398f5231bfe7917b772ec829 Mon Sep 17 00:00:00 2001 From: Jared Norman Date: Wed, 24 Apr 2019 16:53:03 -0700 Subject: More hacks to handle zero dollar orders I have a plan for how to handle these better in v1.0 though! --- lib/super_good/solidus_taxjar/api_params.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/super_good/solidus_taxjar') 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 -- cgit v1.2.3