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
@@ -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
@@ -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
@@ -116,8 +116,10 @@ module LitleOnline
116
116
  'cardValidationNum'=>'555',
117
117
  'type'=>'VI'
118
118
  }}
119
- response= LitleOnlineRequest.new.force_capture(hash)
120
- assert(response.message =~ /Error validating xml data against the schema/)
119
+ #Get exceptions
120
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
121
+ #Test
122
+ assert(exception.message =~ /Error validating xml data against the schema/)
121
123
  end
122
124
 
123
125
  def test_no_order_source
@@ -133,8 +135,10 @@ module LitleOnline
133
135
  'number' =>'4100000000000001',
134
136
  'expDate' =>'1210'
135
137
  }}
136
- response= LitleOnlineRequest.new.force_capture(hash)
137
- assert(response.message =~ /Error validating xml data against the schema/)
138
+ #Get exceptions
139
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
140
+ #Test
141
+ assert(exception.message =~ /Error validating xml data against the schema/)
138
142
  end
139
143
 
140
144
  def test_simple_forceCapture_with_mpos
@@ -160,23 +164,41 @@ module LitleOnline
160
164
  end
161
165
 
162
166
  def test_simple_force_capture_with_secondaryAmount
163
- hash = {
164
- 'merchantId' => '101',
165
- 'version'=>'8.8',
166
- 'reportGroup'=>'Planets',
167
- 'litleTxnId'=>'123456',
168
- 'orderId'=>'12344',
169
- 'amount'=>'106',
170
- 'secondaryAmount'=>'20',
171
- 'orderSource'=>'ecommerce',
172
- 'card'=>{
173
- 'type'=>'VI',
174
- 'number' =>'4100000000000001',
175
- 'expDate' =>'1210'
176
- }}
177
- response= LitleOnlineRequest.new.force_capture(hash)
178
- assert_equal('000', response.forceCaptureResponse.response)
179
- end
167
+ hash = {
168
+ 'merchantId' => '101',
169
+ 'version'=>'8.8',
170
+ 'reportGroup'=>'Planets',
171
+ 'litleTxnId'=>'123456',
172
+ 'orderId'=>'12344',
173
+ 'amount'=>'106',
174
+ 'secondaryAmount'=>'20',
175
+ 'orderSource'=>'ecommerce',
176
+ 'card'=>{
177
+ 'type'=>'VI',
178
+ 'number' =>'4100000000000001',
179
+ 'expDate' =>'1210'
180
+ }}
181
+ response= LitleOnlineRequest.new.force_capture(hash)
182
+ assert_equal('000', response.forceCaptureResponse.response)
183
+ end
184
+
185
+ def test_simple_force_capture_with_processing_type
186
+ hash = {
187
+ 'merchantId' => '101',
188
+ 'version'=>'8.8',
189
+ 'reportGroup'=>'Planets',
190
+ 'orderId'=>'12344',
191
+ 'amount'=>'106',
192
+ 'orderSource'=>'ecommerce',
193
+ 'processingType'=>'accountFunding',
194
+ 'card'=>{
195
+ 'type'=>'VI',
196
+ 'number' =>'4100000000000001',
197
+ 'expDate' =>'1210'
198
+ }}
199
+ response= LitleOnlineRequest.new.force_capture(hash)
200
+ assert_equal('000', response.forceCaptureResponse.response)
201
+ end
180
202
 
181
203
  end
182
204
 
