LitleOnline 8.19.0 → 8.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG +34 -0
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/bin/Setup.rb +16 -6
- data/lib/LitleBatchRequest.rb +85 -2
- data/lib/LitleOnlineRequest.rb +108 -5
- data/lib/LitleRequest.rb +14 -9
- data/lib/LitleTransaction.rb +152 -3
- data/lib/XMLFields.rb +441 -7
- data/test/functional/test_activate.rb +100 -0
- data/test/functional/test_activateReversal.rb +56 -0
- data/test/functional/test_auth.rb +38 -1
- data/test/functional/test_balanceInquiry.rb +80 -0
- data/test/functional/test_batchStream.rb +145 -0
- data/test/functional/test_cancelSubscription.rb +55 -0
- data/test/functional/test_captureGivenAuth.rb +32 -2
- data/test/functional/test_createPlan.rb +85 -0
- data/test/functional/test_credit.rb +22 -1
- data/test/functional/test_deactivate.rb +80 -0
- data/test/functional/test_deactivateReversal.rb +56 -0
- data/test/functional/test_depositReversal.rb +56 -0
- data/test/functional/test_forceCapture.rb +23 -1
- data/test/functional/test_litle_requests.rb +3 -2
- data/test/functional/test_load.rb +82 -0
- data/test/functional/test_loadReversal.rb +56 -0
- data/test/functional/test_refundReversal.rb +56 -0
- data/test/functional/test_sale.rb +23 -1
- data/test/functional/test_unload.rb +82 -0
- data/test/functional/test_unloadReversal.rb +56 -0
- data/test/functional/test_updatePlan.rb +58 -0
- data/test/functional/test_updateSubscription.rb +76 -0
- data/test/functional/ts_all.rb +21 -2
- data/test/unit/test_LitleBatchRequest.rb +47 -2
- data/test/unit/test_LitleOnlineRequest.rb +2 -2
- data/test/unit/test_activate.rb +92 -0
- data/test/{functional/ts_all.rb~ → unit/test_activateReversal.rb} +17 -17
- data/test/unit/test_auth.rb +37 -3
- data/test/unit/test_balanceInquiry.rb +52 -0
- data/test/unit/test_cancelSubscription.rb +43 -0
- data/test/unit/test_captureGivenAuth.rb +44 -2
- data/test/unit/test_createPlan.rb +52 -0
- data/test/unit/test_credit.rb +3 -2
- data/test/unit/test_deactivate.rb +52 -0
- data/test/unit/test_deactivateReversal.rb +44 -0
- data/test/unit/test_depositReversal.rb +44 -0
- data/test/unit/test_load.rb +53 -0
- data/test/unit/test_loadReversal.rb +44 -0
- data/test/unit/test_refundReversal.rb +44 -0
- data/test/unit/test_sale.rb +18 -1
- data/test/unit/test_unload.rb +53 -0
- data/test/unit/test_unloadReversal.rb +44 -0
- data/test/unit/test_updatePlan.rb +45 -0
- data/test/unit/test_updateSubscription.rb +172 -0
- data/test/unit/test_xmlfields.rb +395 -0
- data/test/unit/ts_unit.rb +19 -2
- metadata +51 -34
- data/CHANGELOG~ +0 -81
- data/Rakefile~ +0 -93
- data/lib/LitleOnlineRequest.rb~ +0 -198
- data/lib/LitleRequest.rb~ +0 -513
- data/lib/LitleTransaction.rb~ +0 -297
- data/lib/XMLFields.rb~ +0 -1380
- data/test/unit/test_LitleOnlineRequest.rb~ +0 -296
- data/test/unit/test_sale.rb~ +0 -390
- data/test/unit/test_xmlfields.rb~ +0 -2515
@@ -147,7 +147,12 @@ module LitleOnline
|
|
147
147
|
'authInformation' => {
|
148
148
|
'authDate'=>'2002-10-09','authCode'=>'543216',
|
149
149
|
'authAmount'=>'12345','fraudResult'=>{'avsResult'=>'12','cardValidationResult'=>'123','authenticationResult'=>'1',
|
150
|
-
'advancedAVSResult'=>'123'
|
150
|
+
'advancedAVSResult'=>'123',
|
151
|
+
'advancedFraudResults' => {'deviceReviewStatus' => 'deviceReviewStatusString',
|
152
|
+
'deviceReputationScore' => '100',
|
153
|
+
'triggeredRule' => ['rule1','rule2']
|
154
|
+
}
|
155
|
+
}
|
151
156
|
},
|
152
157
|
'orderSource'=>'ecommerce',
|
153
158
|
'card'=>{
|
@@ -178,5 +183,30 @@ module LitleOnline
|
|
178
183
|
response= LitleOnlineRequest.new.capture_given_auth(hash)
|
179
184
|
assert(response.message =~ /Error validating xml data against the schema/)
|
180
185
|
end
|
186
|
+
|
187
|
+
def test_simple_captureGivenAuth_with_mpos
|
188
|
+
hash = {
|
189
|
+
'merchantId' => '101',
|
190
|
+
'version'=>'8.8',
|
191
|
+
'reportGroup'=>'Planets',
|
192
|
+
'orderId'=>'12344',
|
193
|
+
'amount'=>'106',
|
194
|
+
'authInformation' => {
|
195
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
196
|
+
'authAmount'=>'12345'
|
197
|
+
},
|
198
|
+
'orderSource'=>'ecommerce',
|
199
|
+
'mpos'=>
|
200
|
+
{
|
201
|
+
'ksn'=>'ksnString',
|
202
|
+
'formatId'=>'30',
|
203
|
+
'encryptedTrack'=>'encryptedTrackString',
|
204
|
+
'track1Status'=>'0',
|
205
|
+
'track2Status'=>'0'
|
206
|
+
}
|
207
|
+
}
|
208
|
+
response= LitleOnlineRequest.new.capture_given_auth(hash)
|
209
|
+
assert_equal('Valid Format', response.message)
|
210
|
+
end
|
181
211
|
end
|
182
|
-
end
|
212
|
+
end
|
@@ -0,0 +1,85 @@
|
|
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 TestCreatePlan < Test::Unit::TestCase
|
31
|
+
|
32
|
+
def test_simple_happy
|
33
|
+
hash ={
|
34
|
+
'merchantId' => '101',
|
35
|
+
'version'=>'8.8',
|
36
|
+
'reportGroup'=>'Planets',
|
37
|
+
'planCode'=>'planCodeString',
|
38
|
+
'name'=>'nameString',
|
39
|
+
'description'=>'descriptionString',
|
40
|
+
'intervalType'=>'ANNUAL',
|
41
|
+
'amount'=>'500',
|
42
|
+
'numberOfPayments'=>'2',
|
43
|
+
'trialNumberOfIntervals'=>'1',
|
44
|
+
'trialIntervalType'=>'MONTH',
|
45
|
+
'active'=>'true'
|
46
|
+
}
|
47
|
+
|
48
|
+
response= LitleOnlineRequest.new.create_plan(hash)
|
49
|
+
assert_equal('Valid Format', response.message)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_simple_out_of_order
|
53
|
+
hash ={
|
54
|
+
'merchantId' => '101',
|
55
|
+
'version'=>'8.8',
|
56
|
+
'reportGroup'=>'Planets',
|
57
|
+
'planCode'=>'planCodeString',
|
58
|
+
'name'=>'nameString',
|
59
|
+
'intervalType'=>'ANNUAL',
|
60
|
+
'description'=>'descriptionString',
|
61
|
+
'amount'=>'500',
|
62
|
+
'numberOfPayments'=>'2',
|
63
|
+
'trialNumberOfIntervals'=>'1',
|
64
|
+
'trialIntervalType'=>'MONTH',
|
65
|
+
'active'=>'true'
|
66
|
+
}
|
67
|
+
|
68
|
+
response= LitleOnlineRequest.new.create_plan(hash)
|
69
|
+
assert_equal('Valid Format', response.message)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_simple_error
|
73
|
+
hash = {
|
74
|
+
'merchantId' => '101',
|
75
|
+
'version'=>'8.8',
|
76
|
+
'reportGroup'=>'Planets',
|
77
|
+
'amount' =>'500',
|
78
|
+
'intervalType'=>'ANNUAL',
|
79
|
+
}
|
80
|
+
|
81
|
+
response= LitleOnlineRequest.new.create_plan(hash)
|
82
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -132,5 +132,26 @@ module LitleOnline
|
|
132
132
|
response= LitleOnlineRequest.new.credit(hash)
|
133
133
|
assert_equal('Valid Format', response.message)
|
134
134
|
end
|
135
|
+
|
136
|
+
def test_simple_credit_with_mpos
|
137
|
+
hash = {
|
138
|
+
'merchantId' => '101',
|
139
|
+
'version'=>'8.8',
|
140
|
+
'reportGroup'=>'Planets',
|
141
|
+
'orderId'=>'12344',
|
142
|
+
'amount'=>'106',
|
143
|
+
'orderSource'=>'ecommerce',
|
144
|
+
'mpos'=>
|
145
|
+
{
|
146
|
+
'ksn'=>'ksnString',
|
147
|
+
'formatId'=>'30',
|
148
|
+
'encryptedTrack'=>'encryptedTrackString',
|
149
|
+
'track1Status'=>'0',
|
150
|
+
'track2Status'=>'0'
|
151
|
+
}
|
152
|
+
}
|
153
|
+
response= LitleOnlineRequest.new.credit(hash)
|
154
|
+
assert_equal('Valid Format', response.message)
|
155
|
+
end
|
135
156
|
end
|
136
|
-
end
|
157
|
+
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 Deactivate Transaction
|
29
|
+
module LitleOnline
|
30
|
+
class TestDeactivate < 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.deactivate(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.deactivate(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.deactivate(hash)
|
77
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
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 DeactivateReversal Transaction
|
29
|
+
module LitleOnline
|
30
|
+
class TestDectivateReversal < 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.deactivate_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.deactivate_reversal(hash)
|
53
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
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 DepositReversal Transaction
|
29
|
+
module LitleOnline
|
30
|
+
class TestDepositReversal < 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.deposit_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.deposit_reversal(hash)
|
53
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -136,7 +136,29 @@ module LitleOnline
|
|
136
136
|
response= LitleOnlineRequest.new.force_capture(hash)
|
137
137
|
assert(response.message =~ /Error validating xml data against the schema/)
|
138
138
|
end
|
139
|
+
|
140
|
+
def test_simple_forceCapture_with_mpos
|
141
|
+
hash = {
|
142
|
+
'merchantId' => '101',
|
143
|
+
'version'=>'8.8',
|
144
|
+
'reportGroup'=>'Planets',
|
145
|
+
'litleTxnId'=>'123456',
|
146
|
+
'orderId'=>'12344',
|
147
|
+
'amount'=>'106',
|
148
|
+
'orderSource'=>'ecommerce',
|
149
|
+
'mpos'=>
|
150
|
+
{
|
151
|
+
'ksn'=>'ksnString',
|
152
|
+
'formatId'=>'30',
|
153
|
+
'encryptedTrack'=>'encryptedTrackString',
|
154
|
+
'track1Status'=>'0',
|
155
|
+
'track2Status'=>'0'
|
156
|
+
}
|
157
|
+
}
|
158
|
+
response= LitleOnlineRequest.new.force_capture(hash)
|
159
|
+
assert_equal('000', response.forceCaptureResponse.response)
|
160
|
+
end
|
139
161
|
|
140
162
|
end
|
141
163
|
|
142
|
-
end
|
164
|
+
end
|
@@ -290,9 +290,10 @@ module LitleOnline
|
|
290
290
|
#add the same sale ten times
|
291
291
|
10.times{
|
292
292
|
#batch.account_update(accountUpdateHash)
|
293
|
+
saleHash['card']['number']= (saleHash['card']['number'].to_i + 1).to_s
|
293
294
|
batch.sale(saleHash)
|
294
295
|
}
|
295
|
-
|
296
|
+
|
296
297
|
#close the batch, indicating we plan to add no more transactions
|
297
298
|
batch.close_batch()
|
298
299
|
entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
|
@@ -352,4 +353,4 @@ module LitleOnline
|
|
352
353
|
end
|
353
354
|
end
|
354
355
|
end
|
355
|
-
end
|
356
|
+
end
|
@@ -0,0 +1,82 @@
|
|
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 Load Transaction
|
29
|
+
module LitleOnline
|
30
|
+
class TestLoad < 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
|
+
'amount' =>'500',
|
39
|
+
'orderSource' =>'ecommerce',
|
40
|
+
'card'=>{
|
41
|
+
'type'=>'VI',
|
42
|
+
'number' =>'4100000000000001',
|
43
|
+
'expDate' =>'1210'
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
response= LitleOnlineRequest.new.load_request(hash)
|
48
|
+
assert_equal('Valid Format', response.message)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_simple_out_of_order
|
52
|
+
hash = {
|
53
|
+
'merchantId' => '101',
|
54
|
+
'version'=>'8.8',
|
55
|
+
'reportGroup'=>'Planets',
|
56
|
+
'amount' =>'500',
|
57
|
+
'orderId' =>'1001',
|
58
|
+
'orderSource' =>'ecommerce',
|
59
|
+
'card'=>{
|
60
|
+
'type'=>'VI',
|
61
|
+
'number' =>'4100000000000001',
|
62
|
+
'expDate' =>'1210'
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
response= LitleOnlineRequest.new.load_request(hash)
|
67
|
+
assert_equal('Valid Format', response.message)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_simple_error
|
71
|
+
hash = {
|
72
|
+
'merchantId' => '101',
|
73
|
+
'version'=>'8.8',
|
74
|
+
'reportGroup'=>'Planets',
|
75
|
+
'amount' =>'500',
|
76
|
+
}
|
77
|
+
|
78
|
+
response= LitleOnlineRequest.new.load_request(hash)
|
79
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|