LitleOnline 8.12.0 → 8.12.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +28 -0
- data/Rakefile +2 -3
- data/lib/Communications.rb +14 -12
- data/lib/LitleOnline.rb +11 -2
- data/lib/LitleOnlineRequest.rb +435 -284
- data/lib/LitleXmlMapper.rb +1 -2
- data/lib/XMLFields.rb +900 -307
- data/lib/cacert.pem +3331 -0
- data/test/certification/certTest2_authenhanced.rb +7 -7
- data/test/certification/certTest5_token.rb +8 -8
- data/test/functional/test_auth.rb +106 -3
- data/test/functional/test_authReversal.rb +5 -6
- data/test/functional/test_capture.rb +12 -1
- data/test/functional/test_captureGivenAuth.rb +25 -5
- data/test/functional/test_credit.rb +1 -1
- data/test/functional/test_echeckRedeposit.rb +34 -0
- data/test/functional/test_echeckVerification.rb +33 -0
- data/test/functional/test_forceCapture.rb +35 -0
- data/test/functional/test_sale.rb +45 -13
- data/test/functional/test_xmlfields.rb +197 -10
- data/test/functional/ts_all.rb +2 -0
- data/test/unit/test_LitleOnlineRequest.rb +2 -59
- data/test/unit/test_auth.rb +2 -51
- data/test/unit/test_authReversal.rb +10 -5
- data/test/unit/test_capture.rb +5 -7
- data/test/unit/test_captureGivenAuth.rb +0 -19
- data/test/unit/test_credit.rb +1 -0
- data/test/unit/test_echeckCredit.rb +0 -2
- data/test/unit/test_echeckRedeposit.rb +0 -34
- data/test/unit/test_echeckSale.rb +0 -1
- data/test/unit/test_echeckVerification.rb +0 -33
- data/test/unit/test_forceCapture.rb +0 -35
- data/test/unit/test_sale.rb +20 -51
- data/test/unit/test_xmlfields.rb +44 -84
- data/test/unit/ts_unit.rb +1 -1
- metadata +13 -26
- data/index.html +0 -176
- data/index.html.1 +0 -176
- data/lib/Checker.rb +0 -56
- data/test/unit/test_Checker.rb +0 -58
data/lib/Checker.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
Copyright (c) 2011 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
|
-
|
26
|
-
#
|
27
|
-
# Used to Handle verification of Ruby Hash data
|
28
|
-
#
|
29
|
-
class Checker
|
30
|
-
#checks for empty,flagged and null hashes and deletes them
|
31
|
-
def Checker.purge_null(hash)
|
32
|
-
hash.each_key do |i|
|
33
|
-
if (hash[i] == nil or hash[i] =={} or hash[i] == 'throwFlag')
|
34
|
-
hash.delete(i)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
#checks if Required Fileds are missing and raises and error
|
40
|
-
def Checker.required_missing(hash)
|
41
|
-
hash.each_key do |i|
|
42
|
-
if hash[i] == 'REQUIRED'
|
43
|
-
raise "Missing Required Field: #{i}!!!!"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
#checks if one and only one field is filled out when given a choice between fields
|
49
|
-
def Checker.choice(hash)
|
50
|
-
hash = purge_null(hash)
|
51
|
-
if hash.length > 1
|
52
|
-
raise 'Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!'
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
data/test/unit/test_Checker.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
Copyright (c) 2011 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 'lib/LitleOnlineRequest'
|
27
|
-
require 'test/unit'
|
28
|
-
require 'mocha'
|
29
|
-
|
30
|
-
class CheckerTest < Test::Unit::TestCase
|
31
|
-
def test_purge_null
|
32
|
-
hash = {'a'=>'one','b'=>nil,'c'=>{},'d'=>{'e'=>'two'},'f'=>'throwFlag'}
|
33
|
-
Checker.purge_null(hash)
|
34
|
-
assert_equal 2, hash.length
|
35
|
-
assert_equal 'one', hash['a']
|
36
|
-
assert_equal 'two', hash['d']['e']
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_required_missing
|
40
|
-
hash = {'a'=>'REQUIRED','b'=>'2'}
|
41
|
-
exception = assert_raise(RuntimeError){Checker.required_missing(hash)}
|
42
|
-
assert_match /Missing Required Field: a!!!!/, exception.message
|
43
|
-
|
44
|
-
hash = {'a'=>'1','b'=>'2'}
|
45
|
-
assert_nothing_raised {Checker.required_missing(hash)}
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_choice
|
49
|
-
assert_nothing_raised {Checker.choice({})}
|
50
|
-
|
51
|
-
assert_nothing_raised {Checker.choice({'a'=>'1'})}
|
52
|
-
assert_nothing_raised {Checker.choice({'a'=>'1','b'=>nil})}
|
53
|
-
|
54
|
-
exception = assert_raise(RuntimeError) {Checker.choice({'a'=>'1','b'=>'2'})}
|
55
|
-
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|