LitleOnline 8.19.0 → 8.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +5 -13
  2. data/CHANGELOG +34 -0
  3. data/README.md +1 -1
  4. data/Rakefile +2 -2
  5. data/bin/Setup.rb +16 -6
  6. data/lib/LitleBatchRequest.rb +85 -2
  7. data/lib/LitleOnlineRequest.rb +108 -5
  8. data/lib/LitleRequest.rb +14 -9
  9. data/lib/LitleTransaction.rb +152 -3
  10. data/lib/XMLFields.rb +441 -7
  11. data/test/functional/test_activate.rb +100 -0
  12. data/test/functional/test_activateReversal.rb +56 -0
  13. data/test/functional/test_auth.rb +38 -1
  14. data/test/functional/test_balanceInquiry.rb +80 -0
  15. data/test/functional/test_batchStream.rb +145 -0
  16. data/test/functional/test_cancelSubscription.rb +55 -0
  17. data/test/functional/test_captureGivenAuth.rb +32 -2
  18. data/test/functional/test_createPlan.rb +85 -0
  19. data/test/functional/test_credit.rb +22 -1
  20. data/test/functional/test_deactivate.rb +80 -0
  21. data/test/functional/test_deactivateReversal.rb +56 -0
  22. data/test/functional/test_depositReversal.rb +56 -0
  23. data/test/functional/test_forceCapture.rb +23 -1
  24. data/test/functional/test_litle_requests.rb +3 -2
  25. data/test/functional/test_load.rb +82 -0
  26. data/test/functional/test_loadReversal.rb +56 -0
  27. data/test/functional/test_refundReversal.rb +56 -0
  28. data/test/functional/test_sale.rb +23 -1
  29. data/test/functional/test_unload.rb +82 -0
  30. data/test/functional/test_unloadReversal.rb +56 -0
  31. data/test/functional/test_updatePlan.rb +58 -0
  32. data/test/functional/test_updateSubscription.rb +76 -0
  33. data/test/functional/ts_all.rb +21 -2
  34. data/test/unit/test_LitleBatchRequest.rb +47 -2
  35. data/test/unit/test_LitleOnlineRequest.rb +2 -2
  36. data/test/unit/test_activate.rb +92 -0
  37. data/test/{functional/ts_all.rb~ → unit/test_activateReversal.rb} +17 -17
  38. data/test/unit/test_auth.rb +37 -3
  39. data/test/unit/test_balanceInquiry.rb +52 -0
  40. data/test/unit/test_cancelSubscription.rb +43 -0
  41. data/test/unit/test_captureGivenAuth.rb +44 -2
  42. data/test/unit/test_createPlan.rb +52 -0
  43. data/test/unit/test_credit.rb +3 -2
  44. data/test/unit/test_deactivate.rb +52 -0
  45. data/test/unit/test_deactivateReversal.rb +44 -0
  46. data/test/unit/test_depositReversal.rb +44 -0
  47. data/test/unit/test_load.rb +53 -0
  48. data/test/unit/test_loadReversal.rb +44 -0
  49. data/test/unit/test_refundReversal.rb +44 -0
  50. data/test/unit/test_sale.rb +18 -1
  51. data/test/unit/test_unload.rb +53 -0
  52. data/test/unit/test_unloadReversal.rb +44 -0
  53. data/test/unit/test_updatePlan.rb +45 -0
  54. data/test/unit/test_updateSubscription.rb +172 -0
  55. data/test/unit/test_xmlfields.rb +395 -0
  56. data/test/unit/ts_unit.rb +19 -2
  57. metadata +51 -34
  58. data/CHANGELOG~ +0 -81
  59. data/Rakefile~ +0 -93
  60. data/lib/LitleOnlineRequest.rb~ +0 -198
  61. data/lib/LitleRequest.rb~ +0 -513
  62. data/lib/LitleTransaction.rb~ +0 -297
  63. data/lib/XMLFields.rb~ +0 -1380
  64. data/test/unit/test_LitleOnlineRequest.rb~ +0 -296
  65. data/test/unit/test_sale.rb~ +0 -390
  66. data/test/unit/test_xmlfields.rb~ +0 -2515
