cardconnect 2.1.0 → 2.2.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
2
  SHA1:
3
- metadata.gz: 1424e5c7c8b8b7da969afddb41d96b38251e6c7f
4
- data.tar.gz: 4d108dc528103808b4c9688c4afab51c4b833bb0
3
+ metadata.gz: 0d6ec54a93e96b0853646453b4279a2f4940f944
4
+ data.tar.gz: 4fdb897d65793526a08198bffd4f7b0e1533dbb6
5
5
  SHA512:
6
- metadata.gz: db20abb8bd3a1125ead42db2e54d03b1864a530139d2fd669be621510851bf5537b86f5a5289a5fa98cc8855acf6ee7b84e5051f54ceb128635bb1b512ce8fea
7
- data.tar.gz: 5a524dd23a749c7232831d8d75a3f72fe34b0e1f890d378a985b408b2f3312340b6c6cf06a31b12d08f69ee509a5a49e19224fe58e2fd738fa01617e28a70c84
6
+ metadata.gz: 7c9363231dcd9e016e566bf9bee06c6d58f08c9bf17c8e5b873a5ccb6e5192b42859bfb5517b75c565b220ba7f62a5442251eaf317fb042d5ac9d343bb103d4c
7
+ data.tar.gz: ecc1e1b60110560499449a41b3f615d1506ec0ce2bde957a719ac95cf7d7ebedd243eb3d9da2431e51c237399fea5c7eb2ad6febef6145f76bfd7c82555804c4
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v2.2.0
4
+
5
+ * Add `token` field to Profile Service for create/update responses since this field can potentially be included in the response if a token hadn't already been created for that particular profile. (@mauriciozaffari)
6
+
3
7
  ## v2.1.0
4
8
 
5
9
  * Add ability to pass connection options to the Faraday connection (@jhanggi)
