LitleOnline 8.12.3 → 8.12.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG +4 -0
  2. data/Rakefile +1 -1
  3. data/lib/Communications.rb +34 -32
  4. data/lib/Configuration.rb +13 -11
  5. data/lib/LitleOnline.rb +0 -1
  6. data/lib/LitleOnlineRequest.rb +546 -543
  7. data/lib/LitleXmlMapper.rb +17 -15
  8. data/lib/XMLFields.rb +903 -901
  9. data/test/certification/certTest1_base.rb +935 -933
  10. data/test/certification/certTest2_authenhanced.rb +548 -546
  11. data/test/certification/certTest3_authreversal.rb +179 -177
  12. data/test/certification/certTest4_echeck.rb +245 -243
  13. data/test/certification/certTest5_token.rb +198 -196
  14. data/test/functional/test_auth.rb +205 -204
  15. data/test/functional/test_authReversal.rb +41 -39
  16. data/test/functional/test_capture.rb +54 -52
  17. data/test/functional/test_captureGivenAuth.rb +153 -152
  18. data/test/functional/test_credit.rb +126 -126
  19. data/test/functional/test_echeckCredit.rb +88 -87
  20. data/test/functional/test_echeckRedeposit.rb +85 -84
  21. data/test/functional/test_echeckSale.rb +132 -131
  22. data/test/functional/test_echeckVerification.rb +97 -95
  23. data/test/functional/test_forceCapture.rb +113 -111
  24. data/test/functional/test_sale.rb +200 -198
  25. data/test/functional/test_token.rb +75 -73
  26. data/test/functional/test_xmlfields.rb +558 -558
  27. data/test/unit/test_LitleOnlineRequest.rb +210 -207
  28. data/test/unit/test_auth.rb +119 -116
  29. data/test/unit/test_authReversal.rb +16 -16
  30. data/test/unit/test_capture.rb +10 -8
  31. data/test/unit/test_captureGivenAuth.rb +62 -59
  32. data/test/unit/test_credit.rb +103 -100
  33. data/test/unit/test_echeckCredit.rb +15 -14
  34. data/test/unit/test_echeckRedeposit.rb +14 -13
  35. data/test/unit/test_echeckSale.rb +16 -15
  36. data/test/unit/test_echeckVerification.rb +14 -13
  37. data/test/unit/test_forceCapture.rb +61 -58
  38. data/test/unit/test_sale.rb +206 -205
  39. data/test/unit/test_token.rb +43 -41
  40. data/test/unit/test_xmlfields.rb +101 -99
  41. metadata +58 -77
  42. data/lib/Obj2xml.rb +0 -37
@@ -26,21 +26,21 @@ require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
  require 'mocha'
28
28
 
29
- class TestAuthReversal < Test::Unit::TestCase
30
- def test_invalid_field
31
- hash = {
32
- 'merchantId' => '101',
33
- 'version'=>'8.8',
34
- 'litleTxnId'=>'12345678000',
35
- 'NonexistentField'=>'none',
36
- 'payPalNotes'=>'Notes',
37
- 'amount'=>'106',
38
- 'reportGroup'=>'Planets',
39
- }
40
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>12345678000<\/litleTxnId>.*/m), is_a(Hash))
41
- LitleOnlineRequest.new.auth_reversal(hash)
42
-
43
- end
29
+ module LitleOnline
30
+ class TestAuthReversal < Test::Unit::TestCase
31
+ def test_invalid_field
32
+ hash = {
33
+ 'merchantId' => '101',
34
+ 'version'=>'8.8',
35
+ 'litleTxnId'=>'12345678000',
36
+ 'NonexistentField'=>'none',
37
+ 'payPalNotes'=>'Notes',
38
+ 'amount'=>'106',
39
+ 'reportGroup'=>'Planets',
40
+ }
41
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>12345678000<\/litleTxnId>.*/m), is_a(Hash))
42
+ LitleOnlineRequest.new.auth_reversal(hash)
44
43
 
45
-
44
+ end
45
+ end
46
46
  end
@@ -25,14 +25,16 @@ OTHER DEALINGS IN THE SOFTWARE.
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
- class Test_capture < Test::Unit::TestCase
29
- def test_success_capture
30
- hash = {
31
- 'litleTxnId'=>'123456'
32
- }
33
-
34
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>123456<\/litleTxnId>.*/m), is_a(Hash))
35
- LitleOnlineRequest.new.capture(hash)
28
+ module LitleOnline
29
+ class Test_capture < Test::Unit::TestCase
30
+ def test_success_capture
31
+ hash = {
32
+ 'litleTxnId'=>'123456'
33
+ }
34
+
35
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>123456<\/litleTxnId>.*/m), is_a(Hash))
36
+ LitleOnlineRequest.new.capture(hash)
37
+ end
36
38
  end
