VantivCnp 8.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +139 -0
- data/CONTRIBUTORS +2 -0
- data/DESCRIPTION +5 -0
- data/LICENSE +22 -0
- data/README.md +72 -0
- data/Rakefile +89 -0
- data/SETUP.md +46 -0
- data/bin/Setup.rb +124 -0
- data/bin/sample_batch_driver.rb +123 -0
- data/bin/sample_driver.rb +49 -0
- data/lib/Communications.rb +85 -0
- data/lib/Configuration.rb +67 -0
- data/lib/EnvironmentVariables.rb +22 -0
- data/lib/LitleBatchRequest.rb +562 -0
- data/lib/LitleListeners.rb +142 -0
- data/lib/LitleOnline.rb +62 -0
- data/lib/LitleOnlineRequest.rb +297 -0
- data/lib/LitleRequest.rb +494 -0
- data/lib/LitleTransaction.rb +463 -0
- data/lib/LitleXmlMapper.rb +64 -0
- data/lib/XMLFields.rb +1869 -0
- data/lib/cacert.pem +3331 -0
- 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/certification/certTest1_base.rb +945 -0
- data/test/certification/certTest2_authenhanced.rb +573 -0
- data/test/certification/certTest3_authreversal.rb +185 -0
- data/test/certification/certTest4_echeck.rb +278 -0
- data/test/certification/certTest5_token.rb +204 -0
- data/test/certification/certTest_batchAll.rb +337 -0
- data/test/certification/ts_all.rb +33 -0
- data/test/functional/test_activate.rb +100 -0
- data/test/functional/test_activateReversal.rb +56 -0
- data/test/functional/test_auth.rb +298 -0
- data/test/functional/test_authReversal.rb +69 -0
- data/test/functional/test_balanceInquiry.rb +80 -0
- data/test/functional/test_batch.rb +164 -0
- data/test/functional/test_batchStream.rb +145 -0
- data/test/functional/test_cancelSubscription.rb +55 -0
- data/test/functional/test_capture.rb +84 -0
- data/test/functional/test_captureGivenAuth.rb +235 -0
- data/test/functional/test_configuration.rb +89 -0
- data/test/functional/test_createPlan.rb +85 -0
- data/test/functional/test_credit.rb +174 -0
- 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_echeckCredit.rb +134 -0
- data/test/functional/test_echeckRedeposit.rb +88 -0
- data/test/functional/test_echeckSale.rb +177 -0
- data/test/functional/test_echeckVerification.rb +127 -0
- data/test/functional/test_echeckVoid.rb +41 -0
- data/test/functional/test_forceCapture.rb +183 -0
- data/test/functional/test_litle_requests.rb +356 -0
- data/test/functional/test_load.rb +82 -0
- data/test/functional/test_loadReversal.rb +56 -0
- data/test/functional/test_override.rb +64 -0
- data/test/functional/test_refundReversal.rb +56 -0
- data/test/functional/test_sale.rb +259 -0
- data/test/functional/test_token.rb +115 -0
- data/test/functional/test_unload.rb +82 -0
- data/test/functional/test_unloadReversal.rb +56 -0
- data/test/functional/test_updateCardValidationNumOnToken.rb +43 -0
- data/test/functional/test_updatePlan.rb +58 -0
- data/test/functional/test_updateSubscription.rb +76 -0
- data/test/functional/test_xmlfields.rb +427 -0
- data/test/functional/ts_all.rb +66 -0
- data/test/unit/test_LitleAUBatch.rb +216 -0
- data/test/unit/test_LitleBatchRequest.rb +643 -0
- data/test/unit/test_LitleOnlineRequest.rb +295 -0
- data/test/unit/test_LitleRequest.rb +316 -0
- data/test/unit/test_LitleTransaction.rb +397 -0
- data/test/unit/test_activate.rb +92 -0
- data/test/unit/test_activateReversal.rb +44 -0
- data/test/unit/test_auth.rb +421 -0
- data/test/unit/test_authReversal.rb +82 -0
- data/test/unit/test_balanceInquiry.rb +52 -0
- data/test/unit/test_cancelSubscription.rb +43 -0
- data/test/unit/test_capture.rb +73 -0
- data/test/unit/test_captureGivenAuth.rb +188 -0
- data/test/unit/test_createPlan.rb +52 -0
- data/test/unit/test_credit.rb +342 -0
- 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_echeckCredit.rb +71 -0
- data/test/unit/test_echeckRedeposit.rb +94 -0
- data/test/unit/test_echeckSale.rb +71 -0
- data/test/unit/test_echeckVerification.rb +71 -0
- data/test/unit/test_echeckVoid.rb +54 -0
- data/test/unit/test_forceCapture.rb +145 -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 +465 -0
- data/test/unit/test_token.rb +144 -0
- data/test/unit/test_unload.rb +53 -0
- data/test/unit/test_unloadReversal.rb +44 -0
- data/test/unit/test_updateCardValidationNumOnToken.rb +80 -0
- data/test/unit/test_updatePlan.rb +45 -0
- data/test/unit/test_updateSubscription.rb +172 -0
- data/test/unit/test_xmlfields.rb +2930 -0
- data/test/unit/ts_unit.rb +65 -0
- metadata +224 -0
|
@@ -0,0 +1,82 @@
|
|
|
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 File.expand_path("../../../lib/LitleOnline",__FILE__)
|
|
26
|
+
require 'test/unit'
|
|
27
|
+
require 'mocha/setup'
|
|
28
|
+
|
|
29
|
+
module LitleOnline
|
|
30
|
+
class TestAuthReversal < Test::Unit::TestCase
|
|
31
|
+
def test_invalid_field
|
|
32
|
+
hash = {
|
|
33
|
+
'merchantId' => '101',
|
|
34
|
+
'version'=>'8.8',
|
|
35
|
+
'litleTxnId'=>'12345678000',
|
|
36
|
+
'NonexistentField'=>'none',
|
|
37
|
+
'payPalNotes'=>'Notes',
|
|
38
|
+
'amount'=>'106',
|
|
39
|
+
'reportGroup'=>'Planets',
|
|
40
|
+
}
|
|
41
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>12345678000<\/litleTxnId>.*/m), is_a(Hash))
|
|
42
|
+
LitleOnlineRequest.new.auth_reversal(hash)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_logged_in_user
|
|
46
|
+
hash = {
|
|
47
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
|
48
|
+
'merchantId' => '101',
|
|
49
|
+
'version'=>'8.8',
|
|
50
|
+
'litleTxnId'=>'12345678000',
|
|
51
|
+
'reportGroup'=>'Planets',
|
|
52
|
+
'amount'=>'5000',
|
|
53
|
+
'loggedInUser'=>'gdake'
|
|
54
|
+
}
|
|
55
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
|
56
|
+
LitleOnlineRequest.new.auth_reversal(hash)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def test_surcharge_amount
|
|
60
|
+
hash = {
|
|
61
|
+
'litleTxnId' => '3',
|
|
62
|
+
'amount' => '2',
|
|
63
|
+
'surchargeAmount' => '1',
|
|
64
|
+
'payPalNotes' => 'note',
|
|
65
|
+
'reportGroup' => 'Planets'
|
|
66
|
+
}
|
|
67
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><payPalNotes>note<\/payPalNotes>.*/m), is_a(Hash))
|
|
68
|
+
LitleOnlineRequest.new.auth_reversal(hash)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def test_surcharge_amount_optional
|
|
72
|
+
hash = {
|
|
73
|
+
'litleTxnId' => '3',
|
|
74
|
+
'amount' => '2',
|
|
75
|
+
'payPalNotes' => 'note',
|
|
76
|
+
'reportGroup' => 'Planets'
|
|
77
|
+
}
|
|
78
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><payPalNotes>note<\/payPalNotes>.*/m), is_a(Hash))
|
|
79
|
+
LitleOnlineRequest.new.auth_reversal(hash)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
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 File.expand_path("../../../lib/LitleOnline",__FILE__)
|
|
26
|
+
require 'test/unit'
|
|
27
|
+
require 'mocha/setup'
|
|
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 File.expand_path("../../../lib/LitleOnline",__FILE__)
|
|
26
|
+
require 'test/unit'
|
|
27
|
+
require 'mocha/setup'
|
|
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
|
|
@@ -0,0 +1,73 @@
|
|
|
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 File.expand_path("../../../lib/LitleOnline",__FILE__)
|
|
26
|
+
require 'test/unit'
|
|
27
|
+
require 'mocha/setup'
|
|
28
|
+
|
|
29
|
+
module LitleOnline
|
|
30
|
+
class Test_capture < Test::Unit::TestCase
|
|
31
|
+
def test_success_capture
|
|
32
|
+
hash = {
|
|
33
|
+
'litleTxnId'=>'123456'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>123456<\/litleTxnId>.*/m), is_a(Hash))
|
|
37
|
+
LitleOnlineRequest.new.capture(hash)
|
|
38
|
+
end
|
|
39
|
+
def test_logged_in_user
|
|
40
|
+
hash = {
|
|
41
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
|
42
|
+
'litleTxnId'=>'123456',
|
|
43
|
+
'loggedInUser'=>'gdake'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
|
47
|
+
LitleOnlineRequest.new.capture(hash)
|
|
48
|
+
end
|
|
49
|
+
def test_surcharge_amount
|
|
50
|
+
hash = {
|
|
51
|
+
'litleTxnId' => '3',
|
|
52
|
+
'amount' => '2',
|
|
53
|
+
'surchargeAmount' => '1',
|
|
54
|
+
'payPalNotes' => 'note',
|
|
55
|
+
'reportGroup' => 'Planets'
|
|
56
|
+
}
|
|
57
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><payPalNotes>note<\/payPalNotes>.*/m), is_a(Hash))
|
|
58
|
+
LitleOnlineRequest.new.capture(hash)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_surcharge_amount_optional
|
|
62
|
+
hash = {
|
|
63
|
+
'litleTxnId' => '3',
|
|
64
|
+
'amount' => '2',
|
|
65
|
+
'payPalNotes' => 'note',
|
|
66
|
+
'reportGroup' => 'Planets'
|
|
67
|
+
}
|
|
68
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><payPalNotes>note<\/payPalNotes>.*/m), is_a(Hash))
|
|
69
|
+
LitleOnlineRequest.new.capture(hash)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
@@ -0,0 +1,188 @@
|
|
|
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 File.expand_path("../../../lib/LitleOnline",__FILE__)
|
|
26
|
+
require 'test/unit'
|
|
27
|
+
require 'mocha/setup'
|
|
28
|
+
|
|
29
|
+
module LitleOnline
|
|
30
|
+
class TestcaptureGivenAuth < Test::Unit::TestCase
|
|
31
|
+
def test_both_choices_card_and_token
|
|
32
|
+
hash = {
|
|
33
|
+
'merchantId' => '101',
|
|
34
|
+
'version'=>'8.8',
|
|
35
|
+
'reportGroup'=>'Planets',
|
|
36
|
+
'orderId'=>'12344',
|
|
37
|
+
'amount'=>'106',
|
|
38
|
+
'orderSource'=>'ecommerce',
|
|
39
|
+
'authInformation' => {
|
|
40
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
|
41
|
+
'authAmount'=>'12345'
|
|
42
|
+
},
|
|
43
|
+
'token'=> {
|
|
44
|
+
'litleToken'=>'123456789101112',
|
|
45
|
+
'expDate'=>'1210',
|
|
46
|
+
'cardValidationNum'=>'555',
|
|
47
|
+
'type'=>'VI'},
|
|
48
|
+
'card'=>{
|
|
49
|
+
'type'=>'VI',
|
|
50
|
+
'number' =>'4100000000000001',
|
|
51
|
+
'expDate' =>'1210'
|
|
52
|
+
}}
|
|
53
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.capture_given_auth(hash)}
|
|
54
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def test_all_three_choices
|
|
58
|
+
hash = {
|
|
59
|
+
'merchantId' => '101',
|
|
60
|
+
'version'=>'8.8',
|
|
61
|
+
'reportGroup'=>'Planets',
|
|
62
|
+
'orderId'=>'12344',
|
|
63
|
+
'amount'=>'106',
|
|
64
|
+
'orderSource'=>'ecommerce',
|
|
65
|
+
'authInformation' => {
|
|
66
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
|
67
|
+
'authAmount'=>'12345'
|
|
68
|
+
},
|
|
69
|
+
'card'=>{
|
|
70
|
+
'type'=>'VI',
|
|
71
|
+
'number' =>'4100000000000001',
|
|
72
|
+
'expDate' =>'1210'
|
|
73
|
+
},
|
|
74
|
+
'paypage'=> {
|
|
75
|
+
'paypageRegistrationId'=>'1234',
|
|
76
|
+
'expDate'=>'1210',
|
|
77
|
+
'cardValidationNum'=>'555',
|
|
78
|
+
'type'=>'VI'},
|
|
79
|
+
'token'=> {
|
|
80
|
+
'litleToken'=>'1234567890123',
|
|
81
|
+
'expDate'=>'1210',
|
|
82
|
+
'cardValidationNum'=>'555',
|
|
83
|
+
'type'=>'VI'
|
|
84
|
+
}}
|
|
85
|
+
|
|
86
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.capture_given_auth(hash)}
|
|
87
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def test_logged_in_user
|
|
91
|
+
hash = {
|
|
92
|
+
'loggedInUser' => 'gdake',
|
|
93
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
|
94
|
+
'merchantId' => '101',
|
|
95
|
+
'version'=>'8.8',
|
|
96
|
+
'reportGroup'=>'Planets',
|
|
97
|
+
'orderId'=>'12344',
|
|
98
|
+
'amount'=>'106',
|
|
99
|
+
'orderSource'=>'ecommerce',
|
|
100
|
+
'authInformation' => {
|
|
101
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
|
102
|
+
'authAmount'=>'12345'
|
|
103
|
+
},
|
|
104
|
+
'card'=>{
|
|
105
|
+
'type'=>'VI',
|
|
106
|
+
'number' =>'4100000000000001',
|
|
107
|
+
'expDate' =>'1210'
|
|
108
|
+
}}
|
|
109
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
|
110
|
+
LitleOnlineRequest.new.capture_given_auth(hash)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def test_secondary_amount
|
|
114
|
+
hash = {
|
|
115
|
+
'orderId' => '12344',
|
|
116
|
+
'amount' => '2',
|
|
117
|
+
'secondaryAmount' => '1',
|
|
118
|
+
'orderSource' => 'ecommerce',
|
|
119
|
+
'reportGroup' => 'Planets'
|
|
120
|
+
}
|
|
121
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
|
122
|
+
LitleOnlineRequest.new.capture_given_auth(hash)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def test_surcharge_amount
|
|
126
|
+
hash = {
|
|
127
|
+
'amount' => '2',
|
|
128
|
+
'surchargeAmount' => '1',
|
|
129
|
+
'orderSource' => 'ecommerce',
|
|
130
|
+
'reportGroup' => 'Planets'
|
|
131
|
+
}
|
|
132
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
|
133
|
+
LitleOnlineRequest.new.capture_given_auth(hash)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def test_surcharge_amount_optional
|
|
137
|
+
hash = {
|
|
138
|
+
'amount' => '2',
|
|
139
|
+
'orderSource' => 'ecommerce',
|
|
140
|
+
'reportGroup' => 'Planets'
|
|
141
|
+
}
|
|
142
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
|
143
|
+
LitleOnlineRequest.new.capture_given_auth(hash)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def test_fraudResult
|
|
147
|
+
hash = {
|
|
148
|
+
'amount' => '2',
|
|
149
|
+
'orderSource' => 'ecommerce',
|
|
150
|
+
'reportGroup' => 'Planets',
|
|
151
|
+
'authInformation' => {
|
|
152
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
|
153
|
+
'authAmount'=>'12345',
|
|
154
|
+
'fraudResult' => {
|
|
155
|
+
'advancedFraudResults' =>
|
|
156
|
+
{'deviceReviewStatus' => 'deviceReviewStatusString',
|
|
157
|
+
'deviceReputationScore' => '100'
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudResults><deviceReviewStatus>deviceReviewStatusString<\/deviceReviewStatus><deviceReputationScore>100<\/deviceReputationScore><\/advancedFraudResults>.*/m), is_a(Hash))
|
|
163
|
+
LitleOnlineRequest.new.capture_given_auth(hash)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def test_fraudResult
|
|
167
|
+
hash = {
|
|
168
|
+
'amount' => '2',
|
|
169
|
+
'orderSource' => 'ecommerce',
|
|
170
|
+
'reportGroup' => 'Planets',
|
|
171
|
+
'authInformation' => {
|
|
172
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
|
173
|
+
'authAmount'=>'12345',
|
|
174
|
+
'fraudResult' => {
|
|
175
|
+
'advancedFraudResults' =>
|
|
176
|
+
{'deviceReviewStatus' => 'deviceReviewStatusString',
|
|
177
|
+
'deviceReputationScore' => '100',
|
|
178
|
+
'triggeredRule' => ['rule1','rule2']
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudResults><deviceReviewStatus>deviceReviewStatusString<\/deviceReviewStatus><deviceReputationScore>100<\/deviceReputationScore><triggeredRule>rule1<\/triggeredRule><triggeredRule>rule2<\/triggeredRule><\/advancedFraudResults>.*/m), is_a(Hash))
|
|
184
|
+
LitleOnlineRequest.new.capture_given_auth(hash)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
end
|
|
188
|
+
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 File.expand_path("../../../lib/LitleOnline",__FILE__)
|
|
26
|
+
require 'test/unit'
|
|
27
|
+
require 'mocha/setup'
|
|
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
|