CnpOnline 8.31.1 → 9.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +29 -12
  3. data/DESCRIPTION +2 -2
  4. data/LICENSE +1 -1
  5. data/README.md +1 -1
  6. data/Rakefile +4 -4
  7. data/Rakefile~ +5 -5
  8. data/SETUP.md +3 -3
  9. data/bin/Setup.rb +9 -8
  10. data/bin/sample_batch_driver.rb +1 -1
  11. data/bin/sample_driver.rb +1 -1
  12. data/lib/Communications.rb +1 -1
  13. data/lib/Configuration.rb +16 -16
  14. data/lib/EnvironmentVariables.rb +1 -2
  15. data/lib/LitleBatchRequest.rb +283 -147
  16. data/lib/LitleListeners.rb +132 -33
  17. data/lib/LitleOnline.rb +5 -4
  18. data/lib/LitleOnlineRequest.rb +69 -59
  19. data/lib/LitleRequest.rb +178 -141
  20. data/lib/LitleTransaction.rb +279 -122
  21. data/lib/LitleXmlMapper.rb +9 -4
  22. data/lib/XMLFields.rb +345 -26
  23. data/test/certification/certTest1_base.rb +74 -73
  24. data/test/certification/certTest2_authenhanced.rb +1 -1
  25. data/test/certification/certTest3_authreversal.rb +1 -1
  26. data/test/certification/certTest4_echeck.rb +4 -1
  27. data/test/certification/certTest5_token.rb +4 -4
  28. data/test/certification/certTest_batchAll.rb +296 -55
  29. data/test/certification/ts_all.rb +1 -1
  30. data/test/functional/test_activate.rb +7 -3
  31. data/test/functional/test_activateReversal.rb +7 -3
  32. data/test/functional/test_auth.rb +119 -16
  33. data/test/functional/test_authReversal.rb +5 -3
  34. data/test/functional/test_balanceInquiry.rb +5 -3
  35. data/test/functional/test_batch.rb +3 -3
  36. data/test/functional/test_batchStream.rb +14 -4
  37. data/test/functional/test_cancelSubscription.rb +5 -3
  38. data/test/functional/test_capture.rb +34 -3
  39. data/test/functional/test_captureGivenAuth.rb +55 -4
  40. data/test/functional/test_configuration.rb +2 -2
  41. data/test/functional/test_createPlan.rb +5 -3
  42. data/test/functional/test_credit.rb +45 -16
  43. data/test/functional/test_deactivate.rb +5 -3
  44. data/test/functional/test_deactivateReversal.rb +5 -3
  45. data/test/functional/test_depositReversal.rb +5 -3
  46. data/test/functional/test_echeckCredit.rb +26 -9
  47. data/test/functional/test_echeckRedeposit.rb +5 -3
  48. data/test/functional/test_echeckSale.rb +49 -28
  49. data/test/functional/test_echeckVerification.rb +20 -12
  50. data/test/functional/test_echeckVoid.rb +1 -1
  51. data/test/functional/test_forceCapture.rb +44 -22
  52. data/test/functional/test_fraudCheck.rb +77 -0
  53. data/test/functional/test_litle_requests.rb +24 -24
  54. data/test/functional/test_load.rb +5 -3
  55. data/test/functional/test_loadReversal.rb +5 -3
  56. data/test/functional/test_refundReversal.rb +5 -3
  57. data/test/functional/test_sale.rb +214 -29
  58. data/test/functional/test_token.rb +19 -3
  59. data/test/functional/test_unload.rb +5 -3
  60. data/test/functional/test_unloadReversal.rb +6 -4
  61. data/test/functional/test_updateCardValidationNumOnToken.rb +1 -1
  62. data/test/functional/test_updatePlan.rb +5 -3
  63. data/test/functional/test_updateSubscription.rb +5 -3
  64. data/test/functional/test_utf8.rb +44 -0
  65. data/test/functional/test_xmlfields.rb +10 -6
  66. data/test/functional/ts_all.rb +2 -1
  67. data/test/unit/test_LitleAUBatch.rb +29 -1
  68. data/test/unit/test_LitleBatchRequest.rb +247 -113
  69. data/test/unit/test_LitleOnlineRequest.rb +37 -54
  70. data/test/unit/test_LitleRequest.rb +3 -3
  71. data/test/unit/test_LitleTransaction.rb +5 -5
  72. data/test/unit/test_LitleXmlMapper.rb +136 -0
  73. data/test/unit/test_activate.rb +1 -21
  74. data/test/unit/test_activateReversal.rb +1 -1
  75. data/test/unit/test_auth.rb +54 -14
  76. data/test/unit/test_authReversal.rb +1 -1
  77. data/test/unit/test_balanceInquiry.rb +1 -1
  78. data/test/unit/test_cancelSubscription.rb +1 -1
  79. data/test/unit/test_capture.rb +27 -1
  80. data/test/unit/test_captureGivenAuth.rb +44 -18
  81. data/test/unit/test_createPlan.rb +1 -1
  82. data/test/unit/test_credit.rb +16 -3
  83. data/test/unit/test_deactivate.rb +1 -1
  84. data/test/unit/test_deactivateReversal.rb +1 -1
  85. data/test/unit/test_depositReversal.rb +1 -1
  86. data/test/unit/test_echeckCredit.rb +15 -2
  87. data/test/unit/test_echeckRedeposit.rb +1 -1
  88. data/test/unit/test_echeckSale.rb +18 -1
  89. data/test/unit/test_echeckVerification.rb +1 -1
  90. data/test/unit/test_echeckVoid.rb +1 -1
  91. data/test/unit/test_forceCapture.rb +20 -2
  92. data/test/unit/test_fraudCheck.rb +45 -0
  93. data/test/unit/test_load.rb +1 -1
  94. data/test/unit/test_loadReversal.rb +1 -1
  95. data/test/unit/test_refundReversal.rb +1 -1
  96. data/test/unit/test_sale.rb +73 -7
  97. data/test/unit/test_token.rb +15 -4
  98. data/test/unit/test_unload.rb +1 -1
  99. data/test/unit/test_unloadReversal.rb +1 -1
  100. data/test/unit/test_updateCardValidationNumOnToken.rb +1 -1
  101. data/test/unit/test_updatePlan.rb +1 -1
  102. data/test/unit/test_updateSubscription.rb +1 -1
  103. data/test/unit/test_xmlfields.rb +1 -1
  104. data/test/unit/ts_unit.rb +2 -1
  105. metadata +10 -7
  106. data/CHANGELOG~ +0 -142