data/README.md CHANGED
@@ -122,7 +122,6 @@ response = service.submit
122
122
  ```
123
123
 
124
124
  ### Profile Service
125
- Thanks to [@AndreiBujenitsa](https://github.com/AndreiBujenitsa) for implementing Profile Service!
126
125
 
127
126
  CardConnect documentation for this service can be found here: https://developer.cardconnect.com/cardconnect-api/#profile-service
128
127
 
@@ -5,7 +5,7 @@ module CardConnect
5
5
 
6
6
  FIELDS = [:profileid, :acctid, :respstat, :account, :respcode, :resptext, :respproc, :accttype,
7
7
  :expiry, :name, :address, :city, :region, :country, :phone, :postal, :ssnl4, :email,
8
- :defaultacct, :license, :gsacard, :auoptout]
8
+ :defaultacct, :license, :gsacard, :auoptout, :token]
9
9
 
10
10
  attr_accessor(*FIELDS)
11
11
  attr_reader :errors
@@ -1,3 +1,3 @@
1
1
  module CardConnect
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  end
@@ -125,23 +125,28 @@ end
125
125
 
126
126
  def valid_profile_put_response #rubocop:disable Metrics/MethodLength
127
127
  {
128
- "region" => "AK",
129
- "phone" => "7778789999",
130
- "accttype" => "VISA",
131
- "postal" => "19090",
132
- "ssnl4" => "3655",
133
- "respproc" => "PPS",
134
- "expiry" => "0214",
135
- "city" => "ANYTOWN",
136
128
  "country" => "US",
129
+ "address" => "123 MAIN STREET",
137
130
  "resptext" => "Profile Saved",
138
- "token" => "9440670166031111",
131
+ "city" => "ANYTOWN",
132
+ "acctid" => "1",
139
133
  "respcode" => "09",
140
- "address" => "123 MAIN STREET",
141
- "name" => "TOM JONES",
134
+ "defaultacct" => "Y",
135
+ "accttype" => "VISA",
136
+ "token" => "9441149619831111",
137
+ "account" => "41XXXXXXXXXX1111",
138
+ "email" => "test@test.com",
142
139
  "license" => "123451254",
140
+ "respproc" => "PPS",
141
+ "phone" => "7778789999",
142
+ "profileid" => "12305454023615201322",
143
+ "name" => "TOM JONES",
144
+ "auoptout" => "N",
145
+ "postal" => "19090",
146
+ "expiry" => "0214",
147
+ "region" => "AK",
148
+ "ssnl4" => "3655",
143
149
  "respstat" => "A",
144
- "profileid" => "12345678901234567890",
145
- "acctid" => "1"
150
+ "gsacard" => "N"
146
151
  }
147
152
  end
@@ -0,0 +1,135 @@
1
+ require 'test_helper'
2
+
3
+ describe CardConnect::Service::ProfilePutResponse do
4
+ before do
5
+ @response = CardConnect::Service::ProfilePutResponse.new(valid_profile_put_response)
6
+ end
7
+
8
+ after do
9
+ @response = nil
10
+ end
11
+
12
+ describe 'FIELDS' do
13
+ it 'should have profile id' do
14
+ @response.profileid.must_equal '12305454023615201322'
15
+ end
16
+
17
+ it 'should have account id' do
18
+ @response.acctid.must_equal '1'
19
+ end
20
+
21
+ it 'should have response status' do
22
+ @response.respstat.must_equal 'A'
23
+ end
24
+
25
+ it 'should have account' do
26
+ @response.account.must_equal '41XXXXXXXXXX1111'
27
+ end
28
+
29
+ it 'should have response code' do
30
+ @response.respcode.must_equal '09'
31
+ end
32
+
33
+ it 'should have response text' do
34
+ @response.resptext.must_equal 'Profile Saved'
35
+ end
36
+
37
+ it 'should have respproc' do
38
+ @response.respproc.must_equal 'PPS'
39
+ end
40
+
41
+ it 'should have accttype' do
42
+ @response.accttype.must_equal 'VISA'
43
+ end
44
+
45
+ it 'should have expiry' do
46
+ @response.expiry.must_equal '0214'
47
+ end
48
+
49
+ it 'should have name' do
50
+ @response.name.must_equal 'TOM JONES'
51
+ end
52
+
53
+ it 'should have address' do
54
+ @response.address.must_equal '123 MAIN STREET'
55
+ end
56
+
57
+ it 'should have city' do
58
+ @response.city.must_equal 'ANYTOWN'
59
+ end
60
+
61
+ it 'should have region' do
62
+ @response.region.must_equal 'AK'
63
+ end
64
+
65
+ it 'should have country' do
66
+ @response.country.must_equal 'US'
67
+ end
68
+
69
+ it 'should have phone' do
70
+ @response.phone.must_equal '7778789999'
71
+ end
72
+
73
+ it 'should have postal' do
74
+ @response.postal.must_equal '19090'
75
+ end
76
+
77
+ it 'should have ssnl4' do
78
+ @response.ssnl4.must_equal '3655'
79
+ end
80
+
81
+ it 'should have email' do
82
+ @response.email.must_equal 'test@test.com'
83
+ end
84
+
85
+ it 'should have defaultacct' do
86
+ @response.defaultacct.must_equal 'Y'
87
+ end
88
+
89
+ it 'should have license' do
90
+ @response.license.must_equal '123451254'
91
+ end
92
+
93
+ it 'should have token' do
94
+ @response.token.must_equal '9441149619831111'
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'
103
+ end
104
+ end
105
+
106
+ describe '#success?' do
107
+ it 'should be true when there are no errors' do
108
+ @response.success?.must_equal true
109
+ end
110
+
111
+ it 'should be false when there are errors' do
112
+ prof_response = valid_profile_put_response.merge!('respstat' => 'C', 'resptext' => 'this is an error')
113
+ response = CardConnect::Service::ProfilePutResponse.new(prof_response)
114
+ response.success?.must_equal false
115
+ end
116
+ end
117
+
118
+ describe '#errors' do
119
+ it 'should be empty when there are no errors' do
120
+ @response.errors.must_be_empty
121
+ end
122
+
123
+ it 'should be an array of error messages when there are errors' do
124
+ prof_response = valid_profile_put_response.merge!('respstat' => 'C', 'resptext' => 'this is an error')
125
+ response = CardConnect::Service::ProfilePutResponse.new(prof_response)
126
+ response.errors.must_equal ['this is an error']
127
+ end
128
+ end
129
+
130
+ describe '#body' do
131
+ it 'should generate hash with all the right values' do
132
+ @response.body.must_equal symbolize_keys(valid_profile_put_response)
133
+ end
134
+ end
135
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cardconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim McKenzie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-12-13 00:00:00.000000000 Z
13
+ date: 2018-01-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -123,6 +123,7 @@ files:
123
123
  - test/cardconnect/services/profile/profile_get_request_test.rb
124
124
  - test/cardconnect/services/profile/profile_get_response_test.rb
125
125
  - test/cardconnect/services/profile/profile_put_request_test.rb
126
+ - test/cardconnect/services/profile/profile_put_response_test.rb
126
127
  - test/cardconnect/services/profile/profile_test.rb
127
128
  - test/cardconnect/services/refund/refund_request_test.rb
128
129
  - test/cardconnect/services/refund/refund_response_test.rb
@@ -178,6 +179,7 @@ test_files:
178
179
  - test/cardconnect/services/profile/profile_get_request_test.rb
179
180
  - test/cardconnect/services/profile/profile_get_response_test.rb
180
181
  - test/cardconnect/services/profile/profile_put_request_test.rb
182
+ - test/cardconnect/services/profile/profile_put_response_test.rb
181
183
  - test/cardconnect/services/profile/profile_test.rb
182
184
  - test/cardconnect/services/refund/refund_request_test.rb
183
185
  - test/cardconnect/services/refund/refund_response_test.rb