taxjar-ruby 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/taxjar.rb +1 -0
- data/lib/taxjar/jurisdictions.rb +12 -0
- data/lib/taxjar/tax.rb +1 -0
- data/lib/taxjar/version.rb +1 -1
- data/spec/fixtures/taxes.json +6 -0
- data/spec/fixtures/taxes_canada.json +4 -0
- data/spec/fixtures/taxes_international.json +3 -0
- data/spec/taxjar/api/api_spec.rb +30 -11
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57abdd838dccafdd3d06963feeb4300dcc50cf12
|
4
|
+
data.tar.gz: f9bd34f1b42043934a40f340616233165bb45c64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d40feec61b61684a9041eb88480674a096c75d4b8fce5dd4ab0b33283835cd956d3f9883dcde20e7ca92914bc69702149d18ceb224fef992c3bafe997318570
|
7
|
+
data.tar.gz: c985406fd1c1970628252a3a0a769df953db871fd318f03aea8232fb8f7bdfd0e1d3d9511078eb436cc9aecd505b995180534a1be4102960e33978ff3bd14667
|
data/CHANGELOG.md
CHANGED
data/lib/taxjar.rb
CHANGED
data/lib/taxjar/tax.rb
CHANGED
data/lib/taxjar/version.rb
CHANGED
data/spec/fixtures/taxes.json
CHANGED
@@ -8,6 +8,12 @@
|
|
8
8
|
"has_nexus": true,
|
9
9
|
"freight_taxable": true,
|
10
10
|
"tax_source": "destination",
|
11
|
+
"jurisdictions": {
|
12
|
+
"country": "US",
|
13
|
+
"state": "NJ",
|
14
|
+
"county": "BERGEN",
|
15
|
+
"city": "RAMSEY"
|
16
|
+
},
|
11
17
|
"breakdown": {
|
12
18
|
"taxable_amount": 16.5,
|
13
19
|
"tax_collectable": 1.16,
|
data/spec/taxjar/api/api_spec.rb
CHANGED
@@ -125,7 +125,7 @@ describe Taxjar::API do
|
|
125
125
|
expect(rates.freight_taxable).to eq(true)
|
126
126
|
end
|
127
127
|
end
|
128
|
-
|
128
|
+
|
129
129
|
describe '#rate_for_location (eu)' do
|
130
130
|
before do
|
131
131
|
@postal_code = "00150"
|
@@ -192,7 +192,15 @@ describe Taxjar::API do
|
|
192
192
|
expect(tax.freight_taxable).to eq(true)
|
193
193
|
expect(tax.tax_source).to eq('destination')
|
194
194
|
end
|
195
|
-
|
195
|
+
|
196
|
+
it 'allows access to jurisdictions' do
|
197
|
+
tax = @client.tax_for_order(@order)
|
198
|
+
expect(tax.jurisdictions.country).to eq('US')
|
199
|
+
expect(tax.jurisdictions.state).to eq('NJ')
|
200
|
+
expect(tax.jurisdictions.county).to eq('BERGEN')
|
201
|
+
expect(tax.jurisdictions.city).to eq('RAMSEY')
|
202
|
+
end
|
203
|
+
|
196
204
|
it 'allows access to breakdown' do
|
197
205
|
tax = @client.tax_for_order(@order)
|
198
206
|
expect(tax.breakdown.state_taxable_amount).to eq(16.5)
|
@@ -211,7 +219,7 @@ describe Taxjar::API do
|
|
211
219
|
expect(tax.breakdown.special_tax_rate).to eq(0)
|
212
220
|
expect(tax.breakdown.special_district_tax_collectable).to eq(0)
|
213
221
|
end
|
214
|
-
|
222
|
+
|
215
223
|
it 'allows access to breakdown.shipping' do
|
216
224
|
tax = @client.tax_for_order(@order)
|
217
225
|
expect(tax.breakdown.shipping.taxable_amount).to eq(1.5)
|
@@ -268,7 +276,12 @@ describe Taxjar::API do
|
|
268
276
|
expect(tax.freight_taxable).to eq(true)
|
269
277
|
expect(tax.tax_source).to eq('destination')
|
270
278
|
end
|
271
|
-
|
279
|
+
|
280
|
+
it 'allows access to jurisdictions' do
|
281
|
+
tax = @client.tax_for_order(@order)
|
282
|
+
expect(tax.jurisdictions.country).to eq('FI')
|
283
|
+
end
|
284
|
+
|
272
285
|
it 'allows access to breakdown' do
|
273
286
|
tax = @client.tax_for_order(@order)
|
274
287
|
expect(tax.breakdown.taxable_amount).to eq(26.95)
|
@@ -278,7 +291,7 @@ describe Taxjar::API do
|
|
278
291
|
expect(tax.breakdown.country_tax_rate).to eq(0.24)
|
279
292
|
expect(tax.breakdown.country_tax_collectable).to eq(6.47)
|
280
293
|
end
|
281
|
-
|
294
|
+
|
282
295
|
it 'allows access to breakdown.shipping' do
|
283
296
|
tax = @client.tax_for_order(@order)
|
284
297
|
expect(tax.breakdown.shipping.taxable_amount).to eq(10)
|
@@ -318,7 +331,13 @@ describe Taxjar::API do
|
|
318
331
|
expect(tax.freight_taxable).to eq(true)
|
319
332
|
expect(tax.tax_source).to eq('destination')
|
320
333
|
end
|
321
|
-
|
334
|
+
|
335
|
+
it 'allows access to jurisdictions' do
|
336
|
+
tax = @client.tax_for_order(@order)
|
337
|
+
expect(tax.jurisdictions.country).to eq('CA')
|
338
|
+
expect(tax.jurisdictions.state).to eq('ON')
|
339
|
+
end
|
340
|
+
|
322
341
|
it 'allows access to breakdown' do
|
323
342
|
tax = @client.tax_for_order(@order)
|
324
343
|
expect(tax.breakdown.taxable_amount).to eq(26.95)
|
@@ -334,7 +353,7 @@ describe Taxjar::API do
|
|
334
353
|
expect(tax.breakdown.qst_tax_rate).to eq(0)
|
335
354
|
expect(tax.breakdown.qst).to eq(0)
|
336
355
|
end
|
337
|
-
|
356
|
+
|
338
357
|
it 'allows access to breakdown.shipping' do
|
339
358
|
tax = @client.tax_for_order(@order)
|
340
359
|
expect(tax.breakdown.shipping.taxable_amount).to eq(10)
|
@@ -369,12 +388,12 @@ describe Taxjar::API do
|
|
369
388
|
end
|
370
389
|
end
|
371
390
|
end
|
372
|
-
|
391
|
+
|
373
392
|
describe '#nexus_regions' do
|
374
393
|
before do
|
375
394
|
stub_get('/v2/nexus/regions').to_return(body: fixture('nexus_regions.json'), headers: { content_type: 'application/json; charset=utf-8' })
|
376
395
|
end
|
377
|
-
|
396
|
+
|
378
397
|
it 'requests the right resource' do
|
379
398
|
@client.nexus_regions
|
380
399
|
expect(a_get('/v2/nexus/regions')).to have_been_made
|
@@ -390,7 +409,7 @@ describe Taxjar::API do
|
|
390
409
|
expect(regions.first.region).to eq('California')
|
391
410
|
end
|
392
411
|
end
|
393
|
-
|
412
|
+
|
394
413
|
describe '#validate' do
|
395
414
|
before do
|
396
415
|
@params = 'vat=FR40303265045'
|
@@ -418,7 +437,7 @@ describe Taxjar::API do
|
|
418
437
|
expect(validation.vies_response.address).to eq("11 RUE AMPERE\n26600 PONT DE L ISERE")
|
419
438
|
end
|
420
439
|
end
|
421
|
-
|
440
|
+
|
422
441
|
describe '#summary_rates' do
|
423
442
|
before do
|
424
443
|
stub_get('/v2/summary_rates').to_return(body: fixture('summary_rates.json'), headers: { content_type: 'application/json; charset=utf-8' })
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taxjar-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TaxJar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- lib/taxjar/customer.rb
|
127
127
|
- lib/taxjar/error.rb
|
128
128
|
- lib/taxjar/exempt_region.rb
|
129
|
+
- lib/taxjar/jurisdictions.rb
|
129
130
|
- lib/taxjar/line_item.rb
|
130
131
|
- lib/taxjar/nexus_region.rb
|
131
132
|
- lib/taxjar/order.rb
|