@@ -34,7 +34,7 @@ module LitleOnline
34
34
  assert_equal('11111 ', auth_response.authorizationResponse.authCode)
35
35
  assert_equal('01', auth_response.authorizationResponse.fraudResult.avsResult)
36
36
  assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
37
-
37
+
38
38
  #test 1A
39
39
  capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
40
40
  hash1a = capture_hash.merge(@@merchant_hash)
@@ -49,12 +49,12 @@ module LitleOnline
49
49
  assert_equal('000', credit_response.creditResponse.response)
50
50
  assert_equal('Approved', credit_response.creditResponse.message)
51
51
 
52
- #test1C - intermittent behavior
53
- # void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
54
- # hash1c = void_hash.merge(@@merchant_hash)
55
- # void_response = LitleOnlineRequest.new.void(hash1c)
56
- # assert_equal('000', void_response.voidResponse.response)
57
- # assert_equal('Approved', void_response.voidResponse.message)
52
+ #test1C
53
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
54
+ hash1c = void_hash.merge(@@merchant_hash)
55
+ void_response = LitleOnlineRequest.new.void(hash1c)
56
+ assert_equal('000', void_response.voidResponse.response)
57
+ assert_equal('Approved', void_response.voidResponse.message)
58
58
  end
59
59
 
60
60
  def test_1_AVS
@@ -117,18 +117,18 @@ module LitleOnline
117
117
  assert_equal('000', credit_response.creditResponse.response)
118
118
  assert_equal('Approved', credit_response.creditResponse.message)
119
119
 
120
- #test1C - intermittent behavior
121
- # void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
122
- # hash1c = void_hash.merge(@@merchant_hash)
123
- # void_response = LitleOnlineRequest.new.void(hash1c)
124
- # assert_equal('000', void_response.voidResponse.response)
125
- # assert_equal('Approved', void_response.voidResponse.message)
120
+ #test1C
121
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
122
+ hash1c = void_hash.merge(@@merchant_hash)
123
+ void_response = LitleOnlineRequest.new.void(hash1c)
124
+ assert_equal('000', void_response.voidResponse.response)
125
+ assert_equal('Approved', void_response.voidResponse.message)
126
126
  end
127
127
 
128
128
  def test_2_auth