@@ -0,0 +1,77 @@
1
+ =begin
2
+ Copyright (c) 2017 Vantiv eCommerce
3
+
4
+ Permission is hereby granted, free of charge, to any person
5
+ obtaining a copy of this software and associated documentation
6
+ files (the "Software"), to deal in the Software without
7
+ restriction, including without limitation the rights to use,
8
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the
10
+ Software is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
+ OTHER DEALINGS IN THE SOFTWARE.
24
+ =end
25
+ require File.expand_path("../../../lib/LitleOnline",__FILE__)
26
+ require 'test/unit'
27
+
28
+ #test FraudCheck Transaction
29
+ module LitleOnline
30
+ class TestFraudCheck < Test::Unit::TestCase
31
+ def test_fraud_check_happy_path
32
+ hash = {
33
+ 'merchantId' => '101',
34
+ 'version'=>'10.1',
35
+ 'id' => '127',
36
+ 'reportGroup'=>'Planets',
37
+ 'advancedFraudChecks' => {
38
+ 'threatMetrixSessionId' => 'test1-BXXXXXX003',
39
+ 'customAttribute1' => 'pass',
40
+ 'customAttribute2' => '55',
41
+ 'customAttribute3' => '5'}
42
+ }
43
+ response = LitleOnlineRequest.new.fraud_check_request(hash)
44
+ assert_equal('000', response.fraudCheckResponse.response)
45
+ assert_equal('Approved', response.fraudCheckResponse.message)
46
+ assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
47
+ assert_equal('42', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
48
+ assert_equal('triggered_rule_1', response.fraudCheckResponse.advancedFraudResults.triggeredRule[0])
49
+ assert_equal(5, response.fraudCheckResponse.advancedFraudResults.triggeredRule.size())
50
+ end
51
+
52
+ def test_fraud_check_session_id
53
+ hash = {
54
+ 'merchantId' => '101',
55
+ 'version'=>'10.1',
56
+ 'id' => '127',
57
+ 'reportGroup'=>'Planets',
58
+ 'advancedFraudChecks' => {
59
+ 'threatMetrixSessionId' => 'test2-BXXXXXX003'
60
+ }
61
+ }
62
+ response = LitleOnlineRequest.new.fraud_check_request(hash)
63
+ assert_equal('000', response.fraudCheckResponse.response)
64
+ assert_equal('Approved', response.fraudCheckResponse.message)
65
+ assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
66
+ assert_equal('42', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
67
+ # kind of a hack to get around the variable # of triggered rule elements. ie. 1 element is added as a string not
68
+ # an Array. Fix is to write an unmarshaller or custom node class in XMLFields.rb
69
+ if(response.fraudCheckResponse.advancedFraudResults.triggeredRule.is_a?(Array))
70
+ assert_equal('triggered_rule_default', response.fraudCheckResponse.advancedFraudResults.triggeredRule[0])
71
+ elsif
72
+ assert_equal('triggered_rule_default', response.fraudCheckResponse.advancedFraudResults.triggeredRule)
73
+ end
74
+ end
75
+
76
+ end
77
+ end
@@ -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
@@ -44,7 +44,7 @@ module LitleOnline
44
44
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
45
45
  entries.sort!
46
46
 
47
- assert_equal entries.size, 4
47
+ assert_equal 4, entries.size
48
48
  assert_not_nil entries[2] =~ /request_\d+\z/
49
49
  assert_not_nil entries[3] =~ /request_\d+_batches\z/
50
50
  end
@@ -57,7 +57,7 @@ module LitleOnline
57
57
  batch.close_batch
58
58
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
59
59
 
60
- assert_equal entries.length, 3
60
+ assert_equal 3, entries.length
61
61
  entries.sort!
62
62
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
63
63
 
@@ -72,7 +72,7 @@ module LitleOnline
72
72
  request.commit_batch(batch.get_batch_name)
73
73
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
74
74
  entries.sort!
75
- assert_equal entries.length, 4
75
+ assert_equal 4,entries.length
76
76
  assert_not_nil entries[2] =~ /request_\d+\z/
77
77
  assert_not_nil entries[3] =~ /request_\d+_batches\z/
78
78
  end
@@ -85,7 +85,7 @@ module LitleOnline
85
85
  batch.close_batch
86
86
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
87
87
 
88
- assert_equal entries.length, 3
88
+ assert_equal 3, entries.length
89
89
  entries.sort!
90
90
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
91
91
 
@@ -93,7 +93,7 @@ module LitleOnline
93
93
  request.create_new_litle_request(dir+ '/litle-sdk-for-ruby-test')
94
94
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
95
95
  entries.sort!
96
- assert_equal entries.length, 5
96
+ assert_equal 5, entries.length
97
97
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
98
98
  assert_not_nil entries[3] =~ /request_\d+\z/
99
99
  assert_not_nil entries[4] =~ /request_\d+_batches\z/
@@ -101,7 +101,7 @@ module LitleOnline
101
101
  request.commit_batch(batch)
102
102
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
103
103
  entries.sort!
104
- assert_equal entries.length, 4
104
+ assert_equal 4, entries.length
105
105
  assert_not_nil entries[2] =~ /request_\d+\z/
106
106
  assert_not_nil entries[3] =~ /request_\d+_batches\z/
107
107
  end
@@ -125,7 +125,7 @@ module LitleOnline
125
125
 
126
126
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
127
127
 
128
- assert_equal entries.length, 4
128
+ assert_equal 4, entries.length
129
129
  entries.sort!
130
130
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
131
131
  assert_not_nil entries[3] =~ /batch_\d+.closed-1\z/
@@ -134,7 +134,7 @@ module LitleOnline
134
134
  request.create_new_litle_request(dir+ '/litle-sdk-for-ruby-test')
135
135
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
136
136
  entries.sort!
137
- assert_equal entries.length, 6
137
+ assert_equal 6, entries.length
138
138
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
139
139
  assert_not_nil entries[3] =~ /batch_\d+.closed-1\z/
140
140
  assert_not_nil entries[4] =~ /request_\d+\z/
@@ -143,7 +143,7 @@ module LitleOnline
143
143
  request.commit_batch(batch)
144
144
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
145
145
  entries.sort!
146
- assert_equal entries.length, 4
146
+ assert_equal 4, entries.length
147
147
  assert_not_nil entries[2] =~ /request_\d+\z/
148
148
  assert_not_nil entries[3] =~ /request_\d+_batches\z/
149
149
  end
@@ -157,7 +157,7 @@ module LitleOnline
157
157
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
158
158
  entries.sort!
159
159
 
160
- assert_equal entries.size, 4
160
+ assert_equal 4, entries.size
161
161
  assert_not_nil entries[2] =~ /request_\d+\z/
162
162
  assert_not_nil entries[3] =~ /request_\d+_batches\z/
163
163
 
@@ -166,7 +166,7 @@ module LitleOnline
166
166
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
167
167
  entries.sort!
168
168
 
169
- assert_equal entries.size, 3
169
+ assert_equal 3, entries.size
170
170
  assert_not_nil entries[2] =~ /request_\d+.complete\z/
171
171
  end
172
172
 
@@ -182,7 +182,7 @@ module LitleOnline
182
182
  entries = Dir.entries(temp)
183
183
  entries.sort!
184
184
 
185
- assert_equal entries.size, 3
185
+ assert_equal 3, entries.size
186
186
  assert_not_nil entries[2] =~ /request_\d+.complete\z/
187
187
  end
188
188
 
@@ -199,7 +199,7 @@ module LitleOnline
199
199
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
200
200
  entries.sort!
201
201
 
202
- assert_equal entries.size, 3
202
+ assert_equal 3, entries.size
203
203
  assert_not_nil entries[2] =~ /request_\d+.complete.sent\z/
204
204
 
205
205
  uploaded_file = entries[2]
@@ -218,7 +218,7 @@ module LitleOnline
218
218
  files_on_srv.each {|file|
219
219
  ents.push(file.name)
220
220
  }
221
- assert_equal ents.size, 3
221
+ assert_equal 3,ents.size
222
222
  ents.sort!
223
223
  assert_equal ents[2], uploaded_file.gsub('sent', 'asc')
224
224
  sftp.remove('/inbound/' + ents[2])
@@ -238,14 +238,14 @@ module LitleOnline
238
238
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
239
239
  entries.sort!
240
240
 
241
- assert_equal entries.size, 4
241
+ assert_equal 4, entries.size
242
242
  assert_not_nil entries[2] =~ /request_\d+.complete.sent\z/
243
243
  File.delete(dir + '/litle-sdk-for-ruby-test/' + entries[2])
244
244
 
245
245
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test/responses')
246
246
  entries.sort!
247
247
 
248
- assert_equal entries.size, 3
248
+ assert_equal 3, entries.size
249
249
  assert_not_nil entries[2] =~ /response_\d+.complete.asc.received\z/
250
250
  end
251
251
 
@@ -270,7 +270,7 @@ module LitleOnline
270
270
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
271
271
  entries.sort!
272
272
 
273
- assert_equal entries.size, 4
273
+ assert_equal 4, entries.size
274
274
  assert_not_nil entries[2] =~ /request_\d+\z/
275
275
  assert_not_nil entries[3] =~ /request_\d+_batches\z/
276
276
 
@@ -281,7 +281,7 @@ module LitleOnline
281
281
 
282
282
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
283
283
 
284
- assert_equal entries.length, 6
284
+ assert_equal 6, entries.length
285
285
  entries.sort!
286
286
  assert_not_nil entries[2] =~ /batch_\d+\z/
287
287
  assert_not_nil entries[3] =~ /batch_\d+_txns\z/
@@ -298,7 +298,7 @@ module LitleOnline
298
298
  batch.close_batch()
299
299
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
300
300
 
301
- assert_equal entries.length, 5
301
+ assert_equal 5, entries.length
302
302
  entries.sort!
303
303
  assert_not_nil entries[2] =~ /batch_\d+.closed-\d+\z/
304
304
  assert_not_nil entries[3] =~ /request_\d+\z/
@@ -307,7 +307,7 @@ module LitleOnline
307
307
  #add the batch to the LitleRequest
308
308
  request.commit_batch(batch)
309
309
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
310
- assert_equal entries.length, 4
310
+ assert_equal 4, entries.length
311
311
  entries.sort!
312
312
  assert_not_nil entries[2] =~ /request_\d+\z/
313
313
  assert_not_nil entries[3] =~ /request_\d+_batches\z/
@@ -315,7 +315,7 @@ module LitleOnline
315
315
  #finish the Litle Request, indicating we plan to add no more batches
316
316
  request.finish_request
317
317
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
318
- assert_equal entries.length, 3
318
+ assert_equal 3, entries.length
319
319
  entries.sort!
320
320
  assert_not_nil entries[2] =~ /request_\d+.complete\z/
321
321
 
@@ -331,14 +331,14 @@ module LitleOnline
331
331
  request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction| end})
