LitleOnline 8.12.0 → 8.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/CHANGELOG +28 -0
  2. data/Rakefile +2 -3
  3. data/lib/Communications.rb +14 -12
  4. data/lib/LitleOnline.rb +11 -2
  5. data/lib/LitleOnlineRequest.rb +435 -284
  6. data/lib/LitleXmlMapper.rb +1 -2
  7. data/lib/XMLFields.rb +900 -307
  8. data/lib/cacert.pem +3331 -0
  9. data/test/certification/certTest2_authenhanced.rb +7 -7
  10. data/test/certification/certTest5_token.rb +8 -8
  11. data/test/functional/test_auth.rb +106 -3
  12. data/test/functional/test_authReversal.rb +5 -6
  13. data/test/functional/test_capture.rb +12 -1
  14. data/test/functional/test_captureGivenAuth.rb +25 -5
  15. data/test/functional/test_credit.rb +1 -1
  16. data/test/functional/test_echeckRedeposit.rb +34 -0
  17. data/test/functional/test_echeckVerification.rb +33 -0
  18. data/test/functional/test_forceCapture.rb +35 -0
  19. data/test/functional/test_sale.rb +45 -13
  20. data/test/functional/test_xmlfields.rb +197 -10
  21. data/test/functional/ts_all.rb +2 -0
  22. data/test/unit/test_LitleOnlineRequest.rb +2 -59
  23. data/test/unit/test_auth.rb +2 -51
  24. data/test/unit/test_authReversal.rb +10 -5
  25. data/test/unit/test_capture.rb +5 -7
  26. data/test/unit/test_captureGivenAuth.rb +0 -19
  27. data/test/unit/test_credit.rb +1 -0
  28. data/test/unit/test_echeckCredit.rb +0 -2
  29. data/test/unit/test_echeckRedeposit.rb +0 -34
  30. data/test/unit/test_echeckSale.rb +0 -1
  31. data/test/unit/test_echeckVerification.rb +0 -33
  32. data/test/unit/test_forceCapture.rb +0 -35
  33. data/test/unit/test_sale.rb +20 -51
  34. data/test/unit/test_xmlfields.rb +44 -84
  35. data/test/unit/ts_unit.rb +1 -1
  36. metadata +13 -26
  37. data/index.html +0 -176
  38. data/index.html.1 +0 -176
  39. data/lib/Checker.rb +0 -56
  40. 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
@@ -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