hps 2.3.2 → 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 +4 -4
- data/Gemfile +4 -4
- data/Gemfile.lock +59 -0
- data/LICENSE.md +264 -264
- data/PRIVACY.txt +65 -65
- data/README.md +213 -213
- data/Rakefile +15 -15
- data/examples/sinatra-verify-only/Gemfile +4 -4
- data/examples/sinatra-verify-only/app.rb +32 -32
- data/examples/sinatra-verify-only/views/index.erb +478 -478
- data/examples/sinatra-verify-only/views/result.erb +39 -39
- data/hps.gemspec +28 -27
- data/lib/hps/configuration.rb +17 -17
- data/lib/hps/entities/hps_account_verify.rb +8 -8
- data/lib/hps/entities/hps_address.rb +6 -6
- data/lib/hps/entities/hps_authorization.rb +12 -12
- data/lib/hps/entities/hps_batch.rb +6 -6
- data/lib/hps/entities/hps_cardholder.rb +6 -6
- data/lib/hps/entities/hps_charge.rb +8 -8
- data/lib/hps/entities/hps_charge_exceptions.rb +6 -6
- data/lib/hps/entities/hps_check.rb +18 -18
- data/lib/hps/entities/hps_check_holder.rb +10 -10
- data/lib/hps/entities/hps_check_response.rb +45 -45
- data/lib/hps/entities/hps_check_response_details.rb +9 -9
- data/lib/hps/entities/hps_credit_card.rb +34 -34
- data/lib/hps/entities/hps_direct_market_data.rb +5 -5
- data/lib/hps/entities/hps_encryption_data.rb +6 -6
- data/lib/hps/entities/hps_gift_card.rb +133 -133
- data/lib/hps/entities/hps_manage_tokens.rb +8 -8
- data/lib/hps/entities/hps_refund.rb +8 -8
- data/lib/hps/entities/hps_report_transaction_details.rb +10 -10
- data/lib/hps/entities/hps_report_transaction_summary.rb +6 -6
- data/lib/hps/entities/hps_reversal.rb +10 -10
- data/lib/hps/entities/hps_token_data.rb +10 -10
- data/lib/hps/entities/hps_track_data.rb +5 -5
- data/lib/hps/entities/hps_transaction.rb +161 -161
- data/lib/hps/entities/hps_transaction_details.rb +6 -6
- data/lib/hps/entities/hps_transaction_header.rb +8 -8
- data/lib/hps/entities/hps_transaction_type.rb +16 -16
- data/lib/hps/entities/hps_void.rb +8 -8
- data/lib/hps/infrastructure/api_connection_exception.rb +11 -11
- data/lib/hps/infrastructure/authentication_exception.rb +11 -11
- data/lib/hps/infrastructure/card_exception.rb +15 -15
- data/lib/hps/infrastructure/exceptions.json +547 -547
- data/lib/hps/infrastructure/hps_account_type.rb +11 -11
- data/lib/hps/infrastructure/hps_check_exception.rb +13 -13
- data/lib/hps/infrastructure/hps_check_type.rb +11 -11
- data/lib/hps/infrastructure/hps_data_entry_mode.rb +11 -11
- data/lib/hps/infrastructure/hps_exception.rb +25 -25
- data/lib/hps/infrastructure/hps_exception_mapper.rb +145 -145
- data/lib/hps/infrastructure/hps_gateway_response_validation.rb +20 -20
- data/lib/hps/infrastructure/hps_input_validation.rb +13 -13
- data/lib/hps/infrastructure/hps_sdk_codes.rb +48 -48
- data/lib/hps/infrastructure/hps_sec_code.rb +27 -27
- data/lib/hps/infrastructure/hps_track_data_method.rb +6 -6
- data/lib/hps/infrastructure/invalid_request_exception.rb +15 -15
- data/lib/hps/services/hps_batch_service.rb +29 -29
- data/lib/hps/services/hps_charge_service.rb +773 -773
- data/lib/hps/services/hps_check_service.rb +110 -110
- data/lib/hps/services/hps_gift_card_service.rb +301 -301
- data/lib/hps/services/hps_service.rb +141 -136
- data/lib/hps/version.rb +3 -3
- data/lib/hps.rb +63 -63
- data/tests/amex_tests.rb +292 -292
- data/tests/cert_tests.rb +80 -80
- data/tests/certification/card_present_spec.rb +320 -320
- data/tests/certification/gift_card_certification_test.rb +106 -106
- data/tests/certification/gift_card_certification_tests.rb +107 -107
- data/tests/check_tests.rb +50 -50
- data/tests/discover_tests.rb +386 -386
- data/tests/exception_mapper_tests.rb +311 -311
- data/tests/general_tests.rb +140 -140
- data/tests/giftcard_tests.rb +212 -212
- data/tests/hps_token_service.rb +56 -56
- data/tests/mastercard_tests.rb +387 -387
- data/tests/secret_key.rb +11 -11
- data/tests/test_check.rb +77 -77
- data/tests/test_data.rb +138 -138
- data/tests/test_helper.rb +179 -179
- data/tests/token_tests.rb +512 -512
- data/tests/visa_tests.rb +445 -445
- metadata +31 -11
@@ -1,320 +1,320 @@
|
|
1
|
-
require File.join( File.dirname(File.dirname(__FILE__)), "test_helper" )
|
2
|
-
|
3
|
-
describe "Card Present Certification Tests" do
|
4
|
-
let(:test_descriptor) { "Heartland, Inc." }
|
5
|
-
let(:visa_swipe) { '%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?' }
|
6
|
-
let(:mastercard_swipe) { '%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?' }
|
7
|
-
let(:discover_swipe) { '%B6011000990156527^DIS TEST CARD^25121011000062111401?;6011000990156527=25121011000062111401?' }
|
8
|
-
let(:amex_swipe) { '%B3727 006992 51018^AMEX TEST CARD^2512990502700?;372700699251018=2512990502700?' }
|
9
|
-
|
10
|
-
it "should close batch ok" do
|
11
|
-
Hps::TestHelper.valid_multi_use_config
|
12
|
-
service = Hps::HpsBatchService.new
|
13
|
-
|
14
|
-
response = service.close_batch()
|
15
|
-
|
16
|
-
expect(response).to_not be_nil
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should verify with visa swipe" do
|
20
|
-
Hps::TestHelper.valid_multi_use_config
|
21
|
-
service = Hps::HpsChargeService.new
|
22
|
-
track_data = Hps::HpsTrackData.new
|
23
|
-
track_data.value = visa_swipe
|
24
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
25
|
-
|
26
|
-
verify = service.verify_swipe(track_data)
|
27
|
-
|
28
|
-
expect(verify).to_not be(nil)
|
29
|
-
expect(verify.response_code).to eql("85")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should verify with mastercard swipe" do
|
33
|
-
Hps::TestHelper.valid_multi_use_config
|
34
|
-
service = Hps::HpsChargeService.new
|
35
|
-
track_data = Hps::HpsTrackData.new
|
36
|
-
track_data.value = mastercard_swipe
|
37
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
38
|
-
|
39
|
-
verify = service.verify_swipe(track_data)
|
40
|
-
|
41
|
-
expect(verify).to_not be(nil)
|
42
|
-
expect(verify.response_code).to eql("85")
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should verify with discover swipe" do
|
46
|
-
Hps::TestHelper.valid_multi_use_config
|
47
|
-
service = Hps::HpsChargeService.new
|
48
|
-
track_data = Hps::HpsTrackData.new
|
49
|
-
track_data.value = discover_swipe
|
50
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
51
|
-
|
52
|
-
verify = service.verify_swipe(track_data)
|
53
|
-
|
54
|
-
expect(verify).to_not be(nil)
|
55
|
-
expect(verify.response_code).to eql("85")
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should verify with amex swipe" do
|
59
|
-
Hps::TestHelper.valid_multi_use_config
|
60
|
-
service = Hps::HpsChargeService.new
|
61
|
-
track_data = Hps::HpsTrackData.new
|
62
|
-
track_data.value = amex_swipe
|
63
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
64
|
-
|
65
|
-
verify = service.verify(Hps::TestData.valid_amex, Hps::TestData.cert_cardholder_shortzip)
|
66
|
-
|
67
|
-
expect(verify).to_not be(nil)
|
68
|
-
expect(verify.response_code).to eql("00")
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should charge with token req and visa swipe" do
|
72
|
-
Hps::TestHelper.valid_multi_use_config
|
73
|
-
service = Hps::HpsChargeService.new
|
74
|
-
track_data = Hps::HpsTrackData.new
|
75
|
-
track_data.value = visa_swipe
|
76
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
77
|
-
|
78
|
-
charge = service.charge_swipe(15.01, "usd", track_data, nil, 0, false, true)
|
79
|
-
|
80
|
-
expect(charge).to_not be_nil
|
81
|
-
expect(charge.response_code).to eql("00")
|
82
|
-
end
|
83
|
-
|
84
|
-
it "should charge with token req and mastercard swipe" do
|
85
|
-
Hps::TestHelper.valid_multi_use_config
|
86
|
-
service = Hps::HpsChargeService.new
|
87
|
-
track_data = Hps::HpsTrackData.new
|
88
|
-
track_data.value = mastercard_swipe
|
89
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
90
|
-
|
91
|
-
charge = service.charge_swipe(15.02, "usd", track_data, nil, 0, false, true)
|
92
|
-
|
93
|
-
expect(charge).to_not be_nil
|
94
|
-
expect(charge.response_code).to eql("00")
|
95
|
-
end
|
96
|
-
|
97
|
-
it "should charge with token req and discover swipe" do
|
98
|
-
Hps::TestHelper.valid_multi_use_config
|
99
|
-
service = Hps::HpsChargeService.new
|
100
|
-
track_data = Hps::HpsTrackData.new
|
101
|
-
track_data.value = discover_swipe
|
102
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
103
|
-
|
104
|
-
charge = service.charge_swipe(15.03, "usd", track_data, nil, 0, false, true)
|
105
|
-
|
106
|
-
expect(charge).to_not be_nil
|
107
|
-
expect(charge.response_code).to eql("00")
|
108
|
-
end
|
109
|
-
|
110
|
-
it "should charge with token req and amex swipe" do
|
111
|
-
Hps::TestHelper.valid_multi_use_config
|
112
|
-
service = Hps::HpsChargeService.new
|
113
|
-
track_data = Hps::HpsTrackData.new
|
114
|
-
track_data.value = amex_swipe
|
115
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
116
|
-
|
117
|
-
charge = service.charge_swipe(15.04, "usd", track_data, nil, 0, false, true)
|
118
|
-
|
119
|
-
expect(charge).to_not be_nil
|
120
|
-
expect(charge.response_code).to eql("00")
|
121
|
-
end
|
122
|
-
|
123
|
-
it "should charge with visa swipe" do
|
124
|
-
Hps::TestHelper.valid_multi_use_config
|
125
|
-
service = Hps::HpsChargeService.new
|
126
|
-
track_data = Hps::HpsTrackData.new
|
127
|
-
track_data.value = visa_swipe
|
128
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
129
|
-
|
130
|
-
charge = service.charge_swipe(15.01, "usd", track_data)
|
131
|
-
|
132
|
-
expect(charge).to_not be_nil
|
133
|
-
expect(charge.response_code).to eql("00")
|
134
|
-
end
|
135
|
-
|
136
|
-
it "should charge with mastercard swipe" do
|
137
|
-
Hps::TestHelper.valid_multi_use_config
|
138
|
-
service = Hps::HpsChargeService.new
|
139
|
-
track_data = Hps::HpsTrackData.new
|
140
|
-
track_data.value = mastercard_swipe
|
141
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
142
|
-
|
143
|
-
charge = service.charge_swipe(15.02, "usd", track_data)
|
144
|
-
|
145
|
-
expect(charge).to_not be_nil
|
146
|
-
expect(charge.response_code).to eql("00")
|
147
|
-
end
|
148
|
-
|
149
|
-
it "should charge with discover swipe" do
|
150
|
-
Hps::TestHelper.valid_multi_use_config
|
151
|
-
service = Hps::HpsChargeService.new
|
152
|
-
track_data = Hps::HpsTrackData.new
|
153
|
-
track_data.value = discover_swipe
|
154
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
155
|
-
|
156
|
-
charge = service.charge_swipe(15.03, "usd", track_data)
|
157
|
-
|
158
|
-
expect(charge).to_not be_nil
|
159
|
-
expect(charge.response_code).to eql("00")
|
160
|
-
end
|
161
|
-
|
162
|
-
it "should charge with amex swipe" do
|
163
|
-
Hps::TestHelper.valid_multi_use_config
|
164
|
-
service = Hps::HpsChargeService.new
|
165
|
-
track_data = Hps::HpsTrackData.new
|
166
|
-
track_data.value = amex_swipe
|
167
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
168
|
-
|
169
|
-
charge = service.charge_swipe(15.04, "usd", track_data)
|
170
|
-
|
171
|
-
expect(charge).to_not be_nil
|
172
|
-
expect(charge.response_code).to eql("00")
|
173
|
-
end
|
174
|
-
|
175
|
-
it "should charge with discover jcb swipe" do
|
176
|
-
Hps::TestHelper.valid_multi_use_config
|
177
|
-
service = Hps::HpsChargeService.new
|
178
|
-
track_data = Hps::HpsTrackData.new
|
179
|
-
track_data.value = "%B6011000990156527^DIS TEST CARD^25121011000062111401?;6011000990156527=25121011000062111401?"
|
180
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
181
|
-
|
182
|
-
charge = service.charge_swipe(15.04, "usd", track_data)
|
183
|
-
|
184
|
-
expect(charge).to_not be_nil
|
185
|
-
expect(charge.response_code).to eql("00")
|
186
|
-
end
|
187
|
-
|
188
|
-
it "should charge with visa swipe" do
|
189
|
-
Hps::TestHelper.valid_multi_use_config
|
190
|
-
service = Hps::HpsChargeService.new
|
191
|
-
track_data = Hps::HpsTrackData.new
|
192
|
-
track_data.value = visa_swipe
|
193
|
-
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
194
|
-
|
195
|
-
charge = service.charge_swipe(15.06, "usd", track_data)
|
196
|
-
|
197
|
-
expect(charge).to_not be_nil
|
198
|
-
expect(charge.response_code).to eql("00")
|
199
|
-
end
|
200
|
-
|
201
|
-
it "should charge with card present and visa manual" do
|
202
|
-
Hps::TestHelper.valid_multi_use_config
|
203
|
-
service = Hps::HpsChargeService.new
|
204
|
-
card = Hps::TestData.valid_visa
|
205
|
-
card.card_present = true
|
206
|
-
|
207
|
-
charge = service.charge(16.01, "usd", card, Hps::TestData.cert_cardholder_shortzip)
|
208
|
-
|
209
|
-
expect(charge).to_not be_nil
|
210
|
-
expect(charge.response_code).to eql("00")
|
211
|
-
end
|
212
|
-
|
213
|
-
it "should charge with card present and mastercard manual" do
|
214
|
-
Hps::TestHelper.valid_multi_use_config
|
215
|
-
service = Hps::HpsChargeService.new
|
216
|
-
card = Hps::TestData.valid_mastercard
|
217
|
-
card.card_present = true
|
218
|
-
|
219
|
-
charge = service.charge(16.02, "usd", card, Hps::TestData.cert_cardholder_shortzip_no_street)
|
220
|
-
|
221
|
-
expect(charge).to_not be_nil
|
222
|
-
expect(charge.response_code).to eql("00")
|
223
|
-
end
|
224
|
-
|
225
|
-
it "should charge with card present and discover manual" do
|
226
|
-
Hps::TestHelper.valid_multi_use_config
|
227
|
-
service = Hps::HpsChargeService.new
|
228
|
-
card = Hps::TestData.valid_discover
|
229
|
-
card.card_present = true
|
230
|
-
|
231
|
-
charge = service.charge(16.03, "usd", card, Hps::TestData.cert_cardholder_longzip_no_street)
|
232
|
-
|
233
|
-
expect(charge).to_not be_nil
|
234
|
-
expect(charge.response_code).to eql("00")
|
235
|
-
end
|
236
|
-
|
237
|
-
it "should charge with card present and amex manual" do
|
238
|
-
Hps::TestHelper.valid_multi_use_config
|
239
|
-
service = Hps::HpsChargeService.new
|
240
|
-
card = Hps::TestData.valid_amex
|
241
|
-
card.card_present = true
|
242
|
-
|
243
|
-
charge = service.charge(16.04, "usd", card, Hps::TestData.cert_cardholder_shortzip)
|
244
|
-
|
245
|
-
expect(charge).to_not be_nil
|
246
|
-
expect(charge.response_code).to eql("00")
|
247
|
-
end
|
248
|
-
|
249
|
-
it "should charge card present and with jcb manual" do
|
250
|
-
Hps::TestHelper.valid_multi_use_config
|
251
|
-
service = Hps::HpsChargeService.new
|
252
|
-
card = Hps::TestData.valid_jcb
|
253
|
-
card.card_present = true
|
254
|
-
|
255
|
-
charge = service.charge(16.05, "usd", card, Hps::TestData.cert_cardholder_longzip)
|
256
|
-
|
257
|
-
expect(charge).to_not be_nil
|
258
|
-
expect(charge.response_code).to eql("00")
|
259
|
-
end
|
260
|
-
|
261
|
-
it "should charge with card not present and visa manual" do
|
262
|
-
Hps::TestHelper.valid_multi_use_config
|
263
|
-
service = Hps::HpsChargeService.new
|
264
|
-
card = Hps::TestData.valid_visa
|
265
|
-
card.card_present = true
|
266
|
-
|
267
|
-
charge = service.charge(17.01, "usd", card, Hps::TestData.cert_cardholder_shortzip)
|
268
|
-
|
269
|
-
expect(charge).to_not be_nil
|
270
|
-
expect(charge.response_code).to eql("00")
|
271
|
-
end
|
272
|
-
|
273
|
-
it "should charge with card not present and mastercard manual" do
|
274
|
-
Hps::TestHelper.valid_multi_use_config
|
275
|
-
service = Hps::HpsChargeService.new
|
276
|
-
card = Hps::TestData.valid_mastercard
|
277
|
-
card.card_present = true
|
278
|
-
|
279
|
-
charge = service.charge(17.02, "usd", card, Hps::TestData.cert_cardholder_shortzip_no_street)
|
280
|
-
|
281
|
-
expect(charge).to_not be_nil
|
282
|
-
expect(charge.response_code).to eql("00")
|
283
|
-
end
|
284
|
-
|
285
|
-
it "should charge with card not present and discover manual" do
|
286
|
-
Hps::TestHelper.valid_multi_use_config
|
287
|
-
service = Hps::HpsChargeService.new
|
288
|
-
card = Hps::TestData.valid_discover
|
289
|
-
card.card_present = true
|
290
|
-
|
291
|
-
charge = service.charge(17.03, "usd", card, Hps::TestData.cert_cardholder_longzip_no_street)
|
292
|
-
|
293
|
-
expect(charge).to_not be_nil
|
294
|
-
expect(charge.response_code).to eql("00")
|
295
|
-
end
|
296
|
-
|
297
|
-
it "should charge with card not present and amex manual" do
|
298
|
-
Hps::TestHelper.valid_multi_use_config
|
299
|
-
service = Hps::HpsChargeService.new
|
300
|
-
card = Hps::TestData.valid_amex
|
301
|
-
card.card_present = true
|
302
|
-
|
303
|
-
charge = service.charge(17.04, "usd", card, Hps::TestData.cert_cardholder_shortzip)
|
304
|
-
|
305
|
-
expect(charge).to_not be_nil
|
306
|
-
expect(charge.response_code).to eql("00")
|
307
|
-
end
|
308
|
-
|
309
|
-
it "should charge card not present and with jcb manual" do
|
310
|
-
Hps::TestHelper.valid_multi_use_config
|
311
|
-
service = Hps::HpsChargeService.new
|
312
|
-
card = Hps::TestData.valid_jcb
|
313
|
-
card.card_present = true
|
314
|
-
|
315
|
-
charge = service.charge(17.05, "usd", card, Hps::TestData.cert_cardholder_longzip)
|
316
|
-
|
317
|
-
expect(charge).to_not be_nil
|
318
|
-
expect(charge.response_code).to eql("00")
|
319
|
-
end
|
320
|
-
end
|
1
|
+
require File.join( File.dirname(File.dirname(__FILE__)), "test_helper" )
|
2
|
+
|
3
|
+
describe "Card Present Certification Tests" do
|
4
|
+
let(:test_descriptor) { "Heartland, Inc." }
|
5
|
+
let(:visa_swipe) { '%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?' }
|
6
|
+
let(:mastercard_swipe) { '%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?' }
|
7
|
+
let(:discover_swipe) { '%B6011000990156527^DIS TEST CARD^25121011000062111401?;6011000990156527=25121011000062111401?' }
|
8
|
+
let(:amex_swipe) { '%B3727 006992 51018^AMEX TEST CARD^2512990502700?;372700699251018=2512990502700?' }
|
9
|
+
|
10
|
+
it "should close batch ok" do
|
11
|
+
Hps::TestHelper.valid_multi_use_config
|
12
|
+
service = Hps::HpsBatchService.new
|
13
|
+
|
14
|
+
response = service.close_batch()
|
15
|
+
|
16
|
+
expect(response).to_not be_nil
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should verify with visa swipe" do
|
20
|
+
Hps::TestHelper.valid_multi_use_config
|
21
|
+
service = Hps::HpsChargeService.new
|
22
|
+
track_data = Hps::HpsTrackData.new
|
23
|
+
track_data.value = visa_swipe
|
24
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
25
|
+
|
26
|
+
verify = service.verify_swipe(track_data)
|
27
|
+
|
28
|
+
expect(verify).to_not be(nil)
|
29
|
+
expect(verify.response_code).to eql("85")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should verify with mastercard swipe" do
|
33
|
+
Hps::TestHelper.valid_multi_use_config
|
34
|
+
service = Hps::HpsChargeService.new
|
35
|
+
track_data = Hps::HpsTrackData.new
|
36
|
+
track_data.value = mastercard_swipe
|
37
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
38
|
+
|
39
|
+
verify = service.verify_swipe(track_data)
|
40
|
+
|
41
|
+
expect(verify).to_not be(nil)
|
42
|
+
expect(verify.response_code).to eql("85")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should verify with discover swipe" do
|
46
|
+
Hps::TestHelper.valid_multi_use_config
|
47
|
+
service = Hps::HpsChargeService.new
|
48
|
+
track_data = Hps::HpsTrackData.new
|
49
|
+
track_data.value = discover_swipe
|
50
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
51
|
+
|
52
|
+
verify = service.verify_swipe(track_data)
|
53
|
+
|
54
|
+
expect(verify).to_not be(nil)
|
55
|
+
expect(verify.response_code).to eql("85")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should verify with amex swipe" do
|
59
|
+
Hps::TestHelper.valid_multi_use_config
|
60
|
+
service = Hps::HpsChargeService.new
|
61
|
+
track_data = Hps::HpsTrackData.new
|
62
|
+
track_data.value = amex_swipe
|
63
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
64
|
+
|
65
|
+
verify = service.verify(Hps::TestData.valid_amex, Hps::TestData.cert_cardholder_shortzip)
|
66
|
+
|
67
|
+
expect(verify).to_not be(nil)
|
68
|
+
expect(verify.response_code).to eql("00")
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should charge with token req and visa swipe" do
|
72
|
+
Hps::TestHelper.valid_multi_use_config
|
73
|
+
service = Hps::HpsChargeService.new
|
74
|
+
track_data = Hps::HpsTrackData.new
|
75
|
+
track_data.value = visa_swipe
|
76
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
77
|
+
|
78
|
+
charge = service.charge_swipe(15.01, "usd", track_data, nil, 0, false, true)
|
79
|
+
|
80
|
+
expect(charge).to_not be_nil
|
81
|
+
expect(charge.response_code).to eql("00")
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should charge with token req and mastercard swipe" do
|
85
|
+
Hps::TestHelper.valid_multi_use_config
|
86
|
+
service = Hps::HpsChargeService.new
|
87
|
+
track_data = Hps::HpsTrackData.new
|
88
|
+
track_data.value = mastercard_swipe
|
89
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
90
|
+
|
91
|
+
charge = service.charge_swipe(15.02, "usd", track_data, nil, 0, false, true)
|
92
|
+
|
93
|
+
expect(charge).to_not be_nil
|
94
|
+
expect(charge.response_code).to eql("00")
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should charge with token req and discover swipe" do
|
98
|
+
Hps::TestHelper.valid_multi_use_config
|
99
|
+
service = Hps::HpsChargeService.new
|
100
|
+
track_data = Hps::HpsTrackData.new
|
101
|
+
track_data.value = discover_swipe
|
102
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
103
|
+
|
104
|
+
charge = service.charge_swipe(15.03, "usd", track_data, nil, 0, false, true)
|
105
|
+
|
106
|
+
expect(charge).to_not be_nil
|
107
|
+
expect(charge.response_code).to eql("00")
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should charge with token req and amex swipe" do
|
111
|
+
Hps::TestHelper.valid_multi_use_config
|
112
|
+
service = Hps::HpsChargeService.new
|
113
|
+
track_data = Hps::HpsTrackData.new
|
114
|
+
track_data.value = amex_swipe
|
115
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
116
|
+
|
117
|
+
charge = service.charge_swipe(15.04, "usd", track_data, nil, 0, false, true)
|
118
|
+
|
119
|
+
expect(charge).to_not be_nil
|
120
|
+
expect(charge.response_code).to eql("00")
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should charge with visa swipe" do
|
124
|
+
Hps::TestHelper.valid_multi_use_config
|
125
|
+
service = Hps::HpsChargeService.new
|
126
|
+
track_data = Hps::HpsTrackData.new
|
127
|
+
track_data.value = visa_swipe
|
128
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
129
|
+
|
130
|
+
charge = service.charge_swipe(15.01, "usd", track_data)
|
131
|
+
|
132
|
+
expect(charge).to_not be_nil
|
133
|
+
expect(charge.response_code).to eql("00")
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should charge with mastercard swipe" do
|
137
|
+
Hps::TestHelper.valid_multi_use_config
|
138
|
+
service = Hps::HpsChargeService.new
|
139
|
+
track_data = Hps::HpsTrackData.new
|
140
|
+
track_data.value = mastercard_swipe
|
141
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
142
|
+
|
143
|
+
charge = service.charge_swipe(15.02, "usd", track_data)
|
144
|
+
|
145
|
+
expect(charge).to_not be_nil
|
146
|
+
expect(charge.response_code).to eql("00")
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should charge with discover swipe" do
|
150
|
+
Hps::TestHelper.valid_multi_use_config
|
151
|
+
service = Hps::HpsChargeService.new
|
152
|
+
track_data = Hps::HpsTrackData.new
|
153
|
+
track_data.value = discover_swipe
|
154
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
155
|
+
|
156
|
+
charge = service.charge_swipe(15.03, "usd", track_data)
|
157
|
+
|
158
|
+
expect(charge).to_not be_nil
|
159
|
+
expect(charge.response_code).to eql("00")
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should charge with amex swipe" do
|
163
|
+
Hps::TestHelper.valid_multi_use_config
|
164
|
+
service = Hps::HpsChargeService.new
|
165
|
+
track_data = Hps::HpsTrackData.new
|
166
|
+
track_data.value = amex_swipe
|
167
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
168
|
+
|
169
|
+
charge = service.charge_swipe(15.04, "usd", track_data)
|
170
|
+
|
171
|
+
expect(charge).to_not be_nil
|
172
|
+
expect(charge.response_code).to eql("00")
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should charge with discover jcb swipe" do
|
176
|
+
Hps::TestHelper.valid_multi_use_config
|
177
|
+
service = Hps::HpsChargeService.new
|
178
|
+
track_data = Hps::HpsTrackData.new
|
179
|
+
track_data.value = "%B6011000990156527^DIS TEST CARD^25121011000062111401?;6011000990156527=25121011000062111401?"
|
180
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
181
|
+
|
182
|
+
charge = service.charge_swipe(15.04, "usd", track_data)
|
183
|
+
|
184
|
+
expect(charge).to_not be_nil
|
185
|
+
expect(charge.response_code).to eql("00")
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should charge with visa swipe" do
|
189
|
+
Hps::TestHelper.valid_multi_use_config
|
190
|
+
service = Hps::HpsChargeService.new
|
191
|
+
track_data = Hps::HpsTrackData.new
|
192
|
+
track_data.value = visa_swipe
|
193
|
+
track_data.method_obtained = Hps::HpsTrackDataMethod::SWIPE
|
194
|
+
|
195
|
+
charge = service.charge_swipe(15.06, "usd", track_data)
|
196
|
+
|
197
|
+
expect(charge).to_not be_nil
|
198
|
+
expect(charge.response_code).to eql("00")
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should charge with card present and visa manual" do
|
202
|
+
Hps::TestHelper.valid_multi_use_config
|
203
|
+
service = Hps::HpsChargeService.new
|
204
|
+
card = Hps::TestData.valid_visa
|
205
|
+
card.card_present = true
|
206
|
+
|
207
|
+
charge = service.charge(16.01, "usd", card, Hps::TestData.cert_cardholder_shortzip)
|
208
|
+
|
209
|
+
expect(charge).to_not be_nil
|
210
|
+
expect(charge.response_code).to eql("00")
|
211
|
+
end
|
212
|
+
|
213
|
+
it "should charge with card present and mastercard manual" do
|
214
|
+
Hps::TestHelper.valid_multi_use_config
|
215
|
+
service = Hps::HpsChargeService.new
|
216
|
+
card = Hps::TestData.valid_mastercard
|
217
|
+
card.card_present = true
|
218
|
+
|
219
|
+
charge = service.charge(16.02, "usd", card, Hps::TestData.cert_cardholder_shortzip_no_street)
|
220
|
+
|
221
|
+
expect(charge).to_not be_nil
|
222
|
+
expect(charge.response_code).to eql("00")
|
223
|
+
end
|
224
|
+
|
225
|
+
it "should charge with card present and discover manual" do
|
226
|
+
Hps::TestHelper.valid_multi_use_config
|
227
|
+
service = Hps::HpsChargeService.new
|
228
|
+
card = Hps::TestData.valid_discover
|
229
|
+
card.card_present = true
|
230
|
+
|
231
|
+
charge = service.charge(16.03, "usd", card, Hps::TestData.cert_cardholder_longzip_no_street)
|
232
|
+
|
233
|
+
expect(charge).to_not be_nil
|
234
|
+
expect(charge.response_code).to eql("00")
|
235
|
+
end
|
236
|
+
|
237
|
+
it "should charge with card present and amex manual" do
|
238
|
+
Hps::TestHelper.valid_multi_use_config
|
239
|
+
service = Hps::HpsChargeService.new
|
240
|
+
card = Hps::TestData.valid_amex
|
241
|
+
card.card_present = true
|
242
|
+
|
243
|
+
charge = service.charge(16.04, "usd", card, Hps::TestData.cert_cardholder_shortzip)
|
244
|
+
|
245
|
+
expect(charge).to_not be_nil
|
246
|
+
expect(charge.response_code).to eql("00")
|
247
|
+
end
|
248
|
+
|
249
|
+
it "should charge card present and with jcb manual" do
|
250
|
+
Hps::TestHelper.valid_multi_use_config
|
251
|
+
service = Hps::HpsChargeService.new
|
252
|
+
card = Hps::TestData.valid_jcb
|
253
|
+
card.card_present = true
|
254
|
+
|
255
|
+
charge = service.charge(16.05, "usd", card, Hps::TestData.cert_cardholder_longzip)
|
256
|
+
|
257
|
+
expect(charge).to_not be_nil
|
258
|
+
expect(charge.response_code).to eql("00")
|
259
|
+
end
|
260
|
+
|
261
|
+
it "should charge with card not present and visa manual" do
|
262
|
+
Hps::TestHelper.valid_multi_use_config
|
263
|
+
service = Hps::HpsChargeService.new
|
264
|
+
card = Hps::TestData.valid_visa
|
265
|
+
card.card_present = true
|
266
|
+
|
267
|
+
charge = service.charge(17.01, "usd", card, Hps::TestData.cert_cardholder_shortzip)
|
268
|
+
|
269
|
+
expect(charge).to_not be_nil
|
270
|
+
expect(charge.response_code).to eql("00")
|
271
|
+
end
|
272
|
+
|
273
|
+
it "should charge with card not present and mastercard manual" do
|
274
|
+
Hps::TestHelper.valid_multi_use_config
|
275
|
+
service = Hps::HpsChargeService.new
|
276
|
+
card = Hps::TestData.valid_mastercard
|
277
|
+
card.card_present = true
|
278
|
+
|
279
|
+
charge = service.charge(17.02, "usd", card, Hps::TestData.cert_cardholder_shortzip_no_street)
|
280
|
+
|
281
|
+
expect(charge).to_not be_nil
|
282
|
+
expect(charge.response_code).to eql("00")
|
283
|
+
end
|
284
|
+
|
285
|
+
it "should charge with card not present and discover manual" do
|
286
|
+
Hps::TestHelper.valid_multi_use_config
|
287
|
+
service = Hps::HpsChargeService.new
|
288
|
+
card = Hps::TestData.valid_discover
|
289
|
+
card.card_present = true
|
290
|
+
|
291
|
+
charge = service.charge(17.03, "usd", card, Hps::TestData.cert_cardholder_longzip_no_street)
|
292
|
+
|
293
|
+
expect(charge).to_not be_nil
|
294
|
+
expect(charge.response_code).to eql("00")
|
295
|
+
end
|
296
|
+
|
297
|
+
it "should charge with card not present and amex manual" do
|
298
|
+
Hps::TestHelper.valid_multi_use_config
|
299
|
+
service = Hps::HpsChargeService.new
|
300
|
+
card = Hps::TestData.valid_amex
|
301
|
+
card.card_present = true
|
302
|
+
|
303
|
+
charge = service.charge(17.04, "usd", card, Hps::TestData.cert_cardholder_shortzip)
|
304
|
+
|
305
|
+
expect(charge).to_not be_nil
|
306
|
+
expect(charge.response_code).to eql("00")
|
307
|
+
end
|
308
|
+
|
309
|
+
it "should charge card not present and with jcb manual" do
|
310
|
+
Hps::TestHelper.valid_multi_use_config
|
311
|
+
service = Hps::HpsChargeService.new
|
312
|
+
card = Hps::TestData.valid_jcb
|
313
|
+
card.card_present = true
|
314
|
+
|
315
|
+
charge = service.charge(17.05, "usd", card, Hps::TestData.cert_cardholder_longzip)
|
316
|
+
|
317
|
+
expect(charge).to_not be_nil
|
318
|
+
expect(charge.response_code).to eql("00")
|
319
|
+
end
|
320
|
+
end
|