LitleOnline 8.16.0 → 8.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG +7 -0
  2. data/DESCRIPTION +1 -1
  3. data/README.md +2 -2
  4. data/Rakefile +6 -3
  5. data/bin/Setup.rb +14 -0
  6. data/bin/sample_batch_driver.rb +122 -0
  7. data/lib/LitleBatchRequest.rb +466 -0
  8. data/lib/LitleListeners.rb +142 -0
  9. data/lib/LitleOnline.rb +4 -0
  10. data/lib/LitleOnlineRequest.rb +25 -144
  11. data/lib/LitleRequest.rb +513 -0
  12. data/lib/LitleTransaction.rb +295 -0
  13. data/lib/XMLFields.rb +114 -4
  14. data/test/certification/certTest_batchAll.rb +337 -0
  15. data/test/certification/ts_all.rb +2 -0
  16. data/test/functional/test_batch.rb +164 -0
  17. data/test/functional/test_credit.rb +0 -18
  18. data/test/functional/test_litle_requests.rb +355 -0
  19. data/test/functional/test_updateCardValidationNumOnToken.rb +1 -1
  20. data/test/functional/test_xmlfields.rb +0 -19
  21. data/test/functional/ts_all.rb +2 -0
  22. data/test/unit/test_LitleAUBatch.rb +217 -0
  23. data/test/unit/test_LitleBatchRequest.rb +599 -0
  24. data/test/unit/test_LitleOnlineRequest.rb +9 -57
  25. data/test/unit/test_LitleRequest.rb +320 -0
  26. data/test/unit/test_LitleTransaction.rb +398 -0
  27. data/test/unit/test_auth.rb +25 -2
  28. data/test/unit/test_authReversal.rb +28 -5
  29. data/test/unit/test_capture.rb +24 -1
  30. data/test/unit/test_captureGivenAuth.rb +23 -1
  31. data/test/unit/test_credit.rb +92 -19
  32. data/test/unit/test_echeckCredit.rb +1 -1
  33. data/test/unit/test_echeckRedeposit.rb +1 -1
  34. data/test/unit/test_echeckSale.rb +1 -1
  35. data/test/unit/test_echeckVerification.rb +1 -1
  36. data/test/unit/test_echeckVoid.rb +1 -1
  37. data/test/unit/test_forceCapture.rb +24 -1
  38. data/test/unit/test_sale.rb +25 -2
  39. data/test/unit/test_token.rb +1 -1
  40. data/test/unit/test_updateCardValidationNumOnToken.rb +1 -1
  41. data/test/unit/test_xmlfields.rb +1 -1
  42. data/test/unit/ts_unit.rb +4 -0
  43. metadata +59 -14
@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
- require 'mocha'
27
+ require 'mocha/setup'
28
28
 
29
29
  #test Authorization Transaction
30
30
  module LitleOnline
@@ -277,10 +277,33 @@ module LitleOnline
277
277
  'loggedInUser'=>'gdake'
278
278
  }
279
279
 
280
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
280
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
281
281
  LitleOnlineRequest.new.authorization(hash)
282
282
  end
283
283
 
284
+ def test_surcharge_amount
285
+ hash = {
286
+ 'orderId' => '12344',
287
+ 'amount' => '2',
288
+ 'surchargeAmount' => '1',
289
+ 'orderSource' => 'ecommerce',
290
+ 'reportGroup' => 'Planets'
291
+ }
292
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
293
+ LitleOnlineRequest.new.authorization(hash)
294
+ end
295
+
296
+ def test_surcharge_amount_optional
297
+ hash = {
298
+ 'orderId' => '12344',
299
+ 'amount' => '2',
300
+ 'orderSource' => 'ecommerce',
301
+ 'reportGroup' => 'Planets'
302
+ }
303
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
304
+ LitleOnlineRequest.new.authorization(hash)
305
+ end
306
+
284
307
  end
285
308
 
286
309
  end
@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
- require 'mocha'
27
+ require 'mocha/setup'
28
28
 
29
29
  module LitleOnline
30
30
  class TestAuthReversal < Test::Unit::TestCase
@@ -48,12 +48,35 @@ module LitleOnline
48
48
  'merchantId' => '101',
49
49
  'version'=>'8.8',
50
50
  'litleTxnId'=>'12345678000',
