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,102 @@
1
+ =begin
2
+ Copyright (c) 2012 Litle & Co.
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 'lib/LitleOnline'
26
+ require 'test/unit'
27
+
28
+ class TestToken < Test::Unit::TestCase
29
+ def test_simpleToken
30
+ hash = {
31
+ 'merchantId' => '101',
32
+ 'version'=>'8.8',
33
+ 'reportGroup'=>'Planets',
34
+ 'orderId'=>'12344',
35
+ 'accountNumber'=>'1233456789103801'
36
+ }
37
+ response= LitleOnlineRequest.new.registerTokenRequest(hash)
38
+ assert_equal('Valid Format', response.message)
39
+ end
40
+
41
+ def test_simpleTokenwithpaypage
42
+ hash = {
43
+ 'merchantId' => '101',
44
+ 'version'=>'8.8',
45
+ 'reportGroup'=>'Planets',
46
+ 'orderId'=>'12344',
47
+ 'paypageRegistrationId'=>'1233456789101112'
48
+ }
49
+ response= LitleOnlineRequest.new.registerTokenRequest(hash)
50
+ assert_equal('Valid Format', response.message)
51
+ end
52
+
53
+ def test_simpleTokenecheck
54
+ hash = {
55
+ 'reportGroup'=>'Planets',
56
+ 'merchantId' => '101',
57
+ 'version'=>'8.8',
58
+ 'orderId'=>'12344',
59
+ 'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'}
60
+ }
61
+ response= LitleOnlineRequest.new.registerTokenRequest(hash)
62
+ assert_equal('Valid Format', response.message)
63
+ end
64
+
65
+ def test_Tokenecheckmissingrequired
66
+ hash = {
67
+ 'merchantId' => '101',
68
+ 'version'=>'8.8',
69
+ 'reportGroup'=>'Planets',
70
+ 'orderId'=>'12344',
71
+ 'echeckForToken'=>{'routingNum'=>'132344565'}
72
+ }
73
+ response= LitleOnlineRequest.new.registerTokenRequest(hash)
74
+ assert(response.message =~ /Error validating xml data against the schema/)
75
+ end
76
+
77
+ def test_FieldsOutOfOrder
78
+ hash = {
79
+ 'merchantId' => '101',
80
+ 'version'=>'8.8',
81
+ 'orderId'=>'12344',
82
+ 'accountNumber'=>'1233456789103801',
83
+ 'reportGroup'=>'Planets',
84
+ }
85
+ response= LitleOnlineRequest.new.registerTokenRequest(hash)
86
+ assert_equal('Valid Format', response.message)
87
+ end
88
+
89
+ def test_InvalidField
90
+ hash = {
91
+ 'merchantId' => '101',
92
+ 'version'=>'8.8',
93
+ 'NOSUCHFIELD'=>'none',
94
+ 'orderId'=>'12344',
95
+ 'accountNumber'=>'1233456789103801',
96
+ 'reportGroup'=>'Planets',
97
+ }
98
+ response= LitleOnlineRequest.new.registerTokenRequest(hash)
99
+ assert_equal('Valid Format', response.message)
100
+ end
101
+ end
102
+
@@ -0,0 +1,403 @@
1
+ =begin
2
+ Copyright (c) 2012 Litle & Co.
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 'lib/LitleOnline'
26
+ require 'test/unit'
27
+
28
+ class TestXmlfields < Test::Unit::TestCase
29
+ def test_cardnoRequiredtypeortrack
30
+ hash = {
31
+ 'merchantId' => '101',
32
+ 'version'=>'8.8',
33
+ 'reportGroup'=>'Planets',
34
+ 'litleTxnId'=>'123456',
35
+ 'orderId'=>'12344',
36
+ 'amount'=>'106',
37
+ 'orderSource'=>'ecommerce',
38
+ 'card'=>{
39
+ 'number' =>'4100000000000001',
40
+ 'expDate' =>'1210',
41
+ 'cardValidationNum'=> '123'
42
+ }}
43
+ response= LitleOnlineRequest.new.sale(hash)
44
+ assert(response.message =~ /Error validating xml data against the schema/)
45
+ end
46
+
47
+ def test_simpleCustomBilling
48
+ hash = {
49
+ 'merchantId' => '101',
50
+ 'version'=>'8.8',
51
+ 'reportGroup'=>'Planets',
52
+ 'litleTxnId'=>'123456',
53
+ 'orderId'=>'12344',
54
+ 'amount'=>'106',
55
+ 'orderSource'=>'ecommerce',
56
+ 'customBilling'=>{'phone'=>'123456789','descriptor'=>'good'},
57
+ 'card'=>{
58
+ 'type'=>'VI',
59
+ 'number' =>'4100000000000001',
60
+ 'expDate' =>'1210'
61
+ }}
62
+ response= LitleOnlineRequest.new.sale(hash)
63
+ assert_equal('Valid Format', response.message)
64
+ end
65
+
66
+ def test_BillMeLater
67
+ hash = {
68
+ 'merchantId' => '101',
69
+ 'version'=>'8.8',
70
+ 'reportGroup'=>'Planets',
71
+ 'litleTxnId'=>'123456',
72
+ 'orderId'=>'12344',
73
+ 'amount'=>'106',
74
+ 'orderSource'=>'ecommerce',
75
+ 'billMeLaterRequest'=>{'bmlMerchantId'=>'12345','preapprovalNumber'=>'12345678909023',
76
+ 'customerPhoneChnaged'=>'False','itemCategoryCode'=>'2'},
77
+ 'card'=>{
78
+ 'type'=>'VI',
79
+ 'number' =>'4100000000000002',
80
+ 'expDate' =>'1210'
81
+ }}
82
+ response= LitleOnlineRequest.new.sale(hash)
83
+ assert_equal('000', response.saleResponse.response)
84
+ end
85
+
86
+ def test_CustomerInfo
87
+ hash = {
88
+ 'merchantId' => '101',
89
+ 'version'=>'8.8',
90
+ 'reportGroup'=>'Planets',
91
+ 'litleTxnId'=>'123456',
92
+ 'orderId'=>'12344',
93
+ 'amount'=>'106',
94
+ 'orderSource'=>'ecommerce',
95
+ 'CustomerInfo'=>{'ssn'=>'12345','incomeAmount'=>'12345','incomeCurrency'=>'dollar','yearsAtResidence'=>'2'},
96
+ 'card'=>{
97
+ 'type'=>'VI',
98
+ 'number' =>'4100000000000001',
99
+ 'expDate' =>'1210'
100
+ }}
101
+ response= LitleOnlineRequest.new.sale(hash)
102
+ assert_equal('Valid Format', response.message)
103
+ end
104
+
105
+ def test_simplebilltoAddress
106
+ hash = {
107
+ 'merchantId' => '101',
108
+ 'version'=>'8.8',
109
+ 'reportGroup'=>'Planets',
110
+ 'orderId'=>'12344',
111
+ 'amount'=>'106',
112
+ 'orderSource'=>'ecommerce',
113
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
114
+ 'card'=>{
115
+ 'type'=>'VI',
116
+ 'number' =>'4100000000000001',
117
+ 'expDate' =>'1210'
118
+ }}
119
+ response= LitleOnlineRequest.new.authorization(hash)
120
+ assert_equal('Valid Format', response.message)
121
+ end
122
+
123
+ def test_processingInstructions
124
+ hash = {
125
+ 'merchantId' => '101',
126
+ 'version'=>'8.8',
127
+ 'reportGroup'=>'Planets',
128
+ 'orderId'=>'12344',
129
+ 'amount'=>'106',
130
+ 'orderSource'=>'ecommerce',
131
+ 'processingInstructions'=>{'bypassVelocityCheck'=>'true'},
132
+ 'card'=>{
133
+ 'type'=>'VI',
134
+ 'number' =>'4100000000000001',
135
+ 'expDate' =>'1210'
136
+ }}
137
+ response= LitleOnlineRequest.new.authorization(hash)
138
+ assert_equal('Valid Format', response.message)
139
+ end
140
+
141
+ def test_pos
142
+ hash = {
143
+ 'merchantId' => '101',
144
+ 'version'=>'8.8',
145
+ 'reportGroup'=>'Planets',
146
+ 'orderId'=>'12344',
147
+ 'amount'=>'106',
148
+ 'orderSource'=>'ecommerce',
149
+ 'pos'=>{'capability'=>'notused','entryMode'=>'track1','cardholderId'=>'pin'},
150
+ 'card'=>{
151
+ 'type'=>'VI',
152
+ 'number' =>'4100000000000001',
153
+ 'expDate' =>'1210'
154
+ }}
155
+ response= LitleOnlineRequest.new.authorization(hash)
156
+ assert_equal('Valid Format', response.message)
157
+ end
158
+
159
+ def test_poswithinvalidentryMode
160
+ hash = {
161
+ 'merchantId' => '101',
162
+ 'version'=>'8.8',
163
+ 'reportGroup'=>'Planets',
164
+ 'orderId'=>'12344',
165
+ 'amount'=>'106',
166
+ 'orderSource'=>'ecommerce',
167
+ 'pos'=>{'entryMode'=>'none','cardholderId'=>'pin','capability'=>'notused'},
168
+ 'card'=>{
169
+ 'type'=>'VI',
170
+ 'number' =>'4100000000000001',
171
+ 'expDate' =>'1210'
172
+ }}
173
+ response= LitleOnlineRequest.new.credit(hash)
174
+ assert(response.message =~ /Error validating xml data against the schema/)
175
+ end
176
+
177
+ def test_amexData
178
+ hash = {
179
+ 'merchantId' => '101',
180
+ 'version'=>'8.8',
181
+ 'reportGroup'=>'Planets',
182
+ 'orderId'=>'12344',
183
+ 'amount'=>'106',
184
+ 'card'=>{
185
+ 'type'=>'VI',
186
+ 'number' =>'4100000000000001',
187
+ 'expDate' =>'1210'},
188
+ 'orderSource'=>'ecommerce',
189
+ 'amexAggregatorData'=>{'sellerMerchantCategoryCode'=>'1234','sellerId'=>'1234Id'}
190
+ }
191
+ response= LitleOnlineRequest.new.credit(hash)
192
+ assert_equal('Valid Format', response.message)
193
+ end
194
+
195
+ def test_amexDatamissingsellerId
196
+ hash = {
197
+ 'merchantId' => '101',
198
+ 'version'=>'8.8',
199
+ 'reportGroup'=>'Planets',
200
+ 'orderId'=>'12344',
201
+ 'amount'=>'106',
202
+ 'orderSource'=>'ecommerce',
203
+ 'card'=>{
204
+ 'type'=>'VI',
205
+ 'number' =>'4100000000000001',
206
+ 'expDate' =>'1210'},
207
+ 'amexAggregatorData'=>{'sellerMerchantCategoryCode'=>'1234'}
208
+ }
209
+ response= LitleOnlineRequest.new.credit(hash)
210
+ assert(response.message =~ /Error validating xml data against the schema/)
211
+ end
212
+
213
+ def test_simpleEnhancedData
214
+ hash = {
215
+ 'merchantId' => '101',
216
+ 'version'=>'8.8',
217
+ 'reportGroup'=>'Planets',
218
+ 'orderId'=>'12344',
219
+ 'amount'=>'106',
220
+ 'card'=>{
221
+ 'type'=>'VI',
222
+ 'number' =>'4100000000000001',
223
+ 'expDate' =>'1210'},
224
+ 'orderSource'=>'ecommerce',
225
+ 'enhancedData'=>{
226
+ 'customerReference'=>'Litle',
227
+ 'salesTax'=>'50',
228
+ 'deliveryType'=>'TBD',
229
+ 'restriction'=>'DIG',
230
+ 'shipFromPostalCode'=>'01741',
231
+ 'destinationPostalCode'=>'01742'}
232
+ }
233
+ response= LitleOnlineRequest.new.credit(hash)
234
+ assert_equal('Valid Format', response.message)
235
+ end
236
+
237
+ def test_simpleEnhancedDataincorrectEnumforCountryCode
238
+ hash = {
239
+ 'merchantId' => '101',
240
+ 'version'=>'8.8',
241
+ 'reportGroup'=>'Planets',
242
+ 'orderId'=>'12344',
243
+ 'amount'=>'106',
244
+ 'card'=>{
245
+ 'type'=>'VI',
246
+ 'number' =>'4100000000000001',
247
+ 'expDate' =>'1210'},
248
+ 'orderSource'=>'ecommerce',
249
+ 'enhancedData'=>{
250
+ 'destinationCountryCode'=>'001',
251
+ 'customerReference'=>'Litle',
252
+ 'salesTax'=>'50',
253
+ 'deliveryType'=>'TBD',
254
+ 'shipFromPostalCode'=>'01741',
255
+ 'destinationPostalCode'=>'01742'}
256
+ }
257
+ response= LitleOnlineRequest.new.credit(hash)
258
+ assert(response.message =~ /Error validating xml data against the schema/)
259
+ end
260
+
261
+ def test_EnhancedDatawithdetailtax
262
+ hash = {
263
+ 'merchantId' => '101',
264
+ 'version'=>'8.8',
265
+ 'reportGroup'=>'Planets',
266
+ 'orderId'=>'12344',
267
+ 'amount'=>'106',
268
+ 'card'=>{
269
+ 'type'=>'VI',
270
+ 'number' =>'4100000000000001',
271
+ 'expDate' =>'1210'},
272
+ 'orderSource'=>'ecommerce',
273
+ 'enhancedData'=>{
274
+ 'detailtax'=>{'taxAmount'=>'1234','tax'=>'50'},
275
+ 'customerReference'=>'Litle',
276
+ 'salesTax'=>'50',
277
+ 'deliveryType'=>'TBD',
278
+ 'restriction'=>'DIG',
279
+ 'shipFromPostalCode'=>'01741',
280
+ 'destinationPostalCode'=>'01742'}
281
+ }
282
+ response= LitleOnlineRequest.new.credit(hash)
283
+ assert_equal('Valid Format', response.message)
284
+ end
285
+
286
+ def test_EnhancedDatawithlineItem
287
+ hash = {
288
+ 'merchantId' => '101',
289
+ 'version'=>'8.8',
290
+ 'reportGroup'=>'Planets',
291
+ 'orderId'=>'12344',
292
+ 'amount'=>'106',
293
+ 'card'=>{
294
+ 'type'=>'VI',
295
+ 'number' =>'4100000000000001',
296
+ 'expDate' =>'1210'}, 'processingInstructions'=>{'bypassVelocityCheck'=>'true'},
297
+ 'orderSource'=>'ecommerce',
298
+ 'lineItemData'=>{
299
+ 'itemSequenceNumber'=>'98765',
300
+ 'itemDescription'=>'VERYnice',
301
+ 'productCode'=>'10010100',
302
+ 'quantity'=>'7',
303
+ 'unitOfMeasure'=>'pounds',
304
+ 'enhancedData'=>{
305
+ 'detailtax'=>{'taxAmount'=>'1234','tax'=>'50'}},
306
+ 'customerReference'=>'Litle',
307
+ 'salesTax'=>'50',
308
+ 'deliveryType'=>'TBD',
309
+ 'restriction'=>'DIG',
310
+ 'shipFromPostalCode'=>'01741',
311
+ 'destinationPostalCode'=>'01742'}
312
+ }
313
+ response= LitleOnlineRequest.new.credit(hash)
314
+ assert_equal('Valid Format', response.message)
315
+ end
316
+
317
+ def test_simpletoken
318
+ hash = {
319
+ 'merchantId' => '101',
320
+ 'version'=>'8.8',
321
+ 'reportGroup'=>'Planets',
322
+ 'orderId'=>'12344',
323
+ 'amount'=>'106',
324
+ 'orderSource'=>'ecommerce',
325
+ 'token'=> {
326
+ 'litleToken'=>'123456789101112',
327
+ 'expDate'=>'1210',
328
+ 'cardValidationNum'=>'555',
329
+ 'type'=>'VI'
330
+ }}
331
+ response= LitleOnlineRequest.new.credit(hash)
332
+ assert_equal('Valid Format', response.message)
333
+ end
334
+
335
+ def test_tokenwithincorrecttokenLength
336
+ hash = {
337
+ 'merchantId' => '101',
338
+ 'version'=>'8.8',
339
+ 'reportGroup'=>'Planets',
340
+ 'orderId'=>'12344',
341
+ 'amount'=>'106',
342
+ 'orderSource'=>'ecommerce',
343
+ 'token'=> {
344
+ 'litleToken'=>'123456',
345
+ 'expDate'=>'1210',
346
+ 'cardValidationNum'=>'555',
347
+ 'type'=>'VI'
348
+ }}
349
+ response= LitleOnlineRequest.new.credit(hash)
350
+ assert(response.message =~ /Error validating xml data against the schema/)
351
+ end
352
+
353
+ def test_tokenmissingexpDatandvalidNum
354
+ hash = {
355
+ 'merchantId' => '101',
356
+ 'version'=>'8.8',
357
+ 'reportGroup'=>'Planets',
358
+ 'orderId'=>'12344',
359
+ 'amount'=>'106',
360
+ 'orderSource'=>'ecommerce',
361
+ 'token'=> {
362
+ 'litleToken'=>'123456789101112',
363
+ 'type'=>'VI'
364
+ }}
365
+ response= LitleOnlineRequest.new.credit(hash)
366
+ assert_equal('Valid Format', response.message)
367
+ end
368
+
369
+ def test_simplePaypage
370
+ hash = {
371
+ 'merchantId' => '101',
372
+ 'version'=>'8.8',
373
+ 'reportGroup'=>'Planets',
374
+ 'orderId'=>'12344',
375
+ 'amount'=>'106',
376
+ 'orderSource'=>'ecommerce',
377
+ 'paypage'=> {
378
+ 'paypageRegistrationId'=>'123456789101112',
379
+ 'expDate'=>'1210',
380
+ 'cardValidationNum'=>'555',
381
+ 'type'=>'VI'
382
+ }}
383
+ response= LitleOnlineRequest.new.credit(hash)
384
+ assert_equal('Valid Format', response.message)
385
+ end
386
+
387
+ def test_paypagemissingexpDatandvalidNum
388
+ hash = {
389
+ 'merchantId' => '101',
390
+ 'version'=>'8.8',
391
+ 'reportGroup'=>'Planets',
392
+ 'orderId'=>'12344',
393
+ 'amount'=>'106',
394
+ 'orderSource'=>'ecommerce',
395
+ 'paypage'=> {
396
+ 'paypageRegistrationId'=>'123456789101112',
397
+ 'type'=>'VI'
398
+ }}
399
+ response= LitleOnlineRequest.new.credit(hash)
400
+ assert_equal('Valid Format', response.message)
401
+ end
402
+ end
403
+