LitleOnline 8.25.1 → 8.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -2
- data/README.md +2 -22
- data/Rakefile +2 -2
- data/accurev_plugin.log +1037 -0
- data/bin/sample_batch_driver.rb +1 -0
- data/bin/sample_driver.rb +4 -4
- data/lib/Configuration.rb +2 -2
- data/lib/EnvironmentVariables.rb +2 -1
- data/lib/LitleBatchRequest.rb +16 -3
- data/lib/LitleOnlineRequest.rb +2 -2
- data/lib/LitleRequest.rb +8 -4
- data/lib/LitleTransaction.rb +10 -6
- data/lib/XMLFields.rb +203 -159
- data/samples/Auth/LitleAuthReversalTransaction.rb +15 -0
- data/samples/Auth/LitleAuthorizationTransaction.rb +31 -0
- data/samples/Auth/LitlePaymentFullLifeCycle.rb +47 -0
- data/samples/Batch/AccountUpdate.rb +64 -0
- data/samples/Batch/SampleBatchDriver.rb +94 -0
- data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +30 -0
- data/samples/Capture/LitleCaptureTransaction.rb +14 -0
- data/samples/Capture/LitleForceCaptureTransaction.rb +26 -0
- data/samples/Capture/LitlePartialCapture.rb +16 -0
- data/samples/Credit/LitleCreditTransaction.rb +16 -0
- data/samples/Credit/LitleRefundTransaction.rb +29 -0
- data/samples/Other/LitleAvsTransaction.rb +34 -0
- data/samples/Other/LitleVoidTransaction.rb +18 -0
- data/samples/Paypage/FullPaypageLifeCycle.rb +74 -0
- data/samples/Run_all.rb +17 -0
- data/samples/Sale/LitleSaleTransaction.rb +29 -0
- data/samples/Sale/SampleSaleTransaction.rb +24 -0
- data/test/functional/test_auth.rb +54 -30
- data/test/functional/test_captureGivenAuth.rb +41 -18
- data/test/functional/test_credit.rb +17 -0
- data/test/functional/test_echeckCredit.rb +23 -6
- data/test/functional/test_echeckSale.rb +27 -10
- data/test/functional/test_forceCapture.rb +19 -0
- data/test/functional/test_sale.rb +44 -19
- data/test/functional/test_token.rb +27 -5
- data/test/unit/test_LitleOnlineRequest.rb +2 -2
- data/test/unit/test_activate.rb +1 -1
- data/test/unit/test_activateReversal.rb +1 -1
- data/test/unit/test_auth.rb +104 -41
- data/test/unit/test_balanceInquiry.rb +1 -1
- data/test/unit/test_cancelSubscription.rb +1 -1
- data/test/unit/test_captureGivenAuth.rb +31 -22
- data/test/unit/test_createPlan.rb +1 -1
- data/test/unit/test_credit.rb +61 -39
- data/test/unit/test_deactivate.rb +1 -1
- data/test/unit/test_deactivateReversal.rb +1 -1
- data/test/unit/test_depositReversal.rb +1 -1
- data/test/unit/test_echeckCredit.rb +18 -5
- data/test/unit/test_echeckRedeposit.rb +1 -1
- data/test/unit/test_echeckSale.rb +14 -1
- data/test/unit/test_echeckVerification.rb +1 -1
- data/test/unit/test_echeckVoid.rb +1 -1
- data/test/unit/test_forceCapture.rb +11 -0
- data/test/unit/test_load.rb +1 -1
- data/test/unit/test_loadReversal.rb +1 -1
- data/test/unit/test_refundReversal.rb +1 -1
- data/test/unit/test_sale.rb +113 -55
- data/test/unit/test_token.rb +53 -7
- data/test/unit/test_unload.rb +1 -1
- data/test/unit/test_unloadReversal.rb +1 -1
- data/test/unit/test_updateCardValidationNumOnToken.rb +1 -1
- data/test/unit/test_updatePlan.rb +1 -1
- data/test/unit/test_xmlfields.rb +2 -2
- metadata +22 -4
data/test/unit/test_credit.rb
CHANGED
@@ -22,12 +22,11 @@ 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
|
-
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
25
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
27
|
require 'mocha/setup'
|
28
28
|
|
29
29
|
module LitleOnline
|
30
|
-
|
31
30
|
class TestCredit < Test::Unit::TestCase
|
32
31
|
def test_both_choices_card_and_paypal
|
33
32
|
hash = {
|
@@ -48,11 +47,11 @@ module LitleOnline
|
|
48
47
|
'token'=>'1234',
|
49
48
|
'transactionId'=>'123456'
|
50
49
|
}}
|
51
|
-
|
50
|
+
|
52
51
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
53
52
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
54
53
|
end
|
55
|
-
|
54
|
+
|
56
55
|
def test_three_choices_card_and_paypage_and_paypal
|
57
56
|
hash = {
|
58
57
|
'merchantId' => '101',
|
@@ -80,7 +79,7 @@ module LitleOnline
|
|
80
79
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
81
80
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
82
81
|
end
|
83
|
-
|
82
|
+
|
84
83
|
def test_all_choices_card_and_paypage_and_paypal_and_token
|
85
84
|
hash = {
|
86
85
|
'merchantId' => '101',
|
@@ -92,34 +91,34 @@ module LitleOnline
|
|
92
91
|
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
93
92
|
'bypassVelocityCheckcardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
94
93
|
'card'=>{
|
95
|
-
|
96
|
-
|
97
|
-
|
94
|
+
'type'=>'VI',
|
95
|
+
'number' =>'4100000000000001',
|
96
|
+
'expDate' =>'1210'
|
98
97
|
},
|
99
98
|
'paypage'=> {
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
99
|
+
'paypageRegistrationId'=>'1234',
|
100
|
+
'expDate'=>'1210',
|
101
|
+
'cardValidationNum'=>'555',
|
102
|
+
'type'=>'VI'
|
104
103
|
},
|
105
104
|
'paypal'=>{
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
105
|
+
'payerId'=>'1234',
|
106
|
+
'payerEmail'=>'a@b.com',
|
107
|
+
'token'=>'1234',
|
108
|
+
'transactionId'=>'123456'
|
110
109
|
},
|
111
110
|
'token'=> {
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
111
|
+
'litleToken'=>'1234567890123',
|
112
|
+
'expDate'=>'1210',
|
113
|
+
'cardValidationNum'=>'555',
|
114
|
+
'type'=>'VI'
|
116
115
|
}
|
117
116
|
}
|
118
|
-
|
117
|
+
|
119
118
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
120
119
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
121
120
|
end
|
122
|
-
|
121
|
+
|
123
122
|
def test_action_reason_on_orphaned_refund
|
124
123
|
hash = {
|
125
124
|
'merchantId' => '101',
|
@@ -176,7 +175,7 @@ module LitleOnline
|
|
176
175
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
177
176
|
assert_match /If token litleToken is specified, it must be between/, exception.message
|
178
177
|
end
|
179
|
-
|
178
|
+
|
180
179
|
def test_token_missing_token
|
181
180
|
hash = {
|
182
181
|
'merchantId' => '101',
|
@@ -211,7 +210,7 @@ module LitleOnline
|
|
211
210
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
212
211
|
assert_match /If pos entryMode is specified, it must be in/, exception.message
|
213
212
|
end
|
214
|
-
|
213
|
+
|
215
214
|
def test_paypage_missing_id
|
216
215
|
hash = {
|
217
216
|
'merchantId' => '101',
|
@@ -228,11 +227,11 @@ module LitleOnline
|
|
228
227
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
229
228
|
assert_match /If paypage is specified, it must have a paypageRegistrationId/, exception.message
|
230
229
|
end
|
231
|
-
|
230
|
+
|
232
231
|
def test_logged_in_user
|
233
232
|
hash = {
|
234
|
-
|
235
|
-
|
233
|
+
'loggedInUser' => 'gdake',
|
234
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
236
235
|
'merchantId' => '101',
|
237
236
|
'version'=>'8.12',
|
238
237
|
'orderId'=>'1',
|
@@ -243,7 +242,19 @@ module LitleOnline
|
|
243
242
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
244
243
|
LitleOnlineRequest.new.credit(hash)
|
245
244
|
end
|
246
|
-
|
245
|
+
|
246
|
+
def test_secondary_amount_tied
|
247
|
+
hash = {
|
248
|
+
'amount' => '2',
|
249
|
+
'secondaryAmount' => '1',
|
250
|
+
'litleTxnId' => '3',
|
251
|
+
'processingInstructions' => {},
|
252
|
+
'reportGroup' => 'Planets'
|
253
|
+
}
|
254
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><process.*/m), is_a(Hash))
|
255
|
+
LitleOnlineRequest.new.credit(hash)
|
256
|
+
end
|
257
|
+
|
247
258
|
def test_surcharge_amount_tied
|
248
259
|
hash = {
|
249
260
|
'amount' => '2',
|
@@ -255,7 +266,7 @@ module LitleOnline
|
|
255
266
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><process.*/m), is_a(Hash))
|
256
267
|
LitleOnlineRequest.new.credit(hash)
|
257
268
|
end
|
258
|
-
|
269
|
+
|
259
270
|
def test_surcharge_amount_tied_optional
|
260
271
|
hash = {
|
261
272
|
'amount' => '2',
|
@@ -266,7 +277,18 @@ module LitleOnline
|
|
266
277
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><process.*/m), is_a(Hash))
|
267
278
|
LitleOnlineRequest.new.credit(hash)
|
268
279
|
end
|
269
|
-
|
280
|
+
|
281
|
+
def test_secondary_amount_orphan
|
282
|
+
hash = {
|
283
|
+
'amount' => '2',
|
284
|
+
'secondaryAmount' => '1',
|
285
|
+
'orderSource' => 'ecommerce',
|
286
|
+
'reportGroup' => 'Planets'
|
287
|
+
}
|
288
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
289
|
+
LitleOnlineRequest.new.credit(hash)
|
290
|
+
end
|
291
|
+
|
270
292
|
def test_surcharge_amount_orphan
|
271
293
|
hash = {
|
272
294
|
'amount' => '2',
|
@@ -277,7 +299,7 @@ module LitleOnline
|
|
277
299
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
278
300
|
LitleOnlineRequest.new.credit(hash)
|
279
301
|
end
|
280
|
-
|
302
|
+
|
281
303
|
def test_surcharge_amount_orphan_optional
|
282
304
|
hash = {
|
283
305
|
'amount' => '2',
|
@@ -287,16 +309,16 @@ module LitleOnline
|
|
287
309
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
288
310
|
LitleOnlineRequest.new.credit(hash)
|
289
311
|
end
|
290
|
-
|
312
|
+
|
291
313
|
def test_pos_tied
|
292
314
|
hash = {
|
293
315
|
'amount' => '2',
|
294
316
|
'pos' => {
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
317
|
+
'terminalId' => 'abc123',
|
318
|
+
'capability' => 'magstripe',
|
319
|
+
'entryMode' => 'keyed',
|
320
|
+
'cardholderId' => 'nopin',
|
321
|
+
'catLevel' => 'self service'
|
300
322
|
},
|
301
323
|
'litleTxnId' => '3',
|
302
324
|
'reportGroup' => 'Planets',
|
@@ -306,7 +328,7 @@ module LitleOnline
|
|
306
328
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><pos><capability>magstripe<\/capability><entryMode>keyed<\/entryMode><cardholderId>nopin<\/cardholderId><terminalId>abc123<\/terminalId><catLevel>self service<\/catLevel><\/pos><payPalNotes>.*/m), is_a(Hash))
|
307
329
|
LitleOnlineRequest.new.credit(hash)
|
308
330
|
end
|
309
|
-
|
331
|
+
|
310
332
|
def test_post_tied_optional
|
311
333
|
hash = {
|
312
334
|
'amount' => '2',
|
@@ -315,6 +337,6 @@ module LitleOnline
|
|
315
337
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><\/credit>.*/m), is_a(Hash))
|
316
338
|
LitleOnlineRequest.new.credit(hash)
|
317
339
|
end
|
318
|
-
|
340
|
+
|
319
341
|
end
|
320
342
|
end
|
@@ -22,8 +22,9 @@ 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
|
-
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
25
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
|
+
require 'mocha/setup'
|
27
28
|
|
28
29
|
module LitleOnline
|
29
30
|
class Test_echeckCredit < Test::Unit::TestCase
|
@@ -39,11 +40,11 @@ module LitleOnline
|
|
39
40
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_credit(hash)}
|
40
41
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
41
42
|
end
|
42
|
-
|
43
|
+
|
43
44
|
def test_logged_in_user
|
44
45
|
hash = {
|
45
|
-
|
46
|
-
|
46
|
+
'loggedInUser' => 'gdake',
|
47
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
47
48
|
'merchantId' => '101',
|
48
49
|
'version'=>'8.8',
|
49
50
|
'reportGroup'=>'Planets',
|
@@ -53,6 +54,18 @@ module LitleOnline
|
|
53
54
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
54
55
|
LitleOnlineRequest.new.echeck_credit(hash)
|
55
56
|
end
|
56
|
-
|
57
|
+
|
58
|
+
def test_secondary_amount
|
59
|
+
hash = {
|
60
|
+
'orderId' => '12344',
|
61
|
+
'amount' => '2',
|
62
|
+
'secondaryAmount' => '1',
|
63
|
+
'orderSource' => 'ecommerce',
|
64
|
+
'reportGroup' => 'Planets'
|
65
|
+
}
|
66
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
67
|
+
LitleOnlineRequest.new.echeck_credit(hash)
|
68
|
+
end
|
69
|
+
|
57
70
|
end
|
58
71
|
end
|
@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|
24
24
|
=end
|
25
25
|
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
|
-
|
27
|
+
require 'mocha/setup'
|
28
28
|
module LitleOnline
|
29
29
|
class Test_echeckRedeposit < Test::Unit::TestCase
|
30
30
|
def test_echeck_redeposit_with_both
|
@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|
24
24
|
=end
|
25
25
|
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
|
-
|
27
|
+
require 'mocha/setup'
|
28
28
|
module LitleOnline
|
29
29
|
class Test_echeckSale < Test::Unit::TestCase
|
30
30
|
|
@@ -54,5 +54,18 @@ module LitleOnline
|
|
54
54
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
55
55
|
LitleOnlineRequest.new.echeck_sale(hash)
|
56
56
|
end
|
57
|
+
|
58
|
+
def test_secondary_amount
|
59
|
+
hash = {
|
60
|
+
'orderId' => '12344',
|
61
|
+
'amount' => '2',
|
62
|
+
'secondaryAmount' => '1',
|
63
|
+
'orderSource' => 'ecommerce',
|
64
|
+
'reportGroup' => 'Planets'
|
65
|
+
}
|
66
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
67
|
+
LitleOnlineRequest.new.echeck_sale(hash)
|
68
|
+
end
|
69
|
+
|
57
70
|
end
|
58
71
|
end
|
@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|
24
24
|
=end
|
25
25
|
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
|
-
|
27
|
+
require 'mocha/setup'
|
28
28
|
module LitleOnline
|
29
29
|
class Test_echeckVerification < Test::Unit::TestCase
|
30
30
|
def test_echeck_verification_with_both
|
@@ -108,6 +108,17 @@ module LitleOnline
|
|
108
108
|
LitleOnlineRequest.new.force_capture(hash)
|
109
109
|
end
|
110
110
|
|
111
|
+
def test_secondary_amount
|
112
|
+
hash = {
|
113
|
+
'amount' => '2',
|
114
|
+
'secondaryAmount' => '1',
|
115
|
+
'orderSource' => 'ecommerce',
|
116
|
+
'reportGroup' => 'Planets'
|
117
|
+
}
|
118
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
119
|
+
LitleOnlineRequest.new.force_capture(hash)
|
120
|
+
end
|
121
|
+
|
111
122
|
def test_surcharge_amount
|
112
123
|
hash = {
|
113
124
|
'amount' => '2',
|
data/test/unit/test_load.rb
CHANGED
data/test/unit/test_sale.rb
CHANGED
@@ -22,13 +22,12 @@ 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
|
-
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
25
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
27
|
require 'mocha/setup'
|
28
28
|
|
29
29
|
module LitleOnline
|
30
30
|
class TestSale < Test::Unit::TestCase
|
31
|
-
|
32
31
|
def test_both_choices_fraud_check_and_card_holder
|
33
32
|
hash = {
|
34
33
|
'merchantId' => '101',
|
@@ -45,11 +44,59 @@ module LitleOnline
|
|
45
44
|
'number' =>'4100000000000002',
|
46
45
|
'expDate' =>'1210'
|
47
46
|
}}
|
48
|
-
|
47
|
+
|
49
48
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
50
49
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
51
50
|
end
|
52
|
-
|
51
|
+
|
52
|
+
def test_success_applepay
|
53
|
+
hash = {
|
54
|
+
'merchantId' => '101',
|
55
|
+
'version'=>'8.8',
|
56
|
+
'reportGroup'=>'Planets',
|
57
|
+
'litleTxnId'=>'123456',
|
58
|
+
'orderId'=>'12344',
|
59
|
+
'amount'=>'106',
|
60
|
+
'orderSource'=>'ecommerce',
|
61
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
62
|
+
'applepay'=>{
|
63
|
+
'data'=>'user',
|
64
|
+
'header'=>{
|
65
|
+
'applicationData'=>'454657413164',
|
66
|
+
'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
67
|
+
'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
68
|
+
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
69
|
+
},
|
70
|
+
'signature' =>'sign',
|
71
|
+
'version' =>'1'
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<sale.*?<applepay>.*?<data>user<\/data>.*?<\/applepay>.*?<\/sale>.*?/m), is_a(Hash))
|
76
|
+
LitleOnlineRequest.new.sale(hash)
|
77
|
+
end
|
78
|
+
|
79
|
+
# for test the choice functionality
|
80
|
+
def test_success_card
|
81
|
+
hash = {
|
82
|
+
'merchantId' => '101',
|
83
|
+
'version'=>'8.8',
|
84
|
+
'reportGroup'=>'Planets',
|
85
|
+
'litleTxnId'=>'123456',
|
86
|
+
'orderId'=>'12344',
|
87
|
+
'amount'=>'106',
|
88
|
+
'orderSource'=>'ecommerce',
|
89
|
+
# 'fraudCheck'=>{'authenticationTransactionId'=>'123'}, #for test
|
90
|
+
'card'=>{
|
91
|
+
'type'=>'VI',
|
92
|
+
'number' =>'4100000000000002',
|
93
|
+
'expDate' =>'1210'
|
94
|
+
}
|
95
|
+
}
|
96
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<sale.*?<card>.*?<type>VI<\/type>.*?<\/card>.*?<\/sale>.*?/m), is_a(Hash))
|
97
|
+
LitleOnlineRequest.new.sale(hash)
|
98
|
+
end
|
99
|
+
|
53
100
|
def test_both_choices_card_and_paypal
|
54
101
|
hash = {
|
55
102
|
'merchantId' => '101',
|
@@ -60,7 +107,6 @@ module LitleOnline
|
|
60
107
|
'amount'=>'106',
|
61
108
|
'orderSource'=>'ecommerce',
|
62
109
|
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
63
|
-
'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
64
110
|
'card'=>{
|
65
111
|
'type'=>'VI',
|
66
112
|
'number' =>'4100000000000002',
|
@@ -71,11 +117,11 @@ module LitleOnline
|
|
71
117
|
'token'=>'1234',
|
72
118
|
'transactionId'=>'123456'
|
73
119
|
}}
|
74
|
-
|
120
|
+
|
75
121
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
76
122
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
77
123
|
end
|
78
|
-
|
124
|
+
|
79
125
|
def test_both_choices_card_and_token
|
80
126
|
hash = {
|
81
127
|
'merchantId' => '101',
|
@@ -98,11 +144,11 @@ module LitleOnline
|
|
98
144
|
'cardValidationNum'=>'555',
|
99
145
|
'type'=>'VI'
|
100
146
|
}}
|
101
|
-
|
147
|
+
|
102
148
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
103
149
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
104
150
|
end
|
105
|
-
|
151
|
+
|
106
152
|
def test_both_choices_card_and_paypage
|
107
153
|
hash = {
|
108
154
|
'merchantId' => '101',
|
@@ -125,11 +171,11 @@ module LitleOnline
|
|
125
171
|
'cardValidationNum'=>'555',
|
126
172
|
'type'=>'VI'
|
127
173
|
}}
|
128
|
-
|
174
|
+
|
129
175
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
130
176
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
131
177
|
end
|
132
|
-
|
178
|
+
|
133
179
|
def test_three_choices_card_and_paypage_and_paypal
|
134
180
|
hash = {
|
135
181
|
'merchantId' => '101',
|
@@ -156,11 +202,11 @@ module LitleOnline
|
|
156
202
|
'token'=>'1234',
|
157
203
|
'transactionId'=>'123456'
|
158
204
|
}}
|
159
|
-
|
205
|
+
|
160
206
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
161
207
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
162
208
|
end
|
163
|
-
|
209
|
+
|
164
210
|
def test_all_choices_card_and_paypage_and_paypal_and_token
|
165
211
|
hash = {
|
166
212
|
'merchantId' => '101',
|
@@ -195,7 +241,7 @@ module LitleOnline
|
|
195
241
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
196
242
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
197
243
|
end
|
198
|
-
|
244
|
+
|
199
245
|
def test_merchant_data_sale
|
200
246
|
hash = {
|
201
247
|
'merchantId' => '101',
|
@@ -205,15 +251,15 @@ module LitleOnline
|
|
205
251
|
'orderSource'=>'ecommerce',
|
206
252
|
'reportGroup'=>'Planets',
|
207
253
|
'merchantData'=> {
|
208
|
-
|
254
|
+
'affiliate'=>'bar'
|
209
255
|
}
|
210
256
|
}
|
211
|
-
|
257
|
+
|
212
258
|
XMLObject.expects(:new)
|
213
259
|
Communications.expects(:http_post).with(regexp_matches(/.*<merchantData>.*?<affiliate>bar<\/affiliate>.*?<\/merchantData>.*/m),kind_of(Hash))
|
214
260
|
LitleOnlineRequest.new.sale(hash)
|
215
261
|
end
|
216
|
-
|
262
|
+
|
217
263
|
def test_invalid_embedded_field_values
|
218
264
|
#becasue there are sub fields under fraud check that are not specified
|
219
265
|
hash = {
|
@@ -233,7 +279,7 @@ module LitleOnline
|
|
233
279
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
234
280
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
235
281
|
end
|
236
|
-
|
282
|
+
|
237
283
|
def test_fraud_filter_override
|
238
284
|
hash = {
|
239
285
|
'merchantId' => '101',
|
@@ -244,12 +290,12 @@ module LitleOnline
|
|
244
290
|
'reportGroup'=>'Planets',
|
245
291
|
'fraudFilterOverride'=> 'false'
|
246
292
|
}
|
247
|
-
|
293
|
+
|
248
294
|
XMLObject.expects(:new)
|
249
295
|
Communications.expects(:http_post).with(regexp_matches(/.*<sale.*?<fraudFilterOverride>false<\/fraudFilterOverride>.*?<\/sale>.*/m),kind_of(Hash))
|
250
296
|
LitleOnlineRequest.new.sale(hash)
|
251
297
|
end
|
252
|
-
|
298
|
+
|
253
299
|
def test_illegal_card_type
|
254
300
|
hash = {
|
255
301
|
'merchantId' => '101',
|
@@ -270,8 +316,8 @@ module LitleOnline
|
|
270
316
|
|
271
317
|
def test_logged_in_user
|
272
318
|
hash = {
|
273
|
-
|
274
|
-
|
319
|
+
'loggedInUser' => 'gdake',
|
320
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
275
321
|
'merchantId' => '101',
|
276
322
|
'version'=>'8.8',
|
277
323
|
'reportGroup'=>'Planets',
|
@@ -283,12 +329,12 @@ module LitleOnline
|
|
283
329
|
'type'=>'VI',
|
284
330
|
'number' =>'4100000000000002',
|
285
331
|
'expDate' =>'1210'
|
286
|
-
|
287
|
-
|
332
|
+
}}
|
333
|
+
|
288
334
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
289
335
|
LitleOnlineRequest.new.sale(hash)
|
290
336
|
end
|
291
|
-
|
337
|
+
|
292
338
|
def test_surcharge_amount
|
293
339
|
hash = {
|
294
340
|
'orderId' => '12344',
|
@@ -300,7 +346,19 @@ module LitleOnline
|
|
300
346
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
301
347
|
LitleOnlineRequest.new.sale(hash)
|
302
348
|
end
|
303
|
-
|
349
|
+
|
350
|
+
def test_secondary_amount
|
351
|
+
hash = {
|
352
|
+
'orderId' => '12344',
|
353
|
+
'amount' => '2',
|
354
|
+
'secondaryAmount' => '1',
|
355
|
+
'orderSource' => 'ecommerce',
|
356
|
+
'reportGroup' => 'Planets'
|
357
|
+
}
|
358
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
359
|
+
LitleOnlineRequest.new.sale(hash)
|
360
|
+
end
|
361
|
+
|
304
362
|
def test_surcharge_amount_optional
|
305
363
|
hash = {
|
306
364
|
'orderId' => '12344',
|
@@ -311,35 +369,35 @@ module LitleOnline
|
|
311
369
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
312
370
|
LitleOnlineRequest.new.sale(hash)
|
313
371
|
end
|
314
|
-
|
372
|
+
|
315
373
|
def test_recurringRequest
|
316
374
|
hash = {
|
317
375
|
'card'=>{
|
318
|
-
|
319
|
-
|
320
|
-
|
376
|
+
'type'=>'VI',
|
377
|
+
'number'=>'4100000000000001',
|
378
|
+
'expDate'=>'1213',
|
321
379
|
},
|
322
380
|
'orderId'=>'12344',
|
323
381
|
'amount'=>'2',
|
324
382
|
'orderSource'=>'ecommerce',
|
325
383
|
'fraudFilterOverride'=>'true',
|
326
384
|
'recurringRequest'=>{
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
385
|
+
'subscription'=>{
|
386
|
+
'planCode'=>'abc123',
|
387
|
+
'numberOfPayments'=>'12'
|
388
|
+
}
|
331
389
|
}
|
332
390
|
}
|
333
391
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><recurringRequest><subscription><planCode>abc123<\/planCode><numberOfPayments>12<\/numberOfPayments><\/subscription><\/recurringRequest>.*/m), is_a(Hash))
|
334
392
|
LitleOnlineRequest.new.sale(hash)
|
335
393
|
end
|
336
|
-
|
394
|
+
|
337
395
|
def test_recurringRequest_optional
|
338
396
|
hash = {
|
339
397
|
'card'=>{
|
340
|
-
|
341
|
-
|
342
|
-
|
398
|
+
'type'=>'VI',
|
399
|
+
'number'=>'4100000000000001',
|
400
|
+
'expDate'=>'1213',
|
343
401
|
},
|
344
402
|
'orderId'=>'12344',
|
345
403
|
'amount'=>'2',
|
@@ -349,34 +407,34 @@ module LitleOnline
|
|
349
407
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><\/sale>.*/m), is_a(Hash))
|
350
408
|
LitleOnlineRequest.new.sale(hash)
|
351
409
|
end
|
352
|
-
|
353
|
-
def test_litleInternalRecurringRequest
|
410
|
+
|
411
|
+
def test_litleInternalRecurringRequest
|
354
412
|
hash = {
|
355
413
|
'card'=>{
|
356
|
-
|
357
|
-
|
358
|
-
|
414
|
+
'type'=>'VI',
|
415
|
+
'number'=>'4100000000000001',
|
416
|
+
'expDate'=>'1213',
|
359
417
|
},
|
360
418
|
'orderId'=>'12344',
|
361
419
|
'amount'=>'2',
|
362
420
|
'orderSource'=>'ecommerce',
|
363
421
|
'fraudFilterOverride'=>'true',
|
364
422
|
'litleInternalRecurringRequest'=>{
|
365
|
-
|
366
|
-
|
367
|
-
|
423
|
+
'subscriptionId'=>'1234567890123456789',
|
424
|
+
'recurringTxnId'=>'1234567890123456789',
|
425
|
+
'finalPayment'=>'false'
|
368
426
|
},
|
369
427
|
}
|
370
428
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><litleInternalRecurringRequest><subscriptionId>1234567890123456789<\/subscriptionId><recurringTxnId>1234567890123456789<\/recurringTxnId><finalPayment>false<\/finalPayment><\/litleInternalRecurringRequest>.*/m), is_a(Hash))
|
371
429
|
LitleOnlineRequest.new.sale(hash)
|
372
430
|
end
|
373
|
-
|
431
|
+
|
374
432
|
def test_litleInternalRecurringRequest_optional
|
375
433
|
hash = {
|
376
434
|
'card'=>{
|
377
|
-
|
378
|
-
|
379
|
-
|
435
|
+
'type'=>'VI',
|
436
|
+
'number'=>'4100000000000001',
|
437
|
+
'expDate'=>'1213',
|
380
438
|
},
|
381
439
|
'orderId'=>'12344',
|
382
440
|
'amount'=>'2',
|
@@ -393,15 +451,15 @@ module LitleOnline
|
|
393
451
|
'amount' => '2',
|
394
452
|
'orderSource' => 'ecommerce',
|
395
453
|
'card' => {
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
} ,
|
454
|
+
'number' => '4141000000000000',
|
455
|
+
'expDate' => '1210',
|
456
|
+
'type' => 'GC'
|
457
|
+
} ,
|
400
458
|
'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
|
401
459
|
}
|
402
460
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudChecks><threatMetrixSessionId>1234<\/threatMetrixSessionId><\/advancedFraudChecks>.*/m), is_a(Hash))
|
403
461
|
LitleOnlineRequest.new.sale(hash)
|
404
462
|
end
|
405
|
-
|
463
|
+
|
406
464
|
end
|
407
465
|
end
|