summaryrefslogtreecommitdiff
path: root/lib/super_good/solidus_taxjar/api_params.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/super_good/solidus_taxjar/api_params.rb')
-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