37
39
  end
38
40
 
@@ -25,65 +25,68 @@ OTHER DEALINGS IN THE SOFTWARE.
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
- class TestcaptureGivenAuth < Test::Unit::TestCase
28
+ module LitleOnline
29
29
 
30
- def test_both_choices_card_and_token
31
- hash = {
32
- 'merchantId' => '101',
33
- 'version'=>'8.8',
34
- 'reportGroup'=>'Planets',
35
- 'orderId'=>'12344',
36
- 'amount'=>'106',
37
- 'orderSource'=>'ecommerce',
38
- 'authInformation' => {
39
- 'authDate'=>'2002-10-09','authCode'=>'543216',
40
- 'authAmount'=>'12345'
41
- },
42
- 'token'=> {
43
- 'litleToken'=>'123456789101112',
44
- 'expDate'=>'1210',
45
- 'cardValidationNum'=>'555',
46
- 'type'=>'VI'},
47
- 'card'=>{
48
- 'type'=>'VI',
49
- 'number' =>'4100000000000001',
50
- 'expDate' =>'1210'
51
- }}
52
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.capture_given_auth(hash)}
53
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
30
+ class TestcaptureGivenAuth < Test::Unit::TestCase
31
+
32
+ def test_both_choices_card_and_token
33
+ hash = {
34
+ 'merchantId' => '101',
35
+ 'version'=>'8.8',
36
+ 'reportGroup'=>'Planets',
37
+ 'orderId'=>'12344',
38
+ 'amount'=>'106',
39
+ 'orderSource'=>'ecommerce',
40
+ 'authInformation' => {
41
+ 'authDate'=>'2002-10-09','authCode'=>'543216',
42
+ 'authAmount'=>'12345'
43
+ },
44
+ 'token'=> {
45
+ 'litleToken'=>'123456789101112',
46
+ 'expDate'=>'1210',
47
+ 'cardValidationNum'=>'555',
48
+ 'type'=>'VI'},
49
+ 'card'=>{
50
+ 'type'=>'VI',
51
+ 'number' =>'4100000000000001',
52
+ 'expDate' =>'1210'
53
+ }}
54
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.capture_given_auth(hash)}
55
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
56
+ end
57
+
58
+ def test_all_three_choices
59
+ hash = {
60
+ 'merchantId' => '101',
61
+ 'version'=>'8.8',
62
+ 'reportGroup'=>'Planets',
63
+ 'orderId'=>'12344',
64
+ 'amount'=>'106',
65
+ 'orderSource'=>'ecommerce',
66
+ 'authInformation' => {
67
+ 'authDate'=>'2002-10-09','authCode'=>'543216',
68
+ 'authAmount'=>'12345'
69
+ },
70
+ 'card'=>{
71
+ 'type'=>'VI',
72
+ 'number' =>'4100000000000001',
73
+ 'expDate' =>'1210'
74
+ },
75
+ 'paypage'=> {
76
+ 'paypageRegistrationId'=>'1234',
77
+ 'expDate'=>'1210',
78
+ 'cardValidationNum'=>'555',
79
+ 'type'=>'VI'},
80
+ 'token'=> {
81
+ 'litleToken'=>'1234',
82
+ 'expDate'=>'1210',
83
+ 'cardValidationNum'=>'555',
84
+ 'type'=>'VI'
85
+ }}
86
+
87
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.capture_given_auth(hash)}
88
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
89
+ end
54
90
  end
55
91
 
56
- def test_all_three_choices
57
- hash = {
58
- 'merchantId' => '101',
59
- 'version'=>'8.8',
60
- 'reportGroup'=>'Planets',
61
- 'orderId'=>'12344',
62
- 'amount'=>'106',
63
- 'orderSource'=>'ecommerce',
64
- 'authInformation' => {
65
- 'authDate'=>'2002-10-09','authCode'=>'543216',
66
- 'authAmount'=>'12345'
67
- },
68
- 'card'=>{
69
- 'type'=>'VI',
70
- 'number' =>'4100000000000001',
71
- 'expDate' =>'1210'
72
- },
73
- 'paypage'=> {
74
- 'paypageRegistrationId'=>'1234',
75
- 'expDate'=>'1210',
76
- 'cardValidationNum'=>'555',
77
- 'type'=>'VI'},
78
- 'token'=> {
79
- 'litleToken'=>'1234',
80
- 'expDate'=>'1210',
81
- 'cardValidationNum'=>'555',
82
- 'type'=>'VI'
83
- }}
84
-
85
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.capture_given_auth(hash)}
86
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
87
- end
88
- end
89
-
92
+ end
@@ -26,106 +26,109 @@ require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
  require 'mocha'
