Avatax_TaxService 1.0.7 → 1.0.8

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2JjYzEyNGJlMDA3ZGM5ZmNmZGU4MWM1OGRmYzhjMGIyNDIyNzMxYw==
4
+ YTMwOWJmNmU3Y2I1N2E5OTczNTY4OGRiMmI3ODEzMWI4MmI4YWM2Mw==
5
5
  data.tar.gz: !binary |-
6
- MzgzY2MzMDc5MWVjMDFjM2Y0YWZlNDczMzUxNGUyM2RjNGIwOWI1MA==
6
+ NjNmNjg4NmMxOWIwMTI3NjNiNzQ3ZTQ3MDNiNzM2N2NhZTk1Y2Y2MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTcyZjA0OTgxYTEyZmIyMGFhODYxZjhiYTAyNmRkNzY3MzQ4NzY4M2I1Zjc0
10
- MTIwZTU0OTdkMzhlZDcxMzVjZTgzMGJhNzVhYTExOWZjZjNmODQwNzVhYjg1
11
- YWZjZTlhMWUzZThiYjk2ODJjZTcxNzA1MjkxNWY2MDYxMGVhNjk=
9
+ NDllYTE4M2JmNjY0YzJkMTAyM2JhYWYwM2EwOTI2MjA5ODFiOGU2Mzg3Y2I1
10
+ MzBkYmFmYjNhNmRhMzFhMWRhY2UyMDViM2Y1MTFmMmU0NGFjNDMxMTYwNzhm
11
+ ZGY0OWY4ODBmOTlkNGIwNzliM2Q0MTBiZDA4NzBlZmE2NGExY2E=
12
12
  data.tar.gz: !binary |-
13
- MWQ5NjBiZjdlODlhZmZmZjRlMmU1OGM5NjRlZmQzYzU2OGU3NmFmOGQxNDNh
14
- MDhjNDljNjJjNThlM2FjZDU5M2EyOTE1MTBjMTE4MDk1Nzg5ZmQ2NWQzNGJj
15
- MTUyZDEzNDYzODNiZmRkZjhlYjA5MDkxM2UyMWIwZTc3MzVjNGM=
13
+ N2M2NTBhM2RhZjc4YTg2MGUwY2IwMTk2N2JiZjRiZjEzY2JkMDQwMTNiZGRl
14
+ OTYzNGRkYzk4NWY5NjczZTQzODlkNTMwMzNiMTkxZThlNWU3Y2MwZDc5MzMy
15
+ MWQzNTExZDYxZTU3NjhkZjI0Njc5YTBjMWVkN2I2NzBhMTFhMTQ=
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "Avatax_TaxService"
3
- s.version = "1.0.7"
3
+ s.version = "1.0.8"
4
4
  s.date = "2012-10-28"
5
5
  s.author = "Graham S Wilson"
6
6
  s.email = "support@Avalara.com"
@@ -158,7 +158,7 @@ module AvaTax
158
158
  time = Benchmark.measure do
159
159
  valaddr
160
160
  end
161
- if @val_addr[:ResultCode] == "Success"
161
+ if @val_addr[:ResultCode] == ["Success"]
162
162
  @log.puts "#{Time.now}: Validation OK"
163
163
  else
164
164
  @log.puts "#{Time.now}: Address #{line1}, #{line2}, #{line3}, #{city}, #{region}, #{postalcode}, #{country} failed to validate."
@@ -253,7 +253,7 @@ module AvaTax
253
253
  time = Benchmark.measure do
254
254
  valaddr
255
255
  end
256
- if @val_addr[:ResultCode] == "Success"
256
+ if @val_addr[:ResultCode] == ["Success"]
257
257
  @log.puts "#{Time.now}: Validation OK"
258
258
  else
259
259
  @log.puts "#{Time.now}: Address #{line1}, #{line2}, #{line3}, #{city}, #{region}, #{postalcode}, #{country} failed to validate."
