summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJared Norman <jared@super.gd>2019-05-13 20:10:05 -0700
committerJared Norman <jared@super.gd>2019-05-13 20:10:05 -0700
commit1015448f7dc6efa85a4b65c5417dfc870571ea73 (patch)
treea81923e77cfdf6ac005f140a6356b256475edb5b /lib
parenteaf4f8186610b2b1042630040f5fe96e38d8252f (diff)
Send customer_id to TaxJar API
This is required to support per-customer exemptions through the TaxJar API.
Diffstat (limited to 'lib')
-rw-r--r--lib/super_good/solidus_taxjar/api_params.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/super_good/solidus_taxjar/api_params.rb b/lib/super_good/solidus_taxjar/api_params.rb
index 53b2c81..7c6942f 100644
--- a/lib/super_good/solidus_taxjar/api_params.rb
+++ b/lib/super_good/solidus_taxjar/api_params.rb
@@ -4,6 +4,7 @@ module SuperGood
class << self
def order_params(order)
{}
+ .merge(customer_params(order))
.merge(order_address_params(order.tax_address))
.merge(line_items_params(order.line_items))
.merge(shipping: order.shipment_total)
@@ -23,6 +24,7 @@ module SuperGood
def transaction_params(order)
{}
+ .merge(customer_params(order))
.merge(order_address_params(order.tax_address))
.merge(transaction_line_items_params(order.line_items))
.merge(
@@ -51,6 +53,12 @@ module SuperGood
private
+ def customer_params(order)
+ return {} unless order.user_id
+
+ { customer_id: order.user_id.to_s }
+ end
+
def order_address_params(address)
{
to_country: address.country.iso,