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,134 @@
|
|
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
|
+
|
28
|
+
module LitleOnline
|
29
|
+
class Test_echeckCredit < Test::Unit::TestCase
|
30
|
+
def test_simple_echeckcredit
|
31
|
+
hash = {
|
32
|
+
'merchantId' => '101',
|
33
|
+
'version'=>'8.8',
|
34
|
+
'reportGroup'=>'Planets',
|
35
|
+
'litleTxnId'=>'123456789101112',
|
36
|
+
'amount'=>'12'
|
37
|
+
}
|
38
|
+
response= LitleOnlineRequest.new.echeck_credit(hash)
|
39
|
+
assert_equal('Valid Format', response.message)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_no_amount
|
43
|
+
hash = {
|
44
|
+
'merchantId' => '101',
|
45
|
+
'version'=>'8.8',
|
46
|
+
'reportGroup'=>'Planets',
|
47
|
+
}
|
48
|
+
response = LitleOnlineRequest.new.echeck_credit(hash)
|
49
|
+
assert_match /The content of element 'echeckCredit' is not complete/, response.message
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_echeck_credit_with_echeck
|
53
|
+
hash = {
|
54
|
+
'merchantId' => '101',
|
55
|
+
'version'=>'8.8',
|
56
|
+
'reportGroup'=>'Planets',
|
57
|
+
'amount'=>'123456',
|
58
|
+
'verify'=>'true',
|
59
|
+
'orderId'=>'12345',
|
60
|
+
'orderSource'=>'ecommerce',
|
61
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
62
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
63
|
+
}
|
64
|
+
response= LitleOnlineRequest.new.echeck_credit(hash)
|
65
|
+
assert_equal('Valid Format', response.message)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_echeck_credit_with_echeck_token
|
69
|
+
hash = {
|
70
|
+
'merchantId' => '101',
|
71
|
+
'version'=>'8.8',
|
72
|
+
'reportGroup'=>'Planets',
|
73
|
+
'amount'=>'123456',
|
74
|
+
'verify'=>'true',
|
75
|
+
'orderId'=>'12345',
|
76
|
+
'orderSource'=>'ecommerce',
|
77
|
+
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
78
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
79
|
+
}
|
80
|
+
response= LitleOnlineRequest.new.echeck_credit(hash)
|
81
|
+
assert_equal('Valid Format', response.message)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_extra_field_and_incorrect_order
|
85
|
+
hash = {
|
86
|
+
'merchantId' => '101',
|
87
|
+
'version'=>'8.8',
|
88
|
+
'reportGroup'=>'Planets',
|
89
|
+
'amount'=>'123',
|
90
|
+
'invalidfield'=>'nonexistant',
|
91
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
92
|
+
'verify'=>'true',
|
93
|
+
'orderId'=>'12345',
|
94
|
+
'orderSource'=>'ecommerce',
|
95
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
96
|
+
}
|
97
|
+
response= LitleOnlineRequest.new.echeck_credit(hash)
|
98
|
+
assert_equal('Valid Format', response.message)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_extra_field_and_missing_billing
|
102
|
+
hash = {
|
103
|
+
'merchantId' => '101',
|
104
|
+
'version'=>'8.8',
|
105
|
+
'reportGroup'=>'Planets',
|
106
|
+
'amount'=>'123',
|
107
|
+
'invalidfield'=>'nonexistant',
|
108
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
109
|
+
'verify'=>'true',
|
110
|
+
'orderId'=>'12345',
|
111
|
+
'orderSource'=>'ecommerce',
|
112
|
+
}
|
113
|
+
response= LitleOnlineRequest.new.echeck_credit(hash)
|
114
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_echeck_credit_with_secondaryAmount
|
118
|
+
hash = {
|
119
|
+
'merchantId' => '101',
|
120
|
+
'version'=>'8.8',
|
121
|
+
'reportGroup'=>'Planets',
|
122
|
+
'amount'=>'123456',
|
123
|
+
'secondaryAmount'=>'50',
|
124
|
+
'verify'=>'true',
|
125
|
+
'orderId'=>'12345',
|
126
|
+
'orderSource'=>'ecommerce',
|
127
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
128
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
129
|
+
}
|
130
|
+
response= LitleOnlineRequest.new.echeck_credit(hash)
|
131
|
+
assert_equal('Valid Format', response.message)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,88 @@
|
|
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
|
+
|
28
|
+
module LitleOnline
|
29
|
+
class Test_echeckRedeposit < Test::Unit::TestCase
|
30
|
+
def test_simple_echeck_redeposit
|
31
|
+
hash = {
|
32
|
+
'merchantId' => '101',
|
33
|
+
'version'=>'8.8',
|
34
|
+
'reportGroup'=>'Planets',
|
35
|
+
'litleTxnId'=>'123456'
|
36
|
+
}
|
37
|
+
response= LitleOnlineRequest.new.echeck_redeposit(hash)
|
38
|
+
assert_equal('Valid Format', response.message)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_echeck_redeposit_with_echeck
|
42
|
+
hash = {
|
43
|
+
'merchantId' => '101',
|
44
|
+
'version'=>'8.8',
|
45
|
+
'reportGroup'=>'Planets',
|
46
|
+
'litleTxnId'=>'123456',
|
47
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
48
|
+
}
|
49
|
+
response= LitleOnlineRequest.new.echeck_redeposit(hash)
|
50
|
+
assert_equal('Valid Format', response.message)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_echeck_redeposit_with_echeck_token
|
54
|
+
hash = {
|
55
|
+
'merchantId' => '101',
|
56
|
+
'version'=>'8.8',
|
57
|
+
'reportGroup'=>'Planets',
|
58
|
+
'litleTxnId'=>'123456',
|
59
|
+
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'}
|
60
|
+
}
|
61
|
+
response= LitleOnlineRequest.new.echeck_redeposit(hash)
|
62
|
+
assert_equal('Valid Format', response.message)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_extra_field_and_incorrect_order
|
66
|
+
hash = {
|
67
|
+
'merchantId' => '101',
|
68
|
+
'version'=>'8.8',
|
69
|
+
'reportGroup'=>'Planets',
|
70
|
+
'invalidfield'=>'nonexistant',
|
71
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
72
|
+
'litleTxnId'=>'123456'
|
73
|
+
}
|
74
|
+
response= LitleOnlineRequest.new.echeck_redeposit(hash)
|
75
|
+
assert_equal('Valid Format', response.message)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_no_txn_id
|
79
|
+
hash = {
|
80
|
+
'merchantId' => '101',
|
81
|
+
'version'=>'8.8',
|
82
|
+
'reportGroup'=>'Planets',
|
83
|
+
}
|
84
|
+
response= LitleOnlineRequest.new.echeck_redeposit(hash)
|
85
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,177 @@
|
|
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
|
+
|
28
|
+
module LitleOnline
|
29
|
+
class Test_echeckSale < Test::Unit::TestCase
|
30
|
+
def test_echeck_sale_with_echeck
|
31
|
+
hash = {
|
32
|
+
'merchantId' => '101',
|
33
|
+
'version'=>'8.8',
|
34
|
+
'reportGroup'=>'Planets',
|
35
|
+
'amount'=>'123456',
|
36
|
+
'verify'=>'true',
|
37
|
+
'orderId'=>'12345',
|
38
|
+
'orderSource'=>'ecommerce',
|
39
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
40
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
41
|
+
}
|
42
|
+
response= LitleOnlineRequest.new.echeck_sale(hash)
|
43
|
+
assert_equal('Valid Format', response.message)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_no_amount
|
47
|
+
hash = {
|
48
|
+
'merchantId' => '101',
|
49
|
+
'version'=>'8.8',
|
50
|
+
'reportGroup'=>'Planets'
|
51
|
+
}
|
52
|
+
response = LitleOnlineRequest.new.echeck_sale(hash)
|
53
|
+
assert_match /The content of element 'echeckSale' is not complete/, response.message
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_echeck_sale_with_echeck
|
57
|
+
hash = {
|
58
|
+
'merchantId' => '101',
|
59
|
+
'version'=>'8.8',
|
60
|
+
'reportGroup'=>'Planets',
|
61
|
+
'amount'=>'123456',
|
62
|
+
'verify'=>'true',
|
63
|
+
'orderId'=>'12345',
|
64
|
+
'orderSource'=>'ecommerce',
|
65
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
66
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
67
|
+
}
|
68
|
+
response= LitleOnlineRequest.new.echeck_sale(hash)
|
69
|
+
assert_equal('Valid Format', response.message)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_echeck_sale_with_ship_to
|
73
|
+
hash = {
|
74
|
+
'merchantId' => '101',
|
75
|
+
'version'=>'8.8',
|
76
|
+
'reportGroup'=>'Planets',
|
77
|
+
'amount'=>'123456',
|
78
|
+
'verify'=>'true',
|
79
|
+
'orderId'=>'12345',
|
80
|
+
'orderSource'=>'ecommerce',
|
81
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
82
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
|
83
|
+
'shipToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
84
|
+
}
|
85
|
+
response= LitleOnlineRequest.new.echeck_sale(hash)
|
86
|
+
assert_equal('Valid Format', response.message)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_echeck_sale_with_echeck_token
|
90
|
+
hash = {
|
91
|
+
'merchantId' => '101',
|
92
|
+
'version'=>'8.8',
|
93
|
+
'reportGroup'=>'Planets',
|
94
|
+
'amount'=>'123456',
|
95
|
+
'verify'=>'true',
|
96
|
+
'orderId'=>'12345',
|
97
|
+
'orderSource'=>'ecommerce',
|
98
|
+
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
99
|
+
'customBilling'=>{'phone'=>'123456789','descriptor'=>'good'},
|
100
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
101
|
+
}
|
102
|
+
response= LitleOnlineRequest.new.echeck_sale(hash)
|
103
|
+
assert_equal('Valid Format', response.message)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_extra_field_and_incorrect_order
|
107
|
+
hash = {
|
108
|
+
'merchantId' => '101',
|
109
|
+
'version'=>'8.8',
|
110
|
+
'reportGroup'=>'Planets',
|
111
|
+
'amount'=>'123',
|
112
|
+
'invalidfield'=>'nonexistant',
|
113
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
114
|
+
'verify'=>'true',
|
115
|
+
'orderId'=>'12345',
|
116
|
+
'orderSource'=>'ecommerce',
|
117
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
118
|
+
}
|
119
|
+
response= LitleOnlineRequest.new.echeck_sale(hash)
|
120
|
+
assert_equal('Valid Format', response.message)
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_extra_field_and_missing_billing
|
124
|
+
hash = {
|
125
|
+
'merchantId' => '101',
|
126
|
+
'version'=>'8.8',
|
127
|
+
'reportGroup'=>'Planets',
|
128
|
+
'amount'=>'123',
|
129
|
+
'invalidfield'=>'nonexistant',
|
130
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
131
|
+
'verify'=>'true',
|
132
|
+
'orderId'=>'12345',
|
133
|
+
'orderSource'=>'ecommerce',
|
134
|
+
}
|
135
|
+
response= LitleOnlineRequest.new.echeck_sale(hash)
|
136
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_simple_echeck_sale
|
140
|
+
hash = {
|
141
|
+
'reportGroup'=>'Planets',
|
142
|
+
'litleTxnId'=>'123456789101112',
|
143
|
+
'amount'=>'12'
|
144
|
+
}
|
145
|
+
response= LitleOnlineRequest.new.echeck_sale(hash)
|
146
|
+
assert_equal('Valid Format', response.message)
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_simple_echeck_sale_with_custom_billing
|
150
|
+
hash = {
|
151
|
+
'reportGroup'=>'Planets',
|
152
|
+
'litleTxnId'=>'123456',
|
153
|
+
'amount'=>'10',
|
154
|
+
}
|
155
|
+
response= LitleOnlineRequest.new.echeck_sale(hash)
|
156
|
+
assert_equal('Valid Format', response.message)
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_echeck_sale_with_secondaryAmount
|
160
|
+
hash = {
|
161
|
+
'merchantId' => '101',
|
162
|
+
'version'=>'8.8',
|
163
|
+
'reportGroup'=>'Planets',
|
164
|
+
'amount'=>'123456',
|
165
|
+
'secondaryAmount'=>'50',
|
166
|
+
'verify'=>'true',
|
167
|
+
'orderId'=>'12345',
|
168
|
+
'orderSource'=>'ecommerce',
|
169
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
170
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
171
|
+
}
|
172
|
+
response= LitleOnlineRequest.new.echeck_sale(hash)
|
173
|
+
assert_equal('Valid Format', response.message)
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
end
|
@@ -0,0 +1,127 @@
|
|
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
|
+
|
28
|
+
module LitleOnline
|
29
|
+
class Test_echeckVerification < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_simple_echeck_verification
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'amount'=>'123456',
|
37
|
+
'orderId'=>'12345',
|
38
|
+
'orderSource'=>'ecommerce',
|
39
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
40
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
41
|
+
}
|
42
|
+
response= LitleOnlineRequest.new.echeck_verification(hash)
|
43
|
+
assert_equal('Valid Format', response.message)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_echeck_verification_with_echeck_token
|
47
|
+
hash = {
|
48
|
+
'merchantId' => '101',
|
49
|
+
'version'=>'8.8',
|
50
|
+
'reportGroup'=>'Planets',
|
51
|
+
'amount'=>'123456',
|
52
|
+
'orderId'=>'12345',
|
53
|
+
'orderSource'=>'ecommerce',
|
54
|
+
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
55
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
56
|
+
}
|
57
|
+
response= LitleOnlineRequest.new.echeck_verification(hash)
|
58
|
+
assert_equal('Valid Format', response.message)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_extra_field_and_incorrect_order
|
62
|
+
hash = {
|
63
|
+
'merchantId' => '101',
|
64
|
+
'version'=>'8.8',
|
65
|
+
'reportGroup'=>'Planets',
|
66
|
+
'amount'=>'123',
|
67
|
+
'invalidfield'=>'nonexistant',
|
68
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
69
|
+
'orderId'=>'12345',
|
70
|
+
'orderSource'=>'ecommerce',
|
71
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
72
|
+
}
|
73
|
+
response= LitleOnlineRequest.new.echeck_verification(hash)
|
74
|
+
assert_equal('Valid Format', response.message)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_extra_field_and_missing_billing
|
78
|
+
hash = {
|
79
|
+
'merchantId' => '101',
|
80
|
+
'version'=>'8.8',
|
81
|
+
'reportGroup'=>'Planets',
|
82
|
+
'amount'=>'123',
|
83
|
+
'invalidfield'=>'nonexistant',
|
84
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
85
|
+
'orderId'=>'12345',
|
86
|
+
'orderSource'=>'ecommerce',
|
87
|
+
}
|
88
|
+
response= LitleOnlineRequest.new.echeck_verification(hash)
|
89
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_no_amount
|
93
|
+
hash = {
|
94
|
+
'merchantId' => '101',
|
95
|
+
'version'=>'8.8',
|
96
|
+
'reportGroup'=>'Planets',
|
97
|
+
'orderId'=>'12345'
|
98
|
+
}
|
99
|
+
response= LitleOnlineRequest.new.echeck_verification(hash)
|
100
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_no_order_id
|
104
|
+
hash = {
|
105
|
+
'merchantId' => '101',
|
106
|
+
'version'=>'8.8',
|
107
|
+
'reportGroup'=>'Planets',
|
108
|
+
}
|
109
|
+
response= LitleOnlineRequest.new.echeck_verification(hash)
|
110
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_no_order_source
|
114
|
+
hash = {
|
115
|
+
'merchantId' => '101',
|
116
|
+
'version'=>'8.8',
|
117
|
+
'reportGroup'=>'Planets',
|
118
|
+
'amount'=>'123456',
|
119
|
+
'orderId'=>'12345'
|
120
|
+
}
|
121
|
+
response= LitleOnlineRequest.new.echeck_verification(hash)
|
122
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|