worldpay_cnp 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/ci.yml +5 -30
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +37 -32
- data/README.md +4 -1
- data/Rakefile +1 -0
- data/lib/worldpay_cnp/version.rb +1 -1
- data/lib/worldpay_cnp/xml/nokogiri.rb +4 -4
- data/lib/worldpay_cnp/xml/serializer.rb +5 -4
- data/worldpay-cnp.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a84afc796c60012b3424bdd2f6a680cc70e3a8ae22e31d3580ab066f88c3914
|
4
|
+
data.tar.gz: 2d4d124b6e8ae6208f547b1112f8f0c684bb534d3ad5b6002266777118ab4fce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65f43672007ec1fd82810f90d3ca771e670d38c42f106c5a856f9e31cb77b1435244688f4d12e7cc3b213ec1e41b200a5d4ff4844356b26d1da78bcf1984c6c6
|
7
|
+
data.tar.gz: 1a99347ada993247e14676118648801b75bc0b08278a0e1d650d4da7a246d9e7c9cf4d864c374db3697748115ec15443cbc01ee0e69795b0b0dfc99325ef1768
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
name:
|
1
|
+
name: Tests
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
@@ -11,39 +11,14 @@ jobs:
|
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
ruby: [ '2.5', '2.6', '2.7' ]
|
14
|
+
ruby: [ '2.5', '2.6', '2.7', '3.0' ]
|
15
15
|
name: Ruby ${{ matrix.ruby }}
|
16
16
|
steps:
|
17
17
|
- uses: actions/checkout@v2
|
18
|
-
|
19
|
-
- uses: actions/setup-ruby@v1
|
18
|
+
- uses: ruby/setup-ruby@v1
|
20
19
|
with:
|
21
20
|
ruby-version: ${{ matrix.ruby }}
|
22
|
-
|
23
|
-
- uses: actions/cache@v2
|
24
|
-
with:
|
25
|
-
path: vendor/bundle
|
26
|
-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
27
|
-
restore-keys: |
|
28
|
-
${{ runner.os }}-gems-
|
29
|
-
|
30
|
-
- name: Install rubygems
|
31
|
-
run: |
|
32
|
-
gem update --system --no-document
|
33
|
-
|
34
|
-
- name: Install bundler
|
35
|
-
run: |
|
36
|
-
gem install bundler --no-document
|
37
|
-
|
38
|
-
- name: Install dependencies
|
39
|
-
run: |
|
40
|
-
bundle config path vendor/bundle
|
41
|
-
bundle install --jobs 4 --retry 3
|
42
|
-
|
21
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
43
22
|
- name: Run Tests
|
44
|
-
env:
|
45
|
-
USERNAME: test
|
46
|
-
PASSWORD: test
|
47
|
-
MERCHANT_ID: test
|
48
23
|
run: |
|
49
|
-
bundle exec
|
24
|
+
bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@
|
|
4
4
|
|
5
5
|
...
|
6
6
|
|
7
|
+
## 0.1.1 (2022-01-27)
|
8
|
+
|
9
|
+
* Resolves a deprecation warning with Nokogiri 1.13.0.
|
10
|
+
> Passing a Node as the second parameter to Node.new is deprecated. Please pass a Document instead, or prefer an alternative constructor like Node#add_child. This will become an error in a future release of Nokogiri.
|
11
|
+
|
7
12
|
## 0.1.0 (2020-10-30)
|
8
13
|
|
9
14
|
* Initial release of worldpay_cnp gem
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,59 +1,64 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
worldpay_cnp (0.1.
|
5
|
-
http (>= 4, <
|
4
|
+
worldpay_cnp (0.1.1)
|
5
|
+
http (>= 4, < 6)
|
6
6
|
nokogiri (~> 1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.
|
11
|
+
addressable (2.8.0)
|
12
12
|
public_suffix (>= 2.0.2, < 5.0)
|
13
|
-
crack (0.4.
|
14
|
-
|
13
|
+
crack (0.4.5)
|
14
|
+
rexml
|
15
|
+
diff-lcs (1.5.0)
|
15
16
|
domain_name (0.5.20190701)
|
16
17
|
unf (>= 0.0.5, < 1.0.0)
|
17
18
|
dotenv (2.7.6)
|
18
|
-
ffi (1.
|
19
|
+
ffi (1.15.5)
|
19
20
|
ffi-compiler (1.0.1)
|
20
21
|
ffi (>= 1.0.0)
|
21
22
|
rake
|
22
23
|
hashdiff (1.0.1)
|
23
|
-
http (
|
24
|
-
addressable (~> 2.
|
24
|
+
http (5.0.4)
|
25
|
+
addressable (~> 2.8)
|
25
26
|
http-cookie (~> 1.0)
|
26
27
|
http-form_data (~> 2.2)
|
27
|
-
|
28
|
-
http-cookie (1.0.
|
28
|
+
llhttp-ffi (~> 0.4.0)
|
29
|
+
http-cookie (1.0.4)
|
29
30
|
domain_name (~> 0.5)
|
30
31
|
http-form_data (2.3.0)
|
31
|
-
|
32
|
-
ffi-compiler (
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
llhttp-ffi (0.4.0)
|
33
|
+
ffi-compiler (~> 1.0)
|
34
|
+
rake (~> 13.0)
|
35
|
+
mini_portile2 (2.7.1)
|
36
|
+
nokogiri (1.13.1)
|
37
|
+
mini_portile2 (~> 2.7.0)
|
38
|
+
racc (~> 1.4)
|
36
39
|
public_suffix (4.0.6)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
rspec-
|
42
|
-
|
43
|
-
rspec-
|
44
|
-
rspec-
|
40
|
+
racc (1.6.0)
|
41
|
+
rake (13.0.6)
|
42
|
+
rexml (3.2.5)
|
43
|
+
rspec (3.10.0)
|
44
|
+
rspec-core (~> 3.10.0)
|
45
|
+
rspec-expectations (~> 3.10.0)
|
46
|
+
rspec-mocks (~> 3.10.0)
|
47
|
+
rspec-core (3.10.1)
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-expectations (3.10.2)
|
45
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.
|
47
|
-
rspec-mocks (3.
|
51
|
+
rspec-support (~> 3.10.0)
|
52
|
+
rspec-mocks (3.10.2)
|
48
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
-
rspec-support (~> 3.
|
50
|
-
rspec-support (3.
|
54
|
+
rspec-support (~> 3.10.0)
|
55
|
+
rspec-support (3.10.3)
|
51
56
|
unf (0.1.4)
|
52
57
|
unf_ext
|
53
|
-
unf_ext (0.0.
|
58
|
+
unf_ext (0.0.8)
|
54
59
|
vcr (6.0.0)
|
55
|
-
webmock (3.
|
56
|
-
addressable (>= 2.
|
60
|
+
webmock (3.14.0)
|
61
|
+
addressable (>= 2.8.0)
|
57
62
|
crack (>= 0.3.2)
|
58
63
|
hashdiff (>= 0.4.0, < 2.0.0)
|
59
64
|
|
@@ -62,11 +67,11 @@ PLATFORMS
|
|
62
67
|
|
63
68
|
DEPENDENCIES
|
64
69
|
dotenv
|
65
|
-
rake (~>
|
70
|
+
rake (~> 13.0)
|
66
71
|
rspec (~> 3.0)
|
67
72
|
vcr
|
68
73
|
webmock
|
69
74
|
worldpay_cnp!
|
70
75
|
|
71
76
|
BUNDLED WITH
|
72
|
-
2.
|
77
|
+
2.2.29
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# WorldpayCnp Ruby gem
|
2
2
|
|
3
|
-
![
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/worldpay_cnp.svg)][gem]
|
4
|
+
![Test Suite](https://github.com/jackpocket/worldpay-cnp/workflows/Tests/badge.svg)
|
4
5
|
|
5
6
|
A Ruby library for the Worldpay cnpAPI with a simple interface for creating transactions as a Ruby hash to XML and back. So no real request objects. Since the cnpAPI uses camelCase, this library will handle converting to and from snake_case for you. While Worldpay has an official [CnpOnline Ruby SDK](https://github.com/Vantiv/cnp-sdk-for-ruby), they no longer support it.
|
6
7
|
|
@@ -117,3 +118,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
117
118
|
## Code of Conduct
|
118
119
|
|
119
120
|
Everyone interacting in the WorldpayCnp project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/jackpocket/worldpay_cnp/blob/master/CODE_OF_CONDUCT.md).
|
121
|
+
|
122
|
+
[gem]: https://rubygems.org/gems/worldpay_cnp
|
data/Rakefile
CHANGED
data/lib/worldpay_cnp/version.rb
CHANGED
@@ -26,16 +26,16 @@ module WorldpayCnp
|
|
26
26
|
include XML::Serializer
|
27
27
|
|
28
28
|
def call(hash)
|
29
|
-
::Nokogiri::XML::Document.new.tap { |d| add_xml_elements!(d, hash) }.to_s
|
29
|
+
::Nokogiri::XML::Document.new.tap { |d| add_xml_elements!(d, nil, hash) }.to_s
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
33
33
|
|
34
|
-
def attributes_or_elements!(parent, key, value)
|
34
|
+
def attributes_or_elements!(document, parent, key, value)
|
35
35
|
return parent[attribute_name(key)] = text_with(value) if attribute?(key)
|
36
|
-
element = ::Nokogiri::XML::Element.new(key.to_s,
|
36
|
+
element = ::Nokogiri::XML::Element.new(key.to_s, document)
|
37
37
|
parent.add_child(element)
|
38
|
-
add_xml_elements!(element, value)
|
38
|
+
add_xml_elements!(document, element, value)
|
39
39
|
end
|
40
40
|
|
41
41
|
def insert_text!(element, text)
|
@@ -7,7 +7,7 @@ module WorldpayCnp
|
|
7
7
|
|
8
8
|
private
|
9
9
|
|
10
|
-
def attributes_or_elements!(parent, key, value)
|
10
|
+
def attributes_or_elements!(document, parent, key, value)
|
11
11
|
raise NotImplementedError
|
12
12
|
end
|
13
13
|
|
@@ -15,12 +15,13 @@ module WorldpayCnp
|
|
15
15
|
raise NotImplementedError
|
16
16
|
end
|
17
17
|
|
18
|
-
def add_xml_elements!(parent, obj)
|
18
|
+
def add_xml_elements!(document, parent, obj)
|
19
|
+
parent = document if parent.nil?
|
19
20
|
case obj
|
20
21
|
when Hash
|
21
|
-
obj.each { |key, value| attributes_or_elements!(parent, key, value) }
|
22
|
+
obj.each { |key, value| attributes_or_elements!(document, parent, key, value) }
|
22
23
|
when Array
|
23
|
-
obj.each { |value| add_xml_elements!(parent, value) }
|
24
|
+
obj.each { |value| add_xml_elements!(document, parent, value) }
|
24
25
|
else
|
25
26
|
insert_text!(parent, obj)
|
26
27
|
end
|
data/worldpay-cnp.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.license = "MIT"
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
14
14
|
|
15
|
-
spec.add_dependency "http", '>= 4', '<
|
15
|
+
spec.add_dependency "http", '>= 4', '< 6'
|
16
16
|
spec.add_dependency "nokogiri", '~> 1.0'
|
17
17
|
|
18
18
|
spec.metadata["homepage_uri"] = spec.homepage
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worldpay_cnp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Julio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '4'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '4'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: nokogiri
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,7 @@ extensions: []
|
|
52
52
|
extra_rdoc_files: []
|
53
53
|
files:
|
54
54
|
- ".env.sample"
|
55
|
+
- ".github/dependabot.yml"
|
55
56
|
- ".github/workflows/ci.yml"
|
56
57
|
- ".gitignore"
|
57
58
|
- ".rspec"
|
@@ -101,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
102
|
- !ruby/object:Gem::Version
|
102
103
|
version: '0'
|
103
104
|
requirements: []
|
104
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.2.29
|
105
106
|
signing_key:
|
106
107
|
specification_version: 4
|
107
108
|
summary: A modern Ruby interface to the Worldpay cnpAPI.
|