LitleOnline 8.12.3 → 8.12.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG +4 -0
  2. data/Rakefile +1 -1
  3. data/lib/Communications.rb +34 -32
  4. data/lib/Configuration.rb +13 -11
  5. data/lib/LitleOnline.rb +0 -1
  6. data/lib/LitleOnlineRequest.rb +546 -543
  7. data/lib/LitleXmlMapper.rb +17 -15
  8. data/lib/XMLFields.rb +903 -901
  9. data/test/certification/certTest1_base.rb +935 -933
  10. data/test/certification/certTest2_authenhanced.rb +548 -546
  11. data/test/certification/certTest3_authreversal.rb +179 -177
  12. data/test/certification/certTest4_echeck.rb +245 -243
  13. data/test/certification/certTest5_token.rb +198 -196
  14. data/test/functional/test_auth.rb +205 -204
  15. data/test/functional/test_authReversal.rb +41 -39
  16. data/test/functional/test_capture.rb +54 -52
  17. data/test/functional/test_captureGivenAuth.rb +153 -152
  18. data/test/functional/test_credit.rb +126 -126
  19. data/test/functional/test_echeckCredit.rb +88 -87
  20. data/test/functional/test_echeckRedeposit.rb +85 -84
  21. data/test/functional/test_echeckSale.rb +132 -131
  22. data/test/functional/test_echeckVerification.rb +97 -95
  23. data/test/functional/test_forceCapture.rb +113 -111
  24. data/test/functional/test_sale.rb +200 -198
  25. data/test/functional/test_token.rb +75 -73
  26. data/test/functional/test_xmlfields.rb +558 -558
  27. data/test/unit/test_LitleOnlineRequest.rb +210 -207
  28. data/test/unit/test_auth.rb +119 -116
  29. data/test/unit/test_authReversal.rb +16 -16
  30. data/test/unit/test_capture.rb +10 -8
  31. data/test/unit/test_captureGivenAuth.rb +62 -59
  32. data/test/unit/test_credit.rb +103 -100
  33. data/test/unit/test_echeckCredit.rb +15 -14
  34. data/test/unit/test_echeckRedeposit.rb +14 -13
  35. data/test/unit/test_echeckSale.rb +16 -15
  36. data/test/unit/test_echeckVerification.rb +14 -13
  37. data/test/unit/test_forceCapture.rb +61 -58
  38. data/test/unit/test_sale.rb +206 -205
  39. data/test/unit/test_token.rb +43 -41
  40. data/test/unit/test_xmlfields.rb +101 -99
  41. metadata +58 -77
  42. data/lib/Obj2xml.rb +0 -37
@@ -25,20 +25,21 @@ OTHER DEALINGS IN THE SOFTWARE.
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
- class Test_echeckSale < Test::Unit::TestCase
29
-
30
- def test_echeck_sale_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_sale(hash)}
40
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
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
+
41
44
  end
42
-
43
45
  end
44
-
@@ -25,18 +25,19 @@ OTHER DEALINGS IN THE SOFTWARE.
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
- class Test_echeckVerification < Test::Unit::TestCase
29
- def test_echeck_verification_with_both
30
- hash = {
31
- 'merchantId' => '101',
32
- 'version'=>'8.8',
33
- 'reportGroup'=>'Planets',
34
- 'litleTxnId'=>'123456',
35
- 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
36
- 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
37
- }
38
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
39
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
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
40
42
  end
41
43
  end
