VantivCnp 8.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +139 -0
  3. data/CONTRIBUTORS +2 -0
  4. data/DESCRIPTION +5 -0
  5. data/LICENSE +22 -0
  6. data/README.md +72 -0
  7. data/Rakefile +89 -0
  8. data/SETUP.md +46 -0
  9. data/bin/Setup.rb +124 -0
  10. data/bin/sample_batch_driver.rb +123 -0
  11. data/bin/sample_driver.rb +49 -0
  12. data/lib/Communications.rb +85 -0
  13. data/lib/Configuration.rb +67 -0
  14. data/lib/EnvironmentVariables.rb +22 -0
  15. data/lib/LitleBatchRequest.rb +562 -0
  16. data/lib/LitleListeners.rb +142 -0
  17. data/lib/LitleOnline.rb +62 -0
  18. data/lib/LitleOnlineRequest.rb +297 -0
  19. data/lib/LitleRequest.rb +494 -0
  20. data/lib/LitleTransaction.rb +463 -0
  21. data/lib/LitleXmlMapper.rb +64 -0
  22. data/lib/XMLFields.rb +1869 -0
  23. data/lib/cacert.pem +3331 -0
  24. data/samples/Auth/LitleAuthReversalTransaction.rb +15 -0
  25. data/samples/Auth/LitleAuthorizationTransaction.rb +31 -0
  26. data/samples/Auth/LitlePaymentFullLifeCycle.rb +47 -0
  27. data/samples/Batch/AccountUpdate.rb +64 -0
  28. data/samples/Batch/SampleBatchDriver.rb +94 -0
  29. data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +30 -0
  30. data/samples/Capture/LitleCaptureTransaction.rb +14 -0
  31. data/samples/Capture/LitleForceCaptureTransaction.rb +26 -0
  32. data/samples/Capture/LitlePartialCapture.rb +16 -0
  33. data/samples/Credit/LitleCreditTransaction.rb +16 -0
  34. data/samples/Credit/LitleRefundTransaction.rb +29 -0
  35. data/samples/Other/LitleAvsTransaction.rb +34 -0
  36. data/samples/Other/LitleVoidTransaction.rb +18 -0
  37. data/samples/Paypage/FullPaypageLifeCycle.rb +74 -0
  38. data/samples/Run_all.rb +17 -0
  39. data/samples/Sale/LitleSaleTransaction.rb +29 -0
  40. data/samples/Sale/SampleSaleTransaction.rb +24 -0
  41. data/test/certification/certTest1_base.rb +945 -0
  42. data/test/certification/certTest2_authenhanced.rb +573 -0
  43. data/test/certification/certTest3_authreversal.rb +185 -0
  44. data/test/certification/certTest4_echeck.rb +278 -0
  45. data/test/certification/certTest5_token.rb +204 -0
  46. data/test/certification/certTest_batchAll.rb +337 -0
  47. data/test/certification/ts_all.rb +33 -0
  48. data/test/functional/test_activate.rb +100 -0
  49. data/test/functional/test_activateReversal.rb +56 -0
  50. data/test/functional/test_auth.rb +298 -0
  51. data/test/functional/test_authReversal.rb +69 -0
  52. data/test/functional/test_balanceInquiry.rb +80 -0
  53. data/test/functional/test_batch.rb +164 -0
  54. data/test/functional/test_batchStream.rb +145 -0
  55. data/test/functional/test_cancelSubscription.rb +55 -0
  56. data/test/functional/test_capture.rb +84 -0
  57. data/test/functional/test_captureGivenAuth.rb +235 -0
  58. data/test/functional/test_configuration.rb +89 -0
  59. data/test/functional/test_createPlan.rb +85 -0
  60. data/test/functional/test_credit.rb +174 -0
  61. data/test/functional/test_deactivate.rb +80 -0
  62. data/test/functional/test_deactivateReversal.rb +56 -0
  63. data/test/functional/test_depositReversal.rb +56 -0
  64. data/test/functional/test_echeckCredit.rb +134 -0
  65. data/test/functional/test_echeckRedeposit.rb +88 -0
  66. data/test/functional/test_echeckSale.rb +177 -0
  67. data/test/functional/test_echeckVerification.rb +127 -0
  68. data/test/functional/test_echeckVoid.rb +41 -0
  69. data/test/functional/test_forceCapture.rb +183 -0
  70. data/test/functional/test_litle_requests.rb +356 -0
  71. data/test/functional/test_load.rb +82 -0
  72. data/test/functional/test_loadReversal.rb +56 -0
  73. data/test/functional/test_override.rb +64 -0
  74. data/test/functional/test_refundReversal.rb +56 -0
  75. data/test/functional/test_sale.rb +259 -0
  76. data/test/functional/test_token.rb +115 -0
  77. data/test/functional/test_unload.rb +82 -0
  78. data/test/functional/test_unloadReversal.rb +56 -0
  79. data/test/functional/test_updateCardValidationNumOnToken.rb +43 -0
  80. data/test/functional/test_updatePlan.rb +58 -0
  81. data/test/functional/test_updateSubscription.rb +76 -0
  82. data/test/functional/test_xmlfields.rb +427 -0
  83. data/test/functional/ts_all.rb +66 -0
  84. data/test/unit/test_LitleAUBatch.rb +216 -0
  85. data/test/unit/test_LitleBatchRequest.rb +643 -0
  86. data/test/unit/test_LitleOnlineRequest.rb +295 -0
  87. data/test/unit/test_LitleRequest.rb +316 -0
  88. data/test/unit/test_LitleTransaction.rb +397 -0
  89. data/test/unit/test_activate.rb +92 -0
  90. data/test/unit/test_activateReversal.rb +44 -0
  91. data/test/unit/test_auth.rb +421 -0
  92. data/test/unit/test_authReversal.rb +82 -0
  93. data/test/unit/test_balanceInquiry.rb +52 -0
  94. data/test/unit/test_cancelSubscription.rb +43 -0
  95. data/test/unit/test_capture.rb +73 -0
  96. data/test/unit/test_captureGivenAuth.rb +188 -0
  97. data/test/unit/test_createPlan.rb +52 -0
  98. data/test/unit/test_credit.rb +342 -0
  99. data/test/unit/test_deactivate.rb +52 -0
  100. data/test/unit/test_deactivateReversal.rb +44 -0
  101. data/test/unit/test_depositReversal.rb +44 -0
  102. data/test/unit/test_echeckCredit.rb +71 -0
  103. data/test/unit/test_echeckRedeposit.rb +94 -0
  104. data/test/unit/test_echeckSale.rb +71 -0
  105. data/test/unit/test_echeckVerification.rb +71 -0
  106. data/test/unit/test_echeckVoid.rb +54 -0
  107. data/test/unit/test_forceCapture.rb +145 -0
  108. data/test/unit/test_load.rb +53 -0
  109. data/test/unit/test_loadReversal.rb +44 -0
  110. data/test/unit/test_refundReversal.rb +44 -0
  111. data/test/unit/test_sale.rb +465 -0
  112. data/test/unit/test_token.rb +144 -0
  113. data/test/unit/test_unload.rb +53 -0
  114. data/test/unit/test_unloadReversal.rb +44 -0
  115. data/test/unit/test_updateCardValidationNumOnToken.rb +80 -0
  116. data/test/unit/test_updatePlan.rb +45 -0
  117. data/test/unit/test_updateSubscription.rb +172 -0
  118. data/test/unit/test_xmlfields.rb +2930 -0
  119. data/test/unit/ts_unit.rb +65 -0
  120. metadata +224 -0
