LitleOnline 8.12.0 → 8.12.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +28 -0
- data/Rakefile +2 -3
- data/lib/Communications.rb +14 -12
- data/lib/LitleOnline.rb +11 -2
- data/lib/LitleOnlineRequest.rb +435 -284
- data/lib/LitleXmlMapper.rb +1 -2
- data/lib/XMLFields.rb +900 -307
- data/lib/cacert.pem +3331 -0
- data/test/certification/certTest2_authenhanced.rb +7 -7
- data/test/certification/certTest5_token.rb +8 -8
- data/test/functional/test_auth.rb +106 -3
- data/test/functional/test_authReversal.rb +5 -6
- data/test/functional/test_capture.rb +12 -1
- data/test/functional/test_captureGivenAuth.rb +25 -5
- data/test/functional/test_credit.rb +1 -1
- data/test/functional/test_echeckRedeposit.rb +34 -0
- data/test/functional/test_echeckVerification.rb +33 -0
- data/test/functional/test_forceCapture.rb +35 -0
- data/test/functional/test_sale.rb +45 -13
- data/test/functional/test_xmlfields.rb +197 -10
- data/test/functional/ts_all.rb +2 -0
- data/test/unit/test_LitleOnlineRequest.rb +2 -59
- data/test/unit/test_auth.rb +2 -51
- data/test/unit/test_authReversal.rb +10 -5
- data/test/unit/test_capture.rb +5 -7
- data/test/unit/test_captureGivenAuth.rb +0 -19
- data/test/unit/test_credit.rb +1 -0
- data/test/unit/test_echeckCredit.rb +0 -2
- data/test/unit/test_echeckRedeposit.rb +0 -34
- data/test/unit/test_echeckSale.rb +0 -1
- data/test/unit/test_echeckVerification.rb +0 -33
- data/test/unit/test_forceCapture.rb +0 -35
- data/test/unit/test_sale.rb +20 -51
- data/test/unit/test_xmlfields.rb +44 -84
- data/test/unit/ts_unit.rb +1 -1
- metadata +13 -26
- data/index.html +0 -176
- data/index.html.1 +0 -176
- data/lib/Checker.rb +0 -56
- data/test/unit/test_Checker.rb +0 -58
@@ -101,5 +101,40 @@ class TestForceCapture < Test::Unit::TestCase
|
|
101
101
|
assert_equal('Valid Format', response.message)
|
102
102
|
end
|
103
103
|
|
104
|
+
def test_no_order_id
|
105
|
+
hash = {
|
106
|
+
'merchantId' => '101',
|
107
|
+
'version'=>'8.8',
|
108
|
+
'reportGroup'=>'Planets',
|
109
|
+
'litleTxnId'=>'123456',
|
110
|
+
'amount'=>'106',
|
111
|
+
'orderSource'=>'ecommerce',
|
112
|
+
'token'=> {
|
113
|
+
'litleToken'=>'123456789101112',
|
114
|
+
'expDate'=>'1210',
|
115
|
+
'cardValidationNum'=>'555',
|
116
|
+
'type'=>'VI'
|
117
|
+
}}
|
118
|
+
response= LitleOnlineRequest.new.force_capture(hash)
|
119
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_no_order_source
|
123
|
+
hash = {
|
124
|
+
'merchantId' => '101',
|
125
|
+
'version'=>'8.8',
|
126
|
+
'reportGroup'=>'Planets',
|
127
|
+
'litleTxnId'=>'123456',
|
128
|
+
'orderId'=>'12344',
|
129
|
+
'amount'=>'106',
|
130
|
+
'card'=>{
|
131
|
+
'type'=>'VI',
|
132
|
+
'number' =>'4100000000000001',
|
133
|
+
'expDate' =>'1210'
|
134
|
+
}}
|
135
|
+
response= LitleOnlineRequest.new.force_capture(hash)
|
136
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
137
|
+
end
|
138
|
+
|
104
139
|
end
|
105
140
|
|
@@ -109,7 +109,7 @@ class TestSale < Test::Unit::TestCase
|
|
109
109
|
'orderSource'=>'ecommerce',
|
110
110
|
'card'=>{
|
111
111
|
'type'=>'VI',
|
112
|
-
'number' =>'
|
112
|
+
'number' =>'4100000000000000',
|
113
113
|
'expDate' =>'1210'
|
114
114
|
}}
|
115
115
|
response= LitleOnlineRequest.new.sale(hash)
|
@@ -125,7 +125,7 @@ class TestSale < Test::Unit::TestCase
|
|
125
125
|
'amount'=>'106',
|
126
126
|
'card'=>{
|
127
127
|
'type'=>'VI',
|
128
|
-
'number' =>'
|
128
|
+
'number' =>'4100000000000000',
|
129
129
|
'expDate' =>'1210'
|
130
130
|
},
|
131
131
|
'reportGroup'=>'Planets',
|
@@ -147,40 +147,38 @@ class TestSale < Test::Unit::TestCase
|
|
147
147
|
'card'=>{
|
148
148
|
'NOexistantField' => 'ShouldNotCauseError',
|
149
149
|
'type'=>'VI',
|
150
|
-
'number' =>'
|
150
|
+
'number' =>'4100000000000000',
|
151
151
|
'expDate' =>'1210'
|
152
152
|
}}
|
153
153
|
response= LitleOnlineRequest.new.sale(hash)
|
154
154
|
assert_equal('000', response.saleResponse.response)
|
155
155
|
end
|
156
156
|
|
157
|
-
def
|
158
|
-
#becasue there are sub fields under fraud check that are not specified
|
157
|
+
def test_simple_sale_with_card
|
159
158
|
hash = {
|
160
|
-
'merchantId'
|
159
|
+
'merchantId'=>'101',
|
161
160
|
'version'=>'8.8',
|
162
161
|
'reportGroup'=>'Planets',
|
163
162
|
'litleTxnId'=>'123456',
|
164
163
|
'orderId'=>'12344',
|
165
164
|
'amount'=>'106',
|
166
165
|
'orderSource'=>'ecommerce',
|
167
|
-
'fraudCheck'=>'one',
|
168
|
-
'cardholderAuthentication'=>'two',
|
169
166
|
'card'=>{
|
170
167
|
'type'=>'VI',
|
171
|
-
'number' =>'
|
168
|
+
'number' =>'4100000000000000',
|
169
|
+
'expDate' =>'1210'
|
172
170
|
}}
|
173
171
|
response= LitleOnlineRequest.new.sale(hash)
|
174
172
|
assert_equal('000', response.saleResponse.response)
|
175
173
|
end
|
176
174
|
|
177
|
-
|
175
|
+
|
176
|
+
def test_no_order_id
|
178
177
|
hash = {
|
179
|
-
'merchantId'=>'101',
|
178
|
+
'merchantId' => '101',
|
180
179
|
'version'=>'8.8',
|
181
180
|
'reportGroup'=>'Planets',
|
182
181
|
'litleTxnId'=>'123456',
|
183
|
-
'orderId'=>'12344',
|
184
182
|
'amount'=>'106',
|
185
183
|
'orderSource'=>'ecommerce',
|
186
184
|
'card'=>{
|
@@ -189,7 +187,41 @@ class TestSale < Test::Unit::TestCase
|
|
189
187
|
'expDate' =>'1210'
|
190
188
|
}}
|
191
189
|
response= LitleOnlineRequest.new.sale(hash)
|
192
|
-
|
190
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
191
|
+
end
|
192
|
+
|
193
|
+
def test_no_amount
|
194
|
+
hash = {
|
195
|
+
'merchantId' => '101',
|
196
|
+
'version'=>'8.8',
|
197
|
+
'reportGroup'=>'Planets',
|
198
|
+
'litleTxnId'=>'123456',
|
199
|
+
'orderId'=>'12344',
|
200
|
+
'orderSource'=>'ecommerce',
|
201
|
+
'card'=>{
|
202
|
+
'type'=>'VI',
|
203
|
+
'number' =>'4100000000000002',
|
204
|
+
'expDate' =>'1210'
|
205
|
+
}}
|
206
|
+
response= LitleOnlineRequest.new.sale(hash)
|
207
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
208
|
+
end
|
209
|
+
|
210
|
+
def test_no_order_source
|
211
|
+
hash = {
|
212
|
+
'merchantId' => '101',
|
213
|
+
'version'=>'8.8',
|
214
|
+
'reportGroup'=>'Planets',
|
215
|
+
'litleTxnId'=>'123456',
|
216
|
+
'orderId'=>'12344',
|
217
|
+
'amount'=>'106',
|
218
|
+
'card'=>{
|
219
|
+
'type'=>'VI',
|
220
|
+
'number' =>'4100000000000002',
|
221
|
+
'expDate' =>'1210'
|
222
|
+
}}
|
223
|
+
response= LitleOnlineRequest.new.sale(hash)
|
224
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
193
225
|
end
|
194
226
|
|
195
227
|
end
|
@@ -56,7 +56,7 @@ class TestXmlfields < Test::Unit::TestCase
|
|
56
56
|
'customBilling'=>{'phone'=>'123456789','descriptor'=>'good'},
|
57
57
|
'card'=>{
|
58
58
|
'type'=>'VI',
|
59
|
-
'number' =>'
|
59
|
+
'number' =>'4100000000000000',
|
60
60
|
'expDate' =>'1210'
|
61
61
|
}}
|
62
62
|
response= LitleOnlineRequest.new.sale(hash)
|
@@ -76,7 +76,7 @@ class TestXmlfields < Test::Unit::TestCase
|
|
76
76
|
'customerPhoneChnaged'=>'False','itemCategoryCode'=>'2'},
|
77
77
|
'card'=>{
|
78
78
|
'type'=>'VI',
|
79
|
-
'number' =>'
|
79
|
+
'number' =>'4100000000000000',
|
80
80
|
'expDate' =>'1210'
|
81
81
|
}}
|
82
82
|
response= LitleOnlineRequest.new.sale(hash)
|
@@ -95,7 +95,7 @@ class TestXmlfields < Test::Unit::TestCase
|
|
95
95
|
'CustomerInfo'=>{'ssn'=>'12345','incomeAmount'=>'12345','incomeCurrency'=>'dollar','yearsAtResidence'=>'2'},
|
96
96
|
'card'=>{
|
97
97
|
'type'=>'VI',
|
98
|
-
'number' =>'
|
98
|
+
'number' =>'4100000000000000',
|
99
99
|
'expDate' =>'1210'
|
100
100
|
}}
|
101
101
|
response= LitleOnlineRequest.new.sale(hash)
|
@@ -113,7 +113,7 @@ class TestXmlfields < Test::Unit::TestCase
|
|
113
113
|
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
|
114
114
|
'card'=>{
|
115
115
|
'type'=>'VI',
|
116
|
-
'number' =>'
|
116
|
+
'number' =>'4100000000000000',
|
117
117
|
'expDate' =>'1210'
|
118
118
|
}}
|
119
119
|
response= LitleOnlineRequest.new.authorization(hash)
|
@@ -131,7 +131,7 @@ class TestXmlfields < Test::Unit::TestCase
|
|
131
131
|
'processingInstructions'=>{'bypassVelocityCheck'=>'true'},
|
132
132
|
'card'=>{
|
133
133
|
'type'=>'VI',
|
134
|
-
'number' =>'
|
134
|
+
'number' =>'4100000000000000',
|
135
135
|
'expDate' =>'1210'
|
136
136
|
}}
|
137
137
|
response= LitleOnlineRequest.new.authorization(hash)
|
@@ -149,7 +149,7 @@ class TestXmlfields < Test::Unit::TestCase
|
|
149
149
|
'pos'=>{'capability'=>'notused','entryMode'=>'track1','cardholderId'=>'pin'},
|
150
150
|
'card'=>{
|
151
151
|
'type'=>'VI',
|
152
|
-
'number' =>'
|
152
|
+
'number' =>'4100000000000000',
|
153
153
|
'expDate' =>'1210'
|
154
154
|
}}
|
155
155
|
response= LitleOnlineRequest.new.authorization(hash)
|
@@ -183,7 +183,7 @@ class TestXmlfields < Test::Unit::TestCase
|
|
183
183
|
'amount'=>'106',
|
184
184
|
'card'=>{
|
185
185
|
'type'=>'VI',
|
186
|
-
'number' =>'
|
186
|
+
'number' =>'4100000000000000',
|
187
187
|
'expDate' =>'1210'},
|
188
188
|
'orderSource'=>'ecommerce',
|
189
189
|
'amexAggregatorData'=>{'sellerMerchantCategoryCode'=>'1234','sellerId'=>'1234Id'}
|
@@ -219,7 +219,7 @@ class TestXmlfields < Test::Unit::TestCase
|
|
219
219
|
'amount'=>'106',
|
220
220
|
'card'=>{
|
221
221
|
'type'=>'VI',
|
222
|
-
'number' =>'
|
222
|
+
'number' =>'4100000000000000',
|
223
223
|
'expDate' =>'1210'},
|
224
224
|
'orderSource'=>'ecommerce',
|
225
225
|
'enhancedData'=>{
|
@@ -267,7 +267,7 @@ class TestXmlfields < Test::Unit::TestCase
|
|
267
267
|
'amount'=>'106',
|
268
268
|
'card'=>{
|
269
269
|
'type'=>'VI',
|
270
|
-
'number' =>'
|
270
|
+
'number' =>'4100000000000000',
|
271
271
|
'expDate' =>'1210'},
|
272
272
|
'orderSource'=>'ecommerce',
|
273
273
|
'enhancedData'=>{
|
@@ -292,7 +292,7 @@ class TestXmlfields < Test::Unit::TestCase
|
|
292
292
|
'amount'=>'106',
|
293
293
|
'card'=>{
|
294
294
|
'type'=>'VI',
|
295
|
-
'number' =>'
|
295
|
+
'number' =>'4100000000000000',
|
296
296
|
'expDate' =>'1210'}, 'processingInstructions'=>{'bypassVelocityCheck'=>'true'},
|
297
297
|
'orderSource'=>'ecommerce',
|
298
298
|
'lineItemData'=>{
|
@@ -399,5 +399,192 @@ class TestXmlfields < Test::Unit::TestCase
|
|
399
399
|
response= LitleOnlineRequest.new.credit(hash)
|
400
400
|
assert_equal('Valid Format', response.message)
|
401
401
|
end
|
402
|
+
|
403
|
+
def test_cardbothtypeandtrack
|
404
|
+
hash = {
|
405
|
+
'merchantId' => '101',
|
406
|
+
'version'=>'8.8',
|
407
|
+
'reportGroup'=>'Planets',
|
408
|
+
'litleTxnId'=>'123456',
|
409
|
+
'orderId'=>'12344',
|
410
|
+
'amount'=>'106',
|
411
|
+
'orderSource'=>'ecommerce',
|
412
|
+
'card'=>{
|
413
|
+
'type'=>'VI',
|
414
|
+
'track'=>'1234',
|
415
|
+
'number' =>'4100000000000001',
|
416
|
+
'expDate' =>'1210'
|
417
|
+
}}
|
418
|
+
response= LitleOnlineRequest.new.credit(hash)
|
419
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
420
|
+
end
|
421
|
+
|
422
|
+
def test_paypal_missing_payer_id
|
423
|
+
hash = {
|
424
|
+
'merchantId' => '101',
|
425
|
+
'version'=>'8.8',
|
426
|
+
'reportGroup'=>'Planets',
|
427
|
+
'orderId'=>'12344',
|
428
|
+
'amount'=>'106',
|
429
|
+
'orderSource'=>'ecommerce',
|
430
|
+
'paypal'=>{
|
431
|
+
'token'=>'1234',
|
432
|
+
'transactionId'=>'123456'
|
433
|
+
}}
|
434
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
435
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
436
|
+
end
|
437
|
+
|
438
|
+
def test_paypal_missing_transaction_id
|
439
|
+
hash = {
|
440
|
+
'merchantId' => '101',
|
441
|
+
'version'=>'8.8',
|
442
|
+
'reportGroup'=>'Planets',
|
443
|
+
'orderId'=>'12344',
|
444
|
+
'amount'=>'106',
|
445
|
+
'orderSource'=>'ecommerce',
|
446
|
+
'paypal'=>{
|
447
|
+
'token'=>'1234',
|
448
|
+
'payerId'=>'123456'
|
449
|
+
}}
|
450
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
451
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
452
|
+
end
|
453
|
+
|
454
|
+
def test_pos_without_capability
|
455
|
+
hash = {
|
456
|
+
'merchantId' => '101',
|
457
|
+
'version'=>'8.8',
|
458
|
+
'reportGroup'=>'Planets',
|
459
|
+
'orderId'=>'12344',
|
460
|
+
'amount'=>'106',
|
461
|
+
'orderSource'=>'ecommerce',
|
462
|
+
'pos'=>{'entryMode'=>'track1','cardholderId'=>'pin'},
|
463
|
+
'card'=>{
|
464
|
+
'type'=>'VI',
|
465
|
+
'number' =>'4100000000000001',
|
466
|
+
'expDate' =>'1210'
|
467
|
+
}}
|
468
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
469
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
470
|
+
end
|
471
|
+
|
472
|
+
def test_token_missing_token
|
473
|
+
hash = {
|
474
|
+
'merchantId' => '101',
|
475
|
+
'version'=>'8.8',
|
476
|
+
'reportGroup'=>'Planets',
|
477
|
+
'orderId'=>'12344',
|
478
|
+
'amount'=>'106',
|
479
|
+
'orderSource'=>'ecommerce',
|
480
|
+
'token'=> {
|
481
|
+
'expDate'=>'1210',
|
482
|
+
'cardValidationNum'=>'555',
|
483
|
+
'type'=>'VI'
|
484
|
+
}}
|
485
|
+
response= LitleOnlineRequest.new.credit(hash)
|
486
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
487
|
+
end
|
488
|
+
|
489
|
+
def test_paypage_missing_id
|
490
|
+
hash = {
|
491
|
+
'merchantId' => '101',
|
492
|
+
'version'=>'8.8',
|
493
|
+
'reportGroup'=>'Planets',
|
494
|
+
'orderId'=>'12344',
|
495
|
+
'amount'=>'106',
|
496
|
+
'orderSource'=>'ecommerce',
|
497
|
+
'paypage'=> {
|
498
|
+
'expDate'=>'1210',
|
499
|
+
'cardValidationNum'=>'555',
|
500
|
+
'type'=>'VI'
|
501
|
+
}}
|
502
|
+
response= LitleOnlineRequest.new.credit(hash)
|
503
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
504
|
+
end
|
505
|
+
|
506
|
+
def test_line_item_data
|
507
|
+
hash = {
|
508
|
+
'merchantId' => '101',
|
509
|
+
'version'=>'8.8',
|
510
|
+
'reportGroup'=>'Planets',
|
511
|
+
'orderId'=>'1',
|
512
|
+
'amount'=>'2',
|
513
|
+
'orderSource'=>'ecommerce',
|
514
|
+
'card'=>{
|
515
|
+
'type'=>'VI',
|
516
|
+
'number' =>'4100000000000001',
|
517
|
+
'expDate' =>'1210'
|
518
|
+
},
|
519
|
+
'enhancedData'=>
|
520
|
+
{
|
521
|
+
'lineItemData'=>[
|
522
|
+
{'itemSequenceNumber'=>'1', 'itemDescription'=>'desc1'},
|
523
|
+
{'itemSequenceNumber'=>'2', 'itemDescription'=>'desc2'}
|
524
|
+
]
|
525
|
+
}
|
526
|
+
}
|
527
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
528
|
+
assert_equal('Valid Format', response.message)
|
529
|
+
end
|
530
|
+
|
531
|
+
def test_detail_tax
|
532
|
+
hash = {
|
533
|
+
'merchantId' => '101',
|
534
|
+
'version'=>'8.8',
|
535
|
+
'reportGroup'=>'Planets',
|
536
|
+
'orderId'=>'1',
|
537
|
+
'amount'=>'2',
|
538
|
+
'orderSource'=>'ecommerce',
|
539
|
+
'card'=>{
|
540
|
+
'type'=>'VI',
|
541
|
+
'number' =>'4100000000000001',
|
542
|
+
'expDate' =>'1210'
|
543
|
+
},
|
544
|
+
'enhancedData'=>
|
545
|
+
{
|
546
|
+
'detailTax'=>[
|
547
|
+
{'taxIncludedInTotal'=>'true', 'taxAmount'=>'0'},
|
548
|
+
{'taxIncludedInTotal'=>'false', 'taxAmount'=>'1'}
|
549
|
+
]
|
550
|
+
}
|
551
|
+
}
|
552
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
553
|
+
assert_equal('Valid Format', response.message)
|
554
|
+
end
|
555
|
+
|
556
|
+
def test_detail_tax_in_lineItem
|
557
|
+
hash = {
|
558
|
+
'merchantId' => '101',
|
559
|
+
'version'=>'8.8',
|
560
|
+
'reportGroup'=>'Planets',
|
561
|
+
'orderId'=>'1',
|
562
|
+
'amount'=>'2',
|
563
|
+
'orderSource'=>'ecommerce',
|
564
|
+
'card'=>{
|
565
|
+
'type'=>'VI',
|
566
|
+
'number' =>'4100000000000001',
|
567
|
+
'expDate' =>'1210'
|
568
|
+
},
|
569
|
+
'enhancedData'=>
|
570
|
+
{
|
571
|
+
'lineItemData'=>[
|
572
|
+
{'itemSequenceNumber'=>'1', 'itemDescription'=>'desc1','detailTax'=>[
|
573
|
+
{'taxAmount'=>'1'},
|
574
|
+
{'taxAmount'=>'2'}]
|
575
|
+
},
|
576
|
+
{'itemSequenceNumber'=>'2', 'itemDescription'=>'desc2','detailTax'=>[
|
577
|
+
{'taxAmount'=>'3'},
|
578
|
+
{'taxAmount'=>'4'}]
|
579
|
+
}],
|
580
|
+
'detailTax'=>[
|
581
|
+
{'taxAmount'=>'5'},
|
582
|
+
{'taxAmount'=>'6'}
|
583
|
+
]}
|
584
|
+
}
|
585
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
586
|
+
assert_equal('Valid Format', response.message)
|
587
|
+
end
|
588
|
+
|
402
589
|
end
|
403
590
|
|
data/test/functional/ts_all.rb
CHANGED
@@ -54,22 +54,6 @@ class Newtest < Test::Unit::TestCase
|
|
54
54
|
response = LitleOnlineRequest.new.authorization(hash)
|
55
55
|
end
|
56
56
|
|
57
|
-
def test_authorization_missing_attributes
|
58
|
-
hash={
|
59
|
-
'reportGroup'=>'Planets',
|
60
|
-
'amount'=>'106',
|
61
|
-
|
62
|
-
'orderSource'=>'ecommerce',
|
63
|
-
'card'=>{
|
64
|
-
'type'=>'VI',
|
65
|
-
'number' =>'4100000000000001',
|
66
|
-
'expDate' =>'1210'
|
67
|
-
}}
|
68
|
-
|
69
|
-
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
70
|
-
assert_match /Missing Required Field: orderId!!!!/, exception.message
|
71
|
-
end
|
72
|
-
|
73
57
|
def test_authorization_attributes
|
74
58
|
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
75
59
|
hash={
|
@@ -84,7 +68,7 @@ class Newtest < Test::Unit::TestCase
|
|
84
68
|
'expDate' =>'1210'
|
85
69
|
}}
|
86
70
|
|
87
|
-
Communications.expects(:http_post).with(regexp_matches(/.*<authorization id="003" reportGroup="Planets".*/m),kind_of(Hash))
|
71
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authorization ((reportGroup="Planets" id="003")|(id="003" reportGroup="Planets")).*/m),kind_of(Hash))
|
88
72
|
XMLObject.expects(:new)
|
89
73
|
|
90
74
|
response = LitleOnlineRequest.new.authorization(hash)
|
@@ -253,53 +237,12 @@ def test_choice_between_card_token2
|
|
253
237
|
LitleOnlineRequest.new.authorization(start_hash.merge(token_only))
|
254
238
|
end
|
255
239
|
|
256
|
-
def test_orderId_required
|
257
|
-
start_hash = {
|
258
|
-
#'orderId'=>'12344',
|
259
|
-
'merchantId'=>'101',
|
260
|
-
'reportGroup'=>'Planets',
|
261
|
-
'amount'=>'101',
|
262
|
-
'orderSource'=>'ecommerce',
|
263
|
-
'card' => {
|
264
|
-
'type' => 'VI',
|
265
|
-
'number' => '1111222233334444'
|
266
|
-
}
|
267
|
-
}
|
268
|
-
exception = assert_raise(RuntimeError) {LitleOnlineRequest.new.authorization(start_hash)}
|
269
|
-
assert_match /Missing Required Field: orderId!!!!/, exception.message
|
270
|
-
|
271
|
-
XMLObject.expects(:new)
|
272
|
-
Communications.expects(:http_post).with(regexp_matches(/.*orderId.*/m),kind_of(Hash))
|
273
|
-
assert_nothing_raised {LitleOnlineRequest.new.authorization(start_hash.merge({'orderId'=>'1234'}))}
|
274
|
-
end
|
275
|
-
|
276
|
-
def test_ssn_optional
|
277
|
-
start_hash = {
|
278
|
-
'orderId'=>'12344',
|
279
|
-
'merchantId'=>'101',
|
280
|
-
'reportGroup'=>'Planets',
|
281
|
-
'amount'=>'101',
|
282
|
-
'orderSource'=>'ecommerce',
|
283
|
-
'card' => {
|
284
|
-
'type' => 'VI',
|
285
|
-
'number' => '1111222233334444'
|
286
|
-
},
|
287
|
-
}
|
288
|
-
XMLObject.expects(:new)
|
289
|
-
Communications.expects(:http_post).with(Not(regexp_matches(/.*ssn.*/m)),kind_of(Hash))
|
290
|
-
assert_nothing_raised {LitleOnlineRequest.new.authorization(start_hash)}
|
291
|
-
|
292
|
-
XMLObject.expects(:new)
|
293
|
-
Communications.expects(:http_post).with(regexp_matches(/.*ssn.*/m),kind_of(Hash))
|
294
|
-
assert_nothing_raised {LitleOnlineRequest.new.authorization(start_hash.merge({'customerInfo'=>{'ssn'=>'000112222'} }))}
|
295
|
-
end
|
296
|
-
|
297
240
|
def test_set_merchant_sdk
|
298
241
|
litle = LitleOnlineRequest.new
|
299
242
|
#Explicit - used for integrations
|
300
243
|
assert_equal 'ActiveMerchant;3.2', litle.send(:get_merchant_sdk, {'merchantSdk'=>'ActiveMerchant;3.2'})
|
301
244
|
#Implicit - used raw when nothing is specified
|
302
|
-
assert_equal 'Ruby;8.12.
|
245
|
+
assert_equal 'Ruby;8.12.1', litle.send(:get_merchant_sdk, {'NotMerchantSdk'=>'ActiveMerchant;3.2'})
|
303
246
|
end
|
304
247
|
|
305
248
|
|