@@ -32,47 +32,45 @@
32
32
  <ser:ExemptionNo><%= @exemptionno %></ser:ExemptionNo>
33
33
  <ser:OriginCode><%= @origincode %></ser:OriginCode>
34
34
  <ser:DestinationCode><%= @destinationcode %></ser:DestinationCode>
35
- <ser:Addresses><% addresses.each do |addresscode, line1, line2, line3, city, region, postalcode, country, taxregionid, latitude, longitude| %>
35
+ <ser:Addresses><% @addresses.each do |addr| %>
36
36
  <ser:BaseAddress>
37
- <ser:AddressCode><%= addresscode %></ser:AddressCode>
38
- <ser:Line1><%= line1 %></ser:Line1>
39
- <ser:Line2><%= line2 %></ser:Line2>
40
- <ser:Line3><%= line3 %></ser:Line3>
41
- <ser:City><%= city %></ser:City>
42
- <ser:Region><%= region %></ser:Region>
43
- <ser:PostalCode><%= postalcode %></ser:PostalCode>
44
- <ser:Country><%= country %></ser:Country>
45
- <ser:TaxRegionId><%= taxregionid %></ser:TaxRegionId>
46
- <ser:Latitude><%= latitude %></ser:Latitude>
47
- <ser:Longitude><%= longitude %></ser:Longitude>
37
+ <ser:AddressCode><%= addr[:addresscode] %></ser:AddressCode>
38
+ <ser:Line1><%= addr[:line1] %></ser:Line1>
39
+ <ser:Line2><%= addr[:line2] %></ser:Line2>
40
+ <ser:Line3><%= addr[:line3] %></ser:Line3>
41
+ <ser:City><%= addr[:city] %></ser:City>
42
+ <ser:Region><%= addr[:region] %></ser:Region>
43
+ <ser:PostalCode><%= addr[:postalcode] %></ser:PostalCode>
44
+ <ser:Country><%= addr[:country] %></ser:Country>
45
+ <ser:TaxRegionId><%= addr[:taxregionid] %></ser:TaxRegionId>
46
+ <ser:Latitude><%= addr[:latitude] %></ser:Latitude>
47
+ <ser:Longitude><%= addr[:longitude] %></ser:Longitude>
48
48
  </ser:BaseAddress><% end %>
49
49
  </ser:Addresses>
50
- <ser:Lines><% lines.each do |no, origincodeline, destinationcodeline, itemcode, taxcode, qty, amount, discounted, revacct, ref1, ref2,
51
- exemptionnoline, customerusagetype, description, taxoverridetypeline, taxamountline, taxdateline, reasonline, taxincluded,
52
- businessidentificationnoline| %>
50
+ <ser:Lines><% @lines.each do |lin| %>
53
51
  <ser:Line>
54
- <ser:No><%= no %></ser:No>
55
- <ser:OriginCode><%= origincodeline %></ser:OriginCode>
56
- <ser:DestinationCode><%= destinationcodeline %></ser:DestinationCode>
57
- <ser:ItemCode><%= itemcode %></ser:ItemCode>
58
- <ser:TaxCode><%= taxcode %></ser:TaxCode>
59
- <ser:Qty><%= qty %></ser:Qty>
60
- <ser:Amount><%= amount %></ser:Amount>
61
- <ser:Discounted><%= discounted %></ser:Discounted>
62
- <ser:RevAcct><%= revacct %></ser:RevAcct>
63
- <ser:Ref1><%= ref1 %></ser:Ref1>
64
- <ser:Ref2><%= ref2 %></ser:Ref2>
65
- <ser:ExemptionNo><%= exemptionnoline %></ser:ExemptionNo>
66
- <ser:CustomerUsageType><%= customerusagetype %></ser:CustomerUsageType>
67
- <ser:Description><%= description %></ser:Description>
52
+ <ser:No><%= lin[:no] %></ser:No>
53
+ <ser:OriginCode><%= lin[:origincodeline] %></ser:OriginCode>
54
+ <ser:DestinationCode><%= lin[:destinationcodeline] %></ser:DestinationCode>
55
+ <ser:ItemCode><%= lin[:itemcode] %></ser:ItemCode>
56
+ <ser:TaxCode><%= lin[:taxcode] %></ser:TaxCode>
57
+ <ser:Qty><%= lin[:qty] %></ser:Qty>
58
+ <ser:Amount><%= lin[:amount] %></ser:Amount>
59
+ <ser:Discounted><%= lin[:discounted] %></ser:Discounted>
60
+ <ser:RevAcct><%= lin[:revacct] %></ser:RevAcct>
61
+ <ser:Ref1><%= lin[:ref1] %></ser:Ref1>
62
+ <ser:Ref2><%= lin[:ref2] %></ser:Ref2>
63
+ <ser:ExemptionNo><%= lin[:exemptionnoline] %></ser:ExemptionNo>
64
+ <ser:CustomerUsageType><%= lin[:customerusagetype] %></ser:CustomerUsageType>
65
+ <ser:Description><%= lin[:description] %></ser:Description>
68
66
  <ser:TaxOverride>
