LitleOnline 8.13.2 → 8.16.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +17 -0
- data/CONTRIBUTORS +2 -0
- data/DESCRIPTION +1 -1
- data/README.md +2 -1
- data/Rakefile +2 -2
- data/SETUP.md +1 -2
- data/bin/Setup.rb +0 -1
- data/lib/Communications.rb +1 -4
- data/lib/Configuration.rb +5 -0
- data/lib/LitleOnline.rb +0 -1
- data/lib/LitleOnlineRequest.rb +243 -562
- data/lib/LitleXmlMapper.rb +23 -8
- data/lib/XMLFields.rb +18 -2
- data/test/functional/test_auth.rb +16 -0
- data/test/functional/test_token.rb +2 -1
- data/test/functional/test_updateCardValidationNumOnToken.rb +43 -0
- data/test/functional/ts_all.rb +1 -0
- data/test/unit/test_LitleOnlineRequest.rb +93 -1
- data/test/unit/test_auth.rb +14 -0
- data/test/unit/test_authReversal.rb +14 -1
- data/test/unit/test_capture.rb +10 -0
- data/test/unit/test_captureGivenAuth.rb +23 -0
- data/test/unit/test_credit.rb +16 -0
- data/test/unit/test_echeckCredit.rb +14 -0
- data/test/unit/test_echeckRedeposit.rb +27 -0
- data/test/unit/test_echeckSale.rb +13 -0
- data/test/unit/test_echeckVerification.rb +28 -0
- data/test/unit/test_echeckVoid.rb +13 -0
- data/test/unit/test_forceCapture.rb +22 -1
- data/test/unit/test_sale.rb +21 -0
- data/test/unit/test_token.rb +14 -0
- data/test/unit/test_updateCardValidationNumOnToken.rb +80 -0
- data/test/unit/ts_unit.rb +2 -1
- metadata +14 -12
- data/index.html?grep= +0 -18
data/lib/LitleXmlMapper.rb
CHANGED
@@ -23,6 +23,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
23
23
|
OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
=end
|
25
25
|
|
26
|
+
require 'logger'
|
27
|
+
|
26
28
|
#
|
27
29
|
# Handles round trip of transactions
|
28
30
|
# Maps the request to Litle XML -> Sends XML payload to Litle via HTTP(S) -> formats XML response into a Ruby hash and returns it
|
@@ -30,20 +32,33 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|
30
32
|
module LitleOnline
|
31
33
|
class LitleXmlMapper
|
32
34
|
def LitleXmlMapper.request(request_xml, config_hash)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
puts request_xml
|
37
|
-
end
|
35
|
+
logger = initialize_logger(config_hash)
|
36
|
+
|
37
|
+
logger.debug request_xml
|
38
38
|
# get the Litle Online Response from the API server over HTTP
|
39
39
|
response_xml = Communications.http_post(request_xml,config_hash)
|
40
|
-
|
41
|
-
|
42
|
-
end
|
40
|
+
logger.debug response_xml
|
41
|
+
|
43
42
|
# create response object from xml returned form the Litle API
|
44
43
|
response_object = XMLObject.new(response_xml)
|
45
44
|
|
46
45
|
return response_object
|
47
46
|
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def self.initialize_logger(config_hash)
|
51
|
+
# Sadly, this needs to be static (the alternative would be to change the LitleXmlMapper.request API
|
52
|
+
# to accept a Configuration instance instead of the config_hash)
|
53
|
+
Configuration.logger ||= default_logger config_hash['printxml'] ? Logger::DEBUG : Logger::INFO
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.default_logger(level) # :nodoc:
|
57
|
+
logger = Logger.new(STDOUT)
|
58
|
+
logger.level = level
|
59
|
+
# Backward compatible logging format for pre 8.16
|
60
|
+
logger.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
|
61
|
+
logger
|
62
|
+
end
|
48
63
|
end
|
49
64
|
end
|
data/lib/XMLFields.rb
CHANGED
@@ -1102,6 +1102,7 @@ module LitleOnline
|
|
1102
1102
|
object_node :shipToAddress, "shipToAddress", :class=>Contact, :default_value=>nil
|
1103
1103
|
optional_choice_node :if, 'echeck', :then, (object_node :echeck, "echeck", :class=>Echeck),
|
1104
1104
|
:elsif, 'echeckToken', :then, (object_node :echeckToken, "echeckToken", :class=>EcheckToken)
|
1105
|
+
object_node :merchantData, "merchantData", :class=>MerchantData, :default_value=>nil
|
1105
1106
|
end
|
1106
1107
|
|
1107
1108
|
class EcheckCredit
|
@@ -1130,6 +1131,7 @@ module LitleOnline
|
|
1130
1131
|
text_node :litleTxnId, "litleTxnId", :default_value=>nil
|
1131
1132
|
optional_choice_node :if, 'echeck', :then, (object_node :echeck, "echeck", :class=>Echeck, :default_value=>nil),
|
1132
1133
|
:elsif, 'echeckToken', :then, (object_node :echeckToken, "echeckToken", :class=>EcheckToken, :default_value=>nil)
|
1134
|
+
object_node :merchantData, "merchantData", :class=>MerchantData, :default_value=>nil
|
1133
1135
|
end
|
1134
1136
|
|
1135
1137
|
class EcheckSale
|
@@ -1151,13 +1153,26 @@ module LitleOnline
|
|
1151
1153
|
object_node :merchantData, "merchantData", :class=>MerchantData, :default_value=>nil
|
1152
1154
|
end
|
1153
1155
|
|
1156
|
+
class UpdateCardValidationNumOnToken
|
1157
|
+
include XML::Mapping
|
1158
|
+
text_node :reportGroup, "@reportGroup", :default_value=>nil
|
1159
|
+
text_node :transactionId, "@id", :default_value=>nil
|
1160
|
+
text_node :customerId, "@customerId", :default_value=>nil
|
1161
|
+
|
1162
|
+
text_node :orderId, "orderId", :default_value=>nil
|
1163
|
+
text_node :litleToken, "litleToken", :default_value=>nil
|
1164
|
+
text_node :cardValidationNum, "cardValidationNum", :default_value=>nil
|
1165
|
+
end
|
1166
|
+
|
1167
|
+
|
1154
1168
|
class OnlineRequest
|
1155
1169
|
include XML::Mapping
|
1156
1170
|
root_element_name "litleOnlineRequest"
|
1157
1171
|
text_node :merchantId, "@merchantId", :default_value=>nil
|
1158
1172
|
text_node :version, "@version", :default_value=>nil
|
1159
1173
|
text_node :xmlns, "@xmlns", :default_value=>nil
|
1160
|
-
text_node :merchantSdk, "@merchantSdk", :
|
1174
|
+
text_node :merchantSdk, "@merchantSdk", :default_value=>nil
|
1175
|
+
text_node :loggedInUser, "@loggedInUser", :default_value=>nil
|
1161
1176
|
object_node :authentication, "authentication", :class=>Authentication
|
1162
1177
|
optional_choice_node :if, 'authorization', :then, (object_node :authorization, "authorization", :class=>Authorization),
|
1163
1178
|
:elsif, 'sale', :then, (object_node :sale, "sale", :class=>Sale),
|
@@ -1172,7 +1187,8 @@ module LitleOnline
|
|
1172
1187
|
:elsif, 'echeckSale', :then, (object_node :echeckSale, "echeckSale", :class=>EcheckSale),
|
1173
1188
|
:elsif, 'echeckVoid', :then, (object_node :echeckVoid, "echeckVoid", :class=>EcheckVoid),
|
1174
1189
|
:elsif, 'echeckVerification', :then, (object_node :echeckVerification, "echeckVerification", :class=>EcheckVerification),
|
1175
|
-
:elsif, 'registerTokenRequest', :then, (object_node :registerTokenRequest, "registerTokenRequest", :class=>RegisterTokenRequest)
|
1190
|
+
:elsif, 'registerTokenRequest', :then, (object_node :registerTokenRequest, "registerTokenRequest", :class=>RegisterTokenRequest),
|
1191
|
+
:elsif, 'updateCardValidationNumOnToken', :then, (object_node :updateCardValidationNumOnToken, "updateCardValidationNumOnToken", :class=>UpdateCardValidationNumOnToken)
|
1176
1192
|
def post_save(xml, options={:Mapping=>:_default})
|
1177
1193
|
xml.each_element() {|el|
|
1178
1194
|
if(el.name == 'captureTxn')
|
@@ -216,6 +216,22 @@ module LitleOnline
|
|
216
216
|
response = LitleOnlineRequest.new.authorization(start_hash.merge({'customerInfo'=>{'ssn'=>'000112222'} }))
|
217
217
|
assert_equal('000', response.authorizationResponse.response)
|
218
218
|
end
|
219
|
+
|
220
|
+
def test_simple_auth_with_paypage
|
221
|
+
hash = {
|
222
|
+
'orderId'=>'12344',
|
223
|
+
'amount'=>'106',
|
224
|
+
'orderSource'=>'ecommerce',
|
225
|
+
'paypage'=>{
|
226
|
+
'type'=>'VI',
|
227
|
+
'paypageRegistrationId' =>'QU1pTFZnV2NGQWZrZzRKeTNVR0lzejB1K2Q5VDdWMTVqb2J5WFJ2Snh4U0U4eTBxaFg2cEVWaDBWSlhtMVZTTw==',
|
228
|
+
'expDate' =>'1210',
|
229
|
+
'cardValidationNum' => '123'
|
230
|
+
}
|
231
|
+
}
|
232
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
233
|
+
assert_equal('000', response.authorizationResponse.response)
|
234
|
+
end
|
219
235
|
|
220
236
|
end
|
221
237
|
end
|
@@ -45,10 +45,11 @@ module LitleOnline
|
|
45
45
|
'version'=>'8.8',
|
46
46
|
'reportGroup'=>'Planets',
|
47
47
|
'orderId'=>'12344',
|
48
|
-
'paypageRegistrationId'=>'
|
48
|
+
'paypageRegistrationId'=>'QU1pTFZnV2NGQWZrZzRKeTNVR0lzejB1K2Q5VDdWMTVqb2J5WFJ2Snh4U0U4eTBxaFg2cEVWaDBWSlhtMVZTTw=='
|
49
49
|
}
|
50
50
|
response= LitleOnlineRequest.new.register_token_request(hash)
|
51
51
|
assert_equal('Valid Format', response.message)
|
52
|
+
assert_equal('1111222233334444', response.registerTokenResponse.litleToken)
|
52
53
|
end
|
53
54
|
|
54
55
|
def test_simple_token_echeck
|
@@ -0,0 +1,43 @@
|
|
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
|
+
module LitleOnline
|
29
|
+
class TestUpdateCardValidationNumOnToken < Test::Unit::TestCase
|
30
|
+
def test_simple
|
31
|
+
hash = {
|
32
|
+
'merchantId' => '101',
|
33
|
+
'version'=>'8.8',
|
34
|
+
'reportGroup'=>'Planets',
|
35
|
+
'orderId'=>'12344',
|
36
|
+
'litleToken'=>'1233456789103801',
|
37
|
+
'cardValidationNum'=>'123'
|
38
|
+
}
|
39
|
+
response= LitleOnlineRequest.new.update_card_validation_num_on_token(hash)
|
40
|
+
assert_equal('Valid Format', response.message)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/test/functional/ts_all.rb
CHANGED
@@ -244,9 +244,101 @@ module LitleOnline
|
|
244
244
|
#Explicit - used for integrations
|
245
245
|
assert_equal 'ActiveMerchant;3.2', litle.send(:get_merchant_sdk, {'merchantSdk'=>'ActiveMerchant;3.2'})
|
246
246
|
#Implicit - used raw when nothing is specified
|
247
|
-
assert_equal 'Ruby;8.
|
247
|
+
assert_equal 'Ruby;8.16.0', litle.send(:get_merchant_sdk, {'NotMerchantSdk'=>'ActiveMerchant;3.2'})
|
248
248
|
end
|
249
249
|
|
250
|
+
def test_sale_paypal_order_complete_typo
|
251
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
252
|
+
hash={
|
253
|
+
'reportGroup'=>'Planets',
|
254
|
+
'id' => '006',
|
255
|
+
'orderId'=>'12344',
|
256
|
+
'amount'=>'106',
|
257
|
+
'orderSource'=>'ecommerce',
|
258
|
+
'payPalOrderComplete'=>'true',
|
259
|
+
'card'=>{
|
260
|
+
'type'=>'VI',
|
261
|
+
'number' =>'4100000000000001',
|
262
|
+
'expDate' =>'1210'
|
263
|
+
}}
|
264
|
+
|
265
|
+
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*<sale.*<payPalOrderComplete>true<\/payPalOrderComplete>.*/m),kind_of(Hash))
|
266
|
+
XMLObject.expects(:new)
|
267
|
+
|
268
|
+
response = LitleOnlineRequest.new.sale(hash)
|
269
|
+
end
|
270
|
+
|
271
|
+
def test_version_matches_sdk_major_and_minor_version_ignoring_config
|
272
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
273
|
+
hash={
|
274
|
+
'litleTxnId' => '006'
|
275
|
+
}
|
276
|
+
|
277
|
+
Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*version="8\.16".*/m),kind_of(Hash))
|
278
|
+
XMLObject.expects(:new)
|
279
|
+
|
280
|
+
response = LitleOnlineRequest.new.void(hash)
|
281
|
+
end
|
250
282
|
|
283
|
+
def test_void_response_contains_recycling
|
284
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
285
|
+
hash={
|
286
|
+
'litleTxnId' => '123'
|
287
|
+
}
|
288
|
+
|
289
|
+
Communications.expects(:http_post).with(kind_of(String),kind_of(Hash)).returns('<litleOnlineResponse><voidResponse><recycling><creditLitleTxnId>65</creditLitleTxnId></recycling></voidResponse></litleOnlineResponse>')
|
290
|
+
|
291
|
+
response = LitleOnlineRequest.new.void(hash)
|
292
|
+
assert_equal '65', response.voidResponse.recycling.creditLitleTxnId
|
293
|
+
end
|
294
|
+
|
295
|
+
def test_printxml_can_be_turned_on_by_setting_value_to_true
|
296
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10','printxml'=>true})
|
297
|
+
Communications.expects(:http_post).with(kind_of(String),kind_of(Hash)).returns('<litleOnlineResponse><voidResponse><recycling><creditLitleTxnId>65</creditLitleTxnId></recycling></voidResponse></litleOnlineResponse>')
|
298
|
+
Logger.any_instance.expects(:debug).with(kind_of(String)).twice
|
299
|
+
hash={
|
300
|
+
'litleTxnId' => '123'
|
301
|
+
}
|
302
|
+
|
303
|
+
response = LitleOnlineRequest.new.void(hash)
|
304
|
+
logger = Logger.new(STDOUT)
|
305
|
+
logger.level = Logger::DEBUG
|
306
|
+
assert_equal logger.level, Configuration.logger.level
|
307
|
+
assert_equal logger.sev_threshold, Configuration.logger.sev_threshold
|
308
|
+
LitleOnline::Configuration.logger = nil
|
309
|
+
end
|
310
|
+
|
311
|
+
def test_printxml_can_be_turned_off_by_setting_value_to_false
|
312
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10','printxml'=>false})
|
313
|
+
Communications.expects(:http_post).with(kind_of(String),kind_of(Hash)).returns('<litleOnlineResponse><voidResponse><recycling><creditLitleTxnId>65</creditLitleTxnId></recycling></voidResponse></litleOnlineResponse>')
|
314
|
+
Logger.any_instance.expects(:debug).with(kind_of(String)).twice
|
315
|
+
hash={
|
316
|
+
'litleTxnId' => '123'
|
317
|
+
}
|
318
|
+
|
319
|
+
response = LitleOnlineRequest.new.void(hash)
|
320
|
+
logger = Logger.new(STDOUT)
|
321
|
+
logger.level = Logger::INFO
|
322
|
+
assert_equal logger.level, Configuration.logger.level
|
323
|
+
assert_equal logger.sev_threshold, Configuration.logger.sev_threshold
|
324
|
+
LitleOnline::Configuration.logger = nil
|
325
|
+
end
|
326
|
+
|
327
|
+
def test_printxml_can_be_turned_off_by_not_setting_value
|
328
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
329
|
+
Communications.expects(:http_post).with(kind_of(String),kind_of(Hash)).returns('<litleOnlineResponse><voidResponse><recycling><creditLitleTxnId>65</creditLitleTxnId></recycling></voidResponse></litleOnlineResponse>')
|
330
|
+
Logger.any_instance.expects(:debug).with(kind_of(String)).twice
|
331
|
+
hash={
|
332
|
+
'litleTxnId' => '123'
|
333
|
+
}
|
334
|
+
|
335
|
+
response = LitleOnlineRequest.new.void(hash)
|
336
|
+
logger = Logger.new(STDOUT)
|
337
|
+
logger.level = Logger::INFO
|
338
|
+
assert_equal logger.level, Configuration.logger.level
|
339
|
+
assert_equal logger.sev_threshold, Configuration.logger.sev_threshold
|
340
|
+
LitleOnline::Configuration.logger = nil
|
341
|
+
end
|
342
|
+
|
251
343
|
end
|
252
344
|
end
|
data/test/unit/test_auth.rb
CHANGED
@@ -266,6 +266,20 @@ module LitleOnline
|
|
266
266
|
Communications.expects(:http_post).with(regexp_matches(/.*<authentication.*?<password>TEST<\/password>.*?<\/authentication>.*/m),kind_of(Hash))
|
267
267
|
LitleOnlineRequest.new.authorization(hash)
|
268
268
|
end
|
269
|
+
|
270
|
+
def test_logged_in_user
|
271
|
+
hash = {
|
272
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
273
|
+
'merchantId' => '101',
|
274
|
+
'version'=>'8.8',
|
275
|
+
'reportGroup'=>'Planets',
|
276
|
+
'litleTxnId'=>'123456',
|
277
|
+
'loggedInUser'=>'gdake'
|
278
|
+
}
|
279
|
+
|
280
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
|
281
|
+
LitleOnlineRequest.new.authorization(hash)
|
282
|
+
end
|
269
283
|
|
270
284
|
end
|
271
285
|
|
@@ -40,7 +40,20 @@ module LitleOnline
|
|
40
40
|
}
|
41
41
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>12345678000<\/litleTxnId>.*/m), is_a(Hash))
|
42
42
|
LitleOnlineRequest.new.auth_reversal(hash)
|
43
|
-
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_logged_in_user
|
46
|
+
hash = {
|
47
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
48
|
+
'merchantId' => '101',
|
49
|
+
'version'=>'8.8',
|
50
|
+
'litleTxnId'=>'12345678000',
|
51
|
+
'reportGroup'=>'Planets',
|
52
|
+
'amount'=>'5000',
|
53
|
+
'loggedInUser'=>'gdake'
|
54
|
+
}
|
55
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
|
56
|
+
LitleOnlineRequest.new.auth_reversal(hash)
|
44
57
|
end
|
45
58
|
end
|
46
59
|
end
|
data/test/unit/test_capture.rb
CHANGED
@@ -35,6 +35,16 @@ module LitleOnline
|
|
35
35
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>123456<\/litleTxnId>.*/m), is_a(Hash))
|
36
36
|
LitleOnlineRequest.new.capture(hash)
|
37
37
|
end
|
38
|
+
def test_logged_in_user
|
39
|
+
hash = {
|
40
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
41
|
+
'litleTxnId'=>'123456',
|
42
|
+
'loggedInUser'=>'gdake'
|
43
|
+
}
|
44
|
+
|
45
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
|
46
|
+
LitleOnlineRequest.new.capture(hash)
|
47
|
+
end
|
38
48
|
end
|
39
49
|
end
|
40
50
|
|
@@ -87,6 +87,29 @@ module LitleOnline
|
|
87
87
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.capture_given_auth(hash)}
|
88
88
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
89
89
|
end
|
90
|
+
|
91
|
+
def test_logged_in_user
|
92
|
+
hash = {
|
93
|
+
'loggedInUser' => 'gdake',
|
94
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
95
|
+
'merchantId' => '101',
|
96
|
+
'version'=>'8.8',
|
97
|
+
'reportGroup'=>'Planets',
|
98
|
+
'orderId'=>'12344',
|
99
|
+
'amount'=>'106',
|
100
|
+
'orderSource'=>'ecommerce',
|
101
|
+
'authInformation' => {
|
102
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
103
|
+
'authAmount'=>'12345'
|
104
|
+
},
|
105
|
+
'card'=>{
|
106
|
+
'type'=>'VI',
|
107
|
+
'number' =>'4100000000000001',
|
108
|
+
'expDate' =>'1210'
|
109
|
+
}}
|
110
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
|
111
|
+
LitleOnlineRequest.new.capture_given_auth(hash)
|
112
|
+
end
|
90
113
|
end
|
91
114
|
|
92
115
|
end
|
data/test/unit/test_credit.rb
CHANGED
@@ -226,5 +226,21 @@ module LitleOnline
|
|
226
226
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
227
227
|
assert_match /If paypage is specified, it must have a paypageRegistrationId/, exception.message
|
228
228
|
end
|
229
|
+
|
230
|
+
def test_logged_in_user
|
231
|
+
hash = {
|
232
|
+
'loggedInUser' => 'gdake',
|
233
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
234
|
+
'merchantId' => '101',
|
235
|
+
'version'=>'8.12',
|
236
|
+
'orderId'=>'1',
|
237
|
+
'amount'=>'2',
|
238
|
+
'orderSource'=>'ecommerce',
|
239
|
+
'reportGroup'=>'Planets'
|
240
|
+
}
|
241
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
|
242
|
+
LitleOnlineRequest.new.credit(hash)
|
243
|
+
end
|
244
|
+
|
229
245
|
end
|
230
246
|
end
|
@@ -39,6 +39,20 @@ module LitleOnline
|
|
39
39
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_credit(hash)}
|
40
40
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
41
41
|
end
|
42
|
+
|
43
|
+
def test_logged_in_user
|
44
|
+
hash = {
|
45
|
+
'loggedInUser' => 'gdake',
|
46
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
47
|
+
'merchantId' => '101',
|
48
|
+
'version'=>'8.8',
|
49
|
+
'reportGroup'=>'Planets',
|
50
|
+
'litleTxnId'=>'123456',
|
51
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
52
|
+
}
|
53
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
|
54
|
+
LitleOnlineRequest.new.echeck_credit(hash)
|
55
|
+
end
|
42
56
|
|
43
57
|
end
|
44
58
|
end
|
@@ -63,5 +63,32 @@ module LitleOnline
|
|
63
63
|
exception = assert_raise(RuntimeError) {LitleOnlineRequest.new.echeck_redeposit(hash)}
|
64
64
|
assert_match /If echeckToken is specified, it must have a routingNum/, exception.message
|
65
65
|
end
|
66
|
+
|
67
|
+
def test_logged_in_user
|
68
|
+
hash = {
|
69
|
+
'loggedInUser' => 'gdake',
|
70
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
71
|
+
'merchantId' => '101',
|
72
|
+
'version'=>'8.8',
|
73
|
+
'reportGroup'=>'Planets',
|
74
|
+
'litleTxnId'=>'123456',
|
75
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
76
|
+
}
|
77
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
|
78
|
+
LitleOnlineRequest.new.echeck_redeposit(hash)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_merchant_data
|
82
|
+
hash = {
|
83
|
+
'merchantData' => {'campaign'=>'camping'},
|
84
|
+
'merchantId' => '101',
|
85
|
+
'version'=>'8.8',
|
86
|
+
'reportGroup'=>'Planets',
|
87
|
+
'litleTxnId'=>'123456',
|
88
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
89
|
+
}
|
90
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<\/echeck>.*<merchantData>.*<campaign>camping<\/campaign>.*<\/merchantData>/m), is_a(Hash))
|
91
|
+
LitleOnlineRequest.new.echeck_redeposit(hash)
|
92
|
+
end
|
66
93
|
end
|
67
94
|
end
|