LitleOnline 8.10.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.
- data/DESCRIPTION +5 -0
- data/LICENSE +22 -0
- data/README.md +69 -0
- data/Rakefile +92 -0
- data/SETUP.md +47 -0
- data/bin/Setup.rb +103 -0
- data/bin/sample_driver.rb +49 -0
- data/index.html +176 -0
- data/index.html.1 +176 -0
- data/lib/Checker.rb +56 -0
- data/lib/Communications.rb +85 -0
- data/lib/Configuration.rb +45 -0
- data/lib/LitleOnline.rb +52 -0
- data/lib/LitleOnlineRequest.rb +399 -0
- data/lib/LitleXmlMapper.rb +48 -0
- data/lib/Obj2xml.rb +37 -0
- data/lib/XMLFields.rb +378 -0
- data/test/certification/certTest1_base.rb +948 -0
- data/test/certification/certTest2_authenhanced.rb +571 -0
- data/test/certification/certTest3_authreversal.rb +184 -0
- data/test/certification/certTest4_echeck.rb +279 -0
- data/test/certification/certTest5_token.rb +222 -0
- data/test/certification/ts_all.rb +31 -0
- data/test/functional/test_auth.rb +135 -0
- data/test/functional/test_authReversal.rb +68 -0
- data/test/functional/test_capture.rb +71 -0
- data/test/functional/test_captureGivenAuth.rb +161 -0
- data/test/functional/test_credit.rb +154 -0
- data/test/functional/test_echeckCredit.rb +116 -0
- data/test/functional/test_echeckRedeposit.rb +78 -0
- data/test/functional/test_echeckSale.rb +157 -0
- data/test/functional/test_echeckVerification.rb +92 -0
- data/test/functional/test_forceCapture.rb +105 -0
- data/test/functional/test_sale.rb +198 -0
- data/test/functional/test_token.rb +102 -0
- data/test/functional/test_xmlfields.rb +403 -0
- data/test/functional/ts_all.rb +39 -0
- data/test/unit/test_Checker.rb +58 -0
- data/test/unit/test_LitleOnlineRequest.rb +288 -0
- data/test/unit/test_auth.rb +168 -0
- data/test/unit/test_authReversal.rb +41 -0
- data/test/unit/test_capture.rb +40 -0
- data/test/unit/test_captureGivenAuth.rb +108 -0
- data/test/unit/test_credit.rb +117 -0
- data/test/unit/test_echeckCredit.rb +45 -0
- data/test/unit/test_echeckRedeposit.rb +76 -0
- data/test/unit/test_echeckSale.rb +45 -0
- data/test/unit/test_echeckVerification.rb +75 -0
- data/test/unit/test_forceCapture.rb +122 -0
- data/test/unit/test_sale.rb +249 -0
- data/test/unit/test_token.rb +70 -0
- data/test/unit/test_xmlfields.rb +173 -0
- data/test/unit/ts_unit.rb +41 -0
- metadata +166 -0
@@ -0,0 +1,222 @@
|
|
1
|
+
require 'lib/LitleOnline'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
class Litle_certTest5 < Test::Unit::TestCase
|
5
|
+
#### test token transactions with merchantid 087902 username IMPTKN, password cert3d6Z#####
|
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.registerTokenRequest(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.registerTokenRequest(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.registerTokenRequest(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 #merchant is not authorized for echeck tokens
|
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.registerTokenRequest(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 #merchant is not authorized for echeck tokens
|
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.registerTokenRequest(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_58
|
122
|
+
## customer_hash = {
|
123
|
+
## 'orderId' => '58',
|
124
|
+
## 'amount' => '15000',
|
125
|
+
## 'orderSource' => 'ecommerce',
|
126
|
+
##
|
127
|
+
## 'card' => {'expDate' => '1112', 'cardValidationNum' => '987'}
|
128
|
+
## }
|
129
|
+
## hash = customer_hash.merge(@@merchant_hash)
|
130
|
+
## token_response = LitleOnlineRequest.new.authorization(hash)
|
131
|
+
## assert_equal('000', token_response.authorizationResponse.response)
|
132
|
+
## assert_equal('Approved', token_response.authorizationResponse.message)
|
133
|
+
## assert_equal('801', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
|
134
|
+
## assert_equal('Account number was successfully registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
|
135
|
+
## assert_equal('MC', token_response.authorizationResponse.tokenResponse.type)
|
136
|
+
## assert_equal('543510', token_response.authorizationResponse.tokenResponse.bin)
|
137
|
+
## end
|
138
|
+
#
|
139
|
+
def test_59
|
140
|
+
customer_hash = {
|
141
|
+
'orderId' => '59',
|
142
|
+
'amount' => '15000',
|
143
|
+
'orderSource' => 'ecommerce',
|
144
|
+
'token' => {'litleToken' => '1712990000040196', 'expDate' => '1112'}
|
145
|
+
}
|
146
|
+
hash = customer_hash.merge(@@merchant_hash)
|
147
|
+
token_response = LitleOnlineRequest.new.authorization(hash)
|
148
|
+
assert_equal('822', token_response.authorizationResponse.response)
|
149
|
+
assert_equal('Token was not found', token_response.authorizationResponse.message)
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_60
|
153
|
+
customer_hash = {
|
154
|
+
'orderId' => '60',
|
155
|
+
'amount' => '15000',
|
156
|
+
'orderSource' => 'ecommerce',
|
157
|
+
'token' => {'litleToken' => '1712999999999999', 'expDate' => '1112'}
|
158
|
+
}
|
159
|
+
hash = customer_hash.merge(@@merchant_hash)
|
160
|
+
token_response = LitleOnlineRequest.new.authorization(hash)
|
161
|
+
assert_equal('823', token_response.authorizationResponse.response)
|
162
|
+
assert_equal('Token was invalid', token_response.authorizationResponse.message)
|
163
|
+
end
|
164
|
+
|
165
|
+
# test 61-64 need echecksale to support token. merchantid not authoried.
|
166
|
+
def test_61
|
167
|
+
customer_hash = {
|
168
|
+
'orderId' => '61',
|
169
|
+
'amount' => '15000',
|
170
|
+
'orderSource' => 'ecommerce',
|
171
|
+
'billToAddress'=>{
|
172
|
+
'firstName' => 'Tom',
|
173
|
+
'lastName' => 'Black'},
|
174
|
+
'echeck' => {'accType' => 'Checking', 'accNum' => '1099999003', 'routingNum' => '114567895'}
|
175
|
+
}
|
176
|
+
hash = customer_hash.merge(@@merchant_hash)
|
177
|
+
token_response = LitleOnlineRequest.new.echeckSale(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('003', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
182
|
+
assert_equal('111922223333444003', token_response.echeckSalesResponse.tokenResponse.litleToken)
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_62
|
186
|
+
customer_hash = {
|
187
|
+
'orderId' => '62',
|
188
|
+
'amount' => '15000',
|
189
|
+
'orderSource' => 'ecommerce',
|
190
|
+
'billToAddress'=>{
|
191
|
+
'firstName' => 'Tom',
|
192
|
+
'lastName' => 'Black'},
|
193
|
+
'echeck' => {'accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '114567895'}
|
194
|
+
}
|
195
|
+
hash = customer_hash.merge(@@merchant_hash)
|
196
|
+
token_response = LitleOnlineRequest.new.echeckSale(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('111922223333444999', token_response.echeckSalesResponse.tokenResponse.litleToken)
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_63
|
205
|
+
customer_hash = {
|
206
|
+
'orderId' => '63',
|
207
|
+
'amount' => '15000',
|
208
|
+
'orderSource' => 'ecommerce',
|
209
|
+
'billToAddress'=>{
|
210
|
+
'firstName' => 'Tom',
|
211
|
+
'lastName' => 'Black'},
|
212
|
+
'echeck' => {'accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '214567892'}
|
213
|
+
}
|
214
|
+
hash = customer_hash.merge(@@merchant_hash)
|
215
|
+
token_response = LitleOnlineRequest.new.echeckSale(hash)
|
216
|
+
assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
|
217
|
+
assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
|
218
|
+
assert_equal('EC', token_response.echeckSalesResponse.tokenResponse.type)
|
219
|
+
assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
220
|
+
assert_equal('111922223333555999', token_response.echeckSalesResponse.tokenResponse.litleToken)
|
221
|
+
end
|
222
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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
|
+
#test driver for running all tests
|
27
|
+
require_relative 'certTest1_base'
|
28
|
+
require_relative 'certTest2_authenhanced'
|
29
|
+
require_relative 'certTest3_authreversal'
|
30
|
+
require_relative 'certTest4_echeck'
|
31
|
+
require_relative 'certTest5_token'
|
@@ -0,0 +1,135 @@
|
|
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 'lib/LitleOnline'
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
#test Authorization Transaction
|
29
|
+
class TestAuth < Test::Unit::TestCase
|
30
|
+
def test_simpleAuthwithCard
|
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' =>'4100000000000002',
|
41
|
+
'expDate' =>'1210'
|
42
|
+
}}
|
43
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
44
|
+
assert_equal('000', response.authorizationResponse.response)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_simpleAuthwithpaypal
|
48
|
+
hash = {
|
49
|
+
'merchantId' => '101',
|
50
|
+
'version'=>'8.8',
|
51
|
+
'reportGroup'=>'Planets',
|
52
|
+
'amount'=>'106',
|
53
|
+
'orderId'=>'123456',
|
54
|
+
'orderSource'=>'ecommerce',
|
55
|
+
'paypal'=>{
|
56
|
+
'payerId'=>'1234',
|
57
|
+
'token'=>'1234',
|
58
|
+
'transactionId'=>'123456'
|
59
|
+
}}
|
60
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
61
|
+
assert_equal 'Valid Format', response.message
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_illegalorderSource
|
65
|
+
hash = {
|
66
|
+
'merchantId' => '101',
|
67
|
+
'version'=>'8.8',
|
68
|
+
'reportGroup'=>'Planets',
|
69
|
+
'orderId'=>'12344',
|
70
|
+
'amount'=>'106',
|
71
|
+
'orderSource'=>'ecomerce', #This order source is mispelled on purpose!
|
72
|
+
'card'=>{
|
73
|
+
'type'=>'VI',
|
74
|
+
'number' =>'4100000000000001',
|
75
|
+
'expDate' =>'1210'
|
76
|
+
}}
|
77
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
78
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_FieldsOutOfOrder
|
82
|
+
hash = {
|
83
|
+
'merchantId' => '101',
|
84
|
+
'version'=>'8.8',
|
85
|
+
'reportGroup'=>'Planets',
|
86
|
+
'orderId'=>'12344',
|
87
|
+
'card'=>{
|
88
|
+
'type'=>'VI',
|
89
|
+
'number' =>'4100000000000002',
|
90
|
+
'expDate' =>'1210'
|
91
|
+
},
|
92
|
+
'orderSource'=>'ecommerce',
|
93
|
+
'amount'=>'106'
|
94
|
+
}
|
95
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
96
|
+
assert_equal('000', response.authorizationResponse.response)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_InvalidField
|
100
|
+
hash = {
|
101
|
+
'merchantId' => '101',
|
102
|
+
'version'=>'8.8',
|
103
|
+
'reportGroup'=>'Planets',
|
104
|
+
'orderId'=>'12344',
|
105
|
+
'amount'=>'106',
|
106
|
+
'orderSource'=>'ecommerce',
|
107
|
+
'card'=>{
|
108
|
+
'NOexistantField' => 'ShouldNotCauseError',
|
109
|
+
'type'=>'VI',
|
110
|
+
'number' =>'4100000000000002',
|
111
|
+
'expDate' =>'1210'
|
112
|
+
}}
|
113
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
114
|
+
assert_equal('000', response.authorizationResponse.response)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_poswithoutCapabilityandentryMode
|
118
|
+
hash = {
|
119
|
+
'merchantId' => '101',
|
120
|
+
'version'=>'8.8',
|
121
|
+
'reportGroup'=>'Planets',
|
122
|
+
'orderId'=>'12344',
|
123
|
+
'amount'=>'106',
|
124
|
+
'orderSource'=>'ecommerce',
|
125
|
+
'pos'=>{'cardholderId'=>'pin'},
|
126
|
+
'card'=>{
|
127
|
+
'type'=>'VI',
|
128
|
+
'number' =>'4100000000000001',
|
129
|
+
'expDate' =>'1210'
|
130
|
+
}}
|
131
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
132
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
@@ -0,0 +1,68 @@
|
|
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 'lib/LitleOnline'
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
class TestAuthReversal < Test::Unit::TestCase
|
29
|
+
def test_simpleAuthReversal
|
30
|
+
hash = {
|
31
|
+
'merchantId' => '101',
|
32
|
+
'version'=>'8.8',
|
33
|
+
'reportGroup'=>'Planets',
|
34
|
+
'litleTxnId'=>'12345678000',
|
35
|
+
'amount'=>'106',
|
36
|
+
'payPalNotes'=>'Notes'
|
37
|
+
}
|
38
|
+
response= LitleOnlineRequest.new.authReversal(hash)
|
39
|
+
assert_equal('Valid Format', response.message)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_FieldsOutOfOrder
|
43
|
+
hash = {
|
44
|
+
'merchantId' => '101',
|
45
|
+
'version'=>'8.8',
|
46
|
+
'litleTxnId'=>'12345000',
|
47
|
+
'payPalNotes'=>'Notes',
|
48
|
+
'amount'=>'106',
|
49
|
+
'reportGroup'=>'Planets',
|
50
|
+
}
|
51
|
+
response= LitleOnlineRequest.new.authReversal(hash)
|
52
|
+
assert_equal('Valid Format', response.message)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_InvalidField
|
56
|
+
hash = {
|
57
|
+
'merchantId' => '101',
|
58
|
+
'version'=>'8.8',
|
59
|
+
'litleTxnId'=>'12345678000',
|
60
|
+
'NonexistentField'=>'none',
|
61
|
+
'payPalNotes'=>'Notes',
|
62
|
+
'amount'=>'106',
|
63
|
+
'reportGroup'=>'Planets',
|
64
|
+
}
|
65
|
+
response= LitleOnlineRequest.new.authReversal(hash)
|
66
|
+
assert_equal('Valid Format', response.message)
|
67
|
+
end
|
68
|
+
end
|