Avatax_TaxService 1.0.10 → 1.0.11

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
- MzljMDBmYjY0MTllMGIzNzFjZWMzNjI1Y2YwMmExYmQzOGUyYzZhNg==
4
+ MjRiYjE2ODA4NzMxMzg4ZmNkYzdjODBlZmFhOTdkNzBlMzNlZmExZg==
5
5
  data.tar.gz: !binary |-
6
- Nzg1NTBmYWI1YWE4Nzg5Yjc1OTMyY2U5NDA0MDgzZGYwM2Y5YjBjZg==
6
+ ZWIzYjU2ODY5NDYyZTI3YWRjMWQ2OWYzN2UzZTMxZTFkZTExMTkyYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTk5N2FmYmZiNDNmYTM3MDQwN2Q2MGRiMDE1OTA2MDMzZDlmZDcxY2M3Nzgy
10
- Y2NiMDU4ZDkxNGMxOGJlOTNhYjA4NTk5YmJkZWRjY2I0YjliZGU2OThhMzVm
11
- OTA5MzlmY2IwMGEwNzc4MjcwZGVmNjdiYWY4ZDVlODE0Y2FiMGM=
9
+ Y2FhZTU5ZWM1NDA2NjU1NTg1MzM0NzUyYjI5M2IxNWVhNTJjM2JlYzQ0NWFm
10
+ NTUxNTVlN2FjNjkwYjI2N2IyZWFiNGMzZGJjM2U2Y2VmNDk5ODcyM2IyMmYx
11
+ Y2JhZTlkNDE4MmE3NjVkNDI3NmU5ZDFiMjg0M2NmZmQ2MTdiMjQ=
12
12
  data.tar.gz: !binary |-
13
- OTU1MmRjNTI3NmZlNTVkZjU1YzFlOWQ2MTZlNzNhZWFkMzRlZDBjMjdkMTE5
14
- ZDliZmUyY2IyNTc3ZDcyNzRhMDNmYWIzMTU0MGNmNmNiYTYwNGNiZjk4MjQx
15
- MWY3NzcyNzllNjIzMjhmMDMzNDdlZmM0OWE4ZWM2Zjg5MzcxNDk=
13
+ NWVjNmI3ZGE1MGVmMzdmYzQwZmZhODVlN2Y4YmMyNjhlZTBlMjFmZTk2MmE5
14
+ MTlkYWM3NWI1NWZiYWI5OGE1YmRmNDQyOWNiNDEzN2ZkNjAxNmQwMzc4Zjdm
15
+ MDQ0MmJiOTIxMmY3Y2NmNzc5MzM4NzEyMjdiNjE3M2ZmNmY4NmM=
Binary file
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "Avatax_TaxService"
3
- s.version = "1.0.10"
3
+ s.version = "1.0.11"
4
4
  s.date = "2012-10-28"
5
5
  s.author = "Graham S Wilson"
6
6
  s.email = "support@Avalara.com"
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
13
13
  "lib/template_gettaxhistory.erb","lib/template_isauthorized.erb","lib/template_ping.erb","lib/template_posttax.erb",
14
14
  "lib/template_reconciletaxhistory.erb","test/test_adjtax.rb","test/test_gettax.rb","test/test_gettaxhistory.rb",
15
15
  "test/test_reconciletaxhistory.rb", "Avatax_TaxService.gemspec","Avatax Ruby SDK Guide.docx", "LICENSE.txt"]
16
- s.add_dependency "nokogiri", ">= 1.4.0"
17
16
  s.add_dependency "savon", ">= 2.3.0"
18
17
  s.required_ruby_version = '>= 1.9.1'
19
18
  s.post_install_message = 'Thanks for installing the Avalara AddressService Ruby SDK. Refer to "Avatax Ruby SDK User Guide.docx" to get started.'
@@ -151,7 +151,10 @@ module AvaTax
151
151
  # Call Ping Service
