LitleOnline 8.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/DESCRIPTION +5 -0
  2. data/LICENSE +22 -0
  3. data/README.md +69 -0
  4. data/Rakefile +92 -0
  5. data/SETUP.md +47 -0
  6. data/bin/Setup.rb +103 -0
  7. data/bin/sample_driver.rb +49 -0
  8. data/index.html +176 -0
  9. data/index.html.1 +176 -0
  10. data/lib/Checker.rb +56 -0
  11. data/lib/Communications.rb +85 -0
  12. data/lib/Configuration.rb +45 -0
  13. data/lib/LitleOnline.rb +52 -0
  14. data/lib/LitleOnlineRequest.rb +399 -0
  15. data/lib/LitleXmlMapper.rb +48 -0
  16. data/lib/Obj2xml.rb +37 -0
  17. data/lib/XMLFields.rb +378 -0
  18. data/test/certification/certTest1_base.rb +948 -0
  19. data/test/certification/certTest2_authenhanced.rb +571 -0
  20. data/test/certification/certTest3_authreversal.rb +184 -0
  21. data/test/certification/certTest4_echeck.rb +279 -0
  22. data/test/certification/certTest5_token.rb +222 -0
  23. data/test/certification/ts_all.rb +31 -0
  24. data/test/functional/test_auth.rb +135 -0
  25. data/test/functional/test_authReversal.rb +68 -0
  26. data/test/functional/test_capture.rb +71 -0
  27. data/test/functional/test_captureGivenAuth.rb +161 -0
  28. data/test/functional/test_credit.rb +154 -0
  29. data/test/functional/test_echeckCredit.rb +116 -0
  30. data/test/functional/test_echeckRedeposit.rb +78 -0
  31. data/test/functional/test_echeckSale.rb +157 -0
  32. data/test/functional/test_echeckVerification.rb +92 -0
  33. data/test/functional/test_forceCapture.rb +105 -0
  34. data/test/functional/test_sale.rb +198 -0
  35. data/test/functional/test_token.rb +102 -0
  36. data/test/functional/test_xmlfields.rb +403 -0
  37. data/test/functional/ts_all.rb +39 -0
  38. data/test/unit/test_Checker.rb +58 -0
  39. data/test/unit/test_LitleOnlineRequest.rb +288 -0
  40. data/test/unit/test_auth.rb +168 -0
  41. data/test/unit/test_authReversal.rb +41 -0
  42. data/test/unit/test_capture.rb +40 -0
  43. data/test/unit/test_captureGivenAuth.rb +108 -0
  44. data/test/unit/test_credit.rb +117 -0
  45. data/test/unit/test_echeckCredit.rb +45 -0
  46. data/test/unit/test_echeckRedeposit.rb +76 -0
  47. data/test/unit/test_echeckSale.rb +45 -0
  48. data/test/unit/test_echeckVerification.rb +75 -0
  49. data/test/unit/test_forceCapture.rb +122 -0
  50. data/test/unit/test_sale.rb +249 -0
  51. data/test/unit/test_token.rb +70 -0
  52. data/test/unit/test_xmlfields.rb +173 -0
  53. data/test/unit/ts_unit.rb +41 -0
  54. metadata +166 -0