28
28
 
29
- class TestCredit < Test::Unit::TestCase
30
- def test_both_choices_card_and_paypal
31
- hash = {
32
- 'merchantId' => '101',
33
- 'version'=>'8.8',
34
- 'reportGroup'=>'Planets',
35
- 'orderId'=>'12344',
36
- 'amount'=>'106',
37
- 'orderSource'=>'ecommerce',
38
- 'card'=>{
39
- 'type'=>'VI',
40
- 'number' =>'4100000000000001',
41
- 'expDate' =>'1210'
42
- },
43
- 'paypal'=>{
44
- 'payerId'=>'1234',
45
- 'token'=>'1234',
46
- 'transactionId'=>'123456'
47
- }}
48
-
49
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
50
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
51
- end
52
-
53
- def test_three_choices_card_and_paypage_and_paypal
54
- hash = {
55
- 'merchantId' => '101',
56
- 'version'=>'8.8',
57
- 'reportGroup'=>'Planets',
58
- 'orderId'=>'12344',
59
- 'amount'=>'106',
60
- 'orderSource'=>'ecommerce',
61
- 'card'=>{
62
- 'type'=>'VI',
63
- 'number' =>'4100000000000001',
64
- 'expDate' =>'1210'
65
- },
66
- 'paypage'=> {
67
- 'paypageRegistrationId'=>'1234',
68
- 'expDate'=>'1210',
69
- 'cardValidationNum'=>'555',
70
- 'type'=>'VI'},
71
- 'paypal'=>{
72
- 'payerId'=>'1234',
73
- 'token'=>'1234',
74
- 'transactionId'=>'123456'
75
- }}
76
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
77
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
78
- end
79
-
80
- def test_all_choices_card_and_paypage_and_paypal_and_token
81
- hash = {
82
- 'merchantId' => '101',
83
- 'version'=>'8.8',
84
- 'reportGroup'=>'Planets',
85
- 'litleTxnId'=>'123456',
86
- 'orderId'=>'12344',
87
- 'amount'=>'106',
88
- 'orderSource'=>'ecommerce',
89
- 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
90
- 'bypassVelocityCheckcardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
91
- 'card'=>{
92
- 'type'=>'VI',
93
- 'number' =>'4100000000000001',
94
- 'expDate' =>'1210'
95
- },
96
- 'paypage'=> {
97
- 'paypageRegistrationId'=>'1234',
98
- 'expDate'=>'1210',
99
- 'cardValidationNum'=>'555',
100
- 'type'=>'VI'},
101
- 'paypal'=>{
102
- 'payerId'=>'1234',
103
- 'token'=>'1234',
104
- 'transactionId'=>'123456'},
105
- 'token'=> {
106
- 'litleToken'=>'1234',
107
- 'expDate'=>'1210',
108
- 'cardValidationNum'=>'555',
109
- 'type'=>'VI'
110
- }}
111
-
112
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
113
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
114
- end
29
+ module LitleOnline
30
+
31
+ class TestCredit < Test::Unit::TestCase
32
+ def test_both_choices_card_and_paypal
33
+ hash = {
34
+ 'merchantId' => '101',
35
+ 'version'=>'8.8',
36
+ 'reportGroup'=>'Planets',
37
+ 'orderId'=>'12344',
38
+ 'amount'=>'106',
39
+ 'orderSource'=>'ecommerce',
40
+ 'card'=>{
41
+ 'type'=>'VI',
42
+ 'number' =>'4100000000000001',
43
+ 'expDate' =>'1210'
44
+ },
45
+ 'paypal'=>{
46
+ 'payerId'=>'1234',
47
+ 'token'=>'1234',
48
+ 'transactionId'=>'123456'
49
+ }}
50
+
51
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
52
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
53
+ end
54
+
55
+ def test_three_choices_card_and_paypage_and_paypal
56
+ hash = {
57
+ 'merchantId' => '101',
58
+ 'version'=>'8.8',
59
+ 'reportGroup'=>'Planets',
60
+ 'orderId'=>'12344',
61
+ 'amount'=>'106',
62
+ 'orderSource'=>'ecommerce',
63
+ 'card'=>{
64
+ 'type'=>'VI',
65
+ 'number' =>'4100000000000001',
66
+ 'expDate' =>'1210'
67
+ },
68
+ 'paypage'=> {
69
+ 'paypageRegistrationId'=>'1234',
70
+ 'expDate'=>'1210',
71
+ 'cardValidationNum'=>'555',
72
+ 'type'=>'VI'},
73
+ 'paypal'=>{
74
+ 'payerId'=>'1234',
75
+ 'token'=>'1234',
76
+ 'transactionId'=>'123456'
77
+ }}
78
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
79
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
80
+ end
81
+
82
+ def test_all_choices_card_and_paypage_and_paypal_and_token
83
+ hash = {
84
+ 'merchantId' => '101',
85
+ 'version'=>'8.8',
86
+ 'reportGroup'=>'Planets',
87
+ 'litleTxnId'=>'123456',
88
+ 'orderId'=>'12344',
89
+ 'amount'=>'106',
90
+ 'orderSource'=>'ecommerce',
91
+ 'fraudCheck'=>{'authenticationTransactionId'=>'123'},
92
+ 'bypassVelocityCheckcardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
93
+ 'card'=>{
94
+ 'type'=>'VI',
95
+ 'number' =>'4100000000000001',
96
+ 'expDate' =>'1210'
97
+ },
98
+ 'paypage'=> {
99
+ 'paypageRegistrationId'=>'1234',
100
+ 'expDate'=>'1210',
101
+ 'cardValidationNum'=>'555',
102
+ 'type'=>'VI'},
103
+ 'paypal'=>{
104
+ 'payerId'=>'1234',
105
+ 'token'=>'1234',
106
+ 'transactionId'=>'123456'},
107
+ 'token'=> {
108
+ 'litleToken'=>'1234',
109
+ 'expDate'=>'1210',
110
+ 'cardValidationNum'=>'555',
111
+ 'type'=>'VI'
112
+ }}
113
+
114
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
115
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
116
+ end
117
+
118
+ def test_action_reason_on_orphaned_refund
119
+ hash = {
120
+ 'merchantId' => '101',
121
+ 'version'=>'8.12',
122
+ 'orderId'=>'1',
123
+ 'amount'=>'2',
124
+ 'orderSource'=>'ecommerce',
125
+ 'reportGroup'=>'Planets',
126
+ 'actionReason'=> 'SUSPECT_FRAUD'
127
+ }
128
+ XMLObject.expects(:new)
129
+ Communications.expects(:http_post).with(regexp_matches(/.*<actionReason>SUSPECT_FRAUD<\/actionReason>.*/m),kind_of(Hash))
130
+ LitleOnlineRequest.new.credit(hash)
131
+ end
115
132
 
