LitleOnline 8.19.0 → 8.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG +34 -0
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/bin/Setup.rb +16 -6
- data/lib/LitleBatchRequest.rb +85 -2
- data/lib/LitleOnlineRequest.rb +108 -5
- data/lib/LitleRequest.rb +14 -9
- data/lib/LitleTransaction.rb +152 -3
- data/lib/XMLFields.rb +441 -7
- data/test/functional/test_activate.rb +100 -0
- data/test/functional/test_activateReversal.rb +56 -0
- data/test/functional/test_auth.rb +38 -1
- data/test/functional/test_balanceInquiry.rb +80 -0
- data/test/functional/test_batchStream.rb +145 -0
- data/test/functional/test_cancelSubscription.rb +55 -0
- data/test/functional/test_captureGivenAuth.rb +32 -2
- data/test/functional/test_createPlan.rb +85 -0
- data/test/functional/test_credit.rb +22 -1
- data/test/functional/test_deactivate.rb +80 -0
- data/test/functional/test_deactivateReversal.rb +56 -0
- data/test/functional/test_depositReversal.rb +56 -0
- data/test/functional/test_forceCapture.rb +23 -1
- data/test/functional/test_litle_requests.rb +3 -2
- data/test/functional/test_load.rb +82 -0
- data/test/functional/test_loadReversal.rb +56 -0
- data/test/functional/test_refundReversal.rb +56 -0
- data/test/functional/test_sale.rb +23 -1
- data/test/functional/test_unload.rb +82 -0
- data/test/functional/test_unloadReversal.rb +56 -0
- data/test/functional/test_updatePlan.rb +58 -0
- data/test/functional/test_updateSubscription.rb +76 -0
- data/test/functional/ts_all.rb +21 -2
- data/test/unit/test_LitleBatchRequest.rb +47 -2
- data/test/unit/test_LitleOnlineRequest.rb +2 -2
- data/test/unit/test_activate.rb +92 -0
- data/test/{functional/ts_all.rb~ → unit/test_activateReversal.rb} +17 -17
- data/test/unit/test_auth.rb +37 -3
- data/test/unit/test_balanceInquiry.rb +52 -0
- data/test/unit/test_cancelSubscription.rb +43 -0
- data/test/unit/test_captureGivenAuth.rb +44 -2
- data/test/unit/test_createPlan.rb +52 -0
- data/test/unit/test_credit.rb +3 -2
- data/test/unit/test_deactivate.rb +52 -0
- data/test/unit/test_deactivateReversal.rb +44 -0
- data/test/unit/test_depositReversal.rb +44 -0
- data/test/unit/test_load.rb +53 -0
- data/test/unit/test_loadReversal.rb +44 -0
- data/test/unit/test_refundReversal.rb +44 -0
- data/test/unit/test_sale.rb +18 -1
- data/test/unit/test_unload.rb +53 -0
- data/test/unit/test_unloadReversal.rb +44 -0
- data/test/unit/test_updatePlan.rb +45 -0
- data/test/unit/test_updateSubscription.rb +172 -0
- data/test/unit/test_xmlfields.rb +395 -0
- data/test/unit/ts_unit.rb +19 -2
- metadata +51 -34
- data/CHANGELOG~ +0 -81
- data/Rakefile~ +0 -93
- data/lib/LitleOnlineRequest.rb~ +0 -198
- data/lib/LitleRequest.rb~ +0 -513
- data/lib/LitleTransaction.rb~ +0 -297
- data/lib/XMLFields.rb~ +0 -1380
- data/test/unit/test_LitleOnlineRequest.rb~ +0 -296
- data/test/unit/test_sale.rb~ +0 -390
- data/test/unit/test_xmlfields.rb~ +0 -2515
@@ -174,7 +174,52 @@ module LitleOnline
|
|
174
174
|
counts = batch.get_counts_and_amounts
|
175
175
|
assert_equal 1, counts[:numTokenRegistrations]
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
|
+
def test_cancel_subscription
|
179
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'}).once
|
180
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').once
|
181
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d_txns.*/), 'a+').twice
|
182
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'wb').once
|
183
|
+
File.expects(:directory?).returns(true).once
|
184
|
+
|
185
|
+
hash = {
|
186
|
+
'merchantId' => '101',
|
187
|
+
'version'=>'8.8',
|
188
|
+
'reportGroup'=>'Planets',
|
189
|
+
'subscriptionId'=>'100'
|
190
|
+
}
|
191
|
+
|
192
|
+
batch = LitleBatchRequest.new
|
193
|
+
batch.create_new_batch('D:\Batches\\')
|
194
|
+
batch.cancel_subscription(hash)
|
195
|
+
|
196
|
+
counts = batch.get_counts_and_amounts
|
197
|
+
assert_equal 1, counts[:numCancelSubscriptions]
|
198
|
+
end
|
199
|
+
|
200
|
+
def test_update_subscription
|
201
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'}).once
|
202
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').once
|
203
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d_txns.*/), 'a+').twice
|
204
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'wb').once
|
205
|
+
File.expects(:directory?).returns(true).once
|
206
|
+
|
207
|
+
hash = {
|
208
|
+
'merchantId' => '101',
|
209
|
+
'version'=>'8.8',
|
210
|
+
'reportGroup'=>'Planets',
|
211
|
+
'subscriptionId'=>'100',
|
212
|
+
'planCode'=>'planCodeString',
|
213
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
214
|
+
}
|
215
|
+
|
216
|
+
batch = LitleBatchRequest.new
|
217
|
+
batch.create_new_batch('D:\Batches\\')
|
218
|
+
batch.update_subscription(hash)
|
219
|
+
|
220
|
+
counts = batch.get_counts_and_amounts
|
221
|
+
assert_equal 1, counts[:numUpdateSubscriptions]
|
222
|
+
end
|
178
223
|
def test_add_update_card_validation_num_on_token
|
179
224
|
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'}).once
|
180
225
|
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').once
|
@@ -596,4 +641,4 @@ module LitleOnline
|
|
596
641
|
#assert_equal 6000, counts[:sale][:saleAmount]
|
597
642
|
end
|
598
643
|
end
|
599
|
-
end
|
644
|
+
end
|
@@ -244,7 +244,7 @@ module LitleOnline
|
|
244
244
|
#Explicit - used for integrations
|
245
245
|
assert_equal 'ActiveMerchant;3.2', litle.send(:get_merchant_sdk, {'merchantSdk'=>'ActiveMerchant;3.2'})
|
246
246
|
#Implicit - used raw when nothing is specified
|
247
|
-
assert_equal 'Ruby;8.
|
247
|
+
assert_equal 'Ruby;8.25.0', litle.send(:get_merchant_sdk, {'NotMerchantSdk'=>'ActiveMerchant;3.2'})
|
248
248
|
end
|
249
249
|
|
250
250
|
def test_sale_paypal_order_complete_typo
|
@@ -274,7 +274,7 @@ module LitleOnline
|
|
274
274
|
'litleTxnId' => '006'
|
275
275
|
}
|
276
276
|
|
277
|
-
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*version="8\.
|
277
|
+
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*version="8\.25".*/m),kind_of(Hash))
|
278
278
|
XMLObject.expects(:new)
|
279
279
|
|
280
280
|
response = LitleOnlineRequest.new.void(hash)
|
@@ -0,0 +1,92 @@
|
|
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
|
+
module LitleOnline
|
29
|
+
class TestActivate < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_simple_card
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'orderId' => '11',
|
37
|
+
'amount' => '500',
|
38
|
+
'orderSource'=>'ecommerce',
|
39
|
+
'card'=>
|
40
|
+
{
|
41
|
+
'type'=>'VI',
|
42
|
+
'number' =>'4100000000000001',
|
43
|
+
'expDate' =>'1210'
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
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))
|
48
|
+
LitleOnlineRequest.new.activate(hash)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_simple_card
|
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
|
+
|
71
|
+
def test_simple_virtualGiftcard
|
72
|
+
hash = {
|
73
|
+
'merchantId' => '101',
|
74
|
+
'version'=>'8.8',
|
75
|
+
'reportGroup'=>'Planets',
|
76
|
+
'orderId' => '11',
|
77
|
+
'amount' => '500',
|
78
|
+
'orderSource'=>'ecommerce',
|
79
|
+
'virtualGiftCard'=>
|
80
|
+
{
|
81
|
+
'accountNumberLength'=>'13',
|
82
|
+
'giftCardBin'=>'giftCardBinString'
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><virtualGiftCard><accountNumberLength>13<\/accountNumberLength><giftCardBin>giftCardBinString<\/giftCardBin><\/virtualGiftCard><\/activate>.*/m), is_a(Hash))
|
87
|
+
LitleOnlineRequest.new.activate(hash)
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
@@ -22,23 +22,23 @@ 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
|
-
|
26
25
|
require 'lib/LitleOnline'
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
module LitleOnline
|
29
|
+
class TestActivateReversal < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_simple
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'litleTxnId' => '5000'
|
37
|
+
}
|
27
38
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
require_relative 'test_authReversal'
|
33
|
-
require_relative 'test_credit'
|
34
|
-
require_relative 'test_token'
|
35
|
-
require_relative 'test_forceCapture'
|
36
|
-
require_relative 'test_capture'
|
37
|
-
require_relative 'test_captureGivenAuth'
|
38
|
-
require_relative 'test_echeckRedeposit'
|
39
|
-
require_relative 'test_echeckSale'
|
40
|
-
require_relative 'test_echeckCredit'
|
41
|
-
require_relative 'test_echeckVerification'
|
42
|
-
require_relative 'test_echeckVoid'
|
43
|
-
require_relative 'test_updateCardValidationNumOnToken'
|
39
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activateReversal reportGroup="Planets"><litleTxnId>5000<\/litleTxnId><\/activateReversal>.*/m), is_a(Hash))
|
40
|
+
LitleOnlineRequest.new.activate_reversal(hash)
|
41
|
+
end
|
42
|
+
end
|
44
43
|
|
44
|
+
end
|
data/test/unit/test_auth.rb
CHANGED
@@ -30,6 +30,7 @@ require 'mocha/setup'
|
|
30
30
|
module LitleOnline
|
31
31
|
|
32
32
|
class TestAuth < Test::Unit::TestCase
|
33
|
+
|
33
34
|
def test_success_re_auth
|
34
35
|
hash = {
|
35
36
|
'merchantId' => '101',
|
@@ -318,7 +319,40 @@ module LitleOnline
|
|
318
319
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<card><type>GC<\/type><number>4141000000000000<\/number><expDate>1210<\/expDate><\/card>.*/m), is_a(Hash))
|
319
320
|
LitleOnlineRequest.new.authorization(hash)
|
320
321
|
end
|
321
|
-
|
322
|
-
end
|
323
322
|
|
324
|
-
|
323
|
+
def test_advanced_fraud_check
|
324
|
+
hash = {
|
325
|
+
'orderId' => '12344',
|
326
|
+
'amount' => '2',
|
327
|
+
'orderSource' => 'ecommerce',
|
328
|
+
'card' => {
|
329
|
+
'number' => '4141000000000000',
|
330
|
+
'expDate' => '1210',
|
331
|
+
'type' => 'GC'
|
332
|
+
} ,
|
333
|
+
'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
|
334
|
+
}
|
335
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudChecks><threatMetrixSessionId>1234<\/threatMetrixSessionId><\/advancedFraudChecks>.*/m), is_a(Hash))
|
336
|
+
LitleOnlineRequest.new.authorization(hash)
|
337
|
+
end
|
338
|
+
|
339
|
+
def test_mpos
|
340
|
+
hash = {
|
341
|
+
'orderId' => '12344',
|
342
|
+
'amount' => '2',
|
343
|
+
'orderSource' => 'ecommerce',
|
344
|
+
'mpos'=>
|
345
|
+
{
|
346
|
+
'ksn'=>'ksnString',
|
347
|
+
'formatId'=>'30',
|
348
|
+
'encryptedTrack'=>'encryptedTrackString',
|
349
|
+
'track1Status'=>'0',
|
350
|
+
'track2Status'=>'0'
|
351
|
+
}
|
352
|
+
}
|
353
|
+
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))
|
354
|
+
LitleOnlineRequest.new.authorization(hash)
|
355
|
+
end
|
356
|
+
|
357
|
+
end
|
358
|
+
end
|
@@ -0,0 +1,52 @@
|
|
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
|
+
module LitleOnline
|
29
|
+
class TestBalanceInquiry < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_simple
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'orderId' => '11',
|
37
|
+
'orderSource'=>'ecommerce',
|
38
|
+
'card'=>
|
39
|
+
{
|
40
|
+
'type'=>'VI',
|
41
|
+
'number' =>'4100000000000001',
|
42
|
+
'expDate' =>'1210'
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<balanceInquiry reportGroup="Planets"><orderId>11<\/orderId><orderSource>ecommerce<\/orderSource><card><type>VI<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/balanceInquiry>.*/m), is_a(Hash))
|
47
|
+
LitleOnlineRequest.new.balance_inquiry(hash)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,43 @@
|
|
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
|
+
module LitleOnline
|
29
|
+
class TestCancelSubscription < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_simple
|
32
|
+
hash = {
|
33
|
+
'subscriptionId' =>'100',
|
34
|
+
'merchantId' => '101',
|
35
|
+
'version'=>'8.8',
|
36
|
+
}
|
37
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<cancelSubscription><subscriptionId>100<\/subscriptionId><\/cancelSubscription>.*/m), is_a(Hash))
|
38
|
+
LitleOnlineRequest.new.cancel_subscription(hash)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -132,6 +132,48 @@ module LitleOnline
|
|
132
132
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
133
133
|
LitleOnlineRequest.new.capture_given_auth(hash)
|
134
134
|
end
|
135
|
-
|
135
|
+
|
136
|
+
|
137
|
+
def test_fraudResult
|
138
|
+
hash = {
|
139
|
+
'amount' => '2',
|
140
|
+
'orderSource' => 'ecommerce',
|
141
|
+
'reportGroup' => 'Planets',
|
142
|
+
'authInformation' => {
|
143
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
144
|
+
'authAmount'=>'12345',
|
145
|
+
'fraudResult' => {
|
146
|
+
'advancedFraudResults' =>
|
147
|
+
{'deviceReviewStatus' => 'deviceReviewStatusString',
|
148
|
+
'deviceReputationScore' => '100'
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudResults><deviceReviewStatus>deviceReviewStatusString<\/deviceReviewStatus><deviceReputationScore>100<\/deviceReputationScore><\/advancedFraudResults>.*/m), is_a(Hash))
|
154
|
+
LitleOnlineRequest.new.capture_given_auth(hash)
|
155
|
+
end
|
136
156
|
|
137
|
-
|
157
|
+
def test_fraudResult
|
158
|
+
hash = {
|
159
|
+
'amount' => '2',
|
160
|
+
'orderSource' => 'ecommerce',
|
161
|
+
'reportGroup' => 'Planets',
|
162
|
+
'authInformation' => {
|
163
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
164
|
+
'authAmount'=>'12345',
|
165
|
+
'fraudResult' => {
|
166
|
+
'advancedFraudResults' =>
|
167
|
+
{'deviceReviewStatus' => 'deviceReviewStatusString',
|
168
|
+
'deviceReputationScore' => '100',
|
169
|
+
'triggeredRule' => ['rule1','rule2']
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudResults><deviceReviewStatus>deviceReviewStatusString<\/deviceReviewStatus><deviceReputationScore>100<\/deviceReputationScore><triggeredRule>rule1<\/triggeredRule><triggeredRule>rule2<\/triggeredRule><\/advancedFraudResults>.*/m), is_a(Hash))
|
175
|
+
LitleOnlineRequest.new.capture_given_auth(hash)
|
176
|
+
end
|
177
|
+
|
178
|
+
end
|
179
|
+
end
|
@@ -0,0 +1,52 @@
|
|
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
|
+
module LitleOnline
|
29
|
+
class TestCreatePlan < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_simple
|
32
|
+
hash ={
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'planCode'=>'planCodeString',
|
37
|
+
'name'=>'nameString',
|
38
|
+
'description'=>'descriptionString',
|
39
|
+
'intervalType'=>'ANNUAL',
|
40
|
+
'amount'=>'500',
|
41
|
+
'numberOfPayments'=>'2',
|
42
|
+
'trialNumberOfIntervals'=>'1',
|
43
|
+
'trialIntervalType'=>'MONTH',
|
44
|
+
'active'=>'true'
|
45
|
+
}
|
46
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<createPlan><planCode>planCodeString<\/planCode><name>nameString<\/name><description>descriptionString<\/description><intervalType>ANNUAL<\/intervalType><amount>500<\/amount><numberOfPayments>2<\/numberOfPayments><trialNumberOfIntervals>1<\/trialNumberOfIntervals><trialIntervalType>MONTH<\/trialIntervalType><active>true<\/active><\/createPlan>.*/m), is_a(Hash))
|
47
|
+
LitleOnlineRequest.new.create_plan(hash)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|