From 1015448f7dc6efa85a4b65c5417dfc870571ea73 Mon Sep 17 00:00:00 2001 From: Jared Norman Date: Mon, 13 May 2019 20:10:05 -0700 Subject: Send customer_id to TaxJar API This is required to support per-customer exemptions through the TaxJar API. --- lib/super_good/solidus_taxjar/api_params.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/super_good/solidus_taxjar') 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, -- cgit v1.2.3