CnpOnline 8.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) 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/Rakefile~ +89 -0
  9. data/SETUP.md +46 -0
  10. data/bin/Setup.rb +124 -0
  11. data/bin/sample_batch_driver.rb +123 -0
  12. data/bin/sample_driver.rb +49 -0
  13. data/lib/Communications.rb +85 -0
  14. data/lib/Configuration.rb +67 -0
  15. data/lib/EnvironmentVariables.rb +22 -0
  16. data/lib/LitleBatchRequest.rb +562 -0
  17. data/lib/LitleListeners.rb +142 -0
  18. data/lib/LitleOnline.rb +62 -0
  19. data/lib/LitleOnlineRequest.rb +297 -0
  20. data/lib/LitleRequest.rb +494 -0
  21. data/lib/LitleTransaction.rb +463 -0
  22. data/lib/LitleXmlMapper.rb +64 -0
  23. data/lib/XMLFields.rb +1869 -0
  24. data/lib/cacert.pem +3331 -0
  25. data/samples/Auth/LitleAuthReversalTransaction.rb +15 -0
  26. data/samples/Auth/LitleAuthorizationTransaction.rb +31 -0
  27. data/samples/Auth/LitlePaymentFullLifeCycle.rb +47 -0
  28. data/samples/Batch/AccountUpdate.rb +64 -0
  29. data/samples/Batch/SampleBatchDriver.rb +94 -0
  30. data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +30 -0
  31. data/samples/Capture/LitleCaptureTransaction.rb +14 -0
  32. data/samples/Capture/LitleForceCaptureTransaction.rb +26 -0
  33. data/samples/Capture/LitlePartialCapture.rb +16 -0
  34. data/samples/Credit/LitleCreditTransaction.rb +16 -0
  35. data/samples/Credit/LitleRefundTransaction.rb +29 -0
  36. data/samples/Other/LitleAvsTransaction.rb +34 -0
  37. data/samples/Other/LitleVoidTransaction.rb +18 -0
  38. data/samples/Paypage/FullPaypageLifeCycle.rb +74 -0
  39. data/samples/Run_all.rb +17 -0
  40. data/samples/Sale/LitleSaleTransaction.rb +29 -0
  41. data/samples/Sale/SampleSaleTransaction.rb +24 -0
  42. data/test/certification/certTest1_base.rb +945 -0
  43. data/test/certification/certTest2_authenhanced.rb +573 -0
  44. data/test/certification/certTest3_authreversal.rb +185 -0
  45. data/test/certification/certTest4_echeck.rb +278 -0
  46. data/test/certification/certTest5_token.rb +204 -0
  47. data/test/certification/certTest_batchAll.rb +337 -0
  48. data/test/certification/ts_all.rb +33 -0
  49. data/test/functional/test_activate.rb +100 -0
  50. data/test/functional/test_activateReversal.rb +56 -0
  51. data/test/functional/test_auth.rb +298 -0
  52. data/test/functional/test_authReversal.rb +69 -0
  53. data/test/functional/test_balanceInquiry.rb +80 -0
  54. data/test/functional/test_batch.rb +164 -0
  55. data/test/functional/test_batchStream.rb +145 -0
  56. data/test/functional/test_cancelSubscription.rb +55 -0
  57. data/test/functional/test_capture.rb +84 -0
  58. data/test/functional/test_captureGivenAuth.rb +235 -0
  59. data/test/functional/test_configuration.rb +89 -0
  60. data/test/functional/test_createPlan.rb +85 -0
  61. data/test/functional/test_credit.rb +174 -0
  62. data/test/functional/test_deactivate.rb +80 -0
  63. data/test/functional/test_deactivateReversal.rb +56 -0
  64. data/test/functional/test_depositReversal.rb +56 -0
  65. data/test/functional/test_echeckCredit.rb +134 -0
  66. data/test/functional/test_echeckRedeposit.rb +88 -0
  67. data/test/functional/test_echeckSale.rb +177 -0
  68. data/test/functional/test_echeckVerification.rb +127 -0
  69. data/test/functional/test_echeckVoid.rb +41 -0
  70. data/test/functional/test_forceCapture.rb +183 -0
  71. data/test/functional/test_litle_requests.rb +356 -0
  72. data/test/functional/test_load.rb +82 -0
  73. data/test/functional/test_loadReversal.rb +56 -0
  74. data/test/functional/test_override.rb +64 -0
  75. data/test/functional/test_refundReversal.rb +56 -0
  76. data/test/functional/test_sale.rb +259 -0
  77. data/test/functional/test_token.rb +115 -0
  78. data/test/functional/test_unload.rb +82 -0
  79. data/test/functional/test_unloadReversal.rb +56 -0
  80. data/test/functional/test_updateCardValidationNumOnToken.rb +43 -0
  81. data/test/functional/test_updatePlan.rb +58 -0
  82. data/test/functional/test_updateSubscription.rb +76 -0
  83. data/test/functional/test_xmlfields.rb +427 -0
  84. data/test/functional/ts_all.rb +66 -0
  85. data/test/unit/test_LitleAUBatch.rb +216 -0
  86. data/test/unit/test_LitleBatchRequest.rb +643 -0
  87. data/test/unit/test_LitleOnlineRequest.rb +295 -0
  88. data/test/unit/test_LitleRequest.rb +316 -0
  89. data/test/unit/test_LitleTransaction.rb +397 -0
  90. data/test/unit/test_activate.rb +92 -0
  91. data/test/unit/test_activateReversal.rb +44 -0
  92. data/test/unit/test_auth.rb +421 -0
  93. data/test/unit/test_authReversal.rb +82 -0
  94. data/test/unit/test_balanceInquiry.rb +52 -0
  95. data/test/unit/test_cancelSubscription.rb +43 -0
  96. data/test/unit/test_capture.rb +73 -0
  97. data/test/unit/test_captureGivenAuth.rb +188 -0
  98. data/test/unit/test_createPlan.rb +52 -0
  99. data/test/unit/test_credit.rb +342 -0
  100. data/test/unit/test_deactivate.rb +52 -0
  101. data/test/unit/test_deactivateReversal.rb +44 -0
  102. data/test/unit/test_depositReversal.rb +44 -0
  103. data/test/unit/test_echeckCredit.rb +71 -0
  104. data/test/unit/test_echeckRedeposit.rb +94 -0
  105. data/test/unit/test_echeckSale.rb +71 -0
  106. data/test/unit/test_echeckVerification.rb +71 -0
  107. data/test/unit/test_echeckVoid.rb +54 -0
  108. data/test/unit/test_forceCapture.rb +145 -0
  109. data/test/unit/test_load.rb +53 -0
  110. data/test/unit/test_loadReversal.rb +44 -0
  111. data/test/unit/test_refundReversal.rb +44 -0
  112. data/test/unit/test_sale.rb +465 -0
  113. data/test/unit/test_token.rb +144 -0
  114. data/test/unit/test_unload.rb +53 -0
  115. data/test/unit/test_unloadReversal.rb +44 -0
  116. data/test/unit/test_updateCardValidationNumOnToken.rb +80 -0
  117. data/test/unit/test_updatePlan.rb +45 -0
  118. data/test/unit/test_updateSubscription.rb +172 -0
  119. data/test/unit/test_xmlfields.rb +2930 -0
  120. data/test/unit/ts_unit.rb +65 -0
  121. metadata +255 -0