129
129
  customer_hash = {
130
130
  'orderId' => '2',
131
- 'amount' => '20020',
131
+ 'amount' => '10100',
132
132
  'orderSource'=>'ecommerce',
133
133
  'billToAddress'=>{
134
134
  'name' => 'Mike J. Hammer',
@@ -168,12 +168,12 @@ module LitleOnline
168
168
  assert_equal('000', credit_response.creditResponse.response)
169
169
  assert_equal('Approved', credit_response.creditResponse.message)
170
170
 
171
- # #test 2C - intermittent behavior
172
- # void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
173
- # hash2c = void_hash.merge(@@merchant_hash)
174
- # void_response = LitleOnlineRequest.new.void(hash2c)
175
- # assert_equal('000', void_response.voidResponse.response)
176
- # assert_equal('Approved', void_response.voidResponse.message)
171
+ #test 2C
172
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
173
+ hash2c = void_hash.merge(@@merchant_hash)
174
+ void_response = LitleOnlineRequest.new.void(hash2c)
175
+ assert_equal('000', void_response.voidResponse.response)
176
+ assert_equal('Approved', void_response.voidResponse.message)
177
177
  end
178
178
 
179
179
  def test_2_avs
@@ -209,7 +209,7 @@ module LitleOnline
209
209
  def test_2_sale
210
210
  customer_hash = {
211
211
  'orderId' => '2',
212
- 'amount' => '20020',
212
+ 'amount' => '10100',
213
213
  'orderSource'=>'ecommerce',
214
214
  'billToAddress'=>{
215
215
  'name' => 'Mike J. Hammer',
@@ -236,18 +236,19 @@ module LitleOnline
236
236
  assert_equal('M', sale_response.saleResponse.fraudResult.cardValidationResult)
237
237
 
238
238
  #test 2B
239
+ sleep(5)
239
240
  credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
240
241
  hash2b = credit_hash.merge(@@merchant_hash)
241
242
  credit_response = LitleOnlineRequest.new.credit(hash2b)
242
243
  assert_equal('000', credit_response.creditResponse.response)
243
244
  assert_equal('Approved', credit_response.creditResponse.message)
244
245
 
245
- #test 2C - intermittent behavior
246
- # void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
247
- # hash2c = void_hash.merge(@@merchant_hash)
248
- # void_response = LitleOnlineRequest.new.void(hash2c)
249
- # assert_equal('000', void_response.voidResponse.response)
250
- # assert_equal('Approved', void_response.voidResponse.message)
246
+ #test 2C
247
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
248
+ hash2c = void_hash.merge(@@merchant_hash)
249
+ void_response = LitleOnlineRequest.new.void(hash2c)
250
+ assert_equal('000', void_response.voidResponse.response)
251
+ assert_equal('Approved', void_response.voidResponse.message)
251
252
  end
252
253
 
253
254
  def test_3_auth
@@ -290,12 +291,12 @@ module LitleOnline
290
291
  assert_equal('000', credit_response.creditResponse.response)
291
292
  assert_equal('Approved', credit_response.creditResponse.message)
292
293
 
293
- #test 3C - intermittent behavior
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)
294
+ #test 3C
295
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
296
+ hash2c = void_hash.merge(@@merchant_hash)
297
+ void_response = LitleOnlineRequest.new.void(hash2c)
298
+ assert_equal('000', void_response.voidResponse.response)
299
+ assert_equal('Approved', void_response.voidResponse.message)
299
300
  end
300
301
 
301
302
  def test_3_avs
@@ -358,12 +359,12 @@ module LitleOnline
358
359
  assert_equal('000', credit_response.creditResponse.response)
359
360
  assert_equal('Approved', credit_response.creditResponse.message)
360
361
 
361
- #test 3C - intermittent behavior
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)
362
+ #test 3C
363
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
364
+ hash2c = void_hash.merge(@@merchant_hash)
365
+ void_response = LitleOnlineRequest.new.void(hash2c)
366
+ assert_equal('000', void_response.voidResponse.response)
367
+ assert_equal('Approved', void_response.voidResponse.message)
367
368
  end
368
369
 
369
370
  def test_4_auth
@@ -404,18 +405,18 @@ module LitleOnline
404
405
  assert_equal('000', credit_response.creditResponse.response)
405
406
  assert_equal('Approved', credit_response.creditResponse.message)
406
407
 
407
- #test 4C - intermittent behavior
408
- # void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
409
- # hash2c = void_hash.merge(@@merchant_hash)
410
- # void_response = LitleOnlineRequest.new.void(hash2c)
411
- # assert_equal('000', void_response.voidResponse.response)
412
- # assert_equal('Approved', void_response.voidResponse.message)
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)
413
414
  end
414
415
 
415
416
  def test_4_avs
416
417
  customer_hash = {
417
418
  'orderId' => '4',
418
- 'amount' => '0',
419
+ 'amount' => '101000',
419
420
  'orderSource'=>'ecommerce',
420
421
  'billToAddress'=>{
421
422
  'name' => 'Bob Black',
@@ -470,21 +471,21 @@ module LitleOnline
470
471
  assert_equal('000', credit_response.creditResponse.response)
471
472
  assert_equal('Approved', credit_response.creditResponse.message)
472
473
 
473
- #test 4C - intermittent behavior
474
- # void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
475
- # hash2c = void_hash.merge(@@merchant_hash)
476
- # void_response = LitleOnlineRequest.new.void(hash2c)
477
- # assert_equal('000', void_response.voidResponse.response)
478
- # assert_equal('Approved', void_response.voidResponse.message)
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)
479
480
  end
480
481
 
481
482
  def test_5_auth
482
483
  customer_hash = {
483
484
  'orderId' => '5',
484
- 'amount' => '50050',
485
+ 'amount' => '10100',
485
486
  'orderSource'=>'ecommerce',
486
487
  'card'=>{
487
- 'number' =>'4457010200000007',
488
+ 'number' =>'4100200300011001',
488
489
  'expDate' => '0512',
489
490
  'cardValidationNum' => '463',
490
491
  'type' => 'VI'},
@@ -512,12 +513,12 @@ module LitleOnline
512
513
  assert_equal('000', credit_response.creditResponse.response)
513
514
  assert_equal('Approved', credit_response.creditResponse.message)
514
515
 
515
- #test 5C - intermittent behavior
516
- # void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
517
- # hash2c = void_hash.merge(@@merchant_hash)
518
- # void_response = LitleOnlineRequest.new.void(hash2c)
519
- # assert_equal('000', void_response.voidResponse.response)
520
- # assert_equal('Approved', void_response.voidResponse.message)
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)
521
522
  end
522
523
 
523
524
  def test_5_avs
@@ -526,7 +527,7 @@ module LitleOnline
526
527
  'amount' => '0',
527
528
  'orderSource'=>'ecommerce',
528
529
  'card'=>{
529
- 'number' =>'4457010200000007',
530
+ 'number' =>'4100200300011001',
530
531
  'expDate' => '0512',
531
532
  'cardValidationNum' => '463',
532
533
  'type' => 'VI'},
@@ -568,12 +569,12 @@ module LitleOnline
568
569
  assert_equal('000', credit_response.creditResponse.response)
569
570
  assert_equal('Approved', credit_response.creditResponse.message)
570
571
 
571
- #test 5C - intermittent behavior
572
- # void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
573
- # hash2c = void_hash.merge(@@merchant_hash)
574
- # void_response = LitleOnlineRequest.new.void(hash2c)
575
- # assert_equal('000', void_response.voidResponse.response)
576
- # assert_equal('Approved', void_response.voidResponse.message)
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)
577
578
  end
578
579
 
579
580
  def test_6_auth
@@ -627,12 +628,12 @@ module LitleOnline
627
628
  assert_equal('34', sale_response.saleResponse.fraudResult.avsResult)
628
629
  assert_equal('P', sale_response.saleResponse.fraudResult.cardValidationResult)
629
630
 
630
- #test 6A - intermittent behavior
631
- # void_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId }
632
- # hash6A = void_hash.merge(@@merchant_hash)
633
- # void_response = LitleOnlineRequest.new.void(hash6A)
634
- # assert_equal('360', void_response.voidResponse.response)
635
- # assert_equal('No transaction found with specified transaction Id', void_response.voidResponse.message)
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 transaction Id', void_response.voidResponse.message)
636
637
  end
637
638
 
638
639
  def test_7_auth
@@ -512,7 +512,7 @@ module LitleOnline
512
512
  def test_35
513
513
  customer_hash = {
514
514
  'orderId' => '35',
515
- 'amount' => '40040',
515
+ 'amount' => '10100',
516
516
  'orderSource'=>'ecommerce',
517
517
  'billToAddress'=>{
518
518
  'name' => 'Bob Black',
@@ -146,7 +146,7 @@ module LitleOnline
146
146
  assert_equal('Approved', auth_response.authorizationResponse.message)
147
147
  assert_equal('44444 ', auth_response.authorizationResponse.authCode)
148
148
  assert_equal('13', auth_response.authorizationResponse.fraudResult.avsResult)
149
-
149
+
150
150
  # #test 35A
151
151
  capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId, 'amount' => '20020'}
152
152
  hash1a = capture_hash.merge(@@merchant_hash)
@@ -3,6 +3,7 @@ require 'test/unit'
3
3
 
4
4
  module LitleOnline
5
5
  class Litle_certTest4 < Test::Unit::TestCase
6
+ # test echeck
6
7
  @@merchant_hash = {
7
8
  'reportGroup'=>'Planets',
8
9
  'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
@@ -254,6 +255,7 @@ module LitleOnline
254
255
  end
255
256
 
256
257
  def test_48
258
+
257
259
  customer_hash = {
258
260
  'orderId' => '43',
259
261
  'amount' => '2007',
@@ -272,12 +274,13 @@ module LitleOnline
272
274
  hash = customer_hash.merge(@@merchant_hash)
273
275
  echeck_response = LitleOnlineRequest.new.echeck_sale(hash)
274
276
 
277
+
275
278
  customer_hash = {
276
279
  'litleTxnId' => echeck_response.echeckSalesResponse.litleTxnId
277
280
  }
278
281
  hash = customer_hash.merge(@@merchant_hash)
279
282
  echeck_response = LitleOnlineRequest.new.echeck_credit(hash)
280
-
283
+
281
284
  assert_equal('000', echeck_response.echeckCreditResponse.response)
282
285
  assert_equal('Approved', echeck_response.echeckCreditResponse.message)
283
286
  end
@@ -43,8 +43,8 @@ module LitleOnline
43
43
  assert_equal('445711', token_response.registerTokenResponse.bin)
44
44
  assert_equal('VI', token_response.registerTokenResponse['type'])
45
45
  assert_equal('802', token_response.registerTokenResponse.response)
46
- cardString = "" + token_response.registerTokenResponse.litleToken
47
- assert_equal('0123', cardString[12..15])
46
+ lastFour = String.new(token_response.registerTokenResponse.litleToken)[12..15]
47
+ assert_equal('0123', lastFour)
48
48
  assert_equal('Account number was previously registered', token_response.registerTokenResponse.message)
49
49
  end
50
50
 
@@ -164,7 +164,7 @@ module LitleOnline
164
164
  # assert_equal('003', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
165
165
  # assert_equal('111922223333444003', token_response.echeckSalesResponse.tokenResponse.litleToken)
166
166
  # end
167
- #
167
+
168
168
  # def test_62
169
169
  # customer_hash = {
170
170
  # 'orderId' => '62',
@@ -183,7 +183,7 @@ module LitleOnline
183
183
  # assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
184
184
  # assert_equal('111922223333444999', token_response.echeckSalesResponse.tokenResponse.litleToken)
185
185
  # end
186
- #
186
+
187
187
  # def test_63
188
188
  # customer_hash = {
189
189
  # 'orderId' => '63',
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright (c) 2012 Litle & Co.
2
+ Copyright (c) 2017 Vantiv eCommerce
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person
5
5
  obtaining a copy of this software and associated documentation
@@ -22,8 +22,7 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
22
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
23
  OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
-
26
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
25
+ require File.expand_path("../../../lib/LitleOnline",__FILE__)
27
26
  require 'test/unit'
28
27
  require 'fileutils'
29
28
 
@@ -40,7 +39,7 @@ module LitleOnline
40
39
  Dir.mkdir(path)
41
40
  end
42
41
  end
43
-
42
+
44
43
  def test_MEGA_batch
45
44
  authHash = {
46
45
  'reportGroup'=>'Planets',
@@ -48,10 +47,11 @@ module LitleOnline
48
47
  'amount'=>'106',
49
48
  'orderSource'=>'ecommerce',
50
49
  'card'=>{
51
- 'type'=>'VI',
52
- 'number' =>'4100000000000001',
53
- 'expDate' =>'1210'
54
- }}
50
+ 'type'=>'VI',
51
+ 'number' =>'4100000000000001',
52
+ 'expDate' =>'1210'
53
+ }, 'processingType' => 'initialInstallment',
54
+ }
55
55
 
56
56
  saleHash = {
57
57
  'reportGroup'=>'Planets',
@@ -60,10 +60,12 @@ module LitleOnline
60
60
  'amount'=>'6000',
61
61
  'orderSource'=>'ecommerce',
62
62
  'card'=>{
63
- 'type'=>'VI',
64
- 'number' =>'4100000000000001',
65
- 'expDate' =>'1210'
66
- }}
63
+ 'type'=>'VI',
64
+ 'number' =>'4100000000000001',
65
+ 'expDate' =>'1210'
66
+ },'originalNetworkTransactionId' => '9876543210',
67
+ 'originalTransactionAmount' => '536981'
68
+ }
67
69
 
