heartland_portico 3.2.6 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: fb5def7be902a6e158c9a8373c79233e2813ec131484838bef3e1af595fec333
4
- data.tar.gz: 6d8270546b0c1c42028f4958f81b79eaad10956b87aa17067004815f1c0224d0
2
+ SHA1:
3
+ metadata.gz: d3dc295d130f071c84e2b5999c10f3ad2c57d2ca
4
+ data.tar.gz: f41b6ac067dd5b666fd791f89b702ac96da65bcb
5
5
  SHA512:
6
- metadata.gz: d8c40b034a42f91ab4e1495620e539f256f95be076e440eede90ec34fcd4a17c0e1df31f7e9af6ed397673bc8a46ac4f01f35d0974151c7ed755916463cbe53e
7
- data.tar.gz: e8329c2cf440b11ba046a93a2d587e15f9d68dee4591b3828835ef74eb98603ae3dfd97fb21fdc41633365353e9d0a128d3cab1fc29e22cf0b7b7da535ee90e5
6
+ metadata.gz: e2a2a7b4b828de92e7ce4d2acb488eee9513bb149e6fc3384eb4e64dc3141bd41fd20238b0739b688cfc48f611693f698647e2efd81e664fd6ab880f4752602c
7
+ data.tar.gz: aba15475f5306756223d16169a0ef82a66ba55aa7a993dd333ccf6beb3d56d29cb01983fa88d0d90b752b8a16aec3317e30bad76252e1c0c3fe1721d92bdf66d
@@ -0,0 +1,45 @@
1
+ name: Tests
2
+
3
+ # Controls when the action will run.
4
+ # - push on master
5
+ # - pull_request on any branch
6
+ on:
7
+ push:
8
+ branches: [master]
9
+ pull_request:
10
+
11
+ jobs:
12
+ tests:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+
18
+ - uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.4.10
21
+
22
+ - uses: actions/cache@v2
23
+ id: cache
24
+ with:
25
+ path: |
26
+ vendor/bundle
27
+ key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
28
+
29
+ - name: Bundle install
30
+ run: |
31
+ gem install bundler
32
+ bundle config path vendor/bundle
33
+ bundle install --jobs 4 --retry 3
34
+
35
+ - name: Bundle Audit
36
+ run: |
37
+ bundle exec bundle-audit check --update --ignore CVE-2018-3760 CVE-2018-16471
38
+
39
+ - name: Rspec
40
+ run: |
41
+ bundle exec rspec spec
42
+
43
+ - name: Test/Unit
44
+ run: |
45
+ bundle exec rake test:units
@@ -1 +1 @@
1
- 2.3.3
1
+ 2.4.10
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source "https://rubygems.org"
2
- ruby '~> 2.3.3'
2
+ ruby '2.4.10'
3
3
 
4
4
  # Add dependencies required to use your gem here.
5
5
  gem 'savon', "~> 2.0"
@@ -20,7 +20,7 @@ group :development do
20
20
  gem "minitest"
21
21
  gem "rdoc"
22
22
  gem "bundler"
23
- gem "jeweler"
23
+ gem "jeweler", "~> 2.3.0"
24
24
  gem "simplecov"
25
25
 
26
26
  # ActiveMerchant test dependencies
@@ -1,53 +1,53 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- actionpack (3.2.22.5)
5
- activemodel (= 3.2.22.5)
6
- activesupport (= 3.2.22.5)
7
- builder (~> 3.0.0)
8
- erubis (~> 2.7.0)
9
- journey (~> 1.0.4)
10
- rack (~> 1.4.5)
11
- rack-cache (~> 1.2)
12
- rack-test (~> 0.6.1)
13
- sprockets (~> 2.2.1)
14
- active_utils (2.0.1)
15
- activesupport (>= 2.3.11)
16
- i18n
17
- activemerchant (1.42.4)
18
- active_utils (~> 2.0, >= 2.0.1)
19
- activesupport (>= 2.3.14, < 5.0.0)
4
+ actionpack (5.2.4.4)
5
+ actionview (= 5.2.4.4)
6
+ activesupport (= 5.2.4.4)
7
+ rack (~> 2.0, >= 2.0.8)
8
+ rack-test (>= 0.6.3)
9
+ rails-dom-testing (~> 2.0)
10
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
11
+ actionview (5.2.4.4)
12
+ activesupport (= 5.2.4.4)
13
+ builder (~> 3.1)
14
+ erubi (~> 1.4)
15
+ rails-dom-testing (~> 2.0)
16
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
17
+ activemerchant (1.107.4)
18
+ activesupport (>= 4.2)
20
19
  builder (>= 2.1.2, < 4.0.0)