332
332
 
333
333
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
334
- assert_equal entries.length, 4
334
+ assert_equal 4, entries.length
335
335
  entries.sort!
336
336
  assert_not_nil entries[2] =~ /request_\d+.complete.sent\z/
337
337
  File.delete(dir + '/litle-sdk-for-ruby-test/' + entries[2])
338
338
 
339
339
  entries = Dir.entries(dir + '/litle-sdk-for-ruby-test/' + entries[3])
340
340
  entries.sort!
341
- assert_equal entries.length, 3
341
+ assert_equal 3, entries.length
342
342
  assert_not_nil entries[2] =~ /response_\d+.complete.asc.received.processed\z/
343
343
 
344
344
  end
@@ -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
@@ -75,8 +75,10 @@ def test_simple_happy
75
75
  'amount' =>'500',
76
76
  }
77
77
 
78
- response= LitleOnlineRequest.new.load_request(hash)
79
- assert(response.message =~ /Error validating xml data against the schema/)
78
+ #Get exceptions
79
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.load_request(hash)}
80
+ #Test
81
+ assert(exception.message =~ /Error validating xml data against the schema/)
80
82
  end
81
83
  end
82
84
  end
@@ -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
@@ -49,8 +49,10 @@ def test_simple
49
49
  'reportGroup'=>'Planets',
