LitleOnline 8.10.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.
- data/DESCRIPTION +5 -0
- data/LICENSE +22 -0
- data/README.md +69 -0
- data/Rakefile +92 -0
- data/SETUP.md +47 -0
- data/bin/Setup.rb +103 -0
- data/bin/sample_driver.rb +49 -0
- data/index.html +176 -0
- data/index.html.1 +176 -0
- data/lib/Checker.rb +56 -0
- data/lib/Communications.rb +85 -0
- data/lib/Configuration.rb +45 -0
- data/lib/LitleOnline.rb +52 -0
- data/lib/LitleOnlineRequest.rb +399 -0
- data/lib/LitleXmlMapper.rb +48 -0
- data/lib/Obj2xml.rb +37 -0
- data/lib/XMLFields.rb +378 -0
- data/test/certification/certTest1_base.rb +948 -0
- data/test/certification/certTest2_authenhanced.rb +571 -0
- data/test/certification/certTest3_authreversal.rb +184 -0
- data/test/certification/certTest4_echeck.rb +279 -0
- data/test/certification/certTest5_token.rb +222 -0
- data/test/certification/ts_all.rb +31 -0
- data/test/functional/test_auth.rb +135 -0
- data/test/functional/test_authReversal.rb +68 -0
- data/test/functional/test_capture.rb +71 -0
- data/test/functional/test_captureGivenAuth.rb +161 -0
- data/test/functional/test_credit.rb +154 -0
- data/test/functional/test_echeckCredit.rb +116 -0
- data/test/functional/test_echeckRedeposit.rb +78 -0
- data/test/functional/test_echeckSale.rb +157 -0
- data/test/functional/test_echeckVerification.rb +92 -0
- data/test/functional/test_forceCapture.rb +105 -0
- data/test/functional/test_sale.rb +198 -0
- data/test/functional/test_token.rb +102 -0
- data/test/functional/test_xmlfields.rb +403 -0
- data/test/functional/ts_all.rb +39 -0
- data/test/unit/test_Checker.rb +58 -0
- data/test/unit/test_LitleOnlineRequest.rb +288 -0
- data/test/unit/test_auth.rb +168 -0
- data/test/unit/test_authReversal.rb +41 -0
- data/test/unit/test_capture.rb +40 -0
- data/test/unit/test_captureGivenAuth.rb +108 -0
- data/test/unit/test_credit.rb +117 -0
- data/test/unit/test_echeckCredit.rb +45 -0
- data/test/unit/test_echeckRedeposit.rb +76 -0
- data/test/unit/test_echeckSale.rb +45 -0
- data/test/unit/test_echeckVerification.rb +75 -0
- data/test/unit/test_forceCapture.rb +122 -0
- data/test/unit/test_sale.rb +249 -0
- data/test/unit/test_token.rb +70 -0
- data/test/unit/test_xmlfields.rb +173 -0
- data/test/unit/ts_unit.rb +41 -0
- metadata +166 -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 'lib/LitleOnline'
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
class Test_capture < Test::Unit::TestCase
|
29
|
+
def test_simplecapture
|
30
|
+
hash = {
|
31
|
+
'merchantId' => '101',
|
32
|
+
'version'=>'8.8',
|
33
|
+
'reportGroup'=>'Planets',
|
34
|
+
'litleTxnId'=>'123456000',
|
35
|
+
'amount'=>'106',
|
36
|
+
}
|
37
|
+
response= LitleOnlineRequest.new.capture(hash)
|
38
|
+
assert_equal('Valid Format', response.message)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_simplecapturewithpartial
|
42
|
+
hash = {
|
43
|
+
'merchantId' => '101',
|
44
|
+
'version'=>'8.8',
|
45
|
+
'reportGroup'=>'Planets',
|
46
|
+
'partial'=>'true',
|
47
|
+
'litleTxnId'=>'123456000',
|
48
|
+
'amount'=>'106',
|
49
|
+
}
|
50
|
+
response= LitleOnlineRequest.new.capture(hash)
|
51
|
+
assert_equal('Valid Format', response.message)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_complexcapture
|
55
|
+
hash = {
|
56
|
+
'merchantId' => '101',
|
57
|
+
'version'=>'8.8',
|
58
|
+
'reportGroup'=>'Planets',
|
59
|
+
'litleTxnId'=>'123456000',
|
60
|
+
'amount'=>'106',
|
61
|
+
'enhancedData'=>{
|
62
|
+
'customerReference'=>'Litle',
|
63
|
+
'salesTax'=>'50',
|
64
|
+
'deliveryType'=>'TBD'},
|
65
|
+
'payPalOrderComplete'=>'true'
|
66
|
+
}
|
67
|
+
response= LitleOnlineRequest.new.capture(hash)
|
68
|
+
assert_equal('Valid Format', response.message)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,161 @@
|
|
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
|
+
class TestcaptureGivenAuth < Test::Unit::TestCase
|
29
|
+
def test_simplecaptureGivenAuth_withCard
|
30
|
+
hash = {
|
31
|
+
'merchantId' => '101',
|
32
|
+
'version'=>'8.8',
|
33
|
+
'reportGroup'=>'Planets',
|
34
|
+
'orderId'=>'12344',
|
35
|
+
'amount'=>'106',
|
36
|
+
'authInformation' => {
|
37
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
38
|
+
'authAmount'=>'12345'
|
39
|
+
},
|
40
|
+
'orderSource'=>'ecommerce',
|
41
|
+
'card'=>{
|
42
|
+
'type'=>'VI',
|
43
|
+
'number' =>'4100000000000001',
|
44
|
+
'expDate' =>'1210'
|
45
|
+
}}
|
46
|
+
response= LitleOnlineRequest.new.captureGivenAuth(hash)
|
47
|
+
assert_equal('Valid Format', response.message)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_simplecaptureGivenAuth_withToken
|
51
|
+
hash = {
|
52
|
+
'merchantId' => '101',
|
53
|
+
'version'=>'8.8',
|
54
|
+
'reportGroup'=>'Planets',
|
55
|
+
'orderId'=>'12344',
|
56
|
+
'authInformation' => {
|
57
|
+
'authDate'=>'2002-10-09','authCode'=>'543216', 'processingInstructions'=>{'bypassVelocityCheck'=>'true'},
|
58
|
+
'authAmount'=>'12345'
|
59
|
+
},
|
60
|
+
'amount'=>'106',
|
61
|
+
'orderSource'=>'ecommerce',
|
62
|
+
'token'=> {
|
63
|
+
'litleToken'=>'123456789101112',
|
64
|
+
'expDate'=>'1210',
|
65
|
+
'cardValidationNum'=>'555',
|
66
|
+
'type'=>'VI'
|
67
|
+
}}
|
68
|
+
response= LitleOnlineRequest.new.captureGivenAuth(hash)
|
69
|
+
assert_equal('Valid Format', response.message)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_FieldsOutOfOrder
|
73
|
+
hash = {
|
74
|
+
'merchantId' => '101',
|
75
|
+
'version'=>'8.8',
|
76
|
+
'orderSource'=>'ecommerce',
|
77
|
+
'authInformation' => {
|
78
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
79
|
+
'authAmount'=>'12345'
|
80
|
+
},
|
81
|
+
'amount'=>'106',
|
82
|
+
'card'=>{
|
83
|
+
'type'=>'VI',
|
84
|
+
'number' =>'4100000000000001',
|
85
|
+
'expDate' =>'1210'
|
86
|
+
},
|
87
|
+
'reportGroup'=>'Planets',
|
88
|
+
'orderId'=>'12344'
|
89
|
+
}
|
90
|
+
response= LitleOnlineRequest.new.captureGivenAuth(hash)
|
91
|
+
assert_equal('Valid Format', response.message)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_InvalidField
|
95
|
+
hash = {
|
96
|
+
'merchantId' => '101',
|
97
|
+
'version'=>'8.8',
|
98
|
+
'reportGroup'=>'Planets',
|
99
|
+
'authInformation' => {
|
100
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
101
|
+
'authAmount'=>'12345'
|
102
|
+
},
|
103
|
+
'orderId'=>'12344',
|
104
|
+
'amount'=>'106',
|
105
|
+
'orderSource'=>'ecommerce',
|
106
|
+
'card'=>{
|
107
|
+
'NOexistantField' => 'ShouldNotCauseError',
|
108
|
+
'type'=>'VI',
|
109
|
+
'number' =>'4100000000000001',
|
110
|
+
'expDate' =>'1210'
|
111
|
+
}}
|
112
|
+
response= LitleOnlineRequest.new.captureGivenAuth(hash)
|
113
|
+
assert_equal('Valid Format', response.message)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_complex_captureGivenAuth
|
117
|
+
hash = {
|
118
|
+
'merchantId' => '101',
|
119
|
+
'version'=>'8.8',
|
120
|
+
'reportGroup'=>'Planets',
|
121
|
+
'orderId'=>'12344',
|
122
|
+
'amount'=>'106',
|
123
|
+
'authInformation' => {
|
124
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
125
|
+
'authAmount'=>'12345'
|
126
|
+
},
|
127
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
|
128
|
+
'processingInstructions'=>{'bypassVelocityCheck'=>'true'},
|
129
|
+
'orderSource'=>'ecommerce',
|
130
|
+
'card'=>{
|
131
|
+
'type'=>'VI',
|
132
|
+
'number' =>'4100000000000001',
|
133
|
+
'expDate' =>'1210'
|
134
|
+
}}
|
135
|
+
response= LitleOnlineRequest.new.captureGivenAuth(hash)
|
136
|
+
assert_equal('Valid Format', response.message)
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_authInfo
|
140
|
+
hash = {
|
141
|
+
'merchantId' => '101',
|
142
|
+
'version'=>'8.8',
|
143
|
+
'reportGroup'=>'Planets',
|
144
|
+
'orderId'=>'12344',
|
145
|
+
'amount'=>'106',
|
146
|
+
'authInformation' => {
|
147
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
148
|
+
'authAmount'=>'12345','fraudResult'=>{'avsResult'=>'12','cardValidationResult'=>'123','authenticationResult'=>'1',
|
149
|
+
'advancedAVSResult'=>'123'}
|
150
|
+
},
|
151
|
+
'orderSource'=>'ecommerce',
|
152
|
+
'card'=>{
|
153
|
+
'type'=>'VI',
|
154
|
+
'number' =>'4100000000000001',
|
155
|
+
'expDate' =>'1210'
|
156
|
+
}}
|
157
|
+
response= LitleOnlineRequest.new.captureGivenAuth(hash)
|
158
|
+
assert_equal('Valid Format', response.message)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
@@ -0,0 +1,154 @@
|
|
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
|
+
class TestCredit < Test::Unit::TestCase
|
29
|
+
def test_simple_Credit_withCard
|
30
|
+
hash = {
|
31
|
+
'merchantId' => '101',
|
32
|
+
'version'=>'8.8',
|
33
|
+
'reportGroup'=>'Planets',
|
34
|
+
'orderId'=>'12344',
|
35
|
+
'amount'=>'106',
|
36
|
+
'orderSource'=>'ecommerce',
|
37
|
+
'card'=>{
|
38
|
+
'type'=>'VI',
|
39
|
+
'number' =>'4100000000000001',
|
40
|
+
'expDate' =>'1210'
|
41
|
+
}}
|
42
|
+
response= LitleOnlineRequest.new.credit(hash)
|
43
|
+
assert_equal('Valid Format', response.message)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_simpleCredit_withpaypal
|
47
|
+
hash = {
|
48
|
+
'merchantId' => '101',
|
49
|
+
'version'=>'8.8',
|
50
|
+
'reportGroup'=>'Planets',
|
51
|
+
'amount'=>'106',
|
52
|
+
'orderId'=>'123456',
|
53
|
+
'orderSource'=>'ecommerce',
|
54
|
+
'paypal'=>{
|
55
|
+
'payerId'=>'1234',
|
56
|
+
'transactionId'=>'1234',
|
57
|
+
}}
|
58
|
+
response= LitleOnlineRequest.new.credit(hash)
|
59
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_illegalorderID
|
63
|
+
hash = {
|
64
|
+
'merchantId' => '101',
|
65
|
+
'version'=>'8.8',
|
66
|
+
'reportGroup'=>'Planets',
|
67
|
+
'orderId'=>'12344',
|
68
|
+
'litleTxnId' => '12345456',
|
69
|
+
'amount'=>'106',
|
70
|
+
'orderSource'=>'ecomerce',
|
71
|
+
'card'=>{
|
72
|
+
'type'=>'VI',
|
73
|
+
'number' =>'4100000000000001',
|
74
|
+
'expDate' =>'1210'
|
75
|
+
}}
|
76
|
+
response= LitleOnlineRequest.new.credit(hash)
|
77
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_FieldsOutOfOrder
|
81
|
+
hash = {
|
82
|
+
'merchantId' => '101',
|
83
|
+
'version'=>'8.8',
|
84
|
+
'reportGroup'=>'Planets',
|
85
|
+
'orderId'=>'12344',
|
86
|
+
'card'=>{
|
87
|
+
'type'=>'VI',
|
88
|
+
'number' =>'4100000000000001',
|
89
|
+
'expDate' =>'1210'
|
90
|
+
},
|
91
|
+
'orderSource'=>'ecommerce',
|
92
|
+
'amount'=>'106'
|
93
|
+
}
|
94
|
+
response= LitleOnlineRequest.new.credit(hash)
|
95
|
+
assert_equal('Valid Format', response.message)
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_InvalidField
|
99
|
+
hash = {
|
100
|
+
'merchantId' => '101',
|
101
|
+
'version'=>'8.8',
|
102
|
+
'reportGroup'=>'Planets',
|
103
|
+
'orderId'=>'12344',
|
104
|
+
'amount'=>'106',
|
105
|
+
'orderSource'=>'ecommerce',
|
106
|
+
'card'=>{
|
107
|
+
'NOexistantField' => 'ShouldNotCauseError',
|
108
|
+
'type'=>'VI',
|
109
|
+
'number' =>'4100000000000001',
|
110
|
+
'expDate' =>'1210'
|
111
|
+
}}
|
112
|
+
response= LitleOnlineRequest.new.credit(hash)
|
113
|
+
assert_equal('Valid Format', response.message)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_payPalNotes
|
117
|
+
hash = {
|
118
|
+
'merchantId' => '101',
|
119
|
+
'version'=>'8.8',
|
120
|
+
'reportGroup'=>'Planets',
|
121
|
+
'orderId'=>'12344',
|
122
|
+
'amount'=>'106',
|
123
|
+
'payPalNotes'=>'Hello',
|
124
|
+
'orderSource'=>'ecommerce',
|
125
|
+
'card'=>{
|
126
|
+
'type'=>'VI',
|
127
|
+
'number' =>'4100000000000001',
|
128
|
+
'expDate' =>'1210'
|
129
|
+
}}
|
130
|
+
response= LitleOnlineRequest.new.credit(hash)
|
131
|
+
assert_equal('Valid Format', response.message)
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_processingInstructionsandAmexdata
|
135
|
+
hash = {
|
136
|
+
'merchantId' => '101',
|
137
|
+
'version'=>'8.8',
|
138
|
+
'reportGroup'=>'Planets',
|
139
|
+
'amount'=>'2000',
|
140
|
+
'orderId'=>'12344',
|
141
|
+
'orderSource'=>'ecommerce',
|
142
|
+
'processingInstuctions'=>{'bypassVelocityCheck'=>'yes'},
|
143
|
+
'card'=>{
|
144
|
+
'type'=>'VI',
|
145
|
+
'number' =>'4100000000000001',
|
146
|
+
'expDate' =>'1210'},
|
147
|
+
'amexAggregatorData'=>{'sellerMerchantCategoryCode'=>'1234','sellerId'=>'1234Id'}
|
148
|
+
}
|
149
|
+
response= LitleOnlineRequest.new.credit(hash)
|
150
|
+
assert_equal('Valid Format', response.message)
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|
@@ -0,0 +1,116 @@
|
|
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
|
+
class Test_echeckCredit < Test::Unit::TestCase
|
29
|
+
def test_simple_echeckcredit
|
30
|
+
hash = {
|
31
|
+
'merchantId' => '101',
|
32
|
+
'version'=>'8.8',
|
33
|
+
'reportGroup'=>'Planets',
|
34
|
+
'litleTxnId'=>'123456789101112',
|
35
|
+
'amount'=>'12'
|
36
|
+
}
|
37
|
+
response= LitleOnlineRequest.new.echeckCredit(hash)
|
38
|
+
assert_equal('Valid Format', response.message)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_noAmount
|
42
|
+
hash = {
|
43
|
+
'merchantId' => '101',
|
44
|
+
'version'=>'8.8',
|
45
|
+
'reportGroup'=>'Planets',
|
46
|
+
}
|
47
|
+
response = LitleOnlineRequest.new.echeckCredit(hash)
|
48
|
+
assert_match /The content of element 'echeckCredit' is not complete/, response.message
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_echeckCredit_withecheck
|
52
|
+
hash = {
|
53
|
+
'merchantId' => '101',
|
54
|
+
'version'=>'8.8',
|
55
|
+
'reportGroup'=>'Planets',
|
56
|
+
'amount'=>'123456',
|
57
|
+
'verify'=>'true',
|
58
|
+
'orderId'=>'12345',
|
59
|
+
'orderSource'=>'ecommerce',
|
60
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
61
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
62
|
+
}
|
63
|
+
response= LitleOnlineRequest.new.echeckCredit(hash)
|
64
|
+
assert_equal('Valid Format', response.message)
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_echeckCredit_withechecktoken
|
68
|
+
hash = {
|
69
|
+
'merchantId' => '101',
|
70
|
+
'version'=>'8.8',
|
71
|
+
'reportGroup'=>'Planets',
|
72
|
+
'amount'=>'123456',
|
73
|
+
'verify'=>'true',
|
74
|
+
'orderId'=>'12345',
|
75
|
+
'orderSource'=>'ecommerce',
|
76
|
+
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
77
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
78
|
+
}
|
79
|
+
response= LitleOnlineRequest.new.echeckCredit(hash)
|
80
|
+
assert_equal('Valid Format', response.message)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_extrafieldand_incorrectOrder
|
84
|
+
hash = {
|
85
|
+
'merchantId' => '101',
|
86
|
+
'version'=>'8.8',
|
87
|
+
'reportGroup'=>'Planets',
|
88
|
+
'amount'=>'123',
|
89
|
+
'invalidfield'=>'nonexistant',
|
90
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
91
|
+
'verify'=>'true',
|
92
|
+
'orderId'=>'12345',
|
93
|
+
'orderSource'=>'ecommerce',
|
94
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
95
|
+
}
|
96
|
+
response= LitleOnlineRequest.new.echeckCredit(hash)
|
97
|
+
assert_equal('Valid Format', response.message)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_extrafieldand_missingBilling
|
101
|
+
hash = {
|
102
|
+
'merchantId' => '101',
|
103
|
+
'version'=>'8.8',
|
104
|
+
'reportGroup'=>'Planets',
|
105
|
+
'amount'=>'123',
|
106
|
+
'invalidfield'=>'nonexistant',
|
107
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
108
|
+
'verify'=>'true',
|
109
|
+
'orderId'=>'12345',
|
110
|
+
'orderSource'=>'ecommerce',
|
111
|
+
}
|
112
|
+
response= LitleOnlineRequest.new.echeckCredit(hash)
|
113
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|