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.
Files changed (54) hide show
  1. data/DESCRIPTION +5 -0
  2. data/LICENSE +22 -0
  3. data/README.md +69 -0
  4. data/Rakefile +92 -0
  5. data/SETUP.md +47 -0
  6. data/bin/Setup.rb +103 -0
  7. data/bin/sample_driver.rb +49 -0
  8. data/index.html +176 -0
  9. data/index.html.1 +176 -0
  10. data/lib/Checker.rb +56 -0
  11. data/lib/Communications.rb +85 -0
  12. data/lib/Configuration.rb +45 -0
  13. data/lib/LitleOnline.rb +52 -0
  14. data/lib/LitleOnlineRequest.rb +399 -0
  15. data/lib/LitleXmlMapper.rb +48 -0
  16. data/lib/Obj2xml.rb +37 -0
  17. data/lib/XMLFields.rb +378 -0
  18. data/test/certification/certTest1_base.rb +948 -0
  19. data/test/certification/certTest2_authenhanced.rb +571 -0
  20. data/test/certification/certTest3_authreversal.rb +184 -0
  21. data/test/certification/certTest4_echeck.rb +279 -0
  22. data/test/certification/certTest5_token.rb +222 -0
  23. data/test/certification/ts_all.rb +31 -0
  24. data/test/functional/test_auth.rb +135 -0
  25. data/test/functional/test_authReversal.rb +68 -0
  26. data/test/functional/test_capture.rb +71 -0
  27. data/test/functional/test_captureGivenAuth.rb +161 -0
  28. data/test/functional/test_credit.rb +154 -0
  29. data/test/functional/test_echeckCredit.rb +116 -0
  30. data/test/functional/test_echeckRedeposit.rb +78 -0
  31. data/test/functional/test_echeckSale.rb +157 -0
  32. data/test/functional/test_echeckVerification.rb +92 -0
  33. data/test/functional/test_forceCapture.rb +105 -0
  34. data/test/functional/test_sale.rb +198 -0
  35. data/test/functional/test_token.rb +102 -0
  36. data/test/functional/test_xmlfields.rb +403 -0
  37. data/test/functional/ts_all.rb +39 -0
  38. data/test/unit/test_Checker.rb +58 -0
  39. data/test/unit/test_LitleOnlineRequest.rb +288 -0
  40. data/test/unit/test_auth.rb +168 -0
  41. data/test/unit/test_authReversal.rb +41 -0
  42. data/test/unit/test_capture.rb +40 -0
  43. data/test/unit/test_captureGivenAuth.rb +108 -0
  44. data/test/unit/test_credit.rb +117 -0
  45. data/test/unit/test_echeckCredit.rb +45 -0
  46. data/test/unit/test_echeckRedeposit.rb +76 -0
  47. data/test/unit/test_echeckSale.rb +45 -0
  48. data/test/unit/test_echeckVerification.rb +75 -0
  49. data/test/unit/test_forceCapture.rb +122 -0
  50. data/test/unit/test_sale.rb +249 -0
  51. data/test/unit/test_token.rb +70 -0
  52. data/test/unit/test_xmlfields.rb +173 -0
  53. data/test/unit/ts_unit.rb +41 -0
  54. metadata +166 -0