50
50
  }
51
51
 
52
- response= LitleOnlineRequest.new.load_reversal(hash)
53
- assert(response.message =~ /Error validating xml data against the schema/)
52
+ #Get exceptions
53
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.load_reversal(hash)}
54
+ #Test
55
+ assert(exception.message =~ /Error validating xml data against the schema/)
54
56
  end
55
57
  end
56
58
  end
@@ -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
@@ -49,8 +49,10 @@ def test_simple
49
49
  'reportGroup'=>'Planets',
50
50
  }
51
51
 
52
- response= LitleOnlineRequest.new.refund_reversal(hash)
53
- assert(response.message =~ /Error validating xml data against the schema/)
52
+ #Get exceptions
53
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.refund_reversal(hash)}
54
+ #Test
55
+ assert(exception.message =~ /Error validating xml data against the schema/)
54
56
  end
55
57
  end
56
58
  end
@@ -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
@@ -27,24 +27,6 @@ require 'test/unit'
27
27
 
28
28
  module LitleOnline
29
29
  class TestSale < Test::Unit::TestCase
30
- def test_simple_sale_with_card
31
- hash = {
32
- 'merchantId' => '101',
33
- 'version'=>'8.8',
34
- 'reportGroup'=>'Planets',
35
- 'litleTxnId'=>'123456',
36
- 'orderId'=>'12344',
37
- 'amount'=>'106',
38
- 'orderSource'=>'ecommerce',
39
- 'card'=>{
40
- 'type'=>'VI',
41
- 'number' =>'4100000000000002',
42
- 'expDate' =>'1210'
43
- }}
44
- response= LitleOnlineRequest.new.sale(hash)
45
- assert_equal('000', response.saleResponse.response)
46
- end
47
-
48
30
  def test_simple_sale_with_paypal
