CnpOnline 8.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +139 -0
- data/CONTRIBUTORS +2 -0
- data/DESCRIPTION +5 -0
- data/LICENSE +22 -0
- data/README.md +72 -0
- data/Rakefile +89 -0
- data/Rakefile~ +89 -0
- data/SETUP.md +46 -0
- data/bin/Setup.rb +124 -0
- data/bin/sample_batch_driver.rb +123 -0
- data/bin/sample_driver.rb +49 -0
- data/lib/Communications.rb +85 -0
- data/lib/Configuration.rb +67 -0
- data/lib/EnvironmentVariables.rb +22 -0
- data/lib/LitleBatchRequest.rb +562 -0
- data/lib/LitleListeners.rb +142 -0
- data/lib/LitleOnline.rb +62 -0
- data/lib/LitleOnlineRequest.rb +297 -0
- data/lib/LitleRequest.rb +494 -0
- data/lib/LitleTransaction.rb +463 -0
- data/lib/LitleXmlMapper.rb +64 -0
- data/lib/XMLFields.rb +1869 -0
- data/lib/cacert.pem +3331 -0
- data/samples/Auth/LitleAuthReversalTransaction.rb +15 -0
- data/samples/Auth/LitleAuthorizationTransaction.rb +31 -0
- data/samples/Auth/LitlePaymentFullLifeCycle.rb +47 -0
- data/samples/Batch/AccountUpdate.rb +64 -0
- data/samples/Batch/SampleBatchDriver.rb +94 -0
- data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +30 -0
- data/samples/Capture/LitleCaptureTransaction.rb +14 -0
- data/samples/Capture/LitleForceCaptureTransaction.rb +26 -0
- data/samples/Capture/LitlePartialCapture.rb +16 -0
- data/samples/Credit/LitleCreditTransaction.rb +16 -0
- data/samples/Credit/LitleRefundTransaction.rb +29 -0
- data/samples/Other/LitleAvsTransaction.rb +34 -0
- data/samples/Other/LitleVoidTransaction.rb +18 -0
- data/samples/Paypage/FullPaypageLifeCycle.rb +74 -0
- data/samples/Run_all.rb +17 -0
- data/samples/Sale/LitleSaleTransaction.rb +29 -0
- data/samples/Sale/SampleSaleTransaction.rb +24 -0
- data/test/certification/certTest1_base.rb +945 -0
- data/test/certification/certTest2_authenhanced.rb +573 -0
- data/test/certification/certTest3_authreversal.rb +185 -0
- data/test/certification/certTest4_echeck.rb +278 -0
- data/test/certification/certTest5_token.rb +204 -0
- data/test/certification/certTest_batchAll.rb +337 -0
- data/test/certification/ts_all.rb +33 -0
- data/test/functional/test_activate.rb +100 -0
- data/test/functional/test_activateReversal.rb +56 -0
- data/test/functional/test_auth.rb +298 -0
- data/test/functional/test_authReversal.rb +69 -0
- data/test/functional/test_balanceInquiry.rb +80 -0
- data/test/functional/test_batch.rb +164 -0
- data/test/functional/test_batchStream.rb +145 -0
- data/test/functional/test_cancelSubscription.rb +55 -0
- data/test/functional/test_capture.rb +84 -0
- data/test/functional/test_captureGivenAuth.rb +235 -0
- data/test/functional/test_configuration.rb +89 -0
- data/test/functional/test_createPlan.rb +85 -0
- data/test/functional/test_credit.rb +174 -0
- data/test/functional/test_deactivate.rb +80 -0
- data/test/functional/test_deactivateReversal.rb +56 -0
- data/test/functional/test_depositReversal.rb +56 -0
- data/test/functional/test_echeckCredit.rb +134 -0
- data/test/functional/test_echeckRedeposit.rb +88 -0
- data/test/functional/test_echeckSale.rb +177 -0
- data/test/functional/test_echeckVerification.rb +127 -0
- data/test/functional/test_echeckVoid.rb +41 -0
- data/test/functional/test_forceCapture.rb +183 -0
- data/test/functional/test_litle_requests.rb +356 -0
- data/test/functional/test_load.rb +82 -0
- data/test/functional/test_loadReversal.rb +56 -0
- data/test/functional/test_override.rb +64 -0
- data/test/functional/test_refundReversal.rb +56 -0
- data/test/functional/test_sale.rb +259 -0
- data/test/functional/test_token.rb +115 -0
- data/test/functional/test_unload.rb +82 -0
- data/test/functional/test_unloadReversal.rb +56 -0
- data/test/functional/test_updateCardValidationNumOnToken.rb +43 -0
- data/test/functional/test_updatePlan.rb +58 -0
- data/test/functional/test_updateSubscription.rb +76 -0
- data/test/functional/test_xmlfields.rb +427 -0
- data/test/functional/ts_all.rb +66 -0
- data/test/unit/test_LitleAUBatch.rb +216 -0
- data/test/unit/test_LitleBatchRequest.rb +643 -0
- data/test/unit/test_LitleOnlineRequest.rb +295 -0
- data/test/unit/test_LitleRequest.rb +316 -0
- data/test/unit/test_LitleTransaction.rb +397 -0
- data/test/unit/test_activate.rb +92 -0
- data/test/unit/test_activateReversal.rb +44 -0
- data/test/unit/test_auth.rb +421 -0
- data/test/unit/test_authReversal.rb +82 -0
- data/test/unit/test_balanceInquiry.rb +52 -0
- data/test/unit/test_cancelSubscription.rb +43 -0
- data/test/unit/test_capture.rb +73 -0
- data/test/unit/test_captureGivenAuth.rb +188 -0
- data/test/unit/test_createPlan.rb +52 -0
- data/test/unit/test_credit.rb +342 -0
- data/test/unit/test_deactivate.rb +52 -0
- data/test/unit/test_deactivateReversal.rb +44 -0
- data/test/unit/test_depositReversal.rb +44 -0
- data/test/unit/test_echeckCredit.rb +71 -0
- data/test/unit/test_echeckRedeposit.rb +94 -0
- data/test/unit/test_echeckSale.rb +71 -0
- data/test/unit/test_echeckVerification.rb +71 -0
- data/test/unit/test_echeckVoid.rb +54 -0
- data/test/unit/test_forceCapture.rb +145 -0
- data/test/unit/test_load.rb +53 -0
- data/test/unit/test_loadReversal.rb +44 -0
- data/test/unit/test_refundReversal.rb +44 -0
- data/test/unit/test_sale.rb +465 -0
- data/test/unit/test_token.rb +144 -0
- data/test/unit/test_unload.rb +53 -0
- data/test/unit/test_unloadReversal.rb +44 -0
- data/test/unit/test_updateCardValidationNumOnToken.rb +80 -0
- data/test/unit/test_updatePlan.rb +45 -0
- data/test/unit/test_updateSubscription.rb +172 -0
- data/test/unit/test_xmlfields.rb +2930 -0
- data/test/unit/ts_unit.rb +65 -0
- metadata +255 -0
@@ -0,0 +1,204 @@
|
|
1
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
module LitleOnline
|
5
|
+
class Litle_certTest5 < Test::Unit::TestCase
|
6
|
+
@@merchant_hash = {'reportGroup'=>'Planets',
|
7
|
+
'merchantId'=>'101'
|
8
|
+
}
|
9
|
+
|
10
|
+
def test_50
|
11
|
+
customer_hash = {
|
12
|
+
'orderId' => '50',
|
13
|
+
'accountNumber' => '4457119922390123'
|
14
|
+
}
|
15
|
+
hash = customer_hash.merge(@@merchant_hash)
|
16
|
+
token_response = LitleOnlineRequest.new.register_token_request(hash)
|
17
|
+
assert_equal('445711', token_response.registerTokenResponse.bin)
|
18
|
+
assert_equal('VI', token_response.registerTokenResponse['type'])
|
19
|
+
assert_equal('801', token_response.registerTokenResponse.response)
|
20
|
+
assert_equal('1111222233330123', token_response.registerTokenResponse.litleToken)
|
21
|
+
assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_51
|
25
|
+
customer_hash = {
|
26
|
+
'orderId' => '51',
|
27
|
+
'accountNumber' => '4457119999999999'
|
28
|
+
}
|
29
|
+
hash = customer_hash.merge(@@merchant_hash)
|
30
|
+
token_response = LitleOnlineRequest.new.register_token_request(hash)
|
31
|
+
assert_equal('820', token_response.registerTokenResponse.response)
|
32
|
+
assert_equal('Credit card number was invalid', token_response.registerTokenResponse.message)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_52
|
36
|
+
customer_hash = {
|
37
|
+
'orderId' => '52',
|
38
|
+
'accountNumber' => '4457119922390123'
|
39
|
+
}
|
40
|
+
hash = customer_hash.merge(@@merchant_hash)
|
41
|
+
token_response = LitleOnlineRequest.new.register_token_request(hash)
|
42
|
+
assert_equal('445711', token_response.registerTokenResponse.bin)
|
43
|
+
assert_equal('VI', token_response.registerTokenResponse['type'])
|
44
|
+
assert_equal('802', token_response.registerTokenResponse.response)
|
45
|
+
assert_equal('1111222233330123', token_response.registerTokenResponse.litleToken)
|
46
|
+
assert_equal('Account number was previously registered', token_response.registerTokenResponse.message)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_53
|
50
|
+
customer_hash = {
|
51
|
+
'orderId' => '53',
|
52
|
+
'echeckForToken'=>{'accNum'=>'1099999998','routingNum'=>'114567895'}
|
53
|
+
}
|
54
|
+
hash = customer_hash.merge(@@merchant_hash)
|
55
|
+
token_response = LitleOnlineRequest.new.register_token_request(hash)
|
56
|
+
assert_equal('EC', token_response.registerTokenResponse['type'])
|
57
|
+
assert_equal('998', token_response.registerTokenResponse.eCheckAccountSuffix)
|
58
|
+
assert_equal('801', token_response.registerTokenResponse.response)
|
59
|
+
assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
|
60
|
+
assert_equal('111922223333000998', token_response.registerTokenResponse.litleToken)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_54
|
64
|
+
customer_hash = {
|
65
|
+
'orderId' => '54',
|
66
|
+
'echeckForToken'=>{'accNum'=>'1022222102','routingNum'=>'1145_7895'}
|
67
|
+
}
|
68
|
+
hash = customer_hash.merge(@@merchant_hash)
|
69
|
+
token_response = LitleOnlineRequest.new.register_token_request(hash)
|
70
|
+
assert_equal('900', token_response.registerTokenResponse.response)
|
71
|
+
assert_equal('Invalid bank routing number', token_response.registerTokenResponse.message)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_55
|
75
|
+
customer_hash = {
|
76
|
+
'orderId' => '55',
|
77
|
+
'amount' => '15000',
|
78
|
+
'orderSource' => 'ecommerce',
|
79
|
+
'card' => {'number' => '5435101234510196', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
|
80
|
+
}
|
81
|
+
hash = customer_hash.merge(@@merchant_hash)
|
82
|
+
token_response = LitleOnlineRequest.new.authorization(hash)
|
83
|
+
assert_equal('000', token_response.authorizationResponse.response)
|
84
|
+
assert_equal('Approved', token_response.authorizationResponse.message)
|
85
|
+
assert_equal('801', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
|
86
|
+
assert_equal('Account number was successfully registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
|
87
|
+
assert_equal('MC', token_response.authorizationResponse.tokenResponse['type'])
|
88
|
+
assert_equal('543510', token_response.authorizationResponse.tokenResponse.bin)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_56
|
92
|
+
customer_hash = {
|
93
|
+
'orderId' => '56',
|
94
|
+
'amount' => '15000',
|
95
|
+
'orderSource' => 'ecommerce',
|
96
|
+
'card' => {'number' => '5435109999999999', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
|
97
|
+
}
|
98
|
+
hash = customer_hash.merge(@@merchant_hash)
|
99
|
+
token_response = LitleOnlineRequest.new.authorization(hash)
|
100
|
+
assert_equal('301', token_response.authorizationResponse.response)
|
101
|
+
assert_equal('Invalid account number', token_response.authorizationResponse.message)
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_57
|
105
|
+
customer_hash = {
|
106
|
+
'orderId' => '57',
|
107
|
+
'amount' => '15000',
|
108
|
+
'orderSource' => 'ecommerce',
|
109
|
+
'card' => {'number' => '5435101234510196', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
|
110
|
+
}
|
111
|
+
hash = customer_hash.merge(@@merchant_hash)
|
112
|
+
token_response = LitleOnlineRequest.new.authorization(hash)
|
113
|
+
assert_equal('000', token_response.authorizationResponse.response)
|
114
|
+
assert_equal('Approved', token_response.authorizationResponse.message)
|
115
|
+
assert_equal('802', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
|
116
|
+
assert_equal('Account number was previously registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
|
117
|
+
assert_equal('MC', token_response.authorizationResponse.tokenResponse['type'])
|
118
|
+
assert_equal('543510', token_response.authorizationResponse.tokenResponse.bin)
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_59
|
122
|
+
customer_hash = {
|
123
|
+
'orderId' => '59',
|
124
|
+
'amount' => '15000',
|
125
|
+
'orderSource' => 'ecommerce',
|
126
|
+
'token' => {'litleToken' => '1712990000040196', 'expDate' => '1112'}
|
127
|
+
}
|
128
|
+
hash = customer_hash.merge(@@merchant_hash)
|
129
|
+
token_response = LitleOnlineRequest.new.authorization(hash)
|
130
|
+
assert_equal('822', token_response.authorizationResponse.response)
|
131
|
+
assert_equal('Token was not found', token_response.authorizationResponse.message)
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_60
|
135
|
+
customer_hash = {
|
136
|
+
'orderId' => '60',
|
137
|
+
'amount' => '15000',
|
138
|
+
'orderSource' => 'ecommerce',
|
139
|
+
'token' => {'litleToken' => '1712999999999999', 'expDate' => '1112'}
|
140
|
+
}
|
141
|
+
hash = customer_hash.merge(@@merchant_hash)
|
142
|
+
token_response = LitleOnlineRequest.new.authorization(hash)
|
143
|
+
assert_equal('823', token_response.authorizationResponse.response)
|
144
|
+
assert_equal('Token was invalid', token_response.authorizationResponse.message)
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_61
|
148
|
+
customer_hash = {
|
149
|
+
'orderId' => '61',
|
150
|
+
'amount' => '15000',
|
151
|
+
'orderSource' => 'ecommerce',
|
152
|
+
'billToAddress'=>{
|
153
|
+
'firstName' => 'Tom',
|
154
|
+
'lastName' => 'Black'},
|
155
|
+
'echeck' => {'accType' => 'Checking', 'accNum' => '1099999003', 'routingNum' => '114567895'}
|
156
|
+
}
|
157
|
+
hash = customer_hash.merge(@@merchant_hash)
|
158
|
+
token_response = LitleOnlineRequest.new.echeck_sale(hash)
|
159
|
+
assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
|
160
|
+
assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
|
161
|
+
assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
|
162
|
+
assert_equal('003', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
163
|
+
assert_equal('111922223333444003', token_response.echeckSalesResponse.tokenResponse.litleToken)
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_62
|
167
|
+
customer_hash = {
|
168
|
+
'orderId' => '62',
|
169
|
+
'amount' => '15000',
|
170
|
+
'orderSource' => 'ecommerce',
|
171
|
+
'billToAddress'=>{
|
172
|
+
'firstName' => 'Tom',
|
173
|
+
'lastName' => 'Black'},
|
174
|
+
'echeck' => {'accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '114567895'}
|
175
|
+
}
|
176
|
+
hash = customer_hash.merge(@@merchant_hash)
|
177
|
+
token_response = LitleOnlineRequest.new.echeck_sale(hash)
|
178
|
+
assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
|
179
|
+
assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
|
180
|
+
assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
|
181
|
+
assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
182
|
+
assert_equal('111922223333444999', token_response.echeckSalesResponse.tokenResponse.litleToken)
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_63
|
186
|
+
customer_hash = {
|
187
|
+
'orderId' => '63',
|
188
|
+
'amount' => '15000',
|
189
|
+
'orderSource' => 'ecommerce',
|
190
|
+
'billToAddress'=>{
|
191
|
+
'firstName' => 'Tom',
|
192
|
+
'lastName' => 'Black'},
|
193
|
+
'echeck' => {'accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '214567892'}
|
194
|
+
}
|
195
|
+
hash = customer_hash.merge(@@merchant_hash)
|
196
|
+
token_response = LitleOnlineRequest.new.echeck_sale(hash)
|
197
|
+
assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
|
198
|
+
assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
|
199
|
+
assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
|
200
|
+
assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
201
|
+
assert_equal('111922223333555999', token_response.echeckSalesResponse.tokenResponse.litleToken)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
@@ -0,0 +1,337 @@
|
|
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
|
+
|
26
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
27
|
+
require 'test/unit'
|
28
|
+
require 'fileutils'
|
29
|
+
|
30
|
+
module LitleOnline
|
31
|
+
class LitleBatchCertTest < Test::Unit::TestCase
|
32
|
+
def setup
|
33
|
+
path = "/tmp/litle-sdk-for-ruby"
|
34
|
+
FileUtils.rm_rf path
|
35
|
+
if(!File.directory?(path))
|
36
|
+
Dir.mkdir(path)
|
37
|
+
end
|
38
|
+
path = "/tmp/litle-sdk-for-ruby/cert/"
|
39
|
+
if(!File.directory?(path))
|
40
|
+
Dir.mkdir(path)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_MEGA_batch
|
45
|
+
authHash = {
|
46
|
+
'reportGroup'=>'Planets',
|
47
|
+
'orderId'=>'12344',
|
48
|
+
'amount'=>'106',
|
49
|
+
'orderSource'=>'ecommerce',
|
50
|
+
'card'=>{
|
51
|
+
'type'=>'VI',
|
52
|
+
'number' =>'4100000000000001',
|
53
|
+
'expDate' =>'1210'
|
54
|
+
}}
|
55
|
+
|
56
|
+
saleHash = {
|
57
|
+
'reportGroup'=>'Planets',
|
58
|
+
'id' => '006',
|
59
|
+
'orderId'=>'12344',
|
60
|
+
'amount'=>'6000',
|
61
|
+
'orderSource'=>'ecommerce',
|
62
|
+
'card'=>{
|
63
|
+
'type'=>'VI',
|
64
|
+
'number' =>'4100000000000001',
|
65
|
+
'expDate' =>'1210'
|
66
|
+
}}
|
67
|
+
|
68
|
+
creditHash = {
|
69
|
+
'merchantId' => '101',
|
70
|
+
'version'=>'8.8',
|
71
|
+
'reportGroup'=>'Planets',
|
72
|
+
'orderId'=>'12344',
|
73
|
+
'amount'=>'106',
|
74
|
+
'orderSource'=>'ecommerce',
|
75
|
+
'card'=>{
|
76
|
+
'type'=>'VI',
|
77
|
+
'number' =>'4100000000000001',
|
78
|
+
'expDate' =>'1210'
|
79
|
+
}}
|
80
|
+
|
81
|
+
authReversalHash = {
|
82
|
+
'merchantId' => '101',
|
83
|
+
'version'=>'8.8',
|
84
|
+
'reportGroup'=>'Planets',
|
85
|
+
'litleTxnId'=>'12345678000',
|
86
|
+
'amount'=>'106',
|
87
|
+
'payPalNotes'=>'Notes'
|
88
|
+
}
|
89
|
+
|
90
|
+
registerTokenHash = {
|
91
|
+
'merchantId' => '101',
|
92
|
+
'version'=>'8.8',
|
93
|
+
'reportGroup'=>'Planets',
|
94
|
+
'orderId'=>'12344',
|
95
|
+
'accountNumber'=>'1233456789103801'
|
96
|
+
}
|
97
|
+
|
98
|
+
updateCardHash = {
|
99
|
+
'merchantId' => '101',
|
100
|
+
'version'=>'8.8',
|
101
|
+
'reportGroup'=>'Planets',
|
102
|
+
'id'=>'12345',
|
103
|
+
'customerId'=>'0987',
|
104
|
+
'orderId'=>'12344',
|
105
|
+
'litleToken'=>'1233456789103801',
|
106
|
+
'cardValidationNum'=>'123'
|
107
|
+
}
|
108
|
+
|
109
|
+
forceCaptHash = {
|
110
|
+
'merchantId' => '101',
|
111
|
+
'version'=>'8.8',
|
112
|
+
'reportGroup'=>'Planets',
|
113
|
+
'litleTxnId'=>'123456',
|
114
|
+
'orderId'=>'12344',
|
115
|
+
'amount'=>'106',
|
116
|
+
'orderSource'=>'ecommerce',
|
117
|
+
'card'=>{
|
118
|
+
'type'=>'VI',
|
119
|
+
'number' =>'4100000000000001',
|
120
|
+
'expDate' =>'1210'
|
121
|
+
}}
|
122
|
+
|
123
|
+
captHash = {
|
124
|
+
'merchantId' => '101',
|
125
|
+
'version'=>'8.8',
|
126
|
+
'reportGroup'=>'Planets',
|
127
|
+
'litleTxnId'=>'123456000',
|
128
|
+
'amount'=>'106',
|
129
|
+
}
|
130
|
+
|
131
|
+
captGivenAuthHash = {
|
132
|
+
'merchantId' => '101',
|
133
|
+
'version'=>'8.8',
|
134
|
+
'reportGroup'=>'Planets',
|
135
|
+
'orderId'=>'12344',
|
136
|
+
'amount'=>'106',
|
137
|
+
'authInformation' => {
|
138
|
+
'authDate'=>'2002-10-09','authCode'=>'543216',
|
139
|
+
'authAmount'=>'12345'
|
140
|
+
},
|
141
|
+
'orderSource'=>'ecommerce',
|
142
|
+
'card'=>{
|
143
|
+
'type'=>'VI',
|
144
|
+
'number' =>'4100000000000000',
|
145
|
+
'expDate' =>'1210'
|
146
|
+
}}
|
147
|
+
|
148
|
+
echeckVerificationHash = {
|
149
|
+
'merchantId' => '101',
|
150
|
+
'version'=>'8.8',
|
151
|
+
'reportGroup'=>'Planets',
|
152
|
+
'amount'=>'123456',
|
153
|
+
'orderId'=>'12345',
|
154
|
+
'orderSource'=>'ecommerce',
|
155
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
156
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
157
|
+
}
|
158
|
+
|
159
|
+
echeckCreditHash = {
|
160
|
+
'merchantId' => '101',
|
161
|
+
'version'=>'8.8',
|
162
|
+
'reportGroup'=>'Planets',
|
163
|
+
'litleTxnId'=>'123456789101112',
|
164
|
+
'amount'=>'12'
|
165
|
+
}
|
166
|
+
|
167
|
+
echeckRedeopsitHash = {
|
168
|
+
'merchantId' => '101',
|
169
|
+
'version'=>'8.8',
|
170
|
+
'reportGroup'=>'Planets',
|
171
|
+
'litleTxnId'=>'123456'
|
172
|
+
}
|
173
|
+
|
174
|
+
echeckSaleHash = {
|
175
|
+
'merchantId' => '101',
|
176
|
+
'version'=>'8.8',
|
177
|
+
'reportGroup'=>'Planets',
|
178
|
+
'amount'=>'123456',
|
179
|
+
'verify'=>'true',
|
180
|
+
'orderId'=>'12345',
|
181
|
+
'orderSource'=>'ecommerce',
|
182
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
183
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
184
|
+
}
|
185
|
+
|
186
|
+
accountUpdateHash = {
|
187
|
+
'reportGroup'=>'Planets',
|
188
|
+
'id'=>'12345',
|
189
|
+
'customerId'=>'0987',
|
190
|
+
'orderId'=>'1234',
|
191
|
+
'card'=>{
|
192
|
+
'type'=>'VI',
|
193
|
+
'number' =>'4100000000000001',
|
194
|
+
'expDate' =>'1210'
|
195
|
+
}}
|
196
|
+
|
197
|
+
path = "/tmp/litle-sdk-for-ruby/cert/"
|
198
|
+
|
199
|
+
request = LitleRequest.new({'sessionId'=>'8675309'})
|
200
|
+
|
201
|
+
request.create_new_litle_request(path)
|
202
|
+
batch = LitleBatchRequest.new
|
203
|
+
batch.create_new_batch(path)
|
204
|
+
|
205
|
+
batch.account_update(accountUpdateHash)
|
206
|
+
batch.auth_reversal(authReversalHash)
|
207
|
+
batch.authorization(authHash)
|
208
|
+
batch.capture(captHash)
|
209
|
+
batch.capture_given_auth(captGivenAuthHash)
|
210
|
+
batch.credit(creditHash)
|
211
|
+
batch.echeck_credit(echeckCreditHash)
|
212
|
+
batch.echeck_redeposit(echeckRedeopsitHash)
|
213
|
+
batch.echeck_sale(echeckSaleHash)
|
214
|
+
batch.echeck_verification(echeckVerificationHash)
|
215
|
+
batch.force_capture(forceCaptHash)
|
216
|
+
batch.register_token_request(registerTokenHash)
|
217
|
+
batch.sale(saleHash)
|
218
|
+
batch.update_card_validation_num_on_token(updateCardHash)
|
219
|
+
|
220
|
+
#close the batch, indicating we plan to add no more transactions
|
221
|
+
batch.close_batch()
|
222
|
+
#add the batch to the LitleRequest
|
223
|
+
request.commit_batch(batch)
|
224
|
+
#finish the Litle Request, indicating we plan to add no more batches
|
225
|
+
request.finish_request
|
226
|
+
|
227
|
+
#send the batch files at the given directory over sFTP
|
228
|
+
request.send_to_litle
|
229
|
+
|
230
|
+
#grab the expected number of responses from the sFTP server and save them to the given path
|
231
|
+
request.get_responses_from_server()
|
232
|
+
|
233
|
+
count = 0
|
234
|
+
#process the responses from the server with a listener which applies the given block
|
235
|
+
request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
|
236
|
+
assert_not_nil transaction["litleTxnId"] =~ /\d+/
|
237
|
+
assert_not_nil transaction["response"] =~ /\d+/
|
238
|
+
assert_not_nil transaction["message"]
|
239
|
+
count+=1
|
240
|
+
end})
|
241
|
+
assert_equal count, 14
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_mini_batch_borked_counts
|
245
|
+
echeckSaleHash = {
|
246
|
+
'merchantId' => '101',
|
247
|
+
'version'=>'8.8',
|
248
|
+
'reportGroup'=>'Planets',
|
249
|
+
'amount'=>'123456',
|
250
|
+
'verify'=>'true',
|
251
|
+
'orderId'=>'12345',
|
252
|
+
'orderSource'=>'ecommerce',
|
253
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
254
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
255
|
+
}
|
256
|
+
|
257
|
+
path = "/tmp/litle-sdk-for-ruby/cert/"
|
258
|
+
|
259
|
+
request = LitleRequest.new({'sessionId'=>'8675309'})
|
260
|
+
|
261
|
+
request.create_new_litle_request(path)
|
262
|
+
batch = LitleBatchRequest.new
|
263
|
+
batch.create_new_batch(path)
|
264
|
+
|
265
|
+
batch.echeck_sale(echeckSaleHash)
|
266
|
+
|
267
|
+
#make this a bad batch
|
268
|
+
batch.get_counts_and_amounts[:sale][:numSales] += 1
|
269
|
+
#close the batch, indicating we plan to add no more transactions
|
270
|
+
batch.close_batch()
|
271
|
+
#add the batch to the LitleRequest
|
272
|
+
request.commit_batch(batch)
|
273
|
+
|
274
|
+
#finish the Litle Request, indicating we plan to add no more batches
|
275
|
+
request.finish_request
|
276
|
+
|
277
|
+
#send the batch files at the given directory over sFTP
|
278
|
+
request.send_to_litle
|
279
|
+
|
280
|
+
#grab the expected number of responses from the sFTP server and save them to the given path
|
281
|
+
request.get_responses_from_server()
|
282
|
+
|
283
|
+
assert_raise RuntimeError do
|
284
|
+
#process the responses from the server with a listener which applies the given block
|
285
|
+
request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
|
286
|
+
end})
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
def test_mini_batch_borked_amounts
|
291
|
+
echeckSaleHash = {
|
292
|
+
'merchantId' => '101',
|
293
|
+
'version'=>'8.8',
|
294
|
+
'reportGroup'=>'Planets',
|
295
|
+
'amount'=>'123456',
|
296
|
+
'verify'=>'true',
|
297
|
+
'orderId'=>'12345',
|
298
|
+
'orderSource'=>'ecommerce',
|
299
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
300
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
301
|
+
}
|
302
|
+
|
303
|
+
path = "/tmp/litle-sdk-for-ruby/cert/"
|
304
|
+
|
305
|
+
request = LitleRequest.new({'sessionId'=>'8675309'})
|
306
|
+
|
307
|
+
request.create_new_litle_request(path)
|
308
|
+
batch = LitleBatchRequest.new
|
309
|
+
batch.create_new_batch(path)
|
310
|
+
|
311
|
+
batch.echeck_sale(echeckSaleHash)
|
312
|
+
|
313
|
+
#make this a bad batch
|
314
|
+
batch.get_counts_and_amounts[:sale][:saleAmount] += 1
|
315
|
+
#close the batch, indicating we plan to add no more transactions
|
316
|
+
batch.close_batch()
|
317
|
+
#add the batch to the LitleRequest
|
318
|
+
request.commit_batch(batch)
|
319
|
+
|
320
|
+
#finish the Litle Request, indicating we plan to add no more batches
|
321
|
+
request.finish_request
|
322
|
+
|
323
|
+
#send the batch files at the given directory over sFTP
|
324
|
+
request.send_to_litle
|
325
|
+
|
326
|
+
#grab the expected number of responses from the sFTP server and save them to the given path
|
327
|
+
request.get_responses_from_server()
|
328
|
+
|
329
|
+
# we are checking the litleResponse header for a filed response code and raising it as an error
|
330
|
+
assert_raise RuntimeError do
|
331
|
+
#process the responses from the server with a listener which applies the given block
|
332
|
+
request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
|
333
|
+
end})
|
334
|
+
end
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|