21
- i18n (~> 0.5)
22
- json (~> 1.7)
23
- money (< 7.0.0)
20
+ i18n (>= 0.6.9)
24
21
  nokogiri (~> 1.4)
25
- activemodel (3.2.22.5)
26
- activesupport (= 3.2.22.5)
27
- builder (~> 3.0.0)
28
- activesupport (3.2.22.5)
29
- i18n (~> 0.6, >= 0.6.4)
30
- multi_json (~> 1.0)
22
+ activesupport (5.2.4.4)
23
+ concurrent-ruby (~> 1.0, >= 1.0.2)
24
+ i18n (>= 0.7, < 2)
25
+ minitest (~> 5.1)
26
+ tzinfo (~> 1.1)
31
27
  addressable (2.4.0)
32
- akami (1.2.2)
28
+ akami (1.3.1)
33
29
  gyoku (>= 0.4.0)
34
30
  nokogiri
35
- builder (3.0.4)
36
- bundler-audit (0.5.0)
37
- bundler (~> 1.2)
38
- thor (~> 0.18)
31
+ builder (3.2.4)
32
+ bundler-audit (0.7.0.1)
33
+ bundler (>= 1.2.0, < 3)
34
+ thor (>= 0.18, < 2)
35
+ concurrent-ruby (1.1.7)
36
+ connection_pool (2.2.3)
37
+ crass (1.0.6)
39
38
  daemons (1.0.10)
40
39
  descendants_tracker (0.0.4)
41
40
  thread_safe (~> 0.3, >= 0.3.1)
42
- diff-lcs (1.2.5)
43
- docile (1.1.5)
44
- domain_name (0.5.15)
41
+ diff-lcs (1.4.4)
42
+ docile (1.3.2)
43
+ domain_name (0.5.20190701)
45
44
  unf (>= 0.0.5, < 1.0.0)
46
- erubis (2.7.0)
45
+ erubi (1.9.0)
47
46
  faraday (0.9.2)
48
47
  multipart-post (>= 1.2, < 3)
49
48
  gem_plugin (0.2.3)
50
- git (1.3.0)
49
+ git (1.7.0)
50
+ rchardet (~> 1.8)
51
51
  github_api (0.16.0)
52
52
  addressable (~> 2.4.0)
53
53
  descendants_tracker (~> 0.0.4)
@@ -55,122 +55,123 @@ GEM
55
55
  hashie (>= 3.4)
56
56
  mime-types (>= 1.16, < 3.0)
57
57
  oauth2 (~> 1.0)
58
- gyoku (1.1.1)
58
+ gyoku (1.3.1)
59
59
  builder (>= 2.1.2)
60
- hashie (3.5.6)
61
- highline (1.7.8)
62
- hike (1.2.3)
63
- http-cookie (1.0.2)
60
+ hashie (4.1.0)
61
+ highline (2.0.3)
62
+ http-cookie (1.0.3)
64
63
  domain_name (~> 0.5)
65
- httpi (2.2.7)
64
+ httpi (2.4.5)
66
65
  rack
67
- i18n (0.7.0.beta1)
68
- jeweler (2.3.7)
66
+ socksify
67
+ i18n (1.8.5)
68
+ concurrent-ruby (~> 1.0)
69
+ jeweler (2.3.9)
69
70
  builder
70
- bundler (>= 1)
71
+ bundler
71
72
  git (>= 1.2.5)
72
73
  github_api (~> 0.16.0)
73
74
  highline (>= 1.6.15)
74
75
  nokogiri (>= 1.5.10)
75
- psych (~> 2.2)
76
+ psych
76
77
  rake
77
78
  rdoc
78
79
  semver2
79
- journey (1.0.4)
80
- json (1.8.6)
81
- jwt (1.5.6)
82
- launchy (2.4.2)
80
+ jwt (2.2.2)
81
+ launchy (2.4.3)
83
82
  addressable (~> 2.3)
84
- macaddr (1.7.1)
85
- systemu (~> 2.6.2)
86
- mechanize (2.7.2)
83
+ loofah (2.7.0)
84
+ crass (~> 1.0.2)
85
+ nokogiri (>= 1.5.9)
86
+ mechanize (2.7.6)
87
87
  domain_name (~> 0.5, >= 0.5.1)
88
- http-cookie (~> 1.0.0)
89
- mime-types (~> 1.17, >= 1.17.2)
88
+ http-cookie (~> 1.0)
89
+ mime-types (>= 1.17.2)
90
90
  net-http-digest_auth (~> 1.1, >= 1.1.1)