69
- <ser:TaxOverrideType><%= taxoverridetypeline %></ser:TaxOverrideType>
70
- <ser:TaxAmount><%= taxamountline %></ser:TaxAmount>
71
- <ser:TaxDate><%= taxdateline %></ser:TaxDate>
72
- <ser:Reason><%= reasonline %></ser:Reason>
67
+ <ser:TaxOverrideType><%= lin[:taxoverridetypeline] %></ser:TaxOverrideType>
68
+ <ser:TaxAmount><%= lin[:taxamountline] %></ser:TaxAmount>
69
+ <ser:TaxDate><%= lin[:taxdateline] %></ser:TaxDate>
70
+ <ser:Reason><%= lin[:reasonline] %></ser:Reason>
73
71
  </ser:TaxOverride>
74
- <ser:TaxIncluded><%= taxincluded %></ser:TaxIncluded>
75
- <ser:BusinessIdentificationNo><%= businessidentificationnoline %></ser:BusinessIdentificationNo>
72
+ <ser:TaxIncluded><%= lin[:taxincluded] %></ser:TaxIncluded>
73
+ <ser:BusinessIdentificationNo><%= lin[:businessidentificationnoline] %></ser:BusinessIdentificationNo>
76
74
  </ser:Line><% end %>
77
75
  </ser:Lines>
78
76
  <ser:DetailLevel><%= @detaillevel %></ser:DetailLevel>
@@ -29,47 +29,45 @@
29
29
  <ser:ExemptionNo><%= @exemptionno %></ser:ExemptionNo>
30
30
  <ser:OriginCode><%= @origincode %></ser:OriginCode>
31
31
  <ser:DestinationCode><%= @destinationcode %></ser:DestinationCode>
32
- <ser:Addresses><% @addresses.each do |addresscode, line1, line2, line3, city, region, postalcode, country, taxregionid, latitude, longitude| %>
32
+ <ser:Addresses><% @addresses.each do |addr| %>
33
33
  <ser:BaseAddress>
34
- <ser:AddressCode><%= addresscode %></ser:AddressCode>
35
- <ser:Line1><%= line1 %></ser:Line1>
36
- <ser:Line2><%= line2 %></ser:Line2>
37
- <ser:Line3><%= line3 %></ser:Line3>
38
- <ser:City><%= city %></ser:City>
39
- <ser:Region><%= region %></ser:Region>
40
- <ser:PostalCode><%= postalcode %></ser:PostalCode>
41
- <ser:Country><%= country %></ser:Country>
42
- <ser:TaxRegionId><%= taxregionid %></ser:TaxRegionId>
43
- <ser:Latitude><%= latitude %></ser:Latitude>
44
- <ser:Longitude><%= longitude %></ser:Longitude>
34
+ <ser:AddressCode><%= addr[:addresscode] %></ser:AddressCode>
35
+ <ser:Line1><%= addr[:line1] %></ser:Line1>
36
+ <ser:Line2><%= addr[:line2] %></ser:Line2>
37
+ <ser:Line3><%= addr[:line3] %></ser:Line3>
38
+ <ser:City><%= addr[:city] %></ser:City>
39
+ <ser:Region><%= addr[:region] %></ser:Region>
40
+ <ser:PostalCode><%= addr[:postalcode] %></ser:PostalCode>
41
+ <ser:Country><%= addr[:country] %></ser:Country>
42
+ <ser:TaxRegionId><%= addr[:taxregionid] %></ser:TaxRegionId>
43
+ <ser:Latitude><%= addr[:latitude] %></ser:Latitude>
44
+ <ser:Longitude><%= addr[:longitude] %></ser:Longitude>
45
45
  </ser:BaseAddress><% end %>
