summaryrefslogtreecommitdiff
path: root/lib/super_good/solidus_taxjar
diff options
context:
space:
mode:
Diffstat (limited to 'lib/super_good/solidus_taxjar')
-rw-r--r--lib/super_good/solidus_taxjar/api.rb2
-rw-r--r--lib/super_good/solidus_taxjar/api_params.rb10
-rw-r--r--lib/super_good/solidus_taxjar/calculator_helper.rb2
-rw-r--r--lib/super_good/solidus_taxjar/tax_calculator.rb18
-rw-r--r--lib/super_good/solidus_taxjar/tax_rate_calculator.rb7
5 files changed, 19 insertions, 20 deletions
diff --git a/lib/super_good/solidus_taxjar/api.rb b/lib/super_good/solidus_taxjar/api.rb
index 601a2ae..865bb45 100644
--- a/lib/super_good/solidus_taxjar/api.rb
+++ b/lib/super_good/solidus_taxjar/api.rb
@@ -4,7 +4,7 @@ module SuperGood
def self.default_taxjar_client
::Taxjar::Client.new(
api_key: ENV.fetch("TAXJAR_API_KEY"),
- api_url: ENV.fetch("TAXJAR_API_URL") { 'https://api.taxjar.com' } # Sandbox URL: https://api.sandbox.taxjar.com
+ api_url: ENV.fetch("TAXJAR_API_URL") { "https://api.taxjar.com" } # Sandbox URL: https://api.sandbox.taxjar.com
)
end
diff --git a/lib/super_good/solidus_taxjar/api_params.rb b/lib/super_good/solidus_taxjar/api_params.rb
index b3c02fe..ebce8fe 100644
--- a/lib/super_good/solidus_taxjar/api_params.rb
+++ b/lib/super_good/solidus_taxjar/api_params.rb
@@ -8,7 +8,7 @@ module SuperGood
.merge(order_address_params(order.tax_address))
.merge(line_items_params(order.line_items))
.merge(shipping: shipping(order))
- .merge(SuperGood::SolidusTaxJar.custom_order_params.(order))
+ .merge(SuperGood::SolidusTaxJar.custom_order_params.call(order))
.tap do |params|
next unless SuperGood::SolidusTaxJar.logging_enabled
@@ -33,7 +33,7 @@ module SuperGood
def tax_rate_address_params(address)
{
amount: 100,
- shipping: 0,
+ shipping: 0
}.merge(order_address_params(address))
end
@@ -71,7 +71,7 @@ module SuperGood
def customer_params(order)
return {} unless order.user_id
- { customer_id: order.user_id.to_s }
+ {customer_id: order.user_id.to_s}
end
def order_address_params(address)
@@ -80,7 +80,7 @@ module SuperGood
to_zip: address.zipcode,
to_city: address.city,
to_state: address&.state&.abbr || address.state_name,
- to_street: address.address1,
+ to_street: address.address1
}
end
@@ -127,7 +127,7 @@ module SuperGood
end
def shipping(order)
- SuperGood::SolidusTaxJar.shipping_calculator.(order)
+ SuperGood::SolidusTaxJar.shipping_calculator.call(order)
end
def sales_tax(order)
diff --git a/lib/super_good/solidus_taxjar/calculator_helper.rb b/lib/super_good/solidus_taxjar/calculator_helper.rb
index dbde950..f8690b5 100644
--- a/lib/super_good/solidus_taxjar/calculator_helper.rb
+++ b/lib/super_good/solidus_taxjar/calculator_helper.rb
@@ -22,7 +22,7 @@ module SuperGood
end
def taxable_address?(address)
- SuperGood::SolidusTaxJar.taxable_address_check.(address)
+ SuperGood::SolidusTaxJar.taxable_address_check.call(address)
end
def cache
diff --git a/lib/super_good/solidus_taxjar/tax_calculator.rb b/lib/super_good/solidus_taxjar/tax_calculator.rb
index 7fac1bd..520fffe 100644
--- a/lib/super_good/solidus_taxjar/tax_calculator.rb
+++ b/lib/super_good/solidus_taxjar/tax_calculator.rb
@@ -23,8 +23,8 @@ module SuperGood
shipment_taxes: shipment_taxes
)
end
- rescue StandardError => e
- exception_handler.(e)
+ rescue => e
+ exception_handler.call(e)
no_tax
end
@@ -34,7 +34,7 @@ module SuperGood
def line_item_taxes
@line_item_taxes ||=
- taxjar_breakdown.line_items.map do |taxjar_line_item|
+ taxjar_breakdown.line_items.map { |taxjar_line_item|
spree_line_item_id = taxjar_line_item.id.to_i
# Searching in memory because this association is loaded and most
@@ -48,13 +48,13 @@ module SuperGood
amount: taxjar_line_item.tax_collectable,
included_in_price: false
)
- end
+ }
end
def shipment_taxes
@shipment_taxes ||=
if taxjar_breakdown.shipping? &&
- (total_shipping_tax = taxjar_breakdown.shipping.tax_collectable) != 0
+ (total_shipping_tax = taxjar_breakdown.shipping.tax_collectable) != 0
# Distribute shipping tax across shipments:
# TaxJar does not provide a breakdown of shipping taxes, so we have
@@ -114,22 +114,22 @@ module SuperGood
end
def cache_key
- SuperGood::SolidusTaxJar.cache_key.(order)
+ SuperGood::SolidusTaxJar.cache_key.call(order)
end
def taxable_order?(order)
- SuperGood::SolidusTaxJar.taxable_order_check.(order)
+ SuperGood::SolidusTaxJar.taxable_order_check.call(order)
end
def shipping_tax_label(shipment, shipping_tax)
- SuperGood::SolidusTaxJar.shipping_tax_label_maker.(
+ SuperGood::SolidusTaxJar.shipping_tax_label_maker.call(
shipment,
shipping_tax
)
end
def line_item_tax_label(taxjar_line_item, spree_line_item)
- SuperGood::SolidusTaxJar.line_item_tax_label_maker.(taxjar_line_item, spree_line_item)
+ SuperGood::SolidusTaxJar.line_item_tax_label_maker.call(taxjar_line_item, spree_line_item)
end
end
end
diff --git a/lib/super_good/solidus_taxjar/tax_rate_calculator.rb b/lib/super_good/solidus_taxjar/tax_rate_calculator.rb
index dc3d771..8f513a5 100644
--- a/lib/super_good/solidus_taxjar/tax_rate_calculator.rb
+++ b/lib/super_good/solidus_taxjar/tax_rate_calculator.rb
@@ -14,9 +14,8 @@ module SuperGood
cache do
api.tax_rate_for(address).to_d
end
-
- rescue StandardError => e
- exception_handler.(e)
+ rescue => e
+ exception_handler.call(e)
no_rate
end
@@ -29,7 +28,7 @@ module SuperGood
end
def cache_key
- SuperGood::SolidusTaxJar.cache_key.(address)
+ SuperGood::SolidusTaxJar.cache_key.call(address)
end
end
end