91
- net-http-persistent (~> 2.5, >= 2.5.2)
92
- nokogiri (~> 1.4)
91
+ net-http-persistent (>= 2.5.2)
92
+ nokogiri (~> 1.6)
93
93
  ntlm-http (~> 0.1, >= 0.1.1)
94
94
  webrobots (>= 0.0.9, < 0.2)
95
- metaclass (0.0.2)
96
- mime-types (1.25.1)
97
- mini_portile2 (2.3.0)
98
- minitest (5.10.3)
99
- mocha (1.0.0)
100
- metaclass (~> 0.0.1)
101
- money (6.4.0)
102
- i18n (>= 0.6.4, <= 0.7.0.beta1)
95
+ mime-types (2.99.3)
96
+ mini_portile2 (2.4.0)
97
+ minitest (5.14.2)
98
+ mocha (1.11.2)
99
+ money (6.13.8)
100
+ i18n (>= 0.6.4, <= 2)
103
101
  mongrel (1.2.0.pre2)
104
102
  daemons (~> 1.0.10)
105
103
  gem_plugin (~> 0.2.3)
106
- multi_json (1.12.1)
104
+ multi_json (1.15.0)
107
105
  multi_xml (0.6.0)
108
- multipart-post (2.0.0)
109
- net-http-digest_auth (1.4)
110
- net-http-persistent (2.9)
111
- nokogiri (1.8.2)
112
- mini_portile2 (~> 2.3.0)
113
- nori (2.4.0)
106
+ multipart-post (2.1.1)
107
+ net-http-digest_auth (1.4.1)
108
+ net-http-persistent (4.0.0)
109
+ connection_pool (~> 2.2)
110
+ nokogiri (1.10.10)
111
+ mini_portile2 (~> 2.4.0)
112
+ nori (2.6.0)
114
113
  ntlm-http (0.1.1)
115
- oauth2 (1.4.0)
116
- faraday (>= 0.8, < 0.13)
117
- jwt (~> 1.0)
114
+ oauth2 (1.4.4)
115
+ faraday (>= 0.8, < 2.0)
116
+ jwt (>= 1.0, < 3.0)
118
117
  multi_json (~> 1.3)
119
118
  multi_xml (~> 0.5)
120
119
  rack (>= 1.2, < 3)
121
- power_assert (1.0.2)
122
- psych (2.2.4)
123
- rack (1.4.7)
124
- rack-cache (1.7.0)
125
- rack (>= 0.4)
126
- rack-test (0.6.3)
127
- rack (>= 1.0)
128
- rake (10.1.1)
129
- rdoc (5.1.0)
130
- rspec (2.14.1)
131
- rspec-core (~> 2.14.0)
132
- rspec-expectations (~> 2.14.0)
133
- rspec-mocks (~> 2.14.0)
134
- rspec-core (2.14.7)
135
- rspec-expectations (2.14.4)
136
- diff-lcs (>= 1.1.3, < 2.0)
137
- rspec-mocks (2.14.4)
138
- rubyntlm (0.4.0)
139
- savon (2.7.2)
140
- akami (~> 1.2.0)
120
+ power_assert (1.2.0)
121
+ psych (3.2.0)
122
+ rack (2.2.3)
123
+ rack-test (1.1.0)
124
+ rack (>= 1.0, < 3)
125
+ rails-dom-testing (2.0.3)
126
+ activesupport (>= 4.2.0)
127
+ nokogiri (>= 1.6)
128
+ rails-html-sanitizer (1.3.0)
129
+ loofah (~> 2.3)
130
+ rake (13.0.1)
131
+ rchardet (1.8.0)
132
+ rdoc (6.2.1)
133
+ rspec (3.10.0)
134
+ rspec-core (~> 3.10.0)
135
+ rspec-expectations (~> 3.10.0)
136
+ rspec-mocks (~> 3.10.0)
137
+ rspec-core (3.10.0)
138
+ rspec-support (~> 3.10.0)
139
+ rspec-expectations (3.10.0)
140
+ diff-lcs (>= 1.2.0, < 2.0)
141
+ rspec-support (~> 3.10.0)
142
+ rspec-mocks (3.10.0)
143
+ diff-lcs (>= 1.2.0, < 2.0)
144
+ rspec-support (~> 3.10.0)
145
+ rspec-support (3.10.0)
146
+ rubyntlm (0.6.2)
147
+ savon (2.12.1)
148
+ akami (~> 1.2)
141
149
  builder (>= 2.1.2)
