CnpOnline 8.31.1 → 9.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +29 -12
- data/DESCRIPTION +2 -2
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/Rakefile +4 -4
- data/Rakefile~ +5 -5
- data/SETUP.md +3 -3
- data/bin/Setup.rb +9 -8
- data/bin/sample_batch_driver.rb +1 -1
- data/bin/sample_driver.rb +1 -1
- data/lib/Communications.rb +1 -1
- data/lib/Configuration.rb +16 -16
- data/lib/EnvironmentVariables.rb +1 -2
- data/lib/LitleBatchRequest.rb +283 -147
- data/lib/LitleListeners.rb +132 -33
- data/lib/LitleOnline.rb +5 -4
- data/lib/LitleOnlineRequest.rb +69 -59
- data/lib/LitleRequest.rb +178 -141
- data/lib/LitleTransaction.rb +279 -122
- data/lib/LitleXmlMapper.rb +9 -4
- data/lib/XMLFields.rb +345 -26
- data/test/certification/certTest1_base.rb +74 -73
- data/test/certification/certTest2_authenhanced.rb +1 -1
- data/test/certification/certTest3_authreversal.rb +1 -1
- data/test/certification/certTest4_echeck.rb +4 -1
- data/test/certification/certTest5_token.rb +4 -4
- data/test/certification/certTest_batchAll.rb +296 -55
- data/test/certification/ts_all.rb +1 -1
- data/test/functional/test_activate.rb +7 -3
- data/test/functional/test_activateReversal.rb +7 -3
- data/test/functional/test_auth.rb +119 -16
- data/test/functional/test_authReversal.rb +5 -3
- data/test/functional/test_balanceInquiry.rb +5 -3
- data/test/functional/test_batch.rb +3 -3
- data/test/functional/test_batchStream.rb +14 -4
- data/test/functional/test_cancelSubscription.rb +5 -3
- data/test/functional/test_capture.rb +34 -3
- data/test/functional/test_captureGivenAuth.rb +55 -4
- data/test/functional/test_configuration.rb +2 -2
- data/test/functional/test_createPlan.rb +5 -3
- data/test/functional/test_credit.rb +45 -16
- data/test/functional/test_deactivate.rb +5 -3
- data/test/functional/test_deactivateReversal.rb +5 -3
- data/test/functional/test_depositReversal.rb +5 -3
- data/test/functional/test_echeckCredit.rb +26 -9
- data/test/functional/test_echeckRedeposit.rb +5 -3
- data/test/functional/test_echeckSale.rb +49 -28
- data/test/functional/test_echeckVerification.rb +20 -12
- data/test/functional/test_echeckVoid.rb +1 -1
- data/test/functional/test_forceCapture.rb +44 -22
- data/test/functional/test_fraudCheck.rb +77 -0
- data/test/functional/test_litle_requests.rb +24 -24
- data/test/functional/test_load.rb +5 -3
- data/test/functional/test_loadReversal.rb +5 -3
- data/test/functional/test_refundReversal.rb +5 -3
- data/test/functional/test_sale.rb +214 -29
- data/test/functional/test_token.rb +19 -3
- data/test/functional/test_unload.rb +5 -3
- data/test/functional/test_unloadReversal.rb +6 -4
- data/test/functional/test_updateCardValidationNumOnToken.rb +1 -1
- data/test/functional/test_updatePlan.rb +5 -3
- data/test/functional/test_updateSubscription.rb +5 -3
- data/test/functional/test_utf8.rb +44 -0
- data/test/functional/test_xmlfields.rb +10 -6
- data/test/functional/ts_all.rb +2 -1
- data/test/unit/test_LitleAUBatch.rb +29 -1
- data/test/unit/test_LitleBatchRequest.rb +247 -113
- data/test/unit/test_LitleOnlineRequest.rb +37 -54
- data/test/unit/test_LitleRequest.rb +3 -3
- data/test/unit/test_LitleTransaction.rb +5 -5
- data/test/unit/test_LitleXmlMapper.rb +136 -0
- data/test/unit/test_activate.rb +1 -21
- data/test/unit/test_activateReversal.rb +1 -1
- data/test/unit/test_auth.rb +54 -14
- data/test/unit/test_authReversal.rb +1 -1
- data/test/unit/test_balanceInquiry.rb +1 -1
- data/test/unit/test_cancelSubscription.rb +1 -1
- data/test/unit/test_capture.rb +27 -1
- data/test/unit/test_captureGivenAuth.rb +44 -18
- data/test/unit/test_createPlan.rb +1 -1
- data/test/unit/test_credit.rb +16 -3
- data/test/unit/test_deactivate.rb +1 -1
- data/test/unit/test_deactivateReversal.rb +1 -1
- data/test/unit/test_depositReversal.rb +1 -1
- data/test/unit/test_echeckCredit.rb +15 -2
- data/test/unit/test_echeckRedeposit.rb +1 -1
- data/test/unit/test_echeckSale.rb +18 -1
- data/test/unit/test_echeckVerification.rb +1 -1
- data/test/unit/test_echeckVoid.rb +1 -1
- data/test/unit/test_forceCapture.rb +20 -2
- data/test/unit/test_fraudCheck.rb +45 -0
- data/test/unit/test_load.rb +1 -1
- data/test/unit/test_loadReversal.rb +1 -1
- data/test/unit/test_refundReversal.rb +1 -1
- data/test/unit/test_sale.rb +73 -7
- data/test/unit/test_token.rb +15 -4
- data/test/unit/test_unload.rb +1 -1
- data/test/unit/test_unloadReversal.rb +1 -1
- data/test/unit/test_updateCardValidationNumOnToken.rb +1 -1
- data/test/unit/test_updatePlan.rb +1 -1
- data/test/unit/test_updateSubscription.rb +1 -1
- data/test/unit/test_xmlfields.rb +1 -1
- data/test/unit/ts_unit.rb +2 -1
- metadata +10 -7
- data/CHANGELOG~ +0 -142
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person
|
5
5
|
obtaining a copy of this software and associated documentation
|
@@ -49,9 +49,7 @@ module LitleOnline
|
|
49
49
|
'expDate' =>'1210'
|
50
50
|
}}
|
51
51
|
|
52
|
-
|
53
|
-
XMLObject.expects(:new)
|
54
|
-
|
52
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest .*/m), is_a(Hash))
|
55
53
|
response = LitleOnlineRequest.new.authorization(hash)
|
56
54
|
end
|
57
55
|
|
@@ -69,9 +67,7 @@ module LitleOnline
|
|
69
67
|
'expDate' =>'1210'
|
70
68
|
}}
|
71
69
|
|
72
|
-
|
73
|
-
XMLObject.expects(:new)
|
74
|
-
|
70
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<authorization ((reportGroup="Planets" id="003")|(id="003" reportGroup="Planets")).*/m), is_a(Hash))
|
75
71
|
response = LitleOnlineRequest.new.authorization(hash)
|
76
72
|
end
|
77
73
|
|
@@ -88,10 +84,7 @@ module LitleOnline
|
|
88
84
|
'number' =>'4100000000000001',
|
89
85
|
'expDate' =>'1210'
|
90
86
|
}}
|
91
|
-
|
92
|
-
Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*<orderId>12344.*<amount>106.*<orderSource>ecommerce.*/m),kind_of(Hash))
|
93
|
-
XMLObject.expects(:new)
|
94
|
-
|
87
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<authorization.*<orderId>12344.*<amount>106.*<orderSource>ecommerce.*/m), is_a(Hash))
|
95
88
|
response = LitleOnlineRequest.new.authorization(hash)
|
96
89
|
end
|
97
90
|
|
@@ -109,9 +102,9 @@ module LitleOnline
|
|
109
102
|
'expDate' =>'1210'
|
110
103
|
}}
|
111
104
|
|
112
|
-
Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*<card>.*<number>4100000000000001.*<expDate>1210.*/m),kind_of(Hash))
|
113
|
-
XMLObject.expects(:new)
|
114
|
-
|
105
|
+
#Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*<card>.*<number>4100000000000001.*<expDate>1210.*/m),kind_of(Hash))
|
106
|
+
#XMLObject.expects(:new)
|
107
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<authorization.*<card>.*<number>4100000000000001.*<expDate>1210.*/m), is_a(Hash))
|
115
108
|
response = LitleOnlineRequest.new.authorization(hash)
|
116
109
|
end
|
117
110
|
|
@@ -129,9 +122,9 @@ module LitleOnline
|
|
129
122
|
'expDate' =>'1210'
|
130
123
|
}}
|
131
124
|
|
132
|
-
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*<sale.*<card>.*<number>4100000000000001.*<expDate>1210.*/m),kind_of(Hash))
|
133
|
-
XMLObject.expects(:new)
|
134
|
-
|
125
|
+
#Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*<sale.*<card>.*<number>4100000000000001.*<expDate>1210.*/m),kind_of(Hash))
|
126
|
+
#XMLObject.expects(:new)
|
127
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest.*<sale.*<card>.*<number>4100000000000001.*<expDate>1210.*/m), is_a(Hash))
|
135
128
|
response = LitleOnlineRequest.new.sale(hash)
|
136
129
|
end
|
137
130
|
|
@@ -143,9 +136,9 @@ module LitleOnline
|
|
143
136
|
'litleTxnId'=>'123456789012345678'
|
144
137
|
}
|
145
138
|
|
146
|
-
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
147
|
-
XMLObject.expects(:new)
|
148
|
-
|
139
|
+
#Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
140
|
+
#XMLObject.expects(:new)
|
141
|
+
LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
|
149
142
|
response = LitleOnlineRequest.new.capture(hash)
|
150
143
|
end
|
151
144
|
|
@@ -159,9 +152,9 @@ module LitleOnline
|
|
159
152
|
'litleTxnId'=>'123456789012345678'
|
160
153
|
}
|
161
154
|
|
162
|
-
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
163
|
-
XMLObject.expects(:new)
|
164
|
-
|
155
|
+
#Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
156
|
+
#XMLObject.expects(:new)
|
157
|
+
LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
|
165
158
|
response = LitleOnlineRequest.new.force_capture(hash)
|
166
159
|
end
|
167
160
|
|
@@ -175,9 +168,9 @@ module LitleOnline
|
|
175
168
|
'litleTxnId'=>'123456789012345678',
|
176
169
|
}
|
177
170
|
|
178
|
-
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
179
|
-
XMLObject.expects(:new)
|
180
|
-
|
171
|
+
#Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
172
|
+
#XMLObject.expects(:new)
|
173
|
+
LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
|
181
174
|
response = LitleOnlineRequest.new.echeck_credit(hash)
|
182
175
|
end
|
183
176
|
|
@@ -191,9 +184,9 @@ module LitleOnline
|
|
191
184
|
'litleTxnId'=>'123456789012345678',
|
192
185
|
}
|
193
186
|
|
194
|
-
Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
195
|
-
XMLObject.expects(:new)
|
196
|
-
|
187
|
+
#Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
188
|
+
#XMLObject.expects(:new)
|
189
|
+
LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
|
197
190
|
response = LitleOnlineRequest.new.echeck_sale(hash)
|
198
191
|
end
|
199
192
|
|
@@ -213,8 +206,9 @@ module LitleOnline
|
|
213
206
|
}
|
214
207
|
}
|
215
208
|
|
216
|
-
XMLObject.expects(:new)
|
217
|
-
Communications.expects(:http_post).with(regexp_matches(/.*card.*/m),kind_of(Hash))
|
209
|
+
#XMLObject.expects(:new)
|
210
|
+
#Communications.expects(:http_post).with(regexp_matches(/.*card.*/m),kind_of(Hash))
|
211
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*card.*/m), is_a(Hash))
|
218
212
|
LitleOnlineRequest.new.authorization(start_hash.merge(card_only))
|
219
213
|
end
|
220
214
|
|
@@ -233,17 +227,18 @@ module LitleOnline
|
|
233
227
|
}
|
234
228
|
}
|
235
229
|
|
236
|
-
XMLObject.expects(:new)
|
237
|
-
Communications.expects(:http_post).with(regexp_matches(/.*token.*/m),kind_of(Hash))
|
230
|
+
#XMLObject.expects(:new)
|
231
|
+
#Communications.expects(:http_post).with(regexp_matches(/.*token.*/m),kind_of(Hash))
|
232
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*token.*/m), is_a(Hash))
|
238
233
|
LitleOnlineRequest.new.authorization(start_hash.merge(token_only))
|
239
234
|
end
|
240
235
|
|
241
236
|
def test_set_merchant_sdk
|
242
237
|
litle = LitleOnlineRequest.new
|
243
238
|
#Explicit - used for integrations
|
244
|
-
assert_equal 'ActiveMerchant;
|
239
|
+
assert_equal 'ActiveMerchant;10.0', litle.send(:get_merchant_sdk, {'merchantSdk'=>'ActiveMerchant;10.0'})
|
245
240
|
#Implicit - used raw when nothing is specified
|
246
|
-
assert_equal 'Ruby;
|
241
|
+
assert_equal 'Ruby;9.14.0', litle.send(:get_merchant_sdk, {'NotMerchantSdk'=>'ActiveMerchant;10.0'})
|
247
242
|
end
|
248
243
|
|
249
244
|
def test_sale_paypal_order_complete_typo
|
@@ -261,34 +256,22 @@ module LitleOnline
|
|
261
256
|
'expDate' =>'1210'
|
262
257
|
}}
|
263
258
|
|
264
|
-
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*<sale.*<payPalOrderComplete>true<\/payPalOrderComplete>.*/m),kind_of(Hash))
|
265
|
-
XMLObject.expects(:new)
|
266
|
-
|
259
|
+
#Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*<sale.*<payPalOrderComplete>true<\/payPalOrderComplete>.*/m),kind_of(Hash))
|
260
|
+
#XMLObject.expects(:new)
|
261
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest.*<sale.*<payPalOrderComplete>true<\/payPalOrderComplete>.*/m), is_a(Hash))
|
267
262
|
response = LitleOnlineRequest.new.sale(hash)
|
268
263
|
end
|
269
264
|
|
270
265
|
def test_version_matches_sdk_major_and_minor_version_ignoring_config
|
271
|
-
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'
|
266
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'9.14'})
|
272
267
|
hash={
|
273
268
|
'litleTxnId' => '006'
|
274
269
|
}
|
275
270
|
|
276
|
-
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*version="
|
277
|
-
XMLObject.expects(:new)
|
278
|
-
|
279
|
-
response = LitleOnlineRequest.new.void(hash)
|
280
|
-
end
|
281
|
-
|
282
|
-
def test_void_response_contains_recycling
|
283
|
-
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
284
|
-
hash={
|
285
|
-
'litleTxnId' => '123'
|
286
|
-
}
|
287
|
-
|
288
|
-
Communications.expects(:http_post).with(kind_of(String),kind_of(Hash)).returns('<litleOnlineResponse><voidResponse><recycling><creditLitleTxnId>65</creditLitleTxnId></recycling></voidResponse></litleOnlineResponse>')
|
289
|
-
|
271
|
+
#Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*version="9\.12".*/m),kind_of(Hash))
|
272
|
+
#XMLObject.expects(:new)
|
273
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest.*version="9\.14".*/m), is_a(Hash))
|
290
274
|
response = LitleOnlineRequest.new.void(hash)
|
291
|
-
assert_equal '65', response.voidResponse.recycling.creditLitleTxnId
|
292
275
|
end
|
293
276
|
|
294
277
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person
|
5
5
|
obtaining a copy of this software and associated documentation
|
@@ -41,7 +41,7 @@ module LitleOnline
|
|
41
41
|
rescue RuntimeError=> e
|
42
42
|
message = e.message
|
43
43
|
|
44
|
-
assert_equal
|
44
|
+
assert_equal "Entered a file not a path.",message
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_create_with_no_sep
|
@@ -148,7 +148,7 @@ module LitleOnline
|
|
148
148
|
test = ""
|
149
149
|
rescue RuntimeError => e
|
150
150
|
test = e.message
|
151
|
-
assert_equal
|
151
|
+
assert_equal "You entered neither a path nor a batch. Game over :(" ,test
|
152
152
|
end
|
153
153
|
|
154
154
|
def test_add_open_batch
|
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person
|
5
5
|
obtaining a copy of this software and associated documentation
|
@@ -281,7 +281,7 @@ module LitleOnline
|
|
281
281
|
'billToAddress'=>{'name'=>'Bob',
|
282
282
|
'city'=>'lowell',
|
283
283
|
'state'=>'MA',
|
284
|
-
'email'=>'
|
284
|
+
'email'=>'vantiv.com'}
|
285
285
|
}
|
286
286
|
|
287
287
|
result = ltlTxn.echeck_verification(echeckVerificationHash)
|
@@ -298,7 +298,7 @@ module LitleOnline
|
|
298
298
|
assert_equal 'Bob', result.billToAddress.name
|
299
299
|
assert_equal 'lowell', result.billToAddress.city
|
300
300
|
assert_equal 'MA', result.billToAddress.state
|
301
|
-
assert_equal '
|
301
|
+
assert_equal 'vantiv.com', result.billToAddress.email
|
302
302
|
end
|
303
303
|
|
304
304
|
def test_echeck_credit
|
@@ -352,7 +352,7 @@ module LitleOnline
|
|
352
352
|
'orderId'=>'12345',
|
353
353
|
'orderSource'=>'ecommerce',
|
354
354
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
355
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
355
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'vantiv.com'}
|
356
356
|
}
|
357
357
|
|
358
358
|
result = ltlTxn.echeck_sale(echeckSaleHash)
|
@@ -370,7 +370,7 @@ module LitleOnline
|
|
370
370
|
assert_equal 'Bob', result.billToAddress.name
|
371
371
|
assert_equal 'lowell', result.billToAddress.city
|
372
372
|
assert_equal 'MA', result.billToAddress.state
|
373
|
-
assert_equal '
|
373
|
+
assert_equal 'vantiv.com', result.billToAddress.email
|
374
374
|
end
|
375
375
|
|
376
376
|
def test_account_update
|
@@ -0,0 +1,136 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
14
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
15
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
16
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
17
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
18
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
19
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
20
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
=end
|
22
|
+
|
23
|
+
|
24
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
25
|
+
require 'test/unit'
|
26
|
+
require 'mocha/setup'
|
27
|
+
|
28
|
+
module LitleOnline
|
29
|
+
class TestLitleXmlMapper < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_LitleXmlMapper_request_xml_response_0
|
32
|
+
hash =
|
33
|
+
{
|
34
|
+
'merchantId' => '101',
|
35
|
+
'id' => 'test',
|
36
|
+
'version'=>'8.8',
|
37
|
+
'reportGroup'=>'Planets',
|
38
|
+
'litleTxnId'=>'123456',
|
39
|
+
}
|
40
|
+
Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"0\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
|
41
|
+
response = LitleXmlMapper.request("","")
|
42
|
+
assert_equal('0',response.response)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_LitleXmlMapper_request_xml_response_1
|
46
|
+
hash =
|
47
|
+
{
|
48
|
+
'merchantId' => '101',
|
49
|
+
'id' => 'test',
|
50
|
+
'version'=>'8.8',
|
51
|
+
'reportGroup'=>'Planets',
|
52
|
+
'litleTxnId'=>'123456',
|
53
|
+
}
|
54
|
+
Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"1\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
|
55
|
+
#Get exceptions
|
56
|
+
exception = assert_raise(RuntimeError){
|
57
|
+
LitleXmlMapper.request("","")
|
58
|
+
}
|
59
|
+
#Test
|
60
|
+
assert(exception.message =~ /Error with http response, code: 1/)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_LitleXmlMapper_request_xml_response_2
|
64
|
+
hash =
|
65
|
+
{
|
66
|
+
'merchantId' => '101',
|
67
|
+
'id' => 'test',
|
68
|
+
'version'=>'8.8',
|
69
|
+
'reportGroup'=>'Planets',
|
70
|
+
'litleTxnId'=>'123456',
|
71
|
+
}
|
72
|
+
Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"2\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
|
73
|
+
#Get exceptions
|
74
|
+
exception = assert_raise(RuntimeError){
|
75
|
+
LitleXmlMapper.request("","")
|
76
|
+
}
|
77
|
+
#Test
|
78
|
+
assert(exception.message =~ /Error with http response, code: 2/)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_LitleXmlMapper_request_xml_response_3
|
82
|
+
hash =
|
83
|
+
{
|
84
|
+
'merchantId' => '101',
|
85
|
+
'id' => 'test',
|
86
|
+
'version'=>'8.8',
|
87
|
+
'reportGroup'=>'Planets',
|
88
|
+
'litleTxnId'=>'123456',
|
89
|
+
}
|
90
|
+
Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"3\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
|
91
|
+
#Get exceptions
|
92
|
+
exception = assert_raise(RuntimeError){
|
93
|
+
LitleXmlMapper.request("","")
|
94
|
+
}
|
95
|
+
#Test
|
96
|
+
assert(exception.message =~ /Error with http response, code: 3/)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_LitleXmlMapper_request_xml_response_4
|
100
|
+
hash =
|
101
|
+
{
|
102
|
+
'merchantId' => '101',
|
103
|
+
'id' => 'test',
|
104
|
+
'version'=>'8.8',
|
105
|
+
'reportGroup'=>'Planets',
|
106
|
+
'litleTxnId'=>'123456',
|
107
|
+
}
|
108
|
+
Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"4\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
|
109
|
+
#Get exceptions
|
110
|
+
exception = assert_raise(RuntimeError){
|
111
|
+
LitleXmlMapper.request("","")
|
112
|
+
}
|
113
|
+
#Test
|
114
|
+
assert(exception.message =~ /Error with http response, code: 4/)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_LitleXmlMapper_request_xml_response_5
|
118
|
+
hash =
|
119
|
+
{
|
120
|
+
'merchantId' => '101',
|
121
|
+
'id' => 'test',
|
122
|
+
'version'=>'8.8',
|
123
|
+
'reportGroup'=>'Planets',
|
124
|
+
'litleTxnId'=>'123456',
|
125
|
+
}
|
126
|
+
Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"5\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
|
127
|
+
#Get exceptions
|
128
|
+
exception = assert_raise(RuntimeError){
|
129
|
+
LitleXmlMapper.request("","")
|
130
|
+
}
|
131
|
+
#Test
|
132
|
+
assert(exception.message =~ /Error with http response, code: 5/)
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
end
|
data/test/unit/test_activate.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person
|
5
5
|
obtaining a copy of this software and associated documentation
|
@@ -48,26 +48,6 @@ module LitleOnline
|
|
48
48
|
LitleOnlineRequest.new.activate(hash)
|
49
49
|
end
|
50
50
|
|
51
|
-
def test_simple_card
|
52
|
-
hash = {
|
53
|
-
'merchantId' => '101',
|
54
|
-
'version'=>'8.8',
|
55
|
-
'reportGroup'=>'Planets',
|
56
|
-
'orderId' => '11',
|
57
|
-
'amount' => '500',
|
58
|
-
'orderSource'=>'ecommerce',
|
59
|
-
'card'=>
|
60
|
-
{
|
61
|
-
'type'=>'VI',
|
62
|
-
'number' =>'4100000000000001',
|
63
|
-
'expDate' =>'1210'
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>VI<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/activate>.*/m), is_a(Hash))
|
68
|
-
LitleOnlineRequest.new.activate(hash)
|
69
|
-
end
|
70
|
-
|
71
51
|
def test_simple_virtualGiftcard
|
72
52
|
hash = {
|
73
53
|
'merchantId' => '101',
|
data/test/unit/test_auth.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person
|
5
5
|
obtaining a copy of this software and associated documentation
|
@@ -58,7 +58,7 @@ module LitleOnline
|
|
58
58
|
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
59
59
|
},
|
60
60
|
'signature' =>'sign',
|
61
|
-
'version' =>'1'
|
61
|
+
'version' =>'1.0.0'
|
62
62
|
}
|
63
63
|
}
|
64
64
|
|
@@ -88,7 +88,7 @@ module LitleOnline
|
|
88
88
|
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
89
89
|
},
|
90
90
|
'signature' =>'sign',
|
91
|
-
'version' =>'1'
|
91
|
+
'version' =>'1.0.0'
|
92
92
|
}}
|
93
93
|
|
94
94
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
@@ -194,8 +194,7 @@ module LitleOnline
|
|
194
194
|
}
|
195
195
|
}
|
196
196
|
|
197
|
-
|
198
|
-
Communications.expects(:http_post).with(regexp_matches(/.*<merchantData>.*?<campaign>foo<\/campaign>.*?<\/merchantData>.*/m),kind_of(Hash))
|
197
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<merchantData>.*?<campaign>foo<\/campaign>.*?<\/merchantData>.*/m), is_a(Hash))
|
199
198
|
LitleOnlineRequest.new.authorization(hash)
|
200
199
|
end
|
201
200
|
|
@@ -210,8 +209,7 @@ module LitleOnline
|
|
210
209
|
'fraudFilterOverride'=> 'true'
|
211
210
|
}
|
212
211
|
|
213
|
-
|
214
|
-
Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*?<fraudFilterOverride>true<\/fraudFilterOverride>.*?<\/authorization>.*/m),kind_of(Hash))
|
212
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<authorization.*?<fraudFilterOverride>true<\/fraudFilterOverride>.*?<\/authorization>.*/m), is_a(Hash))
|
215
213
|
LitleOnlineRequest.new.authorization(hash)
|
216
214
|
end
|
217
215
|
|
@@ -296,8 +294,7 @@ module LitleOnline
|
|
296
294
|
'fraudFilterOverride'=> 'true'
|
297
295
|
}
|
298
296
|
|
299
|
-
|
300
|
-
Communications.expects(:http_post).with(regexp_matches(/.*<authentication.*?<user>UNIT<\/user>.*?<\/authentication>.*/m),kind_of(Hash))
|
297
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<authentication.*?<user>UNIT<\/user>.*?<\/authentication>.*/m), is_a(Hash))
|
301
298
|
LitleOnlineRequest.new.authorization(hash)
|
302
299
|
end
|
303
300
|
|
@@ -314,8 +311,7 @@ module LitleOnline
|
|
314
311
|
'fraudFilterOverride'=> 'true'
|
315
312
|
}
|
316
313
|
|
317
|
-
|
318
|
-
Communications.expects(:http_post).with(regexp_matches(/.*<authentication.*?<password>TEST<\/password>.*?<\/authentication>.*/m),kind_of(Hash))
|
314
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<authentication.*?<password>TEST<\/password>.*?<\/authentication>.*/m), is_a(Hash))
|
319
315
|
LitleOnlineRequest.new.authorization(hash)
|
320
316
|
end
|
321
317
|
|
@@ -391,9 +387,9 @@ module LitleOnline
|
|
391
387
|
'card' => {
|
392
388
|
'number' => '4141000000000000',
|
393
389
|
'expDate' => '1210',
|
394
|
-
'type' => 'GC'
|
395
|
-
}
|
396
|
-
'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
|
390
|
+
'type' => 'GC'
|
391
|
+
},
|
392
|
+
'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
|
397
393
|
}
|
398
394
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudChecks><threatMetrixSessionId>1234<\/threatMetrixSessionId><\/advancedFraudChecks>.*/m), is_a(Hash))
|
399
395
|
LitleOnlineRequest.new.authorization(hash)
|
@@ -417,5 +413,49 @@ module LitleOnline
|
|
417
413
|
LitleOnlineRequest.new.authorization(hash)
|
418
414
|
end
|
419
415
|
|
416
|
+
def test_processingType_originalNetworkTransactionId_originalTransactionAmount
|
417
|
+
hash = {
|
418
|
+
'orderId' => '12344',
|
419
|
+
'amount' => '2',
|
420
|
+
'orderSource' => 'ecommerce',
|
421
|
+
'card' => {
|
422
|
+
'number' => '4141000000000000',
|
423
|
+
'expDate' => '1210',
|
424
|
+
'type' => 'GC'
|
425
|
+
},
|
426
|
+
'processingType' => 'initialInstallment',
|
427
|
+
'originalNetworkTransactionId' => '9876543210',
|
428
|
+
'originalTransactionAmount' => '536981'
|
429
|
+
}
|
430
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<processingType>initialInstallment<\/processingType><originalNetworkTransactionId>9876543210<\/originalNetworkTransactionId><originalTransactionAmount>536981<\/originalTransactionAmount>.*/m), is_a(Hash))
|
431
|
+
LitleOnlineRequest.new.authorization(hash)
|
432
|
+
end
|
433
|
+
|
434
|
+
def test_processingType_wallet
|
435
|
+
hash = {
|
436
|
+
'merchantId' => '101',
|
437
|
+
'version'=>'8.8',
|
438
|
+
'reportGroup'=>'Planets',
|
439
|
+
'id'=>'12345',
|
440
|
+
'orderId'=>'67890',
|
441
|
+
'amount'=>'10000',
|
442
|
+
'orderSource'=>'ecommerce',
|
443
|
+
'processingType' => 'initialInstallment',
|
444
|
+
'originalNetworkTransactionId' => '9876543210',
|
445
|
+
'originalTransactionAmount' => '536981',
|
446
|
+
'card'=>{
|
447
|
+
'type'=>'VI',
|
448
|
+
'number' =>'4100000000000000',
|
449
|
+
'expDate' =>'1215'
|
450
|
+
},
|
451
|
+
'wallet'=>{
|
452
|
+
'walletSourceType'=>'VisaCheckout',
|
453
|
+
'walletSourceTypeId' => 'VCIND'
|
454
|
+
}
|
455
|
+
}
|
456
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<wallet><walletSourceType>VisaCheckout<\/walletSourceType><walletSourceTypeId>VCIND<\/walletSourceTypeId><\/wallet>.*/m), is_a(Hash))
|
457
|
+
LitleOnlineRequest.new.authorization(hash)
|
458
|
+
end
|
459
|
+
|
420
460
|
end
|
421
461
|
end
|