@@ -0,0 +1,75 @@
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_echeckVerification < Test::Unit::TestCase
29
+ def test_noAmount
30
+ hash = {
31
+ 'merchantId' => '101',
32
+ 'version'=>'8.8',
33
+ 'reportGroup'=>'Planets',
34
+ 'orderId'=>'12345'
35
+ }
36
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeckVerification(hash)}
37
+ assert_match /Missing Required Field: amount!!!!/, exception.message
38
+ end
39
+
40
+ def test_noOrderId
41
+ hash = {
42
+ 'merchantId' => '101',
43
+ 'version'=>'8.8',
44
+ 'reportGroup'=>'Planets',
45
+ }
46
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeckVerification(hash)}
47
+ assert_match /Missing Required Field: orderId!!!!/, exception.message
48
+ end
49
+
50
+ def test_noOrderSource
51
+ hash = {
52
+ 'merchantId' => '101',
53
+ 'version'=>'8.8',
54
+ 'reportGroup'=>'Planets',
55
+ 'amount'=>'123456',
56
+ 'orderId'=>'12345'
57
+ }
58
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeckVerification(hash)}
59
+ assert_match /Missing Required Field: orderSource!!!/, exception.message
60
+ end
61
+
62
+ def test_echeckVerification_withBOTH
63
+ hash = {
64
+ 'merchantId' => '101',
65
+ 'version'=>'8.8',
66
+ 'reportGroup'=>'Planets',
67
+ 'litleTxnId'=>'123456',
68
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
69
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
70
+ }
71
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeckVerification(hash)}
72
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
73
+ end
74
+ end
75
+
@@ -0,0 +1,122 @@
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 TestForceCapture < Test::Unit::TestCase
29
+ def test_noOrderId
30
+ hash = {
31
+ 'merchantId' => '101',
32
+ 'version'=>'8.8',
33
+ 'reportGroup'=>'Planets',
34
+ 'litleTxnId'=>'123456',
35
+ 'amount'=>'106',
36
+ 'orderSource'=>'ecommerce',
37
+ 'token'=> {
38
+ 'litleToken'=>'123456789101112',
39
+ 'expDate'=>'1210',
40
+ 'cardValidationNum'=>'555',
41
+ 'type'=>'VI'
42
+ }}
43
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.forceCapture(hash)}
44
+ assert_match /Missing Required Field: orderId!!!!/, exception.message
45
+ end
46
+
47
+ def test_noOrderSource
48
+ hash = {
49
+ 'merchantId' => '101',
50
+ 'version'=>'8.8',
51
+ 'reportGroup'=>'Planets',
52
+ 'litleTxnId'=>'123456',
53
+ 'orderId'=>'12344',
54
+ 'amount'=>'106',
55
+ 'card'=>{
56
+ 'type'=>'VI',
57
+ 'number' =>'4100000000000001',
58
+ 'expDate' =>'1210'
59
+ }}
60
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.forceCapture(hash)}
61
+ assert_match /Missing Required Field: orderSource!!!!/, exception.message
62
+ end
63
+
64
+ def test_BothChoicesCardandtoken
65
+ hash = {
66
+ 'merchantId' => '101',
67
+ 'version'=>'8.8',
68
+ 'reportGroup'=>'Planets',
69
+ 'litleTxnId'=>'123456',
70
+ 'orderId'=>'12344',
71
+ 'amount'=>'106',
72
+ 'orderSource'=>'ecommerce',
73
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
74
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
75
+ 'card'=>{
76
+ 'type'=>'VI',
77
+ 'number' =>'4100000000000001',
78
+ 'expDate' =>'1210'
79
+ },
80
+ 'token'=> {
81
+ 'litleToken'=>'1234',
82
+ 'expDate'=>'1210',
83
+ 'cardValidationNum'=>'555',
84
+ 'type'=>'VI'
85
+ }}
86
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.forceCapture(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_allChoices
91
+ hash = {
92
+ 'merchantId' => '101',
93
+ 'version'=>'8.8',
94
+ 'reportGroup'=>'Planets',
95
+ 'litleTxnId'=>'123456',
96
+ 'orderId'=>'12344',
97
+ 'amount'=>'106',
98
+ 'orderSource'=>'ecommerce',
99
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
100
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
101
+ 'card'=>{
102
+ 'type'=>'VI',
103
+ 'number' =>'4100000000000001',
104
+ 'expDate' =>'1210'
105
+ },
106
+ 'paypage'=> {
107
+ 'paypageRegistrationId'=>'1234',
108
+ 'expDate'=>'1210',
109
+ 'cardValidationNum'=>'555',
110
+ 'type'=>'VI'},
111
+ 'token'=> {
112
+ 'litleToken'=>'1234',
113
+ 'expDate'=>'1210',
114
+ 'cardValidationNum'=>'555',
115
+ 'type'=>'VI'
116
+ }}
117
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.forceCapture(hash)}
118
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
119
+ end
120
+
121
+ end
122
+
@@ -0,0 +1,249 @@
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 TestSale < Test::Unit::TestCase
29
+
30
+ def test_noOrderId
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'litleTxnId'=>'123456',
36
+ 'amount'=>'106',
37
+ 'orderSource'=>'ecommerce',
38
+ 'card'=>{
39
+ 'type'=>'VI',
40
+ 'number' =>'4100000000000002',
41
+ 'expDate' =>'1210'
42
+ }}
43
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
44
+ assert_match /Missing Required Field: orderId!!!!/, exception.message
45
+ end
46
+
47
+ def test_noAmount
48
+ hash = {
49
+ 'merchantId' => '101',
50
+ 'version'=>'8.8',
51
+ 'reportGroup'=>'Planets',
52
+ 'litleTxnId'=>'123456',
53
+ 'orderId'=>'12344',
54
+ 'orderSource'=>'ecommerce',
55
+ 'card'=>{
56
+ 'type'=>'VI',
57
+ 'number' =>'4100000000000002',
58
+ 'expDate' =>'1210'
59
+ }}
60
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
61
+ assert_match /Missing Required Field: amount!!!!/, exception.message
62
+ end
63
+
64
+ def test_noOrderSource
65
+ hash = {
66
+ 'merchantId' => '101',
67
+ 'version'=>'8.8',
68
+ 'reportGroup'=>'Planets',
69
+ 'litleTxnId'=>'123456',
70
+ 'orderId'=>'12344',
71
+ 'amount'=>'106',
72
+ 'card'=>{
73
+ 'type'=>'VI',
74
+ 'number' =>'4100000000000002',
75
+ 'expDate' =>'1210'
76
+ }}
77
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
78
+ assert_match /Missing Required Field: orderSource!!!!/, exception.message
79
+ end
80
+
81
+ def test_BothChoicesfraudCheckandcardHolder
82
+ hash = {
83
+ 'merchantId' => '101',
84
+ 'version'=>'8.8',
85
+ 'reportGroup'=>'Planets',
86
+ 'litleTxnId'=>'123456',
87
+ 'orderId'=>'12344',
88
+ 'amount'=>'106',
89
+ 'orderSource'=>'ecommerce',
90
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
91
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
92
+ 'card'=>{
93
+ 'type'=>'VI',
94
+ 'number' =>'4100000000000002',
95
+ 'expDate' =>'1210'
96
+ }}
97
+
98
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
99
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
100
+ end
101
+
102
+ def test_BothChoicesCardandPaypal
103
+ hash = {
104
+ 'merchantId' => '101',
105
+ 'version'=>'8.8',
106
+ 'reportGroup'=>'Planets',
107
+ 'litleTxnId'=>'123456',
108
+ 'orderId'=>'12344',
109
+ 'amount'=>'106',
110
+ 'orderSource'=>'ecommerce',
111
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
112
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
113
+ 'card'=>{
114
+ 'type'=>'VI',
115
+ 'number' =>'4100000000000002',
116
+ 'expDate' =>'1210'
117
+ },
118
+ 'paypal'=>{
119
+ 'payerId'=>'1234',
120
+ 'token'=>'1234',
121
+ 'transactionId'=>'123456'
122
+ }}
123
+
124
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
125
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
126
+ end
127
+
128
+ def test_BothChoicesCardandtoken
129
+ hash = {
130
+ 'merchantId' => '101',
131
+ 'version'=>'8.8',
132
+ 'reportGroup'=>'Planets',
133
+ 'litleTxnId'=>'123456',
134
+ 'orderId'=>'12344',
135
+ 'amount'=>'106',
136
+ 'orderSource'=>'ecommerce',
137
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
138
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
139
+ 'card'=>{
140
+ 'type'=>'VI',
141
+ 'number' =>'4100000000000002',
142
+ 'expDate' =>'1210'
143
+ },
144
+ 'token'=> {
145
+ 'litleToken'=>'1234',
146
+ 'expDate'=>'1210',
147
+ 'cardValidationNum'=>'555',
148
+ 'type'=>'VI'
149
+ }}
150
+
151
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
152
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
153
+ end
154
+
155
+ def test_BothChoicesCardandPaypage
156
+ hash = {
157
+ 'merchantId' => '101',
158
+ 'version'=>'8.8',
159
+ 'reportGroup'=>'Planets',
160
+ 'litleTxnId'=>'123456',
161
+ 'orderId'=>'12344',
162
+ 'amount'=>'106',
163
+ 'orderSource'=>'ecommerce',
164
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
165
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
166
+ 'card'=>{
167
+ 'type'=>'VI',
168
+ 'number' =>'4100000000000002',
169
+ 'expDate' =>'1210'
170
+ },
171
+ 'paypage'=> {
172
+ 'paypageRegistrationId'=>'1234',
173
+ 'expDate'=>'1210',
174
+ 'cardValidationNum'=>'555',
175
+ 'type'=>'VI'
176
+ }}
177
+
178
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
179
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
180
+ end
181
+
182
+ def test_threeChoicesCardandPaypageandPaypal
183
+ hash = {
184
+ 'merchantId' => '101',
185
+ 'version'=>'8.8',
186
+ 'reportGroup'=>'Planets',
187
+ 'litleTxnId'=>'123456',
188
+ 'orderId'=>'12344',
189
+ 'amount'=>'106',
190
+ 'orderSource'=>'ecommerce',
191
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
192
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
193
+ 'card'=>{
194
+ 'type'=>'VI',
195
+ 'number' =>'4100000000000002',
196
+ 'expDate' =>'1210'
197
+ },
198
+ 'paypage'=> {
199
+ 'paypageRegistrationId'=>'1234',
200
+ 'expDate'=>'1210',
201
+ 'cardValidationNum'=>'555',
202
+ 'type'=>'VI'},
203
+ 'paypal'=>{
204
+ 'payerId'=>'1234',
205
+ 'token'=>'1234',
206
+ 'transactionId'=>'123456'
207
+ }}
208
+
209
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
210
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
211
+ end
212
+
213
+ def test_allChoicesCardandPaypageandPaypalandToken
214
+ hash = {
215
+ 'merchantId' => '101',
216
+ 'version'=>'8.8',
217
+ 'reportGroup'=>'Planets',
218
+ 'litleTxnId'=>'123456',
219
+ 'orderId'=>'12344',
220
+ 'amount'=>'106',
221
+ 'orderSource'=>'ecommerce',
222
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
223
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
224
+ 'card'=>{
225
+ 'type'=>'VI',
226
+ 'number' =>'4100000000000002',
227
+ 'expDate' =>'1210'
228
+ },
229
+ 'paypage'=> {
230
+ 'paypageRegistrationId'=>'1234',
231
+ 'expDate'=>'1210',
232
+ 'cardValidationNum'=>'555',
233
+ 'type'=>'VI'},
234
+ 'paypal'=>{
235
+ 'payerId'=>'1234',
236
+ 'token'=>'1234',
237
+ 'transactionId'=>'123456'},
238
+ 'token'=> {
239
+ 'litleToken'=>'1234',
240
+ 'expDate'=>'1210',
241
+ 'cardValidationNum'=>'555',
242
+ 'type'=>'VI'
243
+ }}
244
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
245
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
246
+ end
247
+
248
+ end
249
+
@@ -0,0 +1,70 @@
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 TestToken < Test::Unit::TestCase
29
+ def test_accountNumandPaypage
30
+ hash = {
31
+ 'merchantId' => '101',
32
+ 'version'=>'8.8',
33
+ 'reportGroup'=>'Planets',
34
+ 'orderId'=>'12344',
35
+ 'accountNumber'=>'1233456789101112',
36
+ 'paypageRegistrationId'=>'1233456789101112'
37
+ }
38
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.registerTokenRequest(hash)}
39
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
40
+ end
41
+
42
+ def test_echeckandPaypage
43
+ hash = {
44
+ 'merchantId' => '101',
45
+ 'version'=>'8.8',
46
+ 'reportGroup'=>'Planets',
47
+ 'orderId'=>'12344',
48
+ 'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'},
49
+ 'paypageRegistrationId'=>'1233456789101112'
50
+ }
51
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.registerTokenRequest(hash)}
52
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
53
+ end
54
+
55
+ def test_echeckandPaypageandaccountnum
56
+ hash = {
57
+ 'merchantId' => '101',
58
+ 'version'=>'8.8',
59
+ 'reportGroup'=>'Planets',
60
+ 'orderId'=>'12344',
61
+ 'accountNumber'=>'1233456789101112',
62
+ 'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'},
63
+ 'paypageRegistrationId'=>'1233456789101112'
64
+ }
65
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.registerTokenRequest(hash)}
66
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
67
+ end
68
+
69
+ end
70
+