49
31
  hash = {
50
32
  'merchantId' => '101',
@@ -82,7 +64,7 @@ module LitleOnline
82
64
  'transactionId'=>'1234'
83
65
  },
84
66
  'signature' =>'1',
85
- 'version'=>'12345'
67
+ 'version'=>'1.0.0'
86
68
  }}
87
69
  response= LitleOnlineRequest.new.sale(hash)
88
70
  assert_equal('Insufficient Funds', response.saleResponse.message)
@@ -103,8 +85,10 @@ module LitleOnline
103
85
  'number' =>'4100000000000002',
104
86
  'expDate' =>'1210'
105
87
  }}
106
- response= LitleOnlineRequest.new.sale(hash)
107
- assert(response.message =~ /Error validating xml data against the schema/)
88
+ #Get exceptions
89
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
90
+ #Test
91
+ assert(exception.message =~ /Error validating xml data against the schema/)
108
92
  end
109
93
 
110
94
  def test_no_report_group
@@ -194,8 +178,10 @@ module LitleOnline
194
178
  'number' =>'4100000000000002',
195
179
  'expDate' =>'1210'
196
180
  }}
197
- response= LitleOnlineRequest.new.sale(hash)
198
- assert(response.message =~ /Error validating xml data against the schema/)
181
+ #Get exceptions
182
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
183
+ #Test
184
+ assert(exception.message =~ /Error validating xml data against the schema/)
199
185
  end
200
186
 
201
187
  def test_no_amount
@@ -211,8 +197,10 @@ module LitleOnline
211
197
  'number' =>'4100000000000002',
212
198
  'expDate' =>'1210'
213
199
  }}
214
- response= LitleOnlineRequest.new.sale(hash)
215
- assert(response.message =~ /Error validating xml data against the schema/)
200
+ #Get exceptions
201
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
202
+ #Test
203
+ assert(exception.message =~ /Error validating xml data against the schema/)
216
204
  end
217
205
 
218
206
  def test_no_order_source
@@ -228,8 +216,10 @@ module LitleOnline
228
216
  'number' =>'4100000000000002',
229
217
  'expDate' =>'1210'
230
218
  }}
231
- response= LitleOnlineRequest.new.sale(hash)
232
- assert(response.message =~ /Error validating xml data against the schema/)
219
+ #Get exceptions
220
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
221
+ #Test
222
+ assert(exception.message =~ /Error validating xml data against the schema/)
233
223
  end
234
224
 
235
225
  def test_simple_sale_with_mpos
@@ -254,6 +244,201 @@ module LitleOnline
254
244
  assert_equal('000', response.saleResponse.response)
255
245
  end
256
246
 
