VantivCnp 8.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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 +224 -0
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
require 'mocha/setup'
|
|
28
|
+
module LitleOnline
|
|
29
|
+
class TestActivateReversal < Test::Unit::TestCase
|
|
30
|
+
|
|
31
|
+
def test_simple
|
|
32
|
+
hash = {
|
|
33
|
+
'merchantId' => '101',
|
|
34
|
+
'version'=>'8.8',
|
|
35
|
+
'reportGroup'=>'Planets',
|
|
36
|
+
'litleTxnId' => '5000'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activateReversal reportGroup="Planets"><litleTxnId>5000<\/litleTxnId><\/activateReversal>.*/m), is_a(Hash))
|
|
40
|
+
LitleOnlineRequest.new.activate_reversal(hash)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
@@ -0,0 +1,421 @@
|
|
|
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
|
+
require 'mocha/setup'
|
|
28
|
+
|
|
29
|
+
#test Authorization Transaction
|
|
30
|
+
module LitleOnline
|
|
31
|
+
class TestAuth < Test::Unit::TestCase
|
|
32
|
+
def test_success_re_auth
|
|
33
|
+
hash = {
|
|
34
|
+
'merchantId' => '101',
|
|
35
|
+
'version'=>'8.8',
|
|
36
|
+
'reportGroup'=>'Planets',
|
|
37
|
+
'litleTxnId'=>'123456'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>123456<\/litleTxnId>.*/m), is_a(Hash))
|
|
41
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_success_applepay
|
|
45
|
+
hash = {
|
|
46
|
+
'merchantId' => '101',
|
|
47
|
+
'version'=>'8.8',
|
|
48
|
+
'reportGroup'=>'Planets',
|
|
49
|
+
'orderId'=>'12344',
|
|
50
|
+
'amount'=>'106',
|
|
51
|
+
'orderSource'=>'ecommerce',
|
|
52
|
+
'applepay'=>{
|
|
53
|
+
'data'=>'user',
|
|
54
|
+
'header'=>{
|
|
55
|
+
'applicationData'=>'454657413164',
|
|
56
|
+
'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
57
|
+
'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
58
|
+
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
|
59
|
+
},
|
|
60
|
+
'signature' =>'sign',
|
|
61
|
+
'version' =>'1'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<authorization.*?<applepay>.*?<data>user<\/data>.*?<\/applepay>.*?<\/authorization>.*?/m), is_a(Hash))
|
|
66
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def test_both_choices_card_and_applepay
|
|
70
|
+
hash = {
|
|
71
|
+
'merchantId' => '101',
|
|
72
|
+
'version'=>'8.8',
|
|
73
|
+
'reportGroup'=>'Planets',
|
|
74
|
+
'orderId'=>'12344',
|
|
75
|
+
'amount'=>'106',
|
|
76
|
+
'orderSource'=>'ecommerce',
|
|
77
|
+
'card'=>{
|
|
78
|
+
'type'=>'VI',
|
|
79
|
+
'number' =>'4100000000000001',
|
|
80
|
+
'expDate' =>'1210'
|
|
81
|
+
},
|
|
82
|
+
'applepay'=>{
|
|
83
|
+
'data'=>'user',
|
|
84
|
+
'header'=>{
|
|
85
|
+
'applicationData'=>'454657413164',
|
|
86
|
+
'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
87
|
+
'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
88
|
+
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
|
89
|
+
},
|
|
90
|
+
'signature' =>'sign',
|
|
91
|
+
'version' =>'1'
|
|
92
|
+
}}
|
|
93
|
+
|
|
94
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
|
95
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_both_choices_card_and_paypal
|
|
99
|
+
hash = {
|
|
100
|
+
'merchantId' => '101',
|
|
101
|
+
'version'=>'8.8',
|
|
102
|
+
'reportGroup'=>'Planets',
|
|
103
|
+
'orderId'=>'12344',
|
|
104
|
+
'amount'=>'106',
|
|
105
|
+
'orderSource'=>'ecommerce',
|
|
106
|
+
'card'=>{
|
|
107
|
+
'type'=>'VI',
|
|
108
|
+
'number' =>'4100000000000001',
|
|
109
|
+
'expDate' =>'1210'
|
|
110
|
+
},
|
|
111
|
+
'paypal'=>{
|
|
112
|
+
'payerId'=>'1234',
|
|
113
|
+
'token'=>'1234',
|
|
114
|
+
'transactionId'=>'123456'
|
|
115
|
+
}}
|
|
116
|
+
|
|
117
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
|
118
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def test_three_choices_card_and_paypage_and_paypal
|
|
122
|
+
hash = {
|
|
123
|
+
'merchantId' => '101',
|
|
124
|
+
'version'=>'8.8',
|
|
125
|
+
'reportGroup'=>'Planets',
|
|
126
|
+
'orderId'=>'12344',
|
|
127
|
+
'amount'=>'106',
|
|
128
|
+
'orderSource'=>'ecommerce',
|
|
129
|
+
'card'=>{
|
|
130
|
+
'type'=>'VI',
|
|
131
|
+
'number' =>'4100000000000001',
|
|
132
|
+
'expDate' =>'1210'
|
|
133
|
+
},
|
|
134
|
+
'paypage'=> {
|
|
135
|
+
'paypageRegistrationId'=>'1234',
|
|
136
|
+
'expDate'=>'1210',
|
|
137
|
+
'cardValidationNum'=>'555',
|
|
138
|
+
'type'=>'VI'},
|
|
139
|
+
'paypal'=>{
|
|
140
|
+
'payerId'=>'1234',
|
|
141
|
+
'token'=>'1234',
|
|
142
|
+
'transactionId'=>'123456'
|
|
143
|
+
}}
|
|
144
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
|
145
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def test_all_choices_card_and_paypage_and_paypal_and_token
|
|
149
|
+
hash = {
|
|
150
|
+
'merchantId' => '101',
|
|
151
|
+
'version'=>'8.8',
|
|
152
|
+
'reportGroup'=>'Planets',
|
|
153
|
+
# 'litleTxnId'=>'123456',
|
|
154
|
+
'orderId'=>'12344',
|
|
155
|
+
'amount'=>'106',
|
|
156
|
+
'orderSource'=>'ecommerce',
|
|
157
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
|
158
|
+
'bypassVelocityCheckcardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
|
159
|
+
'card'=>{
|
|
160
|
+
'type'=>'VI',
|
|
161
|
+
'number' =>'4100000000000001',
|
|
162
|
+
'expDate' =>'1210'
|
|
163
|
+
},
|
|
164
|
+
'paypage'=> {
|
|
165
|
+
'paypageRegistrationId'=>'1234',
|
|
166
|
+
'expDate'=>'1210',
|
|
167
|
+
'cardValidationNum'=>'555',
|
|
168
|
+
'type'=>'VI'},
|
|
169
|
+
'paypal'=>{
|
|
170
|
+
'payerId'=>'1234',
|
|
171
|
+
'token'=>'1234',
|
|
172
|
+
'transactionId'=>'123456'},
|
|
173
|
+
'token'=> {
|
|
174
|
+
'litleToken'=>'1234567890123',
|
|
175
|
+
'expDate'=>'1210',
|
|
176
|
+
'cardValidationNum'=>'555',
|
|
177
|
+
'type'=>'VI'
|
|
178
|
+
}}
|
|
179
|
+
|
|
180
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
|
181
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def test_merchant_data_auth
|
|
185
|
+
hash = {
|
|
186
|
+
'merchantId' => '101',
|
|
187
|
+
'version'=>'8.12',
|
|
188
|
+
'orderId'=>'1',
|
|
189
|
+
'amount'=>'0',
|
|
190
|
+
'orderSource'=>'ecommerce',
|
|
191
|
+
'reportGroup'=>'Planets',
|
|
192
|
+
'merchantData'=> {
|
|
193
|
+
'campaign'=>'foo'
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
XMLObject.expects(:new)
|
|
198
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<merchantData>.*?<campaign>foo<\/campaign>.*?<\/merchantData>.*/m),kind_of(Hash))
|
|
199
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def test_fraud_filter_override
|
|
203
|
+
hash = {
|
|
204
|
+
'merchantId' => '101',
|
|
205
|
+
'version'=>'8.12',
|
|
206
|
+
'orderId'=>'1',
|
|
207
|
+
'amount'=>'0',
|
|
208
|
+
'orderSource'=>'ecommerce',
|
|
209
|
+
'reportGroup'=>'Planets',
|
|
210
|
+
'fraudFilterOverride'=> 'true'
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
XMLObject.expects(:new)
|
|
214
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*?<fraudFilterOverride>true<\/fraudFilterOverride>.*?<\/authorization>.*/m),kind_of(Hash))
|
|
215
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def test_pos_without_capability
|
|
219
|
+
hash = {
|
|
220
|
+
'merchantId' => '101',
|
|
221
|
+
'version'=>'8.8',
|
|
222
|
+
'reportGroup'=>'Planets',
|
|
223
|
+
'orderId'=>'12344',
|
|
224
|
+
'amount'=>'106',
|
|
225
|
+
'orderSource'=>'ecommerce',
|
|
226
|
+
'pos'=>{'entryMode'=>'track1','cardholderId'=>'pin'},
|
|
227
|
+
'card'=>{
|
|
228
|
+
'type'=>'VI',
|
|
229
|
+
'number' =>'4100000000000001',
|
|
230
|
+
'expDate' =>'1210'
|
|
231
|
+
}}
|
|
232
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
|
233
|
+
assert_match /If pos is specified, it must have a capability/, exception.message
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
def test_paypal_missing_payer_id
|
|
237
|
+
hash = {
|
|
238
|
+
'merchantId' => '101',
|
|
239
|
+
'version'=>'8.8',
|
|
240
|
+
'reportGroup'=>'Planets',
|
|
241
|
+
'orderId'=>'12344',
|
|
242
|
+
'amount'=>'106',
|
|
243
|
+
'orderSource'=>'ecommerce',
|
|
244
|
+
'paypal'=>{
|
|
245
|
+
'token'=>'1234',
|
|
246
|
+
'transactionId'=>'123456'
|
|
247
|
+
}}
|
|
248
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
|
249
|
+
assert_match /If paypal is specified, it must have a payerId/, exception.message
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def test_paypal_missing_transaction_id
|
|
253
|
+
hash = {
|
|
254
|
+
'merchantId' => '101',
|
|
255
|
+
'version'=>'8.8',
|
|
256
|
+
'reportGroup'=>'Planets',
|
|
257
|
+
'orderId'=>'12344',
|
|
258
|
+
'amount'=>'106',
|
|
259
|
+
'orderSource'=>'ecommerce',
|
|
260
|
+
'paypal'=>{
|
|
261
|
+
'token'=>'1234',
|
|
262
|
+
'payerId'=>'123456'
|
|
263
|
+
}}
|
|
264
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
|
265
|
+
assert_match /If paypal is specified, it must have a transactionId/, exception.message
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
def test_pos_without_capability_and_entry_mode
|
|
269
|
+
hash = {
|
|
270
|
+
'merchantId' => '101',
|
|
271
|
+
'version'=>'8.8',
|
|
272
|
+
'reportGroup'=>'Planets',
|
|
273
|
+
'orderId'=>'12344',
|
|
274
|
+
'amount'=>'106',
|
|
275
|
+
'orderSource'=>'ecommerce',
|
|
276
|
+
'pos'=>{'cardholderId'=>'pin','capability'=>'notused'},
|
|
277
|
+
'card'=>{
|
|
278
|
+
'type'=>'VI',
|
|
279
|
+
'number' =>'4100000000000001',
|
|
280
|
+
'expDate' =>'1210'
|
|
281
|
+
}}
|
|
282
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.authorization(hash)}
|
|
283
|
+
assert_match /If pos is specified, it must have a entryMode/, exception.message
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
def test_auth_override_username
|
|
287
|
+
hash = {
|
|
288
|
+
'merchantId' => '101',
|
|
289
|
+
'user' => 'UNIT',
|
|
290
|
+
'password' => 'TEST',
|
|
291
|
+
'version'=>'8.12',
|
|
292
|
+
'orderId'=>'1',
|
|
293
|
+
'amount'=>'0',
|
|
294
|
+
'orderSource'=>'ecommerce',
|
|
295
|
+
'reportGroup'=>'Planets',
|
|
296
|
+
'fraudFilterOverride'=> 'true'
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
XMLObject.expects(:new)
|
|
300
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authentication.*?<user>UNIT<\/user>.*?<\/authentication>.*/m),kind_of(Hash))
|
|
301
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
def test_auth_override_password
|
|
305
|
+
hash = {
|
|
306
|
+
'merchantId' => '101',
|
|
307
|
+
'user' => 'UNIT',
|
|
308
|
+
'password' => 'TEST',
|
|
309
|
+
'version'=>'8.12',
|
|
310
|
+
'orderId'=>'1',
|
|
311
|
+
'amount'=>'0',
|
|
312
|
+
'orderSource'=>'ecommerce',
|
|
313
|
+
'reportGroup'=>'Planets',
|
|
314
|
+
'fraudFilterOverride'=> 'true'
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
XMLObject.expects(:new)
|
|
318
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<authentication.*?<password>TEST<\/password>.*?<\/authentication>.*/m),kind_of(Hash))
|
|
319
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
def test_logged_in_user
|
|
323
|
+
hash = {
|
|
324
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
|
325
|
+
'merchantId' => '101',
|
|
326
|
+
'version'=>'8.8',
|
|
327
|
+
'reportGroup'=>'Planets',
|
|
328
|
+
'litleTxnId'=>'123456',
|
|
329
|
+
'loggedInUser'=>'gdake'
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
|
333
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
def test_surcharge_amount
|
|
337
|
+
hash = {
|
|
338
|
+
'orderId' => '12344',
|
|
339
|
+
'amount' => '2',
|
|
340
|
+
'surchargeAmount' => '1',
|
|
341
|
+
'orderSource' => 'ecommerce',
|
|
342
|
+
'reportGroup' => 'Planets'
|
|
343
|
+
}
|
|
344
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
|
345
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def test_secondary_amount
|
|
349
|
+
hash = {
|
|
350
|
+
'orderId' => '12344',
|
|
351
|
+
'amount' => '2',
|
|
352
|
+
'secondaryAmount' => '1',
|
|
353
|
+
'orderSource' => 'ecommerce',
|
|
354
|
+
'reportGroup' => 'Planets'
|
|
355
|
+
}
|
|
356
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
|
357
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
def test_surcharge_amount_optional
|
|
361
|
+
hash = {
|
|
362
|
+
'orderId' => '12344',
|
|
363
|
+
'amount' => '2',
|
|
364
|
+
'orderSource' => 'ecommerce',
|
|
365
|
+
'reportGroup' => 'Planets'
|
|
366
|
+
}
|
|
367
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
|
368
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
def test_method_of_payment_allows_giftcard
|
|
372
|
+
hash = {
|
|
373
|
+
'orderId' => '12344',
|
|
374
|
+
'amount' => '2',
|
|
375
|
+
'orderSource' => 'ecommerce',
|
|
376
|
+
'card' => {
|
|
377
|
+
'number' => '4141000000000000',
|
|
378
|
+
'expDate' => '1210',
|
|
379
|
+
'type' => 'GC'
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<card><type>GC<\/type><number>4141000000000000<\/number><expDate>1210<\/expDate><\/card>.*/m), is_a(Hash))
|
|
383
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
def test_advanced_fraud_check
|
|
387
|
+
hash = {
|
|
388
|
+
'orderId' => '12344',
|
|
389
|
+
'amount' => '2',
|
|
390
|
+
'orderSource' => 'ecommerce',
|
|
391
|
+
'card' => {
|
|
392
|
+
'number' => '4141000000000000',
|
|
393
|
+
'expDate' => '1210',
|
|
394
|
+
'type' => 'GC'
|
|
395
|
+
} ,
|
|
396
|
+
'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
|
|
397
|
+
}
|
|
398
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudChecks><threatMetrixSessionId>1234<\/threatMetrixSessionId><\/advancedFraudChecks>.*/m), is_a(Hash))
|
|
399
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
def test_mpos
|
|
403
|
+
hash = {
|
|
404
|
+
'orderId' => '12344',
|
|
405
|
+
'amount' => '2',
|
|
406
|
+
'orderSource' => 'ecommerce',
|
|
407
|
+
'mpos'=>
|
|
408
|
+
{
|
|
409
|
+
'ksn'=>'ksnString',
|
|
410
|
+
'formatId'=>'30',
|
|
411
|
+
'encryptedTrack'=>'encryptedTrackString',
|
|
412
|
+
'track1Status'=>'0',
|
|
413
|
+
'track2Status'=>'0'
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<mpos><ksn>ksnString<\/ksn><formatId>30<\/formatId><encryptedTrack>encryptedTrackString<\/encryptedTrack><track1Status>0<\/track1Status><track2Status>0<\/track2Status><\/mpos>.*/m), is_a(Hash))
|
|
417
|
+
LitleOnlineRequest.new.authorization(hash)
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
end
|
|
421
|
+
end
|