CnpOnline 8.31.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/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 +255 -0
@@ -0,0 +1,71 @@
|
|
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_echeckCredit < Test::Unit::TestCase
|
31
|
+
def test_echeck_credit_with_both
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'litleTxnId'=>'123456',
|
37
|
+
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
38
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
39
|
+
}
|
40
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_credit(hash)}
|
41
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_logged_in_user
|
45
|
+
hash = {
|
46
|
+
'loggedInUser' => 'gdake',
|
47
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
48
|
+
'merchantId' => '101',
|
49
|
+
'version'=>'8.8',
|
50
|
+
'reportGroup'=>'Planets',
|
51
|
+
'litleTxnId'=>'123456',
|
52
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
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))
|
55
|
+
LitleOnlineRequest.new.echeck_credit(hash)
|
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_credit(hash)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,94 @@
|
|
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 Test_echeckRedeposit < Test::Unit::TestCase
|
30
|
+
def test_echeck_redeposit_with_both
|
31
|
+
hash = {
|
32
|
+
'merchantId' => '101',
|
33
|
+
'version'=>'8.8',
|
34
|
+
'reportGroup'=>'Planets',
|
35
|
+
'litleTxnId'=>'123456',
|
36
|
+
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
37
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
38
|
+
}
|
39
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_redeposit(hash)}
|
40
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_echeck_redeposit_withecheckmissingfield
|
44
|
+
hash = {
|
45
|
+
'merchantId' => '101',
|
46
|
+
'version'=>'8.8',
|
47
|
+
'reportGroup'=>'Planets',
|
48
|
+
'litleTxnId'=>'123456',
|
49
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','checkNum'=>'123455'}
|
50
|
+
}
|
51
|
+
exception = assert_raise(RuntimeError) {LitleOnlineRequest.new.echeck_redeposit(hash)}
|
52
|
+
assert_match /If echeck is specified, it must have a routingNum/, exception.message
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_echeck_redeposit_with_echeck_token_missing_field
|
56
|
+
hash = {
|
57
|
+
'merchantId' => '101',
|
58
|
+
'version'=>'8.8',
|
59
|
+
'reportGroup'=>'Planets',
|
60
|
+
'litleTxnId'=>'123456',
|
61
|
+
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','checkNum'=>'123455'}
|
62
|
+
}
|
63
|
+
exception = assert_raise(RuntimeError) {LitleOnlineRequest.new.echeck_redeposit(hash)}
|
64
|
+
assert_match /If echeckToken is specified, it must have a routingNum/, exception.message
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_logged_in_user
|
68
|
+
hash = {
|
69
|
+
'loggedInUser' => 'gdake',
|
70
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
71
|
+
'merchantId' => '101',
|
72
|
+
'version'=>'8.8',
|
73
|
+
'reportGroup'=>'Planets',
|
74
|
+
'litleTxnId'=>'123456',
|
75
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
76
|
+
}
|
77
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
78
|
+
LitleOnlineRequest.new.echeck_redeposit(hash)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_merchant_data
|
82
|
+
hash = {
|
83
|
+
'merchantData' => {'campaign'=>'camping'},
|
84
|
+
'merchantId' => '101',
|
85
|
+
'version'=>'8.8',
|
86
|
+
'reportGroup'=>'Planets',
|
87
|
+
'litleTxnId'=>'123456',
|
88
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
89
|
+
}
|
90
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<\/echeck>.*<merchantData>.*<campaign>camping<\/campaign>.*<\/merchantData>/m), is_a(Hash))
|
91
|
+
LitleOnlineRequest.new.echeck_redeposit(hash)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,71 @@
|
|
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 Test_echeckSale < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_echeck_sale_with_both
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'litleTxnId'=>'123456',
|
37
|
+
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
38
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
39
|
+
}
|
40
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_sale(hash)}
|
41
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_logged_in_user
|
45
|
+
hash = {
|
46
|
+
'loggedInUser' => 'gdake',
|
47
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
48
|
+
'merchantId' => '101',
|
49
|
+
'version'=>'8.8',
|
50
|
+
'reportGroup'=>'Planets',
|
51
|
+
'litleTxnId'=>'123456',
|
52
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
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))
|
55
|
+
LitleOnlineRequest.new.echeck_sale(hash)
|
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
|
+
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,71 @@
|
|
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 Test_echeckVerification < Test::Unit::TestCase
|
30
|
+
def test_echeck_verification_with_both
|
31
|
+
hash = {
|
32
|
+
'merchantId' => '101',
|
33
|
+
'version'=>'8.8',
|
34
|
+
'reportGroup'=>'Planets',
|
35
|
+
'litleTxnId'=>'123456',
|
36
|
+
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
37
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
38
|
+
}
|
39
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
|
40
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_logged_in_user
|
44
|
+
hash = {
|
45
|
+
'loggedInUser' => 'gdake',
|
46
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
47
|
+
'merchantId' => '101',
|
48
|
+
'version'=>'8.8',
|
49
|
+
'reportGroup'=>'Planets',
|
50
|
+
'litleTxnId'=>'123456',
|
51
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
52
|
+
}
|
53
|
+
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
|
+
LitleOnlineRequest.new.echeck_verification(hash)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_merchant_data
|
58
|
+
hash = {
|
59
|
+
'merchantData' => {'campaign'=>'camping'},
|
60
|
+
'merchantId' => '101',
|
61
|
+
'version'=>'8.8',
|
62
|
+
'reportGroup'=>'Planets',
|
63
|
+
'litleTxnId'=>'123456',
|
64
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
65
|
+
}
|
66
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<\/echeck>.*<merchantData>.*<campaign>camping<\/campaign>.*<\/merchantData>/m), is_a(Hash))
|
67
|
+
LitleOnlineRequest.new.echeck_verification(hash)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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 Test_echeckVoid < Test::Unit::TestCase
|
30
|
+
def test_echeck_void
|
31
|
+
hash = {
|
32
|
+
'merchantId' => '101',
|
33
|
+
'version'=>'8.8',
|
34
|
+
'reportGroup'=>'Planets',
|
35
|
+
'litleTxnId'=>'123456',
|
36
|
+
}
|
37
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<echeckVoid.*<litleTxnId>123456<\/litleTxnId>.*/m), is_a(Hash))
|
38
|
+
LitleOnlineRequest.new.echeck_void(hash)
|
39
|
+
end
|
40
|
+
def test_logged_in_user
|
41
|
+
hash = {
|
42
|
+
'loggedInUser' => 'gdake',
|
43
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
44
|
+
'merchantId' => '101',
|
45
|
+
'version'=>'8.8',
|
46
|
+
'reportGroup'=>'Planets',
|
47
|
+
'litleTxnId'=>'123456',
|
48
|
+
}
|
49
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
50
|
+
LitleOnlineRequest.new.echeck_void(hash)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,145 @@
|
|
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
|
+
|
31
|
+
class TestForceCapture < Test::Unit::TestCase
|
32
|
+
def test_both_choices_card_and_token
|
33
|
+
hash = {
|
34
|
+
'merchantId' => '101',
|
35
|
+
'version'=>'8.8',
|
36
|
+
'reportGroup'=>'Planets',
|
37
|
+
'litleTxnId'=>'123456',
|
38
|
+
'orderId'=>'12344',
|
39
|
+
'amount'=>'106',
|
40
|
+
'orderSource'=>'ecommerce',
|
41
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
42
|
+
'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
43
|
+
'card'=>{
|
44
|
+
'type'=>'VI',
|
45
|
+
'number' =>'4100000000000001',
|
46
|
+
'expDate' =>'1210'
|
47
|
+
},
|
48
|
+
'token'=> {
|
49
|
+
'litleToken'=>'1234567890123',
|
50
|
+
'expDate'=>'1210',
|
51
|
+
'cardValidationNum'=>'555',
|
52
|
+
'type'=>'VI'
|
53
|
+
}}
|
54
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
|
55
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_all_choices
|
59
|
+
hash = {
|
60
|
+
'merchantId' => '101',
|
61
|
+
'version'=>'8.8',
|
62
|
+
'reportGroup'=>'Planets',
|
63
|
+
'litleTxnId'=>'123456',
|
64
|
+
'orderId'=>'12344',
|
65
|
+
'amount'=>'106',
|
66
|
+
'orderSource'=>'ecommerce',
|
67
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
68
|
+
'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
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
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
|
86
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_logged_in_user
|
90
|
+
hash = {
|
91
|
+
'loggedInUser' => 'gdake',
|
92
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
93
|
+
'merchantId' => '101',
|
94
|
+
'version'=>'8.8',
|
95
|
+
'reportGroup'=>'Planets',
|
96
|
+
'litleTxnId'=>'123456',
|
97
|
+
'orderId'=>'12344',
|
98
|
+
'amount'=>'106',
|
99
|
+
'orderSource'=>'ecommerce',
|
100
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
101
|
+
'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
102
|
+
'card'=>{
|
103
|
+
'type'=>'VI',
|
104
|
+
'number' =>'4100000000000001',
|
105
|
+
'expDate' =>'1210'
|
106
|
+
}}
|
107
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
108
|
+
LitleOnlineRequest.new.force_capture(hash)
|
109
|
+
end
|
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
|
+
|
122
|
+
def test_surcharge_amount
|
123
|
+
hash = {
|
124
|
+
'amount' => '2',
|
125
|
+
'surchargeAmount' => '1',
|
126
|
+
'orderSource' => 'ecommerce',
|
127
|
+
'reportGroup' => 'Planets'
|
128
|
+
}
|
129
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
130
|
+
LitleOnlineRequest.new.force_capture(hash)
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_surcharge_amount_optional
|
134
|
+
hash = {
|
135
|
+
'amount' => '2',
|
136
|
+
'orderSource' => 'ecommerce',
|
137
|
+
'reportGroup' => 'Planets'
|
138
|
+
}
|
139
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
140
|
+
LitleOnlineRequest.new.force_capture(hash)
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|