51
- 'reportGroup'=>'Planets',
52
- 'amount'=>'5000',
53
- 'loggedInUser'=>'gdake'
51
+ 'reportGroup'=>'Planets',
52
+ 'amount'=>'5000',
53
+ 'loggedInUser'=>'gdake'
54
54
  }
55
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
55
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
56
56
  LitleOnlineRequest.new.auth_reversal(hash)
57
57
  end
58
+
59
+ def test_surcharge_amount
60
+ hash = {
61
+ 'litleTxnId' => '3',
62
+ 'amount' => '2',
63
+ 'surchargeAmount' => '1',
64
+ 'payPalNotes' => 'note',
65
+ 'reportGroup' => 'Planets'
66
+ }
67
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><payPalNotes>note<\/payPalNotes>.*/m), is_a(Hash))
68
+ LitleOnlineRequest.new.auth_reversal(hash)
69
+ end
70
+
71
+ def test_surcharge_amount_optional
72
+ hash = {
73
+ 'litleTxnId' => '3',
74
+ 'amount' => '2',
75
+ 'payPalNotes' => 'note',
76
+ 'reportGroup' => 'Planets'
77
+ }
78
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><payPalNotes>note<\/payPalNotes>.*/m), is_a(Hash))
79
+ LitleOnlineRequest.new.auth_reversal(hash)
80
+ end
58
81
  end
59
82
  end
@@ -24,6 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
+ require 'mocha/setup'
27
28
 
28
29
  module LitleOnline
29
30
  class Test_capture < Test::Unit::TestCase
@@ -42,7 +43,29 @@ module LitleOnline
42
43
  'loggedInUser'=>'gdake'
43
44
  }
44
45
 
45
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
46
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
47
+ LitleOnlineRequest.new.capture(hash)
48
+ end
49
+ def test_surcharge_amount
50
+ hash = {
51
+ 'litleTxnId' => '3',
52
+ 'amount' => '2',
53
+ 'surchargeAmount' => '1',
54
+ 'payPalNotes' => 'note',
55
+ 'reportGroup' => 'Planets'
56
+ }
57
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><payPalNotes>note<\/payPalNotes>.*/m), is_a(Hash))
58
+ LitleOnlineRequest.new.capture(hash)
59
+ end
60
+
61
+ def test_surcharge_amount_optional
62
+ hash = {
63
+ 'litleTxnId' => '3',
64
+ 'amount' => '2',
65
+ 'payPalNotes' => 'note',
66
+ 'reportGroup' => 'Planets'
67
+ }
68
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><payPalNotes>note<\/payPalNotes>.*/m), is_a(Hash))
46
69
  LitleOnlineRequest.new.capture(hash)
47
70
  end
48
71
  end
@@ -24,6 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
+ require 'mocha/setup'
27
28
 
28
29
  module LitleOnline
29
30
 
@@ -107,7 +108,28 @@ module LitleOnline
107
108
  'number' =>'4100000000000001',
108
109
  'expDate' =>'1210'
109
110
  }}
110
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
111
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
112
+ LitleOnlineRequest.new.capture_given_auth(hash)
113
+ end
114
+
115
+ def test_surcharge_amount
116
+ hash = {
117
+ 'amount' => '2',
118
+ 'surchargeAmount' => '1',
119
+ 'orderSource' => 'ecommerce',
120
+ 'reportGroup' => 'Planets'
121
+ }
122
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
123
+ LitleOnlineRequest.new.capture_given_auth(hash)
124
+ end
125
+
126
+ def test_surcharge_amount_optional
127
+ hash = {
128
+ 'amount' => '2',
129
+ 'orderSource' => 'ecommerce',
130
+ 'reportGroup' => 'Planets'
131
+ }
132
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
111
133
  LitleOnlineRequest.new.capture_given_auth(hash)
112
134
  end
113
135
  end
@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
- require 'mocha'
27
+ require 'mocha/setup'
28
28
 
29
29
  module LitleOnline
30
30
 
@@ -86,33 +86,35 @@ module LitleOnline
86
86
  'merchantId' => '101',
87
87
  'version'=>'8.8',
88
88
  'reportGroup'=>'Planets',
89
- 'litleTxnId'=>'123456',
90
89
  'orderId'=>'12344',
91
90
  'amount'=>'106',
92
91
  'orderSource'=>'ecommerce',
93
92
  'fraudCheck'=>{'authenticationTransactionId'=>'123'},
