From 0203766a9291ae2eca5a73c067530564e09f481d Mon Sep 17 00:00:00 2001 From: Jared Norman Date: Wed, 24 Apr 2019 16:42:55 -0700 Subject: Report no tax collected when order zeroed out --- lib/super_good/solidus_taxjar/api_params.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/super_good') diff --git a/lib/super_good/solidus_taxjar/api_params.rb b/lib/super_good/solidus_taxjar/api_params.rb index 3d898c3..ca346ff 100644 --- a/lib/super_good/solidus_taxjar/api_params.rb +++ b/lib/super_good/solidus_taxjar/api_params.rb @@ -30,7 +30,7 @@ module SuperGood transaction_date: order.completed_at.to_formatted_s(:iso8601), amount: [order.total - order.additional_tax_total, 0].max, shipping: shipping(order), - sales_tax: order.additional_tax_total + sales_tax: sales_tax(order) ) end @@ -106,6 +106,12 @@ module SuperGood def shipping(order) SuperGood::SolidusTaxJar.shipping_calculator.(order) end + + def sales_tax(order) + return 0 if order.total.zero? + + order.additional_tax_total + end end end end -- cgit v1.2.3