tax_cloud 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.rdoc +4 -0
- data/CONTRIBUTORS.txt +7 -4
- data/README.rdoc +11 -6
- data/lib/tax_cloud/transaction.rb +14 -7
- data/lib/tax_cloud/version.rb +1 -1
- data/test/cassettes/authorized.yml +35 -24
- data/test/cassettes/authorized_with_capture.yml +35 -24
- data/test/cassettes/authorized_with_localized_time.yml +99 -0
- data/test/cassettes/captured.yml +49 -32
- data/test/cassettes/lookup.yml +9 -607
- data/test/cassettes/lookup_ny.yml +7 -605
- data/test/cassettes/returned.yml +49 -32
- data/test/test_transaction.rb +15 -2
- data/test/test_transaction_ny.rb +2 -2
- metadata +3 -2
data/test/cassettes/returned.yml
CHANGED
@@ -4,19 +4,25 @@ http_interactions:
|
|
4
4
|
method: post
|
5
5
|
uri: https://api.taxcloud.net/1.0/TaxCloud.asmx
|
6
6
|
body:
|
7
|
-
encoding:
|
7
|
+
encoding: US-ASCII
|
8
8
|
string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
9
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:
|
10
|
-
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://taxcloud.net"><env:Body><ins0:Lookup><ins0:customerID>42</ins0:customerID><ins0:cartID>
|
11
|
-
|
12
|
-
xsi:nil="true"/></ins0:origin><ins0:destination><ins0:Address1>
|
13
|
-
|
9
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://taxcloud.net"
|
10
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://taxcloud.net"><env:Body><ins0:Lookup><ins0:customerID>42</ins0:customerID><ins0:cartID>12747407328244180087</ins0:cartID><ins0:cartItems><ins0:CartItem><tns:Index>0</tns:Index><tns:ItemID>SKU-TEST</tns:ItemID><tns:TIC>0</tns:TIC><tns:Price>50.0</tns:Price><tns:Qty>1</tns:Qty></ins0:CartItem><ins0:CartItem><tns:Index>1</tns:Index><tns:ItemID>SKU-TEST1</tns:ItemID><tns:TIC>0</tns:TIC><tns:Price>100.0</tns:Price><tns:Qty>1</tns:Qty></ins0:CartItem></ins0:cartItems><ins0:origin><ins0:Address1>162
|
11
|
+
East Avenue</ins0:Address1><ins0:Address2>Third Floor</ins0:Address2><ins0:City>Norwalk</ins0:City><ins0:State>CT</ins0:State><ins0:Zip5>06851</ins0:Zip5><ins0:Zip4
|
12
|
+
xsi:nil="true"/></ins0:origin><ins0:destination><ins0:Address1>3121 West Government
|
13
|
+
Way</ins0:Address1><ins0:Address2>Suite 2B</ins0:Address2><ins0:City>Seattle</ins0:City><ins0:State>WA</ins0:State><ins0:Zip5>98199</ins0:Zip5><ins0:Zip4
|
14
14
|
xsi:nil="true"/></ins0:destination><ins0:apiLoginID>api-login-id</ins0:apiLoginID><ins0:apiKey>api-key</ins0:apiKey></ins0:Lookup></env:Body></env:Envelope>
|
15
15
|
headers:
|
16
16
|
Soapaction:
|
17
17
|
- ! '"http://taxcloud.net/Lookup"'
|
18
18
|
Content-Type:
|
19
19
|
- text/xml;charset=UTF-8
|
20
|
+
Content-Length:
|
21
|
+
- '1338'
|
22
|
+
Accept:
|
23
|
+
- ! '*/*'
|
24
|
+
User-Agent:
|
25
|
+
- Ruby
|
20
26
|
response:
|
21
27
|
status:
|
22
28
|
code: 200
|
@@ -29,35 +35,40 @@ http_interactions:
|
|
29
35
|
Server:
|
30
36
|
- Microsoft-IIS/7.0
|
31
37
|
X-Aspnet-Version:
|
32
|
-
-
|
38
|
+
- 4.0.30319
|
33
39
|
X-Powered-By:
|
34
40
|
- TaxCloud
|
35
41
|
Date:
|
36
|
-
-
|
42
|
+
- Fri, 01 Mar 2013 22:58:21 GMT
|
37
43
|
Content-Length:
|
38
|
-
- '
|
44
|
+
- '646'
|
39
45
|
body:
|
40
|
-
encoding:
|
46
|
+
encoding: US-ASCII
|
41
47
|
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
42
48
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><LookupResponse
|
43
|
-
xmlns="http://taxcloud.net"><LookupResult><ResponseType>
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
recorded_at: Fri, 23 Nov 2012 15:41:40 GMT
|
49
|
+
xmlns="http://taxcloud.net"><LookupResult><ResponseType>OK</ResponseType><Messages
|
50
|
+
/><CartID>12747407328244180087</CartID><CartItemsResponse><CartItemResponse><CartItemIndex>0</CartItemIndex><TaxAmount>4.75</TaxAmount></CartItemResponse><CartItemResponse><CartItemIndex>1</CartItemIndex><TaxAmount>9.5</TaxAmount></CartItemResponse></CartItemsResponse></LookupResult></LookupResponse></soap:Body></soap:Envelope>
|
51
|
+
http_version:
|
52
|
+
recorded_at: Fri, 01 Mar 2013 22:58:21 GMT
|
48
53
|
- request:
|
49
54
|
method: post
|
50
55
|
uri: https://api.taxcloud.net/1.0/TaxCloud.asmx
|
51
56
|
body:
|
52
|
-
encoding:
|
57
|
+
encoding: US-ASCII
|
53
58
|
string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
54
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:
|
55
|
-
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://taxcloud.net"><env:Body><ins0:AuthorizedWithCapture><ins0:customerID>42</ins0:customerID><ins0:cartID>
|
59
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://taxcloud.net"
|
60
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://taxcloud.net"><env:Body><ins0:AuthorizedWithCapture><ins0:customerID>42</ins0:customerID><ins0:cartID>12747407328244180087</ins0:cartID><ins0:orderID>10233029719812053746</ins0:orderID><ins0:dateAuthorized>2013-03-01</ins0:dateAuthorized><ins0:dateCaptured>2013-03-01</ins0:dateCaptured><ins0:apiLoginID>api-login-id</ins0:apiLoginID><ins0:apiKey>api-key</ins0:apiKey></ins0:AuthorizedWithCapture></env:Body></env:Envelope>
|
56
61
|
headers:
|
57
62
|
Soapaction:
|
58
63
|
- ! '"http://taxcloud.net/AuthorizedWithCapture"'
|
59
64
|
Content-Type:
|
60
65
|
- text/xml;charset=UTF-8
|
66
|
+
Content-Length:
|
67
|
+
- '704'
|
68
|
+
Accept:
|
69
|
+
- ! '*/*'
|
70
|
+
User-Agent:
|
71
|
+
- Ruby
|
61
72
|
response:
|
62
73
|
status:
|
63
74
|
code: 200
|
@@ -70,34 +81,40 @@ http_interactions:
|
|
70
81
|
Server:
|
71
82
|
- Microsoft-IIS/7.0
|
72
83
|
X-Aspnet-Version:
|
73
|
-
-
|
84
|
+
- 4.0.30319
|
74
85
|
X-Powered-By:
|
75
86
|
- TaxCloud
|
76
87
|
Date:
|
77
|
-
-
|
88
|
+
- Fri, 01 Mar 2013 22:58:21 GMT
|
78
89
|
Content-Length:
|
79
90
|
- '439'
|
80
91
|
body:
|
81
|
-
encoding:
|
92
|
+
encoding: US-ASCII
|
82
93
|
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
83
94
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><AuthorizedWithCaptureResponse
|
84
95
|
xmlns="http://taxcloud.net"><AuthorizedWithCaptureResult><ResponseType>OK</ResponseType><Messages
|
85
96
|
/></AuthorizedWithCaptureResult></AuthorizedWithCaptureResponse></soap:Body></soap:Envelope>
|
86
|
-
http_version:
|
87
|
-
recorded_at: Fri,
|
97
|
+
http_version:
|
98
|
+
recorded_at: Fri, 01 Mar 2013 22:58:21 GMT
|
88
99
|
- request:
|
89
100
|
method: post
|
90
101
|
uri: https://api.taxcloud.net/1.0/TaxCloud.asmx
|
91
102
|
body:
|
92
|
-
encoding:
|
103
|
+
encoding: US-ASCII
|
93
104
|
string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
94
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:
|
95
|
-
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://taxcloud.net"><env:Body><ins0:Returned><ins0:orderID>
|
105
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://taxcloud.net"
|
106
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://taxcloud.net"><env:Body><ins0:Returned><ins0:orderID>10233029719812053746</ins0:orderID><ins0:cartItems><ins0:CartItem><tns:Index>0</tns:Index><tns:ItemID>SKU-TEST</tns:ItemID><tns:TIC>0</tns:TIC><tns:Price>50.0</tns:Price><tns:Qty>1</tns:Qty></ins0:CartItem><ins0:CartItem><tns:Index>1</tns:Index><tns:ItemID>SKU-TEST1</tns:ItemID><tns:TIC>0</tns:TIC><tns:Price>100.0</tns:Price><tns:Qty>1</tns:Qty></ins0:CartItem></ins0:cartItems><ins0:returnedDate>2013-03-01</ins0:returnedDate><ins0:apiLoginID>api-login-id</ins0:apiLoginID><ins0:apiKey>api-key</ins0:apiKey></ins0:Returned></env:Body></env:Envelope>
|
96
107
|
headers:
|
97
108
|
Soapaction:
|
98
109
|
- ! '"http://taxcloud.net/Returned"'
|
99
110
|
Content-Type:
|
100
111
|
- text/xml;charset=UTF-8
|
112
|
+
Content-Length:
|
113
|
+
- '886'
|
114
|
+
Accept:
|
115
|
+
- ! '*/*'
|
116
|
+
User-Agent:
|
117
|
+
- Ruby
|
101
118
|
response:
|
102
119
|
status:
|
103
120
|
code: 200
|
@@ -110,19 +127,19 @@ http_interactions:
|
|
110
127
|
Server:
|
111
128
|
- Microsoft-IIS/7.0
|
112
129
|
X-Aspnet-Version:
|
113
|
-
-
|
130
|
+
- 4.0.30319
|
114
131
|
X-Powered-By:
|
115
132
|
- TaxCloud
|
116
133
|
Date:
|
117
|
-
-
|
134
|
+
- Fri, 01 Mar 2013 22:58:21 GMT
|
118
135
|
Content-Length:
|
119
136
|
- '387'
|
120
137
|
body:
|
121
|
-
encoding:
|
138
|
+
encoding: US-ASCII
|
122
139
|
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
123
140
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><ReturnedResponse
|
124
141
|
xmlns="http://taxcloud.net"><ReturnedResult><ResponseType>OK</ResponseType><Messages
|
125
142
|
/></ReturnedResult></ReturnedResponse></soap:Body></soap:Envelope>
|
126
|
-
http_version:
|
127
|
-
recorded_at: Fri,
|
128
|
-
recorded_with: VCR 2.
|
143
|
+
http_version:
|
144
|
+
recorded_at: Fri, 01 Mar 2013 22:58:21 GMT
|
145
|
+
recorded_with: VCR 2.4.0
|
data/test/test_transaction.rb
CHANGED
@@ -9,14 +9,13 @@ class TestTransaction < TestSetup
|
|
9
9
|
cart_items = []
|
10
10
|
cart_items << TaxCloud::CartItem.new(:index => 0, :item_id => 'SKU-TEST', :tic => TaxCloud::TaxCodes::GENERAL, :quantity => 1, :price => 50.00)
|
11
11
|
cart_items << TaxCloud::CartItem.new(:index => 1, :item_id => 'SKU-TEST1', :tic => TaxCloud::TaxCodes::GENERAL, :quantity => 1, :price => 100.00)
|
12
|
-
@transaction = TaxCloud::Transaction.new(:customer_id => 42, :cart_id =>
|
12
|
+
@transaction = TaxCloud::Transaction.new(:customer_id => 42, :cart_id => rand(18446744073709551616), :order_id => rand(18446744073709551616), :cart_items => cart_items, :origin => origin, :destination => destination)
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_lookup
|
16
16
|
VCR.use_cassette('lookup') do
|
17
17
|
result = @transaction.lookup
|
18
18
|
assert_instance_of TaxCloud::Responses::Lookup, result
|
19
|
-
assert_equal '708', result.cart_id
|
20
19
|
assert_equal 2, result.cart_items.count
|
21
20
|
result.cart_items.first.tap do |item|
|
22
21
|
assert_equal 0, item.cart_item_index
|
@@ -38,6 +37,20 @@ class TestTransaction < TestSetup
|
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
40
|
+
class LocalizedDate < Date
|
41
|
+
def to_s
|
42
|
+
strftime "%d/%m/%Y"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_authorized_with_localized_date
|
47
|
+
VCR.use_cassette('authorized_with_localized_time') do
|
48
|
+
@transaction.lookup
|
49
|
+
result = @transaction.authorized(:date_authorized => LocalizedDate.civil(2013, 2, 1))
|
50
|
+
assert_equal 'OK', result
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
41
54
|
def test_captured
|
42
55
|
VCR.use_cassette('captured') do
|
43
56
|
@transaction.lookup
|
data/test/test_transaction_ny.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class TestTransactionNy < TestSetup
|
4
4
|
|
5
5
|
def setup
|
6
6
|
super
|
7
7
|
origin = TaxCloud::Address.new :address1 => '888 6th Ave', :city => 'New York', :state => 'NY', :zip5 => '10001'
|
8
8
|
destination = TaxCloud::Address.new :address1 => '888 6th Ave', :city => 'New York', :state => 'NY', :zip5 => '10001'
|
9
9
|
cart_items = [ TaxCloud::CartItem.new(:index => 0, :item_id => 'SKU-TEST', :tic => TaxCloud::TaxCodes::GENERAL, :quantity => 1, :price => 50.00) ]
|
10
|
-
@transaction = TaxCloud::Transaction.new(:customer_id => 42, :cart_id => 708, :order_id =>
|
10
|
+
@transaction = TaxCloud::Transaction.new(:customer_id => 42, :cart_id => 708, :order_id => rand(18446744073709551616), :cart_items => cart_items, :origin => origin, :destination => destination)
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_lookup_non_ssuta_state
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tax_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -182,6 +182,7 @@ files:
|
|
182
182
|
- tax_cloud.gemspec
|
183
183
|
- test/cassettes/authorized.yml
|
184
184
|
- test/cassettes/authorized_with_capture.yml
|
185
|
+
- test/cassettes/authorized_with_localized_time.yml
|
185
186
|
- test/cassettes/captured.yml
|
186
187
|
- test/cassettes/get_tic_groups.yml
|
187
188
|
- test/cassettes/get_tics.yml
|
@@ -222,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
223
|
version: '0'
|
223
224
|
segments:
|
224
225
|
- 0
|
225
|
-
hash:
|
226
|
+
hash: 1029917613
|
226
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
228
|
none: false
|
228
229
|
requirements:
|