94
93
  'bypassVelocityCheckcardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
95
94
  'card'=>{
96
- 'type'=>'VI',
97
- 'number' =>'4100000000000001',
98
- 'expDate' =>'1210'
95
+ 'type'=>'VI',
96
+ 'number' =>'4100000000000001',
97
+ 'expDate' =>'1210'
99
98
  },
100
99
  'paypage'=> {
101
- 'paypageRegistrationId'=>'1234',
102
- 'expDate'=>'1210',
103
- 'cardValidationNum'=>'555',
104
- 'type'=>'VI'},
100
+ 'paypageRegistrationId'=>'1234',
101
+ 'expDate'=>'1210',
102
+ 'cardValidationNum'=>'555',
103
+ 'type'=>'VI'
104
+ },
105
105
  'paypal'=>{
106
- 'payerId'=>'1234',
107
- 'payerEmail'=>'a@b.com',
108
- 'token'=>'1234',
109
- 'transactionId'=>'123456'},
106
+ 'payerId'=>'1234',
107
+ 'payerEmail'=>'a@b.com',
108
+ 'token'=>'1234',
109
+ 'transactionId'=>'123456'
110
+ },
110
111
  'token'=> {
111
- 'litleToken'=>'1234567890123',
112
- 'expDate'=>'1210',
113
- 'cardValidationNum'=>'555',
114
- 'type'=>'VI'
115
- }}
112
+ 'litleToken'=>'1234567890123',
113
+ 'expDate'=>'1210',
114
+ 'cardValidationNum'=>'555',
115
+ 'type'=>'VI'
116
+ }
117
+ }
116
118
 
117
119
  exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
118
120
  assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
@@ -238,7 +240,78 @@ module LitleOnline
238
240
  'orderSource'=>'ecommerce',
239
241
  'reportGroup'=>'Planets'
240
242
  }
241
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
243
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
244
+ LitleOnlineRequest.new.credit(hash)
245
+ end
246
+
247
+ def test_surcharge_amount_tied
248
+ hash = {
249
+ 'amount' => '2',
250
+ 'surchargeAmount' => '1',
251
+ 'litleTxnId' => '3',
252
+ 'processingInstructions' => {},
253
+ 'reportGroup' => 'Planets'
254
+ }
255
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><process.*/m), is_a(Hash))
256
+ LitleOnlineRequest.new.credit(hash)
257
+ end
258
+
259
+ def test_surcharge_amount_tied_optional
260
+ hash = {
261
+ 'amount' => '2',
262
+ 'litleTxnId' => '3',
263
+ 'processingInstructions' => {},
264
+ 'reportGroup' => 'Planets'
265
+ }
266
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><process.*/m), is_a(Hash))
267
+ LitleOnlineRequest.new.credit(hash)
268
+ end
269
+
270
+ def test_surcharge_amount_orphan
271
+ hash = {
272
+ 'amount' => '2',
273
+ 'surchargeAmount' => '1',
274
+ 'orderSource' => 'ecommerce',
275
+ 'reportGroup' => 'Planets'
276
+ }
277
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
278
+ LitleOnlineRequest.new.credit(hash)
279
+ end
280
+
281
+ def test_surcharge_amount_orphan_optional
282
+ hash = {
283
+ 'amount' => '2',
284
+ 'orderSource' => 'ecommerce',
285
+ 'reportGroup' => 'Planets'
286
+ }
287
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
288
+ LitleOnlineRequest.new.credit(hash)
289
+ end
290
+
291
+ def test_pos_tied
292
+ hash = {
293
+ 'amount' => '2',
294
+ 'pos' => {
295
+ 'terminalId' => 'abc123',
296
+ 'capability' => 'magstripe',
297
+ 'entryMode' => 'keyed',
298
+ 'cardholderId' => 'nopin',
299
+ },
300
+ 'litleTxnId' => '3',
301
+ 'reportGroup' => 'Planets',
302
+ 'orderSource' => 'ecommerce',
303
+ 'payPalNotes' => 'notes'
304
+ }
305
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><pos><capability>magstripe<\/capability><entryMode>keyed<\/entryMode><cardholderId>nopin<\/cardholderId><terminalId>abc123<\/terminalId><\/pos><payPalNotes>.*/m), is_a(Hash))
306
+ LitleOnlineRequest.new.credit(hash)
307
+ end
308
+
309
+ def test_post_tied_optional
310
+ hash = {
311
+ 'amount' => '2',
312
+ 'litleTxnId' => '3',
313
+ }
314
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><\/credit>.*/m), is_a(Hash))
242
315
  LitleOnlineRequest.new.credit(hash)