152
152
  @response = @client.call(:ping, xml: @soap).to_hash
153
153
  end
154
-
154
+
155
+ #Strip off outer layer of the hash - not needed
156
+ @response = @response[:ping_response]
157
+
155
158
  return @response
156
159
 
157
160
  #Capture unexpected errors
@@ -218,6 +221,9 @@ module AvaTax
218
221
  @response = @client.call(:get_tax, xml: @soap).to_hash
219
222
  end
220
223
 
224
+ #Strip off outer layer of the hash - not needed
225
+ @response = @response[:get_tax_response]
226
+
221
227
  #Return data to calling program
222
228
  return @response
223
229
 
@@ -283,7 +289,10 @@ module AvaTax
283
289
  @response = @client.call(:adjust_tax, xml: @soap).to_hash
284
290
  end
285
291
 
286
- #Return data to calling program
292
+ #Strip off outer layer of the hash - not needed
293
+ @response = @response[:adjust_tax_response]
294
+
295
+ #Return data to calling program
287
296
  return @response
288
297
 
289
298
  #Capture unexpected errors
@@ -328,6 +337,9 @@ module AvaTax
328
337
  @response = @client.call(:post_tax, xml: @soap).to_hash
329
338
  end
330
339
 
340
+ #Strip off outer layer of the hash - not needed
341
+ @response = @response[:post_tax_response]
342
+
331
343
  #Return data to calling program
332
344
  return @response
333
345
 
@@ -373,6 +385,9 @@ module AvaTax
373
385
  @response = @client.call(:commit_tax, xml: @soap).to_hash
374
386
  end
375
387
 
388
+ #Strip off outer layer of the hash - not needed
389
+ @response = @response[:commit_tax_response]
390
+
376
391
  #Return data to calling program
377
392
  return @response
378
393
 
@@ -417,6 +432,9 @@ module AvaTax
417
432
  @response = @client.call(:cancel_tax, xml: @soap).to_hash
418
433
  end
419
434
 
435
+ #Strip off outer layer of the hash - not needed
436
+ @response = @response[:cancel_tax_response]
437
+
420
438
  #Return data to calling program
421
439
  return @response
422
440
 
@@ -460,7 +478,10 @@ module AvaTax
460
478
  # Call GetTaxHistory Service
461
479
  @response = @client.call(:get_tax_history, xml: @soap).to_hash
462
480
  end
463
-
481
+
482
+ #Strip off outer layer of the hash - not needed
483
+ @response = @response[:get_tax_history_response]
484
+
464
485
  #Return data to calling program
465
486
  return @response
466
487
 
@@ -506,6 +527,9 @@ module AvaTax
506
527
  @response = @client.call(:reconcile_tax_history, xml: @soap).to_hash
507
528
  end
508
529
 
530
+ #Strip off outer layer of the hash - not needed
531
+ @response = @response[:reconcile_tax_history_response]
532
+
509
533
  #Return data to calling program
510
534
  return @response
511
535
 
@@ -522,16 +546,23 @@ module AvaTax
522
546
 
523
547
  @service = 'IsAuthorized'
524
548
 
525
- #Read in the SOAP template
526
- @operation = operation == nil ? "?" : operation
549
+ #Extract data from document hash
550
+ xtract(document)
527
551
 
528
552
  # Subsitute real vales for template place holders
529
553
  @soap = @template_isauthorized.result(binding)
554
+ if @debug
555
+ @log.puts "#{Time.now}: SOAP request created:"
556
+ @log.puts @soap
557
+ end
530
558
 
531
559
  # Make the call to the Avalara service
532
560
  begin
533
561
  @response = @client.call(:is_authorized, xml: @soap).to_hash
534
562
 
563
+ #Strip off outer layer of the hash - not needed
564
+ @response = @response[:is_authorized_response]
565
+
535
566
  return @response
536
567
 
537
568
  #Capture unexpected errors
