suretax 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +35 -26
- data/.env.test +4 -0
- data/.ruby-version +1 -1
- data/Gemfile +5 -6
- data/Gemfile.lock +37 -37
- data/README.md +2 -6
- data/lib/suretax.rb +2 -0
- data/lib/suretax/api/request.rb +1 -0
- data/lib/suretax/response.rb +2 -0
- data/lib/suretax/version.rb +1 -1
- data/spec/lib/suretax/response_spec.rb +8 -0
- data/spec/spec_helper.rb +4 -4
- data/spec/support/request_helper.rb +18 -0
- metadata +4 -4
- data/NOTES.md +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 620a9d4fb40588a041c883da4f0ebeba65d78a03b1b215808c1ad92b8d5cd48d
|
4
|
+
data.tar.gz: 1070aa9064d87eddfa9e541e75cfd45413f95fb9baff06718ae4505b108a76a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38ded09d6aa2104b5aa384669a6f5a51ee18178844b0a1e08909cefc9cb8ba549d6a46ce12d167786c872990bf83158e62b33d5274fd696e8bb0f1d977f4792d
|
7
|
+
data.tar.gz: c6931fb4060cb38e409f6b9adead8a81c5b8eb30c6f1af566c678afecb70008dd1ab96b7dce02be95107b481dfc5de8c18f287955cd371cb1e106e11662804e3
|
data/.circleci/config.yml
CHANGED
@@ -1,35 +1,44 @@
|
|
1
1
|
version: 2
|
2
2
|
jobs:
|
3
3
|
build:
|
4
|
-
working_directory: ~/suretax
|
5
4
|
docker:
|
6
|
-
- image: circleci/ruby:2.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
- image: circleci/ruby:2.7.0
|
6
|
+
environment:
|
7
|
+
RAILS_ENV: test
|
8
|
+
RAKE_ENV: test
|
9
|
+
SURETAX_BASE_URL: "https://testapi.taxrating.net"
|
10
|
+
SURETAX_VALIDATION_KEY: "xxxxxxxxxx"
|
11
|
+
SURETAX_CLIENT_NUMBER: "000000000"
|
12
|
+
SURETAX_POST_PATH: "/Services/V01/SureTax.asmx/PostRequest"
|
13
|
+
SURETAX_CANCEL_PATH: "/Services/V01/SureTax.asmx/CancelPostRequest"
|
14
|
+
working_directory: ~/suretax
|
16
15
|
steps:
|
17
16
|
- checkout
|
18
|
-
|
19
17
|
- restore_cache:
|
20
18
|
keys:
|
21
|
-
|
22
|
-
|
19
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
20
|
+
# fallback to using the latest cache if no exact match is found
|
21
|
+
- v1-dependencies-
|
22
|
+
- run:
|
23
|
+
name: install dependencies
|
24
|
+
command: |
|
25
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
23
26
|
- save_cache:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
--format progress
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
paths:
|
28
|
+
- ./vendor/bundle
|
29
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
30
|
+
- run:
|
31
|
+
name: run tests
|
32
|
+
command: |
|
33
|
+
mkdir /tmp/test-results
|
34
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
35
|
+
bundle exec rspec --format progress \
|
36
|
+
--format RspecJunitFormatter \
|
37
|
+
--out /tmp/test-results/rspec.xml \
|
38
|
+
--format progress \
|
39
|
+
$TEST_FILES
|
40
|
+
- store_test_results:
|
41
|
+
path: /tmp/test-results
|
42
|
+
- store_artifacts:
|
43
|
+
path: /tmp/test-results
|
44
|
+
destination: test-results
|
data/.env.test
ADDED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.0
|
data/Gemfile
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in suretax.gemspec
|
4
3
|
gemspec
|
5
4
|
|
6
5
|
group :development, :test do
|
7
6
|
gem "dotenv"
|
8
|
-
gem "pry-byebug"
|
9
|
-
gem "rspec", "~> 3.
|
10
|
-
gem "rspec-its"
|
11
|
-
gem "rspec_junit_formatter"
|
12
|
-
gem "webmock"
|
7
|
+
gem "pry-byebug"
|
8
|
+
gem "rspec", "~> 3.9.0"
|
9
|
+
gem "rspec-its"
|
10
|
+
gem "rspec_junit_formatter"
|
11
|
+
gem "webmock"
|
13
12
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
suretax (1.1.
|
4
|
+
suretax (1.1.2)
|
5
5
|
excon
|
6
6
|
monetize
|
7
7
|
money (~> 6.13)
|
@@ -9,51 +9,51 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
addressable (2.
|
13
|
-
public_suffix (>= 2.0.2, <
|
14
|
-
byebug (
|
12
|
+
addressable (2.7.0)
|
13
|
+
public_suffix (>= 2.0.2, < 5.0)
|
14
|
+
byebug (11.1.3)
|
15
15
|
coderay (1.1.2)
|
16
|
-
concurrent-ruby (1.1.
|
16
|
+
concurrent-ruby (1.1.6)
|
17
17
|
crack (0.4.3)
|
18
18
|
safe_yaml (~> 1.0.0)
|
19
19
|
diff-lcs (1.3)
|
20
|
-
dotenv (2.7.
|
21
|
-
excon (0.
|
22
|
-
hashdiff (0.
|
23
|
-
i18n (1.
|
20
|
+
dotenv (2.7.5)
|
21
|
+
excon (0.73.0)
|
22
|
+
hashdiff (1.0.1)
|
23
|
+
i18n (1.8.2)
|
24
24
|
concurrent-ruby (~> 1.0)
|
25
|
-
method_source (0.
|
26
|
-
monetize (1.9.
|
25
|
+
method_source (1.0.0)
|
26
|
+
monetize (1.9.4)
|
27
27
|
money (~> 6.12)
|
28
|
-
money (6.13.
|
28
|
+
money (6.13.7)
|
29
29
|
i18n (>= 0.6.4, <= 2)
|
30
|
-
pry (0.
|
31
|
-
coderay (~> 1.1
|
32
|
-
method_source (~>
|
33
|
-
pry-byebug (3.
|
34
|
-
byebug (~>
|
35
|
-
pry (~> 0.
|
36
|
-
public_suffix (
|
37
|
-
rspec (3.
|
38
|
-
rspec-core (~> 3.
|
39
|
-
rspec-expectations (~> 3.
|
40
|
-
rspec-mocks (~> 3.
|
41
|
-
rspec-core (3.
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-expectations (3.
|
30
|
+
pry (0.13.1)
|
31
|
+
coderay (~> 1.1)
|
32
|
+
method_source (~> 1.0)
|
33
|
+
pry-byebug (3.9.0)
|
34
|
+
byebug (~> 11.0)
|
35
|
+
pry (~> 0.13.0)
|
36
|
+
public_suffix (4.0.5)
|
37
|
+
rspec (3.9.0)
|
38
|
+
rspec-core (~> 3.9.0)
|
39
|
+
rspec-expectations (~> 3.9.0)
|
40
|
+
rspec-mocks (~> 3.9.0)
|
41
|
+
rspec-core (3.9.2)
|
42
|
+
rspec-support (~> 3.9.3)
|
43
|
+
rspec-expectations (3.9.2)
|
44
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.
|
45
|
+
rspec-support (~> 3.9.0)
|
46
46
|
rspec-its (1.3.0)
|
47
47
|
rspec-core (>= 3.0.0)
|
48
48
|
rspec-expectations (>= 3.0.0)
|
49
|
-
rspec-mocks (3.
|
49
|
+
rspec-mocks (3.9.1)
|
50
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-support (3.
|
51
|
+
rspec-support (~> 3.9.0)
|
52
|
+
rspec-support (3.9.3)
|
53
53
|
rspec_junit_formatter (0.4.1)
|
54
54
|
rspec-core (>= 2, < 4, != 2.12.0)
|
55
55
|
safe_yaml (1.0.5)
|
56
|
-
webmock (3.
|
56
|
+
webmock (3.8.3)
|
57
57
|
addressable (>= 2.3.6)
|
58
58
|
crack (>= 0.3.2)
|
59
59
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -63,12 +63,12 @@ PLATFORMS
|
|
63
63
|
|
64
64
|
DEPENDENCIES
|
65
65
|
dotenv
|
66
|
-
pry-byebug
|
67
|
-
rspec (~> 3.
|
68
|
-
rspec-its
|
69
|
-
rspec_junit_formatter
|
66
|
+
pry-byebug
|
67
|
+
rspec (~> 3.9.0)
|
68
|
+
rspec-its
|
69
|
+
rspec_junit_formatter
|
70
70
|
suretax!
|
71
|
-
webmock
|
71
|
+
webmock
|
72
72
|
|
73
73
|
BUNDLED WITH
|
74
|
-
1.
|
74
|
+
2.1.2
|
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# Suretax
|
2
|
-
[![Code Climate](https://codeclimate.com/github/
|
3
|
-
|
2
|
+
[![Code Climate](https://codeclimate.com/github/hello-labs/suretax.png)](https://codeclimate.com/github/hello-labs/suretax)
|
4
3
|
|
5
4
|
## Synopsis
|
6
5
|
|
@@ -28,17 +27,14 @@ Suretax transactions. The validation_key, client_number, and
|
|
28
27
|
base_url may be overridden by supplying the key when instantiating
|
29
28
|
a Suretax::Api::Request object.
|
30
29
|
|
31
|
-
|
32
|
-
If not supplied, the base_url will default to the Suretax test
|
30
|
+
If not supplied, the base_url will default to the Suretax test
|
33
31
|
host (https://testapi.taxrating.net) and the request version
|
34
32
|
and cancel version will default to the latest versions available
|
35
33
|
(currently V03 and V01 respectively).
|
36
34
|
|
37
|
-
|
38
35
|
You can peek inside the tests for more examples and to see what data
|
39
36
|
methods are available.
|
40
37
|
|
41
|
-
|
42
38
|
## Development Environment
|
43
39
|
|
44
40
|
Suretax uses [dotenv] to easily switch between development/test environments
|
data/lib/suretax.rb
CHANGED
data/lib/suretax/api/request.rb
CHANGED
data/lib/suretax/response.rb
CHANGED
@@ -27,6 +27,8 @@ module Suretax
|
|
27
27
|
@status = map_response_code_to_http_status(api.status)
|
28
28
|
log_response
|
29
29
|
self
|
30
|
+
rescue JSON::ParserError => e
|
31
|
+
raise(Suretax::Api::ConnectionError, "Failed to parse response from SureTax: #{e.inspect}")
|
30
32
|
end
|
31
33
|
|
32
34
|
def invalid_request_response(sanitized_body)
|
data/lib/suretax/version.rb
CHANGED
@@ -129,4 +129,12 @@ describe Suretax::Response do
|
|
129
129
|
expect(client_response).to_not be_success
|
130
130
|
end
|
131
131
|
end
|
132
|
+
|
133
|
+
context "when posting fails with a html error" do
|
134
|
+
let(:response_body) { suretax_wrap_response("html error") }
|
135
|
+
|
136
|
+
it "should raise connection error" do
|
137
|
+
expect { client_response }.to raise_error(Suretax::Api::ConnectionError)
|
138
|
+
end
|
139
|
+
end
|
132
140
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require "dotenv"
|
2
|
-
Dotenv.load
|
1
|
+
require "dotenv"
|
2
|
+
Dotenv.load(".env.test")
|
3
3
|
|
4
4
|
require "pry"
|
5
5
|
require "rspec"
|
@@ -15,8 +15,8 @@ end
|
|
15
15
|
RSpec.configure do |config|
|
16
16
|
config.before(:each) do
|
17
17
|
Suretax.configure do |c|
|
18
|
-
c.validation_key
|
19
|
-
c.client_number
|
18
|
+
c.validation_key = ENV["SURETAX_VALIDATION_KEY"]
|
19
|
+
c.client_number = ENV["SURETAX_CLIENT_NUMBER"]
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -351,4 +351,22 @@ module RequestSpecHelper
|
|
351
351
|
common_carrier: nil
|
352
352
|
}
|
353
353
|
end
|
354
|
+
|
355
|
+
def suretax_html_error
|
356
|
+
"<html xmlns='http://www.w3.org/1999/xhtml'>
|
357
|
+
<head>
|
358
|
+
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
|
359
|
+
<title>502 - Web server received an invalid response while acting as a gateway or proxy server.</title>
|
360
|
+
</head>
|
361
|
+
<body>
|
362
|
+
<div id='header'><h1>Server Error</h1></div>
|
363
|
+
<div id='content'>
|
364
|
+
<div class='content-container'><fieldset>
|
365
|
+
<h2>502 - Web server received an invalid response while acting as a gateway or proxy server.</h2>
|
366
|
+
<h3>There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.</h3>
|
367
|
+
</fieldset></div>
|
368
|
+
</div>
|
369
|
+
</body>
|
370
|
+
</html>"
|
371
|
+
end
|
354
372
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suretax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damon Davison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- ".circleci/config.yml"
|
63
63
|
- ".env.example"
|
64
|
+
- ".env.test"
|
64
65
|
- ".gitignore"
|
65
66
|
- ".rspec"
|
66
67
|
- ".rubocop.yml"
|
@@ -68,7 +69,6 @@ files:
|
|
68
69
|
- Gemfile
|
69
70
|
- Gemfile.lock
|
70
71
|
- LICENSE.txt
|
71
|
-
- NOTES.md
|
72
72
|
- README.md
|
73
73
|
- Rakefile
|
74
74
|
- lib/suretax.rb
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.1.2
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: This gem will allow Ruby developers to easily integrate SureTax into their
|
data/NOTES.md
DELETED