@@ -0,0 +1,100 @@
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
+ #test Activate Transaction
29
+ module LitleOnline
30
+ class TestActivate < Test::Unit::TestCase
31
+
32
+ def test_simple_card_happy
33
+ hash = {
34
+ 'merchantId' => '101',
35
+ 'version'=>'8.8',
36
+ 'reportGroup'=>'Planets',
37
+ 'orderId' =>'1001',
38
+ 'amount' =>'500',
39
+ 'orderSource' =>'ecommerce',
40
+ 'card'=>{
41
+ 'type'=>'VI',
42
+ 'number' =>'4100000000000001',
43
+ 'expDate' =>'1210'
44
+ }
45
+ }
46
+
47
+ response= LitleOnlineRequest.new.activate(hash)
48
+ assert_equal('Valid Format', response.message)
49
+ end
50
+
51
+ def test_simple_virtualGiftCard_happy
52
+ hash = {
53
+ 'merchantId' => '101',
54
+ 'version'=>'8.8',
55
+ 'reportGroup'=>'Planets',
56
+ 'orderId' =>'1001',
57
+ 'amount' =>'500',
58
+ 'orderSource' =>'ecommerce',
59
+ 'virtualGiftCard'=>{
60
+ 'accountNumberLength'=>'13',
61
+ 'giftCardBin'=>'giftCardBinString'
62
+ }
63
+ }
64
+
65
+ response= LitleOnlineRequest.new.activate(hash)
66
+ assert_equal('Valid Format', response.message)
67
+ end
68
+
69
+ def test_simple_out_of_order
70
+ hash = {
71
+ 'merchantId' => '101',
72
+ 'version'=>'8.8',
73
+ 'reportGroup'=>'Planets',
74
+ 'amount' =>'500',
75
+ 'orderId' =>'1001',
76
+ 'orderSource' =>'ecommerce',
77
+ 'card'=>{
78
+ 'type'=>'VI',
79
+ 'number' =>'4100000000000001',
80
+ 'expDate' =>'1210'
81
+ }
82
+ }
83
+
84
+ response= LitleOnlineRequest.new.activate(hash)
85
+ assert_equal('Valid Format', response.message)
86
+ end
87
+
88
+ def test_simple_error
89
+ hash = {
90
+ 'merchantId' => '101',
91
+ 'version'=>'8.8',
92
+ 'reportGroup'=>'Planets',
93
+ 'amount' =>'500',
94
+ }
95
+
96
+ response= LitleOnlineRequest.new.activate(hash)
97
+ assert(response.message =~ /Error validating xml data against the schema/)
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,56 @@
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
+ #test ActivateReversal Transaction
29
+ module LitleOnline
30
+ class TestActivateReversal < Test::Unit::TestCase
31
+
32
+ def test_simple
33
+ hash = {
34
+ 'merchantId' => '101',
35
+ 'version'=>'8.8',
36
+ 'reportGroup'=>'Planets',
37
+ 'litleTxnId' =>'5000'
38
+ }
39
+
40
+ response= LitleOnlineRequest.new.activate_reversal(hash)
41
+ assert_equal('Valid Format', response.message)
42
+ end
43
+
44
+
45
+ def test_simple_error
46
+ hash = {
47
+ 'merchantId' => '101',
48
+ 'version'=>'8.8',
49
+ 'reportGroup'=>'Planets',
50
+ }
51
+
52
+ response= LitleOnlineRequest.new.activate_reversal(hash)
53
+ assert(response.message =~ /Error validating xml data against the schema/)
54
+ end
55
+ end
56
+ end
@@ -28,6 +28,7 @@ require 'test/unit'
28
28
  #test Authorization Transaction
29
29
  module LitleOnline
30
30
  class TestAuth < Test::Unit::TestCase
31
+
31
32
  def test_simple_auth_with_card