257
- end
247
+ def test_simple_sale_with_processingType
248
+ hash = {
249
+ 'merchantId' => '101',
250
+ 'version'=>'8.8',
251
+ 'reportGroup'=>'Planets',
252
+ 'litleTxnId'=>'123456',
253
+ 'orderId'=>'12344',
254
+ 'amount'=>'106',
255
+ 'orderSource'=>'ecommerce',
256
+ 'card'=>
257
+ {
258
+ 'type'=>'MC',
259
+ 'number' =>'5400000000000000',
260
+ 'expDate' =>'1210'
261
+ },
262
+ 'processingType'=>'initialInstallment'
263
+ }
264
+ response= LitleOnlineRequest.new.sale(hash)
265
+ assert_equal('000', response.saleResponse.response)
266
+ end
258
267
 
268
+ def test_simple_sale_with_originalNetworkTransactionId_originalTransactionAmount
269
+ hash = {
270
+ 'merchantId' => '101',
271
+ 'version'=>'8.8',
272
+ 'reportGroup'=>'Planets',
273
+ 'litleTxnId'=>'123456',
274
+ 'orderId'=>'12344',
275
+ 'amount'=>'106',
276
+ 'orderSource'=>'ecommerce',
277
+ 'card'=>
278
+ {
279
+ 'type'=>'MC',
280
+ 'number' =>'5400700000000000',
281
+ 'expDate' =>'1210'
282
+ },
283
+ 'originalNetworkTransactionId'=>'98765432109876543210',
284
+ 'originalTransactionAmount'=>'7001'
285
+ }
286
+ response= LitleOnlineRequest.new.sale(hash)
287
+ assert_equal('000', response.saleResponse.response)
288
+ end
289
+
290
+ def test_simple_sale_with_networkTxnId_response_cardSuffix_response
291
+ hash = {
292
+ 'merchantId' => '101',
293
+ 'version'=>'8.8',
294
+ 'reportGroup'=>'Planets',
295
+ 'litleTxnId'=>'123456',
296
+ 'orderId'=>'12344',
297
+ 'amount'=>'106',
298
+ 'orderSource'=>'ecommerce',
299
+ 'card'=>
300
+ {
301
+ 'type'=>'VI',
302
+ 'number' =>'4100700000000000',
303
+ 'expDate' =>'1210',
304
+ 'pin'=>'1111'
305
+ },
306
+ 'originalNetworkTransactionId'=>'98765432109876543210',
307
+ 'originalTransactionAmount'=>'7001'
308
+ }
309
+ response= LitleOnlineRequest.new.sale(hash)
310
+ assert_equal('000', response.saleResponse.response)
311
+ assert_equal('123456', response.saleResponse.cardSuffix)
312
+ assert_equal('63225578415568556365452427825', response.saleResponse.networkTransactionId)
313
+ end
314
+
315
+ def test_simple_sale_with_Wallet_Visa
316
+ hash = {
317
+ 'merchantId' => '101',
318
+ 'version'=>'8.8',
319
+ 'reportGroup'=>'Planets',
320
+ 'litleTxnId'=>'123456',
321
+ 'orderId'=>'12344',
322
+ 'amount'=>'106',
323
+ 'orderSource'=>'ecommerce',
324
+ 'card'=>
325
+ {
326
+ 'type'=>'VI',
327
+ 'number' =>'4100700000000000',
328
+ 'expDate' =>'1210',
329
+ },
330
+ 'wallet'=>{
331
+ 'walletSourceType'=>'VisaCheckout',
332
+ 'walletSourceTypeId'=>'VCIND'
333
+ }
334
+ }
335
+ response= LitleOnlineRequest.new.sale(hash)
336
+ assert_equal('000', response.saleResponse.response)
337
+ assert_equal('123456', response.saleResponse.cardSuffix)
338
+ assert_equal('63225578415568556365452427825', response.saleResponse.networkTransactionId)
339
+ end
340
+
341
+ def test_simple_sale_with_Wallet_Mastercard
342
+ hash = {
343
+ 'merchantId' => '101',
344
+ 'version'=>'8.8',
345
+ 'reportGroup'=>'Planets',
346
+ 'litleTxnId'=>'123456',
347
+ 'orderId'=>'12344',
348
+ 'amount'=>'106',
349
+ 'orderSource'=>'ecommerce',
350
+ 'card'=>
351
+ {
352
+ 'type'=>'MC',
353
+ 'number' =>'5400000000000000',
354
+ 'expDate' =>'1210',
355
+ },
356
+ 'wallet'=>{
357
+ 'walletSourceType'=>'MasterPass',
358
+ 'walletSourceTypeId'=>'MasterPass'
359
+ }
360
+ }
361
+ response= LitleOnlineRequest.new.sale(hash)
362
+ assert_equal('000', response.saleResponse.response)
363
+ end
364
+
365
+ def test_simple_sale_with_sepaDirectDebit
366
+ hash = {
367
+ 'merchantId' => '101',
368
+ 'version'=>'8.8',
369
+ 'reportGroup'=>'Planets',
370
+ 'litleTxnId'=>'123456',
371
+ 'orderId'=>'12344',
372
+ 'amount'=>'106',
373
+ 'orderSource'=>'ecommerce',
374
+ 'sepaDirectDebit'=>
375
+ {
376
+ 'iban'=>'SepaDirectDebit Iban',
377
+ 'mandateProvider' =>'Merchant',
378
+ 'sequenceType' =>'OneTime',
379
+ },
380
+ }
381
+ response= LitleOnlineRequest.new.sale(hash)
382
+ assert_equal('000', response.saleResponse.response)
383
+ assert_equal('http://redirect.url.vantiv.com', response.saleResponse.sepaDirectDebitResponse.redirectUrl)
384
+ end
385
+
386
+ def test_simple_sale_with_ideal
387
+ hash = {
388
+ 'merchantId' => '101',
389
+ 'version'=>'8.8',
390
+ 'reportGroup'=>'Planets',
391
+ 'litleTxnId'=>'123456',
392
+ 'orderId'=>'12344',
393
+ 'amount'=>'106',
394
+ 'orderSource'=>'ecommerce',
395
+ 'ideal'=>
396
+ {
397
+ 'preferredLanguage'=>'AD',
398
+ }
399
+ }
400
+ response= LitleOnlineRequest.new.sale(hash)
401
+ assert_equal('000', response.saleResponse.response)
402
+ assert_equal('http://redirect.url.vantiv.com', response.saleResponse.idealResponse.redirectUrl)
403
+ end
404
+
405
+ # def test_simple_sale_with_giropay
406
+ # hash = {
407
+ # 'merchantId' => '101',
408
+ # 'version'=>'9.14',
409
+ # 'reportGroup'=>'Planets',
410
+ # 'litleTxnId'=>'123456',
411
+ # 'orderId'=>'12344',
412
+ # 'amount'=>'106',
413
+ # 'orderSource'=>'ecommerce',
414
+ # 'giropay'=>
415
+ # {
416
+ # 'preferredLanguage'=>'AD',
417
+ # }
418
+ # }
419
+ # response= LitleOnlineRequest.new.sale(hash)
420
+ # assert_equal('000', response.saleResponse.response)
421
+ # assert_equal('http://redirect.url.vantiv.com', response.saleResponse.giropayResponse.redirectUrl)
422
+ # end
423
+ #
424
+ # def test_simple_sale_with_sofort
425
+ # hash = {
426
+ # 'merchantId' => '101',
427
+ # 'version'=>'8.8',
428
+ # 'reportGroup'=>'Planets',
429
+ # 'litleTxnId'=>'123456',
430
+ # 'orderId'=>'12344',
431
+ # 'amount'=>'106',
432
+ # 'orderSource'=>'ecommerce',
433
+ # 'sofort'=>
434
+ # {
435
+ # 'preferredLanguage'=>'AD',
436
+ # },
437
+ # }
438
+ # response= LitleOnlineRequest.new.sale(hash)
439
+ # assert_equal('000', response.saleResponse.response)
440
+ # assert_equal('http://redirect.url.vantiv.com', response.saleResponse.sofortResponse.redirectUrl)
441
+ # end
442
+
443
+ end
259
444
  end