142
- gyoku (~> 1.1.0)
143
- httpi (~> 2.2.3)
144
- nokogiri (>= 1.4.0)
145
- nori (~> 2.4.0)
146
- uuid (~> 2.3.7)
147
- wasabi (~> 3.3.0)
150
+ gyoku (~> 1.2)
151
+ httpi (~> 2.3)
152
+ nokogiri (>= 1.8.1)
153
+ nori (~> 2.4)
154
+ wasabi (~> 3.4)
148
155
  semver2 (3.4.2)
149
- simplecov (0.9.1)
150
- docile (~> 1.1.0)
151
- multi_json (~> 1.0)
152
- simplecov-html (~> 0.8.0)
153
- simplecov-html (0.8.0)
154
- sprockets (2.2.3)
155
- hike (~> 1.2)
156
- multi_json (~> 1.0)
157
- rack (~> 1.0)
158
- tilt (~> 1.1, != 1.3.0)
159
- systemu (2.6.4)
160
- test-unit (3.2.5)
156
+ simplecov (0.18.5)
157
+ docile (~> 1.1)
158
+ simplecov-html (~> 0.11)
159
+ simplecov-html (0.12.3)
160
+ socksify (1.7.1)
161
+ test-unit (3.3.6)
161
162
  power_assert
162
- thor (0.19.4)
163
+ thor (1.0.1)
163
164
  thread_safe (0.3.6)
164
- tilt (1.4.1)
165
- unf (0.1.3)
165
+ tzinfo (1.2.8)
166
+ thread_safe (~> 0.1)
167
+ unf (0.1.4)
166
168
  unf_ext
167
- unf_ext (0.0.6)
168
- uuid (2.3.7)
169
- macaddr (~> 1.0)
170
- wasabi (3.3.1)
169
+ unf_ext (0.0.7.7)
170
+ wasabi (3.6.1)
171
+ addressable
171
172
  httpi (~> 2.0)
172
- nokogiri (>= 1.4.0)
173
- webrobots (0.1.1)
173
+ nokogiri (>= 1.4.2)
174
+ webrobots (0.1.2)
174
175
 
175
176
  PLATFORMS
176
177
  ruby
@@ -182,7 +183,7 @@ DEPENDENCIES
182
183
  builder
183
184
  bundler
184
185
  bundler-audit
185
- jeweler
186
+ jeweler (~> 2.3.0)
186
187
  launchy
187
188
  mechanize
188
189
  minitest
@@ -198,7 +199,7 @@ DEPENDENCIES
198
199
  test-unit
199
200
 
200
201
  RUBY VERSION
201
- ruby 2.3.3p222
202
+ ruby 2.4.10p364
202
203
 
203
204
  BUNDLED WITH
204
- 1.16.0
205
+ 1.17.3
@@ -0,0 +1,35 @@
1
+ pipeline {
2
+ agent any
3
+ stages {
4
+ stage('bundle') {
5
+ steps {
6
+ sh 'bundle install'
7
+ }
8
+ }
9
+ stage('veracode') {
10
+ when {
11
+ branch 'master'
12
+ }
13
+ steps {
14
+ withCredentials([string(credentialsId: 'SRCCLR_API_TOKEN', variable: 'SRCCLR_API_TOKEN')]) {
15
+ sh '''
16
+ set +x
17
+ echo "$SRCCLR_API_TOKEN"
18
+ curl -HsSL "Token: $SRCCLR_API_TOKEN" https://download.sourceclear.com/ci.sh | sh
19
+ '''
20
+ }
21
+ }
22
+ }
23
+ stage('sanity') {
24
+ steps {
25
+ sh 'bundle exec bundle-audit check --update --ignore CVE-2018-3760 CVE-2018-16471'
26
+ }
27
+ }
28
+ stage('tests') {
29
+ steps {
30
+ sh 'RACK_ENV=test bundle exec rspec spec --format progress'
31
+ sh 'RACK_ENV=test bundle exec rake test:units'
32
+ }
33
+ }
34
+ }
35
+ }
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.6
1
+ 4.0.0
@@ -1,20 +1,10 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift File.expand_path('../../lib', __FILE__)
3
-
4
- require 'pp'
5
- require 'minitest'
6
-
7
- begin
8
- require 'rubygems'
9
- require 'bundler'
10
- Bundler.setup
11
- rescue LoadError => e
12
- puts "Error loading bundler (#{e.message}): \"gem install bundler\" for bundler support."
13
- end
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'bundler/setup'
14
4
 
