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.
Files changed (120) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +139 -0
  3. data/CONTRIBUTORS +2 -0
  4. data/DESCRIPTION +5 -0
  5. data/LICENSE +22 -0
  6. data/README.md +72 -0
  7. data/Rakefile +89 -0
  8. data/SETUP.md +46 -0
  9. data/bin/Setup.rb +124 -0
  10. data/bin/sample_batch_driver.rb +123 -0
  11. data/bin/sample_driver.rb +49 -0
  12. data/lib/Communications.rb +85 -0
  13. data/lib/Configuration.rb +67 -0
  14. data/lib/EnvironmentVariables.rb +22 -0
  15. data/lib/LitleBatchRequest.rb +562 -0
  16. data/lib/LitleListeners.rb +142 -0
  17. data/lib/LitleOnline.rb +62 -0
  18. data/lib/LitleOnlineRequest.rb +297 -0
  19. data/lib/LitleRequest.rb +494 -0
  20. data/lib/LitleTransaction.rb +463 -0
  21. data/lib/LitleXmlMapper.rb +64 -0
  22. data/lib/XMLFields.rb +1869 -0
  23. data/lib/cacert.pem +3331 -0
  24. data/samples/Auth/LitleAuthReversalTransaction.rb +15 -0
  25. data/samples/Auth/LitleAuthorizationTransaction.rb +31 -0
  26. data/samples/Auth/LitlePaymentFullLifeCycle.rb +47 -0
  27. data/samples/Batch/AccountUpdate.rb +64 -0
  28. data/samples/Batch/SampleBatchDriver.rb +94 -0
  29. data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +30 -0
  30. data/samples/Capture/LitleCaptureTransaction.rb +14 -0
  31. data/samples/Capture/LitleForceCaptureTransaction.rb +26 -0
  32. data/samples/Capture/LitlePartialCapture.rb +16 -0
  33. data/samples/Credit/LitleCreditTransaction.rb +16 -0
  34. data/samples/Credit/LitleRefundTransaction.rb +29 -0
  35. data/samples/Other/LitleAvsTransaction.rb +34 -0
  36. data/samples/Other/LitleVoidTransaction.rb +18 -0
  37. data/samples/Paypage/FullPaypageLifeCycle.rb +74 -0
  38. data/samples/Run_all.rb +17 -0
  39. data/samples/Sale/LitleSaleTransaction.rb +29 -0
  40. data/samples/Sale/SampleSaleTransaction.rb +24 -0
  41. data/test/certification/certTest1_base.rb +945 -0
  42. data/test/certification/certTest2_authenhanced.rb +573 -0
  43. data/test/certification/certTest3_authreversal.rb +185 -0
  44. data/test/certification/certTest4_echeck.rb +278 -0
  45. data/test/certification/certTest5_token.rb +204 -0
  46. data/test/certification/certTest_batchAll.rb +337 -0
  47. data/test/certification/ts_all.rb +33 -0
  48. data/test/functional/test_activate.rb +100 -0
  49. data/test/functional/test_activateReversal.rb +56 -0
  50. data/test/functional/test_auth.rb +298 -0
  51. data/test/functional/test_authReversal.rb +69 -0
  52. data/test/functional/test_balanceInquiry.rb +80 -0
  53. data/test/functional/test_batch.rb +164 -0
  54. data/test/functional/test_batchStream.rb +145 -0
  55. data/test/functional/test_cancelSubscription.rb +55 -0
  56. data/test/functional/test_capture.rb +84 -0
  57. data/test/functional/test_captureGivenAuth.rb +235 -0
  58. data/test/functional/test_configuration.rb +89 -0
  59. data/test/functional/test_createPlan.rb +85 -0
  60. data/test/functional/test_credit.rb +174 -0
  61. data/test/functional/test_deactivate.rb +80 -0
  62. data/test/functional/test_deactivateReversal.rb +56 -0
  63. data/test/functional/test_depositReversal.rb +56 -0
  64. data/test/functional/test_echeckCredit.rb +134 -0
  65. data/test/functional/test_echeckRedeposit.rb +88 -0
  66. data/test/functional/test_echeckSale.rb +177 -0
  67. data/test/functional/test_echeckVerification.rb +127 -0
  68. data/test/functional/test_echeckVoid.rb +41 -0
  69. data/test/functional/test_forceCapture.rb +183 -0
  70. data/test/functional/test_litle_requests.rb +356 -0
  71. data/test/functional/test_load.rb +82 -0
  72. data/test/functional/test_loadReversal.rb +56 -0
  73. data/test/functional/test_override.rb +64 -0
  74. data/test/functional/test_refundReversal.rb +56 -0
  75. data/test/functional/test_sale.rb +259 -0
  76. data/test/functional/test_token.rb +115 -0
  77. data/test/functional/test_unload.rb +82 -0
  78. data/test/functional/test_unloadReversal.rb +56 -0
  79. data/test/functional/test_updateCardValidationNumOnToken.rb +43 -0
  80. data/test/functional/test_updatePlan.rb +58 -0
  81. data/test/functional/test_updateSubscription.rb +76 -0
  82. data/test/functional/test_xmlfields.rb +427 -0
  83. data/test/functional/ts_all.rb +66 -0
  84. data/test/unit/test_LitleAUBatch.rb +216 -0
  85. data/test/unit/test_LitleBatchRequest.rb +643 -0
  86. data/test/unit/test_LitleOnlineRequest.rb +295 -0
  87. data/test/unit/test_LitleRequest.rb +316 -0
  88. data/test/unit/test_LitleTransaction.rb +397 -0
  89. data/test/unit/test_activate.rb +92 -0
  90. data/test/unit/test_activateReversal.rb +44 -0
  91. data/test/unit/test_auth.rb +421 -0
  92. data/test/unit/test_authReversal.rb +82 -0
  93. data/test/unit/test_balanceInquiry.rb +52 -0
  94. data/test/unit/test_cancelSubscription.rb +43 -0
  95. data/test/unit/test_capture.rb +73 -0
  96. data/test/unit/test_captureGivenAuth.rb +188 -0
  97. data/test/unit/test_createPlan.rb +52 -0
  98. data/test/unit/test_credit.rb +342 -0
  99. data/test/unit/test_deactivate.rb +52 -0
  100. data/test/unit/test_deactivateReversal.rb +44 -0
  101. data/test/unit/test_depositReversal.rb +44 -0
  102. data/test/unit/test_echeckCredit.rb +71 -0
  103. data/test/unit/test_echeckRedeposit.rb +94 -0
  104. data/test/unit/test_echeckSale.rb +71 -0
  105. data/test/unit/test_echeckVerification.rb +71 -0
  106. data/test/unit/test_echeckVoid.rb +54 -0
  107. data/test/unit/test_forceCapture.rb +145 -0
  108. data/test/unit/test_load.rb +53 -0
  109. data/test/unit/test_loadReversal.rb +44 -0
  110. data/test/unit/test_refundReversal.rb +44 -0
  111. data/test/unit/test_sale.rb +465 -0
  112. data/test/unit/test_token.rb +144 -0
  113. data/test/unit/test_unload.rb +53 -0
  114. data/test/unit/test_unloadReversal.rb +44 -0
  115. data/test/unit/test_updateCardValidationNumOnToken.rb +80 -0
  116. data/test/unit/test_updatePlan.rb +45 -0
  117. data/test/unit/test_updateSubscription.rb +172 -0
  118. data/test/unit/test_xmlfields.rb +2930 -0
  119. data/test/unit/ts_unit.rb +65 -0
  120. metadata +224 -0
