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,342 @@
|
|
|
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
|
+
module LitleOnline
|
|
30
|
+
class TestCredit < Test::Unit::TestCase
|
|
31
|
+
def test_both_choices_card_and_paypal
|
|
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' =>'4100000000000001',
|
|
42
|
+
'expDate' =>'1210'
|
|
43
|
+
},
|
|
44
|
+
'paypal'=>{
|
|
45
|
+
'payerEmail'=>'a@b.com',
|
|
46
|
+
'payerId'=>'1234',
|
|
47
|
+
'token'=>'1234',
|
|
48
|
+
'transactionId'=>'123456'
|
|
49
|
+
}}
|
|
50
|
+
|
|
51
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
|
52
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_three_choices_card_and_paypage_and_paypal
|
|
56
|
+
hash = {
|
|
57
|
+
'merchantId' => '101',
|
|
58
|
+
'version'=>'8.8',
|
|
59
|
+
'reportGroup'=>'Planets',
|
|
60
|
+
'orderId'=>'12344',
|
|
61
|
+
'amount'=>'106',
|
|
62
|
+
'orderSource'=>'ecommerce',
|
|
63
|
+
'card'=>{
|
|
64
|
+
'type'=>'VI',
|
|
65
|
+
'number' =>'4100000000000001',
|
|
66
|
+
'expDate' =>'1210'
|
|
67
|
+
},
|
|
68
|
+
'paypage'=> {
|
|
69
|
+
'paypageRegistrationId'=>'1234',
|
|
70
|
+
'expDate'=>'1210',
|
|
71
|
+
'cardValidationNum'=>'555',
|
|
72
|
+
'type'=>'VI'},
|
|
73
|
+
'paypal'=>{
|
|
74
|
+
'payerEmail'=>'a@b.com',
|
|
75
|
+
'payerId'=>'1234',
|
|
76
|
+
'token'=>'1234',
|
|
77
|
+
'transactionId'=>'123456'
|
|
78
|
+
}}
|
|
79
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
|
80
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def test_all_choices_card_and_paypage_and_paypal_and_token
|
|
84
|
+
hash = {
|
|
85
|
+
'merchantId' => '101',
|
|
86
|
+
'version'=>'8.8',
|
|
87
|
+
'reportGroup'=>'Planets',
|
|
88
|
+
'orderId'=>'12344',
|
|
89
|
+
'amount'=>'106',
|
|
90
|
+
'orderSource'=>'ecommerce',
|
|
91
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
|
92
|
+
'bypassVelocityCheckcardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
|
93
|
+
'card'=>{
|
|
94
|
+
'type'=>'VI',
|
|
95
|
+
'number' =>'4100000000000001',
|
|
96
|
+
'expDate' =>'1210'
|
|
97
|
+
},
|
|
98
|
+
'paypage'=> {
|
|
99
|
+
'paypageRegistrationId'=>'1234',
|
|
100
|
+
'expDate'=>'1210',
|
|
101
|
+
'cardValidationNum'=>'555',
|
|
102
|
+
'type'=>'VI'
|
|
103
|
+
},
|
|
104
|
+
'paypal'=>{
|
|
105
|
+
'payerId'=>'1234',
|
|
106
|
+
'payerEmail'=>'a@b.com',
|
|
107
|
+
'token'=>'1234',
|
|
108
|
+
'transactionId'=>'123456'
|
|
109
|
+
},
|
|
110
|
+
'token'=> {
|
|
111
|
+
'litleToken'=>'1234567890123',
|
|
112
|
+
'expDate'=>'1210',
|
|
113
|
+
'cardValidationNum'=>'555',
|
|
114
|
+
'type'=>'VI'
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
|
119
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def test_action_reason_on_orphaned_refund
|
|
123
|
+
hash = {
|
|
124
|
+
'merchantId' => '101',
|
|
125
|
+
'version'=>'8.12',
|
|
126
|
+
'orderId'=>'1',
|
|
127
|
+
'amount'=>'2',
|
|
128
|
+
'orderSource'=>'ecommerce',
|
|
129
|
+
'reportGroup'=>'Planets',
|
|
130
|
+
'actionReason'=> 'SUSPECT_FRAUD'
|
|
131
|
+
}
|
|
132
|
+
XMLObject.expects(:new)
|
|
133
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<actionReason>SUSPECT_FRAUD<\/actionReason>.*/m),kind_of(Hash))
|
|
134
|
+
LitleOnlineRequest.new.credit(hash)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def test_simple_enhanced_data_incorrect_enum_for_country_code
|
|
138
|
+
hash = {
|
|
139
|
+
'merchantId' => '101',
|
|
140
|
+
'version'=>'8.8',
|
|
141
|
+
'reportGroup'=>'Planets',
|
|
142
|
+
'orderId'=>'12344',
|
|
143
|
+
'amount'=>'106',
|
|
144
|
+
'card'=>{
|
|
145
|
+
'type'=>'VI',
|
|
146
|
+
'number' =>'4100000000000001',
|
|
147
|
+
'expDate' =>'1210'},
|
|
148
|
+
'orderSource'=>'ecommerce',
|
|
149
|
+
'enhancedData'=>{
|
|
150
|
+
'destinationCountryCode'=>'001',
|
|
151
|
+
'customerReference'=>'Litle',
|
|
152
|
+
'salesTax'=>'50',
|
|
153
|
+
'deliveryType'=>'TBD',
|
|
154
|
+
'shipFromPostalCode'=>'01741',
|
|
155
|
+
'destinationPostalCode'=>'01742'}
|
|
156
|
+
}
|
|
157
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
|
158
|
+
assert_match /If enhancedData destinationCountryCode is specified, it must be/, exception.message
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def test_token_with_incorrect_token_Length
|
|
162
|
+
hash = {
|
|
163
|
+
'merchantId' => '101',
|
|
164
|
+
'version'=>'8.8',
|
|
165
|
+
'reportGroup'=>'Planets',
|
|
166
|
+
'orderId'=>'12344',
|
|
167
|
+
'amount'=>'106',
|
|
168
|
+
'orderSource'=>'ecommerce',
|
|
169
|
+
'token'=> {
|
|
170
|
+
'litleToken'=>'123456789012',
|
|
171
|
+
'expDate'=>'1210',
|
|
172
|
+
'cardValidationNum'=>'555',
|
|
173
|
+
'type'=>'VI'
|
|
174
|
+
}}
|
|
175
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
|
176
|
+
assert_match /If token litleToken is specified, it must be between/, exception.message
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def test_token_missing_token
|
|
180
|
+
hash = {
|
|
181
|
+
'merchantId' => '101',
|
|
182
|
+
'version'=>'8.8',
|
|
183
|
+
'reportGroup'=>'Planets',
|
|
184
|
+
'orderId'=>'12344',
|
|
185
|
+
'amount'=>'106',
|
|
186
|
+
'orderSource'=>'ecommerce',
|
|
187
|
+
'token'=> {
|
|
188
|
+
'expDate'=>'1210',
|
|
189
|
+
'cardValidationNum'=>'555',
|
|
190
|
+
'type'=>'VI'
|
|
191
|
+
}}
|
|
192
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
|
193
|
+
assert_match /If token is specified, it must have a litleToken/, exception.message
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def test_pos_with_invalid_entry_mode
|
|
197
|
+
hash = {
|
|
198
|
+
'merchantId' => '101',
|
|
199
|
+
'version'=>'8.8',
|
|
200
|
+
'reportGroup'=>'Planets',
|
|
201
|
+
'orderId'=>'12344',
|
|
202
|
+
'amount'=>'106',
|
|
203
|
+
'orderSource'=>'ecommerce',
|
|
204
|
+
'pos'=>{'entryMode'=>'none','cardholderId'=>'pin','capability'=>'notused'},
|
|
205
|
+
'card'=>{
|
|
206
|
+
'type'=>'VI',
|
|
207
|
+
'number' =>'4100000000000001',
|
|
208
|
+
'expDate' =>'1210'
|
|
209
|
+
}}
|
|
210
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
|
211
|
+
assert_match /If pos entryMode is specified, it must be in/, exception.message
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def test_paypage_missing_id
|
|
215
|
+
hash = {
|
|
216
|
+
'merchantId' => '101',
|
|
217
|
+
'version'=>'8.8',
|
|
218
|
+
'reportGroup'=>'Planets',
|
|
219
|
+
'orderId'=>'12344',
|
|
220
|
+
'amount'=>'106',
|
|
221
|
+
'orderSource'=>'ecommerce',
|
|
222
|
+
'paypage'=> {
|
|
223
|
+
'expDate'=>'1210',
|
|
224
|
+
'cardValidationNum'=>'555',
|
|
225
|
+
'type'=>'VI'
|
|
226
|
+
}}
|
|
227
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
|
|
228
|
+
assert_match /If paypage is specified, it must have a paypageRegistrationId/, exception.message
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def test_logged_in_user
|
|
232
|
+
hash = {
|
|
233
|
+
'loggedInUser' => 'gdake',
|
|
234
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
|
235
|
+
'merchantId' => '101',
|
|
236
|
+
'version'=>'8.12',
|
|
237
|
+
'orderId'=>'1',
|
|
238
|
+
'amount'=>'2',
|
|
239
|
+
'orderSource'=>'ecommerce',
|
|
240
|
+
'reportGroup'=>'Planets'
|
|
241
|
+
}
|
|
242
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
|
243
|
+
LitleOnlineRequest.new.credit(hash)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def test_secondary_amount_tied
|
|
247
|
+
hash = {
|
|
248
|
+
'amount' => '2',
|
|
249
|
+
'secondaryAmount' => '1',
|
|
250
|
+
'litleTxnId' => '3',
|
|
251
|
+
'processingInstructions' => {},
|
|
252
|
+
'reportGroup' => 'Planets'
|
|
253
|
+
}
|
|
254
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><process.*/m), is_a(Hash))
|
|
255
|
+
LitleOnlineRequest.new.credit(hash)
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def test_surcharge_amount_tied
|
|
259
|
+
hash = {
|
|
260
|
+
'amount' => '2',
|
|
261
|
+
'surchargeAmount' => '1',
|
|
262
|
+
'litleTxnId' => '3',
|
|
263
|
+
'processingInstructions' => {},
|
|
264
|
+
'reportGroup' => 'Planets'
|
|
265
|
+
}
|
|
266
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><process.*/m), is_a(Hash))
|
|
267
|
+
LitleOnlineRequest.new.credit(hash)
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
def test_surcharge_amount_tied_optional
|
|
271
|
+
hash = {
|
|
272
|
+
'amount' => '2',
|
|
273
|
+
'litleTxnId' => '3',
|
|
274
|
+
'processingInstructions' => {},
|
|
275
|
+
'reportGroup' => 'Planets'
|
|
276
|
+
}
|
|
277
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><process.*/m), is_a(Hash))
|
|
278
|
+
LitleOnlineRequest.new.credit(hash)
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
def test_secondary_amount_orphan
|
|
282
|
+
hash = {
|
|
283
|
+
'amount' => '2',
|
|
284
|
+
'secondaryAmount' => '1',
|
|
285
|
+
'orderSource' => 'ecommerce',
|
|
286
|
+
'reportGroup' => 'Planets'
|
|
287
|
+
}
|
|
288
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
|
289
|
+
LitleOnlineRequest.new.credit(hash)
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
def test_surcharge_amount_orphan
|
|
293
|
+
hash = {
|
|
294
|
+
'amount' => '2',
|
|
295
|
+
'surchargeAmount' => '1',
|
|
296
|
+
'orderSource' => 'ecommerce',
|
|
297
|
+
'reportGroup' => 'Planets'
|
|
298
|
+
}
|
|
299
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
|
300
|
+
LitleOnlineRequest.new.credit(hash)
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
def test_surcharge_amount_orphan_optional
|
|
304
|
+
hash = {
|
|
305
|
+
'amount' => '2',
|
|
306
|
+
'orderSource' => 'ecommerce',
|
|
307
|
+
'reportGroup' => 'Planets'
|
|
308
|
+
}
|
|
309
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
|
310
|
+
LitleOnlineRequest.new.credit(hash)
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
def test_pos_tied
|
|
314
|
+
hash = {
|
|
315
|
+
'amount' => '2',
|
|
316
|
+
'pos' => {
|
|
317
|
+
'terminalId' => 'abc123',
|
|
318
|
+
'capability' => 'magstripe',
|
|
319
|
+
'entryMode' => 'keyed',
|
|
320
|
+
'cardholderId' => 'nopin',
|
|
321
|
+
'catLevel' => 'self service'
|
|
322
|
+
},
|
|
323
|
+
'litleTxnId' => '3',
|
|
324
|
+
'reportGroup' => 'Planets',
|
|
325
|
+
'orderSource' => 'ecommerce',
|
|
326
|
+
'payPalNotes' => 'notes'
|
|
327
|
+
}
|
|
328
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><pos><capability>magstripe<\/capability><entryMode>keyed<\/entryMode><cardholderId>nopin<\/cardholderId><terminalId>abc123<\/terminalId><catLevel>self service<\/catLevel><\/pos><payPalNotes>.*/m), is_a(Hash))
|
|
329
|
+
LitleOnlineRequest.new.credit(hash)
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
def test_post_tied_optional
|
|
333
|
+
hash = {
|
|
334
|
+
'amount' => '2',
|
|
335
|
+
'litleTxnId' => '3',
|
|
336
|
+
}
|
|
337
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>3<\/litleTxnId><amount>2<\/amount><\/credit>.*/m), is_a(Hash))
|
|
338
|
+
LitleOnlineRequest.new.credit(hash)
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
end
|
|
342
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
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 TestDeactivate < Test::Unit::TestCase
|
|
30
|
+
|
|
31
|
+
def test_simple
|
|
32
|
+
hash = {
|
|
33
|
+
'merchantId' => '101',
|
|
34
|
+
'version'=>'8.8',
|
|
35
|
+
'reportGroup'=>'Planets',
|
|
36
|
+
'orderId' => '11',
|
|
37
|
+
'orderSource'=>'ecommerce',
|
|
38
|
+
'card'=>
|
|
39
|
+
{
|
|
40
|
+
'type'=>'VI',
|
|
41
|
+
'number' =>'4100000000000001',
|
|
42
|
+
'expDate' =>'1210'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<deactivate reportGroup="Planets"><orderId>11<\/orderId><orderSource>ecommerce<\/orderSource><card><type>VI<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/deactivate>.*/m), is_a(Hash))
|
|
47
|
+
LitleOnlineRequest.new.deactivate(hash)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
@@ -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 TestDeactivateReversal < 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(/.*<deactivateReversal reportGroup="Planets"><litleTxnId>5000<\/litleTxnId><\/deactivateReversal>.*/m), is_a(Hash))
|
|
40
|
+
LitleOnlineRequest.new.deactivate_reversal(hash)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
@@ -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 TestDepositReversal < 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(/.*<depositReversal reportGroup="Planets"><litleTxnId>5000<\/litleTxnId><\/depositReversal>.*/m), is_a(Hash))
|
|
40
|
+
LitleOnlineRequest.new.deposit_reversal(hash)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|