LitleOnline 9.12.0 → 10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -16
- data/CONTRIBUTORS +0 -0
- data/DESCRIPTION +2 -2
- data/LICENSE +1 -1
- data/README.md +9 -9
- data/Rakefile +9 -8
- data/SETUP.md +3 -3
- data/bin/Setup.rb +4 -4
- data/bin/sample_batch_driver.rb +1 -1
- data/bin/sample_driver.rb +1 -1
- data/lib/Communications.rb +7 -7
- data/lib/Configuration.rb +1 -1
- data/lib/EnvironmentVariables.rb +0 -0
- data/lib/LitleBatchRequest.rb +22 -8
- data/lib/LitleListeners.rb +9 -9
- data/lib/LitleOnline.rb +2 -2
- data/lib/LitleOnlineRequest.rb +16 -10
- data/lib/LitleRequest.rb +10 -10
- data/lib/LitleTransaction.rb +66 -64
- data/lib/LitleXmlMapper.rb +4 -9
- data/lib/XMLFields.rb +129 -116
- data/lib/cacert.pem +0 -0
- data/samples/Auth/LitleAuthReversalTransaction.rb +2 -2
- data/samples/Auth/LitleAuthorizationTransaction.rb +1 -0
- data/samples/Auth/LitlePaymentFullLifeCycle.rb +12 -6
- data/samples/Batch/AccountUpdate.rb +1 -0
- data/samples/Batch/SampleBatchDriver.rb +2 -1
- data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +2 -1
- data/samples/Capture/LitleCaptureTransaction.rb +2 -2
- data/samples/Capture/LitleForceCaptureTransaction.rb +2 -1
- data/samples/Capture/LitlePartialCapture.rb +3 -3
- data/samples/Credit/LitleCreditTransaction.rb +2 -2
- data/samples/Credit/LitleRefundTransaction.rb +2 -1
- data/samples/Other/LitleAvsTransaction.rb +2 -1
- data/samples/Other/LitleVoidTransaction.rb +2 -1
- data/samples/Paypage/FullPaypageLifeCycle.rb +7 -2
- data/samples/Run_all.rb +0 -0
- data/samples/Sale/LitleSaleTransaction.rb +2 -1
- data/samples/Sale/SampleSaleTransaction.rb +2 -1
- data/test/certification/certTest1_base.rb +53 -52
- data/test/certification/certTest2_authenhanced.rb +16 -15
- data/test/certification/certTest3_authreversal.rb +16 -15
- data/test/certification/certTest4_echeck.rb +11 -10
- data/test/certification/certTest5_token.rb +2 -1
- data/test/certification/certTest_batchAll.rb +40 -16
- data/test/certification/ts_all.rb +1 -1
- data/test/functional/test_activate.rb +8 -9
- data/test/functional/test_activateReversal.rb +4 -7
- data/test/functional/test_auth.rb +50 -113
- data/test/functional/test_authReversal.rb +6 -5
- data/test/functional/test_balanceInquiry.rb +5 -5
- data/test/functional/test_batch.rb +1 -1
- data/test/functional/test_batchStream.rb +3 -5
- data/test/functional/test_cancelSubscription.rb +3 -5
- data/test/functional/test_capture.rb +6 -34
- data/test/functional/test_captureGivenAuth.rb +13 -55
- data/test/functional/test_configuration.rb +1 -1
- data/test/functional/test_createPlan.rb +3 -5
- data/test/functional/test_credit.rb +10 -17
- data/test/functional/test_deactivate.rb +5 -5
- data/test/functional/test_deactivateReversal.rb +4 -5
- data/test/functional/test_depositReversal.rb +5 -5
- data/test/functional/test_echeckCredit.rb +17 -13
- data/test/functional/test_echeckRedeposit.rb +7 -5
- data/test/functional/test_echeckSale.rb +42 -21
- data/test/functional/test_echeckVerification.rb +19 -20
- data/test/functional/test_echeckVoid.rb +3 -2
- data/test/functional/test_forceCapture.rb +16 -30
- data/test/functional/test_litle_requests.rb +5 -9
- data/test/functional/test_load.rb +5 -5
- data/test/functional/test_loadReversal.rb +4 -5
- data/test/functional/test_override.rb +3 -0
- data/test/functional/test_queryTransaction.rb +146 -0
- data/test/functional/test_refundReversal.rb +4 -5
- data/test/functional/test_sale.rb +94 -170
- data/test/functional/test_token.rb +9 -18
- data/test/functional/test_unload.rb +5 -5
- data/test/functional/test_unloadReversal.rb +5 -6
- data/test/functional/test_updateCardValidationNumOnToken.rb +2 -1
- data/test/functional/test_updatePlan.rb +4 -5
- data/test/functional/test_updateSubscription.rb +5 -5
- data/test/functional/test_wallet.rb +74 -0
- data/test/functional/test_xmlfields.rb +25 -10
- data/test/functional/ts_all.rb +4 -2
- data/test/unit/test_LitleAUBatch.rb +1 -1
- data/test/unit/test_LitleBatchRequest.rb +4 -4
- data/test/unit/test_LitleOnlineRequest.rb +54 -37
- data/test/unit/test_LitleRequest.rb +3 -4
- data/test/unit/test_LitleTransaction.rb +35 -6
- data/test/unit/test_activate.rb +21 -1
- data/test/unit/test_activateReversal.rb +1 -1
- data/test/unit/test_auth.rb +16 -55
- data/test/unit/test_authReversal.rb +1 -1
- data/test/unit/test_balanceInquiry.rb +1 -1
- data/test/unit/test_cancelSubscription.rb +1 -1
- data/test/unit/test_capture.rb +1 -27
- data/test/unit/test_captureGivenAuth.rb +18 -44
- data/test/unit/test_createPlan.rb +1 -1
- data/test/unit/test_credit.rb +3 -16
- 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 +1 -1
- data/test/unit/test_echeckRedeposit.rb +1 -1
- data/test/unit/test_echeckSale.rb +2 -2
- data/test/unit/test_echeckVerification.rb +1 -1
- data/test/unit/test_echeckVoid.rb +1 -1
- data/test/unit/test_forceCapture.rb +2 -20
- data/test/unit/test_load.rb +1 -1
- data/test/unit/test_loadReversal.rb +1 -1
- data/test/unit/test_queryTransaction.rb +122 -0
- data/test/unit/test_refundReversal.rb +1 -1
- data/test/unit/test_sale.rb +8 -73
- data/test/unit/test_token.rb +8 -15
- 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_updateSubscription.rb +1 -1
- data/test/unit/test_wallet.rb +262 -0
- data/test/unit/test_xmlfields.rb +1 -1
- data/test/unit/ts_unit.rb +3 -3
- metadata +15 -16
- data/temp.xml +0 -21
- data/test/functional/test_fraudCheck.rb +0 -77
- data/test/functional/test_utf8.rb +0 -44
- data/test/unit/test_LitleXmlMapper.rb +0 -136
- data/test/unit/test_fraudCheck.rb +0 -45
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2011 Litle & Co.
|
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,7 +49,9 @@ module LitleOnline
|
|
49
49
|
'expDate' =>'1210'
|
50
50
|
}}
|
51
51
|
|
52
|
-
|
52
|
+
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest .*/m),kind_of(Hash))
|
53
|
+
XMLObject.expects(:new)
|
54
|
+
|
53
55
|
response = LitleOnlineRequest.new.authorization(hash)
|
54
56
|
end
|
55
57
|
|
@@ -67,7 +69,9 @@ module LitleOnline
|
|
67
69
|
'expDate' =>'1210'
|
68
70
|
}}
|
69
71
|
|
70
|
-
|
72
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authorization ((reportGroup="Planets" id="003")|(id="003" reportGroup="Planets")).*/m),kind_of(Hash))
|
73
|
+
XMLObject.expects(:new)
|
74
|
+
|
71
75
|
response = LitleOnlineRequest.new.authorization(hash)
|
72
76
|
end
|
73
77
|
|
@@ -84,7 +88,10 @@ module LitleOnline
|
|
84
88
|
'number' =>'4100000000000001',
|
85
89
|
'expDate' =>'1210'
|
86
90
|
}}
|
87
|
-
|
91
|
+
|
92
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*<orderId>12344.*<amount>106.*<orderSource>ecommerce.*/m),kind_of(Hash))
|
93
|
+
XMLObject.expects(:new)
|
94
|
+
|
88
95
|
response = LitleOnlineRequest.new.authorization(hash)
|
89
96
|
end
|
90
97
|
|
@@ -102,9 +109,9 @@ module LitleOnline
|
|
102
109
|
'expDate' =>'1210'
|
103
110
|
}}
|
104
111
|
|
105
|
-
|
106
|
-
|
107
|
-
|
112
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*<card>.*<number>4100000000000001.*<expDate>1210.*/m),kind_of(Hash))
|
113
|
+
XMLObject.expects(:new)
|
114
|
+
|
108
115
|
response = LitleOnlineRequest.new.authorization(hash)
|
109
116
|
end
|
110
117
|
|
@@ -122,9 +129,9 @@ module LitleOnline
|
|
122
129
|
'expDate' =>'1210'
|
123
130
|
}}
|
124
131
|
|
125
|
-
|
126
|
-
|
127
|
-
|
132
|
+
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*<sale.*<card>.*<number>4100000000000001.*<expDate>1210.*/m),kind_of(Hash))
|
133
|
+
XMLObject.expects(:new)
|
134
|
+
|
128
135
|
response = LitleOnlineRequest.new.sale(hash)
|
129
136
|
end
|
130
137
|
|
@@ -136,9 +143,9 @@ module LitleOnline
|
|
136
143
|
'litleTxnId'=>'123456789012345678'
|
137
144
|
}
|
138
145
|
|
139
|
-
|
140
|
-
|
141
|
-
|
146
|
+
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
147
|
+
XMLObject.expects(:new)
|
148
|
+
|
142
149
|
response = LitleOnlineRequest.new.capture(hash)
|
143
150
|
end
|
144
151
|
|
@@ -152,9 +159,9 @@ module LitleOnline
|
|
152
159
|
'litleTxnId'=>'123456789012345678'
|
153
160
|
}
|
154
161
|
|
155
|
-
|
156
|
-
|
157
|
-
|
162
|
+
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
163
|
+
XMLObject.expects(:new)
|
164
|
+
|
158
165
|
response = LitleOnlineRequest.new.force_capture(hash)
|
159
166
|
end
|
160
167
|
|
@@ -168,9 +175,9 @@ module LitleOnline
|
|
168
175
|
'litleTxnId'=>'123456789012345678',
|
169
176
|
}
|
170
177
|
|
171
|
-
|
172
|
-
|
173
|
-
|
178
|
+
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
179
|
+
XMLObject.expects(:new)
|
180
|
+
|
174
181
|
response = LitleOnlineRequest.new.echeck_credit(hash)
|
175
182
|
end
|
176
183
|
|
@@ -184,9 +191,9 @@ module LitleOnline
|
|
184
191
|
'litleTxnId'=>'123456789012345678',
|
185
192
|
}
|
186
193
|
|
187
|
-
|
188
|
-
|
189
|
-
|
194
|
+
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
195
|
+
XMLObject.expects(:new)
|
196
|
+
|
190
197
|
response = LitleOnlineRequest.new.echeck_sale(hash)
|
191
198
|
end
|
192
199
|
|
@@ -206,9 +213,8 @@ module LitleOnline
|
|
206
213
|
}
|
207
214
|
}
|
208
215
|
|
209
|
-
|
210
|
-
|
211
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*card.*/m), is_a(Hash))
|
216
|
+
XMLObject.expects(:new)
|
217
|
+
Communications.expects(:http_post).with(regexp_matches(/.*card.*/m),kind_of(Hash))
|
212
218
|
LitleOnlineRequest.new.authorization(start_hash.merge(card_only))
|
213
219
|
end
|
214
220
|
|
@@ -227,18 +233,17 @@ module LitleOnline
|
|
227
233
|
}
|
228
234
|
}
|
229
235
|
|
230
|
-
|
231
|
-
|
232
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*token.*/m), is_a(Hash))
|
236
|
+
XMLObject.expects(:new)
|
237
|
+
Communications.expects(:http_post).with(regexp_matches(/.*token.*/m),kind_of(Hash))
|
233
238
|
LitleOnlineRequest.new.authorization(start_hash.merge(token_only))
|
234
239
|
end
|
235
240
|
|
236
241
|
def test_set_merchant_sdk
|
237
242
|
litle = LitleOnlineRequest.new
|
238
243
|
#Explicit - used for integrations
|
239
|
-
assert_equal 'ActiveMerchant;
|
244
|
+
assert_equal 'ActiveMerchant;3.2', litle.send(:get_merchant_sdk, {'merchantSdk'=>'ActiveMerchant;3.2'})
|
240
245
|
#Implicit - used raw when nothing is specified
|
241
|
-
assert_equal 'Ruby;
|
246
|
+
assert_equal 'Ruby;10.1', litle.send(:get_merchant_sdk, {'NotMerchantSdk'=>'ActiveMerchant;3.2'})
|
242
247
|
end
|
243
248
|
|
244
249
|
def test_sale_paypal_order_complete_typo
|
@@ -256,22 +261,34 @@ module LitleOnline
|
|
256
261
|
'expDate' =>'1210'
|
257
262
|
}}
|
258
263
|
|
259
|
-
|
260
|
-
|
261
|
-
|
264
|
+
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*<sale.*<payPalOrderComplete>true<\/payPalOrderComplete>.*/m),kind_of(Hash))
|
265
|
+
XMLObject.expects(:new)
|
266
|
+
|
262
267
|
response = LitleOnlineRequest.new.sale(hash)
|
263
268
|
end
|
264
269
|
|
265
270
|
def test_version_matches_sdk_major_and_minor_version_ignoring_config
|
266
|
-
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'
|
271
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
267
272
|
hash={
|
268
273
|
'litleTxnId' => '006'
|
269
274
|
}
|
270
275
|
|
271
|
-
|
272
|
-
|
273
|
-
|
276
|
+
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*version="10\.1".*/m),kind_of(Hash))
|
277
|
+
XMLObject.expects(:new)
|
278
|
+
|
279
|
+
response = LitleOnlineRequest.new.void(hash)
|
280
|
+
end
|
281
|
+
|
282
|
+
def test_void_response_contains_recycling
|
283
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
284
|
+
hash={
|
285
|
+
'litleTxnId' => '123'
|
286
|
+
}
|
287
|
+
|
288
|
+
Communications.expects(:http_post).with(kind_of(String),kind_of(Hash)).returns('<litleOnlineResponse><voidResponse><recycling><creditLitleTxnId>65</creditLitleTxnId></recycling></voidResponse></litleOnlineResponse>')
|
289
|
+
|
274
290
|
response = LitleOnlineRequest.new.void(hash)
|
291
|
+
assert_equal '65', response.voidResponse.recycling.creditLitleTxnId
|
275
292
|
end
|
276
293
|
|
277
294
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c)
|
3
|
-
|
2
|
+
Copyright (c) 2011 Litle & Co.
|
4
3
|
Permission is hereby granted, free of charge, to any person
|
5
4
|
obtaining a copy of this software and associated documentation
|
6
5
|
files (the "Software"), to deal in the Software without
|
@@ -9,10 +8,8 @@ copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
8
|
copies of the Software, and to permit persons to whom the
|
10
9
|
Software is furnished to do so, subject to the following
|
11
10
|
conditions:
|
12
|
-
|
13
11
|
The above copyright notice and this permission notice shall be
|
14
12
|
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
13
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
14
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18
15
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -94,7 +91,9 @@ module LitleOnline
|
|
94
91
|
request = LitleRequest.new({'sessionId'=>'8675309',
|
95
92
|
'user'=>'john',
|
96
93
|
'password'=>'tinkleberry'})
|
94
|
+
|
97
95
|
request.add_rfr_request({'litleSessionId' => '137813712'}, '/usr/srv')
|
96
|
+
|
98
97
|
end
|
99
98
|
|
100
99
|
def test_commit_batch_with_batch
|
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2011 Litle & Co.
|
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
|
@@ -30,6 +30,8 @@ require 'mocha/setup'
|
|
30
30
|
module LitleOnline
|
31
31
|
|
32
32
|
class TestLitleTransaction < Test::Unit::TestCase
|
33
|
+
|
34
|
+
|
33
35
|
def test_authorization
|
34
36
|
ltlTxn = LitleTransaction.new
|
35
37
|
authHash = {
|
@@ -281,7 +283,7 @@ module LitleOnline
|
|
281
283
|
'billToAddress'=>{'name'=>'Bob',
|
282
284
|
'city'=>'lowell',
|
283
285
|
'state'=>'MA',
|
284
|
-
'email'=>'
|
286
|
+
'email'=>'litle.com'}
|
285
287
|
}
|
286
288
|
|
287
289
|
result = ltlTxn.echeck_verification(echeckVerificationHash)
|
@@ -298,7 +300,7 @@ module LitleOnline
|
|
298
300
|
assert_equal 'Bob', result.billToAddress.name
|
299
301
|
assert_equal 'lowell', result.billToAddress.city
|
300
302
|
assert_equal 'MA', result.billToAddress.state
|
301
|
-
assert_equal '
|
303
|
+
assert_equal 'litle.com', result.billToAddress.email
|
302
304
|
end
|
303
305
|
|
304
306
|
def test_echeck_credit
|
@@ -352,7 +354,7 @@ module LitleOnline
|
|
352
354
|
'orderId'=>'12345',
|
353
355
|
'orderSource'=>'ecommerce',
|
354
356
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
355
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
357
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
356
358
|
}
|
357
359
|
|
358
360
|
result = ltlTxn.echeck_sale(echeckSaleHash)
|
@@ -370,7 +372,7 @@ module LitleOnline
|
|
370
372
|
assert_equal 'Bob', result.billToAddress.name
|
371
373
|
assert_equal 'lowell', result.billToAddress.city
|
372
374
|
assert_equal 'MA', result.billToAddress.state
|
373
|
-
assert_equal '
|
375
|
+
assert_equal 'litle.com', result.billToAddress.email
|
374
376
|
end
|
375
377
|
|
376
378
|
def test_account_update
|
@@ -392,6 +394,33 @@ module LitleOnline
|
|
392
394
|
assert_equal "4100000000000001", result.card.number
|
393
395
|
assert_equal "VI", result.card.mop
|
394
396
|
assert_equal "1210", result.card.expDate
|
395
|
-
end
|
397
|
+
end
|
398
|
+
|
399
|
+
|
400
|
+
def test_queryTransaction
|
401
|
+
ltlTxn = LitleTransaction.new
|
402
|
+
queryTransactionHash = {
|
403
|
+
'merchantId' => '101',
|
404
|
+
'version'=>'8.8',
|
405
|
+
'reportGroup'=>'Planets',
|
406
|
+
'id'=>'12345',
|
407
|
+
'customerId'=>'0987',
|
408
|
+
'origId'=>'834262',
|
409
|
+
'origActionType'=>'A',
|
410
|
+
'origLitleTxnId'=>'123456',
|
411
|
+
'origOrderId' => '65347567',
|
412
|
+
'origAccountNumber'=>'4000000000000001'
|
413
|
+
}
|
414
|
+
|
415
|
+
result = ltlTxn.query_Transaction(queryTransactionHash)
|
416
|
+
assert_equal 'Planets', result.reportGroup
|
417
|
+
assert_equal '12345', result.transactionId
|
418
|
+
assert_equal '0987', result.customerId
|
419
|
+
assert_equal '834262', result.origId
|
420
|
+
assert_equal 'A', result.origActionType
|
421
|
+
assert_equal '123456', result.origLitleTxnId
|
422
|
+
assert_equal '65347567', result.origOrderId
|
423
|
+
assert_equal '4000000000000001', result.origAccountNumber
|
424
|
+
end
|
396
425
|
end
|
397
426
|
end
|
data/test/unit/test_activate.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2012 Litle & Co.
|
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
|
@@ -48,6 +48,26 @@ module LitleOnline
|
|
48
48
|
LitleOnlineRequest.new.activate(hash)
|
49
49
|
end
|
50
50
|
|
51
|
+
def test_simple_card1
|
52
|
+
hash = {
|
53
|
+
'merchantId' => '101',
|
54
|
+
'version'=>'8.8',
|
55
|
+
'reportGroup'=>'Planets',
|
56
|
+
'orderId' => '11',
|
57
|
+
'amount' => '500',
|
58
|
+
'orderSource'=>'ecommerce',
|
59
|
+
'card'=>
|
60
|
+
{
|
61
|
+
'type'=>'VI',
|
62
|
+
'number' =>'4100000000000001',
|
63
|
+
'expDate' =>'1210'
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>VI<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/activate>.*/m), is_a(Hash))
|
68
|
+
LitleOnlineRequest.new.activate(hash)
|
69
|
+
end
|
70
|
+
|
51
71
|
def test_simple_virtualGiftcard
|
52
72
|
hash = {
|
53
73
|
'merchantId' => '101',
|
data/test/unit/test_auth.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2012 Litle & Co.
|
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
|
@@ -28,7 +28,7 @@ require 'mocha/setup'
|
|
28
28
|
|
29
29
|
#test Authorization Transaction
|
30
30
|
module LitleOnline
|
31
|
-
|
31
|
+
class TestAuth < Test::Unit::TestCase
|
32
32
|
def test_success_re_auth
|
33
33
|
hash = {
|
34
34
|
'merchantId' => '101',
|
@@ -58,7 +58,7 @@ module LitleOnline
|
|
58
58
|
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
59
59
|
},
|
60
60
|
'signature' =>'sign',
|
61
|
-
'version' =>'
|
61
|
+
'version' =>'10000'
|
62
62
|
}
|
63
63
|
}
|
64
64
|
|
@@ -88,7 +88,7 @@ module LitleOnline
|
|
88
88
|
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
89
89
|
},
|
90
90
|
'signature' =>'sign',
|
91
|
-
'version' =>'
|
91
|
+
'version' =>'10000'
|
92
92
|
}}
|
93
93
|
|
94
94
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
@@ -150,7 +150,6 @@ module LitleOnline
|
|
150
150
|
'merchantId' => '101',
|
151
151
|
'version'=>'8.8',
|
152
152
|
'reportGroup'=>'Planets',
|
153
|
-
# 'litleTxnId'=>'123456',
|
154
153
|
'orderId'=>'12344',
|
155
154
|
'amount'=>'106',
|
156
155
|
'orderSource'=>'ecommerce',
|
@@ -194,7 +193,8 @@ module LitleOnline
|
|
194
193
|
}
|
195
194
|
}
|
196
195
|
|
197
|
-
|
196
|
+
XMLObject.expects(:new)
|
197
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<merchantData>.*?<campaign>foo<\/campaign>.*?<\/merchantData>.*/m),kind_of(Hash))
|
198
198
|
LitleOnlineRequest.new.authorization(hash)
|
199
199
|
end
|
200
200
|
|
@@ -209,9 +209,13 @@ module LitleOnline
|
|
209
209
|
'fraudFilterOverride'=> 'true'
|
210
210
|
}
|
211
211
|
|
212
|
-
|
212
|
+
XMLObject.expects(:new)
|
213
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*?<fraudFilterOverride>true<\/fraudFilterOverride>.*?<\/authorization>.*/m),kind_of(Hash))
|
213
214
|
LitleOnlineRequest.new.authorization(hash)
|
214
215
|
end
|
216
|
+
|
217
|
+
|
218
|
+
|
215
219
|
|
216
220
|
def test_pos_without_capability
|
217
221
|
hash = {
|
@@ -244,7 +248,7 @@ module LitleOnline
|
|
244
248
|
'transactionId'=>'123456'
|
245
249
|
}}
|
246
250
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
247
|
-
|
251
|
+
assert_match /If paypal is specified, it must have a payerId/, exception.message
|
248
252
|
end
|
249
253
|
|
250
254
|
def test_paypal_missing_transaction_id
|
@@ -294,7 +298,8 @@ module LitleOnline
|
|
294
298
|
'fraudFilterOverride'=> 'true'
|
295
299
|
}
|
296
300
|
|
297
|
-
|
301
|
+
XMLObject.expects(:new)
|
302
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authentication.*?<user>UNIT<\/user>.*?<\/authentication>.*/m),kind_of(Hash))
|
298
303
|
LitleOnlineRequest.new.authorization(hash)
|
299
304
|
end
|
300
305
|
|
@@ -311,7 +316,8 @@ module LitleOnline
|
|
311
316
|
'fraudFilterOverride'=> 'true'
|
312
317
|
}
|
313
318
|
|
314
|
-
|
319
|
+
XMLObject.expects(:new)
|
320
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authentication.*?<password>TEST<\/password>.*?<\/authentication>.*/m),kind_of(Hash))
|
315
321
|
LitleOnlineRequest.new.authorization(hash)
|
316
322
|
end
|
317
323
|
|
@@ -412,50 +418,5 @@ module LitleOnline
|
|
412
418
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<mpos><ksn>ksnString<\/ksn><formatId>30<\/formatId><encryptedTrack>encryptedTrackString<\/encryptedTrack><track1Status>0<\/track1Status><track2Status>0<\/track2Status><\/mpos>.*/m), is_a(Hash))
|
413
419
|
LitleOnlineRequest.new.authorization(hash)
|
414
420
|
end
|
415
|
-
|
416
|
-
def test_processingType_originalNetworkTransactionId_originalTransactionAmount
|
417
|
-
hash = {
|
418
|
-
'orderId' => '12344',
|
419
|
-
'amount' => '2',
|
420
|
-
'orderSource' => 'ecommerce',
|
421
|
-
'card' => {
|
422
|
-
'number' => '4141000000000000',
|
423
|
-
'expDate' => '1210',
|
424
|
-
'type' => 'GC'
|
425
|
-
},
|
426
|
-
'processingType' => 'initialInstallment',
|
427
|
-
'originalNetworkTransactionId' => '9876543210',
|
428
|
-
'originalTransactionAmount' => '536981'
|
429
|
-
}
|
430
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<processingType>initialInstallment<\/processingType><originalNetworkTransactionId>9876543210<\/originalNetworkTransactionId><originalTransactionAmount>536981<\/originalTransactionAmount>.*/m), is_a(Hash))
|
431
|
-
LitleOnlineRequest.new.authorization(hash)
|
432
|
-
end
|
433
|
-
|
434
|
-
def test_processingType_wallet
|
435
|
-
hash = {
|
436
|
-
'merchantId' => '101',
|
437
|
-
'version'=>'8.8',
|
438
|
-
'reportGroup'=>'Planets',
|
439
|
-
'id'=>'12345',
|
440
|
-
'orderId'=>'67890',
|
441
|
-
'amount'=>'10000',
|
442
|
-
'orderSource'=>'ecommerce',
|
443
|
-
'processingType' => 'initialInstallment',
|
444
|
-
'originalNetworkTransactionId' => '9876543210',
|
445
|
-
'originalTransactionAmount' => '536981',
|
446
|
-
'card'=>{
|
447
|
-
'type'=>'VI',
|
448
|
-
'number' =>'4100000000000000',
|
449
|
-
'expDate' =>'1215'
|
450
|
-
},
|
451
|
-
'wallet'=>{
|
452
|
-
'walletSourceType'=>'VisaCheckout',
|
453
|
-
'walletSourceTypeId' => 'VCIND'
|
454
|
-
}
|
455
|
-
}
|
456
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<wallet><walletSourceType>VisaCheckout<\/walletSourceType><walletSourceTypeId>VCIND<\/walletSourceTypeId><\/wallet>.*/m), is_a(Hash))
|
457
|
-
LitleOnlineRequest.new.authorization(hash)
|
458
|
-
end
|
459
|
-
|
460
421
|
end
|
461
422
|
end
|