diff options
author | Jared Norman <jared@super.gd> | 2019-04-24 16:42:55 -0700 |
---|---|---|
committer | Jared Norman <jared@super.gd> | 2019-04-24 16:42:55 -0700 |
commit | 0203766a9291ae2eca5a73c067530564e09f481d (patch) | |
tree | 3941b71ab1c93620d5630eab6e4a3ae6a55cbd32 /lib/super_good/solidus_taxjar | |
parent | 656181bb7e234da0872239c8572965c8aaad58cd (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.rb | 8 |
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 |