46
46
  </ser:Addresses>
47
- <ser:Lines><% @lines.each do |no, origincodeline, destinationcodeline, itemcode, taxcode, qty, amount, discounted, revacct, ref1, ref2,
48
- exemptionnoline, customerusagetype, description, taxoverridetypeline, taxamountline, taxdateline, reasonline, taxincluded,
49
- businessidentificationnoline| %>
47
+ <ser:Lines><% @lines.each do |lin| %>
50
48
  <ser:Line>
51
- <ser:No><%= no %></ser:No>
52
- <ser:OriginCode><%= origincodeline %></ser:OriginCode>
53
- <ser:DestinationCode><%= destinationcodeline %></ser:DestinationCode>
54
- <ser:ItemCode><%= itemcode %></ser:ItemCode>
55
- <ser:TaxCode><%= taxcode %></ser:TaxCode>
56
- <ser:Qty><%= qty %></ser:Qty>
57
- <ser:Amount><%= amount %></ser:Amount>
58
- <ser:Discounted><%= discounted %></ser:Discounted>
59
- <ser:RevAcct><%= revacct %></ser:RevAcct>
60
- <ser:Ref1><%= ref1 %></ser:Ref1>
61
- <ser:Ref2><%= ref2 %></ser:Ref2>
62
- <ser:ExemptionNo><%= exemptionnoline %></ser:ExemptionNo>
63
- <ser:CustomerUsageType><%= customerusagetype %></ser:CustomerUsageType>
64
- <ser:Description><%= description %></ser:Description>
49
+ <ser:No><%= lin[:no] %></ser:No>
50
+ <ser:OriginCode><%= lin[:origincodeline] %></ser:OriginCode>
51
+ <ser:DestinationCode><%= lin[:destinationcodeline] %></ser:DestinationCode>
52
+ <ser:ItemCode><%= lin[:itemcode] %></ser:ItemCode>
53
+ <ser:TaxCode><%= lin[:taxcode] %></ser:TaxCode>
54
+ <ser:Qty><%= lin[:qty] %></ser:Qty>
55
+ <ser:Amount><%= lin[:amount] %></ser:Amount>
56
+ <ser:Discounted><%= lin[:discounted] %></ser:Discounted>
57
+ <ser:RevAcct><%= lin[:revacct] %></ser:RevAcct>
58
+ <ser:Ref1><%= lin[:ref1] %></ser:Ref1>
59
+ <ser:Ref2><%= lin[:ref2] %></ser:Ref2>
60
+ <ser:ExemptionNo><%= lin[:exemptionnoline] %></ser:ExemptionNo>
61
+ <ser:CustomerUsageType><%= lin[:customerusagetype] %></ser:CustomerUsageType>
62
+ <ser:Description><%= lin[:description] %></ser:Description>
65
63
  <ser:TaxOverride>