32
33
  hash = {
33
34
  'merchantId' => '101',
@@ -232,6 +233,42 @@ module LitleOnline
232
233
  response= LitleOnlineRequest.new.authorization(hash)
233
234
  assert_equal('000', response.authorizationResponse.response)
234
235
  end
235
-
236
+
237
+ def test_simple_auth_with_advanced_fraud_checks
238
+ hash = {
239
+ 'merchantId' => '101',
240
+ 'version'=>'8.8',
241
+ 'reportGroup'=>'Planets',
242
+ 'orderId'=>'12355',
243
+ 'amount'=>'106',
244
+ 'orderSource'=>'ecommerce',
245
+ 'card'=>{
246
+ 'type'=>'VI',
247
+ 'number' =>'4100000000000000',
248
+ 'expDate' =>'1210'
249
+ },
250
+ 'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
251
+ }
252
+ response= LitleOnlineRequest.new.authorization(hash)
253
+ assert_equal('000', response.authorizationResponse.response)
254
+ end
255
+
256
+ def test_simple_auth_with_mpos
257
+ hash = {
258
+ 'orderId'=>'12344',
259
+ 'amount'=>'106',
260
+ 'orderSource'=>'ecommerce',
261
+ 'mpos'=>
262
+ {
263
+ 'ksn'=>'ksnString',
264
+ 'formatId'=>'30',
265
+ 'encryptedTrack'=>'encryptedTrackString',
266
+ 'track1Status'=>'0',
267
+ 'track2Status'=>'0'
268
+ }
269
+ }
270
+ response= LitleOnlineRequest.new.authorization(hash)
271
+ assert_equal('000', response.authorizationResponse.response)
272
+ end
236
273
  end
237
274
  end
@@ -0,0 +1,80 @@
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
+ #test BalanceInquiry Transaction
29
+ module LitleOnline
30
+ class TestBalanceInquiry < Test::Unit::TestCase
31
+
32
+ def test_simple_happy
33
+ hash = {
34
+ 'merchantId' => '101',
35
+ 'version'=>'8.8',
36
+ 'reportGroup'=>'Planets',
37
+ 'orderId' =>'1001',
38
+ 'orderSource' =>'ecommerce',
39
+ 'card'=>{
40
+ 'type'=>'VI',
41
+ 'number' =>'4100000000000001',
42
+ 'expDate' =>'1210'
43
+ }
44
+ }
45
+
46
+ response= LitleOnlineRequest.new.balance_inquiry(hash)
47
+ assert_equal('Valid Format', response.message)
48
+ end
49
+
50
+ def test_simple_out_of_order
51
+ hash = {
52
+ 'merchantId' => '101',
53
+ 'version'=>'8.8',
54
+ 'reportGroup'=>'Planets',
55
+ 'orderSource' =>'ecommerce',
56
+ 'orderId' =>'1001',
57
+ 'card'=>{
58
+ 'type'=>'VI',
59
+ 'number' =>'4100000000000001',
60
+ 'expDate' =>'1210'
61
+ }
62
+ }
63
+
64
+ response= LitleOnlineRequest.new.balance_inquiry(hash)
65
+ assert_equal('Valid Format', response.message)
66
+ end
67
+
68
+ def test_simple_error
69
+ hash = {
70
+ 'merchantId' => '101',
71
+ 'version'=>'8.8',
72
+ 'reportGroup'=>'Planets',
73
+ 'amount' =>'500',
74
+ }
75
+
76
+ response= LitleOnlineRequest.new.balance_inquiry(hash)
77
+ assert(response.message =~ /Error validating xml data against the schema/)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,145 @@
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
+ require 'fileutils'
28
+
29
+ module LitleOnline
30
+ class TestLitleBatchStream < Test::Unit::TestCase
31
+
32
+ def setup
33
+ dir = '/tmp/litle-sdk-for-ruby-test'
34
+ FileUtils.rm_rf dir
35
+ Dir.mkdir dir
36
+ end
37
+
38
+ def test_full_flow
39
+ saleHash = {
40
+ 'reportGroup'=>'Planets',
41
+ 'id' => '006',
42
+ 'orderId'=>'12344',
43
+ 'amount'=>'6000',
44
+ 'orderSource'=>'ecommerce',
45
+ 'card'=>{
46
+ 'type'=>'VI',
47
+ 'number' =>'4100000000000001',
48
+ 'expDate' =>'1210'
49
+ }}
50
+
51
+ dir = '/tmp'
52
+
53
+ request = LitleRequest.new()
54
+ request.create_new_litle_request(dir + '/litle-sdk-for-ruby-test')
55
+
56
+ entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
57
+ entries.sort!
58
+
59
+ assert_equal entries.size, 4
60
+ assert_not_nil entries[2] =~ /request_\d+\z/
61
+ assert_not_nil entries[3] =~ /request_\d+_batches\z/
62
+
63
+ #create five batches, each with 10 sales
64
+
65
+ batch = LitleBatchRequest.new
66
+ batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
67
+
68
+ cancelSubscriptionHash =
69
+ {
70
+ 'subscriptionId'=>'100'
71
+ }
72
+ batch.cancel_subscription(cancelSubscriptionHash)
73
+
74
+ updateSubscriptionHash =
75
+ {
76
+ 'subscriptionId'=>'1000'
77
+ }
78
+ batch.update_subscription(updateSubscriptionHash)
79
+
80
+ createPlanHash ={
81
+ 'merchantId' => '101',
82
+ 'version'=>'8.8',
83
+ 'reportGroup'=>'Planets',
84
+ 'planCode'=>'createPlanCodeString',
85
+ 'name'=>'nameString',
86
+ 'description'=>'descriptionString',
87
+ 'intervalType'=>'ANNUAL',
88
+ 'amount'=>'500',
89
+ 'numberOfPayments'=>'2',
90
+ 'trialNumberOfIntervals'=>'1',
91
+ 'trialIntervalType'=>'MONTH',
92
+ 'active'=>'true'
93
+ }
94
+ batch.create_plan(createPlanHash)
95
+
96
+ updatePlanHash ={
97
+ 'merchantId' => '101',
98
+ 'version'=>'8.8',
99
+ 'reportGroup'=>'Planets',
100
+ 'planCode'=>'updatePlanCodeString',
101
+ 'active'=>'true'
102
+ }
103
+
104
+ batch.update_plan(updatePlanHash)
105
+
106
+ #close the batch, indicating we plan to add no more transactions
107
+ batch.close_batch()
108
+
109
+
110
+ #add the batch to the LitleRequest
111
+ request.commit_batch(batch)
112
+
113
+ #finish the Litle Request, indicating we plan to add no more batches
114
+ request.finish_request
115
+ entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
116
+ assert_equal entries.length, 3
117
+ entries.sort!
118
+ assert_not_nil entries[2] =~ /request_\d+.complete\z/
119
+
120
+ #send the batch files at the given directory over sFTP
121
+ request.send_to_litle_stream
122
+ request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
123
+ type = transaction["type"]
124
+
125
+ if(type == "cancelSubscriptionResponse") then
126
+ assert_equal "100" ,transaction["subscriptionId"]
127
+ end
128
+
129
+ if(type == "updateSubscriptionResponse") then
130
+ assert_equal "1000" ,transaction["subscriptionId"]
131
+ end
132
+
133
+ if(type == "createPlanResponse") then
134
+ assert_equal "createPlanCodeString" ,transaction["planCode"]
135
+ end
136
+
137
+ if(type == "updatePlanResponse") then
138
+ assert_equal "updatePlanCodeString" ,transaction["planCode"]
139
+ end
140
+
141
+ end})
142
+
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,55 @@
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
+ #test Authorization Transaction
29
+ module LitleOnline
30
+ class TestCancelSubscription < Test::Unit::TestCase
31
+ def test_simple_happy
32
+ hash = {
33
+ 'merchantId' => '101',
34
+ 'version'=>'8.8',
35
+ 'reportGroup'=>'Planets',
36
+ 'subscriptionId' =>'1001'
37
+ }
38
+
39
+ response= LitleOnlineRequest.new.cancel_subscription(hash)
40
+ assert_equal('Valid Format', response.message)
41
+ end
42
+
43
+ def test_simple_error
44
+ hash = {
45
+ 'merchantId' => '101',
46
+ 'version'=>'8.8',
47
+ 'reportGroup'=>'Planets',
48
+ }
49
+
50
+ response= LitleOnlineRequest.new.cancel_subscription(hash)
51
+ assert(response.message =~ /Error validating xml data against the schema/)
52
+ end
53
+
54
+ end
55
+ end