LitleOnline 8.12.3 → 8.12.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +1 -1
- data/lib/Communications.rb +34 -32
- data/lib/Configuration.rb +13 -11
- data/lib/LitleOnline.rb +0 -1
- data/lib/LitleOnlineRequest.rb +546 -543
- data/lib/LitleXmlMapper.rb +17 -15
- data/lib/XMLFields.rb +903 -901
- data/test/certification/certTest1_base.rb +935 -933
- data/test/certification/certTest2_authenhanced.rb +548 -546
- data/test/certification/certTest3_authreversal.rb +179 -177
- data/test/certification/certTest4_echeck.rb +245 -243
- data/test/certification/certTest5_token.rb +198 -196
- data/test/functional/test_auth.rb +205 -204
- data/test/functional/test_authReversal.rb +41 -39
- data/test/functional/test_capture.rb +54 -52
- data/test/functional/test_captureGivenAuth.rb +153 -152
- data/test/functional/test_credit.rb +126 -126
- data/test/functional/test_echeckCredit.rb +88 -87
- data/test/functional/test_echeckRedeposit.rb +85 -84
- data/test/functional/test_echeckSale.rb +132 -131
- data/test/functional/test_echeckVerification.rb +97 -95
- data/test/functional/test_forceCapture.rb +113 -111
- data/test/functional/test_sale.rb +200 -198
- data/test/functional/test_token.rb +75 -73
- data/test/functional/test_xmlfields.rb +558 -558
- data/test/unit/test_LitleOnlineRequest.rb +210 -207
- data/test/unit/test_auth.rb +119 -116
- data/test/unit/test_authReversal.rb +16 -16
- data/test/unit/test_capture.rb +10 -8
- data/test/unit/test_captureGivenAuth.rb +62 -59
- data/test/unit/test_credit.rb +103 -100
- data/test/unit/test_echeckCredit.rb +15 -14
- data/test/unit/test_echeckRedeposit.rb +14 -13
- data/test/unit/test_echeckSale.rb +16 -15
- data/test/unit/test_echeckVerification.rb +14 -13
- data/test/unit/test_forceCapture.rb +61 -58
- data/test/unit/test_sale.rb +206 -205
- data/test/unit/test_token.rb +43 -41
- data/test/unit/test_xmlfields.rb +101 -99
- metadata +58 -77
- data/lib/Obj2xml.rb +0 -37
@@ -1,202 +1,204 @@
|
|
1
1
|
require 'lib/LitleOnline'
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
'
|
7
|
-
|
8
|
-
|
9
|
-
def test_50
|
10
|
-
customer_hash = {
|
11
|
-
'orderId' => '50',
|
12
|
-
'accountNumber' => '4457119922390123'
|
13
|
-
}
|
14
|
-
hash = customer_hash.merge(@@merchant_hash)
|
15
|
-
token_response = LitleOnlineRequest.new.register_token_request(hash)
|
16
|
-
assert_equal('445711', token_response.registerTokenResponse.bin)
|
17
|
-
assert_equal('VI', token_response.registerTokenResponse['type'])
|
18
|
-
assert_equal('801', token_response.registerTokenResponse.response)
|
19
|
-
assert_equal('1111222233330123', token_response.registerTokenResponse.litleToken)
|
20
|
-
assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_51
|
24
|
-
customer_hash = {
|
25
|
-
'orderId' => '51',
|
26
|
-
'accountNumber' => '4457119999999999'
|
27
|
-
}
|
28
|
-
hash = customer_hash.merge(@@merchant_hash)
|
29
|
-
token_response = LitleOnlineRequest.new.register_token_request(hash)
|
30
|
-
assert_equal('820', token_response.registerTokenResponse.response)
|
31
|
-
assert_equal('Credit card number was invalid', token_response.registerTokenResponse.message)
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_52
|
35
|
-
customer_hash = {
|
36
|
-
'orderId' => '52',
|
37
|
-
'accountNumber' => '4457119922390123'
|
38
|
-
}
|
39
|
-
hash = customer_hash.merge(@@merchant_hash)
|
40
|
-
token_response = LitleOnlineRequest.new.register_token_request(hash)
|
41
|
-
assert_equal('445711', token_response.registerTokenResponse.bin)
|
42
|
-
assert_equal('VI', token_response.registerTokenResponse['type'])
|
43
|
-
assert_equal('802', token_response.registerTokenResponse.response)
|
44
|
-
assert_equal('1111222233330123', token_response.registerTokenResponse.litleToken)
|
45
|
-
assert_equal('Account number was previously registered', token_response.registerTokenResponse.message)
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_53
|
49
|
-
customer_hash = {
|
50
|
-
'orderId' => '53',
|
51
|
-
'echeckForToken'=>{'accNum'=>'1099999998','routingNum'=>'114567895'}
|
52
|
-
}
|
53
|
-
hash = customer_hash.merge(@@merchant_hash)
|
54
|
-
token_response = LitleOnlineRequest.new.register_token_request(hash)
|
55
|
-
assert_equal('EC', token_response.registerTokenResponse['type'])
|
56
|
-
assert_equal('998', token_response.registerTokenResponse.eCheckAccountSuffix)
|
57
|
-
assert_equal('801', token_response.registerTokenResponse.response)
|
58
|
-
assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
|
59
|
-
assert_equal('111922223333000998', token_response.registerTokenResponse.litleToken)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_54
|
63
|
-
customer_hash = {
|
64
|
-
'orderId' => '54',
|
65
|
-
'echeckForToken'=>{'accNum'=>'1022222102','routingNum'=>'1145_7895'}
|
66
|
-
}
|
67
|
-
hash = customer_hash.merge(@@merchant_hash)
|
68
|
-
token_response = LitleOnlineRequest.new.register_token_request(hash)
|
69
|
-
assert_equal('900', token_response.registerTokenResponse.response)
|
70
|
-
assert_equal('Invalid bank routing number', token_response.registerTokenResponse.message)
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_55
|
74
|
-
customer_hash = {
|
75
|
-
'orderId' => '55',
|
76
|
-
'amount' => '15000',
|
77
|
-
'orderSource' => 'ecommerce',
|
78
|
-
'card' => {'number' => '5435101234510196', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
|
79
|
-
}
|
80
|
-
hash = customer_hash.merge(@@merchant_hash)
|
81
|
-
token_response = LitleOnlineRequest.new.authorization(hash)
|
82
|
-
assert_equal('000', token_response.authorizationResponse.response)
|
83
|
-
assert_equal('Approved', token_response.authorizationResponse.message)
|
84
|
-
assert_equal('801', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
|
85
|
-
assert_equal('Account number was successfully registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
|
86
|
-
assert_equal('MC', token_response.authorizationResponse.tokenResponse['type'])
|
87
|
-
assert_equal('543510', token_response.authorizationResponse.tokenResponse.bin)
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_56
|
91
|
-
customer_hash = {
|
92
|
-
'orderId' => '56',
|
93
|
-
'amount' => '15000',
|
94
|
-
'orderSource' => 'ecommerce',
|
95
|
-
'card' => {'number' => '5435109999999999', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
|
96
|
-
}
|
97
|
-
hash = customer_hash.merge(@@merchant_hash)
|
98
|
-
token_response = LitleOnlineRequest.new.authorization(hash)
|
99
|
-
assert_equal('301', token_response.authorizationResponse.response)
|
100
|
-
assert_equal('Invalid account number', token_response.authorizationResponse.message)
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_57
|
104
|
-
customer_hash = {
|
105
|
-
'orderId' => '57',
|
106
|
-
'amount' => '15000',
|
107
|
-
'orderSource' => 'ecommerce',
|
108
|
-
'card' => {'number' => '5435101234510196', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
|
4
|
+
module LitleOnline
|
5
|
+
class Litle_certTest5 < Test::Unit::TestCase
|
6
|
+
@@merchant_hash = {'reportGroup'=>'Planets',
|
7
|
+
'merchantId'=>'101'
|
109
8
|
}
|
110
|
-
hash = customer_hash.merge(@@merchant_hash)
|
111
|
-
token_response = LitleOnlineRequest.new.authorization(hash)
|
112
|
-
assert_equal('000', token_response.authorizationResponse.response)
|
113
|
-
assert_equal('Approved', token_response.authorizationResponse.message)
|
114
|
-
assert_equal('802', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
|
115
|
-
assert_equal('Account number was previously registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
|
116
|
-
assert_equal('MC', token_response.authorizationResponse.tokenResponse['type'])
|
117
|
-
assert_equal('543510', token_response.authorizationResponse.tokenResponse.bin)
|
118
|
-
end
|
119
9
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
'
|
153
|
-
'
|
154
|
-
'
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
'
|
168
|
-
'
|
169
|
-
'
|
170
|
-
'
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
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
|
201
203
|
end
|
202
|
-
end
|
204
|
+
end
|
@@ -26,213 +26,214 @@ require 'lib/LitleOnline'
|
|
26
26
|
require 'test/unit'
|
27
27
|
|
28
28
|
#test Authorization Transaction
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
def test_simple_auth_with_paypal
|
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_illegal_order_source
|
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_fields_out_of_order
|
82
|
-
hash = {
|
83
|
-
'merchantId' => '101',
|
84
|
-
'version'=>'8.8',
|
85
|
-
'reportGroup'=>'Planets',
|
86
|
-
'orderId'=>'12344',
|
87
|
-
'card'=>{
|
88
|
-
'type'=>'VI',
|
89
|
-
'number' =>'4100000000000000',
|
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_invalid_field
|
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' =>'4100000000000000',
|
111
|
-
'expDate' =>'1210'
|
112
|
-
}}
|
113
|
-
response= LitleOnlineRequest.new.authorization(hash)
|
114
|
-
assert_equal('000', response.authorizationResponse.response)
|
115
|
-
end
|
116
|
-
|
117
|
-
def test_pos_without_capability_and_entry_mode
|
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
|
29
|
+
module LitleOnline
|
30
|
+
class TestAuth < Test::Unit::TestCase
|
31
|
+
def test_simple_auth_with_card
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'orderId'=>'12344',
|
37
|
+
'amount'=>'106',
|
38
|
+
'orderSource'=>'ecommerce',
|
39
|
+
'card'=>{
|
40
|
+
'type'=>'VI',
|
41
|
+
'number' =>'4100000000000000',
|
42
|
+
'expDate' =>'1210'
|
43
|
+
}}
|
44
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
45
|
+
assert_equal('000', response.authorizationResponse.response)
|
46
|
+
end
|
134
47
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
48
|
+
def test_simple_auth_with_paypal
|
49
|
+
hash = {
|
50
|
+
'merchantId' => '101',
|
51
|
+
'version'=>'8.8',
|
52
|
+
'reportGroup'=>'Planets',
|
53
|
+
'amount'=>'106',
|
54
|
+
'orderId'=>'123456',
|
55
|
+
'orderSource'=>'ecommerce',
|
56
|
+
'paypal'=>{
|
57
|
+
'payerId'=>'1234',
|
58
|
+
'token'=>'1234',
|
59
|
+
'transactionId'=>'123456'
|
60
|
+
}}
|
61
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
62
|
+
assert_equal 'Valid Format', response.message
|
63
|
+
end
|
150
64
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
assert(response.message =~ /Error validating xml data against the schema/)
|
182
|
-
end
|
183
|
-
|
184
|
-
def test_authorization_missing_attributes
|
185
|
-
hash={
|
186
|
-
'reportGroup'=>'Planets',
|
187
|
-
'amount'=>'106',
|
188
|
-
|
189
|
-
'orderSource'=>'ecommerce',
|
190
|
-
'card'=>{
|
191
|
-
'type'=>'VI',
|
192
|
-
'number' =>'4100000000000001',
|
193
|
-
'expDate' =>'1210'
|
194
|
-
}}
|
195
|
-
|
196
|
-
response= LitleOnlineRequest.new.authorization(hash)
|
197
|
-
assert(response.message =~ /Error validating xml data against the schema/)
|
198
|
-
end
|
199
|
-
|
200
|
-
def test_orderId_required
|
201
|
-
start_hash = {
|
202
|
-
'merchantId'=>'101',
|
203
|
-
'reportGroup'=>'Planets',
|
204
|
-
'amount'=>'101',
|
205
|
-
'orderSource'=>'ecommerce',
|
206
|
-
'card' => {
|
207
|
-
'type' => 'VI',
|
208
|
-
'number' => '1111222233334444'
|
65
|
+
def test_illegal_order_source
|
66
|
+
hash = {
|
67
|
+
'merchantId' => '101',
|
68
|
+
'version'=>'8.8',
|
69
|
+
'reportGroup'=>'Planets',
|
70
|
+
'orderId'=>'12344',
|
71
|
+
'amount'=>'106',
|
72
|
+
'orderSource'=>'ecomerce', #This order source is mispelled on purpose!
|
73
|
+
'card'=>{
|
74
|
+
'type'=>'VI',
|
75
|
+
'number' =>'4100000000000001',
|
76
|
+
'expDate' =>'1210'
|
77
|
+
}}
|
78
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
79
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_fields_out_of_order
|
83
|
+
hash = {
|
84
|
+
'merchantId' => '101',
|
85
|
+
'version'=>'8.8',
|
86
|
+
'reportGroup'=>'Planets',
|
87
|
+
'orderId'=>'12344',
|
88
|
+
'card'=>{
|
89
|
+
'type'=>'VI',
|
90
|
+
'number' =>'4100000000000000',
|
91
|
+
'expDate' =>'1210'
|
92
|
+
},
|
93
|
+
'orderSource'=>'ecommerce',
|
94
|
+
'amount'=>'106'
|
209
95
|
}
|
210
|
-
|
211
|
-
|
212
|
-
|
96
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
97
|
+
assert_equal('000', response.authorizationResponse.response)
|
98
|
+
end
|
213
99
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
assert_equal('000', response.authorizationResponse.response)
|
100
|
+
def test_invalid_field
|
101
|
+
hash = {
|
102
|
+
'merchantId' => '101',
|
103
|
+
'version'=>'8.8',
|
104
|
+
'reportGroup'=>'Planets',
|
105
|
+
'orderId'=>'12344',
|
106
|
+
'amount'=>'106',
|
107
|
+
'orderSource'=>'ecommerce',
|
108
|
+
'card'=>{
|
109
|
+
'NOexistantField' => 'ShouldNotCauseError',
|
110
|
+
'type'=>'VI',
|
111
|
+
'number' =>'4100000000000000',
|
112
|
+
'expDate' =>'1210'
|
113
|
+
}}
|
114
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
115
|
+
assert_equal('000', response.authorizationResponse.response)
|
116
|
+
end
|
232
117
|
|
233
|
-
|
234
|
-
|
235
|
-
|
118
|
+
def test_pos_without_capability_and_entry_mode
|
119
|
+
hash = {
|
120
|
+
'merchantId' => '101',
|
121
|
+
'version'=>'8.8',
|
122
|
+
'reportGroup'=>'Planets',
|
123
|
+
'orderId'=>'12344',
|
124
|
+
'amount'=>'106',
|
125
|
+
'orderSource'=>'ecommerce',
|
126
|
+
'pos'=>{'cardholderId'=>'pin'},
|
127
|
+
'card'=>{
|
128
|
+
'type'=>'VI',
|
129
|
+
'number' =>'4100000000000001',
|
130
|
+
'expDate' =>'1210'
|
131
|
+
}}
|
132
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
133
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_no_order_id
|
137
|
+
hash = {
|
138
|
+
'merchantId' => '101',
|
139
|
+
'version'=>'8.8',
|
140
|
+
'reportGroup'=>'Planets',
|
141
|
+
'amount'=>'106',
|
142
|
+
'orderSource'=>'ecommerce',
|
143
|
+
'card'=>{
|
144
|
+
'type'=>'VI',
|
145
|
+
'number' =>'4100000000000001',
|
146
|
+
'expDate' =>'1210'
|
147
|
+
}}
|
148
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
149
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_no_amount
|
153
|
+
hash = {
|
154
|
+
'merchantId' => '101',
|
155
|
+
'version'=>'8.8',
|
156
|
+
'reportGroup'=>'Planets',
|
157
|
+
'orderId'=>'12344',
|
158
|
+
'orderSource'=>'ecommerce',
|
159
|
+
'card'=>{
|
160
|
+
'type'=>'VI',
|
161
|
+
'number' =>'4100000000000001',
|
162
|
+
'expDate' =>'1210'
|
163
|
+
}}
|
164
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
165
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
166
|
+
end
|
236
167
|
|
237
|
-
|
238
|
-
|
168
|
+
def test_no_order_source
|
169
|
+
hash = {
|
170
|
+
'merchantId' => '101',
|
171
|
+
'version'=>'8.8',
|
172
|
+
'reportGroup'=>'Planets',
|
173
|
+
# 'litleTxnId'=>'123456',
|
174
|
+
'orderId'=>'12344',
|
175
|
+
'amount'=>'106',
|
176
|
+
'card'=>{
|
177
|
+
'type'=>'VI',
|
178
|
+
'number' =>'4100000000000001',
|
179
|
+
'expDate' =>'1210'
|
180
|
+
}}
|
181
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
182
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_authorization_missing_attributes
|
186
|
+
hash={
|
187
|
+
'reportGroup'=>'Planets',
|
188
|
+
'amount'=>'106',
|
189
|
+
|
190
|
+
'orderSource'=>'ecommerce',
|
191
|
+
'card'=>{
|
192
|
+
'type'=>'VI',
|
193
|
+
'number' =>'4100000000000001',
|
194
|
+
'expDate' =>'1210'
|
195
|
+
}}
|
196
|
+
|
197
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
198
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_orderId_required
|
202
|
+
start_hash = {
|
203
|
+
'merchantId'=>'101',
|
204
|
+
'reportGroup'=>'Planets',
|
205
|
+
'amount'=>'101',
|
206
|
+
'orderSource'=>'ecommerce',
|
207
|
+
'card' => {
|
208
|
+
'type' => 'VI',
|
209
|
+
'number' => '1111222233334444'
|
210
|
+
}
|
211
|
+
}
|
212
|
+
response= LitleOnlineRequest.new.authorization(start_hash)
|
213
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
214
|
+
|
215
|
+
response = LitleOnlineRequest.new.authorization(start_hash.merge({'orderId'=>'1234'}))
|
216
|
+
assert_equal('000', response.authorizationResponse.response)
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_ssn_optional
|
220
|
+
start_hash = {
|
221
|
+
'orderId'=>'12344',
|
222
|
+
'merchantId'=>'101',
|
223
|
+
'reportGroup'=>'Planets',
|
224
|
+
'amount'=>'101',
|
225
|
+
'orderSource'=>'ecommerce',
|
226
|
+
'card' => {
|
227
|
+
'type' => 'VI',
|
228
|
+
'number' => '1111222233334444'
|
229
|
+
},
|
230
|
+
}
|
231
|
+
response = LitleOnlineRequest.new.authorization(start_hash)
|
232
|
+
assert_equal('000', response.authorizationResponse.response)
|
233
|
+
|
234
|
+
response = LitleOnlineRequest.new.authorization(start_hash.merge({'customerInfo'=>{'ssn'=>'000112222'} }))
|
235
|
+
assert_equal('000', response.authorizationResponse.response)
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
239
|
+
end
|