@@ -0,0 +1,134 @@
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 File.expand_path("../../../lib/LitleOnline",__FILE__)
26
+ require 'test/unit'
27
+
28
+ module LitleOnline
29
+ class Test_echeckCredit < Test::Unit::TestCase
30
+ def test_simple_echeckcredit
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'litleTxnId'=>'123456789101112',
36
+ 'amount'=>'12'
37
+ }
38
+ response= LitleOnlineRequest.new.echeck_credit(hash)
39
+ assert_equal('Valid Format', response.message)
40
+ end
41
+
42
+ def test_no_amount
43
+ hash = {
44
+ 'merchantId' => '101',
45
+ 'version'=>'8.8',
46
+ 'reportGroup'=>'Planets',
47
+ }
48
+ response = LitleOnlineRequest.new.echeck_credit(hash)
49
+ assert_match /The content of element 'echeckCredit' is not complete/, response.message
50
+ end
51
+
52
+ def test_echeck_credit_with_echeck
53
+ hash = {
54
+ 'merchantId' => '101',
55
+ 'version'=>'8.8',
56
+ 'reportGroup'=>'Planets',
57
+ 'amount'=>'123456',
58
+ 'verify'=>'true',
59
+ 'orderId'=>'12345',
60
+ 'orderSource'=>'ecommerce',
61
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
62
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
63
+ }
64
+ response= LitleOnlineRequest.new.echeck_credit(hash)
65
+ assert_equal('Valid Format', response.message)
66
+ end
67
+
68
+ def test_echeck_credit_with_echeck_token
69
+ hash = {
70
+ 'merchantId' => '101',
71
+ 'version'=>'8.8',
72
+ 'reportGroup'=>'Planets',
73
+ 'amount'=>'123456',
74
+ 'verify'=>'true',
75
+ 'orderId'=>'12345',
76
+ 'orderSource'=>'ecommerce',
77
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
78
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
79
+ }
80
+ response= LitleOnlineRequest.new.echeck_credit(hash)
81
+ assert_equal('Valid Format', response.message)
82
+ end
83
+
84
+ def test_extra_field_and_incorrect_order
85
+ hash = {
86
+ 'merchantId' => '101',
87
+ 'version'=>'8.8',
88
+ 'reportGroup'=>'Planets',
89
+ 'amount'=>'123',
90
+ 'invalidfield'=>'nonexistant',
91
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
92
+ 'verify'=>'true',
93
+ 'orderId'=>'12345',
94
+ 'orderSource'=>'ecommerce',
95
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
96
+ }
97
+ response= LitleOnlineRequest.new.echeck_credit(hash)
98
+ assert_equal('Valid Format', response.message)
99
+ end
100
+
101
+ def test_extra_field_and_missing_billing
102
+ hash = {
103
+ 'merchantId' => '101',
104
+ 'version'=>'8.8',
105
+ 'reportGroup'=>'Planets',
106
+ 'amount'=>'123',
107
+ 'invalidfield'=>'nonexistant',
108
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
109
+ 'verify'=>'true',
110
+ 'orderId'=>'12345',
111
+ 'orderSource'=>'ecommerce',
112
+ }
113
+ response= LitleOnlineRequest.new.echeck_credit(hash)
114
+ assert(response.message =~ /Error validating xml data against the schema/)
115
+ end
116
+
117
+ def test_echeck_credit_with_secondaryAmount
118
+ hash = {
119
+ 'merchantId' => '101',
120
+ 'version'=>'8.8',
121
+ 'reportGroup'=>'Planets',
122
+ 'amount'=>'123456',
123
+ 'secondaryAmount'=>'50',
124
+ 'verify'=>'true',
125
+ 'orderId'=>'12345',
126
+ 'orderSource'=>'ecommerce',
127
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
128
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
129
+ }
130
+ response= LitleOnlineRequest.new.echeck_credit(hash)
131
+ assert_equal('Valid Format', response.message)
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,88 @@
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 File.expand_path("../../../lib/LitleOnline",__FILE__)
26
+ require 'test/unit'
27
+
28
+ module LitleOnline
29
+ class Test_echeckRedeposit < Test::Unit::TestCase
30
+ def test_simple_echeck_redeposit
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'litleTxnId'=>'123456'
36
+ }
37
+ response= LitleOnlineRequest.new.echeck_redeposit(hash)
38
+ assert_equal('Valid Format', response.message)
39
+ end
40
+
41
+ def test_echeck_redeposit_with_echeck
42
+ hash = {
43
+ 'merchantId' => '101',
44
+ 'version'=>'8.8',
45
+ 'reportGroup'=>'Planets',
46
+ 'litleTxnId'=>'123456',
47
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
48
+ }
49
+ response= LitleOnlineRequest.new.echeck_redeposit(hash)
50
+ assert_equal('Valid Format', response.message)
51
+ end
52
+
53
+ def test_echeck_redeposit_with_echeck_token
54
+ hash = {
55
+ 'merchantId' => '101',
56
+ 'version'=>'8.8',
57
+ 'reportGroup'=>'Planets',
58
+ 'litleTxnId'=>'123456',
59
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'}
60
+ }
61
+ response= LitleOnlineRequest.new.echeck_redeposit(hash)
62
+ assert_equal('Valid Format', response.message)
63
+ end
64
+
65
+ def test_extra_field_and_incorrect_order
66
+ hash = {
67
+ 'merchantId' => '101',
68
+ 'version'=>'8.8',
69
+ 'reportGroup'=>'Planets',
70
+ 'invalidfield'=>'nonexistant',
71
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
72
+ 'litleTxnId'=>'123456'
73
+ }
74
+ response= LitleOnlineRequest.new.echeck_redeposit(hash)
75
+ assert_equal('Valid Format', response.message)
76
+ end
77
+
78
+ def test_no_txn_id
79
+ hash = {
80
+ 'merchantId' => '101',
81
+ 'version'=>'8.8',
82
+ 'reportGroup'=>'Planets',
83
+ }
84
+ response= LitleOnlineRequest.new.echeck_redeposit(hash)
85
+ assert(response.message =~ /Error validating xml data against the schema/)
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,177 @@
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 File.expand_path("../../../lib/LitleOnline",__FILE__)
26
+ require 'test/unit'
27
+
28
+ module LitleOnline
29
+ class Test_echeckSale < Test::Unit::TestCase
30
+ def test_echeck_sale_with_echeck
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'amount'=>'123456',
36
+ 'verify'=>'true',
37
+ 'orderId'=>'12345',
38
+ 'orderSource'=>'ecommerce',
39
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
40
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
41
+ }
42
+ response= LitleOnlineRequest.new.echeck_sale(hash)
43
+ assert_equal('Valid Format', response.message)
44
+ end
45
+
46
+ def test_no_amount
47
+ hash = {
48
+ 'merchantId' => '101',
49
+ 'version'=>'8.8',
50
+ 'reportGroup'=>'Planets'
51
+ }
52
+ response = LitleOnlineRequest.new.echeck_sale(hash)
53
+ assert_match /The content of element 'echeckSale' is not complete/, response.message
54
+ end
55
+
56
+ def test_echeck_sale_with_echeck
57
+ hash = {
58
+ 'merchantId' => '101',
59
+ 'version'=>'8.8',
60
+ 'reportGroup'=>'Planets',
61
+ 'amount'=>'123456',
62
+ 'verify'=>'true',
63
+ 'orderId'=>'12345',
64
+ 'orderSource'=>'ecommerce',
65
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
66
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
67
+ }
68
+ response= LitleOnlineRequest.new.echeck_sale(hash)
69
+ assert_equal('Valid Format', response.message)
70
+ end
71
+
72
+ def test_echeck_sale_with_ship_to
73
+ hash = {
74
+ 'merchantId' => '101',
75
+ 'version'=>'8.8',
76
+ 'reportGroup'=>'Planets',
77
+ 'amount'=>'123456',
78
+ 'verify'=>'true',
79
+ 'orderId'=>'12345',
80
+ 'orderSource'=>'ecommerce',
81
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
82
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
83
+ 'shipToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
84
+ }
85
+ response= LitleOnlineRequest.new.echeck_sale(hash)
86
+ assert_equal('Valid Format', response.message)
87
+ end
88
+
89
+ def test_echeck_sale_with_echeck_token
90
+ hash = {
91
+ 'merchantId' => '101',
92
+ 'version'=>'8.8',
93
+ 'reportGroup'=>'Planets',
94
+ 'amount'=>'123456',
95
+ 'verify'=>'true',
96
+ 'orderId'=>'12345',
97
+ 'orderSource'=>'ecommerce',
98
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
99
+ 'customBilling'=>{'phone'=>'123456789','descriptor'=>'good'},
100
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
101
+ }
102
+ response= LitleOnlineRequest.new.echeck_sale(hash)
103
+ assert_equal('Valid Format', response.message)
104
+ end
105
+
106
+ def test_extra_field_and_incorrect_order
107
+ hash = {
108
+ 'merchantId' => '101',
109
+ 'version'=>'8.8',
110
+ 'reportGroup'=>'Planets',
111
+ 'amount'=>'123',
112
+ 'invalidfield'=>'nonexistant',
113
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
114
+ 'verify'=>'true',
115
+ 'orderId'=>'12345',
116
+ 'orderSource'=>'ecommerce',
117
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
118
+ }
119
+ response= LitleOnlineRequest.new.echeck_sale(hash)
120
+ assert_equal('Valid Format', response.message)
121
+ end
122
+
123
+ def test_extra_field_and_missing_billing
124
+ hash = {
125
+ 'merchantId' => '101',
126
+ 'version'=>'8.8',
127
+ 'reportGroup'=>'Planets',
128
+ 'amount'=>'123',
129
+ 'invalidfield'=>'nonexistant',
130
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
131
+ 'verify'=>'true',
132
+ 'orderId'=>'12345',
133
+ 'orderSource'=>'ecommerce',
134
+ }
135
+ response= LitleOnlineRequest.new.echeck_sale(hash)
136
+ assert(response.message =~ /Error validating xml data against the schema/)
137
+ end
138
+
139
+ def test_simple_echeck_sale
140
+ hash = {
141
+ 'reportGroup'=>'Planets',
142
+ 'litleTxnId'=>'123456789101112',
143
+ 'amount'=>'12'
144
+ }
145
+ response= LitleOnlineRequest.new.echeck_sale(hash)
146
+ assert_equal('Valid Format', response.message)
147
+ end
148
+
149
+ def test_simple_echeck_sale_with_custom_billing
150
+ hash = {
151
+ 'reportGroup'=>'Planets',
152
+ 'litleTxnId'=>'123456',
153
+ 'amount'=>'10',
154
+ }
155
+ response= LitleOnlineRequest.new.echeck_sale(hash)
156
+ assert_equal('Valid Format', response.message)
157
+ end
158
+
159
+ def test_echeck_sale_with_secondaryAmount
160
+ hash = {
161
+ 'merchantId' => '101',
162
+ 'version'=>'8.8',
163
+ 'reportGroup'=>'Planets',
164
+ 'amount'=>'123456',
165
+ 'secondaryAmount'=>'50',
166
+ 'verify'=>'true',
167
+ 'orderId'=>'12345',
168
+ 'orderSource'=>'ecommerce',
169
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
170
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
171
+ }
172
+ response= LitleOnlineRequest.new.echeck_sale(hash)
173
+ assert_equal('Valid Format', response.message)
174
+ end
175
+
176
+ end
177
+ end
@@ -0,0 +1,127 @@
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 File.expand_path("../../../lib/LitleOnline",__FILE__)
26
+ require 'test/unit'
27
+
28
+ module LitleOnline
29
+ class Test_echeckVerification < Test::Unit::TestCase
30
+
31
+ def test_simple_echeck_verification
32
+ hash = {
33
+ 'merchantId' => '101',
34
+ 'version'=>'8.8',
35
+ 'reportGroup'=>'Planets',
36
+ 'amount'=>'123456',
37
+ 'orderId'=>'12345',
38
+ 'orderSource'=>'ecommerce',
39
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
40
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
41
+ }
42
+ response= LitleOnlineRequest.new.echeck_verification(hash)
43
+ assert_equal('Valid Format', response.message)
44
+ end
45
+
46
+ def test_echeck_verification_with_echeck_token
47
+ hash = {
48
+ 'merchantId' => '101',
49
+ 'version'=>'8.8',
50
+ 'reportGroup'=>'Planets',
51
+ 'amount'=>'123456',
52
+ 'orderId'=>'12345',
53
+ 'orderSource'=>'ecommerce',
54
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
55
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
56
+ }
57
+ response= LitleOnlineRequest.new.echeck_verification(hash)
58
+ assert_equal('Valid Format', response.message)
59
+ end
60
+
61
+ def test_extra_field_and_incorrect_order
62
+ hash = {
63
+ 'merchantId' => '101',
64
+ 'version'=>'8.8',
65
+ 'reportGroup'=>'Planets',
66
+ 'amount'=>'123',
67
+ 'invalidfield'=>'nonexistant',
68
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
69
+ 'orderId'=>'12345',
70
+ 'orderSource'=>'ecommerce',
71
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
72
+ }
73
+ response= LitleOnlineRequest.new.echeck_verification(hash)
74
+ assert_equal('Valid Format', response.message)
75
+ end
76
+
77
+ def test_extra_field_and_missing_billing
78
+ hash = {
79
+ 'merchantId' => '101',
80
+ 'version'=>'8.8',
81
+ 'reportGroup'=>'Planets',
82
+ 'amount'=>'123',
83
+ 'invalidfield'=>'nonexistant',
84
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
85
+ 'orderId'=>'12345',
86
+ 'orderSource'=>'ecommerce',
87
+ }
88
+ response= LitleOnlineRequest.new.echeck_verification(hash)
89
+ assert(response.message =~ /Error validating xml data against the schema/)
90
+ end
91
+
92
+ def test_no_amount
93
+ hash = {
94
+ 'merchantId' => '101',
95
+ 'version'=>'8.8',
96
+ 'reportGroup'=>'Planets',
97
+ 'orderId'=>'12345'
98
+ }
99
+ response= LitleOnlineRequest.new.echeck_verification(hash)
100
+ assert(response.message =~ /Error validating xml data against the schema/)
101
+ end
102
+
103
+ def test_no_order_id
104
+ hash = {
105
+ 'merchantId' => '101',
106
+ 'version'=>'8.8',
107
+ 'reportGroup'=>'Planets',
108
+ }
109
+ response= LitleOnlineRequest.new.echeck_verification(hash)
110
+ assert(response.message =~ /Error validating xml data against the schema/)
111
+ end
112
+
113
+ def test_no_order_source
114
+ hash = {
115
+ 'merchantId' => '101',
116
+ 'version'=>'8.8',
117
+ 'reportGroup'=>'Planets',
118
+ 'amount'=>'123456',
119
+ 'orderId'=>'12345'
120
+ }
121
+ response= LitleOnlineRequest.new.echeck_verification(hash)
122
+ assert(response.message =~ /Error validating xml data against the schema/)
123
+ end
124
+
125
+ end
126
+
127
+ end