summaryrefslogtreecommitdiff
path: root/lib/super_good/solidus_taxjar
diff options
context:
space:
mode:
authorJared Norman <jared@super.gd>2019-04-24 16:42:55 -0700
committerJared Norman <jared@super.gd>2019-04-24 16:42:55 -0700
commit0203766a9291ae2eca5a73c067530564e09f481d (patch)
tree3941b71ab1c93620d5630eab6e4a3ae6a55cbd32 /lib/super_good/solidus_taxjar
parent656181bb7e234da0872239c8572965c8aaad58cd (diff)
Report no tax collected when order zeroed out
Diffstat (limited to 'lib/super_good/solidus_taxjar')
-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 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