15
5
  require 'test/unit'
16
- require 'money'
17
- require 'mocha/setup'
6
+ require 'mocha/test_unit'
7
+
18
8
  require 'yaml'
19
9
  require 'json'
20
10
  require 'active_merchant'
@@ -22,28 +12,7 @@ require 'comm_stub'
22
12
 
23
13
  require 'active_support/core_ext/integer/time'
24
14
  require 'active_support/core_ext/numeric/time'
25
- require 'active_support/core_ext/hash/slice'
26
-
27
- begin
28
- require 'active_support/core_ext/time/acts_like'
29
- rescue LoadError
30
- end
31
-
32
- begin
33
- gem 'actionpack'
34
- rescue LoadError
35
- raise StandardError, "The view tests need ActionPack installed as gem to run"
36
- end
37
-
38
- #require 'action_controller'
39
- #require "action_view/template"
40
- begin
41
- require 'active_support/core_ext/module/deprecation'
42
- require 'action_dispatch/testing/test_process'
43
- rescue LoadError
44
- # require 'action_controller/test_process'
45
- end
46
- #require 'active_merchant/billing/integrations/action_view_helper'
15
+ require 'active_support/core_ext/time/acts_like'
47
16
 
48
17
  ActiveMerchant::Billing::Base.mode = :test
49
18
 
@@ -60,10 +29,9 @@ end
60
29
  class SubclassGateway < SimpleTestGateway
61
30
  end
62
31
 
63
-
64
32
  module ActiveMerchant
65
33
  module Assertions
66
- AssertionClass = RUBY_VERSION > '1.9' ? MiniTest::Assertion : Test::Unit::AssertionFailedError
34
+ ASSERTION_CLASS = defined?(Minitest) ? MiniTest::Assertion : Test::Unit::AssertionFailedError
67
35
 
68
36
  def assert_field(field, value)
69
37
  clean_backtrace do
@@ -71,7 +39,7 @@ module ActiveMerchant
71
39
  end
72
40
  end
73
41
 
74
- # Allows the testing of you to check for negative assertions:
42
+ # Allows testing of negative assertions:
75
43
  #
76
44
  # # Instead of
77
45
  # assert !something_that_is_false
@@ -90,108 +58,216 @@ module ActiveMerchant
90
58
  end
91
59
  end
92
60
 
93
- # A handy little assertion to check for a successful response:
61
+ # An assertion of a successful response:
94
62
  #
95
63
  # # Instead of
96
- # assert_success response
64
+ # assert response.success?
97
65
  #
98
66
  # # DRY that up with
99
67
  # assert_success response
100
68
  #
101
69
  # A message will automatically show the inspection of the response
102
70
  # object if things go afoul.
103
- def assert_success(response)
71
+ def assert_success(response, message = nil)
104
72
  clean_backtrace do
105
- assert response.success?, "Response failed: #{response.inspect}"
73
+ assert response.success?, build_message(nil, "#{message + "\n" if message}Response expected to succeed: <?>", response)
106
74
  end
107
75
  end
108
76
 
109
77
  # The negative of +assert_success+
110
- def assert_failure(response)
78
+ def assert_failure(response, message = nil)
111
79
  clean_backtrace do
112
- assert_false response.success?, "Response expected to fail: #{response.inspect}"
80
+ assert !response.success?, build_message(nil, "#{message + "\n" if message}Response expected to fail: <?>", response)
113
81
  end
114
82
  end
115
83
 
116
- def assert_valid(validateable)
84
+ def assert_valid(model, message = nil)
85
+ errors = model.validate
86
+
117
87
  clean_backtrace do
118
- assert validateable.valid?, "Expected to be valid"
88
+ assert_equal({}, errors, (message || 'Expected to be valid'))
119
89
  end
90
+
91
+ errors
120
92
  end
121
93
 
122
- def assert_not_valid(validateable)
94
+ def assert_not_valid(model)
95
+ errors = model.validate
96
+
123
97
  clean_backtrace do
124
- assert_false validateable.valid?, "Expected to not be valid"
98
+ assert_not_equal({}, errors, 'Expected to not be valid')
125
99
  end
100
+
101
+ errors
102
+ end
103
+
104
+ def assert_deprecation_warning(message = nil)
105
+ ActiveMerchant.expects(:deprecated).with(message || anything)
106
+ yield
126
107
  end
127
108
 