68
70
  creditHash = {
69
71
  'merchantId' => '101',
@@ -73,9 +75,9 @@ module LitleOnline
73
75
  'amount'=>'106',
74
76
  'orderSource'=>'ecommerce',
75
77
  'card'=>{
76
- 'type'=>'VI',
77
- 'number' =>'4100000000000001',
78
- 'expDate' =>'1210'
78
+ 'type'=>'VI',
79
+ 'number' =>'4100000000000001',
80
+ 'expDate' =>'1210'
79
81
  }}
80
82
 
81
83
  authReversalHash = {
@@ -105,7 +107,7 @@ module LitleOnline
105
107
  'litleToken'=>'1233456789103801',
106
108
  'cardValidationNum'=>'123'
107
109
  }
108
-
110
+
109
111
  forceCaptHash = {
110
112
  'merchantId' => '101',
111
113
  'version'=>'8.8',
@@ -115,10 +117,11 @@ module LitleOnline
115
117
  'amount'=>'106',
116
118
  'orderSource'=>'ecommerce',
117
119
  'card'=>{
118
- 'type'=>'VI',
119
- 'number' =>'4100000000000001',
120
- 'expDate' =>'1210'
121
- }}
120
+ 'type'=>'VI',
121
+ 'number' =>'4100000000000001',
122
+ 'expDate' =>'1210'
123
+ },'processingType' => 'initialInstallment',
124
+ }
122
125
 