@@ -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 File.expand_path("../../../lib/LitleOnline",__FILE__)
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
@@ -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 File.expand_path("../../../lib/LitleOnline",__FILE__)
26
+ require 'test/unit'
27
+
28
+ #test loadReversal Transaction
29
+ module LitleOnline
30
+ class TestLoadReversal < 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.load_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.load_reversal(hash)
53
+ assert(response.message =~ /Error validating xml data against the schema/)
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,64 @@
1
+ require File.expand_path("../../../lib/LitleOnline",__FILE__)
2
+ require 'test/unit'
3
+
4
+ #test Activate Transaction
5
+ module LitleOnline
6
+ class TestOverride < Test::Unit::TestCase
7
+ def test_override_withoutLocalAndEnv
8
+ hash = {
9
+ 'merchantId' => '101',
10
+ 'version'=>'8.8',
11
+ 'orderId' =>'1001',
12
+ 'amount' =>'500',
13
+ 'orderSource' =>'ecommerce',
14
+ 'card'=>{
15
+ 'type'=>'VI',
16
+ 'number' =>'4100000000000001',
17
+ 'expDate' =>'1210'
18
+ }
19
+ }
20
+ response= LitleOnlineRequest.new.activate(hash)
21
+ assert_equal('Default Report Group', response.activateResponse.reportGroup)
22
+ end
23
+ def test_override_withoutLocal
24
+ hash = {
25
+ 'merchantId' => '101',
26
+ 'version'=>'8.8',
27
+ 'orderId' =>'1001',
28
+ 'amount' =>'500',
29
+ 'orderSource' =>'ecommerce',
30
+ 'card'=>{
31
+ 'type'=>'VI',
32
+ 'number' =>'4100000000000001',
33
+ 'expDate' =>'1210'
34
+ }
35
+ }
36
+ ENV['litle_default_report_group']='380'
37
+ response= LitleOnlineRequest.new.activate(hash)
38
+ assert_equal('380', response.activateResponse.reportGroup)
39
+ ENV['litle_default_report_group']=nil
40
+
41
+ end
42
+ def test_override
43
+ hash = {
44
+ 'merchantId' => '101',
45
+ 'version'=>'8.8',
46
+ 'reportGroup'=>'Planets',
47
+ 'orderId' =>'1001',
48
+ 'amount' =>'500',
49
+ 'orderSource' =>'ecommerce',
50
+ 'card'=>{
51
+ 'type'=>'VI',
52
+ 'number' =>'4100000000000001',
53
+ 'expDate' =>'1210'
54
+ }
55
+ }
56
+ ENV['litle_default_report_group']='380'
57
+ response= LitleOnlineRequest.new.activate(hash)
58
+ assert_equal('Planets', response.activateResponse.reportGroup)
59
+ ENV['litle_default_report_group']=nil
60
+
61
+ end
62
+
63
+ end
64
+ 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 File.expand_path("../../../lib/LitleOnline",__FILE__)
26
+ require 'test/unit'
27
+
28
+ #test RefundReversal Transaction
29
+ module LitleOnline
30
+ class TestRefundReversal < 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.refund_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.refund_reversal(hash)
53
+ assert(response.message =~ /Error validating xml data against the schema/)
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,259 @@
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 TestSale < Test::Unit::TestCase
30
+ def test_simple_sale_with_card
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'litleTxnId'=>'123456',
36
+ 'orderId'=>'12344',
37
+ 'amount'=>'106',
38
+ 'orderSource'=>'ecommerce',
39
+ 'card'=>{
40
+ 'type'=>'VI',
41
+ 'number' =>'4100000000000002',
42
+ 'expDate' =>'1210'
43
+ }}
44
+ response= LitleOnlineRequest.new.sale(hash)
45
+ assert_equal('000', response.saleResponse.response)
46
+ end
47
+
48
+ def test_simple_sale_with_paypal
49
+ hash = {
50
+ 'merchantId' => '101',
51
+ 'version'=>'8.8',
52
+ 'reportGroup'=>'Planets',
53
+ 'litleTxnId'=>'123456',
54
+ 'orderId'=>'12344',
55
+ 'amount'=>'106',
56
+ 'orderSource'=>'ecommerce',
57
+ 'paypal'=>{
58
+ 'payerId'=>'1234',
59
+ 'token'=>'1234',
60
+ 'transactionId'=>'123456'
61
+ }}
62
+ response= LitleOnlineRequest.new.sale(hash)
63
+ assert_equal 'Valid Format', response.message
64
+ end
65
+
66
+ def test_simple_sale_with_applepay_and_secondaryAmount
67
+ hash = {
68
+ 'merchantId' => '101',
69
+ 'version'=>'8.8',
70
+ 'reportGroup'=>'Planets',
71
+ 'litleTxnId'=>'123456',
72
+ 'orderId'=>'12344',
73
+ 'amount'=>'110',
74
+ 'secondaryAmount'=>'50',
75
+ 'orderSource'=>'ecommerce',
76
+ 'applepay'=>{
77
+ 'data'=>'1234',
78
+ 'header'=>{
79
+ 'applicationData'=>'454657413164',
80
+ 'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
81
+ 'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
82
+ 'transactionId'=>'1234'
83
+ },
84
+ 'signature' =>'1',
85
+ 'version'=>'12345'
86
+ }}
87
+ response= LitleOnlineRequest.new.sale(hash)
88
+ assert_equal('Insufficient Funds', response.saleResponse.message)
89
+ assert_equal('110', response.saleResponse.applepayResponse.transactionAmount)
90
+ end
91
+
92
+ def test_illegal_order_source
93
+ hash = {
94
+ 'merchantId' => '101',
95
+ 'version'=>'8.8',
96
+ 'reportGroup'=>'Planets',
97
+ 'litleTxnId'=>'123456',
98
+ 'orderId'=>'12344',
99
+ 'amount'=>'106',
100
+ 'orderSource'=>'ecomerce',
101
+ 'card'=>{
102
+ 'type'=>'VI',
103
+ 'number' =>'4100000000000002',
104
+ 'expDate' =>'1210'
105
+ }}
106
+ response= LitleOnlineRequest.new.sale(hash)
107
+ assert(response.message =~ /Error validating xml data against the schema/)
108
+ end
109
+
110
+ def test_no_report_group
111
+ hash = {
112
+ 'merchantId' => '101',
113
+ 'version'=>'8.8',
114
+ 'reportGroup'=>'Planets',
115
+ 'litleTxnId'=>'123456',
116
+ 'orderId'=>'12344',
117
+ 'amount'=>'106',
118
+ 'orderSource'=>'ecommerce',
119
+ 'card'=>{
120
+ 'type'=>'VI',
121
+ 'number' =>'4100000000000000',
122
+ 'expDate' =>'1210'
123
+ }}
124
+ response= LitleOnlineRequest.new.sale(hash)
125
+ assert_equal('000', response.saleResponse.response)
126
+ end
127
+
128
+ def test_fields_out_of_order
129
+ hash = {
130
+ 'merchantId' => '101',
131
+ 'version'=>'8.8',
132
+ 'orderSource'=>'ecommerce',
133
+ 'litleTxnId'=>'123456',
134
+ 'amount'=>'106',
135
+ 'card'=>{
136
+ 'type'=>'VI',
137
+ 'number' =>'4100000000000000',
138
+ 'expDate' =>'1210'
139
+ },
140
+ 'reportGroup'=>'Planets',
141
+ 'orderId'=>'12344'
142
+ }
143
+ response= LitleOnlineRequest.new.sale(hash)
144
+ assert_equal('000', response.saleResponse.response)
145
+ end
146
+
147
+ def test_invalid_field
148
+ hash = {
149
+ 'merchantId' => '101',
150
+ 'version'=>'8.8',
151
+ 'reportGroup'=>'Planets',
152
+ 'litleTxnId'=>'123456',
153
+ 'orderId'=>'12344',
154
+ 'amount'=>'106',
155
+ 'orderSource'=>'ecommerce',
156
+ 'card'=>{
157
+ 'NOexistantField' => 'ShouldNotCauseError',
158
+ 'type'=>'VI',
159
+ 'number' =>'4100000000000000',
160
+ 'expDate' =>'1210'
161
+ }}
162
+ response= LitleOnlineRequest.new.sale(hash)
163
+ assert_equal('000', response.saleResponse.response)
164
+ end
165
+
166
+ def test_simple_sale_with_card
167
+ hash = {
168
+ 'merchantId'=>'101',
169
+ 'version'=>'8.8',
170
+ 'reportGroup'=>'Planets',
171
+ 'litleTxnId'=>'123456',
172
+ 'orderId'=>'12344',
173
+ 'amount'=>'106',
174
+ 'orderSource'=>'ecommerce',
175
+ 'card'=>{
176
+ 'type'=>'VI',
177
+ 'number' =>'4100000000000000',
178
+ 'expDate' =>'1210'
179
+ }}
180
+ response= LitleOnlineRequest.new.sale(hash)
181
+ assert_equal('000', response.saleResponse.response)
182
+ end
183
+
184
+ def test_no_order_id
185
+ hash = {
186
+ 'merchantId' => '101',
187
+ 'version'=>'8.8',
188
+ 'reportGroup'=>'Planets',
189
+ 'litleTxnId'=>'123456',
190
+ 'amount'=>'106',
191
+ 'orderSource'=>'ecommerce',
192
+ 'card'=>{
193
+ 'type'=>'VI',
194
+ 'number' =>'4100000000000002',
195
+ 'expDate' =>'1210'
196
+ }}
197
+ response= LitleOnlineRequest.new.sale(hash)
198
+ assert(response.message =~ /Error validating xml data against the schema/)
199
+ end
200
+
201
+ def test_no_amount
202
+ hash = {
203
+ 'merchantId' => '101',
204
+ 'version'=>'8.8',
205
+ 'reportGroup'=>'Planets',
206
+ 'litleTxnId'=>'123456',
207
+ 'orderId'=>'12344',
208
+ 'orderSource'=>'ecommerce',
209
+ 'card'=>{
210
+ 'type'=>'VI',
211
+ 'number' =>'4100000000000002',
212
+ 'expDate' =>'1210'
213
+ }}
214
+ response= LitleOnlineRequest.new.sale(hash)
215
+ assert(response.message =~ /Error validating xml data against the schema/)
216
+ end
217
+
218
+ def test_no_order_source
219
+ hash = {
220
+ 'merchantId' => '101',
221
+ 'version'=>'8.8',
222
+ 'reportGroup'=>'Planets',
223
+ 'litleTxnId'=>'123456',
224
+ 'orderId'=>'12344',
225
+ 'amount'=>'106',
226
+ 'card'=>{
227
+ 'type'=>'VI',
228
+ 'number' =>'4100000000000002',
229
+ 'expDate' =>'1210'
230
+ }}
231
+ response= LitleOnlineRequest.new.sale(hash)
232
+ assert(response.message =~ /Error validating xml data against the schema/)
233
+ end
234
+
235
+ def test_simple_sale_with_mpos
236
+ hash = {
237
+ 'merchantId' => '101',
238
+ 'version'=>'8.8',
239
+ 'reportGroup'=>'Planets',
240
+ 'litleTxnId'=>'123456',
241
+ 'orderId'=>'12344',
242
+ 'amount'=>'106',
243
+ 'orderSource'=>'ecommerce',
244
+ 'mpos'=>
245
+ {
246
+ 'ksn'=>'ksnString',
247
+ 'formatId'=>'30',
248
+ 'encryptedTrack'=>'encryptedTrackString',
249
+ 'track1Status'=>'0',
250
+ 'track2Status'=>'0'
251
+ }
252
+ }
253
+ response= LitleOnlineRequest.new.sale(hash)
254
+ assert_equal('000', response.saleResponse.response)
255
+ end
256
+
257
+ end
258
+
259
+ end