66
- <ser:TaxOverrideType><%= taxoverridetypeline %></ser:TaxOverrideType>
67
- <ser:TaxAmount><%= taxamountline %></ser:TaxAmount>
68
- <ser:TaxDate><%= taxdateline %></ser:TaxDate>
69
- <ser:Reason><%= reasonline %></ser:Reason>
64
+ <ser:TaxOverrideType><%= lin[:taxoverridetypeline] %></ser:TaxOverrideType>
65
+ <ser:TaxAmount><%= lin[:taxamountline] %></ser:TaxAmount>
66
+ <ser:TaxDate><%= lin[:taxdateline] %></ser:TaxDate>
67
+ <ser:Reason><%= lin[:reasonline] %></ser:Reason>
70
68
  </ser:TaxOverride>
71
- <ser:TaxIncluded><%= taxincluded %></ser:TaxIncluded>
72
- <ser:BusinessIdentificationNo><%= businessidentificationnoline %></ser:BusinessIdentificationNo>
69
+ <ser:TaxIncluded><%= lin[:taxincluded] %></ser:TaxIncluded>
70
+ <ser:BusinessIdentificationNo><%= lin[:businessidentificationnoline] %></ser:BusinessIdentificationNo>
73
71
  </ser:Line><% end %>
74
72
  </ser:Lines>
75
73
  <ser:DetailLevel><%= @detaillevel %></ser:DetailLevel>
data/test/test_adjtax.rb CHANGED
@@ -52,9 +52,9 @@ document[:destinationcode] = "456"
52
52
  # <TaxRegionId>0</TaxRegionId>
53
53
  # <Latitude/>
54
54
  # <Longitude/>