123
126
  captHash = {
124
127
  'merchantId' => '101',
@@ -126,6 +129,7 @@ module LitleOnline
126
129
  'reportGroup'=>'Planets',
127
130
  'litleTxnId'=>'123456000',
128
131
  'amount'=>'106',
132
+ 'pin'=>'1234'
129
133
  }
130
134
 
131
135
  captGivenAuthHash = {
@@ -135,14 +139,14 @@ module LitleOnline
135
139
  'orderId'=>'12344',
136
140
  'amount'=>'106',
137
141
  'authInformation' => {
138
- 'authDate'=>'2002-10-09','authCode'=>'543216',
139
- 'authAmount'=>'12345'
140
- },
142
+ 'authDate'=>'2002-10-09','authCode'=>'543216',
143
+ 'authAmount'=>'12345'
144
+ },'originalNetworkTransactionId' => '9876543210',
141
145
  'orderSource'=>'ecommerce',
142
146
  'card'=>{
143
- 'type'=>'VI',
144
- 'number' =>'4100000000000000',
145
- 'expDate' =>'1210'
147
+ 'type'=>'VI',
148
+ 'number' =>'4100000000000000',
149
+ 'expDate' =>'1210'
146
150
  }}
147
151
 
148
152
  echeckVerificationHash = {
@@ -153,7 +157,7 @@ module LitleOnline
153
157
  'orderId'=>'12345',
154
158
  'orderSource'=>'ecommerce',
155
159
  'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
156
- 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
160
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'vantiv.com'}
157
161
  }
158
162
 
159
163
  echeckCreditHash = {
@@ -180,7 +184,7 @@ module LitleOnline
180
184
  'orderId'=>'12345',
181
185
  'orderSource'=>'ecommerce',
182
186
  'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
183
- 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
187
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'vantiv.com'}
184
188
  }
185
189
 
186
190
  accountUpdateHash = {
@@ -189,11 +193,11 @@ module LitleOnline
189
193
  'customerId'=>'0987',
190
194
  'orderId'=>'1234',
191
195
  'card'=>{
192
- 'type'=>'VI',
193
- 'number' =>'4100000000000001',
194
- 'expDate' =>'1210'
196
+ 'type'=>'VI',
197
+ 'number' =>'4100000000000001',
198
+ 'expDate' =>'1210'
195
199
  }}
