taxjar-ruby 1.0.1 → 1.1.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.
- data/.ruby-version +1 -0
- data/.travis.yml +9 -0
- data/README.md +574 -11
- data/lib/taxjar/api/api.rb +0 -18
- data/lib/taxjar/api/order.rb +29 -0
- data/lib/taxjar/api/refund.rb +29 -0
- data/lib/taxjar/api/utils.rb +12 -0
- data/lib/taxjar/base.rb +21 -0
- data/lib/taxjar/client.rb +5 -0
- data/lib/taxjar/version.rb +2 -2
- data/spec/fixtures/orders.json +6 -0
- data/spec/fixtures/refunds.json +6 -0
- data/spec/helper.rb +8 -0
- data/spec/taxjar/api/api_spec.rb +0 -130
- data/spec/taxjar/api/order_spec.rb +156 -0
- data/spec/taxjar/api/refund_spec.rb +157 -0
- data/spec/taxjar/api/request_spec.rb +3 -3
- metadata +49 -19
- checksums.yaml +0 -7
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p0
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
-
# TaxJar Ruby Gem
|
1
|
+
# TaxJar Ruby Gem [](https://rubygems.org/gems/taxjar-ruby) [](https://travis-ci.org/taxjar/taxjar-ruby)
|
2
2
|
|
3
3
|
<a href="http://developers.taxjar.com"><img src="http://www.taxjar.com/img/TJ_logo_color_office_png.png" alt="TaxJar" width="220"></a>
|
4
4
|
|
5
|
-
A Ruby interface to the TaxJar API. TaxJar makes sales tax filing easier for online sellers and merchants.
|
5
|
+
A Ruby interface to the TaxJar Sales Tax API. TaxJar makes sales tax filing easier for online sellers and merchants.
|
6
6
|
See local jurisdictional tax reports, get payment reminders, and more. You can use our API to access TaxJar API endpoints,
|
7
7
|
which can get information on sales tax rates, categories or upload transactions.
|
8
8
|
|
9
9
|
* This wrapper supports 100% of the [TaxJar API Version 2](http://developers.taxjar.com/api/#introduction)
|
10
10
|
* Data returned from API calls are mapped into Ruby objects
|
11
11
|
|
12
|
+
## Supported Ruby Versions
|
13
|
+
|
14
|
+
Ruby 1.9.3 or greater
|
15
|
+
|
12
16
|
## Gem Dependencies
|
13
17
|
|
14
18
|
Installing this gem also installs the following gems:
|
@@ -41,29 +45,98 @@ $ gem install taxjar-ruby
|
|
41
45
|
|
42
46
|
First, [get an API key from TaxJar](https://app.taxjar.com/api_sign_up/plus/). Copy and paste in your API key:
|
43
47
|
|
44
|
-
```ruby
|
45
|
-
client = Taxjar::Client.new(api_key: 'YOUR KEY')
|
46
|
-
```
|
47
48
|
|
48
49
|
You are now ready to use TaxJar!
|
49
50
|
|
50
51
|
## Usage
|
51
52
|
|
52
53
|
### List all tax categories
|
54
|
+
|
55
|
+
#### Definition
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
client.categories
|
59
|
+
```
|
60
|
+
|
61
|
+
#### Example Request
|
62
|
+
|
53
63
|
```ruby
|
54
|
-
|
64
|
+
require 'taxjar'
|
65
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
66
|
+
|
67
|
+
client.categories
|
68
|
+
```
|
69
|
+
|
70
|
+
#### Example Response
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
[
|
74
|
+
#<Taxjar::Category:0x007f081dc3e278 @attrs={
|
75
|
+
:name => "Digital Goods",
|
76
|
+
:product_tax_code => 31000,
|
77
|
+
:description => "Digital products transferred electronically."
|
78
|
+
}>,
|
79
|
+
#<Taxjar::Category:0x007f081dc3de90 @attrs={
|
80
|
+
:name => "Clothing",
|
81
|
+
:product_tax_code => 20010,
|
82
|
+
:description => "All human wearing apparel suitable for general use"
|
83
|
+
}>,
|
84
|
+
#<Taxjar::Category:0x007f081dc3da80 @attrs={
|
85
|
+
:name => "Non-Prescription",
|
86
|
+
:product_tax_code => 51010,
|
87
|
+
:description => "Drugs for human use without a prescription"
|
88
|
+
}>
|
89
|
+
]
|
55
90
|
```
|
56
91
|
|
57
92
|
### List tax rates for a location (by zip/postal code)
|
58
93
|
|
94
|
+
#### Definition
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
client.rates_for_location
|
98
|
+
```
|
99
|
+
|
100
|
+
#### Example Request
|
101
|
+
|
59
102
|
```ruby
|
60
|
-
|
103
|
+
require 'taxjar'
|
104
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
105
|
+
|
106
|
+
client.rates_for_location('10001')
|
107
|
+
```
|
108
|
+
|
109
|
+
#### Example Response
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
#<Taxjar::Rate:0x007fc47056a928 @attrs={
|
113
|
+
:zip => 90002,
|
114
|
+
:state => "CA",
|
115
|
+
:state_rate => 0.065,
|
116
|
+
:county => "LOS ANGELES",
|
117
|
+
:county_rate => 0.01,
|
118
|
+
:city => "WATTS",
|
119
|
+
:city_rate => 0,
|
120
|
+
:combined_district_rate => 0.015,
|
121
|
+
:combined_rate => 0.09
|
122
|
+
}>
|
61
123
|
```
|
62
124
|
|
63
125
|
### Calculate Sales tax for an order
|
64
126
|
|
127
|
+
#### Definition
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
client.tax_for_order
|
131
|
+
```
|
132
|
+
|
133
|
+
#### Example Request
|
134
|
+
|
65
135
|
```ruby
|
66
|
-
|
136
|
+
require 'taxjar'
|
137
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
138
|
+
|
139
|
+
client.tax_for_order({
|
67
140
|
:to_country => 'US',
|
68
141
|
:to_zip => '90002',
|
69
142
|
:to_city => 'Los Angeles',
|
@@ -73,6 +146,12 @@ order = client.tax_for_order({
|
|
73
146
|
:from_city => 'San Diego',
|
74
147
|
:amount => 16.50,
|
75
148
|
:shipping => 1.5,
|
149
|
+
:nexus_addresses => [{:address_id => 1,
|
150
|
+
:country => 'US',
|
151
|
+
:zip => '93101',
|
152
|
+
:state => 'CA',
|
153
|
+
:city => 'Santa Barbara',
|
154
|
+
:street => '1218 State St.'}],
|
76
155
|
:line_items => [{:quantity => 1,
|
77
156
|
:product_identifier => '12-34243-9',
|
78
157
|
:unit_price => 15.0,
|
@@ -80,17 +159,145 @@ order = client.tax_for_order({
|
|
80
159
|
})
|
81
160
|
```
|
82
161
|
|
162
|
+
#### Example Response
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
#<Taxjar::Tax:0x007f3945688fc8 @attrs={
|
166
|
+
:order_total_amount => 16.5,
|
167
|
+
:amount_to_collect => 1.35,
|
168
|
+
:has_nexus => true,
|
169
|
+
:freight_taxable => false,
|
170
|
+
:tax_source => "destination",
|
171
|
+
:breakdown => {
|
172
|
+
:state_taxable_amount => 15.0,
|
173
|
+
:state_tax_collectable => 0.98,
|
174
|
+
:county_taxable_amount => 15.0,
|
175
|
+
:county_tax_collectable => 0.15,
|
176
|
+
:city_taxable_amount => 0.0,
|
177
|
+
:city_tax_collectable => 0.0,
|
178
|
+
:special_district_taxable_amount => 15.0,
|
179
|
+
:special_district_tax_collectable => 0.22,
|
180
|
+
:line_items => [
|
181
|
+
{
|
182
|
+
:id => "1",
|
183
|
+
:state_taxable_amount => 15.0,
|
184
|
+
:state_sales_tax_rate => 0.065,
|
185
|
+
:county_taxable_amount => 15.0,
|
186
|
+
:county_tax_rate => 0.01,
|
187
|
+
:city_taxable_amount => 0.0,
|
188
|
+
:city_tax_rate => 0.0,
|
189
|
+
:special_district_taxable_amount => 15.0,
|
190
|
+
:special_tax_rate => 0.015
|
191
|
+
}
|
192
|
+
]
|
193
|
+
}
|
194
|
+
}>
|
195
|
+
```
|
196
|
+
|
197
|
+
### List order transactions
|
198
|
+
|
199
|
+
#### Definition
|
200
|
+
|
201
|
+
```ruby
|
202
|
+
client.list_orders
|
203
|
+
```
|
204
|
+
|
205
|
+
#### Example Request
|
206
|
+
|
207
|
+
```ruby
|
208
|
+
require 'taxjar'
|
209
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
210
|
+
|
211
|
+
client.list_orders({:from_transaction_date => '2014/01/01',
|
212
|
+
:to_transaction_date => '2015/05/30'})
|
213
|
+
```
|
214
|
+
|
215
|
+
#### Example Response
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
['20', '21', '22']
|
219
|
+
```
|
220
|
+
|
221
|
+
### Show order transaction
|
222
|
+
|
223
|
+
#### Definition
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
client.show_order
|
227
|
+
```
|
228
|
+
|
229
|
+
#### Example Request
|
230
|
+
|
231
|
+
```ruby
|
232
|
+
require 'taxjar'
|
233
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
234
|
+
|
235
|
+
client.show_order('123')
|
236
|
+
```
|
237
|
+
|
238
|
+
#### Example Response
|
239
|
+
|
240
|
+
```ruby
|
241
|
+
#<Taxjar::Order:0x007fd3e514a940 @attrs={
|
242
|
+
:transaction_id => 123,
|
243
|
+
:user_id => 11836,
|
244
|
+
:transaction_date => "2015-05-14T00:00:00Z",
|
245
|
+
:transaction_reference_id => nil,
|
246
|
+
:from_country => "US",
|
247
|
+
:from_zip => 93107,
|
248
|
+
:from_state => "CA",
|
249
|
+
:from_city => "SANTA BARBARA",
|
250
|
+
:from_street => "1281 State St",
|
251
|
+
:to_country => "US",
|
252
|
+
:to_zip => 90002,
|
253
|
+
:to_state => "CA",
|
254
|
+
:to_city => "LOS ANGELES",
|
255
|
+
:to_street => "123 Palm Grove Ln",
|
256
|
+
:amount => 17.95,
|
257
|
+
:shipping => 2,
|
258
|
+
:sales_tax => 0.95,
|
259
|
+
:line_items => [
|
260
|
+
{
|
261
|
+
:id => 1,
|
262
|
+
:quantity => 1,
|
263
|
+
:product_identifier => "12-34243-0",
|
264
|
+
:product_tax_code => nil,
|
265
|
+
:description => "Heavy Widget",
|
266
|
+
:unit_price => "15.0",
|
267
|
+
:discount => "0.0",
|
268
|
+
:sales_tax => "0.95"
|
269
|
+
}
|
270
|
+
]
|
271
|
+
}>
|
272
|
+
```
|
273
|
+
|
83
274
|
### Create order transaction
|
84
275
|
|
276
|
+
#### Definition
|
277
|
+
|
278
|
+
```ruby
|
279
|
+
client.create_order
|
280
|
+
```
|
281
|
+
|
282
|
+
#### Example Request
|
283
|
+
|
85
284
|
```ruby
|
86
|
-
|
285
|
+
require 'taxjar'
|
286
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
287
|
+
|
288
|
+
client.create_order({
|
87
289
|
:transaction_id => '123',
|
88
290
|
:transaction_date => '2015/05/14',
|
291
|
+
:from_state => 'CA',
|
292
|
+
:from_city => 'Santa Barbara',
|
293
|
+
:from_street => '1218 State St',
|
294
|
+
:from_country => 'US',
|
295
|
+
:from_zip => '93101',
|
89
296
|
:to_country => 'US',
|
90
|
-
:to_zip => '90002',
|
91
297
|
:to_state => 'CA',
|
92
298
|
:to_city => 'Los Angeles',
|
93
299
|
:to_street => '123 Palm Grove Ln',
|
300
|
+
:to_zip => '90002',
|
94
301
|
:amount => 17.45,
|
95
302
|
:shipping => 1.5,
|
96
303
|
:sales_tax => 0.95,
|
@@ -102,10 +309,54 @@ order = client.create_order({
|
|
102
309
|
})
|
103
310
|
```
|
104
311
|
|
312
|
+
#### Example Response
|
313
|
+
|
314
|
+
```ruby
|
315
|
+
#<Taxjar::Order:0x007f6d65b252d0 @attrs={
|
316
|
+
:transaction_id => 20,
|
317
|
+
:user_id => 11836,
|
318
|
+
:transaction_date => "2015-05-14T00:00:00Z",
|
319
|
+
:transaction_reference_id => nil,
|
320
|
+
:from_country => "US",
|
321
|
+
:from_zip => 93101,
|
322
|
+
:from_state => "CA",
|
323
|
+
:from_city => "SANTA BARBARA",
|
324
|
+
:from_street => "1218 State St",
|
325
|
+
:to_country => "US",
|
326
|
+
:to_zip => 90002,
|
327
|
+
:to_state => "CA",
|
328
|
+
:to_city => "LOS ANGELES",
|
329
|
+
:to_street => "123 Palm Grove Ln",
|
330
|
+
:amount => 15.02,
|
331
|
+
:shipping => 1.5,
|
332
|
+
:sales_tax => 0.95,
|
333
|
+
:line_items => [
|
334
|
+
{
|
335
|
+
:id => 1,
|
336
|
+
:quantity => 1,
|
337
|
+
:product_identifier => "12-34243-9",
|
338
|
+
:product_tax_code => nil,
|
339
|
+
:description => "Fuzzy Widget",
|
340
|
+
:unit_price => "15.0",
|
341
|
+
:discount => "0.0",
|
342
|
+
:sales_tax => "0.85"
|
343
|
+
}
|
344
|
+
]
|
345
|
+
}>
|
346
|
+
```
|
347
|
+
|
105
348
|
### Update order transaction
|
106
349
|
|
350
|
+
#### Definition
|
351
|
+
|
352
|
+
```ruby
|
353
|
+
client.update_order
|
354
|
+
```
|
355
|
+
|
356
|
+
#### Example Request
|
357
|
+
|
107
358
|
```ruby
|
108
|
-
|
359
|
+
client.update_order({
|
109
360
|
:transaction_id => '123',
|
110
361
|
:amount => 17.95,
|
111
362
|
:shipping => 2.0,
|
@@ -118,13 +369,195 @@ order = client.update_order({
|
|
118
369
|
})
|
119
370
|
```
|
120
371
|
|
372
|
+
#### Example Response
|
373
|
+
|
374
|
+
```ruby
|
375
|
+
#<Taxjar::Order:0x007f6d65b252d0 @attrs={
|
376
|
+
:transaction_id => 123,
|
377
|
+
:user_id => 11836,
|
378
|
+
:transaction_date => "2015-05-14T00:00:00Z",
|
379
|
+
:transaction_reference_id => nil,
|
380
|
+
:from_country => "US",
|
381
|
+
:from_zip => 93101,
|
382
|
+
:from_state => "CA",
|
383
|
+
:from_city => "SANTA BARBARA",
|
384
|
+
:from_street => "1218 State St",
|
385
|
+
:to_country => "US",
|
386
|
+
:to_zip => 90002,
|
387
|
+
:to_state => "CA",
|
388
|
+
:to_city => "LOS ANGELES",
|
389
|
+
:to_street => "123 Palm Grove Ln",
|
390
|
+
:amount => 17.95,
|
391
|
+
:shipping => 2.0,
|
392
|
+
:sales_tax => 0.95,
|
393
|
+
:line_items => [
|
394
|
+
{
|
395
|
+
:id => 1,
|
396
|
+
:quantity => 1,
|
397
|
+
:product_identifier => "12-34243-0",
|
398
|
+
:product_tax_code => nil,
|
399
|
+
:description => "Heavy Widget",
|
400
|
+
:unit_price => "15.0",
|
401
|
+
:discount => "0.0",
|
402
|
+
:sales_tax => "0.95"
|
403
|
+
}
|
404
|
+
]
|
405
|
+
}>
|
406
|
+
```
|
407
|
+
|
408
|
+
### Delete order transaction
|
409
|
+
|
410
|
+
#### Definition
|
411
|
+
|
412
|
+
```ruby
|
413
|
+
client.delete_order
|
414
|
+
```
|
415
|
+
|
416
|
+
#### Example Request
|
417
|
+
|
418
|
+
```ruby
|
419
|
+
require 'taxjar'
|
420
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
421
|
+
|
422
|
+
client.delete_order(123)
|
423
|
+
```
|
424
|
+
|
425
|
+
#### Example Response
|
426
|
+
|
427
|
+
```ruby
|
428
|
+
#<Taxjar::Order:0x007f6d65b252d0 @attrs={
|
429
|
+
:transaction_id => 123,
|
430
|
+
:user_id => 11836,
|
431
|
+
:transaction_date => "2015-05-14T00:00:00Z",
|
432
|
+
:transaction_reference_id => nil,
|
433
|
+
:from_country => "US",
|
434
|
+
:from_zip => 93101,
|
435
|
+
:from_state => "CA",
|
436
|
+
:from_city => "SANTA BARBARA",
|
437
|
+
:from_street => "1218 State St",
|
438
|
+
:to_country => "US",
|
439
|
+
:to_zip => 90002,
|
440
|
+
:to_state => "CA",
|
441
|
+
:to_city => "LOS ANGELES",
|
442
|
+
:to_street => "123 Palm Grove Ln",
|
443
|
+
:amount => 17.95,
|
444
|
+
:shipping => 2.0,
|
445
|
+
:sales_tax => 0.95,
|
446
|
+
:line_items => [
|
447
|
+
{
|
448
|
+
:id => 1,
|
449
|
+
:quantity => 1,
|
450
|
+
:product_identifier => "12-34243-0",
|
451
|
+
:product_tax_code => nil,
|
452
|
+
:description => "Heavy Widget",
|
453
|
+
:unit_price => "15.0",
|
454
|
+
:discount => "0.0",
|
455
|
+
:sales_tax => "0.95"
|
456
|
+
}
|
457
|
+
]
|
458
|
+
}>
|
459
|
+
```
|
460
|
+
|
461
|
+
### Listing refund transactions
|
462
|
+
|
463
|
+
#### Definition
|
464
|
+
|
465
|
+
```ruby
|
466
|
+
client.list_refunds
|
467
|
+
```
|
468
|
+
|
469
|
+
#### Example Request
|
470
|
+
|
471
|
+
```ruby
|
472
|
+
require 'taxjar'
|
473
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
474
|
+
|
475
|
+
client.list_refunds({:from_transaction_date => '2014/01/01',
|
476
|
+
:to_transaction_date => '2015/05/30'})
|
477
|
+
```
|
478
|
+
|
479
|
+
#### Example Response
|
480
|
+
|
481
|
+
```ruby
|
482
|
+
['203', '204', '205']
|
483
|
+
```
|
484
|
+
|
485
|
+
### Show refund transaction
|
486
|
+
|
487
|
+
#### Definition
|
488
|
+
|
489
|
+
```ruby
|
490
|
+
client.show_refund
|
491
|
+
```
|
492
|
+
|
493
|
+
#### Example Request
|
494
|
+
|
495
|
+
```ruby
|
496
|
+
require 'taxjar'
|
497
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
498
|
+
|
499
|
+
client.show_refund('321')
|
500
|
+
```
|
501
|
+
|
502
|
+
#### Example Response
|
503
|
+
|
504
|
+
```ruby
|
505
|
+
#<Taxjar::Refund:0x007f6da40e33a0 @attrs={
|
506
|
+
:transaction_id => 321,
|
507
|
+
:user_id => 11836,
|
508
|
+
:transaction_date => "2015-06-14T00:00:00Z",
|
509
|
+
:transaction_reference_id => 123,
|
510
|
+
:from_country => "US",
|
511
|
+
:from_zip => 93107,
|
512
|
+
:from_state => "CA",
|
513
|
+
:from_city => "SANTA BARBARA",
|
514
|
+
:from_street => "1218 State St",
|
515
|
+
:to_country => "US",
|
516
|
+
:to_zip => 90002,
|
517
|
+
:to_state => "CA",
|
518
|
+
:to_city => "LOS ANGELES",
|
519
|
+
:to_street => "123 Palm Grove Ln",
|
520
|
+
:amount => 17.95,
|
521
|
+
:shipping => 2.0,
|
522
|
+
:sales_tax => 0.95,
|
523
|
+
:line_items => [
|
524
|
+
{
|
525
|
+
:id => 1,
|
526
|
+
:quantity => 1,
|
527
|
+
:product_identifier => "12-34243-0",
|
528
|
+
:product_tax_code => nil,
|
529
|
+
:description => "Heavy Widget",
|
530
|
+
:unit_price => "15.0",
|
531
|
+
:discount => "0.0",
|
532
|
+
:sales_tax => "0.95"
|
533
|
+
}
|
534
|
+
]
|
535
|
+
}>
|
536
|
+
```
|
537
|
+
|
121
538
|
### Create refund transaction
|
122
539
|
|
540
|
+
#### Definition
|
541
|
+
|
542
|
+
```ruby
|
543
|
+
client.create_refund
|
544
|
+
```
|
545
|
+
|
546
|
+
#### Example Request
|
547
|
+
|
123
548
|
```ruby
|
549
|
+
require 'taxjar'
|
550
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
551
|
+
|
124
552
|
refund = client.create_refund({
|
125
553
|
:transaction_id => '321',
|
126
554
|
:transaction_date => '2015/05/14',
|
127
555
|
:transaction_reference_id => '123',
|
556
|
+
:from_country => 'US',
|
557
|
+
:from_zip => '93107',
|
558
|
+
:from_state => 'CA',
|
559
|
+
:from_city => 'Santa Barbara',
|
560
|
+
:from_street => '1218 State St',
|
128
561
|
:to_country => 'US',
|
129
562
|
:to_zip => '90002',
|
130
563
|
:to_state => 'CA',
|
@@ -141,8 +574,52 @@ refund = client.create_refund({
|
|
141
574
|
})
|
142
575
|
```
|
143
576
|
|
577
|
+
#### Example Response
|
578
|
+
|
579
|
+
```ruby
|
580
|
+
#<Taxjar::Refund:0x007f6da40e33a0 @attrs={
|
581
|
+
:transaction_id => 321,
|
582
|
+
:user_id => 11836,
|
583
|
+
:transaction_date => "2015-06-14T00:00:00Z",
|
584
|
+
:transaction_reference_id => 123,
|
585
|
+
:from_country => "US",
|
586
|
+
:from_zip => 93107,
|
587
|
+
:from_state => "CA",
|
588
|
+
:from_city => "SANTA BARBARA",
|
589
|
+
:from_street => "1218 State St",
|
590
|
+
:to_country => "US",
|
591
|
+
:to_zip => 90002,
|
592
|
+
:to_state => "CA",
|
593
|
+
:to_city => "LOS ANGELES",
|
594
|
+
:to_street => "123 Palm Grove Ln",
|
595
|
+
:amount => 17.95,
|
596
|
+
:shipping => 2.0,
|
597
|
+
:sales_tax => 0.95,
|
598
|
+
:line_items => [
|
599
|
+
{
|
600
|
+
:id => 1,
|
601
|
+
:quantity => 1,
|
602
|
+
:product_identifier => "12-34243-0",
|
603
|
+
:product_tax_code => nil,
|
604
|
+
:description => "Heavy Widget",
|
605
|
+
:unit_price => "15.0",
|
606
|
+
:discount => "0.0",
|
607
|
+
:sales_tax => "0.95"
|
608
|
+
}
|
609
|
+
]
|
610
|
+
}>
|
611
|
+
```
|
612
|
+
|
144
613
|
### Update refund transaction
|
145
614
|
|
615
|
+
#### Definition
|
616
|
+
|
617
|
+
```ruby
|
618
|
+
client.update_refund
|
619
|
+
```
|
620
|
+
|
621
|
+
#### Example Request
|
622
|
+
|
146
623
|
```ruby
|
147
624
|
refund = client.update_refund{
|
148
625
|
:transaction_id => '321',
|
@@ -157,6 +634,92 @@ refund = client.update_refund{
|
|
157
634
|
})
|
158
635
|
```
|
159
636
|
|
637
|
+
#### Example Response
|
638
|
+
|
639
|
+
```ruby
|
640
|
+
#<Taxjar::Refund:0x007f6da40e33a0 @attrs={
|
641
|
+
:transaction_id => 321,
|
642
|
+
:user_id => 11836,
|
643
|
+
:transaction_date => "2015-06-14T00:00:00Z",
|
644
|
+
:transaction_reference_id => 123,
|
645
|
+
:from_country => "US",
|
646
|
+
:from_zip => 93107,
|
647
|
+
:from_state => "CA",
|
648
|
+
:from_city => "SANTA BARBARA",
|
649
|
+
:from_street => "1218 State St",
|
650
|
+
:to_country => "US",
|
651
|
+
:to_zip => 90002,
|
652
|
+
:to_state => "CA",
|
653
|
+
:to_city => "LOS ANGELES",
|
654
|
+
:to_street => "123 Palm Grove Ln",
|
655
|
+
:amount => 17.95,
|
656
|
+
:shipping => 2.0,
|
657
|
+
:sales_tax => 0.95,
|
658
|
+
:line_items => [
|
659
|
+
{
|
660
|
+
:id => 1,
|
661
|
+
:quantity => 1,
|
662
|
+
:product_identifier => "12-34243-9",
|
663
|
+
:product_tax_code => nil,
|
664
|
+
:description => "Heavy Widget",
|
665
|
+
:unit_price => "15.0",
|
666
|
+
:discount => "0.0",
|
667
|
+
:sales_tax => "0.95"
|
668
|
+
}
|
669
|
+
]
|
670
|
+
}>
|
671
|
+
```
|
672
|
+
|
673
|
+
### Delete refund transaction
|
674
|
+
|
675
|
+
#### Definition
|
676
|
+
|
677
|
+
```ruby
|
678
|
+
client.delete_refund
|
679
|
+
```
|
680
|
+
|
681
|
+
#### Example Request
|
682
|
+
|
683
|
+
```ruby
|
684
|
+
client.delete_refund(321)
|
685
|
+
```
|
686
|
+
|
687
|
+
#### Example Response
|
688
|
+
|
689
|
+
```ruby
|
690
|
+
#<Taxjar::Refund:0x007f6da40e33a0 @attrs={
|
691
|
+
:transaction_id => 321,
|
692
|
+
:user_id => 11836,
|
693
|
+
:transaction_date => "2015-06-14T00:00:00Z",
|
694
|
+
:transaction_reference_id => 123,
|
695
|
+
:from_country => "US",
|
696
|
+
:from_zip => 93107,
|
697
|
+
:from_state => "CA",
|
698
|
+
:from_city => "SANTA BARBARA",
|
699
|
+
:from_street => "1218 State St",
|
700
|
+
:to_country => "US",
|
701
|
+
:to_zip => 90002,
|
702
|
+
:to_state => "CA",
|
703
|
+
:to_city => "LOS ANGELES",
|
704
|
+
:to_street => "123 Palm Grove Ln",
|
705
|
+
:amount => 17.95,
|
706
|
+
:shipping => 2.0,
|
707
|
+
:sales_tax => 0.95,
|
708
|
+
:line_items => [
|
709
|
+
{
|
710
|
+
:id => 1,
|
711
|
+
:quantity => 1,
|
712
|
+
:product_identifier => "12-34243-9",
|
713
|
+
:product_tax_code => nil,
|
714
|
+
:description => "Heavy Widget",
|
715
|
+
:unit_price => "15.0",
|
716
|
+
:discount => "0.0",
|
717
|
+
:sales_tax => "0.95"
|
718
|
+
}
|
719
|
+
]
|
720
|
+
}>
|
721
|
+
```
|
722
|
+
|
160
723
|
## Tests
|
161
724
|
|
162
725
|
An RSpec test suite is available to ensure API functionality:
|