LitleOnline 8.12.3 → 8.12.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +1 -1
- data/lib/Communications.rb +34 -32
- data/lib/Configuration.rb +13 -11
- data/lib/LitleOnline.rb +0 -1
- data/lib/LitleOnlineRequest.rb +546 -543
- data/lib/LitleXmlMapper.rb +17 -15
- data/lib/XMLFields.rb +903 -901
- data/test/certification/certTest1_base.rb +935 -933
- data/test/certification/certTest2_authenhanced.rb +548 -546
- data/test/certification/certTest3_authreversal.rb +179 -177
- data/test/certification/certTest4_echeck.rb +245 -243
- data/test/certification/certTest5_token.rb +198 -196
- data/test/functional/test_auth.rb +205 -204
- data/test/functional/test_authReversal.rb +41 -39
- data/test/functional/test_capture.rb +54 -52
- data/test/functional/test_captureGivenAuth.rb +153 -152
- data/test/functional/test_credit.rb +126 -126
- data/test/functional/test_echeckCredit.rb +88 -87
- data/test/functional/test_echeckRedeposit.rb +85 -84
- data/test/functional/test_echeckSale.rb +132 -131
- data/test/functional/test_echeckVerification.rb +97 -95
- data/test/functional/test_forceCapture.rb +113 -111
- data/test/functional/test_sale.rb +200 -198
- data/test/functional/test_token.rb +75 -73
- data/test/functional/test_xmlfields.rb +558 -558
- data/test/unit/test_LitleOnlineRequest.rb +210 -207
- data/test/unit/test_auth.rb +119 -116
- data/test/unit/test_authReversal.rb +16 -16
- data/test/unit/test_capture.rb +10 -8
- data/test/unit/test_captureGivenAuth.rb +62 -59
- data/test/unit/test_credit.rb +103 -100
- data/test/unit/test_echeckCredit.rb +15 -14
- data/test/unit/test_echeckRedeposit.rb +14 -13
- data/test/unit/test_echeckSale.rb +16 -15
- data/test/unit/test_echeckVerification.rb +14 -13
- data/test/unit/test_forceCapture.rb +61 -58
- data/test/unit/test_sale.rb +206 -205
- data/test/unit/test_token.rb +43 -41
- data/test/unit/test_xmlfields.rb +101 -99
- metadata +58 -77
- data/lib/Obj2xml.rb +0 -37
@@ -27,176 +27,199 @@ require 'lib/LitleOnlineRequest'
|
|
27
27
|
require 'test/unit'
|
28
28
|
require 'mocha'
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
'
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
'
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
'
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
'
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
'
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
'
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
'
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
'
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
'
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
30
|
+
module LitleOnline
|
31
|
+
|
32
|
+
class Newtest < Test::Unit::TestCase
|
33
|
+
def test_set_merchant_id
|
34
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}})
|
35
|
+
litle = LitleOnlineRequest.new
|
36
|
+
assert_equal '2', litle.send(:get_merchant_id, {'merchantId'=>'2'})
|
37
|
+
assert_equal '1', litle.send(:get_merchant_id, {'NotMerchantId'=>'2'})
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_simple
|
41
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
42
|
+
hash = {
|
43
|
+
'reportGroup'=>'Planets',
|
44
|
+
'orderId'=>'12344',
|
45
|
+
'amount'=>'106',
|
46
|
+
'orderSource'=>'ecommerce',
|
47
|
+
'card'=>{
|
48
|
+
'type'=>'VI',
|
49
|
+
'number' =>'4100000000000001',
|
50
|
+
'expDate' =>'1210'
|
51
|
+
}}
|
52
|
+
|
53
|
+
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest .*/m),kind_of(Hash))
|
54
|
+
XMLObject.expects(:new)
|
55
|
+
|
56
|
+
response = LitleOnlineRequest.new.authorization(hash)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_authorization_attributes
|
60
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
61
|
+
hash={
|
62
|
+
'reportGroup'=>'Planets',
|
63
|
+
'id' => '003',
|
64
|
+
'orderId'=>'12344',
|
65
|
+
'amount'=>'106',
|
66
|
+
'orderSource'=>'ecommerce',
|
67
|
+
'card'=>{
|
68
|
+
'type'=>'VI',
|
69
|
+
'number' =>'4100000000000001',
|
70
|
+
'expDate' =>'1210'
|
71
|
+
}}
|
72
|
+
|
73
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authorization ((reportGroup="Planets" id="003")|(id="003" reportGroup="Planets")).*/m),kind_of(Hash))
|
74
|
+
XMLObject.expects(:new)
|
75
|
+
|
76
|
+
response = LitleOnlineRequest.new.authorization(hash)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_authorization_elements
|
80
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
81
|
+
hash={
|
82
|
+
'reportGroup'=>'Planets',
|
83
|
+
'id' => '004',
|
84
|
+
'orderId'=>'12344',
|
85
|
+
'amount'=>'106',
|
86
|
+
'orderSource'=>'ecommerce',
|
87
|
+
'card'=>{
|
88
|
+
'type'=>'VI',
|
89
|
+
'number' =>'4100000000000001',
|
90
|
+
'expDate' =>'1210'
|
91
|
+
}}
|
92
|
+
|
93
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*<orderId>12344.*<amount>106.*<orderSource>ecommerce.*/m),kind_of(Hash))
|
94
|
+
XMLObject.expects(:new)
|
95
|
+
|
96
|
+
response = LitleOnlineRequest.new.authorization(hash)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_authorization_card_field
|
100
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
101
|
+
hash={
|
102
|
+
'reportGroup'=>'Planets',
|
103
|
+
'id' => '005',
|
104
|
+
'orderId'=>'12344',
|
105
|
+
'amount'=>'106',
|
106
|
+
'orderSource'=>'ecommerce',
|
107
|
+
'card'=>{
|
108
|
+
'type'=>'VI',
|
109
|
+
'number' =>'4100000000000001',
|
110
|
+
'expDate' =>'1210'
|
111
|
+
}}
|
112
|
+
|
113
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*<card>.*<number>4100000000000001.*<expDate>1210.*/m),kind_of(Hash))
|
114
|
+
XMLObject.expects(:new)
|
115
|
+
|
116
|
+
response = LitleOnlineRequest.new.authorization(hash)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_sale_card_field
|
120
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
121
|
+
hash={
|
122
|
+
'reportGroup'=>'Planets',
|
123
|
+
'id' => '006',
|
124
|
+
'orderId'=>'12344',
|
125
|
+
'amount'=>'106',
|
126
|
+
'orderSource'=>'ecommerce',
|
127
|
+
'card'=>{
|
128
|
+
'type'=>'VI',
|
129
|
+
'number' =>'4100000000000001',
|
130
|
+
'expDate' =>'1210'
|
131
|
+
}}
|
132
|
+
|
133
|
+
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*<sale.*<card>.*<number>4100000000000001.*<expDate>1210.*/m),kind_of(Hash))
|
134
|
+
XMLObject.expects(:new)
|
135
|
+
|
136
|
+
response = LitleOnlineRequest.new.sale(hash)
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_capture_amount_unset_should_not_be_in_xml
|
140
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
141
|
+
hash={
|
142
|
+
'id' => '006',
|
143
|
+
'reportGroup'=>'Planets',
|
144
|
+
'litleTxnId'=>'123456789012345678',
|
145
|
+
}
|
146
|
+
|
147
|
+
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
148
|
+
XMLObject.expects(:new)
|
149
|
+
|
150
|
+
response = LitleOnlineRequest.new.capture(hash)
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_force_capture_amount_unset_should_not_be_in_xml
|
154
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
155
|
+
hash={
|
156
|
+
'id' => '006',
|
157
|
+
'orderId'=>'12344',
|
158
|
+
'reportGroup'=>'Planets',
|
159
|
+
'orderSource'=>'ecommerce',
|
160
|
+
'litleTxnId'=>'123456789012345678',
|
161
|
+
}
|
162
|
+
|
163
|
+
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
164
|
+
XMLObject.expects(:new)
|
165
|
+
|
166
|
+
response = LitleOnlineRequest.new.force_capture(hash)
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_amount_is_not_required_in_echeck_credit
|
170
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
171
|
+
hash={
|
172
|
+
'id' => '006',
|
173
|
+
'orderId'=>'12344',
|
174
|
+
'reportGroup'=>'Planets',
|
175
|
+
'orderSource'=>'ecommerce',
|
176
|
+
'litleTxnId'=>'123456789012345678',
|
177
|
+
}
|
178
|
+
|
179
|
+
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
180
|
+
XMLObject.expects(:new)
|
181
|
+
|
182
|
+
response = LitleOnlineRequest.new.echeck_credit(hash)
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_amount_is_not_required_in_echeck_sale
|
186
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
187
|
+
hash={
|
188
|
+
'id' => '006',
|
189
|
+
'orderId'=>'12344',
|
190
|
+
'reportGroup'=>'Planets',
|
191
|
+
'orderSource'=>'ecommerce',
|
192
|
+
'litleTxnId'=>'123456789012345678',
|
193
|
+
}
|
194
|
+
|
195
|
+
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
196
|
+
XMLObject.expects(:new)
|
197
|
+
|
198
|
+
response = LitleOnlineRequest.new.echeck_sale(hash)
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_choice_between_card_token
|
202
|
+
start_hash = {
|
203
|
+
'orderId'=>'12344',
|
204
|
+
'merchantId'=>'101',
|
205
|
+
'reportGroup'=>'Planets',
|
206
|
+
'amount'=>'101',
|
207
|
+
'orderSource'=>'ecommerce'
|
208
|
+
}
|
209
|
+
|
210
|
+
card_only = {
|
211
|
+
'card' => {
|
212
|
+
'type' => 'VI',
|
213
|
+
'number' => '1111222233334444'
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
XMLObject.expects(:new)
|
218
|
+
Communications.expects(:http_post).with(regexp_matches(/.*card.*/m),kind_of(Hash))
|
219
|
+
LitleOnlineRequest.new.authorization(start_hash.merge(card_only))
|
220
|
+
end
|
221
|
+
|
222
|
+
def test_choice_between_card_token2
|
200
223
|
start_hash = {
|
201
224
|
'orderId'=>'12344',
|
202
225
|
'merchantId'=>'101',
|
@@ -204,46 +227,26 @@ class Newtest < Test::Unit::TestCase
|
|
204
227
|
'amount'=>'101',
|
205
228
|
'orderSource'=>'ecommerce'
|
206
229
|
}
|
207
|
-
|
208
|
-
|
209
|
-
'
|
210
|
-
'
|
211
|
-
'number' => '1111222233334444'
|
230
|
+
|
231
|
+
token_only = {
|
232
|
+
'token'=> {
|
233
|
+
'litleToken' => '1111222233334444'
|
212
234
|
}
|
213
235
|
}
|
214
|
-
|
236
|
+
|
215
237
|
XMLObject.expects(:new)
|
216
|
-
Communications.expects(:http_post).with(regexp_matches(/.*
|
217
|
-
LitleOnlineRequest.new.authorization(start_hash.merge(
|
238
|
+
Communications.expects(:http_post).with(regexp_matches(/.*token.*/m),kind_of(Hash))
|
239
|
+
LitleOnlineRequest.new.authorization(start_hash.merge(token_only))
|
218
240
|
end
|
219
241
|
|
220
|
-
def
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
}
|
228
|
-
|
229
|
-
token_only = {
|
230
|
-
'token'=> {
|
231
|
-
'litleToken' => '1111222233334444'
|
232
|
-
}
|
233
|
-
}
|
234
|
-
|
235
|
-
XMLObject.expects(:new)
|
236
|
-
Communications.expects(:http_post).with(regexp_matches(/.*token.*/m),kind_of(Hash))
|
237
|
-
LitleOnlineRequest.new.authorization(start_hash.merge(token_only))
|
238
|
-
end
|
239
|
-
|
240
|
-
def test_set_merchant_sdk
|
241
|
-
litle = LitleOnlineRequest.new
|
242
|
-
#Explicit - used for integrations
|
243
|
-
assert_equal 'ActiveMerchant;3.2', litle.send(:get_merchant_sdk, {'merchantSdk'=>'ActiveMerchant;3.2'})
|
244
|
-
#Implicit - used raw when nothing is specified
|
245
|
-
assert_equal 'Ruby;8.12.3', litle.send(:get_merchant_sdk, {'NotMerchantSdk'=>'ActiveMerchant;3.2'})
|
246
|
-
end
|
247
|
-
|
242
|
+
def test_set_merchant_sdk
|
243
|
+
litle = LitleOnlineRequest.new
|
244
|
+
#Explicit - used for integrations
|
245
|
+
assert_equal 'ActiveMerchant;3.2', litle.send(:get_merchant_sdk, {'merchantSdk'=>'ActiveMerchant;3.2'})
|
246
|
+
#Implicit - used raw when nothing is specified
|
247
|
+
assert_equal 'Ruby;8.12.4', litle.send(:get_merchant_sdk, {'NotMerchantSdk'=>'ActiveMerchant;3.2'})
|
248
|
+
end
|
248
249
|
|
249
|
-
|
250
|
+
|
251
|
+
end
|
252
|
+
end
|
data/test/unit/test_auth.rb
CHANGED
@@ -27,123 +27,126 @@ require 'test/unit'
|
|
27
27
|
require 'mocha'
|
28
28
|
|
29
29
|
#test Authorization Transaction
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>123456<\/litleTxnId>.*/m), is_a(Hash))
|
40
|
-
LitleOnlineRequest.new.authorization(hash)
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
def test_both_choices_card_and_paypal
|
45
|
-
hash = {
|
46
|
-
'merchantId' => '101',
|
47
|
-
'version'=>'8.8',
|
48
|
-
'reportGroup'=>'Planets',
|
49
|
-
'orderId'=>'12344',
|
50
|
-
'amount'=>'106',
|
51
|
-
'orderSource'=>'ecommerce',
|
52
|
-
'card'=>{
|
53
|
-
'type'=>'VI',
|
54
|
-
'number' =>'4100000000000001',
|
55
|
-
'expDate' =>'1210'
|
56
|
-
},
|
57
|
-
'paypal'=>{
|
58
|
-
'payerId'=>'1234',
|
59
|
-
'token'=>'1234',
|
60
|
-
'transactionId'=>'123456'
|
61
|
-
}}
|
62
|
-
|
63
|
-
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
64
|
-
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_three_choices_card_and_paypage_and_paypal
|
68
|
-
hash = {
|
69
|
-
'merchantId' => '101',
|
70
|
-
'version'=>'8.8',
|
71
|
-
'reportGroup'=>'Planets',
|
72
|
-
'orderId'=>'12344',
|
73
|
-
'amount'=>'106',
|
74
|
-
'orderSource'=>'ecommerce',
|
75
|
-
'card'=>{
|
76
|
-
'type'=>'VI',
|
77
|
-
'number' =>'4100000000000001',
|
78
|
-
'expDate' =>'1210'
|
79
|
-
},
|
80
|
-
'paypage'=> {
|
81
|
-
'paypageRegistrationId'=>'1234',
|
82
|
-
'expDate'=>'1210',
|
83
|
-
'cardValidationNum'=>'555',
|
84
|
-
'type'=>'VI'},
|
85
|
-
'paypal'=>{
|
86
|
-
'payerId'=>'1234',
|
87
|
-
'token'=>'1234',
|
88
|
-
'transactionId'=>'123456'
|
89
|
-
}}
|
90
|
-
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
91
|
-
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_all_choices_card_and_paypage_and_paypal_and_token
|
95
|
-
hash = {
|
96
|
-
'merchantId' => '101',
|
97
|
-
'version'=>'8.8',
|
98
|
-
'reportGroup'=>'Planets',
|
99
|
-
# 'litleTxnId'=>'123456',
|
100
|
-
'orderId'=>'12344',
|
101
|
-
'amount'=>'106',
|
102
|
-
'orderSource'=>'ecommerce',
|
103
|
-
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
104
|
-
'bypassVelocityCheckcardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
105
|
-
'card'=>{
|
106
|
-
'type'=>'VI',
|
107
|
-
'number' =>'4100000000000001',
|
108
|
-
'expDate' =>'1210'
|
109
|
-
},
|
110
|
-
'paypage'=> {
|
111
|
-
'paypageRegistrationId'=>'1234',
|
112
|
-
'expDate'=>'1210',
|
113
|
-
'cardValidationNum'=>'555',
|
114
|
-
'type'=>'VI'},
|
115
|
-
'paypal'=>{
|
116
|
-
'payerId'=>'1234',
|
117
|
-
'token'=>'1234',
|
118
|
-
'transactionId'=>'123456'},
|
119
|
-
'token'=> {
|
120
|
-
'litleToken'=>'1234',
|
121
|
-
'expDate'=>'1210',
|
122
|
-
'cardValidationNum'=>'555',
|
123
|
-
'type'=>'VI'
|
124
|
-
}}
|
125
|
-
|
126
|
-
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
127
|
-
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
128
|
-
end
|
129
|
-
|
130
|
-
def test_merchant_data_auth
|
131
|
-
hash = {
|
132
|
-
'merchantId' => '101',
|
133
|
-
'version'=>'8.12',
|
134
|
-
'orderId'=>'1',
|
135
|
-
'amount'=>'0',
|
136
|
-
'orderSource'=>'ecommerce',
|
137
|
-
'reportGroup'=>'Planets',
|
138
|
-
'merchantData'=> {
|
139
|
-
'campaign'=>'foo'
|
30
|
+
module LitleOnline
|
31
|
+
|
32
|
+
class TestAuth < Test::Unit::TestCase
|
33
|
+
def test_success_re_auth
|
34
|
+
hash = {
|
35
|
+
'merchantId' => '101',
|
36
|
+
'version'=>'8.8',
|
37
|
+
'reportGroup'=>'Planets',
|
38
|
+
'litleTxnId'=>'123456'
|
140
39
|
}
|
141
|
-
}
|
142
40
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
41
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>123456<\/litleTxnId>.*/m), is_a(Hash))
|
42
|
+
LitleOnlineRequest.new.authorization(hash)
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
def test_both_choices_card_and_paypal
|
47
|
+
hash = {
|
48
|
+
'merchantId' => '101',
|
49
|
+
'version'=>'8.8',
|
50
|
+
'reportGroup'=>'Planets',
|
51
|
+
'orderId'=>'12344',
|
52
|
+
'amount'=>'106',
|
53
|
+
'orderSource'=>'ecommerce',
|
54
|
+
'card'=>{
|
55
|
+
'type'=>'VI',
|
56
|
+
'number' =>'4100000000000001',
|
57
|
+
'expDate' =>'1210'
|
58
|
+
},
|
59
|
+
'paypal'=>{
|
60
|
+
'payerId'=>'1234',
|
61
|
+
'token'=>'1234',
|
62
|
+
'transactionId'=>'123456'
|
63
|
+
}}
|
64
|
+
|
65
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
66
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
67
|
+
end
|
147
68
|
|
148
|
-
|
69
|
+
def test_three_choices_card_and_paypage_and_paypal
|
70
|
+
hash = {
|
71
|
+
'merchantId' => '101',
|
72
|
+
'version'=>'8.8',
|
73
|
+
'reportGroup'=>'Planets',
|
74
|
+
'orderId'=>'12344',
|
75
|
+
'amount'=>'106',
|
76
|
+
'orderSource'=>'ecommerce',
|
77
|
+
'card'=>{
|
78
|
+
'type'=>'VI',
|
79
|
+
'number' =>'4100000000000001',
|
80
|
+
'expDate' =>'1210'
|
81
|
+
},
|
82
|
+
'paypage'=> {
|
83
|
+
'paypageRegistrationId'=>'1234',
|
84
|
+
'expDate'=>'1210',
|
85
|
+
'cardValidationNum'=>'555',
|
86
|
+
'type'=>'VI'},
|
87
|
+
'paypal'=>{
|
88
|
+
'payerId'=>'1234',
|
89
|
+
'token'=>'1234',
|
90
|
+
'transactionId'=>'123456'
|
91
|
+
}}
|
92
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
93
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_all_choices_card_and_paypage_and_paypal_and_token
|
97
|
+
hash = {
|
98
|
+
'merchantId' => '101',
|
99
|
+
'version'=>'8.8',
|
100
|
+
'reportGroup'=>'Planets',
|
101
|
+
# 'litleTxnId'=>'123456',
|
102
|
+
'orderId'=>'12344',
|
103
|
+
'amount'=>'106',
|
104
|
+
'orderSource'=>'ecommerce',
|
105
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
106
|
+
'bypassVelocityCheckcardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
107
|
+
'card'=>{
|
108
|
+
'type'=>'VI',
|
109
|
+
'number' =>'4100000000000001',
|
110
|
+
'expDate' =>'1210'
|
111
|
+
},
|
112
|
+
'paypage'=> {
|
113
|
+
'paypageRegistrationId'=>'1234',
|
114
|
+
'expDate'=>'1210',
|
115
|
+
'cardValidationNum'=>'555',
|
116
|
+
'type'=>'VI'},
|
117
|
+
'paypal'=>{
|
118
|
+
'payerId'=>'1234',
|
119
|
+
'token'=>'1234',
|
120
|
+
'transactionId'=>'123456'},
|
121
|
+
'token'=> {
|
122
|
+
'litleToken'=>'1234',
|
123
|
+
'expDate'=>'1210',
|
124
|
+
'cardValidationNum'=>'555',
|
125
|
+
'type'=>'VI'
|
126
|
+
}}
|
127
|
+
|
128
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(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_merchant_data_auth
|
133
|
+
hash = {
|
134
|
+
'merchantId' => '101',
|
135
|
+
'version'=>'8.12',
|
136
|
+
'orderId'=>'1',
|
137
|
+
'amount'=>'0',
|
138
|
+
'orderSource'=>'ecommerce',
|
139
|
+
'reportGroup'=>'Planets',
|
140
|
+
'merchantData'=> {
|
141
|
+
'campaign'=>'foo'
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
XMLObject.expects(:new)
|
146
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<merchantData>.*?<campaign>foo<\/campaign>.*?<\/merchantData>.*/m),kind_of(Hash))
|
147
|
+
LitleOnlineRequest.new.authorization(hash)
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
149
151
|
|
152
|
+
end
|