196
-
200
+
197
201
  path = "/tmp/litle-sdk-for-ruby/cert/"
198
202
 
199
203
  request = LitleRequest.new({'sessionId'=>'8675309'})
@@ -201,7 +205,7 @@ module LitleOnline
201
205
  request.create_new_litle_request(path)
202
206
  batch = LitleBatchRequest.new
203
207
  batch.create_new_batch(path)
204
-
208
+
205
209
  batch.account_update(accountUpdateHash)
206
210
  batch.auth_reversal(authReversalHash)
207
211
  batch.authorization(authHash)
@@ -216,7 +220,7 @@ module LitleOnline
216
220
  batch.register_token_request(registerTokenHash)
217
221
  batch.sale(saleHash)
218
222
  batch.update_card_validation_num_on_token(updateCardHash)
219
-
223
+
220
224
  #close the batch, indicating we plan to add no more transactions
221
225
  batch.close_batch()
222
226
  #add the batch to the LitleRequest
@@ -229,18 +233,18 @@ module LitleOnline
229
233
 
230
234
  #grab the expected number of responses from the sFTP server and save them to the given path
231
235
  request.get_responses_from_server()
232
-
236
+
233
237
  count = 0
234
238
  #process the responses from the server with a listener which applies the given block
235
239
  request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
236
- assert_not_nil transaction["litleTxnId"] =~ /\d+/
237
- assert_not_nil transaction["response"] =~ /\d+/
238
- assert_not_nil transaction["message"]
239
- count+=1
240
- end})
241
- assert_equal count, 14
240
+ assert_not_nil transaction["litleTxnId"] =~ /\d+/
241
+ assert_not_nil transaction["response"] =~ /\d+/
242
+ assert_not_nil transaction["message"]
243
+ count+=1
244
+ end})
245
+ assert_equal 14,count
242
246
  end
243
-
247
+
244
248
  def test_mini_batch_borked_counts
245
249
  echeckSaleHash = {
246
250
  'merchantId' => '101',
@@ -251,9 +255,9 @@ module LitleOnline
251
255
  'orderId'=>'12345',
252
256
  'orderSource'=>'ecommerce',
253
257
  'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
254
- 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
258
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'vantiv.com'}
255
259
  }
256
-
260
+
257
261
  path = "/tmp/litle-sdk-for-ruby/cert/"
258
262
 
259
263
  request = LitleRequest.new({'sessionId'=>'8675309'})
@@ -261,11 +265,11 @@ module LitleOnline
261
265
  request.create_new_litle_request(path)
262
266
  batch = LitleBatchRequest.new
263
267
  batch.create_new_batch(path)
264
-
268
+
265
269
  batch.echeck_sale(echeckSaleHash)
266
-
270
+
267
271
  #make this a bad batch
268
- batch.get_counts_and_amounts[:sale][:numSales] += 1
272
+ batch.get_counts_and_amounts[:sale][:numSales] += 1
269
273
  #close the batch, indicating we plan to add no more transactions
270
274
  batch.close_batch()
271
275
  #add the batch to the LitleRequest
@@ -283,10 +287,10 @@ module LitleOnline
283
287
  assert_raise RuntimeError do
284
288
  #process the responses from the server with a listener which applies the given block
285
289
  request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
286
- end})
290
+ end})
287
291
  end
288
292
  end
289
-
293
+
290
294
  def test_mini_batch_borked_amounts
291
295
  echeckSaleHash = {
292
296
  'merchantId' => '101',
@@ -297,9 +301,9 @@ module LitleOnline
297
301
  'orderId'=>'12345',
298
302
  'orderSource'=>'ecommerce',
299
303
  'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
300
- 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
304
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'vantiv.com'}
301
305
  }
302
-
306
+
303
307
  path = "/tmp/litle-sdk-for-ruby/cert/"
304
308
 
305
309
  request = LitleRequest.new({'sessionId'=>'8675309'})
@@ -307,11 +311,11 @@ module LitleOnline
307
311
  request.create_new_litle_request(path)
308
312
  batch = LitleBatchRequest.new
309
313
  batch.create_new_batch(path)
310
-
314
+
311
315
  batch.echeck_sale(echeckSaleHash)
312
-
316
+
313
317
  #make this a bad batch
314
- batch.get_counts_and_amounts[:sale][:saleAmount] += 1
318
+ batch.get_counts_and_amounts[:sale][:saleAmount] += 1
315
319
  #close the batch, indicating we plan to add no more transactions
316
320
  batch.close_batch()
317
321
  #add the batch to the LitleRequest
@@ -330,8 +334,245 @@ module LitleOnline
330
334
  assert_raise RuntimeError do
331
335
  #process the responses from the server with a listener which applies the given block
332
336
  request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
333
- end})
337
+ end})
334
338
  end
335
339
  end