@@ -0,0 +1,948 @@
1
+ require 'lib/LitleOnline'
2
+
3
+ #require 'Litle_activemerchant'
4
+ require 'test/unit'
5
+
6
+ class Litle_certTest < Test::Unit::TestCase
7
+ @@merchant_hash = {'reportGroup'=>'Planets',
8
+ 'merchantId'=>'101'
9
+ }
10
+ def test_1_Auth
11
+ customer_hash = {
12
+ 'orderId' => '1',
13
+ 'amount' => '10010',
14
+ 'orderSource'=>'ecommerce',
15
+ 'billToAddress'=>{
16
+ 'name' => 'John Smith',
17
+ 'addressLine1' => '1 Main St.',
18
+ 'city' => 'Burlington',
19
+ 'state' => 'MA',
20
+ 'zip' => '01803-3747',
21
+ 'country' => 'US'},
22
+ 'card'=>{
23
+ 'number' =>'4457010000000009',
24
+ 'expDate' => '0112',
25
+ 'cardValidationNum' => '349',
26
+ 'type' => 'VI'}
27
+ }
28
+ hash = customer_hash.merge(@@merchant_hash)
29
+ auth_response = LitleOnlineRequest.new.authorization(hash)
30
+ assert_equal('000', auth_response.authorizationResponse.response)
31
+ assert_equal('Approved', auth_response.authorizationResponse.message)
32
+ assert_equal('11111 ', auth_response.authorizationResponse.authCode)
33
+ assert_equal('01', auth_response.authorizationResponse.fraudResult.avsResult)
34
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
35
+
36
+ #test 1A
37
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
38
+ hash1a = capture_hash.merge(@@merchant_hash)
39
+ capture_response = LitleOnlineRequest.new.capture(hash1a)
40
+ assert_equal('000', capture_response.captureResponse.response)
41
+ assert_equal('Approved', capture_response.captureResponse.message)
42
+
43
+ #test 1B
44
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
45
+ hash1b = credit_hash.merge(@@merchant_hash)
46
+ credit_response = LitleOnlineRequest.new.credit(hash1b)
47
+ assert_equal('000', credit_response.creditResponse.response)
48
+ assert_equal('Approved', credit_response.creditResponse.message)
49
+
50
+ #test1C
51
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
52
+ hash1c = void_hash.merge(@@merchant_hash)
53
+ void_response = LitleOnlineRequest.new.void(hash1c)
54
+ assert_equal('000', void_response.voidResponse.response)
55
+ assert_equal('Approved', void_response.voidResponse.message)
56
+ end
57
+
58
+ def test_1_AVS
59
+ customer_hash = {
60
+ 'orderId' => '1',
61
+ 'amount' => '000',
62
+ 'orderSource'=>'ecommerce',
63
+ 'billToAddress'=>{
64
+ 'name' => 'John Smith',
65
+ 'addressLine1' => '1 Main St.',
66
+ 'city' => 'Burlington',
67
+ 'state' => 'MA',
68
+ 'zip' => '01803-3747',
69
+ 'country' => 'US'},
70
+ 'card'=>{
71
+ 'number' =>'4457010000000009',
72
+ 'expDate' => '0112',
73
+ 'cardValidationNum' => '349',
74
+ 'type' => 'VI'}
75
+ }
76
+ hash = customer_hash.merge(@@merchant_hash)
77
+ auth_response = LitleOnlineRequest.new.authorization(hash)
78
+ assert_equal('000', auth_response.authorizationResponse.response)
79
+ assert_equal('Approved', auth_response.authorizationResponse.message)
80
+ assert_equal('11111 ', auth_response.authorizationResponse.authCode)
81
+ assert_equal('01', auth_response.authorizationResponse.fraudResult.avsResult)
82
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
83
+ end
84
+
85
+ def test_1_Sale
86
+ customer_hash = {
87
+ 'orderId' => '1',
88
+ 'amount' => '10010',
89
+ 'orderSource'=>'ecommerce',
90
+ 'billToAddress'=>{
91
+ 'name' => 'John Smith',
92
+ 'addressLine1' => '1 Main St.',
93
+ 'city' => 'Burlington',
94
+ 'state' => 'MA',
95
+ 'zip' => '01803-3747',
96
+ 'country' => 'US'},
97
+ 'card'=>{
98
+ 'number' =>'4457010000000009',
99
+ 'expDate' => '0112',
100
+ 'cardValidationNum' => '349',
101
+ 'type' => 'VI'}
102
+ }
103
+ hash = customer_hash.merge(@@merchant_hash)
104
+ sale_response = LitleOnlineRequest.new.sale(hash)
105
+ assert_equal('000', sale_response.saleResponse.response)
106
+ assert_equal('Approved', sale_response.saleResponse.message)
107
+ assert_equal('11111 ', sale_response.saleResponse.authCode)
108
+ assert_equal('01', sale_response.saleResponse.fraudResult.avsResult)
109
+ assert_equal('M', sale_response.saleResponse.fraudResult.cardValidationResult)
110
+
111
+ #test 1B
112
+ credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
113
+ hash1b = credit_hash.merge(@@merchant_hash)
114
+ credit_response = LitleOnlineRequest.new.credit(hash1b)
115
+ assert_equal('000', credit_response.creditResponse.response)
116
+ assert_equal('Approved', credit_response.creditResponse.message)
117
+
118
+ #test1C
119
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
120
+ hash1c = void_hash.merge(@@merchant_hash)
121
+ void_response = LitleOnlineRequest.new.void(hash1c)
122
+ assert_equal('000', void_response.voidResponse.response)
123
+ assert_equal('Approved', void_response.voidResponse.message)
124
+ end
125
+
126
+
127
+ def test_2_Auth
128
+ customer_hash = {
129
+ 'orderId' => '2',
130
+ 'amount' => '20020',
131
+ 'orderSource'=>'ecommerce',
132
+ 'billToAddress'=>{
133
+ 'name' => 'Mike J. Hammer',
134
+ 'addressLine1' => '2 Main St.',
135
+ 'addressLine2' => 'Apt. 222',
136
+ 'city' => 'Riverside',
137
+ 'state' => 'RI',
138
+ 'zip' => '02915',
139
+ 'country' => 'US'},
140
+ 'card'=>{
141
+ 'number' =>'5112010000000003',
142
+ 'expDate' => '0212',
143
+ 'cardValidationNum' => '261',
144
+ 'type' => 'MC'
145
+ },
146
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
147
+ }
148
+ hash = customer_hash.merge(@@merchant_hash)
149
+ auth_response = LitleOnlineRequest.new.authorization(hash)
150
+ assert_equal('000', auth_response.authorizationResponse.response)
151
+ assert_equal('Approved', auth_response.authorizationResponse.message)
152
+ assert_equal('22222', auth_response.authorizationResponse.authCode)
153
+ assert_equal('10', auth_response.authorizationResponse.fraudResult.avsResult)
154
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
155
+
156
+ #test 2A
157
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
158
+ hash2a = capture_hash.merge(@@merchant_hash)
159
+ capture_response = LitleOnlineRequest.new.capture(hash2a)
160
+ assert_equal('000', capture_response.captureResponse.response)
161
+ assert_equal('Approved', capture_response.captureResponse.message)
162
+
163
+ #test 2B
164
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
165
+ hash2b = credit_hash.merge(@@merchant_hash)
166
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
167
+ assert_equal('000', credit_response.creditResponse.response)
168
+ assert_equal('Approved', credit_response.creditResponse.message)
169
+
170
+ #test 2C
171
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
172
+ hash2c = void_hash.merge(@@merchant_hash)
173
+ void_response = LitleOnlineRequest.new.void(hash2c)
174
+ assert_equal('000', void_response.voidResponse.response)
175
+ assert_equal('Approved', void_response.voidResponse.message)
176
+ end
177
+
178
+ def test_2_Avs
179
+ customer_hash = {
180
+ 'orderId' => '2',
181
+ 'amount' => '000',
182
+ 'orderSource'=>'ecommerce',
183
+ 'billToAddress'=>{
184
+ 'name' => 'Mike J. Hammer',
185
+ 'addressLine1' => '2 Main St.',
186
+ 'addressLine2' => 'Apt. 222',
187
+ 'city' => 'Riverside',
188
+ 'state' => 'RI',
189
+ 'zip' => '02915',
190
+ 'country' => 'US'},
191
+ 'card'=>{
192
+ 'number' =>'5112010000000003',
193
+ 'expDate' => '0212',
194
+ 'cardValidationNum' => '261',
195
+ 'type' => 'MC'
196
+ },
197
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
198
+ }
199
+ hash = customer_hash.merge(@@merchant_hash)
200
+ auth_response = LitleOnlineRequest.new.authorization(hash)
201
+ assert_equal('000', auth_response.authorizationResponse.response)
202
+ assert_equal('Approved', auth_response.authorizationResponse.message)
203
+ assert_equal('22222', auth_response.authorizationResponse.authCode)
204
+ assert_equal('10', auth_response.authorizationResponse.fraudResult.avsResult)
205
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
206
+ end
207
+
208
+ def test_2_Sale
209
+ customer_hash = {
210
+ 'orderId' => '2',
211
+ 'amount' => '20020',
212
+ 'orderSource'=>'ecommerce',
213
+ 'billToAddress'=>{
214
+ 'name' => 'Mike J. Hammer',
215
+ 'addressLine1' => '2 Main St.',
216
+ 'addressLine2' => 'Apt. 222',
217
+ 'city' => 'Riverside',
218
+ 'state' => 'RI',
219
+ 'zip' => '02915',
220
+ 'country' => 'US'},
221
+ 'card'=>{
222
+ 'number' =>'5112010000000003',
223
+ 'expDate' => '0212',
224
+ 'cardValidationNum' => '261',
225
+ 'type' => 'MC'
226
+ },
227
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
228
+ }
229
+ hash = customer_hash.merge(@@merchant_hash)
230
+ sale_response = LitleOnlineRequest.new.sale(hash)
231
+ assert_equal('000', sale_response.saleResponse.response)
232
+ assert_equal('Approved', sale_response.saleResponse.message)
233
+ assert_equal('22222', sale_response.saleResponse.authCode)
234
+ assert_equal('10', sale_response.saleResponse.fraudResult.avsResult)
235
+ assert_equal('M', sale_response.saleResponse.fraudResult.cardValidationResult)
236
+
237
+ #test 2B
238
+ credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
239
+ hash2b = credit_hash.merge(@@merchant_hash)
240
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
241
+ assert_equal('000', credit_response.creditResponse.response)
242
+ assert_equal('Approved', credit_response.creditResponse.message)
243
+
244
+ #test 2C
245
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
246
+ hash2c = void_hash.merge(@@merchant_hash)
247
+ void_response = LitleOnlineRequest.new.void(hash2c)
248
+ assert_equal('000', void_response.voidResponse.response)
249
+ assert_equal('Approved', void_response.voidResponse.message)
250
+ end
251
+
252
+ def test_3_Auth
253
+ customer_hash = {
254
+ 'orderId' => '3',
255
+ 'amount' => '30030',
256
+ 'orderSource'=>'ecommerce',
257
+ 'billToAddress'=>{
258
+ 'name' => 'Eileen Jones',
259
+ 'addressLine1' => '3 Main St.',
260
+ 'city' => 'Bloomfield',
261
+ 'state' => 'CT',
262
+ 'zip' => '06002',
263
+ 'country' => 'US'},
264
+ 'card'=>{
265
+ 'number' =>'6011010000000003',
266
+ 'expDate' => '0312',
267
+ 'type' => 'DI',
268
+ 'cardValidationNum' => '758'},
269
+ }
270
+ hash = customer_hash.merge(@@merchant_hash)
271
+ auth_response = LitleOnlineRequest.new.authorization(hash)
272
+ assert_equal('000', auth_response.authorizationResponse.response)
273
+ assert_equal('Approved', auth_response.authorizationResponse.message)
274
+ assert_equal('33333', auth_response.authorizationResponse.authCode)
275
+ assert_equal('10', auth_response.authorizationResponse.fraudResult.avsResult)
276
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
277
+
278
+ #test 3A
279
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
280
+ hash2a = capture_hash.merge(@@merchant_hash)
281
+ capture_response = LitleOnlineRequest.new.capture(hash2a)
282
+ assert_equal('000', capture_response.captureResponse.response)
283
+ assert_equal('Approved', capture_response.captureResponse.message)
284
+
285
+
286
+ #test 3B
287
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
288
+ hash2b = credit_hash.merge(@@merchant_hash)
289
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
290
+ assert_equal('000', credit_response.creditResponse.response)
291
+ assert_equal('Approved', credit_response.creditResponse.message)
292
+
293
+ #test 3C
294
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
295
+ hash2c = void_hash.merge(@@merchant_hash)
296
+ void_response = LitleOnlineRequest.new.void(hash2c)
297
+ assert_equal('000', void_response.voidResponse.response)
298
+ assert_equal('Approved', void_response.voidResponse.message)
299
+ end
300
+
301
+ def test_3_Avs
302
+ customer_hash = {
303
+ 'orderId' => '3',
304
+ 'amount' => '000',
305
+ 'orderSource'=>'ecommerce',
306
+ 'billToAddress'=>{
307
+ 'name' => 'Eileen Jones',
308
+ 'addressLine1' => '3 Main St.',
309
+ 'city' => 'Bloomfield',
310
+ 'state' => 'CT',
311
+ 'zip' => '06002',
312
+ 'country' => 'US'},
313
+ 'card'=>{
314
+ 'number' =>'6011010000000003',
315
+ 'expDate' => '0312',
316
+ 'type' => 'DI',
317
+ 'cardValidationNum' => '758'},
318
+ }
319
+ hash = customer_hash.merge(@@merchant_hash)
320
+ auth_response = LitleOnlineRequest.new.authorization(hash)
321
+ assert_equal('000', auth_response.authorizationResponse.response)
322
+ assert_equal('Approved', auth_response.authorizationResponse.message)
323
+ assert_equal('33333', auth_response.authorizationResponse.authCode)
324
+ assert_equal('10', auth_response.authorizationResponse.fraudResult.avsResult)
325
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
326
+ end
327
+
328
+ def test_3_Sale
329
+ customer_hash = {
330
+ 'orderId' => '3',
331
+ 'amount' => '30030',
332
+ 'orderSource'=>'ecommerce',
333
+ 'billToAddress'=>{
334
+ 'name' => 'Eileen Jones',
335
+ 'addressLine1' => '3 Main St.',
336
+ 'city' => 'Bloomfield',
337
+ 'state' => 'CT',
338
+ 'zip' => '06002',
339
+ 'country' => 'US'},
340
+ 'card'=>{
341
+ 'number' =>'6011010000000003',
342
+ 'expDate' => '0312',
343
+ 'type' => 'DI',
344
+ 'cardValidationNum' => '758'},
345
+ }
346
+ hash = customer_hash.merge(@@merchant_hash)
347
+ sale_response = LitleOnlineRequest.new.sale(hash)
348
+ assert_equal('000', sale_response.saleResponse.response)
349
+ assert_equal('Approved', sale_response.saleResponse.message)
350
+ assert_equal('33333', sale_response.saleResponse.authCode)
351
+ assert_equal('10', sale_response.saleResponse.fraudResult.avsResult)
352
+ assert_equal('M', sale_response.saleResponse.fraudResult.cardValidationResult)
353
+
354
+ #test 3B
355
+ credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
356
+ hash2b = credit_hash.merge(@@merchant_hash)
357
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
358
+ assert_equal('000', credit_response.creditResponse.response)
359
+ assert_equal('Approved', credit_response.creditResponse.message)
360
+
361
+ #test 3C
362
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
363
+ hash2c = void_hash.merge(@@merchant_hash)
364
+ void_response = LitleOnlineRequest.new.void(hash2c)
365
+ assert_equal('000', void_response.voidResponse.response)
366
+ assert_equal('Approved', void_response.voidResponse.message)
367
+ end
368
+
369
+ def test_4_Auth
370
+ customer_hash = {
371
+ 'orderId' => '4',
372
+ 'amount' => '40040',
373
+ 'orderSource'=>'ecommerce',
374
+ 'billToAddress'=>{
375
+ 'name' => 'Bob Black',
376
+ 'addressLine1' => '4 Main St.',
377
+ 'city' => 'Laurel',
378
+ 'state' => 'MD',
379
+ 'zip' => '20708',
380
+ 'country' => 'US'},
381
+ 'card'=>{
382
+ 'number' =>'375001000000005',
383
+ 'expDate' => '0412',
384
+ 'type' => 'AX'
385
+ },
386
+ }
387
+ hash = customer_hash.merge(@@merchant_hash)
388
+ auth_response = LitleOnlineRequest.new.authorization(hash)
389
+ assert_equal('000', auth_response.authorizationResponse.response)
390
+ assert_equal('Approved', auth_response.authorizationResponse.message)
391
+ assert_equal('44444', auth_response.authorizationResponse.authCode)
392
+ assert_equal('12', auth_response.authorizationResponse.fraudResult.avsResult)
393
+
394
+ #test 4A
395
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
396
+ hash2a = capture_hash.merge(@@merchant_hash)
397
+ capture_response = LitleOnlineRequest.new.capture(hash2a)
398
+ #assert_equal('000', cardholderAuthenticationcapture_response.captureResponse.response)
399
+ assert_equal('Approved', capture_response.captureResponse.message)
400
+
401
+ #test 4B
402
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
403
+ hash2b = credit_hash.merge(@@merchant_hash)
404
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
405
+ assert_equal('000', credit_response.creditResponse.response)
406
+ assert_equal('Approved', credit_response.creditResponse.message)
407
+
408
+ #test 4C
409
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
410
+ hash2c = void_hash.merge(@@merchant_hash)
411
+ void_response = LitleOnlineRequest.new.void(hash2c)
412
+ assert_equal('000', void_response.voidResponse.response)
413
+ assert_equal('Approved', void_response.voidResponse.message)
414
+ end
415
+
416
+ def test_4_Avs
417
+ customer_hash = {
418
+ 'orderId' => '4',
419
+ 'amount' => '000',
420
+ 'orderSource'=>'ecommerce',
421
+ 'billToAddress'=>{
422
+ 'name' => 'Bob Black',
423
+ 'addressLine1' => '4 Main St.',
424
+ 'city' => 'Laurel',
425
+ 'state' => 'MD',
426
+ 'zip' => '20708',
427
+ 'country' => 'US'},
428
+ 'card'=>{
429
+ 'number' =>'375001000000005',
430
+ 'expDate' => '0412',
431
+ 'type' => 'AX'
432
+ },
433
+ }
434
+ hash = customer_hash.merge(@@merchant_hash)
435
+ auth_response = LitleOnlineRequest.new.authorization(hash)
436
+ assert_equal('000', auth_response.authorizationResponse.response)
437
+ assert_equal('Approved', auth_response.authorizationResponse.message)
438
+ assert_equal('44444', auth_response.authorizationResponse.authCode)
439
+ assert_equal('12', auth_response.authorizationResponse.fraudResult.avsResult)
440
+ end
441
+
442
+ def test_4_Sale
443
+ customer_hash = {
444
+ 'orderId' => '4',
445
+ 'amount' => '40040',
446
+ 'orderSource'=>'ecommerce',
447
+ 'billToAddress'=>{
448
+ 'name' => 'Bob Black',
449
+ 'addressLine1' => '4 Main St.',
450
+ 'city' => 'Laurel',
451
+ 'state' => 'MD',
452
+ 'zip' => '20708',
453
+ 'country' => 'US'},
454
+ 'card'=>{
455
+ 'number' =>'375001000000005',
456
+ 'expDate' => '0412',
457
+ 'type' => 'AX'
458
+ },
459
+ }
460
+ hash = customer_hash.merge(@@merchant_hash)
461
+ sale_response = LitleOnlineRequest.new.sale(hash)
462
+ assert_equal('000', sale_response.saleResponse.response)
463
+ assert_equal('Approved', sale_response.saleResponse.message)
464
+ assert_equal('44444', sale_response.saleResponse.authCode)
465
+ assert_equal('12', sale_response.saleResponse.fraudResult.avsResult)
466
+
467
+ #test 4B
468
+ credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
469
+ hash2b = credit_hash.merge(@@merchant_hash)
470
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
471
+ assert_equal('000', credit_response.creditResponse.response)
472
+ assert_equal('Approved', credit_response.creditResponse.message)
473
+
474
+ #test 4C
475
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
476
+ hash2c = void_hash.merge(@@merchant_hash)
477
+ void_response = LitleOnlineRequest.new.void(hash2c)
478
+ assert_equal('000', void_response.voidResponse.response)
479
+ assert_equal('Approved', void_response.voidResponse.message)
480
+ end
481
+
482
+ def test_5_Auth
483
+ customer_hash = {
484
+ 'orderId' => '5',
485
+ 'amount' => '50050',
486
+ 'orderSource'=>'ecommerce',
487
+ 'card'=>{
488
+ 'number' =>'4457010200000007',
489
+ 'expDate' => '0512',
490
+ 'cardValidationNum' => '463',
491
+ 'type' => 'VI'},
492
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
493
+ }
494
+ hash = customer_hash.merge(@@merchant_hash)
495
+ auth_response = LitleOnlineRequest.new.authorization(hash)
496
+ assert_equal('000', auth_response.authorizationResponse.response)
497
+ assert_equal('Approved', auth_response.authorizationResponse.message)
498
+ assert_equal('55555 ', auth_response.authorizationResponse.authCode)
499
+ assert_equal('32', auth_response.authorizationResponse.fraudResult.avsResult)
500
+ assert_equal('N', auth_response.authorizationResponse.fraudResult.cardValidationResult)
501
+
502
+ #test 5A
503
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
504
+ hash2a = capture_hash.merge(@@merchant_hash)
505
+ capture_response = LitleOnlineRequest.new.capture(hash2a)
506
+ assert_equal('000', capture_response.captureResponse.response)
507
+ assert_equal('Approved', capture_response.captureResponse.message)
508
+
509
+ #test 5B
510
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
511
+ hash2b = credit_hash.merge(@@merchant_hash)
512
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
513
+ assert_equal('000', credit_response.creditResponse.response)
514
+ assert_equal('Approved', credit_response.creditResponse.message)
515
+
516
+ #test 5C
517
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
518
+ hash2c = void_hash.merge(@@merchant_hash)
519
+ void_response = LitleOnlineRequest.new.void(hash2c)
520
+ assert_equal('000', void_response.voidResponse.response)
521
+ assert_equal('Approved', void_response.voidResponse.message)
522
+ end
523
+
524
+ def test_5_Avs
525
+ customer_hash = {
526
+ 'orderId' => '5',
527
+ 'amount' => '000',
528
+ 'orderSource'=>'ecommerce',
529
+ 'card'=>{
530
+ 'number' =>'4457010200000007',
531
+ 'expDate' => '0512',
532
+ 'cardValidationNum' => '463',
533
+ 'type' => 'VI'},
534
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
535
+ }
536
+ hash = customer_hash.merge(@@merchant_hash)
537
+ auth_response = LitleOnlineRequest.new.authorization(hash)
538
+ assert_equal('000', auth_response.authorizationResponse.response)
539
+ assert_equal('Approved', auth_response.authorizationResponse.message)
540
+ assert_equal('55555 ', auth_response.authorizationResponse.authCode)
541
+ assert_equal('32', auth_response.authorizationResponse.fraudResult.avsResult)
542
+ assert_equal('N', auth_response.authorizationResponse.fraudResult.cardValidationResult)
543
+ end
544
+
545
+ def test_5_Sale
546
+ customer_hash = {
547
+ 'orderId' => '5',
548
+ 'amount' => '50050',
549
+ 'orderSource'=>'ecommerce',
550
+ 'card'=>{
551
+ 'number' =>'4457010200000007',
552
+ 'expDate' => '0512',
553
+ 'cardValidationNum' => '463',
554
+ 'type' => 'VI'},
555
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
556
+ }
557
+ hash = customer_hash.merge(@@merchant_hash)
558
+ sale_response = LitleOnlineRequest.new.sale(hash)
559
+ assert_equal('000', sale_response.saleResponse.response)
560
+ assert_equal('Approved', sale_response.saleResponse.message)
561
+ assert_equal('55555 ', sale_response.saleResponse.authCode)
562
+ assert_equal('32', sale_response.saleResponse.fraudResult.avsResult)
563
+ assert_equal('N', sale_response.saleResponse.fraudResult.cardValidationResult)
564
+
565
+ #test 5B
566
+ credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
567
+ hash2b = credit_hash.merge(@@merchant_hash)
568
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
569
+ assert_equal('000', credit_response.creditResponse.response)
570
+ assert_equal('Approved', credit_response.creditResponse.message)
571
+
572
+ #test 5C
573
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
574
+ hash2c = void_hash.merge(@@merchant_hash)
575
+ void_response = LitleOnlineRequest.new.void(hash2c)
576
+ assert_equal('000', void_response.voidResponse.response)
577
+ assert_equal('Approved', void_response.voidResponse.message)
578
+ end
579
+
580
+ def test_6_Auth
581
+ customer_hash = {
582
+ 'orderId' => '6',
583
+ 'amount' => '60060',
584
+ 'orderSource'=>'ecommerce',
585
+ 'billToAddress'=>{
586
+ 'name' => 'Joe Green',
587
+ 'addressLine1' => '6 Main St.',
588
+ 'city' => 'Derry',
589
+ 'state' => 'NH',
590
+ 'zip' => '03038',
591
+ 'country' => 'US'},
592
+ 'card'=>{
593
+ 'number' =>'4457010100000008',
594
+ 'expDate' => '0612',
595
+ 'type' => 'VI',
596
+ 'cardValidationNum' => '992'}
597
+ }
598
+ hash = customer_hash.merge(@@merchant_hash)
599
+ auth_response = LitleOnlineRequest.new.authorization(hash)
600
+ assert_equal('110', auth_response.authorizationResponse.response)
601
+ assert_equal('Insufficient Funds', auth_response.authorizationResponse.message)
602
+ assert_equal('34', auth_response.authorizationResponse.fraudResult.avsResult)
603
+ assert_equal('P', auth_response.authorizationResponse.fraudResult.cardValidationResult)
604
+ end
605
+
606
+ def test_6_Sale
607
+ customer_hash = {
608
+ 'orderId' => '6',
609
+ 'amount' => '60060',
610
+ 'orderSource'=>'ecommerce',
611
+ 'billToAddress'=>{
612
+ 'name' => 'Joe Green',
613
+ 'addressLine1' => '6 Main St.',
614
+ 'city' => 'Derry',
615
+ 'state' => 'NH',
616
+ 'zip' => '03038',
617
+ 'country' => 'US'},
618
+ 'card'=>{
619
+ 'number' =>'4457010100000008',
620
+ 'expDate' => '0612',
621
+ 'type' => 'VI',
622
+ 'cardValidationNum' => '992'}
623
+ }
624
+ hash = customer_hash.merge(@@merchant_hash)
625
+ sale_response = LitleOnlineRequest.new.sale(hash)
626
+ assert_equal('110', sale_response.saleResponse.response)
627
+ assert_equal('Insufficient Funds', sale_response.saleResponse.message)
628
+ assert_equal('34', sale_response.saleResponse.fraudResult.avsResult)
629
+ assert_equal('P', sale_response.saleResponse.fraudResult.cardValidationResult)
630
+
631
+ #test 6A
632
+ void_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId }
633
+ hash6A = void_hash.merge(@@merchant_hash)
634
+ void_response = LitleOnlineRequest.new.void(hash6A)
635
+ assert_equal('360', void_response.voidResponse.response)
636
+ assert_equal('No transaction found with specified litleTxnId', void_response.voidResponse.message)
637
+ end
638
+
639
+
640
+ def test_7_Auth
641
+ customer_hash = {
642
+ 'orderId' => '7',
643
+ 'amount' => '70070',
644
+ 'orderSource'=>'ecommerce',
645
+ 'billToAddress'=>{
646
+ 'name' => 'Jane Murray',
647
+ 'addressLine1' => '7 Main St.',
648
+ 'city' => 'Amesbury',
649
+ 'state' => 'MA',
650
+ 'zip' => '01913',
651
+ 'country' => 'US'},
652
+ 'card'=>{
653
+ 'number' =>'5112010100000002',
654
+ 'expDate' => '0712',
655
+ 'cardValidationNum' => '251',
656
+ 'type' => 'MC'}
657
+ }
658
+ hash = customer_hash.merge(@@merchant_hash)
659
+ authorization_response = LitleOnlineRequest.new.authorization(hash)
660
+ assert_equal('301', authorization_response.authorizationResponse.response)
661
+ assert_equal('Invalid Account Number', authorization_response.authorizationResponse.message)
662
+ assert_equal('34', authorization_response.authorizationResponse.fraudResult.avsResult)
663
+ assert_equal('N', authorization_response.authorizationResponse.fraudResult.cardValidationResult)
664
+ end
665
+
666
+ def test_7_Avs
667
+ customer_hash = {
668
+ 'orderId' => '7',
669
+ 'amount' => '000',
670
+ 'orderSource'=>'ecommerce',
671
+ 'billToAddress'=>{
672
+ 'name' => 'Jane Murray',
673
+ 'addressLine1' => '7 Main St.',
674
+ 'city' => 'Amesbury',
675
+ 'state' => 'MA',
676
+ 'zip' => '01913',
677
+ 'country' => 'US'},
678
+ 'card'=>{
679
+ 'number' =>'5112010100000002',
680
+ 'expDate' => '0712',
681
+ 'cardValidationNum' => '251',
682
+ 'type' => 'MC'}
683
+ }
684
+ hash = customer_hash.merge(@@merchant_hash)
685
+ authorization_response = LitleOnlineRequest.new.authorization(hash)
686
+ assert_equal('301', authorization_response.authorizationResponse.response)
687
+ assert_equal('Invalid Account Number', authorization_response.authorizationResponse.message)
688
+ assert_equal('34', authorization_response.authorizationResponse.fraudResult.avsResult)
689
+ assert_equal('N', authorization_response.authorizationResponse.fraudResult.cardValidationResult)
690
+ end
691
+
692
+ def test_7_sale
693
+ customer_hash = {
694
+ 'orderId' => '7',
695
+ 'amount' => '70070',
696
+ 'orderSource'=>'ecommerce',
697
+ 'billToAddress'=>{
698
+ 'name' => 'Jane Murray',
699
+ 'addressLine1' => '7 Main St.',
700
+ 'city' => 'Amesbury',
701
+ 'state' => 'MA',
702
+ 'zip' => '01913',
703
+ 'country' => 'US'},
704
+ 'card'=>{
705
+ 'number' =>'5112010100000002',
706
+ 'expDate' => '0712',
707
+ 'cardValidationNum' => '251',
708
+ 'type' => 'MC'}
709
+ }
710
+ hash = customer_hash.merge(@@merchant_hash)
711
+ sale_response = LitleOnlineRequest.new.sale(hash)
712
+ assert_equal('301', sale_response.saleResponse.response)
713
+ assert_equal('Invalid Account Number', sale_response.saleResponse.message)
714
+ assert_equal('34', sale_response.saleResponse.fraudResult.avsResult)
715
+ assert_equal('N', sale_response.saleResponse.fraudResult.cardValidationResult)
716
+ end
717
+
718
+ def test_8_Auth
719
+ customer_hash = {
720
+ 'orderId' => '8',
721
+ 'amount' => '80080',
722
+ 'orderSource'=>'ecommerce',
723
+ 'billToAddress'=>{
724
+ 'name' => 'Mark Johnson',
725
+ 'addressLine1' => '8 Main St.',
726
+ 'city' => 'Manchester',
727
+ 'state' => 'NH',
728
+ 'zip' => '03101',
729
+ 'country' => 'US'},
730
+ 'card'=>{
731
+ 'number' =>'6011010100000002',
732
+ 'expDate' => '0812',
733
+ 'type' => 'DI',
734
+ 'cardValidationNum' => '184'}
735
+ }
736
+ hash = customer_hash.merge(@@merchant_hash)
737
+ auth_response = LitleOnlineRequest.new.authorization(hash)
738
+ assert_equal('123', auth_response.authorizationResponse.response)
739
+ assert_equal('Call Discover', auth_response.authorizationResponse.message)
740
+ assert_equal('P', auth_response.authorizationResponse.fraudResult.cardValidationResult)
741
+ assert_equal('34', auth_response.authorizationResponse.fraudResult.avsResult)
742
+ end
743
+
744
+ def test_8_Avs
745
+ customer_hash = {
746
+ 'orderId' => '8',
747
+ 'amount' => '000',
748
+ 'orderSource'=>'ecommerce',
749
+ 'billToAddress'=>{
750
+ 'name' => 'Mark Johnson',
751
+ 'addressLine1' => '8 Main St.',
752
+ 'city' => 'Manchester',
753
+ 'state' => 'NH',
754
+ 'zip' => '03101',
755
+ 'country' => 'US'},
756
+ 'card'=>{
757
+ 'number' =>'6011010100000002',
758
+ 'expDate' => '0812',
759
+ 'type' => 'DI',
760
+ 'cardValidationNum' => '184'}
761
+ }
762
+ hash = customer_hash.merge(@@merchant_hash)
763
+ auth_response = LitleOnlineRequest.new.authorization(hash)
764
+ assert_equal('123', auth_response.authorizationResponse.response)
765
+ assert_equal('Call Discover', auth_response.authorizationResponse.message)
766
+ assert_equal('P', auth_response.authorizationResponse.fraudResult.cardValidationResult)
767
+ assert_equal('34', auth_response.authorizationResponse.fraudResult.avsResult)
768
+ end
769
+
770
+ def test_8_Sale
771
+ customer_hash = {
772
+ 'orderId' => '8',
773
+ 'amount' => '80080',
774
+ 'orderSource'=>'ecommerce',
775
+ 'billToAddress'=>{
776
+ 'name' => 'Mark Johnson',
777
+ 'addressLine1' => '8 Main St.',
778
+ 'city' => 'Manchester',
779
+ 'state' => 'NH',
780
+ 'zip' => '03101',
781
+ 'country' => 'US'},
782
+ 'card'=>{
783
+ 'number' =>'6011010100000002',
784
+ 'expDate' => '0812',
785
+ 'type' => 'DI',
786
+ 'cardValidationNum' => '184'}
787
+ }
788
+ hash = customer_hash.merge(@@merchant_hash)
789
+ sale_response = LitleOnlineRequest.new.sale(hash)
790
+ assert_equal('123', sale_response.saleResponse.response)
791
+ assert_equal('Call Discover', sale_response.saleResponse.message)
792
+ assert_equal('P', sale_response.saleResponse.fraudResult.cardValidationResult)
793
+ assert_equal('34', sale_response.saleResponse.fraudResult.avsResult)
794
+ end
795
+
796
+ def test_9_auth
797
+ customer_hash = {
798
+ 'orderId' => '9',
799
+ 'amount' => '90090',
800
+ 'orderSource'=>'ecommerce',
801
+ 'billToAddress'=>{
802
+ 'name' => 'James Miller',
803
+ 'addressLine1' => '9 Main St.',
804
+ 'city' => 'Boston',
805
+ 'state' => 'MA',
806
+ 'zip' => '02134',
807
+ 'country' => 'US'},
808
+ 'card'=>{
809
+ 'number' =>'375001010000003',
810
+ 'expDate' => '0912',
811
+ 'cardValidationNum' => '0421',
812
+ 'type' => 'AX'
813
+ }
814
+ }
815
+ hash = customer_hash.merge(@@merchant_hash)
816
+ response = LitleOnlineRequest.new.authorization(hash)
817
+ assert_equal('303', response.authorizationResponse.response)
818
+ assert_equal('Pick Up Card', response.authorizationResponse.message)
819
+ assert_equal('34', response.authorizationResponse.fraudResult.avsResult)
820
+ end
821
+
822
+ def test_9_avs
823
+ customer_hash = {
824
+ 'orderId' => '9',
825
+ 'amount' => '000',
826
+ 'orderSource'=>'ecommerce',
827
+ 'billToAddress'=>{
828
+ 'name' => 'James Miller',
829
+ 'addressLine1' => '9 Main St.',
830
+ 'city' => 'Boston',
831
+ 'state' => 'MA',
832
+ 'zip' => '02134',
833
+ 'country' => 'US'},
834
+ 'card'=>{
835
+ 'number' =>'375001010000003',
836
+ 'expDate' => '0912',
837
+ 'cardValidationNum' => '0421',
838
+ 'type' => 'AX'
839
+ }
840
+ }
841
+ hash = customer_hash.merge(@@merchant_hash)
842
+ response = LitleOnlineRequest.new.authorization(hash)
843
+ assert_equal('303', response.authorizationResponse.response)
844
+ assert_equal('Pick Up Card', response.authorizationResponse.message)
845
+ assert_equal('34', response.authorizationResponse.fraudResult.avsResult)
846
+ end
847
+
848
+ def test_9_sale
849
+ customer_hash = {
850
+ 'orderId' => '9',
851
+ 'amount' => '90090',
852
+ 'orderSource'=>'ecommerce',
853
+ 'billToAddress'=>{
854
+ 'name' => 'James Miller',
855
+ 'addressLine1' => '9 Main St.',
856
+ 'city' => 'Boston',
857
+ 'state' => 'MA',
858
+ 'zip' => '02134',
859
+ 'country' => 'US'},
860
+ 'card'=>{
861
+ 'number' =>'375001010000003',
862
+ 'expDate' => '0912',
863
+ 'cardValidationNum' => '0421',
864
+ 'type' => 'AX'
865
+ }
866
+ }
867
+ hash = customer_hash.merge(@@merchant_hash)
868
+ response = LitleOnlineRequest.new.sale(hash)
869
+ assert_equal('303', response.saleResponse.response)
870
+ assert_equal('Pick Up Card', response.saleResponse.message)
871
+ assert_equal('34', response.saleResponse.fraudResult.avsResult)
872
+ end
873
+
874
+
875
+ def test_10
876
+ customer_hash = {
877
+ 'orderId' => '10',
878
+ 'amount' => '40000',
879
+ 'orderSource'=>'ecommerce',
880
+ 'card'=>{
881
+ 'number' =>'4457010140000141',
882
+ 'expDate' => '0912',
883
+ 'type' => 'VI'
884
+ },
885
+ 'allowPartialAuth' => 'true'
886
+ }
887
+ hash = customer_hash.merge(@@merchant_hash)
888
+ auth_response = LitleOnlineRequest.new.authorization(hash)
889
+ assert_equal('010', auth_response.authorizationResponse.response)
890
+ assert_equal('Partially Approved', auth_response.authorizationResponse.message)
891
+ assert_equal('32000', auth_response.authorizationResponse.approvedAmount)
892
+ end
893
+
894
+ def test_11
895
+ customer_hash = {
896
+ 'orderId' => '11',
897
+ 'amount' => '60000',
898
+ 'orderSource'=>'ecommerce',
899
+ 'card'=>{
900
+ 'number' =>'5112010140000004',
901
+ 'expDate' => '1111',
902
+ 'type' => 'MC'
903
+ },
904
+ 'allowPartialAuth' => 'true'
905
+ }
906
+ hash = customer_hash.merge(@@merchant_hash)
907
+ auth_response = LitleOnlineRequest.new.authorization(hash)
908
+ assert_equal('010', auth_response.authorizationResponse.response)
909
+ assert_equal('Partially Approved', auth_response.authorizationResponse.message)
910
+ assert_equal('48000', auth_response.authorizationResponse.approvedAmount)
911
+ end
912
+
913
+ def test_12
914
+ customer_hash = {
915
+ 'orderId' => '12',
916
+ 'amount' => '50000',
917
+ 'orderSource'=>'ecommerce',
918
+ 'card'=>{
919
+ 'number' =>'375001014000009',
920
+ 'expDate' => '0412',
921
+ 'type' => 'AX'},
922
+ 'allowPartialAuth' => 'true'
923
+ }
924
+ hash = customer_hash.merge(@@merchant_hash)
925
+ auth_response = LitleOnlineRequest.new.authorization(hash)
926
+ assert_equal('010', auth_response.authorizationResponse.response)
927
+ assert_equal('Partially Approved', auth_response.authorizationResponse.message)
928
+ assert_equal('40000', auth_response.authorizationResponse.approvedAmount)
929
+ end
930
+
931
+ def test_13
932
+ customer_hash = {
933
+ 'orderId' => '13',
934
+ 'amount' => '15000',
935
+ 'orderSource'=>'ecommerce',
936
+ 'card'=>{
937
+ 'number' =>'6011010140000004',
938
+ 'expDate' => '0812',
939
+ 'type' => 'DI'},
940
+ 'allowPartialAuth' => 'true'
941
+ }
942
+ hash = customer_hash.merge(@@merchant_hash)
943
+ auth_response = LitleOnlineRequest.new.authorization(hash)
944
+ assert_equal('010', auth_response.authorizationResponse.response)
945
+ assert_equal('Partially Approved', auth_response.authorizationResponse.message)
946
+ assert_equal('12000', auth_response.authorizationResponse.approvedAmount)
947
+ end
948
+ end