55
- document[:addresses] = [
56
- ["123", "100 ravine lane", "", "","Bainbridge Island","WA","98110","US","0","",""],
57
- ["456", "1S278 Wenmoth", "", "","Batavia","IL","60510","US","0","",""]
55
+ document[:addresses]= [
56
+ {:addresscode => "123",:line1 => "100 ravine lane",:city => "Bainbridge Island",:region => "WA",:postalcode => "98110",:country => "US",:taxregionid => "0",:latitude => "",:longitude => ""},
57
+ {:addresscode => "456",:line1 => "7070 West Arlington Drive",:city => "Lakewood",:region => "CO",:postalcode => "80123",:country => "US",:taxregionid => "0"}
58
58
  ]
59
59
  #Pass order/invoice lines as an array
60
60
  # <No>1</No>
@@ -77,8 +77,9 @@ document[:addresses] = [
77
77
  # <Reason>Tax Credit</Reason>
78
78
  # <TaxIncluded>false</TaxIncluded>
79
79
  # <BusinessIdentificationNo></BusinessIdentificationNo>
80
- document[:lines] = [["1","","","Canoe","","1","300","false","","ref1","ref2","","","Blue canoe","None",".0000","1900-01-01","","false",""],
81
- ["2","","","Rowing boat","","1","800","false","","ref3","ref4","","","Red rowing boat","None",".0000","1900-01-01","","false",""]
80
+ document[:lines] = [
81
+ {:no => "1",:itemcode => "Canoe",:qty => "1",:amount => "300.43",:discounted => "false",:ref1 => "ref1",:ref2 => "ref2",:description => "Blue canoe",:taxoverridetypeline => "TaxAmount",:taxamountline => "10",:taxdateline => "1900-01-01",:reasonline => "Tax credit",:taxincluded => "false"},
82
+ {:no => "2",:itemcode => "Rowing boat",:qty => "1",:amount => "800.12",:discounted => "false",:ref1 => "ref3",:ref2 => "ref4",:description => "Red rowing boat",:taxoverridetypeline => "None",:taxamountline => "0",:taxdateline => "1900-01-01",:taxincluded => "false"}
82
83
  ]
83
84
  document[:detaillevel] = "Tax" #The level of detail you want returned by the service
84
85
  document[:referencecode] = "" #Reference code - used for returns
data/test/test_gettax.rb CHANGED
@@ -12,8 +12,8 @@ document = Hash.new
12
12
  #Create new address hash object
13
13
  address = Hash.new
14
14
 
15
- credentials[:username] = 'grahamw'
16
- credentials[:password] = 'Avalara1!'
15
+ credentials[:username] = 'USERNAME'
16
+ credentials[:password] = 'PASSWORD'
17
17
  credentials[:name] = 'Avalara Inc.'
18
18
  credentials[:clientname] = 'MyShoppingCart'
19
19
  credentials[:adapter] = 'Avatax SDK for Ruby 1.0.6'
@@ -26,7 +26,7 @@ TaxServ = AvaTax::TaxService.new(credentials)
26
26
  AddrService = AvaTax::AddressService.new(credentials)
27
27
 
28
28
  #Populate the fields required by the GetTax call
29
- document[:companycode] = '1'
29
+ document[:companycode] = 'APITrialCompany'
30
30
  document[:doctype] = 'SalesInvoice'
31
31
  document[:doccode] = "MyDocCode"
32
32
  document[:docdate] = "2013-10-11"
@@ -39,7 +39,7 @@ document[:exemptionno] = ""
39
39
  document[:origincode] = "123"
40
40
  document[:destinationcode] = "456"
41
41
 
42
- #Pass addresses as an array
42
+ #Pass addresses as an array of hashes
43
43
  # <AddressCode>123</AddressCode>
44
44
  # <Line1>100 Ravine Lane</Line1>
45
45
  # <Line2/>
@@ -52,11 +52,11 @@ document[:destinationcode] = "456"
52
52
  # <Latitude/>
53
53
  # <Longitude/>
54
54
  document[:addresses]= [
55
- ["123", "100 ravine lane", "", "","Bainbridge Island","WA","98110","US","0","",""],
56
- ["456", "7070 West Arlington Drive", "", "","Lakewood","CO","80123","US","0","",""]
55
+ {:addresscode => "123",:line1 => "100 ravine lane", :line2 => "Suite 21",:city => "Bainbridge Island",:region => "WA",:postalcode => "98110",:country => "US",:taxregionid => "0",:latitude => "",:longitude => ""},
56
+ {:addresscode => "456",:line1 => "7070 West Arlington Drive",:city => "Lakewood",:region => "CO",:postalcode => "80123",:country => "US",:taxregionid => "0"}
57
57
  ]
58
58
 
59
- #Pass order/invoice lines as an array
59
+ #Pass order/invoice lines as an array of hashes
60
60
  # <No>1</No>
61
61
  # <OriginCode></OriginCode>
62
62
  # <DestinationCode></DestinationCode>
@@ -78,8 +78,8 @@ document[:addresses]= [
78
78
  # <TaxIncluded>false</TaxIncluded>
79
79
  # <BusinessIdentificationNo></BusinessIdentificationNo>
80
80
  document[:lines] = [
81
- ["1","","","Canoe","","1","300.43","false","","ref1","ref2","","","Blue canoe","TaxAmount","10","1900-01-01","Tax credit","false",""],
82
- ["2","","","Rowing boat","","1","800.12","false","","ref3","ref4","","","Red rowing boat","None",".0000","1900-01-01","","false",""]
81
+ {:no => "1",:itemcode => "Canoe",:qty => "1",:amount => "300.43",:discounted => "false",:ref1 => "ref1",:ref2 => "ref2",:description => "Blue canoe",:taxoverridetypeline => "TaxAmount",:taxamountline => "10",:taxdateline => "1900-01-01",:reasonline => "Tax credit",:taxincluded => "false"},
82
+ {:no => "2",:itemcode => "Rowing boat",:qty => "1",:amount => "800.12",:discounted => "false",:ref1 => "ref3",:ref2 => "ref4",:description => "Red rowing boat",:taxoverridetypeline => "None",:taxamountline => "0",:taxdateline => "1900-01-01",:taxincluded => "false"}
83
83
  ]
84
84
  document[:detaillevel] = "Tax" #The level of detail you want returned by the service
85
85
  document[:referencecode] = "" #Reference code - used for returns
@@ -154,21 +154,4 @@ while i < no_of_lines
154
154
  j += 1
155
155
  end
156
156
  i += 1
157
- end
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
157
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Avatax_TaxService
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Graham S Wilson