cardconnect 2.2.0 → 2.4.0
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 +5 -5
- data/.github/workflows/ruby.yml +35 -0
- data/CHANGELOG.md +13 -0
- data/README.md +29 -5
- data/cardconnect.gemspec +1 -4
- data/lib/cardconnect/connection.rb +3 -3
- data/lib/cardconnect/services/authorization/authorization_response.rb +2 -6
- data/lib/cardconnect/services/bin/bin.rb +15 -0
- data/lib/cardconnect/services/bin/bin_request.rb +43 -0
- data/lib/cardconnect/services/bin/bin_response.rb +36 -0
- data/lib/cardconnect/services/capture/capture_request.rb +1 -5
- data/lib/cardconnect/services/capture/capture_response.rb +9 -11
- data/lib/cardconnect/services/inquire/inquire_response.rb +13 -14
- data/lib/cardconnect/services/profile/profile.rb +1 -1
- data/lib/cardconnect/services/profile/profile_delete_response.rb +1 -5
- data/lib/cardconnect/services/profile/profile_get_response.rb +6 -8
- data/lib/cardconnect/services/profile/profile_put_response.rb +1 -5
- data/lib/cardconnect/services/refund/refund_response.rb +1 -5
- data/lib/cardconnect/services/settlement_status/settlement_status_response.rb +1 -5
- data/lib/cardconnect/services/void/void_response.rb +1 -5
- data/lib/cardconnect/utils.rb +3 -6
- data/lib/cardconnect/version.rb +1 -1
- data/lib/cardconnect.rb +5 -1
- data/test/api_request_stubs.rb +7 -0
- data/test/api_response_stubs.rb +40 -6
- data/test/cardconnect/configuration_test.rb +5 -5
- data/test/cardconnect/connection_test.rb +6 -6
- data/test/cardconnect/services/authorization/authorization_request_test.rb +35 -35
- data/test/cardconnect/services/authorization/authorization_response_test.rb +19 -19
- data/test/cardconnect/services/authorization/authorization_test.rb +11 -11
- data/test/cardconnect/services/bin/bin_request_test.rb +45 -0
- data/test/cardconnect/services/bin/bin_response_test.rb +67 -0
- data/test/cardconnect/services/bin/bin_test.rb +56 -0
- data/test/cardconnect/services/capture/capture_request_test.rb +11 -11
- data/test/cardconnect/services/capture/capture_response_test.rb +6 -6
- data/test/cardconnect/services/capture/capture_test.rb +9 -9
- data/test/cardconnect/services/inquire/inquire_request_test.rb +6 -6
- data/test/cardconnect/services/inquire/inquire_response_test.rb +35 -11
- data/test/cardconnect/services/inquire/inquire_test.rb +9 -9
- data/test/cardconnect/services/profile/profile_delete_request_test.rb +7 -7
- data/test/cardconnect/services/profile/profile_delete_response_test.rb +11 -11
- data/test/cardconnect/services/profile/profile_get_request_test.rb +7 -7
- data/test/cardconnect/services/profile/profile_get_response_test.rb +34 -26
- data/test/cardconnect/services/profile/profile_put_request_test.rb +23 -23
- data/test/cardconnect/services/profile/profile_put_response_test.rb +28 -28
- data/test/cardconnect/services/profile/profile_test.rb +27 -27
- data/test/cardconnect/services/refund/refund_request_test.rb +7 -7
- data/test/cardconnect/services/refund/refund_response_test.rb +13 -13
- data/test/cardconnect/services/refund/refund_test.rb +9 -9
- data/test/cardconnect/services/settlement_status/settlement_status_request_test.rb +12 -12
- data/test/cardconnect/services/settlement_status/settlement_status_response_test.rb +8 -8
- data/test/cardconnect/services/settlement_status/settlement_status_test.rb +9 -9
- data/test/cardconnect/services/void/void_request_test.rb +7 -7
- data/test/cardconnect/services/void/void_response_test.rb +14 -14
- data/test/cardconnect/services/void/void_test.rb +9 -9
- data/test/cardconnect_test.rb +2 -2
- data/test/test_helper.rb +3 -1
- metadata +18 -38
- data/.travis.yml +0 -9
@@ -11,39 +11,39 @@ describe CardConnect::Service::VoidRequest do
|
|
11
11
|
|
12
12
|
describe 'FIELDS' do
|
13
13
|
it 'should have merchant id' do
|
14
|
-
@request.merchid.must_equal '000000927996'
|
14
|
+
_(@request.merchid).must_equal '000000927996'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should have retrieval reference number' do
|
18
|
-
@request.retref.must_equal '288013185633'
|
18
|
+
_(@request.retref).must_equal '288013185633'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have amount' do
|
22
|
-
@request.amount.must_equal '101'
|
22
|
+
_(@request.amount).must_equal '101'
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
describe '#valid?' do
|
27
27
|
it 'should not be valid if no attributes are passed in' do
|
28
|
-
CardConnect::Service::VoidRequest.new.valid
|
28
|
+
_(CardConnect::Service::VoidRequest.new.valid?).must_equal false
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should be valid if valid attributes are passed in' do
|
32
|
-
CardConnect::Service::VoidRequest.new(valid_void_request).valid
|
32
|
+
_(CardConnect::Service::VoidRequest.new(valid_void_request).valid?).must_equal true
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
describe '#errors' do
|
37
37
|
CardConnect::Service::VoidRequest::REQUIRED_FIELDS.each do |field|
|
38
38
|
it "should have an error message if #{field} is missing" do
|
39
|
-
CardConnect::Service::VoidRequest.new.errors.must_include "#{field.to_s.capitalize} is missing"
|
39
|
+
_(CardConnect::Service::VoidRequest.new.errors).must_include "#{field.to_s.capitalize} is missing"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe '#payload' do
|
45
45
|
it 'should generate hash with all the right values' do
|
46
|
-
@request.payload.must_equal symbolize_keys(valid_void_request)
|
46
|
+
_(@request.payload).must_equal symbolize_keys(valid_void_request)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -11,69 +11,69 @@ describe CardConnect::Service::VoidResponse do
|
|
11
11
|
|
12
12
|
describe 'FIELDS' do
|
13
13
|
it 'should have the merchant id' do
|
14
|
-
@response.merchid.must_equal '000000927996'
|
14
|
+
_(@response.merchid).must_equal '000000927996'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should have the Amount' do
|
18
|
-
@response.amount.must_equal '1.01'
|
18
|
+
_(@response.amount).must_equal '1.01'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have the currency' do
|
22
|
-
@response.currency.must_equal 'USD'
|
22
|
+
_(@response.currency).must_equal 'USD'
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should have the Retrieval Reference Number' do
|
26
|
-
@response.retref.must_equal '288013185633'
|
26
|
+
_(@response.retref).must_equal '288013185633'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should have the authcode' do
|
30
|
-
@response.authcode.must_equal 'REVERS'
|
30
|
+
_(@response.authcode).must_equal 'REVERS'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should have the Response Code' do
|
34
|
-
@response.respcode.must_equal '00'
|
34
|
+
_(@response.respcode).must_equal '00'
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should have the Response Processor' do
|
38
|
-
@response.respproc.must_equal 'FNOR'
|
38
|
+
_(@response.respproc).must_equal 'FNOR'
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should have the status' do
|
42
|
-
@response.respstat.must_equal 'A'
|
42
|
+
_(@response.respstat).must_equal 'A'
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'should have the Response text' do
|
46
|
-
@response.resptext.must_equal 'Approval'
|
46
|
+
_(@response.resptext).must_equal 'Approval'
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
describe '#success?' do
|
51
51
|
it 'should be true when there are no errors' do
|
52
|
-
@response.success
|
52
|
+
_(@response.success?).must_equal true
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should be false when there are errors' do
|
56
56
|
void_response = valid_void_response.merge!('respstat' => 'C', 'resptext' => 'this is an error')
|
57
57
|
response = CardConnect::Service::VoidResponse.new(void_response)
|
58
|
-
response.success
|
58
|
+
_(response.success?).must_equal false
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
describe '#errors' do
|
63
63
|
it 'should be empty when there are no errors' do
|
64
|
-
@response.errors.must_be_empty
|
64
|
+
_(@response.errors).must_be_empty
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'should be an array of error messages when there are errors' do
|
68
68
|
void_response = valid_void_response.merge!('respstat' => 'C', 'resptext' => 'this is an error')
|
69
69
|
response = CardConnect::Service::VoidResponse.new(void_response)
|
70
|
-
response.errors.must_equal ['this is an error']
|
70
|
+
_(response.errors).must_equal ['this is an error']
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
describe '#body' do
|
75
75
|
it 'should generate hash with all the right values' do
|
76
|
-
@response.body.must_equal symbolize_keys(valid_void_response)
|
76
|
+
_(@response.body).must_equal symbolize_keys(valid_void_response)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -13,7 +13,7 @@ describe CardConnect::Service::Void do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'must have the right path' do
|
16
|
-
@service.path.must_equal '/cardconnect/rest/void'
|
16
|
+
_(@service.path).must_equal '/cardconnect/rest/void'
|
17
17
|
end
|
18
18
|
|
19
19
|
describe '#build_request' do
|
@@ -27,30 +27,30 @@ describe CardConnect::Service::Void do
|
|
27
27
|
|
28
28
|
it 'uses the default merchant id if it is not passed in' do
|
29
29
|
@service.build_request(@valid_params.reject! { |k, _| k == 'merchid' })
|
30
|
-
@service.request.merchid.must_equal 'merchant123'
|
30
|
+
_(@service.request.merchid).must_equal 'merchant123'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'creates an Authorization request object with the right params' do
|
34
34
|
@service.build_request(@valid_params)
|
35
35
|
|
36
|
-
@service.request.must_be_kind_of CardConnect::Service::VoidRequest
|
36
|
+
_(@service.request).must_be_kind_of CardConnect::Service::VoidRequest
|
37
37
|
|
38
|
-
@service.request.merchid.must_equal '000000927996'
|
39
|
-
@service.request.retref.must_equal '288013185633'
|
40
|
-
@service.request.amount.must_equal '101'
|
38
|
+
_(@service.request.merchid).must_equal '000000927996'
|
39
|
+
_(@service.request.retref).must_equal '288013185633'
|
40
|
+
_(@service.request.amount).must_equal '101'
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe '#submit' do
|
45
45
|
it 'raises an error when there is no request' do
|
46
|
-
@service.request.nil
|
47
|
-
proc { @service.submit }.must_raise CardConnect::Error
|
46
|
+
_(@service.request.nil?).must_equal true
|
47
|
+
_(proc { @service.submit }).must_raise CardConnect::Error
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'creates a response when a valid request is processed' do
|
51
51
|
@service.build_request(valid_void_request)
|
52
52
|
@service.submit
|
53
|
-
@service.response.must_be_kind_of CardConnect::Service::VoidResponse
|
53
|
+
_(@service.response).must_be_kind_of CardConnect::Service::VoidResponse
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/test/cardconnect_test.rb
CHANGED
@@ -2,12 +2,12 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
describe CardConnect do
|
4
4
|
it 'must respond to configure' do
|
5
|
-
CardConnect.must_respond_to :configure
|
5
|
+
_(CardConnect).must_respond_to :configure
|
6
6
|
end
|
7
7
|
|
8
8
|
describe 'configuration' do
|
9
9
|
it 'must return instance of Configuration' do
|
10
|
-
CardConnect.configuration.must_be_kind_of CardConnect::Configuration
|
10
|
+
_(CardConnect.configuration).must_be_kind_of CardConnect::Configuration
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/test/test_helper.rb
CHANGED
@@ -18,9 +18,11 @@ end
|
|
18
18
|
# Stub out the Faraday connection for testing.
|
19
19
|
module CardConnect
|
20
20
|
class Connection
|
21
|
+
undef :connection if method_defined? :connection
|
22
|
+
|
21
23
|
def connection
|
22
24
|
@connection ||= Faraday.new(faraday_options) do |faraday|
|
23
|
-
faraday.request :
|
25
|
+
faraday.request :authorization, :basic, @config.api_username, @config.api_password
|
24
26
|
faraday.request :json
|
25
27
|
|
26
28
|
faraday.response :json, content_type: /\bjson$/
|
metadata
CHANGED
@@ -1,59 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cardconnect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim McKenzie
|
8
8
|
- Prashant Mokkarala
|
9
9
|
- Jason Taylor
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-05-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: bundler
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
requirements:
|
19
|
-
- - "~>"
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '1.0'
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
requirements:
|
26
|
-
- - "~>"
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '1.0'
|
29
15
|
- !ruby/object:Gem::Dependency
|
30
16
|
name: faraday
|
31
17
|
requirement: !ruby/object:Gem::Requirement
|
32
18
|
requirements:
|
33
19
|
- - "~>"
|
34
20
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
36
|
-
type: :runtime
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - "~>"
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 0.12.1
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: faraday_middleware
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 0.11.0.1
|
21
|
+
version: 2.7.4
|
50
22
|
type: :runtime
|
51
23
|
prerelease: false
|
52
24
|
version_requirements: !ruby/object:Gem::Requirement
|
53
25
|
requirements:
|
54
26
|
- - "~>"
|
55
27
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
28
|
+
version: 2.7.4
|
57
29
|
description: CardConnect API Ruby Client
|
58
30
|
email:
|
59
31
|
- tim@mobilecause.com
|
@@ -64,9 +36,9 @@ extensions: []
|
|
64
36
|
extra_rdoc_files: []
|
65
37
|
files:
|
66
38
|
- ".codeclimate.yml"
|
39
|
+
- ".github/workflows/ruby.yml"
|
67
40
|
- ".gitignore"
|
68
41
|
- ".rubocop.yml"
|
69
|
-
- ".travis.yml"
|
70
42
|
- CHANGELOG.md
|
71
43
|
- Gemfile
|
72
44
|
- LICENSE.txt
|
@@ -80,6 +52,9 @@ files:
|
|
80
52
|
- lib/cardconnect/services/authorization/authorization.rb
|
81
53
|
- lib/cardconnect/services/authorization/authorization_request.rb
|
82
54
|
- lib/cardconnect/services/authorization/authorization_response.rb
|
55
|
+
- lib/cardconnect/services/bin/bin.rb
|
56
|
+
- lib/cardconnect/services/bin/bin_request.rb
|
57
|
+
- lib/cardconnect/services/bin/bin_response.rb
|
83
58
|
- lib/cardconnect/services/capture/capture.rb
|
84
59
|
- lib/cardconnect/services/capture/capture_request.rb
|
85
60
|
- lib/cardconnect/services/capture/capture_response.rb
|
@@ -112,6 +87,9 @@ files:
|
|
112
87
|
- test/cardconnect/services/authorization/authorization_request_test.rb
|
113
88
|
- test/cardconnect/services/authorization/authorization_response_test.rb
|
114
89
|
- test/cardconnect/services/authorization/authorization_test.rb
|
90
|
+
- test/cardconnect/services/bin/bin_request_test.rb
|
91
|
+
- test/cardconnect/services/bin/bin_response_test.rb
|
92
|
+
- test/cardconnect/services/bin/bin_test.rb
|
115
93
|
- test/cardconnect/services/capture/capture_request_test.rb
|
116
94
|
- test/cardconnect/services/capture/capture_response_test.rb
|
117
95
|
- test/cardconnect/services/capture/capture_test.rb
|
@@ -140,7 +118,7 @@ homepage: http://developer.cardconnect.com/
|
|
140
118
|
licenses:
|
141
119
|
- MIT
|
142
120
|
metadata: {}
|
143
|
-
post_install_message:
|
121
|
+
post_install_message:
|
144
122
|
rdoc_options: []
|
145
123
|
require_paths:
|
146
124
|
- lib
|
@@ -155,9 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
133
|
- !ruby/object:Gem::Version
|
156
134
|
version: '0'
|
157
135
|
requirements: []
|
158
|
-
|
159
|
-
|
160
|
-
signing_key:
|
136
|
+
rubygems_version: 3.4.10
|
137
|
+
signing_key:
|
161
138
|
specification_version: 4
|
162
139
|
summary: CardConnect API Ruby Client
|
163
140
|
test_files:
|
@@ -168,6 +145,9 @@ test_files:
|
|
168
145
|
- test/cardconnect/services/authorization/authorization_request_test.rb
|
169
146
|
- test/cardconnect/services/authorization/authorization_response_test.rb
|
170
147
|
- test/cardconnect/services/authorization/authorization_test.rb
|
148
|
+
- test/cardconnect/services/bin/bin_request_test.rb
|
149
|
+
- test/cardconnect/services/bin/bin_response_test.rb
|
150
|
+
- test/cardconnect/services/bin/bin_test.rb
|
171
151
|
- test/cardconnect/services/capture/capture_request_test.rb
|
172
152
|
- test/cardconnect/services/capture/capture_response_test.rb
|
173
153
|
- test/cardconnect/services/capture/capture_test.rb
|