340
+
341
+ # def test_PFIF_instruction_txn
342
+ # submerchantCreditHash = {
343
+ # 'reportGroup'=>'Planets',
344
+ # 'orderId'=>'12344',
345
+ # 'fundingSubmerchantId'=>'123456',
346
+ # 'submerchantName'=>'001',
347
+ # 'fundsTransferId'=>'00003',
348
+ # 'amount'=>'10000',
349
+ # 'accountInfo' => {'accType'=>'Checking','accNum'=>'123456789012','routingNum'=>'114567895'}
350
+ # }
351
+ #
352
+ # vendorCreditHash = {
353
+ # 'reportGroup'=>'Planets',
354
+ # 'orderId'=>'12344',
355
+ # 'fundingSubmerchantId'=>'123456',
356
+ # 'vendorName'=>'001',
357
+ # 'fundsTransferId'=>'00007',
358
+ # 'amount'=>'7000',
359
+ # 'accountInfo' => {'accType'=>'Checking','accNum'=>'123456789012','routingNum'=>'114567895'}
360
+ # }
361
+ #
362
+ # payFacCreditHash = {
363
+ # 'reportGroup'=>'Planets',
364
+ # 'orderId'=>'12344',
365
+ # 'fundingSubmerchantId'=>'123456',
366
+ # 'fundsTransferId'=>'00001',
367
+ # 'amount'=>'1000',
368
+ # }
369
+ #
370
+ # reserveCreditHash = {
371
+ # 'reportGroup'=>'Planets',
372
+ # 'orderId'=>'12344',
373
+ # 'fundingSubmerchantId'=>'123456',
374
+ # 'fundsTransferId'=>'00005',
375
+ # 'amount'=>'50000',
376
+ # }
377
+ #
378
+ # physicalCheckCreditHash = {
379
+ # 'reportGroup'=>'Planets',
380
+ # 'orderId'=>'12344',
381
+ # 'fundingSubmerchantId'=>'123456',
382
+ # 'fundsTransferId'=>'00009',
383
+ # 'amount'=>'9000',
384
+ # }
385
+ #
386
+ # submerchantDebitHash = {
387
+ # 'reportGroup'=>'Planets',
388
+ # 'orderId'=>'12344',
389
+ # 'fundingSubmerchantId'=>'123456',
390
+ # 'submerchantName'=>'001',
391
+ # 'fundsTransferId'=>'00003',
392
+ # 'amount'=>'10000',
393
+ # 'accountInfo' => {'accType'=>'Checking','accNum'=>'123456789012','routingNum'=>'114567895'}
394
+ # }
395
+ #
396
+ # vendorDebitHash = {
397
+ # 'reportGroup'=>'Planets',
398
+ # 'orderId'=>'12344',
399
+ # 'fundingSubmerchantId'=>'123456',
400
+ # 'vendorName'=>'001',
401
+ # 'fundsTransferId'=>'00007',
402
+ # 'amount'=>'7000',
403
+ # 'accountInfo' => {'accType'=>'Checking','accNum'=>'123456789012','routingNum'=>'114567895'}
404
+ # }
405
+ #
406
+ # payFacDebitHash = {
407
+ # 'reportGroup'=>'Planets',
408
+ # 'orderId'=>'12344',
409
+ # 'fundingSubmerchantId'=>'123456',
410
+ # 'fundsTransferId'=>'00001',
411
+ # 'amount'=>'1000',
412
+ # }
413
+ #
414
+ # reserveDebitHash = {
415
+ # 'reportGroup'=>'Planets',
416
+ # 'orderId'=>'12344',
417
+ # 'fundingSubmerchantId'=>'123456',
418
+ # 'fundsTransferId'=>'00005',
419
+ # 'amount'=>'50000',
420
+ # }
421
+ #
422
+ # physicalCheckDebitHash = {
423
+ # 'reportGroup'=>'Planets',
424
+ # 'orderId'=>'12344',
425
+ # 'fundingSubmerchantId'=>'123456',
426
+ # 'fundsTransferId'=>'00009',
427
+ # 'amount'=>'9000',
428
+ # }
429
+ #
430
+ # path = "/tmp/litle-sdk-for-ruby/cert/"
431
+ #
432
+ # request = LitleRequest.new({'sessionId'=>'8675309'})
433
+ # request.create_new_litle_request(path)
434
+ # batch = LitleBatchRequest.new
435
+ # batch.create_new_batch(path)
436
+ #
437
+ # batch.submerchant_credit(submerchantCreditHash)
438
+ # batch.payFac_credit(payFacCreditHash)
439
+ # batch.vendor_credit(vendorCreditHash)
440
+ # batch.reserve_credit(reserveCreditHash)
441
+ # batch.physical_check_credit(physicalCheckCreditHash)
442
+ # batch.submerchant_debit(submerchantDebitHash)
443
+ # batch.payFac_debit(payFacDebitHash)
444
+ # batch.vendor_debit(vendorDebitHash)
445
+ # batch.reserve_debit(reserveDebitHash)
446
+ # batch.physical_check_debit(physicalCheckDebitHash)
447
+ #
448
+ # #close the batch, indicating we plan to add no more transactions
449
+ # batch.close_batch()
450
+ # #add the batch to the LitleRequest
451
+ # request.commit_batch(batch)
452
+ # #finish the Litle Request, indicating we plan to add no more batches
453
+ # request.finish_request
454
+ #
455
+ # #send the batch files at the given directory over sFTP
456
+ # request.send_to_litle
457
+ #
458
+ # #grab the expected number of responses from the sFTP server and save them to the given path
459
+ # request.get_responses_from_server()
460
+ #
461
+ # count = 0
462
+ # #process the responses from the server with a listener which applies the given block
463
+ # request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
464
+ # assert_not_nil transaction["litleTxnId"] =~ /\d+/
465
+ # assert_not_nil transaction["response"] =~ /\d+/
466
+ # assert_not_nil transaction["message"]
467
+ # count+=1
468
+ # end})
469
+ # assert_equal 10, count
470
+ # end
471
+
472
+ def test_echeck_pre_note_all
473
+
474
+ billToAddress = {'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'vantiv.com'}
475
+ echeckSuccess = {'accType'=>'Corporate','accNum'=>'1092969901','routingNum'=>'011075150'}
476
+ echeckRoutErr = {'accType'=>'Checking','accNum'=>'6099999992','routingNum'=>'053133052'}
477
+ echeckAccErr = {'accType'=>'Corporate','accNum'=>'10@2969901','routingNum'=>'011100012'}
478
+
479
+ echeckPreNoteSaleHashSuccess = {
480
+ 'merchantId' => '0180',
481
+ 'version'=>'9.3',
482
+ 'reportGroup'=>'Planets',
483
+ 'orderId'=>'000',
484
+ 'orderSource'=>'ecommerce',
485
+ 'billToAddress'=> billToAddress,
486
+ 'echeck' => echeckSuccess
487
+ }
488
+
489
+ echeckPreNoteSaleHashErrRout = {
490
+ 'merchantId' => '0180',
491
+ 'version'=>'9.3',
492
+ 'reportGroup'=>'Planets',
493
+ 'orderId'=>'900',
494
+ 'orderSource'=>'ecommerce',
495
+ 'billToAddress'=> billToAddress,
496
+ 'echeck' => echeckRoutErr
497
+ }
498
+
499
+ echeckPreNoteSaleHashErrAcc = {
500
+ 'merchantId' => '0180',
501
+ 'version'=>'9.3',
502
+ 'reportGroup'=>'Planets',
503
+ 'orderId'=>'301',
504
+ 'orderSource'=>'ecommerce',
505
+ 'billToAddress'=> billToAddress,
506
+ 'echeck' => echeckAccErr
507
+ }
508
+
509
+ echeckPreNoteCreditHashSuccess = {
510
+ 'merchantId' => '0180',
511
+ 'version'=>'9.3',
512
+ 'reportGroup'=>'Planets',
513
+ 'orderId'=>'000',
514
+ 'orderSource'=>'ecommerce',
515
+ 'billToAddress'=> billToAddress,
516
+ 'echeck' => echeckSuccess
517
+ }
518
+
519
+ echeckPreNoteCreditHashErrRout = {
520
+ 'merchantId' => '0180',
521
+ 'version'=>'9.3',
522
+ 'reportGroup'=>'Planets',
523
+ 'orderId'=>'900',
524
+ 'orderSource'=>'ecommerce',
525
+ 'billToAddress'=> billToAddress,
526
+ 'echeck' => echeckRoutErr
527
+ }
528
+
529
+ echeckPreNoteCreditHashErrAcc = {
530
+ 'merchantId' => '101',
531
+ 'version'=>'9.3',
532
+ 'reportGroup'=>'Planets',
533
+ 'orderId'=>'301',
534
+ 'orderSource'=>'ecommerce',
535
+ 'billToAddress'=> billToAddress,
536
+ 'echeck' => echeckAccErr
537
+ }
538
+
539
+ path = "/tmp/litle-sdk-for-ruby/cert/"
540
+
541
+ request = LitleRequest.new({'sessionId'=>'8675309'})
542
+
543
+ request.create_new_litle_request(path)
544
+ batch = LitleBatchRequest.new
545
+ batch.create_new_batch(path)
546
+
547
+ batch.echeck_pre_note_sale(echeckPreNoteSaleHashSuccess)
548
+ batch.echeck_pre_note_sale(echeckPreNoteSaleHashErrRout)
549
+ batch.echeck_pre_note_sale(echeckPreNoteSaleHashErrAcc)
550
+ batch.echeck_pre_note_credit(echeckPreNoteSaleHashSuccess)
551
+ batch.echeck_pre_note_credit(echeckPreNoteSaleHashErrRout)
552
+ batch.echeck_pre_note_credit(echeckPreNoteSaleHashErrAcc)
553
+
554
+ #close the batch, indicating we plan to add no more transactions
555
+ batch.close_batch()
556
+ #add the batch to the LitleRequest
557
+ request.commit_batch(batch)
558
+ #finish the Litle Request, indicating we plan to add no more batches
559
+ request.finish_request
560
+
561
+ #send the batch files at the given directory over sFTP
562
+ request.send_to_litle
563
+
564
+ request.get_responses_from_server()
565
+
566
+ count = 0
567
+ #process the responses from the server with a listener which applies the given block
568
+ request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
569
+ assert_not_nil transaction["litleTxnId"] =~ /\d+/
570
+ assert_not_nil transaction["message"]
571
+ assert_equal(transaction["orderId"],transaction["response"])
572
+ count+=1
573
+ end})
574
+ assert_equal 6,count
575
+ end
576
+
336
577
  end
337
578
  end