42
-
@@ -25,63 +25,66 @@ OTHER DEALINGS IN THE SOFTWARE.
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
- class TestForceCapture < Test::Unit::TestCase
29
- def test_both_choices_card_and_token
30
- hash = {
31
- 'merchantId' => '101',
32
- 'version'=>'8.8',
33
- 'reportGroup'=>'Planets',
34
- 'litleTxnId'=>'123456',
35
- 'orderId'=>'12344',
36
- 'amount'=>'106',
37
- 'orderSource'=>'ecommerce',
38
- 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
39
- 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
40
- 'card'=>{
41
- 'type'=>'VI',
42
- 'number' =>'4100000000000001',
43
- 'expDate' =>'1210'
44
- },
45
- 'token'=> {
46
- 'litleToken'=>'1234',
47
- 'expDate'=>'1210',
48
- 'cardValidationNum'=>'555',
49
- 'type'=>'VI'
50
- }}
51
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
52
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
28
+ module LitleOnline
29
+
30
+ class TestForceCapture < Test::Unit::TestCase
31
+ def test_both_choices_card_and_token
32
+ hash = {
33
+ 'merchantId' => '101',
34
+ 'version'=>'8.8',
35
+ 'reportGroup'=>'Planets',
36
+ 'litleTxnId'=>'123456',
37
+ 'orderId'=>'12344',
38
+ 'amount'=>'106',
39
+ 'orderSource'=>'ecommerce',
40
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
41
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
42
+ 'card'=>{
43
+ 'type'=>'VI',
44
+ 'number' =>'4100000000000001',
45
+ 'expDate' =>'1210'
46
+ },
47
+ 'token'=> {
48
+ 'litleToken'=>'1234',
49
+ 'expDate'=>'1210',
50
+ 'cardValidationNum'=>'555',
51
+ 'type'=>'VI'
52
+ }}
53
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
54
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
55
+ end
56
+
57
+ def test_all_choices
58
+ hash = {
59
+ 'merchantId' => '101',
60
+ 'version'=>'8.8',
61
+ 'reportGroup'=>'Planets',
62
+ 'litleTxnId'=>'123456',
63
+ 'orderId'=>'12344',
64
+ 'amount'=>'106',
65
+ 'orderSource'=>'ecommerce',
66
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
67
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
68
+ 'card'=>{
69
+ 'type'=>'VI',
70
+ 'number' =>'4100000000000001',
71
+ 'expDate' =>'1210'
72
+ },
73
+ 'paypage'=> {
74
+ 'paypageRegistrationId'=>'1234',
75
+ 'expDate'=>'1210',
76
+ 'cardValidationNum'=>'555',
77
+ 'type'=>'VI'},
78
+ 'token'=> {
79
+ 'litleToken'=>'1234',
80
+ 'expDate'=>'1210',
81
+ 'cardValidationNum'=>'555',
82
+ 'type'=>'VI'
83
+ }}
84
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
85
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
86
+ end
87
+
53
88
  end
54
89
 
55
- def test_all_choices
56
- hash = {
57
- 'merchantId' => '101',
58
- 'version'=>'8.8',
59
- 'reportGroup'=>'Planets',
60
- 'litleTxnId'=>'123456',
61
- 'orderId'=>'12344',
62
- 'amount'=>'106',
63
- 'orderSource'=>'ecommerce',
64
- 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
65
- 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
66
- 'card'=>{
67
- 'type'=>'VI',
68
- 'number' =>'4100000000000001',
69
- 'expDate' =>'1210'
70
- },
71
- 'paypage'=> {
72
- 'paypageRegistrationId'=>'1234',
73
- 'expDate'=>'1210',
74
- 'cardValidationNum'=>'555',
75
- 'type'=>'VI'},
76
- 'token'=> {
77
- 'litleToken'=>'1234',
78
- 'expDate'=>'1210',
79
- 'cardValidationNum'=>'555',
80
- 'type'=>'VI'
81
- }}
82
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
83
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
84
- end
85
-
86
- end
87
-
90
+ end
@@ -26,211 +26,212 @@ require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
  require 'mocha'
28
28
 