116
- def test_action_reason_on_orphaned_refund
117
- hash = {
118
- 'merchantId' => '101',
119
- 'version'=>'8.12',
120
- 'orderId'=>'1',
121
- 'amount'=>'2',
122
- 'orderSource'=>'ecommerce',
123
- 'reportGroup'=>'Planets',
124
- 'actionReason'=> 'SUSPECT_FRAUD'
125
- }
126
- XMLObject.expects(:new)
127
- Communications.expects(:http_post).with(regexp_matches(/.*<actionReason>SUSPECT_FRAUD<\/actionReason>.*/m),kind_of(Hash))
128
- LitleOnlineRequest.new.credit(hash)
129
133
  end
130
-
131
134
  end
@@ -25,19 +25,20 @@ OTHER DEALINGS IN THE SOFTWARE.
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
- class Test_echeckCredit < Test::Unit::TestCase
29
- def test_echeck_credit_with_both
30
- hash = {
31
- 'merchantId' => '101',
32
- 'version'=>'8.8',
33
- 'reportGroup'=>'Planets',
34
- 'litleTxnId'=>'123456',
35
- 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
36
- 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
37
- }
38
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_credit(hash)}
39
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
28
+ module LitleOnline
29
+ class Test_echeckCredit < Test::Unit::TestCase
30
+ def test_echeck_credit_with_both
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'litleTxnId'=>'123456',
36
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
37
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
38
+ }
39
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_credit(hash)}
40
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
41
+ end
42
+
40
43
  end
41
-
42
44
  end
43
-
@@ -25,18 +25,19 @@ OTHER DEALINGS IN THE SOFTWARE.
25
25
  require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
- class Test_echeckRedeposit < Test::Unit::TestCase
29
- def test_echeck_redeposit_with_both
30
- hash = {
31
- 'merchantId' => '101',
32
- 'version'=>'8.8',
33
- 'reportGroup'=>'Planets',
34
- 'litleTxnId'=>'123456',
35
- 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
36
- 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
37
- }
38
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_redeposit(hash)}
39
- assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
28
+ module LitleOnline
29
+ class Test_echeckRedeposit < Test::Unit::TestCase
30
+ def test_echeck_redeposit_with_both
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'litleTxnId'=>'123456',
36
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
37
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
38
+ }
39
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_redeposit(hash)}
40
+ assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
41
+ end
40
42
  end
41
43
  end
42
-