@@ -622,6 +653,7 @@ module AvaTax
622
653
  debug = document[:debug]
623
654
  validate = document[:validate]
624
655
  message = document[:message]
656
+ operation = document[:operation]
625
657
 
626
658
  #Set parms passed by user - If Nil then default else use passed value
627
659
  @companycode = companycode == nil ? "" : companycode
@@ -673,6 +705,7 @@ module AvaTax
673
705
  @pagesize = pagesize == nil ? "" : pagesize
674
706
  @debug = debug == nil ? false : debug
675
707
  @ping_message = message
708
+ @operation = operation
676
709
 
677
710
  end
678
711
 
data/test/test_gettax.rb CHANGED
@@ -107,7 +107,7 @@ document[:validate]= false #If true - addresses will be vali
107
107
  #Create empty hash for the tax result details
108
108
  tax_result = Hash.new
109
109
 
110
- #Call the tax service
110
+ #Call the Avatax tax service
111
111
  tax_result = TaxServ.gettax(document)
112
112
 
113
113
  #Print out the returned hash
@@ -115,31 +115,35 @@ require 'pp'
115
115
  pp tax_result
116
116
  puts
117
117
 
118
- puts "Result Code = #{tax_result[:get_tax_response][:get_tax_result][:result_code]}"
119
- puts "Total Taxable = #{tax_result[:get_tax_response][:get_tax_result][:total_taxable]}"
120
- puts "Total Tax = #{tax_result[:get_tax_response][:get_tax_result][:total_tax]}"
118
+ puts "Result Code = #{tax_result[:get_tax_result][:result_code]}"
119
+ puts "Total Taxable = #{tax_result[:get_tax_result][:total_taxable]}"
120
+ puts "Total Tax = #{tax_result[:get_tax_result][:total_tax]}"
121
121
  puts
122
122
  #Get total taxable
123
- puts tax_result[:get_tax_response][:get_tax_result][:total_taxable]
123
+ puts tax_result[:get_tax_result][:total_taxable]
124
124
  puts
125
125
 
126
126
  #Get first tax line
127
- pp tax_result[:get_tax_response][:get_tax_result][:tax_lines][:tax_line][0]
127
+ pp tax_result[:get_tax_result][:tax_lines][:tax_line][0]
128
128
 
129
129
  puts
130
130
  #Get tax details for line 2
131
- pp tax_result[:get_tax_response][:get_tax_result][:tax_lines][:tax_line][1][:tax_details]
131
+ pp tax_result[:get_tax_result][:tax_lines][:tax_line][1][:tax_details]
132
132
 
133
133
  puts
134
134
  #Get tax line 2 .. first level of tax detail
135
- pp tax_result[:get_tax_response][:get_tax_result][:tax_lines][:tax_line][1][:tax_details][:tax_detail][0]
135
+ pp tax_result[:get_tax_result][:tax_lines][:tax_line][1][:tax_details][:tax_detail][0]
136
136
 
137
137
  puts
138
138
  #Get tax line 2 - country
139
- pp tax_result[:get_tax_response][:get_tax_result][:tax_lines][:tax_line][1][:tax_details][:tax_detail][0][:country]
140
-
139
+ pp tax_result[:get_tax_result][:tax_lines][:tax_line][1][:tax_details][:tax_detail][0][:country]
141
140
 
142
141
 
142
+ if tax_result[:get_tax_result][:result_code] == "Success" then
143
+ puts "The GetTax call was successful"
144
+ else
145
+ puts "The GetTax call failed"
146
+ end
143
147
 
144
148
 
145
149
 
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.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Graham S Wilson
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2012-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: nokogiri
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ! '>='
18
- - !ruby/object:Gem::Version
19
- version: 1.4.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ! '>='
25
- - !ruby/object:Gem::Version
26
- version: 1.4.0
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: savon
29
15
  requirement: !ruby/object:Gem::Requirement