taxjar 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +103 -8
- data/Rakefile +0 -0
- data/lib/faraday/raise_http_exception.rb +14 -0
- data/lib/taxjar.rb +0 -0
- data/lib/taxjar/client.rb +69 -2
- data/lib/taxjar/configuration.rb +7 -1
- data/lib/taxjar/error.rb +29 -0
- data/lib/taxjar/version.rb +1 -1
- data/taxjar.gemspec +2 -2
- data/test/fixtures/{sales_tax.yml → v1/sales_tax.yml} +12 -12
- data/test/fixtures/{tax_rate.yml → v1/tax_rate.yml} +9 -9
- data/test/fixtures/v2/enhanced/create_order_transaction.yml +52 -0
- data/test/fixtures/v2/enhanced/create_refund_transaction.yml +52 -0
- data/test/fixtures/v2/enhanced/list_categories.yml +58 -0
- data/test/fixtures/v2/enhanced/update_order_transaction.yml +52 -0
- data/test/fixtures/v2/enhanced/update_refund_transaction.yml +52 -0
- data/test/fixtures/v2/standard/sales_tax.yml +52 -0
- data/test/fixtures/v2/standard/tax_rate.yml +50 -0
- data/test/taxjar/client_test.rb +161 -28
- data/test/taxjar/configuration_test.rb +1 -1
- data/test/taxjar/taxjar_test.rb +0 -0
- data/test/test_helper.rb +0 -0
- metadata +23 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 39a381c8762ddba45978205d3453a9fd223c987f
|
|
4
|
+
data.tar.gz: 6a7da0e3e52feb69d62866089c19ca7101bb9480
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5201dba0ccc0e1beb82005b959665c2ae2761076ff6df66754889763188b0775f25590da6c220e886642f53cc8c66b38e71dbec451061ea8c750e05682c6cadf
|
|
7
|
+
data.tar.gz: d0d08b35fac7190e4890992231f6f061fdf7da7653c03680a45e0b10c84c2afc507f57c52b20dfda67997a6b18239505d81989a3d01d0f24df3b84846615f78c
|
data/.gitignore
CHANGED
|
File without changes
|
data/Gemfile
CHANGED
|
File without changes
|
data/LICENSE.txt
CHANGED
|
File without changes
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Taxjar
|
|
2
2
|
|
|
3
|
-
Taxjar is a Ruby API wrapper for Taxjar's
|
|
3
|
+
Taxjar is a Ruby API wrapper for Taxjar's v1 and v2 API, supporting both Standard and Enhanced API tiers.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -20,17 +20,19 @@ Or install it yourself as:
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
-
Please reference the Taxjar [API Documentation](http://
|
|
23
|
+
Please reference the Taxjar [API Documentation](http://developers.taxjar.com/api/)
|
|
24
|
+
|
|
25
|
+
### Configuration
|
|
24
26
|
|
|
25
|
-
Configuration:
|
|
26
27
|
```ruby
|
|
27
28
|
Taxjar.configure do |config|
|
|
28
29
|
config.auth_token = "authtokenstring"
|
|
30
|
+
config.api_version = 2 # use 1 for legacy v1 API
|
|
31
|
+
config.api_tier = 'enhanced' # use 'standard' for standard API
|
|
29
32
|
end
|
|
30
33
|
```
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
Sales tax:
|
|
35
|
+
### Sales tax
|
|
34
36
|
|
|
35
37
|
```ruby
|
|
36
38
|
options = {
|
|
@@ -46,10 +48,10 @@ options = {
|
|
|
46
48
|
from_zip: "07446"
|
|
47
49
|
}
|
|
48
50
|
response = Taxjar.client.sales_tax(options)
|
|
49
|
-
# => {"amount_to_collect"
|
|
51
|
+
# => {"tax":{"taxable_amount":"12.0","amount_to_collect":0.84,"rate":0.07,"has_nexus":true,"freight_taxable":true,"tax_source":"destination"}}
|
|
50
52
|
```
|
|
51
53
|
|
|
52
|
-
Tax rate lookup
|
|
54
|
+
### Tax rate lookup
|
|
53
55
|
|
|
54
56
|
```ruby
|
|
55
57
|
options = {
|
|
@@ -58,7 +60,100 @@ options = {
|
|
|
58
60
|
country: "US"
|
|
59
61
|
}
|
|
60
62
|
response = Taxjar.client.tax_rate(options)
|
|
61
|
-
# {"
|
|
63
|
+
# => {"rate":{"zip":"07446","state":"NJ","state_rate":"0.07","county":"BERGEN","county_rate":"0.0","city":"RAMSEY","city_rate":"0.0","combined_district_rate":"0.0","combined_rate":"0.07"}}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### List tax categories
|
|
67
|
+
(Enhanced API tier)
|
|
68
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
response = Taxjar.client.list_categories()
|
|
71
|
+
# => {"categories":[{"name":"Other Exempt","product_tax_code":"99999","description":"item is exempt"}, ... ]}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Create order transaction
|
|
75
|
+
(Enhanced API tier)
|
|
76
|
+
|
|
77
|
+
```ruby
|
|
78
|
+
options = {
|
|
79
|
+
transaction_id: "123456",
|
|
80
|
+
transaction_date: "2015/06/26",
|
|
81
|
+
amount: 10,
|
|
82
|
+
shipping: 2,
|
|
83
|
+
sales_tax: 0.84,
|
|
84
|
+
to_country: "US",
|
|
85
|
+
to_state: "NJ",
|
|
86
|
+
to_city: "Freehold",
|
|
87
|
+
to_zip: "07728",
|
|
88
|
+
from_country: "US",
|
|
89
|
+
from_state: "CA",
|
|
90
|
+
from_city: "Camarillo",
|
|
91
|
+
from_zip: "93010",
|
|
92
|
+
line_items: [
|
|
93
|
+
{
|
|
94
|
+
id: 123456,
|
|
95
|
+
unit_price: 20,
|
|
96
|
+
quantity: 1
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
response = Taxjar.client.create_order_transaction(options)
|
|
101
|
+
# => {"order":{"transaction_id":"123456","user_id":440,"transaction_date":"2015-06-26T00:00:00Z","from_country":"US","from_zip":"93010","from_state":"CA","from_city":"CAMARILLO","from_street":null,"to_country":"US","to_zip":"07728","to_state":"NJ","to_city":"FREEHOLD","to_street":null,"amount":"10.0","shipping":"2.0","sales_tax":"0.84","line_items":[{"id":1,"quantity":1,"product_identifier":null,"product_tax_code":null,"description":null,"unit_price":"20.0","discount":"0.0","sales_tax":"0.0"}]}}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Update order transaction
|
|
105
|
+
(Enhanced API tier)
|
|
106
|
+
|
|
107
|
+
```ruby
|
|
108
|
+
options = {
|
|
109
|
+
transaction_id: "123456",
|
|
110
|
+
sales_tax: 0.94,
|
|
111
|
+
}
|
|
112
|
+
response = Taxjar.client.update_order_transaction(options)
|
|
113
|
+
# => {"order":{"transaction_id":"123456","user_id":440,"transaction_date":"2015-06-26T00:00:00Z","from_country":"US","from_zip":"93010","from_state":"CA","from_city":"CAMARILLO","from_street":null,"to_country":"US","to_zip":"07728","to_state":"NJ","to_city":"FREEHOLD","to_street":null,"amount":"10.0","shipping":"2.0","sales_tax":"0.94","line_items":[{"id":1,"quantity":1,"product_identifier":null,"product_tax_code":null,"description":null,"unit_price":"20.0","discount":"0.0","sales_tax":"0.0"}]}}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Create refund transaction
|
|
117
|
+
(Enhanced API tier)
|
|
118
|
+
|
|
119
|
+
```ruby
|
|
120
|
+
options = {
|
|
121
|
+
transaction_id: "REFUND_123456",
|
|
122
|
+
transaction_date: "2015/06/26",
|
|
123
|
+
transaction_reference_id: "123456",
|
|
124
|
+
amount: 10,
|
|
125
|
+
shipping: 2,
|
|
126
|
+
sales_tax: 0.84,
|
|
127
|
+
to_country: "US",
|
|
128
|
+
to_state: "NJ",
|
|
129
|
+
to_city: "Freehold",
|
|
130
|
+
to_zip: "07728",
|
|
131
|
+
from_country: "US",
|
|
132
|
+
from_state: "CA",
|
|
133
|
+
from_city: "Camarillo",
|
|
134
|
+
from_zip: "93010",
|
|
135
|
+
line_items: [
|
|
136
|
+
{
|
|
137
|
+
id: 123456,
|
|
138
|
+
unit_price: 20,
|
|
139
|
+
quantity: 1
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
response = Taxjar.client.create_refund_transaction(options)
|
|
144
|
+
# => {"refund":{"transaction_id":"REFUND_123456","user_id":440,"transaction_date":"2015-06-26T00:00:00Z","transaction_reference_id":"123456","from_country":"US","from_zip":"93010","from_state":"CA","from_city":"CAMARILLO","from_street":null,"to_country":"US","to_zip":"07728","to_state":"NJ","to_city":"FREEHOLD","to_street":null,"amount":"10.0","shipping":"2.0","sales_tax":"0.84","line_items":[{"id":1,"quantity":1,"product_identifier":null,"product_tax_code":null,"description":null,"unit_price":"20.0","discount":"0.0","sales_tax":"0.0"}]}}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Update refund transaction
|
|
148
|
+
(Enhanced API tier)
|
|
149
|
+
|
|
150
|
+
```ruby
|
|
151
|
+
options = {
|
|
152
|
+
transaction_id: "REFUND_123456",
|
|
153
|
+
sales_tax: 0.94,
|
|
154
|
+
}
|
|
155
|
+
response = Taxjar.client.update_refund_transaction(options)
|
|
156
|
+
# => {"order":{"transaction_id":"123456","user_id":440,"transaction_date":"2015-06-26T00:00:00Z","from_country":"US","from_zip":"93010","from_state":"CA","from_city":"CAMARILLO","from_street":null,"to_country":"US","to_zip":"07728","to_state":"NJ","to_city":"FREEHOLD","to_street":null,"amount":"10.0","shipping":"2.0","sales_tax":"0.94","line_items":[{"id":1,"quantity":1,"product_identifier":null,"product_tax_code":null,"description":null,"unit_price":"20.0","discount":"0.0","sales_tax":"0.0"}]}}
|
|
62
157
|
```
|
|
63
158
|
|
|
64
159
|
## Contributing
|
data/Rakefile
CHANGED
|
File without changes
|
|
@@ -10,10 +10,24 @@ module FaradayMiddleware
|
|
|
10
10
|
raise Taxjar::BadRequest, error_message_400(response)
|
|
11
11
|
when 401
|
|
12
12
|
raise Taxjar::NotAuthorized, error_message_400(response)
|
|
13
|
+
when 403
|
|
14
|
+
raise Taxjar::Forbidden, error_message_400(response)
|
|
13
15
|
when 404
|
|
14
16
|
raise Taxjar::NotFound, error_message_400(response)
|
|
17
|
+
when 405
|
|
18
|
+
raise Taxjar::MethodNotAllowed, error_message_400(response)
|
|
19
|
+
when 406
|
|
20
|
+
raise Taxjar::NotAcceptable, error_message_400(response)
|
|
21
|
+
when 410
|
|
22
|
+
raise Taxjar::Gone, error_message_400(response)
|
|
23
|
+
when 422
|
|
24
|
+
raise Taxjar::UnprocessableEntity, error_message_400(response)
|
|
25
|
+
when 429
|
|
26
|
+
raise Taxjar::TooManyRequests, error_message_400(response)
|
|
15
27
|
when 500
|
|
16
28
|
raise Taxjar::InternalServerError, error_message_500(response, "Something is technically wrong.")
|
|
29
|
+
when 503
|
|
30
|
+
raise Taxjar::ServiceUnavailable, error_message_500(response, "Service is temporarily down for maintenance.")
|
|
17
31
|
when 504
|
|
18
32
|
raise Taxjar::GatewayTimeout, error_message_500(response, "504 Gateway Time-out")
|
|
19
33
|
end
|
data/lib/taxjar.rb
CHANGED
|
File without changes
|
data/lib/taxjar/client.rb
CHANGED
|
@@ -15,16 +15,57 @@ module Taxjar
|
|
|
15
15
|
send("#{key}=", options[key])
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
check_configuration
|
|
18
19
|
setup_conn
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
def sales_tax(options={})
|
|
22
|
-
|
|
23
|
+
case api_version
|
|
24
|
+
when 1
|
|
25
|
+
response = @conn.get api_path('sales_tax'), options
|
|
26
|
+
when 2
|
|
27
|
+
response = @conn.post api_path('taxes'), options
|
|
28
|
+
end
|
|
23
29
|
response.body
|
|
24
30
|
end
|
|
25
31
|
|
|
26
32
|
def tax_rate(options={})
|
|
27
|
-
|
|
33
|
+
case api_version
|
|
34
|
+
when 1
|
|
35
|
+
response = @conn.get "/locations/#{options.delete(:zip)}", options
|
|
36
|
+
when 2
|
|
37
|
+
response = @conn.get api_path('rates', options.delete(:zip)), options
|
|
38
|
+
end
|
|
39
|
+
response.body
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def list_categories()
|
|
43
|
+
check_availability(method_api_version: 2, method_api_tier: 'enhanced')
|
|
44
|
+
response = @conn.get api_path('categories')
|
|
45
|
+
response.body
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def create_order_transaction(options={})
|
|
49
|
+
check_availability(method_api_version: 2, method_api_tier: 'enhanced')
|
|
50
|
+
response = @conn.post api_path('transactions', 'orders'), options
|
|
51
|
+
response.body
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def update_order_transaction(options={})
|
|
55
|
+
check_availability(method_api_version: 2, method_api_tier: 'enhanced')
|
|
56
|
+
response = @conn.put api_path('transactions', 'orders', options.delete(:transaction_id)), options
|
|
57
|
+
response.body
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def create_refund_transaction(options={})
|
|
61
|
+
check_availability(method_api_version: 2, method_api_tier: 'enhanced')
|
|
62
|
+
response = @conn.post api_path('transactions', 'refunds'), options
|
|
63
|
+
response.body
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def update_refund_transaction(options={})
|
|
67
|
+
check_availability(method_api_version: 2, method_api_tier: 'enhanced')
|
|
68
|
+
response = @conn.put api_path('transactions', 'refunds', options.delete(:transaction_id)), options
|
|
28
69
|
response.body
|
|
29
70
|
end
|
|
30
71
|
|
|
@@ -38,6 +79,7 @@ module Taxjar
|
|
|
38
79
|
}.merge(connection_options)
|
|
39
80
|
|
|
40
81
|
@conn = Faraday::Connection.new(options) do |c|
|
|
82
|
+
c.request :url_encoded
|
|
41
83
|
c.token_auth self.auth_token
|
|
42
84
|
c.use FaradayMiddleware::ParseJson
|
|
43
85
|
c.use FaradayMiddleware::RaiseHttpException
|
|
@@ -45,5 +87,30 @@ module Taxjar
|
|
|
45
87
|
end
|
|
46
88
|
|
|
47
89
|
end
|
|
90
|
+
|
|
91
|
+
# checks correct client configuration
|
|
92
|
+
def check_configuration
|
|
93
|
+
case api_version
|
|
94
|
+
when 1
|
|
95
|
+
raise Taxjar::BadConfiguration, "Configuration error - API v1 does not support API tiers" unless api_tier.nil?
|
|
96
|
+
when 2
|
|
97
|
+
raise Taxjar::BadConfiguration, "Configuration error - API tier #{api_tier} is invalid" unless ['standard','enhanced'].include?(api_tier)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# checks whether the requested method is available for the current configuration
|
|
102
|
+
def check_availability(method_api_version: 1, method_api_tier: nil)
|
|
103
|
+
raise Taxjar::NotAvailable, "Method not available for API v#{api_version}" if (method_api_version != api_version)
|
|
104
|
+
raise Taxjar::NotAvailable, "Method not available for #{api_tier} API tier" if (method_api_tier != api_tier)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# returns path for TaxJar API endpoint
|
|
108
|
+
#
|
|
109
|
+
# examples:
|
|
110
|
+
# API v1: /v1/sales_tax
|
|
111
|
+
# API v2: /v2/enhanced/transactions/orders/123
|
|
112
|
+
def api_path(*args)
|
|
113
|
+
"/v#{api_version}/#{args.unshift(api_tier).compact.join('/')}"
|
|
114
|
+
end
|
|
48
115
|
end
|
|
49
116
|
end
|
data/lib/taxjar/configuration.rb
CHANGED
|
@@ -9,7 +9,9 @@ module Taxjar
|
|
|
9
9
|
:format,
|
|
10
10
|
:proxy,
|
|
11
11
|
:user_agent,
|
|
12
|
-
:connection_options
|
|
12
|
+
:connection_options,
|
|
13
|
+
:api_version,
|
|
14
|
+
:api_tier ]
|
|
13
15
|
|
|
14
16
|
DEFAULT_ADAPTER = Faraday.default_adapter
|
|
15
17
|
DEFAULT_AUTH_TOKEN = "dae79dc5154ccabd7cb169f616d605e7"
|
|
@@ -19,6 +21,8 @@ module Taxjar
|
|
|
19
21
|
DEFAULT_USER_AGENT = "Taxjar ruby Gem #{Taxjar::VERSION}".freeze
|
|
20
22
|
|
|
21
23
|
DEFAULT_CONNECTION_OPTIONS = {}
|
|
24
|
+
DEFAULT_API_VERSION = 1
|
|
25
|
+
DEFAULT_API_TIER = nil
|
|
22
26
|
|
|
23
27
|
attr_accessor *VALID_CONFIG_KEYS
|
|
24
28
|
|
|
@@ -44,6 +48,8 @@ module Taxjar
|
|
|
44
48
|
self.proxy = DEFAULT_PROXY
|
|
45
49
|
self.user_agent = DEFAULT_USER_AGENT
|
|
46
50
|
self.connection_options = DEFAULT_CONNECTION_OPTIONS
|
|
51
|
+
self.api_version = DEFAULT_API_VERSION
|
|
52
|
+
self.api_tier = DEFAULT_API_TIER
|
|
47
53
|
end
|
|
48
54
|
|
|
49
55
|
end # Configuration
|
data/lib/taxjar/error.rb
CHANGED
|
@@ -8,10 +8,39 @@ module Taxjar
|
|
|
8
8
|
# Raised when Taxjar returns the HTTP status code 401
|
|
9
9
|
class NotAuthorized < Error; end
|
|
10
10
|
|
|
11
|
+
# Raised when Taxjar returns the HTTP status code 403
|
|
12
|
+
class Forbidden < Error; end
|
|
13
|
+
|
|
11
14
|
# Raised when Taxjar returns the HTTP status code 404
|
|
12
15
|
class NotFound < Error; end
|
|
13
16
|
|
|
17
|
+
# Raised when Taxjar returns the HTTP status code 405
|
|
18
|
+
class MethodNotAllowed < Error; end
|
|
19
|
+
|
|
20
|
+
# Raised when Taxjar returns the HTTP status code 406
|
|
21
|
+
class NotAcceptable < Error; end
|
|
22
|
+
|
|
23
|
+
# Raised when Taxjar returns the HTTP status code 410
|
|
24
|
+
class Gone < Error; end
|
|
25
|
+
|
|
26
|
+
# Raised when Taxjar returns the HTTP status code 422
|
|
27
|
+
class UnprocessableEntity < Error; end
|
|
28
|
+
|
|
29
|
+
# Raised when Taxjar returns the HTTP status code 429
|
|
30
|
+
class TooManyRequests < Error; end
|
|
31
|
+
|
|
14
32
|
# Raised when Taxjar returns the HTTP status code 500
|
|
15
33
|
class InternalServerError < Error; end
|
|
16
34
|
|
|
35
|
+
# Raised when Taxjar returns the HTTP status code 503
|
|
36
|
+
class ServiceUnavailable < Error; end
|
|
37
|
+
|
|
38
|
+
# Raised when Taxjar returns the HTTP status code 504
|
|
39
|
+
class GatewayTimeout < Error; end
|
|
40
|
+
|
|
41
|
+
# Raised when the method is not available in the configured API version or tier
|
|
42
|
+
class NotAvailable < Error; end
|
|
43
|
+
|
|
44
|
+
# Raised when Taxjar configuration is invalid
|
|
45
|
+
class BadConfiguration < Error; end
|
|
17
46
|
end
|
data/lib/taxjar/version.rb
CHANGED
data/taxjar.gemspec
CHANGED
|
@@ -6,8 +6,8 @@ require 'taxjar/version'
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "taxjar"
|
|
8
8
|
spec.version = Taxjar::VERSION
|
|
9
|
-
spec.authors = ["Darren Johnson"]
|
|
10
|
-
spec.email = ["darrenbjohnson@gmail.com"]
|
|
9
|
+
spec.authors = ["Darren Johnson, Ladislav Marsik"]
|
|
10
|
+
spec.email = ["darrenbjohnson@gmail.com, laci.marsik@gmail.com"]
|
|
11
11
|
spec.summary = %q{A Ruby wrapper for the Taxjar API}
|
|
12
12
|
spec.description = %q{A Ruby wrapper for the Taxjar API's sales tax and tax rate endpoints}
|
|
13
13
|
spec.homepage = "http://github.com/djohnson/taxjar"
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://api.taxjar.com/sales_tax?amount=10&from_city=Ramsey&from_country=US&from_state=NJ&from_zip=07446&shipping=2&to_city=Freehold&to_country=US&to_state=NJ&to_zip=07728
|
|
5
|
+
uri: https://api.taxjar.com/v1/sales_tax?amount=10&from_city=Ramsey&from_country=US&from_state=NJ&from_zip=07446&shipping=2&to_city=Freehold&to_country=US&to_state=NJ&to_zip=07728
|
|
6
6
|
body:
|
|
7
7
|
encoding: US-ASCII
|
|
8
8
|
string: ''
|
|
9
9
|
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/json; charset=utf-8
|
|
10
12
|
User-Agent:
|
|
11
|
-
-
|
|
13
|
+
- Taxjar ruby Gem 0.1.0
|
|
12
14
|
Authorization:
|
|
13
15
|
- Token token="dae79dc5154ccabd7cb169f616d605e7"
|
|
14
16
|
Accept-Encoding:
|
|
15
17
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
16
|
-
Accept:
|
|
17
|
-
- "*/*"
|
|
18
18
|
response:
|
|
19
19
|
status:
|
|
20
20
|
code: 200
|
|
@@ -25,7 +25,7 @@ http_interactions:
|
|
|
25
25
|
Connection:
|
|
26
26
|
- close
|
|
27
27
|
Date:
|
|
28
|
-
-
|
|
28
|
+
- Thu, 25 Jun 2015 11:31:30 GMT
|
|
29
29
|
Status:
|
|
30
30
|
- 200 OK
|
|
31
31
|
X-Frame-Options:
|
|
@@ -34,23 +34,23 @@ http_interactions:
|
|
|
34
34
|
- 1; mode=block
|
|
35
35
|
X-Content-Type-Options:
|
|
36
36
|
- nosniff
|
|
37
|
-
|
|
38
|
-
-
|
|
37
|
+
Warning:
|
|
38
|
+
- '299: "Deprecated API, respected until 2015-09-01" "2015-06-25T11:31:30.641"'
|
|
39
39
|
Content-Type:
|
|
40
40
|
- application/json; charset=utf-8
|
|
41
41
|
Etag:
|
|
42
|
-
- '"
|
|
42
|
+
- '"e5e58b860796403d1f1a3efa41b7fc30"'
|
|
43
43
|
Cache-Control:
|
|
44
44
|
- max-age=0, private, must-revalidate
|
|
45
45
|
X-Request-Id:
|
|
46
|
-
-
|
|
46
|
+
- 81b4fa31-5fd5-426a-a324-5427dc5e3fcd
|
|
47
47
|
X-Runtime:
|
|
48
|
-
- '0.
|
|
48
|
+
- '0.026848'
|
|
49
49
|
Via:
|
|
50
50
|
- 1.1 vegur
|
|
51
51
|
body:
|
|
52
52
|
encoding: UTF-8
|
|
53
|
-
string: '{"amount_to_collect":0.84,"rate":0.07,"has_nexus":true,"freight_taxable":true,"tax_source":"destination"}'
|
|
53
|
+
string: '{"taxable_amount":12.0,"amount_to_collect":0.84,"rate":0.07,"has_nexus":true,"freight_taxable":true,"tax_source":"destination"}'
|
|
54
54
|
http_version:
|
|
55
|
-
recorded_at:
|
|
55
|
+
recorded_at: Thu, 25 Jun 2015 11:31:39 GMT
|
|
56
56
|
recorded_with: VCR 2.9.3
|
|
@@ -7,14 +7,14 @@ http_interactions:
|
|
|
7
7
|
encoding: US-ASCII
|
|
8
8
|
string: ''
|
|
9
9
|
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/json; charset=utf-8
|
|
10
12
|
User-Agent:
|
|
11
|
-
-
|
|
13
|
+
- Taxjar ruby Gem 0.1.0
|
|
12
14
|
Authorization:
|
|
13
15
|
- Token token="dae79dc5154ccabd7cb169f616d605e7"
|
|
14
16
|
Accept-Encoding:
|
|
15
17
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
16
|
-
Accept:
|
|
17
|
-
- "*/*"
|
|
18
18
|
response:
|
|
19
19
|
status:
|
|
20
20
|
code: 200
|
|
@@ -25,7 +25,7 @@ http_interactions:
|
|
|
25
25
|
Connection:
|
|
26
26
|
- close
|
|
27
27
|
Date:
|
|
28
|
-
-
|
|
28
|
+
- Thu, 25 Jun 2015 14:46:20 GMT
|
|
29
29
|
Status:
|
|
30
30
|
- 200 OK
|
|
31
31
|
X-Frame-Options:
|
|
@@ -34,8 +34,8 @@ http_interactions:
|
|
|
34
34
|
- 1; mode=block
|
|
35
35
|
X-Content-Type-Options:
|
|
36
36
|
- nosniff
|
|
37
|
-
|
|
38
|
-
-
|
|
37
|
+
Warning:
|
|
38
|
+
- '299: "Deprecated API, respected until 2015-09-01" "2015-06-25T14:46:20.101"'
|
|
39
39
|
Content-Type:
|
|
40
40
|
- application/json; charset=utf-8
|
|
41
41
|
Etag:
|
|
@@ -43,14 +43,14 @@ http_interactions:
|
|
|
43
43
|
Cache-Control:
|
|
44
44
|
- max-age=0, private, must-revalidate
|
|
45
45
|
X-Request-Id:
|
|
46
|
-
-
|
|
46
|
+
- 6152b99c-908f-4880-9ac1-6227493d3c9b
|
|
47
47
|
X-Runtime:
|
|
48
|
-
- '0.
|
|
48
|
+
- '0.039630'
|
|
49
49
|
Via:
|
|
50
50
|
- 1.1 vegur
|
|
51
51
|
body:
|
|
52
52
|
encoding: UTF-8
|
|
53
53
|
string: '{"location":{"state":"NJ","zip":"07446","state_rate":"0.07","city":"RAMSEY","city_rate":"0.0","county":"BERGEN","county_rate":"0.0","combined_district_rate":"0.0","combined_rate":"0.07"}}'
|
|
54
54
|
http_version:
|
|
55
|
-
recorded_at:
|
|
55
|
+
recorded_at: Thu, 25 Jun 2015 14:46:29 GMT
|
|
56
56
|
recorded_with: VCR 2.9.3
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.taxjar.com/v2/enhanced/transactions/orders
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: amount=10&from_city=Camarillo&from_country=US&from_state=CA&from_zip=93010&line_items%5B%5D%5Bid%5D=123456&line_items%5B%5D%5Bquantity%5D=1&line_items%5B%5D%5Bunit_price%5D=20&sales_tax=0.84&shipping=2&to_city=Freehold&to_country=US&to_state=NJ&to_zip=07728&transaction_date=2015%2F06%2F26&transaction_id=123456
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/json; charset=utf-8
|
|
12
|
+
User-Agent:
|
|
13
|
+
- Taxjar ruby Gem 0.1.0
|
|
14
|
+
Authorization:
|
|
15
|
+
- Token token="dae79dc5154ccabd7cb169f616d605e7"
|
|
16
|
+
Content-Type:
|
|
17
|
+
- application/x-www-form-urlencoded
|
|
18
|
+
Accept-Encoding:
|
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 201
|
|
23
|
+
message: Created
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- Cowboy
|
|
27
|
+
Connection:
|
|
28
|
+
- keep-alive
|
|
29
|
+
Date:
|
|
30
|
+
- Fri, 26 Jun 2015 10:16:35 GMT
|
|
31
|
+
Status:
|
|
32
|
+
- 201 Created
|
|
33
|
+
Content-Type:
|
|
34
|
+
- application/json
|
|
35
|
+
Content-Length:
|
|
36
|
+
- '495'
|
|
37
|
+
Etag:
|
|
38
|
+
- '"10809675205f5a521c954c042bb3ec53"'
|
|
39
|
+
Cache-Control:
|
|
40
|
+
- max-age=0, private, must-revalidate
|
|
41
|
+
X-Request-Id:
|
|
42
|
+
- 70e3c692-ed8e-4d92-824b-71fb3cef4ede
|
|
43
|
+
X-Runtime:
|
|
44
|
+
- '0.402656'
|
|
45
|
+
Via:
|
|
46
|
+
- 1.1 vegur
|
|
47
|
+
body:
|
|
48
|
+
encoding: UTF-8
|
|
49
|
+
string: '{"order":{"transaction_id":"123456","user_id":440,"transaction_date":"2015-06-26T00:00:00Z","from_country":"US","from_zip":"93010","from_state":"CA","from_city":"CAMARILLO","from_street":null,"to_country":"US","to_zip":"07728","to_state":"NJ","to_city":"FREEHOLD","to_street":null,"amount":"10.0","shipping":"2.0","sales_tax":"0.84","line_items":[{"id":1,"quantity":1,"product_identifier":null,"product_tax_code":null,"description":null,"unit_price":"20.0","discount":"0.0","sales_tax":"0.0"}]}}'
|
|
50
|
+
http_version:
|
|
51
|
+
recorded_at: Fri, 26 Jun 2015 10:16:46 GMT
|
|
52
|
+
recorded_with: VCR 2.9.3
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.taxjar.com/v2/enhanced/transactions/refunds
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: amount=10&from_city=Camarillo&from_country=US&from_state=CA&from_zip=93010&line_items%5B%5D%5Bid%5D=123456&line_items%5B%5D%5Bquantity%5D=1&line_items%5B%5D%5Bunit_price%5D=20&sales_tax=0.84&shipping=2&to_city=Freehold&to_country=US&to_state=NJ&to_zip=07728&transaction_date=2015%2F06%2F26&transaction_id=REFUND_123456&transaction_reference_id=123456
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/json; charset=utf-8
|
|
12
|
+
User-Agent:
|
|
13
|
+
- Taxjar ruby Gem 0.1.0
|
|
14
|
+
Authorization:
|
|
15
|
+
- Token token="dae79dc5154ccabd7cb169f616d605e7"
|
|
16
|
+
Content-Type:
|
|
17
|
+
- application/x-www-form-urlencoded
|
|
18
|
+
Accept-Encoding:
|
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 201
|
|
23
|
+
message: Created
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- Cowboy
|
|
27
|
+
Connection:
|
|
28
|
+
- keep-alive
|
|
29
|
+
Date:
|
|
30
|
+
- Fri, 26 Jun 2015 11:58:47 GMT
|
|
31
|
+
Status:
|
|
32
|
+
- 201 Created
|
|
33
|
+
Content-Type:
|
|
34
|
+
- application/json
|
|
35
|
+
Content-Length:
|
|
36
|
+
- '539'
|
|
37
|
+
Etag:
|
|
38
|
+
- '"32c9d35f24aede17ea2a3831eb0b81c2"'
|
|
39
|
+
Cache-Control:
|
|
40
|
+
- max-age=0, private, must-revalidate
|
|
41
|
+
X-Request-Id:
|
|
42
|
+
- bb90af6e-f662-44b7-b4a4-0045a96327ca
|
|
43
|
+
X-Runtime:
|
|
44
|
+
- '0.629224'
|
|
45
|
+
Via:
|
|
46
|
+
- 1.1 vegur
|
|
47
|
+
body:
|
|
48
|
+
encoding: UTF-8
|
|
49
|
+
string: '{"refund":{"transaction_id":"REFUND_123456","user_id":440,"transaction_date":"2015-06-26T00:00:00Z","transaction_reference_id":"123456","from_country":"US","from_zip":"93010","from_state":"CA","from_city":"CAMARILLO","from_street":null,"to_country":"US","to_zip":"07728","to_state":"NJ","to_city":"FREEHOLD","to_street":null,"amount":"10.0","shipping":"2.0","sales_tax":"0.84","line_items":[{"id":1,"quantity":1,"product_identifier":null,"product_tax_code":null,"description":null,"unit_price":"20.0","discount":"0.0","sales_tax":"0.0"}]}}'
|
|
50
|
+
http_version:
|
|
51
|
+
recorded_at: Fri, 26 Jun 2015 11:58:57 GMT
|
|
52
|
+
recorded_with: VCR 2.9.3
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.taxjar.com/v2/enhanced/categories
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/json; charset=utf-8
|
|
12
|
+
User-Agent:
|
|
13
|
+
- Taxjar ruby Gem 0.1.0
|
|
14
|
+
Authorization:
|
|
15
|
+
- Token token="dae79dc5154ccabd7cb169f616d605e7"
|
|
16
|
+
Accept-Encoding:
|
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
18
|
+
response:
|
|
19
|
+
status:
|
|
20
|
+
code: 200
|
|
21
|
+
message: OK
|
|
22
|
+
headers:
|
|
23
|
+
Server:
|
|
24
|
+
- Cowboy
|
|
25
|
+
Connection:
|
|
26
|
+
- keep-alive
|
|
27
|
+
Date:
|
|
28
|
+
- Fri, 26 Jun 2015 10:53:55 GMT
|
|
29
|
+
Status:
|
|
30
|
+
- 200 OK
|
|
31
|
+
Content-Type:
|
|
32
|
+
- application/json
|
|
33
|
+
Content-Length:
|
|
34
|
+
- '777'
|
|
35
|
+
Etag:
|
|
36
|
+
- '"d806e22ec7ec1f585c2aa84ac769ee2c"'
|
|
37
|
+
Cache-Control:
|
|
38
|
+
- max-age=0, private, must-revalidate
|
|
39
|
+
X-Request-Id:
|
|
40
|
+
- 8ede27a6-dbff-4326-b114-1d9f91cfd093
|
|
41
|
+
X-Runtime:
|
|
42
|
+
- '0.024949'
|
|
43
|
+
Via:
|
|
44
|
+
- 1.1 vegur
|
|
45
|
+
body:
|
|
46
|
+
encoding: UTF-8
|
|
47
|
+
string: '{"categories":[{"name":"Other Exempt","product_tax_code":"99999","description":"item
|
|
48
|
+
is exempt"},{"name":"Clothing","product_tax_code":"20010","description":"normal
|
|
49
|
+
clothing"},{"name":"Food \u0026 Groceries","product_tax_code":"40030","description":"food
|
|
50
|
+
for humans not cooked"},{"name":"Non-Prescription","product_tax_code":"51010","description":"non
|
|
51
|
+
prescription drugs"},{"name":"Prescription","product_tax_code":"51020","description":"prescription
|
|
52
|
+
drugs"},{"name":"Digital Goods","product_tax_code":"31000","description":"digital
|
|
53
|
+
goods"},{"name":"Special Digital Products","product_tax_code":"32000","description":"special
|
|
54
|
+
digital products"},{"name":"Software as a Service","product_tax_code":"30050","description":"Pre-written
|
|
55
|
+
computer software delivered electronically"}]}'
|
|
56
|
+
http_version:
|
|
57
|
+
recorded_at: Fri, 26 Jun 2015 10:54:05 GMT
|
|
58
|
+
recorded_with: VCR 2.9.3
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: put
|
|
5
|
+
uri: https://api.taxjar.com/v2/enhanced/transactions/orders/123456
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: amount=10&from_city=Camarillo&from_country=US&from_state=CA&from_zip=93010&line_items%5B%5D%5Bid%5D=123456&line_items%5B%5D%5Bquantity%5D=1&line_items%5B%5D%5Bunit_price%5D=20&sales_tax=0.84&shipping=2&to_city=Freehold&to_country=US&to_state=NJ&to_zip=07728&transaction_date=2015%2F06%2F26
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/json; charset=utf-8
|
|
12
|
+
User-Agent:
|
|
13
|
+
- Taxjar ruby Gem 0.1.0
|
|
14
|
+
Authorization:
|
|
15
|
+
- Token token="dae79dc5154ccabd7cb169f616d605e7"
|
|
16
|
+
Content-Type:
|
|
17
|
+
- application/x-www-form-urlencoded
|
|
18
|
+
Accept-Encoding:
|
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- Cowboy
|
|
27
|
+
Connection:
|
|
28
|
+
- keep-alive
|
|
29
|
+
Date:
|
|
30
|
+
- Fri, 26 Jun 2015 11:43:14 GMT
|
|
31
|
+
Status:
|
|
32
|
+
- 200 OK
|
|
33
|
+
Content-Type:
|
|
34
|
+
- application/json
|
|
35
|
+
Content-Length:
|
|
36
|
+
- '495'
|
|
37
|
+
Etag:
|
|
38
|
+
- '"10809675205f5a521c954c042bb3ec53"'
|
|
39
|
+
Cache-Control:
|
|
40
|
+
- max-age=0, private, must-revalidate
|
|
41
|
+
X-Request-Id:
|
|
42
|
+
- 28be5d53-65e4-497d-aafd-984bdc0e763e
|
|
43
|
+
X-Runtime:
|
|
44
|
+
- '0.669167'
|
|
45
|
+
Via:
|
|
46
|
+
- 1.1 vegur
|
|
47
|
+
body:
|
|
48
|
+
encoding: UTF-8
|
|
49
|
+
string: '{"order":{"transaction_id":"123456","user_id":440,"transaction_date":"2015-06-26T00:00:00Z","from_country":"US","from_zip":"93010","from_state":"CA","from_city":"CAMARILLO","from_street":null,"to_country":"US","to_zip":"07728","to_state":"NJ","to_city":"FREEHOLD","to_street":null,"amount":"10.0","shipping":"2.0","sales_tax":"0.84","line_items":[{"id":1,"quantity":1,"product_identifier":null,"product_tax_code":null,"description":null,"unit_price":"20.0","discount":"0.0","sales_tax":"0.0"}]}}'
|
|
50
|
+
http_version:
|
|
51
|
+
recorded_at: Fri, 26 Jun 2015 11:43:25 GMT
|
|
52
|
+
recorded_with: VCR 2.9.3
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: put
|
|
5
|
+
uri: https://api.taxjar.com/v2/enhanced/transactions/refunds/REFUND_123456
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: amount=10&from_city=Camarillo&from_country=US&from_state=CA&from_zip=93010&line_items%5B%5D%5Bid%5D=123456&line_items%5B%5D%5Bquantity%5D=1&line_items%5B%5D%5Bunit_price%5D=20&sales_tax=0.84&shipping=2&to_city=Freehold&to_country=US&to_state=NJ&to_zip=07728&transaction_date=2015%2F06%2F26&transaction_reference_id=123456
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/json; charset=utf-8
|
|
12
|
+
User-Agent:
|
|
13
|
+
- Taxjar ruby Gem 0.1.0
|
|
14
|
+
Authorization:
|
|
15
|
+
- Token token="dae79dc5154ccabd7cb169f616d605e7"
|
|
16
|
+
Content-Type:
|
|
17
|
+
- application/x-www-form-urlencoded
|
|
18
|
+
Accept-Encoding:
|
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- Cowboy
|
|
27
|
+
Connection:
|
|
28
|
+
- keep-alive
|
|
29
|
+
Date:
|
|
30
|
+
- Fri, 26 Jun 2015 12:03:06 GMT
|
|
31
|
+
Status:
|
|
32
|
+
- 200 OK
|
|
33
|
+
Content-Type:
|
|
34
|
+
- application/json
|
|
35
|
+
Content-Length:
|
|
36
|
+
- '539'
|
|
37
|
+
Etag:
|
|
38
|
+
- '"32c9d35f24aede17ea2a3831eb0b81c2"'
|
|
39
|
+
Cache-Control:
|
|
40
|
+
- max-age=0, private, must-revalidate
|
|
41
|
+
X-Request-Id:
|
|
42
|
+
- 4ef6e4b2-b27c-4807-90a5-52422758a3c4
|
|
43
|
+
X-Runtime:
|
|
44
|
+
- '0.339815'
|
|
45
|
+
Via:
|
|
46
|
+
- 1.1 vegur
|
|
47
|
+
body:
|
|
48
|
+
encoding: UTF-8
|
|
49
|
+
string: '{"refund":{"transaction_id":"REFUND_123456","user_id":440,"transaction_date":"2015-06-26T00:00:00Z","transaction_reference_id":"123456","from_country":"US","from_zip":"93010","from_state":"CA","from_city":"CAMARILLO","from_street":null,"to_country":"US","to_zip":"07728","to_state":"NJ","to_city":"FREEHOLD","to_street":null,"amount":"10.0","shipping":"2.0","sales_tax":"0.84","line_items":[{"id":1,"quantity":1,"product_identifier":null,"product_tax_code":null,"description":null,"unit_price":"20.0","discount":"0.0","sales_tax":"0.0"}]}}'
|
|
50
|
+
http_version:
|
|
51
|
+
recorded_at: Fri, 26 Jun 2015 12:03:17 GMT
|
|
52
|
+
recorded_with: VCR 2.9.3
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.taxjar.com/v2/standard/taxes
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: amount=10&from_city=Ramsey&from_country=US&from_state=NJ&from_zip=07446&shipping=2&to_city=Freehold&to_country=US&to_state=NJ&to_zip=07728
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/json; charset=utf-8
|
|
12
|
+
User-Agent:
|
|
13
|
+
- Taxjar ruby Gem 0.1.0
|
|
14
|
+
Authorization:
|
|
15
|
+
- Token token="dae79dc5154ccabd7cb169f616d605e7"
|
|
16
|
+
Content-Type:
|
|
17
|
+
- application/x-www-form-urlencoded
|
|
18
|
+
Accept-Encoding:
|
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- Cowboy
|
|
27
|
+
Connection:
|
|
28
|
+
- keep-alive
|
|
29
|
+
Date:
|
|
30
|
+
- Thu, 25 Jun 2015 12:30:57 GMT
|
|
31
|
+
Status:
|
|
32
|
+
- 200 OK
|
|
33
|
+
Content-Type:
|
|
34
|
+
- application/json
|
|
35
|
+
Content-Length:
|
|
36
|
+
- '137'
|
|
37
|
+
Etag:
|
|
38
|
+
- '"f5fa2826a66a2b9ac360ed7be14f1679"'
|
|
39
|
+
Cache-Control:
|
|
40
|
+
- max-age=0, private, must-revalidate
|
|
41
|
+
X-Request-Id:
|
|
42
|
+
- dcc0bec5-4749-4b20-bfbe-1a50582abcf3
|
|
43
|
+
X-Runtime:
|
|
44
|
+
- '0.453908'
|
|
45
|
+
Via:
|
|
46
|
+
- 1.1 vegur
|
|
47
|
+
body:
|
|
48
|
+
encoding: UTF-8
|
|
49
|
+
string: '{"tax":{"taxable_amount":"12.0","amount_to_collect":0.84,"rate":0.07,"has_nexus":true,"freight_taxable":true,"tax_source":"destination"}}'
|
|
50
|
+
http_version:
|
|
51
|
+
recorded_at: Thu, 25 Jun 2015 12:31:06 GMT
|
|
52
|
+
recorded_with: VCR 2.9.3
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.taxjar.com/v2/standard/rates/07446?city=Ramsey&country=US
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/json; charset=utf-8
|
|
12
|
+
User-Agent:
|
|
13
|
+
- Taxjar ruby Gem 0.1.0
|
|
14
|
+
Authorization:
|
|
15
|
+
- Token token="dae79dc5154ccabd7cb169f616d605e7"
|
|
16
|
+
Accept-Encoding:
|
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
18
|
+
response:
|
|
19
|
+
status:
|
|
20
|
+
code: 200
|
|
21
|
+
message: OK
|
|
22
|
+
headers:
|
|
23
|
+
Server:
|
|
24
|
+
- Cowboy
|
|
25
|
+
Connection:
|
|
26
|
+
- keep-alive
|
|
27
|
+
Date:
|
|
28
|
+
- Thu, 25 Jun 2015 14:48:52 GMT
|
|
29
|
+
Status:
|
|
30
|
+
- 200 OK
|
|
31
|
+
Content-Type:
|
|
32
|
+
- application/json
|
|
33
|
+
Content-Length:
|
|
34
|
+
- '183'
|
|
35
|
+
Etag:
|
|
36
|
+
- '"4d36d5fe8325a3598f7523580c88830a"'
|
|
37
|
+
Cache-Control:
|
|
38
|
+
- max-age=0, private, must-revalidate
|
|
39
|
+
X-Request-Id:
|
|
40
|
+
- 173d512a-3f80-49a6-a079-07b6509f8c4e
|
|
41
|
+
X-Runtime:
|
|
42
|
+
- '0.053635'
|
|
43
|
+
Via:
|
|
44
|
+
- 1.1 vegur
|
|
45
|
+
body:
|
|
46
|
+
encoding: UTF-8
|
|
47
|
+
string: '{"rate":{"zip":"07446","state":"NJ","state_rate":"0.07","county":"BERGEN","county_rate":"0.0","city":"RAMSEY","city_rate":"0.0","combined_district_rate":"0.0","combined_rate":"0.07"}}'
|
|
48
|
+
http_version:
|
|
49
|
+
recorded_at: Thu, 25 Jun 2015 14:49:01 GMT
|
|
50
|
+
recorded_with: VCR 2.9.3
|
data/test/taxjar/client_test.rb
CHANGED
|
@@ -2,46 +2,179 @@ require "test_helper"
|
|
|
2
2
|
|
|
3
3
|
describe Taxjar::Client do
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
before do
|
|
6
|
+
@options_sales_tax = {
|
|
7
|
+
amount: 10,
|
|
8
|
+
shipping: 2,
|
|
9
|
+
to_country: "US",
|
|
10
|
+
to_state: "NJ",
|
|
11
|
+
to_city: "Freehold",
|
|
12
|
+
to_zip: "07728",
|
|
13
|
+
from_country: "US",
|
|
14
|
+
from_state: "NJ",
|
|
15
|
+
from_city: "Ramsey",
|
|
16
|
+
from_zip: "07446"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@options_tax_rate = {
|
|
20
|
+
zip: "07446",
|
|
21
|
+
city: "Ramsey",
|
|
22
|
+
country: "US"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@options_order_transaction = {
|
|
26
|
+
transaction_id: "123456",
|
|
27
|
+
transaction_date: "2015/06/26",
|
|
28
|
+
amount: 10,
|
|
29
|
+
shipping: 2,
|
|
30
|
+
sales_tax: 0.84,
|
|
31
|
+
to_country: "US",
|
|
32
|
+
to_state: "NJ",
|
|
33
|
+
to_city: "Freehold",
|
|
34
|
+
to_zip: "07728",
|
|
35
|
+
from_country: "US",
|
|
36
|
+
from_state: "CA",
|
|
37
|
+
from_city: "Camarillo",
|
|
38
|
+
from_zip: "93010",
|
|
39
|
+
line_items: [
|
|
40
|
+
{
|
|
41
|
+
id: 123456,
|
|
42
|
+
unit_price: 20,
|
|
43
|
+
quantity: 1
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@options_refund_transaction = {
|
|
49
|
+
transaction_id: "REFUND_123456",
|
|
50
|
+
transaction_date: "2015/06/26",
|
|
51
|
+
transaction_reference_id: "123456",
|
|
52
|
+
amount: 10,
|
|
53
|
+
shipping: 2,
|
|
54
|
+
sales_tax: 0.84,
|
|
55
|
+
to_country: "US",
|
|
56
|
+
to_state: "NJ",
|
|
57
|
+
to_city: "Freehold",
|
|
58
|
+
to_zip: "07728",
|
|
59
|
+
from_country: "US",
|
|
60
|
+
from_state: "CA",
|
|
61
|
+
from_city: "Camarillo",
|
|
62
|
+
from_zip: "93010",
|
|
63
|
+
line_items: [
|
|
64
|
+
{
|
|
65
|
+
id: 123456,
|
|
66
|
+
unit_price: 20,
|
|
67
|
+
quantity: 1
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
describe "v1" do
|
|
6
74
|
before do
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
to_state: "NJ",
|
|
12
|
-
to_city: "Freehold",
|
|
13
|
-
to_zip: "07728",
|
|
14
|
-
from_country: "US",
|
|
15
|
-
from_state: "NJ",
|
|
16
|
-
from_city: "Ramsey",
|
|
17
|
-
from_zip: "07446"
|
|
18
|
-
}
|
|
75
|
+
Taxjar.configure do |config|
|
|
76
|
+
config.api_version = 1
|
|
77
|
+
config.api_tier = nil
|
|
78
|
+
end
|
|
19
79
|
end
|
|
20
80
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
81
|
+
describe ".sales_tax" do
|
|
82
|
+
it "should return a SalesTax" do
|
|
83
|
+
VCR.use_cassette("v1/sales_tax") do
|
|
84
|
+
response = Taxjar::Client.new.sales_tax(@options_sales_tax)
|
|
85
|
+
response.must_be :hash
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
describe ".tax_rate" do
|
|
91
|
+
it "should return a TaxRate" do
|
|
92
|
+
VCR.use_cassette("v1/tax_rate") do
|
|
93
|
+
response = Taxjar::Client.new.tax_rate(@options_tax_rate)
|
|
94
|
+
response.must_be :hash
|
|
95
|
+
end
|
|
25
96
|
end
|
|
26
97
|
end
|
|
27
98
|
end
|
|
28
99
|
|
|
29
|
-
describe "
|
|
100
|
+
describe "v2" do
|
|
30
101
|
before do
|
|
31
|
-
|
|
32
|
-
zip: "07446",
|
|
33
|
-
city: "Ramsey",
|
|
34
|
-
country: "US"
|
|
35
|
-
}
|
|
102
|
+
Taxjar.api_version = 2
|
|
36
103
|
end
|
|
37
104
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
105
|
+
describe "standard" do
|
|
106
|
+
before do
|
|
107
|
+
Taxjar.api_tier = 'standard'
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
describe ".sales_tax" do
|
|
111
|
+
it "should return a SalesTax" do
|
|
112
|
+
VCR.use_cassette("v2/standard/sales_tax") do
|
|
113
|
+
response = Taxjar::Client.new.sales_tax(@options_sales_tax)
|
|
114
|
+
response.must_be :hash
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
describe ".tax_rate" do
|
|
120
|
+
it "should return a TaxRate" do
|
|
121
|
+
VCR.use_cassette("v2/standard/tax_rate") do
|
|
122
|
+
response = Taxjar::Client.new.tax_rate(@options_tax_rate)
|
|
123
|
+
response.must_be :hash
|
|
124
|
+
end
|
|
125
|
+
end
|
|
42
126
|
end
|
|
43
127
|
end
|
|
44
|
-
end
|
|
45
128
|
|
|
129
|
+
describe "enhanced" do
|
|
130
|
+
before do
|
|
131
|
+
Taxjar.api_tier = 'enhanced'
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
describe ".list_categories" do
|
|
135
|
+
it "should list tax categories" do
|
|
136
|
+
VCR.use_cassette("v2/enhanced/list_categories") do
|
|
137
|
+
response = Taxjar::Client.new.list_categories()
|
|
138
|
+
response.must_be :hash
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
46
142
|
|
|
143
|
+
describe ".create_order_transaction" do
|
|
144
|
+
it "should create a new order transaction" do
|
|
145
|
+
VCR.use_cassette("v2/enhanced/create_order_transaction") do
|
|
146
|
+
response = Taxjar::Client.new.create_order_transaction(@options_order_transaction)
|
|
147
|
+
response.must_be :hash
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
describe ".update_order_transaction" do
|
|
153
|
+
it "should update order transaction" do
|
|
154
|
+
VCR.use_cassette("v2/enhanced/update_order_transaction") do
|
|
155
|
+
response = Taxjar::Client.new.update_order_transaction(@options_order_transaction)
|
|
156
|
+
response.must_be :hash
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
describe ".create_refund_transaction" do
|
|
162
|
+
it "should create a new refund transaction" do
|
|
163
|
+
VCR.use_cassette("v2/enhanced/create_refund_transaction") do
|
|
164
|
+
response = Taxjar::Client.new.create_refund_transaction(@options_refund_transaction)
|
|
165
|
+
response.must_be :hash
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
describe ".update_refund_transaction" do
|
|
171
|
+
it "should update refund transaction" do
|
|
172
|
+
VCR.use_cassette("v2/enhanced/update_refund_transaction") do
|
|
173
|
+
response = Taxjar::Client.new.update_refund_transaction(@options_refund_transaction)
|
|
174
|
+
response.must_be :hash
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
47
180
|
end
|
data/test/taxjar/taxjar_test.rb
CHANGED
|
File without changes
|
data/test/test_helper.rb
CHANGED
|
File without changes
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: taxjar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Darren Johnson
|
|
7
|
+
- Darren Johnson, Ladislav Marsik
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -154,7 +154,7 @@ dependencies:
|
|
|
154
154
|
version: '1.0'
|
|
155
155
|
description: A Ruby wrapper for the Taxjar API's sales tax and tax rate endpoints
|
|
156
156
|
email:
|
|
157
|
-
- darrenbjohnson@gmail.com
|
|
157
|
+
- darrenbjohnson@gmail.com, laci.marsik@gmail.com
|
|
158
158
|
executables: []
|
|
159
159
|
extensions: []
|
|
160
160
|
extra_rdoc_files: []
|
|
@@ -171,8 +171,15 @@ files:
|
|
|
171
171
|
- lib/taxjar/error.rb
|
|
172
172
|
- lib/taxjar/version.rb
|
|
173
173
|
- taxjar.gemspec
|
|
174
|
-
- test/fixtures/sales_tax.yml
|
|
175
|
-
- test/fixtures/tax_rate.yml
|
|
174
|
+
- test/fixtures/v1/sales_tax.yml
|
|
175
|
+
- test/fixtures/v1/tax_rate.yml
|
|
176
|
+
- test/fixtures/v2/enhanced/create_order_transaction.yml
|
|
177
|
+
- test/fixtures/v2/enhanced/create_refund_transaction.yml
|
|
178
|
+
- test/fixtures/v2/enhanced/list_categories.yml
|
|
179
|
+
- test/fixtures/v2/enhanced/update_order_transaction.yml
|
|
180
|
+
- test/fixtures/v2/enhanced/update_refund_transaction.yml
|
|
181
|
+
- test/fixtures/v2/standard/sales_tax.yml
|
|
182
|
+
- test/fixtures/v2/standard/tax_rate.yml
|
|
176
183
|
- test/taxjar/client_test.rb
|
|
177
184
|
- test/taxjar/configuration_test.rb
|
|
178
185
|
- test/taxjar/taxjar_test.rb
|
|
@@ -197,13 +204,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
197
204
|
version: '0'
|
|
198
205
|
requirements: []
|
|
199
206
|
rubyforge_project:
|
|
200
|
-
rubygems_version: 2.4.
|
|
207
|
+
rubygems_version: 2.4.6
|
|
201
208
|
signing_key:
|
|
202
209
|
specification_version: 4
|
|
203
210
|
summary: A Ruby wrapper for the Taxjar API
|
|
204
211
|
test_files:
|
|
205
|
-
- test/fixtures/sales_tax.yml
|
|
206
|
-
- test/fixtures/tax_rate.yml
|
|
212
|
+
- test/fixtures/v1/sales_tax.yml
|
|
213
|
+
- test/fixtures/v1/tax_rate.yml
|
|
214
|
+
- test/fixtures/v2/enhanced/create_order_transaction.yml
|
|
215
|
+
- test/fixtures/v2/enhanced/create_refund_transaction.yml
|
|
216
|
+
- test/fixtures/v2/enhanced/list_categories.yml
|
|
217
|
+
- test/fixtures/v2/enhanced/update_order_transaction.yml
|
|
218
|
+
- test/fixtures/v2/enhanced/update_refund_transaction.yml
|
|
219
|
+
- test/fixtures/v2/standard/sales_tax.yml
|
|
220
|
+
- test/fixtures/v2/standard/tax_rate.yml
|
|
207
221
|
- test/taxjar/client_test.rb
|
|
208
222
|
- test/taxjar/configuration_test.rb
|
|
209
223
|
- test/taxjar/taxjar_test.rb
|