@@ -0,0 +1,397 @@
1
+ =begin
2
+ Copyright (c) 2011 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
+
27
+ require 'test/unit'
28
+ require 'mocha/setup'
29
+
30
+ module LitleOnline
31
+
32
+ class TestLitleTransaction < Test::Unit::TestCase
33
+ def test_authorization
34
+ ltlTxn = LitleTransaction.new
35
+ authHash = {
36
+ 'reportGroup'=>'Planets',
37
+ 'id'=>'12345',
38
+ 'customerId'=>'0987',
39
+ 'orderId'=>'12344',
40
+ 'amount'=>'106',
41
+ 'orderSource'=>'ecommerce',
42
+ 'card'=>{
43
+ 'type'=>'VI',
44
+ 'number' =>'4100000000000001',
45
+ 'expDate' =>'1210'
46
+ }}
47
+
48
+ result = ltlTxn.authorization(authHash)
49
+ assert_equal 'Planets', result.reportGroup
50
+ assert_equal '12345', result.transactionId
51
+ assert_equal '0987', result.customerId
52
+ assert_equal "12344", result.orderId
53
+ assert_equal "106", result.amount
54
+ assert_equal "ecommerce", result.orderSource
55
+ assert_equal "4100000000000001", result.card.number
56
+ assert_equal "VI", result.card.mop
57
+ assert_equal "1210", result.card.expDate
58
+ end
59
+
60
+ def test_sale
61
+ ltlTxn = LitleTransaction.new
62
+ saleHash = {
63
+ 'reportGroup'=>'Planets',
64
+ 'id'=>'12345',
65
+ 'customerId'=>'0987',
66
+ 'orderId'=>'12344',
67
+ 'amount'=>'6000',
68
+ 'orderSource'=>'ecommerce',
69
+ 'card'=>{
70
+ 'type'=>'VI',
71
+ 'number' =>'4100000000000001',
72
+ 'expDate' =>'1210'
73
+ }}
74
+
75
+ result = ltlTxn.sale(saleHash)
76
+ assert_equal 'Planets', result.reportGroup
77
+ assert_equal '12345', result.transactionId
78
+ assert_equal '0987', result.customerId
79
+ assert_equal "12344", result.orderId
80
+ assert_equal "6000", result.amount
81
+ assert_equal "ecommerce", result.orderSource
82
+ assert_equal "4100000000000001", result.card.number
83
+ assert_equal "VI", result.card.mop
84
+ assert_equal "1210", result.card.expDate
85
+ end
86
+
87
+ def test_credit
88
+ ltlTxn = LitleTransaction.new
89
+ creditHash = {
90
+ 'merchantId' => '101',
91
+ 'version'=>'8.8',
92
+ 'reportGroup'=>'Planets',
93
+ 'id'=>'12345',
94
+ 'customerId'=>'0987',
95
+ 'orderId'=>'12344',
96
+ 'amount'=>'106',
97
+ 'orderSource'=>'ecommerce',
98
+ 'card'=>{
99
+ 'type'=>'VI',
100
+ 'number' =>'4100000000000001',
101
+ 'expDate' =>'1210'
102
+ }}
103
+
104
+ result = ltlTxn.credit(creditHash)
105
+ assert_equal 'Planets', result.reportGroup
106
+ assert_equal '12345', result.transactionId
107
+ assert_equal '0987', result.customerId
108
+ assert_equal '12344', result.orderId
109
+ assert_equal '106', result.amount
110
+ assert_equal 'ecommerce', result.orderSource
111
+ assert_equal '4100000000000001', result.card.number
112
+ assert_equal 'VI', result.card.mop
113
+ assert_equal '1210', result.card.expDate
114
+ end
115
+
116
+ def test_auth_reversal
117
+ ltlTxn = LitleTransaction.new
118
+ authReversalHash = {
119
+ 'merchantId' => '101',
120
+ 'version'=>'8.8',
121
+ 'reportGroup'=>'Planets',
122
+ 'id'=>'12345',
123
+ 'customerId'=>'0987',
124
+ 'litleTxnId'=>'12345678000',
125
+ 'amount'=>'106',
126
+ 'payPalNotes'=>'Notes'
127
+ }
128
+
129
+ result = ltlTxn.auth_reversal(authReversalHash)
130
+ assert_equal 'Planets', result.reportGroup
131
+ assert_equal '12345', result.transactionId
132
+ assert_equal '0987', result.customerId
133
+ assert_equal '12345678000', result.litleTxnId
134
+ assert_equal '106', result.amount
135
+ assert_equal 'Notes', result.payPalNotes
136
+ end
137
+
138
+ def test_register_token_request
139
+ ltlTxn = LitleTransaction.new
140
+ registerTokenHash = {
141
+ 'merchantId' => '101',
142
+ 'version'=>'8.8',
143
+ 'reportGroup'=>'Planets',
144
+ 'id'=>'12345',
145
+ 'customerId'=>'0987',
146
+ 'orderId'=>'12344',
147
+ 'accountNumber'=>'1233456789103801'
148
+ }
149
+
150
+ result = ltlTxn.register_token_request(registerTokenHash)
151
+ assert_equal 'Planets', result.reportGroup
152
+ assert_equal '12345', result.transactionId
153
+ assert_equal '0987', result.customerId
154
+ assert_equal '12344', result.orderId
155
+ assert_equal '1233456789103801', result.accountNumber
156
+ end
157
+
158
+ def test_update_card_validation_num_on_token
159
+ ltlTxn = LitleTransaction.new
160
+ updateCardHash = {
161
+ 'merchantId' => '101',
162
+ 'version'=>'8.8',
163
+ 'reportGroup'=>'Planets',
164
+ 'id'=>'12345',
165
+ 'customerId'=>'0987',
166
+ 'orderId'=>'12344',
167
+ 'litleToken'=>'1233456789103801',
168
+ 'cardValidationNum'=>'123'
169
+ }
170
+
171
+ result = ltlTxn.update_card_validation_num_on_token(updateCardHash)
172
+ assert_equal 'Planets', result.reportGroup
173
+ assert_equal '12345', result.transactionId
174
+ assert_equal '0987', result.customerId
175
+ assert_equal '12344', result.orderId
176
+ assert_equal '1233456789103801', result.litleToken
177
+ assert_equal '123', result.cardValidationNum
178
+ end
179
+
180
+ def test_force_capture
181
+ ltlTxn = LitleTransaction.new
182
+ forceCaptHash = {
183
+ 'merchantId' => '101',
184
+ 'version'=>'8.8',
185
+ 'reportGroup'=>'Planets',
186
+ 'id'=>'12345',
187
+ 'customerId'=>'0987',
188
+ 'orderId'=>'12344',
189
+ 'amount'=>'106',
190
+ 'orderSource'=>'ecommerce',
191
+ 'card'=>{
192
+ 'type'=>'VI',
193
+ 'number' =>'4100000000000001',
194
+ 'expDate' =>'1210'
195
+ }}
196
+
197
+ result = ltlTxn.force_capture(forceCaptHash)
198
+ assert_equal 'Planets', result.reportGroup
199
+ assert_equal '12345', result.transactionId
200
+ assert_equal '0987', result.customerId
201
+ assert_equal '12344', result.orderId
202
+ assert_equal '106', result.amount
203
+ assert_equal 'ecommerce', result.orderSource
204
+ assert_equal 'VI', result.card.mop
205
+ assert_equal '4100000000000001', result.card.number
206
+ assert_equal '1210', result.card.expDate
207
+ end
208
+
209
+ def test_capture
210
+ ltlTxn = LitleTransaction.new
211
+ captHash = {
212
+ 'merchantId' => '101',
213
+ 'version'=>'8.8',
214
+ 'reportGroup'=>'Planets',
215
+ 'id'=>'12345',
216
+ 'customerId'=>'0987',
217
+ 'litleTxnId'=>'123456000',
218
+ 'amount'=>'106',
219
+ }
220
+
221
+ result = ltlTxn.capture(captHash)
222
+ assert_equal 'Planets', result.reportGroup
223
+ assert_equal '12345', result.transactionId
224
+ assert_equal '0987', result.customerId
225
+ assert_equal '123456000', result.litleTxnId
226
+ assert_equal '106', result.amount
227
+ end
228
+
229
+ def test_capture_given_auth
230
+ ltlTxn = LitleTransaction.new
231
+ captGivenAuthHash = {
232
+ 'merchantId' => '101',
233
+ 'version'=>'8.8',
234
+ 'reportGroup'=>'Planets',
235
+ 'id'=>'12345',
236
+ 'customerId'=>'0987',
237
+ 'orderId'=>'12344',
238
+ 'amount'=>'106',
239
+ 'authInformation' => {
240
+ 'authDate'=>'2002-10-09',
241
+ 'authCode'=>'543216',
242
+ 'authAmount'=>'12345'
243
+ },
244
+ 'orderSource'=>'ecommerce',
245
+ 'card'=>{
246
+ 'type'=>'VI',
247
+ 'number' =>'4100000000000000',
248
+ 'expDate' =>'1210'
249
+ }}
250
+
251
+ result = ltlTxn.capture_given_auth(captGivenAuthHash)
252
+ assert_equal 'Planets', result.reportGroup
253
+ assert_equal '12345', result.transactionId
254
+ assert_equal '0987', result.customerId
255
+ assert_equal '12344', result.orderId
256
+ assert_equal '106', result.amount
257
+ assert_equal 'ecommerce', result.orderSource
258
+ assert_equal 'VI', result.card.mop
259
+ assert_equal '4100000000000000', result.card.number
260
+ assert_equal '1210', result.card.expDate
261
+ assert_equal '2002-10-09', result.authInformation.authDate
262
+ assert_equal '543216', result.authInformation.authCode
263
+ assert_equal '12345', result.authInformation.authAmount
264
+ end
265
+
266
+ def test_echeck_verification
267
+ ltlTxn = LitleTransaction.new
268
+ echeckVerificationHash = {
269
+ 'merchantId' => '101',
270
+ 'version'=>'8.8',
271
+ 'reportGroup'=>'Planets',
272
+ 'id'=>'12345',
273
+ 'customerId'=>'0987',
274
+ 'amount'=>'123456',
275
+ 'orderId'=>'12345',
276
+ 'orderSource'=>'ecommerce',
277
+ 'echeck' => {'accType'=>'Checking',
278
+ 'accNum'=>'12345657890',
279
+ 'routingNum'=>'123456789',
280
+ 'checkNum'=>'123455'},
281
+ 'billToAddress'=>{'name'=>'Bob',
282
+ 'city'=>'lowell',
283
+ 'state'=>'MA',
284
+ 'email'=>'litle.com'}
285
+ }
286
+
287
+ result = ltlTxn.echeck_verification(echeckVerificationHash)
288
+ assert_equal 'Planets', result.reportGroup
289
+ assert_equal '12345', result.transactionId
290
+ assert_equal '0987', result.customerId
291
+ assert_equal '12345', result.orderId
292
+ assert_equal '123456', result.amount
293
+ assert_equal 'ecommerce', result.orderSource
294
+ assert_equal 'Checking', result.echeck.accType
295
+ assert_equal '12345657890', result.echeck.accNum
296
+ assert_equal '123456789', result.echeck.routingNum
297
+ assert_equal '123455', result.echeck.checkNum
298
+ assert_equal 'Bob', result.billToAddress.name
299
+ assert_equal 'lowell', result.billToAddress.city
300
+ assert_equal 'MA', result.billToAddress.state
301
+ assert_equal 'litle.com', result.billToAddress.email
302
+ end
303
+
304
+ def test_echeck_credit
305
+ ltlTxn = LitleTransaction.new
306
+ echeckCreditHash = {
307
+ 'merchantId' => '101',
308
+ 'version'=>'8.8',
309
+ 'reportGroup'=>'Planets',
310
+ 'id'=>'12345',
311
+ 'customerId'=>'0987',
312
+ 'litleTxnId'=>'123456789101112',
313
+ 'amount'=>'12'
314
+ }
315
+
316
+ result = ltlTxn.echeck_credit(echeckCreditHash)
317
+ assert_equal 'Planets', result.reportGroup
318
+ assert_equal '12345', result.transactionId
319
+ assert_equal '0987', result.customerId
320
+ assert_equal '123456789101112', result.litleTxnId
321
+ assert_equal '12', result.amount
322
+ end
323
+
324
+ def test_echeck_redeposit
325
+ ltlTxn = LitleTransaction.new
326
+ echeckRedeopsitHash = {
327
+ 'merchantId' => '101',
328
+ 'version'=>'8.8',
329
+ 'reportGroup'=>'Planets',
330
+ 'id'=>'12345',
331
+ 'customerId'=>'0987',
332
+ 'litleTxnId'=>'123456'
333
+ }
334
+
335
+ result = ltlTxn.echeck_redeposit(echeckRedeopsitHash)
336
+ assert_equal 'Planets', result.reportGroup
337
+ assert_equal '12345', result.transactionId
338
+ assert_equal '0987', result.customerId
339
+ assert_equal '123456', result.litleTxnId
340
+ end
341
+
342
+ def test_echeck_sale
343
+ ltlTxn = LitleTransaction.new
344
+ echeckSaleHash = {
345
+ 'merchantId' => '101',
346
+ 'version'=>'8.8',
347
+ 'reportGroup'=>'Planets',
348
+ 'id'=>'12345',
349
+ 'customerId'=>'0987',
350
+ 'amount'=>'123456',
351
+ 'verify'=>'true',
352
+ 'orderId'=>'12345',
353
+ 'orderSource'=>'ecommerce',
354
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
355
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
356
+ }
357
+
358
+ result = ltlTxn.echeck_sale(echeckSaleHash)
359
+ assert_equal 'Planets', result.reportGroup
360
+ assert_equal '12345', result.transactionId
361
+ assert_equal '0987', result.customerId
362
+ assert_equal '12345', result.orderId
363
+ assert_equal '123456', result.amount
364
+ assert_equal 'true', result.verify
365
+ assert_equal 'ecommerce', result.orderSource
366
+ assert_equal 'Checking', result.echeck.accType
367
+ assert_equal '12345657890', result.echeck.accNum
368
+ assert_equal '123456789', result.echeck.routingNum
369
+ assert_equal '123455', result.echeck.checkNum
370
+ assert_equal 'Bob', result.billToAddress.name
371
+ assert_equal 'lowell', result.billToAddress.city
372
+ assert_equal 'MA', result.billToAddress.state
373
+ assert_equal 'litle.com', result.billToAddress.email
374
+ end
375
+
376
+ def test_account_update
377
+ ltlTxn = LitleTransaction.new
378
+ accountUpdateHash = {
379
+ 'reportGroup'=>'Planets',
380
+ 'id'=>'12345',
381
+ 'customerId'=>'0987',
382
+ 'card'=>{
383
+ 'type'=>'VI',
384
+ 'number' =>'4100000000000001',
385
+ 'expDate' =>'1210'
386
+ }}
387
+
388
+ result = ltlTxn.account_update(accountUpdateHash)
389
+ assert_equal 'Planets', result.reportGroup
390
+ assert_equal '12345', result.transactionId
391
+ assert_equal '0987', result.customerId
392
+ assert_equal "4100000000000001", result.card.number
393
+ assert_equal "VI", result.card.mop
394
+ assert_equal "1210", result.card.expDate
395
+ end
396
+ end
397
+ end
@@ -0,0 +1,92 @@
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 TestActivate < Test::Unit::TestCase
30
+
31
+ def test_simple_card
32
+ hash = {
33
+ 'merchantId' => '101',
34
+ 'version'=>'8.8',
35
+ 'reportGroup'=>'Planets',
36
+ 'orderId' => '11',
37
+ 'amount' => '500',
38
+ 'orderSource'=>'ecommerce',
39
+ 'card'=>
40
+ {
41
+ 'type'=>'VI',
42
+ 'number' =>'4100000000000001',
43
+ 'expDate' =>'1210'
44
+ }
45
+ }
46
+
47
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>VI<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/activate>.*/m), is_a(Hash))
48
+ LitleOnlineRequest.new.activate(hash)
49
+ end
50
+
51
+ def test_simple_card
52
+ hash = {
53
+ 'merchantId' => '101',
54
+ 'version'=>'8.8',
55
+ 'reportGroup'=>'Planets',
56
+ 'orderId' => '11',
57
+ 'amount' => '500',
58
+ 'orderSource'=>'ecommerce',
59
+ 'card'=>
60
+ {
61
+ 'type'=>'VI',
62
+ 'number' =>'4100000000000001',
63
+ 'expDate' =>'1210'
64
+ }
65
+ }
66
+
67
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>VI<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/activate>.*/m), is_a(Hash))
68
+ LitleOnlineRequest.new.activate(hash)
69
+ end
70
+
71
+ def test_simple_virtualGiftcard
72
+ hash = {
73
+ 'merchantId' => '101',
74
+ 'version'=>'8.8',
75
+ 'reportGroup'=>'Planets',
76
+ 'orderId' => '11',
77
+ 'amount' => '500',
78
+ 'orderSource'=>'ecommerce',
79
+ 'virtualGiftCard'=>
80
+ {
81
+ 'accountNumberLength'=>'13',
82
+ 'giftCardBin'=>'giftCardBinString'
83
+ }
84
+ }
85
+
86
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><virtualGiftCard><accountNumberLength>13<\/accountNumberLength><giftCardBin>giftCardBinString<\/giftCardBin><\/virtualGiftCard><\/activate>.*/m), is_a(Hash))
87
+ LitleOnlineRequest.new.activate(hash)
88
+ end
89
+
90
+ end
91
+
92
+ end