128
- def assert_deprecation_warning(message, target)
129
- target.expects(:deprecated).with(message)
109
+ def refute(value, message = nil)
110
+ assert(!value, message)
111
+ end
112
+
113
+ def silence_deprecation_warnings
114
+ ActiveMerchant.stubs(:deprecated)
130
115
  yield
131
116
  end
132
117
 
133
- def assert_no_deprecation_warning(target)
134
- target.expects(:deprecated).never
118
+ def assert_no_deprecation_warning
119
+ ActiveMerchant.expects(:deprecated).never
135
120
  yield
136
121
  end
137
122
 
123
+ def assert_scrubbed(unexpected_value, transcript)
124
+ regexp = (Regexp === unexpected_value ? unexpected_value : Regexp.new(Regexp.quote(unexpected_value.to_s)))
125
+ refute_match regexp, transcript, 'Expected the value to be scrubbed out of the transcript'
126
+ end
127
+
138
128
  private
129
+
139
130
  def clean_backtrace(&block)
140
131
  yield
141
- rescue AssertionClass => e
132
+ rescue ASSERTION_CLASS => e
142
133
  path = File.expand_path(__FILE__)
143
- raise AssertionClass, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ }
134
+ raise ASSERTION_CLASS, e.message, (e.backtrace.reject { |line| File.expand_path(line).match?(/#{path}/) })
144
135
  end
145
136
  end
146
137
 
147
138
  module Fixtures
148
- HOME_DIR = RUBY_PLATFORM =~ /mswin32/ ? ENV['HOMEPATH'] : ENV['HOME'] unless defined?(HOME_DIR)
139
+ HOME_DIR = RUBY_PLATFORM.match?('mswin32') ? ENV['HOMEPATH'] : ENV['HOME'] unless defined?(HOME_DIR)
149
140
  LOCAL_CREDENTIALS = File.join(HOME_DIR.to_s, '.active_merchant/fixtures.yml') unless defined?(LOCAL_CREDENTIALS)
150
141
  DEFAULT_CREDENTIALS = File.join(File.dirname(__FILE__), 'fixtures.yml') unless defined?(DEFAULT_CREDENTIALS)
151
142
 
152
143
  private
144
+
145
+ def default_expiration_date
146
+ @default_expiration_date ||= Date.new((Time.now.year + 1), 9, 30)
147
+ end
148
+
149
+ def formatted_expiration_date(credit_card)
150
+ credit_card.expiry_date.expiration.strftime('%Y-%m')
151
+ end
152
+
153
153
  def credit_card(number = '4242424242424242', options = {})
154
154
  defaults = {
155
- :number => number,
156
- :month => 9,
157
- :year => Time.now.year + 1,
158
- :first_name => 'Longbob',
159
- :last_name => 'Longsen',
160
- :verification_value => '123',
161
- :brand => 'visa'
155
+ number: number,
156
+ month: default_expiration_date.month,
157
+ year: default_expiration_date.year,
158
+ first_name: 'Longbob',
159
+ last_name: 'Longsen',
160
+ verification_value: options[:verification_value] || '123',
161
+ brand: 'visa'
162
162
  }.update(options)
163
163
 
164
164
  Billing::CreditCard.new(defaults)
165
165
  end
166
166
 
167
+ def credit_card_with_track_data(number = '4242424242424242', options = {})
168
+ exp_date = default_expiration_date.strftime('%y%m')
169
+
170
+ defaults = {
171
+ track_data: "%B#{number}^LONGSEN/L. ^#{exp_date}1200000000000000**123******?"
172
+ }.update(options)
173
+
174
+ Billing::CreditCard.new(defaults)
175
+ end
176
+
177
+ def network_tokenization_credit_card(number = '4242424242424242', options = {})
178
+ defaults = {
179
+ number: number,
180
+ month: default_expiration_date.month,
181
+ year: default_expiration_date.year,
182
+ first_name: 'Longbob',
183
+ last_name: 'Longsen',
184
+ verification_value: '123',
185
+ brand: 'visa'
186
+ }.update(options)
187
+
188
+ Billing::NetworkTokenizationCreditCard.new(defaults)
189
+ end
190
+
167
191
  def check(options = {})
168
192
  defaults = {
169
- :name => 'Jim Smith',
170
- :routing_number => '244183602',
171
- :account_number => '15378535',
172
- :account_holder_type => 'personal',
173
- :account_type => 'checking',
174
- :number => '1'
193
+ name: 'Jim Smith',
194
+ bank_name: 'Bank of Elbonia',
195
+ routing_number: '244183602',
196
+ account_number: '15378535',
197
+ account_holder_type: 'personal',
198
+ account_type: 'checking',
199
+ number: '1'
175
200
  }.update(options)
176
201
 
177
202
  Billing::Check.new(defaults)
178
203
  end
179
204
 
205
+ def apple_pay_payment_token(options = {})
206
+ # apple_pay_json_raw should contain the JSON serialization of the object described here
207
+ # https://developer.apple.com/library/IOs//documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.htm
208
+ apple_pay_json_raw = '{"version":"EC_v1","data":"","signature":""}'
209
+ defaults = {
210
+ payment_data: ActiveSupport::JSON.decode(apple_pay_json_raw),
211
+ payment_instrument_name: 'Visa 2424',
212
+ payment_network: 'Visa',
213
+ transaction_identifier: 'uniqueidentifier123'
214
+ }.update(options)
215
+
216
+ ActiveMerchant::Billing::ApplePayPaymentToken.new(defaults[:payment_data],
217
+ payment_instrument_name: defaults[:payment_instrument_name],
218
+ payment_network: defaults[:payment_network],
219
+ transaction_identifier: defaults[:transaction_identifier])
220
+ end
221
+
180
222
  def address(options = {})
181
223
  {
182
- :name => 'Jim Smith',
183
- :address1 => '1234 My Street',
184
- :address2 => 'Apt 1',
185
- :company => 'Widgets Inc',
186
- :city => 'Ottawa',
187
- :state => 'ON',
188
- :zip => 'K1C2N6',
189
- :country => 'CA',
190
- :phone => '(555)555-5555',
191
- :fax => '(555)555-6666'
224
+ name: 'Jim Smith',
225
+ address1: '456 My Street',
226
+ address2: 'Apt 1',
227
+ company: 'Widgets Inc',
228
+ city: 'Ottawa',
229
+ state: 'ON',
230
+ zip: 'K1C2N6',
231
+ country: 'CA',
232
+ phone: '(555)555-5555',
233
+ fax: '(555)555-6666'
192
234
  }.update(options)
193
235
  end
194
236
 
237
+ def statement_address(options = {})
238
+ {
239
+ address1: '456 My Street',
240
+ address2: 'Apt 1',
241
+ city: 'Ottawa',
242
+ state: 'ON',
243
+ zip: 'K1C2N6'
244
+ }.update(options)
245
+ end
246
+
247
+ def stored_credential(*args, **options)
248
+ id = options.delete(:id) || options.delete(:network_transaction_id)
249
+
250
+ stored_credential = {
251
+ network_transaction_id: id,
252
+ initial_transaction: false
253
+ }
254
+
255
+ stored_credential[:initial_transaction] = true if args.include?(:initial)
256
+
257
+ stored_credential[:reason_type] = 'recurring' if args.include?(:recurring)
258
+ stored_credential[:reason_type] = 'unscheduled' if args.include?(:unscheduled)
259
+ stored_credential[:reason_type] = 'installment' if args.include?(:installment)
260
+
261
+ stored_credential[:initiator] = 'cardholder' if args.include?(:cardholder)
262
+ stored_credential[:initiator] = 'merchant' if args.include?(:merchant)
263
+
264
+ stored_credential
265
+ end
266
+
267
+ def generate_unique_id
268
+ SecureRandom.hex(16)
269
+ end
270
+
195
271
  def all_fixtures
196
272
  @@fixtures ||= load_fixtures
197
273
  end
@@ -204,8 +280,8 @@ module ActiveMerchant
204
280
 
205
281
  def load_fixtures
206
282
  [DEFAULT_CREDENTIALS, LOCAL_CREDENTIALS].inject({}) do |credentials, file_name|
207
- if File.exists?(file_name)
208
- yaml_data = YAML.load(File.read(file_name))
283
+ if File.exist?(file_name)
284
+ yaml_data = YAML.safe_load(File.read(file_name), [], [], true)
209
285
  credentials.merge!(symbolize_keys(yaml_data))
210
286
  end
211
287
  credentials
@@ -216,7 +292,7 @@ module ActiveMerchant
216
292
  return unless hash.is_a?(Hash)
217
293
 
218
294
  hash.symbolize_keys!
219
- hash.each{|k,v| symbolize_keys(v)}
295
+ hash.each { |_k, v| symbolize_keys(v) }
220
296
  end
221
297
  end
222
298
  end
@@ -224,36 +300,44 @@ end
224
300
  Test::Unit::TestCase.class_eval do
225
301
  include ActiveMerchant::Billing
226
302
  include ActiveMerchant::Assertions
227
- include ActiveMerchant::Utils
228
303
  include ActiveMerchant::Fixtures
229
- end
230
304
 
231
- module ActionViewHelperTestHelper
232
-
233
- def self.included(base)
234
- base.send(:include, ActiveMerchant::Billing::Integrations::ActionViewHelper)
235
- base.send(:include, ActionView::Helpers::FormHelper)
236
- base.send(:include, ActionView::Helpers::FormTagHelper)
237
- base.send(:include, ActionView::Helpers::UrlHelper)
238
- base.send(:include, ActionView::Helpers::TagHelper)
239
- base.send(:include, ActionView::Helpers::CaptureHelper)
240
- base.send(:include, ActionView::Helpers::TextHelper)
241
- base.send(:attr_accessor, :output_buffer)
305
+ def capture_transcript(gateway)
306
+ transcript = ''
307
+ gateway.class.wiredump_device = transcript
308
+
309
+ yield
310
+
311
+ transcript
242
312
  end
243
313
 
244
- def setup
245
- @controller = Class.new do
246
- attr_reader :url_for_options
247
- def url_for(options, *parameters_for_method_reference)
248
- @url_for_options = options
249
- end
314
+ def dump_transcript_and_fail(gateway, amount, credit_card, params)
315
+ transcript = capture_transcript(gateway) do
316
+ gateway.purchase(amount, credit_card, params)
250
317
  end
251
- @controller = @controller.new
252
- @output_buffer = ''
253
- end
254
318
 
255
- protected
256
- def protect_against_forgery?
257
- false
319
+ File.open('transcript.log', 'w') { |f| f.write(transcript) }
320
+ assert false, 'A purchase transcript has been written to transcript.log for you to test scrubbing with.'
258
321
  end
259
322
  end
323
+
324
+ class MockResponse
325
+ attr_reader :code, :body, :message
326
+ attr_accessor :headers
327
+
328
+ def self.succeeded(body, message = '')
329
+ MockResponse.new(200, body, message)
330
+ end
331
+
332
+ def self.failed(body, http_status_code = 422, message = '')
333
+ MockResponse.new(http_status_code, body, message)
334
+ end
335
+
336
+ def initialize(code, body, message = '', headers = {})
337
+ @code, @body, @message, @headers = code, body, message, headers
338
+ end
339
+
340
+ def [](header)
341
+ @headers[header]
342
+ end
343
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heartland_portico
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.6
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - VersaPay Corp
8
8
  - Jamie Macey
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-12 00:00:00.000000000 Z
12
+ date: 2020-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -197,16 +197,16 @@ dependencies:
197
197
  name: jeweler
198
198
  requirement: !ruby/object:Gem::Requirement
199
199
  requirements:
200
- - - ">="
200
+ - - "~>"
201
201
  - !ruby/object:Gem::Version
202
- version: '0'
202
+ version: 2.3.0
203
203
  type: :development
204
204
  prerelease: false
205
205
  version_requirements: !ruby/object:Gem::Requirement
206
206
  requirements:
207
- - - ">="
207
+ - - "~>"
208
208
  - !ruby/object:Gem::Version
209
- version: '0'
209
+ version: 2.3.0
210
210
  - !ruby/object:Gem::Dependency
211
211
  name: simplecov
212
212
  requirement: !ruby/object:Gem::Requirement
@@ -299,10 +299,12 @@ extra_rdoc_files:
299
299
  - LICENSE.txt
300
300
  files:
301
301
  - ".document"
302
+ - ".github/workflows/main.yml"
302
303
  - ".rspec"
303
304
  - ".ruby-version"
304
305
  - Gemfile
305
306
  - Gemfile.lock
307
+ - Jenkinsfile
306
308
  - LICENSE.txt
307
309
  - Rakefile
308
310
  - VERSION
@@ -334,7 +336,7 @@ homepage: http://github.com/versapay/heartland_portico
334
336
  licenses:
335
337
  - MIT
336
338
  metadata: {}
337
- post_install_message:
339
+ post_install_message:
338
340
  rdoc_options: []
339
341
  require_paths:
340
342
  - lib
@@ -349,9 +351,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
351
  - !ruby/object:Gem::Version
350
352
  version: '0'
351
353
  requirements: []
352
- rubyforge_project:
353
- rubygems_version: 2.7.6
354
- signing_key:
354
+ rubyforge_project:
355
+ rubygems_version: 2.6.14.4
356
+ signing_key:
355
357
  specification_version: 4
356
358
  summary: SOAP Wrapper for Heartland Portico payment gateway
357
359
  test_files: []