29
- class TestSale < Test::Unit::TestCase
30
-
31
- def test_both_choices_fraud_check_and_card_holder
32
- hash = {
33
- 'merchantId' => '101',
34
- 'version'=>'8.8',
35
- 'reportGroup'=>'Planets',
36
- 'litleTxnId'=>'123456',
37
- 'orderId'=>'12344',
38
- 'amount'=>'106',
39
- 'orderSource'=>'ecommerce',
40
- 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
41
- 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
42
- 'card'=>{
43
- 'type'=>'VI',
44
- 'number' =>'4100000000000002',
45
- 'expDate' =>'1210'
46
- }}
47
-
48
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
49
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
50
- end
51
-
52
- def test_both_choices_card_and_paypal
53
- hash = {
54
- 'merchantId' => '101',
55
- 'version'=>'8.8',
56
- 'reportGroup'=>'Planets',
57
- 'litleTxnId'=>'123456',
58
- 'orderId'=>'12344',
59
- 'amount'=>'106',
60
- 'orderSource'=>'ecommerce',
61
- 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
62
- 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
63
- 'card'=>{
64
- 'type'=>'VI',
65
- 'number' =>'4100000000000002',
66
- 'expDate' =>'1210'
67
- },
68
- 'paypal'=>{
69
- 'payerId'=>'1234',
70
- 'token'=>'1234',
71
- 'transactionId'=>'123456'
72
- }}
73
-
74
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
75
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
76
- end
77
-
78
- def test_both_choices_card_and_token
79
- hash = {
80
- 'merchantId' => '101',
81
- 'version'=>'8.8',
82
- 'reportGroup'=>'Planets',
83
- 'litleTxnId'=>'123456',
84
- 'orderId'=>'12344',
85
- 'amount'=>'106',
86
- 'orderSource'=>'ecommerce',
87
- 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
88
- 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
89
- 'card'=>{
90
- 'type'=>'VI',
91
- 'number' =>'4100000000000002',
92
- 'expDate' =>'1210'
93
- },
94
- 'token'=> {
95
- 'litleToken'=>'1234',
96
- 'expDate'=>'1210',
97
- 'cardValidationNum'=>'555',
98
- 'type'=>'VI'
99
- }}
100
-
101
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
102
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
103
- end
104
-
105
- def test_both_choices_card_and_paypage
106
- hash = {
107
- 'merchantId' => '101',
108
- 'version'=>'8.8',
109
- 'reportGroup'=>'Planets',
110
- 'litleTxnId'=>'123456',
111
- 'orderId'=>'12344',
112
- 'amount'=>'106',
113
- 'orderSource'=>'ecommerce',
114
- 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
115
- 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
116
- 'card'=>{
117
- 'type'=>'VI',
118
- 'number' =>'4100000000000002',
119
- 'expDate' =>'1210'
120
- },
121
- 'paypage'=> {
122
- 'paypageRegistrationId'=>'1234',
123
- 'expDate'=>'1210',
124
- 'cardValidationNum'=>'555',
125
- 'type'=>'VI'
126
- }}
127
-
128
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
129
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
130
- end
131
-
132
- def test_three_choices_card_and_paypage_and_paypal
133
- hash = {
134
- 'merchantId' => '101',
135
- 'version'=>'8.8',
136
- 'reportGroup'=>'Planets',
137
- 'litleTxnId'=>'123456',
138
- 'orderId'=>'12344',
139
- 'amount'=>'106',
140
- 'orderSource'=>'ecommerce',
141
- 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
142
- 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
143
- 'card'=>{
144
- 'type'=>'VI',
145
- 'number' =>'4100000000000002',
146
- 'expDate' =>'1210'
147
- },
148
- 'paypage'=> {
149
- 'paypageRegistrationId'=>'1234',
150
- 'expDate'=>'1210',
151
- 'cardValidationNum'=>'555',
152
- 'type'=>'VI'},
153
- 'paypal'=>{
154
- 'payerId'=>'1234',
155
- 'token'=>'1234',
156
- 'transactionId'=>'123456'
157
- }}
158
-
159
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
160
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
161
- end
162
-
163
- def test_all_choices_card_and_paypage_and_paypal_and_token
164
- hash = {
165
- 'merchantId' => '101',
166
- 'version'=>'8.8',
167
- 'reportGroup'=>'Planets',
168
- 'litleTxnId'=>'123456',
169
- 'orderId'=>'12344',
170
- 'amount'=>'106',
171
- 'orderSource'=>'ecommerce',
172
- 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
173
- 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
174
- 'card'=>{
175
- 'type'=>'VI',
176
- 'number' =>'4100000000000002',
177
- 'expDate' =>'1210'
178
- },
179
- 'paypage'=> {
180
- 'paypageRegistrationId'=>'1234',
181
- 'expDate'=>'1210',
182
- 'cardValidationNum'=>'555',
183
- 'type'=>'VI'},
184
- 'paypal'=>{
185
- 'payerId'=>'1234',
186
- 'token'=>'1234',
187
- 'transactionId'=>'123456'},
188
- 'token'=> {
189
- 'litleToken'=>'1234',
190
- 'expDate'=>'1210',
191
- 'cardValidationNum'=>'555',
192
- 'type'=>'VI'
193
- }}
194
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
195
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
196
- end
197
-
198
- def test_merchant_data_sale
199
- hash = {
200
- 'merchantId' => '101',
201
- 'version'=>'8.12',
202
- 'orderId'=>'1',
203
- 'amount'=>'0',
204
- 'orderSource'=>'ecommerce',
205
- 'reportGroup'=>'Planets',
206
- 'merchantData'=> {
207
- 'affiliate'=>'bar'
29
+ module LitleOnline
30
+ class TestSale < Test::Unit::TestCase
31
+
32
+ def test_both_choices_fraud_check_and_card_holder
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' =>'4100000000000002',
46
+ 'expDate' =>'1210'
47
+ }}
48
+
49
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
50
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
51
+ end
52
+
53
+ def test_both_choices_card_and_paypal
54
+ hash = {
55
+ 'merchantId' => '101',
56
+ 'version'=>'8.8',
57
+ 'reportGroup'=>'Planets',
58
+ 'litleTxnId'=>'123456',
59
+ 'orderId'=>'12344',
60
+ 'amount'=>'106',
61
+ 'orderSource'=>'ecommerce',
62
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
63
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
64
+ 'card'=>{
65
+ 'type'=>'VI',
66
+ 'number' =>'4100000000000002',
67
+ 'expDate' =>'1210'
68
+ },
69
+ 'paypal'=>{
70
+ 'payerId'=>'1234',
71
+ 'token'=>'1234',
72
+ 'transactionId'=>'123456'
73
+ }}
74
+
75
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
76
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
77
+ end
78
+
79
+ def test_both_choices_card_and_token
80
+ hash = {
81
+ 'merchantId' => '101',
82
+ 'version'=>'8.8',
83
+ 'reportGroup'=>'Planets',
84
+ 'litleTxnId'=>'123456',
85
+ 'orderId'=>'12344',
86
+ 'amount'=>'106',
87
+ 'orderSource'=>'ecommerce',
88
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
89
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
90
+ 'card'=>{
91
+ 'type'=>'VI',
92
+ 'number' =>'4100000000000002',
93
+ 'expDate' =>'1210'
94
+ },
95
+ 'token'=> {
96
+ 'litleToken'=>'1234',
97
+ 'expDate'=>'1210',
98
+ 'cardValidationNum'=>'555',
99
+ 'type'=>'VI'
100
+ }}
101
+
102
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
103
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
104
+ end
105
+
106
+ def test_both_choices_card_and_paypage
107
+ hash = {
108
+ 'merchantId' => '101',
109
+ 'version'=>'8.8',
110
+ 'reportGroup'=>'Planets',
111
+ 'litleTxnId'=>'123456',
112
+ 'orderId'=>'12344',
113
+ 'amount'=>'106',
114
+ 'orderSource'=>'ecommerce',
115
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
116
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
117
+ 'card'=>{
118
+ 'type'=>'VI',
119
+ 'number' =>'4100000000000002',
120
+ 'expDate' =>'1210'
121
+ },
122
+ 'paypage'=> {
123
+ 'paypageRegistrationId'=>'1234',
124
+ 'expDate'=>'1210',
125
+ 'cardValidationNum'=>'555',
126
+ 'type'=>'VI'
127
+ }}
128
+
129
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
130
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
131
+ end
132
+
133
+ def test_three_choices_card_and_paypage_and_paypal
134
+ hash = {
135
+ 'merchantId' => '101',
136
+ 'version'=>'8.8',
137
+ 'reportGroup'=>'Planets',
138
+ 'litleTxnId'=>'123456',
139
+ 'orderId'=>'12344',
140
+ 'amount'=>'106',
141
+ 'orderSource'=>'ecommerce',
142
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
143
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
144
+ 'card'=>{
145
+ 'type'=>'VI',
146
+ 'number' =>'4100000000000002',
147
+ 'expDate' =>'1210'
148
+ },
149
+ 'paypage'=> {
150
+ 'paypageRegistrationId'=>'1234',
151
+ 'expDate'=>'1210',
152
+ 'cardValidationNum'=>'555',
153
+ 'type'=>'VI'},
154
+ 'paypal'=>{
155
+ 'payerId'=>'1234',
156
+ 'token'=>'1234',
157
+ 'transactionId'=>'123456'
158
+ }}
159
+
160
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
161
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
162
+ end
163
+
164
+ def test_all_choices_card_and_paypage_and_paypal_and_token
165
+ hash = {
166
+ 'merchantId' => '101',
167
+ 'version'=>'8.8',
168
+ 'reportGroup'=>'Planets',
169
+ 'litleTxnId'=>'123456',
170
+ 'orderId'=>'12344',
171
+ 'amount'=>'106',
172
+ 'orderSource'=>'ecommerce',
173
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
174
+ 'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
175
+ 'card'=>{
176
+ 'type'=>'VI',
177
+ 'number' =>'4100000000000002',
178
+ 'expDate' =>'1210'
179
+ },
180
+ 'paypage'=> {
181
+ 'paypageRegistrationId'=>'1234',
182
+ 'expDate'=>'1210',
183
+ 'cardValidationNum'=>'555',
184
+ 'type'=>'VI'},
185
+ 'paypal'=>{
186
+ 'payerId'=>'1234',
187
+ 'token'=>'1234',
188
+ 'transactionId'=>'123456'},
189
+ 'token'=> {
190
+ 'litleToken'=>'1234',
191
+ 'expDate'=>'1210',
192
+ 'cardValidationNum'=>'555',
193
+ 'type'=>'VI'
194
+ }}
195
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
196
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
197
+ end
198
+
199
+ def test_merchant_data_sale
200
+ hash = {
201
+ 'merchantId' => '101',
202
+ 'version'=>'8.12',
203
+ 'orderId'=>'1',
204
+ 'amount'=>'0',
205
+ 'orderSource'=>'ecommerce',
206
+ 'reportGroup'=>'Planets',
207
+ 'merchantData'=> {
208
+ 'affiliate'=>'bar'
209
+ }
208
210
  }
