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
@@ -13,7 +13,7 @@ describe CardConnect::Service::Capture do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'must have the right path' do
|
16
|
-
@service.path.must_equal '/cardconnect/rest/capture'
|
16
|
+
_(@service.path).must_equal '/cardconnect/rest/capture'
|
17
17
|
end
|
18
18
|
|
19
19
|
describe '#build_request' do
|
@@ -28,29 +28,29 @@ describe CardConnect::Service::Capture do
|
|
28
28
|
it 'creates a Capture request object with the passed in params' do
|
29
29
|
@service.build_request(@valid_params)
|
30
30
|
|
31
|
-
@service.request.must_be_kind_of CardConnect::Service::CaptureRequest
|
31
|
+
_(@service.request).must_be_kind_of CardConnect::Service::CaptureRequest
|
32
32
|
|
33
|
-
@service.request.merchid.must_equal '000000927996'
|
34
|
-
@service.request.retref.must_equal '288002073633'
|
33
|
+
_(@service.request.merchid).must_equal '000000927996'
|
34
|
+
_(@service.request.retref).must_equal '288002073633'
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'uses default merchant ID if merchid is not passed in' do
|
38
38
|
@service.build_request(@valid_params.reject! { |k, _| k == 'merchid' })
|
39
|
-
@service.request.must_be_kind_of CardConnect::Service::CaptureRequest
|
40
|
-
@service.request.merchid.must_equal 'merchant123'
|
39
|
+
_(@service.request).must_be_kind_of CardConnect::Service::CaptureRequest
|
40
|
+
_(@service.request.merchid).must_equal 'merchant123'
|
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_capture_request)
|
52
52
|
@service.submit
|
53
|
-
@service.response.must_be_kind_of CardConnect::Service::CaptureResponse
|
53
|
+
_(@service.response).must_be_kind_of CardConnect::Service::CaptureResponse
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -11,35 +11,35 @@ describe CardConnect::Service::InquireRequest 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 '288002073633'
|
18
|
+
_(@request.retref).must_equal '288002073633'
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#valid?' do
|
23
23
|
it 'should not be valid if no attributes are passed in' do
|
24
|
-
CardConnect::Service::InquireRequest.new.valid
|
24
|
+
_(CardConnect::Service::InquireRequest.new.valid?).must_equal false
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should be valid if valid attributes are passed in' do
|
28
|
-
CardConnect::Service::InquireRequest.new(valid_inquire_request).valid
|
28
|
+
_(CardConnect::Service::InquireRequest.new(valid_inquire_request).valid?).must_equal true
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe '#errors' do
|
33
33
|
CardConnect::Service::InquireRequest::REQUIRED_FIELDS.each do |field|
|
34
34
|
it "should have an error message if #{field} is missing" do
|
35
|
-
CardConnect::Service::InquireRequest.new.errors.must_include "#{field.to_s.capitalize} is missing"
|
35
|
+
_(CardConnect::Service::InquireRequest.new.errors).must_include "#{field.to_s.capitalize} is missing"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe '#payload' do
|
41
41
|
it 'should generate the correct path params' do
|
42
|
-
@request.payload.must_equal '/288002073633/000000927996'
|
42
|
+
_(@request.payload).must_equal '/288002073633/000000927996'
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -11,49 +11,73 @@ describe CardConnect::Service::InquireResponse do
|
|
11
11
|
|
12
12
|
describe 'FIELDS' do
|
13
13
|
it 'should have merchant id' do
|
14
|
-
@response.merchid.must_equal '000000927996'
|
14
|
+
_(@response.merchid).must_equal '000000927996'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should have name' do
|
18
|
+
_(@response.name).must_equal 'TOM JONES'
|
15
19
|
end
|
16
20
|
|
17
21
|
it 'should have account' do
|
18
|
-
@response.account.must_equal '
|
22
|
+
_(@response.account).must_equal '9418594164541111'
|
19
23
|
end
|
20
24
|
|
21
25
|
it 'should have amount' do
|
22
|
-
@response.amount.must_equal '596.00'
|
26
|
+
_(@response.amount).must_equal '596.00'
|
23
27
|
end
|
24
28
|
|
25
29
|
it 'should have currency' do
|
26
|
-
@response.currency.must_equal 'USD'
|
30
|
+
_(@response.currency).must_equal 'USD'
|
27
31
|
end
|
28
32
|
|
29
33
|
it 'should have retrieval reference number' do
|
30
|
-
@response.retref.must_equal '288015190411'
|
34
|
+
_(@response.retref).must_equal '288015190411'
|
31
35
|
end
|
32
36
|
|
33
37
|
it 'should have response code' do
|
34
|
-
@response.respcode.must_equal '00'
|
38
|
+
_(@response.respcode).must_equal '00'
|
35
39
|
end
|
36
40
|
|
37
41
|
it 'should have response processor' do
|
38
|
-
@response.respproc.must_equal 'FNOR'
|
42
|
+
_(@response.respproc).must_equal 'FNOR'
|
39
43
|
end
|
40
44
|
|
41
45
|
it 'should have response status' do
|
42
|
-
@response.respstat.must_equal 'A'
|
46
|
+
_(@response.respstat).must_equal 'A'
|
43
47
|
end
|
44
48
|
|
45
49
|
it 'should have capture status' do
|
46
|
-
@response.resptext.must_equal 'Approval'
|
50
|
+
_(@response.resptext).must_equal 'Approval'
|
47
51
|
end
|
48
52
|
|
49
53
|
it 'should have settlement status' do
|
50
|
-
@response.setlstat.must_equal '
|
54
|
+
_(@response.setlstat).must_equal 'Accepted'
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should have token' do
|
58
|
+
_(@response.token).must_equal '9418594164541111'
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should have authdate' do
|
62
|
+
_(@response.authdate).must_equal '20180410'
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should have captureddate' do
|
66
|
+
_(@response.capturedate).must_equal '20180326065748'
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should have lastfour value' do
|
70
|
+
_(@response.lastfour).must_equal '1111'
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should have settledate' do
|
74
|
+
_(@response.settledate).must_equal '20180327143721'
|
51
75
|
end
|
52
76
|
end
|
53
77
|
|
54
78
|
describe '#body' do
|
55
79
|
it 'should generate hash with all the right values' do
|
56
|
-
@response.body.must_equal symbolize_keys(valid_inquire_response)
|
80
|
+
_(@response.body).must_equal symbolize_keys(valid_inquire_response)
|
57
81
|
end
|
58
82
|
end
|
59
83
|
end
|
@@ -14,7 +14,7 @@ describe CardConnect::Service::Inquire do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'must have the right path' do
|
17
|
-
@service.path.must_equal '/cardconnect/rest/inquire'
|
17
|
+
_(@service.path).must_equal '/cardconnect/rest/inquire'
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '#build_request' do
|
@@ -29,28 +29,28 @@ describe CardConnect::Service::Inquire do
|
|
29
29
|
it 'creates a inquire request object with the passed in params' do
|
30
30
|
@service.build_request(@valid_params)
|
31
31
|
|
32
|
-
@service.request.must_be_kind_of CardConnect::Service::InquireRequest
|
33
|
-
@service.request.retref.must_equal '288002073633'
|
34
|
-
@service.request.merchid.must_equal '000000927996'
|
32
|
+
_(@service.request).must_be_kind_of CardConnect::Service::InquireRequest
|
33
|
+
_(@service.request.retref).must_equal '288002073633'
|
34
|
+
_(@service.request.merchid).must_equal '000000927996'
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'uses default merchant ID if merchid is not passed in' do
|
38
38
|
@service.build_request(@valid_params.reject! { |k, _| k == 'merchid' })
|
39
|
-
@service.request.must_be_kind_of CardConnect::Service::InquireRequest
|
40
|
-
@service.request.merchid.must_equal 'merchant123'
|
39
|
+
_(@service.request).must_be_kind_of CardConnect::Service::InquireRequest
|
40
|
+
_(@service.request.merchid).must_equal 'merchant123'
|
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_inquire_request)
|
52
52
|
@service.submit
|
53
|
-
@service.response.must_be_kind_of CardConnect::Service::InquireResponse
|
53
|
+
_(@service.response).must_be_kind_of CardConnect::Service::InquireResponse
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -11,25 +11,25 @@ describe CardConnect::Service::ProfileDeleteRequest 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 profile id' do
|
18
|
-
@request.profileid.must_equal '12345678901234567890'
|
18
|
+
_(@request.profileid).must_equal '12345678901234567890'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have account id' do
|
22
|
-
@request.acctid.must_equal '1'
|
22
|
+
_(@request.acctid).must_equal '1'
|
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::ProfileDeleteRequest.new.valid
|
28
|
+
_(CardConnect::Service::ProfileDeleteRequest.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::ProfileDeleteRequest.new(valid_profile_request).valid
|
32
|
+
_(CardConnect::Service::ProfileDeleteRequest.new(valid_profile_request).valid?).must_equal true
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -37,14 +37,14 @@ describe CardConnect::Service::ProfileDeleteRequest do
|
|
37
37
|
CardConnect::Service::ProfileDeleteRequest::REQUIRED_FIELDS.each do |field|
|
38
38
|
field_name = field.to_s.capitalize
|
39
39
|
it "should have an error message if #{field_name} is missing" do
|
40
|
-
CardConnect::Service::ProfileDeleteRequest.new.errors.must_include "#{field_name} is missing"
|
40
|
+
_(CardConnect::Service::ProfileDeleteRequest.new.errors).must_include "#{field_name} is missing"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe '#payload' do
|
46
46
|
it 'should generate hash with all the right values' do
|
47
|
-
@request.payload.must_equal "/12345678901234567890/1/000000927996"
|
47
|
+
_(@request.payload).must_equal "/12345678901234567890/1/000000927996"
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -11,57 +11,57 @@ describe CardConnect::Service::ProfileDeleteResponse do
|
|
11
11
|
|
12
12
|
describe 'FIELDS' do
|
13
13
|
it 'should have response text' do
|
14
|
-
@response.resptext.must_equal 'Profile Deleted'
|
14
|
+
_(@response.resptext).must_equal 'Profile Deleted'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should have the response code' do
|
18
|
-
@response.respcode.must_equal '08'
|
18
|
+
_(@response.respcode).must_equal '08'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have the respproc' do
|
22
|
-
@response.respproc.must_equal 'PPS'
|
22
|
+
_(@response.respproc).must_equal 'PPS'
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should have response status' do
|
26
|
-
@response.respstat.must_equal 'A'
|
26
|
+
_(@response.respstat).must_equal 'A'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should have profileid' do
|
30
|
-
@response.profileid.must_equal '12345678901234567890'
|
30
|
+
_(@response.profileid).must_equal '12345678901234567890'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should have acctid' do
|
34
|
-
@response.acctid.must_equal '1'
|
34
|
+
_(@response.acctid).must_equal '1'
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe '#success?' do
|
39
39
|
it 'should be true when there are no errors' do
|
40
|
-
@response.success
|
40
|
+
_(@response.success?).must_equal true
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should be false when there are errors' do
|
44
44
|
prof_response = valid_profile_delete_response.merge!('respstat' => 'C', 'resptext' => 'this is an error')
|
45
45
|
response = CardConnect::Service::ProfileDeleteResponse.new(prof_response)
|
46
|
-
response.success
|
46
|
+
_(response.success?).must_equal false
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
describe '#errors' do
|
51
51
|
it 'should be empty when there are no errors' do
|
52
|
-
@response.errors.must_be_empty
|
52
|
+
_(@response.errors).must_be_empty
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should be an array of error messages when there are errors' do
|
56
56
|
prof_response = valid_profile_delete_response.merge!('respstat' => 'C', 'resptext' => 'this is an error')
|
57
57
|
response = CardConnect::Service::ProfileDeleteResponse.new(prof_response)
|
58
|
-
response.errors.must_equal ['this is an error']
|
58
|
+
_(response.errors).must_equal ['this is an error']
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
describe '#body' do
|
63
63
|
it 'should generate hash with all the right values' do
|
64
|
-
@response.body.must_equal symbolize_keys(valid_profile_delete_response)
|
64
|
+
_(@response.body).must_equal symbolize_keys(valid_profile_delete_response)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -11,25 +11,25 @@ describe CardConnect::Service::ProfileGetRequest 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 profile id' do
|
18
|
-
@request.profileid.must_equal '12345678901234567890'
|
18
|
+
_(@request.profileid).must_equal '12345678901234567890'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have account id' do
|
22
|
-
@request.acctid.must_equal '1'
|
22
|
+
_(@request.acctid).must_equal '1'
|
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::ProfileGetRequest.new.valid
|
28
|
+
_(CardConnect::Service::ProfileGetRequest.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::ProfileGetRequest.new(valid_profile_request).valid
|
32
|
+
_(CardConnect::Service::ProfileGetRequest.new(valid_profile_request).valid?).must_equal true
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -37,14 +37,14 @@ describe CardConnect::Service::ProfileGetRequest do
|
|
37
37
|
CardConnect::Service::ProfileGetRequest::REQUIRED_FIELDS.each do |field|
|
38
38
|
field_name = field.to_s.capitalize
|
39
39
|
it "should have an error message if #{field_name} is missing" do
|
40
|
-
CardConnect::Service::ProfileGetRequest.new.errors.must_include "#{field_name} is missing"
|
40
|
+
_(CardConnect::Service::ProfileGetRequest.new.errors).must_include "#{field_name} is missing"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe '#payload' do
|
46
46
|
it 'should generate hash with all the right values' do
|
47
|
-
@request.payload.must_equal "/12345678901234567890/1/000000927996"
|
47
|
+
_(@request.payload).must_equal "/12345678901234567890/1/000000927996"
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -11,117 +11,125 @@ describe CardConnect::Service::ProfileGetResponse do
|
|
11
11
|
|
12
12
|
describe 'FIELDS' do
|
13
13
|
it 'should have profile id' do
|
14
|
-
@response.profileid.must_equal '12345678901234567890'
|
14
|
+
_(@response.profileid).must_equal '12345678901234567890'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should have account id' do
|
18
|
-
@response.acctid.must_equal '1'
|
18
|
+
_(@response.acctid).must_equal '1'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have response status' do
|
22
|
-
@response.respstat.must_equal 'B'
|
22
|
+
_(@response.respstat).must_equal 'B'
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should have account' do
|
26
|
-
@response.account.must_equal '41XXXXXXXXXX1111'
|
26
|
+
_(@response.account).must_equal '41XXXXXXXXXX1111'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should have response code' do
|
30
|
-
@response.respcode.must_equal 'A'
|
30
|
+
_(@response.respcode).must_equal 'A'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should have response text' do
|
34
|
-
@response.resptext.must_equal 'Profile found'
|
34
|
+
_(@response.resptext).must_equal 'Profile found'
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should have respproc' do
|
38
|
-
@response.respproc.must_equal 'PPS'
|
38
|
+
_(@response.respproc).must_equal 'PPS'
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should have accttype' do
|
42
|
-
@response.accttype.must_equal 'VISA'
|
42
|
+
_(@response.accttype).must_equal 'VISA'
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'should have expiry' do
|
46
|
-
@response.expiry.must_equal '0214'
|
46
|
+
_(@response.expiry).must_equal '0214'
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should have name' do
|
50
|
-
@response.name.must_equal 'TOM JONES'
|
50
|
+
_(@response.name).must_equal 'TOM JONES'
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should have address' do
|
54
|
-
@response.address.must_equal '123 MAIN STREET'
|
54
|
+
_(@response.address).must_equal '123 MAIN STREET'
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'should have city' do
|
58
|
-
@response.city.must_equal 'ANYTOWN'
|
58
|
+
_(@response.city).must_equal 'ANYTOWN'
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'should have region' do
|
62
|
-
@response.region.must_equal 'AK'
|
62
|
+
_(@response.region).must_equal 'AK'
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'should have country' do
|
66
|
-
@response.country.must_equal 'US'
|
66
|
+
_(@response.country).must_equal 'US'
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'should have phone' do
|
70
|
-
@response.phone.must_equal '7778789999'
|
70
|
+
_(@response.phone).must_equal '7778789999'
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'should have postal' do
|
74
|
-
@response.postal.must_equal '19090'
|
74
|
+
_(@response.postal).must_equal '19090'
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'should have ssnl4' do
|
78
|
-
@response.ssnl4.must_equal '1234'
|
78
|
+
_(@response.ssnl4).must_equal '1234'
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'should have email' do
|
82
|
-
@response.email.must_equal 'test@test.com'
|
82
|
+
_(@response.email).must_equal 'test@test.com'
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'should have defaultacct' do
|
86
|
-
@response.defaultacct.must_equal '12345'
|
86
|
+
_(@response.defaultacct).must_equal '12345'
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'should have license' do
|
90
|
-
@response.license.must_equal '123451254'
|
90
|
+
_(@response.license).must_equal '123451254'
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'should have token' do
|
94
|
-
@response.token.must_equal '9440670166031111'
|
94
|
+
_(@response.token).must_equal '9440670166031111'
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'should have gsacard' do
|
98
|
+
_(@response.gsacard).must_equal 'N'
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'should have auoptout' do
|
102
|
+
_(@response.auoptout).must_equal 'N'
|
95
103
|
end
|
96
104
|
end
|
97
105
|
|
98
106
|
describe '#success?' do
|
99
107
|
it 'should be true when there are no errors' do
|
100
|
-
@response.success
|
108
|
+
_(@response.success?).must_equal true
|
101
109
|
end
|
102
110
|
|
103
111
|
it 'should be false when there are errors' do
|
104
112
|
prof_response = valid_profile_get_response.merge!('respstat' => 'C', 'resptext' => 'this is an error')
|
105
113
|
response = CardConnect::Service::ProfileGetResponse.new(prof_response)
|
106
|
-
response.success
|
114
|
+
_(response.success?).must_equal false
|
107
115
|
end
|
108
116
|
end
|
109
117
|
|
110
118
|
describe '#errors' do
|
111
119
|
it 'should be empty when there are no errors' do
|
112
|
-
@response.errors.must_be_empty
|
120
|
+
_(@response.errors).must_be_empty
|
113
121
|
end
|
114
122
|
|
115
123
|
it 'should be an array of error messages when there are errors' do
|
116
124
|
prof_response = valid_profile_get_response.merge!('respstat' => 'C', 'resptext' => 'this is an error')
|
117
125
|
response = CardConnect::Service::ProfileGetResponse.new(prof_response)
|
118
|
-
response.errors.must_equal ['this is an error']
|
126
|
+
_(response.errors).must_equal ['this is an error']
|
119
127
|
end
|
120
128
|
end
|
121
129
|
|
122
130
|
describe '#body' do
|
123
131
|
it 'should generate hash with all the right values' do
|
124
|
-
@response.body.must_equal symbolize_keys(valid_profile_get_response)
|
132
|
+
_(@response.body).must_equal symbolize_keys(valid_profile_get_response)
|
125
133
|
end
|
126
134
|
end
|
127
135
|
end
|
@@ -11,89 +11,89 @@ describe CardConnect::Service::ProfilePutRequest 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 profile id' do
|
18
|
-
@request.profileid.must_equal '12345678901234567890'
|
18
|
+
_(@request.profileid).must_equal '12345678901234567890'
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should have region' do
|
22
|
-
@request.region.must_equal 'AK'
|
22
|
+
_(@request.region).must_equal 'AK'
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should have phone' do
|
26
|
-
@request.phone.must_equal '7778789999'
|
26
|
+
_(@request.phone).must_equal '7778789999'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should have accttype' do
|
30
|
-
@request.accttype.must_equal 'VISA'
|
30
|
+
_(@request.accttype).must_equal 'VISA'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should have postal' do
|
34
|
-
@request.postal.must_equal '19090'
|
34
|
+
_(@request.postal).must_equal '19090'
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should have ssnl4' do
|
38
|
-
@request.ssnl4.must_equal '3655'
|
38
|
+
_(@request.ssnl4).must_equal '3655'
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should have expiry' do
|
42
|
-
@request.expiry.must_equal '0214'
|
42
|
+
_(@request.expiry).must_equal '0214'
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'should have city' do
|
46
|
-
@request.city.must_equal 'ANYTOWN'
|
46
|
+
_(@request.city).must_equal 'ANYTOWN'
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should have country' do
|
50
|
-
@request.country.must_equal 'US'
|
50
|
+
_(@request.country).must_equal 'US'
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should have address' do
|
54
|
-
@request.address.must_equal '123 MAIN STREET'
|
54
|
+
_(@request.address).must_equal '123 MAIN STREET'
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'should have name' do
|
58
|
-
@request.name.must_equal 'TOM JONES'
|
58
|
+
_(@request.name).must_equal 'TOM JONES'
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'should have account' do
|
62
|
-
@request.account.must_equal '4444333322221111'
|
62
|
+
_(@request.account).must_equal '4444333322221111'
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'should have license' do
|
66
|
-
@request.license.must_equal '123451254'
|
66
|
+
_(@request.license).must_equal '123451254'
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'should have defaultacct' do
|
70
|
-
@request.defaultacct.must_equal 'N'
|
70
|
+
_(@request.defaultacct).must_equal 'N'
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'should have profileupdate' do
|
74
|
-
@request.profileupdate.must_equal 'Y'
|
74
|
+
_(@request.profileupdate).must_equal 'Y'
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'should have profile' do
|
78
|
-
@request.profile.must_equal '12345678901234567890acctid'
|
78
|
+
_(@request.profile).must_equal '12345678901234567890acctid'
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'should have bankaba' do
|
82
|
-
@request.bankaba.must_equal '1234567'
|
82
|
+
_(@request.bankaba).must_equal '1234567'
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'should have email' do
|
86
|
-
@request.email.must_equal 'test@email.com'
|
86
|
+
_(@request.email).must_equal 'test@email.com'
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
90
|
describe '#valid?' do
|
91
91
|
it 'should not be valid if no attributes are passed in' do
|
92
|
-
CardConnect::Service::ProfilePutRequest.new.valid
|
92
|
+
_(CardConnect::Service::ProfilePutRequest.new.valid?).must_equal false
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'should be valid if valid attributes are passed in' do
|
96
|
-
CardConnect::Service::ProfilePutRequest.new(valid_profile_put_request).valid
|
96
|
+
_(CardConnect::Service::ProfilePutRequest.new(valid_profile_put_request).valid?).must_equal true
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -101,14 +101,14 @@ describe CardConnect::Service::ProfilePutRequest do
|
|
101
101
|
CardConnect::Service::ProfilePutRequest::REQUIRED_FIELDS.each do |field|
|
102
102
|
field_name = field.to_s.capitalize
|
103
103
|
it "should have an error message if #{field_name} is missing" do
|
104
|
-
CardConnect::Service::ProfilePutRequest.new.errors.must_include "#{field_name} is missing"
|
104
|
+
_(CardConnect::Service::ProfilePutRequest.new.errors).must_include "#{field_name} is missing"
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
109
|
describe '#payload' do
|
110
110
|
it 'should generate hash with all the right values' do
|
111
|
-
@request.payload.must_equal symbolize_keys(valid_profile_put_request)
|
111
|
+
_(@request.payload).must_equal symbolize_keys(valid_profile_put_request)
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|