243
316
  end
244
317
 
@@ -50,7 +50,7 @@ module LitleOnline
50
50
  'litleTxnId'=>'123456',
51
51
  'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
52
52
  }
53
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
53
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
54
54
  LitleOnlineRequest.new.echeck_credit(hash)
55
55
  end
56
56
 
@@ -74,7 +74,7 @@ module LitleOnline
74
74
  'litleTxnId'=>'123456',
75
75
  'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
76
76
  }
77
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
77
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
78
78
  LitleOnlineRequest.new.echeck_redeposit(hash)
79
79
  end
80
80
 
@@ -51,7 +51,7 @@ module LitleOnline
51
51
  'litleTxnId'=>'123456',
52
52
  'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
53
53
  }
54
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
54
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
55
55
  LitleOnlineRequest.new.echeck_sale(hash)
56
56
  end
57
57
  end
@@ -50,7 +50,7 @@ module LitleOnline
50
50
  'litleTxnId'=>'123456',
51
51
  'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
52
52
  }
53
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
53
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
54
54
  LitleOnlineRequest.new.echeck_verification(hash)
55
55
  end
56
56
 
@@ -46,7 +46,7 @@ module LitleOnline
46
46
  'reportGroup'=>'Planets',
47
47
  'litleTxnId'=>'123456',
48
48
  }
49
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
49
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
50
50
  LitleOnlineRequest.new.echeck_void(hash)
51
51
  end
52
52
 
@@ -24,6 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
+ require 'mocha/setup'
27
28
 
28
29
  module LitleOnline
29
30
 
@@ -103,9 +104,31 @@ module LitleOnline
103
104
  'number' =>'4100000000000001',
104
105
  'expDate' =>'1210'
105
106
  }}
106
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
107
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
107
108
  LitleOnlineRequest.new.force_capture(hash)
108
109
  end
110
+
111
+ def test_surcharge_amount
112
+ hash = {
113
+ 'amount' => '2',
114
+ 'surchargeAmount' => '1',
115
+ 'orderSource' => 'ecommerce',
116
+ 'reportGroup' => 'Planets'
117
+ }
118
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
119
+ LitleOnlineRequest.new.force_capture(hash)
120
+ end
121
+
122
+ def test_surcharge_amount_optional
123
+ hash = {
124
+ 'amount' => '2',
125
+ 'orderSource' => 'ecommerce',
126
+ 'reportGroup' => 'Planets'
127
+ }
128
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
129
+ LitleOnlineRequest.new.force_capture(hash)
130
+ end
131
+
109
132
  end
110
133
 
111
134
  end
@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
- require 'mocha'
27
+ require 'mocha/setup'
28
28
 
29
29
  module LitleOnline
30
30
  class TestSale < Test::Unit::TestCase
@@ -285,7 +285,30 @@ module LitleOnline
285
285
  'expDate' =>'1210'
286
286
  }}
287
287
 
288
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
288
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
289
+ LitleOnlineRequest.new.sale(hash)
290
+ end
291
+
292
+ def test_surcharge_amount
293
+ hash = {
294
+ 'orderId' => '12344',
295
+ 'amount' => '2',
296
+ 'surchargeAmount' => '1',
297
+ 'orderSource' => 'ecommerce',
298
+ 'reportGroup' => 'Planets'
299
+ }
300
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
301
+ LitleOnlineRequest.new.sale(hash)
302
+ end
303
+
304
+ def test_surcharge_amount_optional
305
+ hash = {
306
+ 'orderId' => '12344',
307
+ 'amount' => '2',
308
+ 'orderSource' => 'ecommerce',
309
+ 'reportGroup' => 'Planets'
310
+ }
311
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
289
312
  LitleOnlineRequest.new.sale(hash)
290
313
  end
291
314
 
@@ -89,7 +89,7 @@ module LitleOnline
89
89
  'orderId'=>'12344',
90
90
  'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'}
91
91
  }
92
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*loggedInUser="gdake".*merchantSdk="Ruby;8.14.0".*/m), is_a(Hash))
92
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
93
93
  LitleOnlineRequest.new.register_token_request(hash)
94
94
  end
95
95