209
- }
211
+
212
+ XMLObject.expects(:new)
213
+ Communications.expects(:http_post).with(regexp_matches(/.*<merchantData>.*?<affiliate>bar<\/affiliate>.*?<\/merchantData>.*/m),kind_of(Hash))
214
+ LitleOnlineRequest.new.sale(hash)
215
+ end
210
216
 
211
- XMLObject.expects(:new)
212
- Communications.expects(:http_post).with(regexp_matches(/.*<merchantData>.*?<affiliate>bar<\/affiliate>.*?<\/merchantData>.*/m),kind_of(Hash))
213
- LitleOnlineRequest.new.sale(hash)
214
- end
215
-
216
- def test_invalid_embedded_field_values
217
- #becasue there are sub fields under fraud check that are not specified
218
- hash = {
219
- 'merchantId' => '101',
220
- 'version'=>'8.8',
221
- 'reportGroup'=>'Planets',
222
- 'litleTxnId'=>'123456',
223
- 'orderId'=>'12344',
224
- 'amount'=>'106',
225
- 'orderSource'=>'ecommerce',
226
- 'fraudCheck'=>'one',
227
- 'cardholderAuthentication'=>'two',
228
- 'card'=>{
229
- 'type'=>'VI',
230
- 'number' =>'4100000000000000',
231
- }}
232
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
233
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
217
+ def test_invalid_embedded_field_values
218
+ #becasue there are sub fields under fraud check that are not specified
219
+ hash = {
220
+ 'merchantId' => '101',
221
+ 'version'=>'8.8',
222
+ 'reportGroup'=>'Planets',
223
+ 'litleTxnId'=>'123456',
224
+ 'orderId'=>'12344',
225
+ 'amount'=>'106',
226
+ 'orderSource'=>'ecommerce',
227
+ 'fraudCheck'=>'one',
228
+ 'cardholderAuthentication'=>'two',
229
+ 'card'=>{
230
+ 'type'=>'VI',
231
+ 'number' =>'4100000000000000',
232
+ }}
233
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
234
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
235
+ end
234
236
  end
235
- end
236
-
237
+ end