CnpOnline 8.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) 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/Rakefile~ +89 -0
  9. data/SETUP.md +46 -0
  10. data/bin/Setup.rb +124 -0
  11. data/bin/sample_batch_driver.rb +123 -0
  12. data/bin/sample_driver.rb +49 -0
  13. data/lib/Communications.rb +85 -0
  14. data/lib/Configuration.rb +67 -0
  15. data/lib/EnvironmentVariables.rb +22 -0
  16. data/lib/LitleBatchRequest.rb +562 -0
  17. data/lib/LitleListeners.rb +142 -0
  18. data/lib/LitleOnline.rb +62 -0
  19. data/lib/LitleOnlineRequest.rb +297 -0
  20. data/lib/LitleRequest.rb +494 -0
  21. data/lib/LitleTransaction.rb +463 -0
  22. data/lib/LitleXmlMapper.rb +64 -0
  23. data/lib/XMLFields.rb +1869 -0
  24. data/lib/cacert.pem +3331 -0
  25. data/samples/Auth/LitleAuthReversalTransaction.rb +15 -0
  26. data/samples/Auth/LitleAuthorizationTransaction.rb +31 -0
  27. data/samples/Auth/LitlePaymentFullLifeCycle.rb +47 -0
  28. data/samples/Batch/AccountUpdate.rb +64 -0
  29. data/samples/Batch/SampleBatchDriver.rb +94 -0
  30. data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +30 -0
  31. data/samples/Capture/LitleCaptureTransaction.rb +14 -0
  32. data/samples/Capture/LitleForceCaptureTransaction.rb +26 -0
  33. data/samples/Capture/LitlePartialCapture.rb +16 -0
  34. data/samples/Credit/LitleCreditTransaction.rb +16 -0
  35. data/samples/Credit/LitleRefundTransaction.rb +29 -0
  36. data/samples/Other/LitleAvsTransaction.rb +34 -0
  37. data/samples/Other/LitleVoidTransaction.rb +18 -0
  38. data/samples/Paypage/FullPaypageLifeCycle.rb +74 -0
  39. data/samples/Run_all.rb +17 -0
  40. data/samples/Sale/LitleSaleTransaction.rb +29 -0
  41. data/samples/Sale/SampleSaleTransaction.rb +24 -0
  42. data/test/certification/certTest1_base.rb +945 -0
  43. data/test/certification/certTest2_authenhanced.rb +573 -0
  44. data/test/certification/certTest3_authreversal.rb +185 -0
  45. data/test/certification/certTest4_echeck.rb +278 -0
  46. data/test/certification/certTest5_token.rb +204 -0
  47. data/test/certification/certTest_batchAll.rb +337 -0
  48. data/test/certification/ts_all.rb +33 -0
  49. data/test/functional/test_activate.rb +100 -0
  50. data/test/functional/test_activateReversal.rb +56 -0
  51. data/test/functional/test_auth.rb +298 -0
  52. data/test/functional/test_authReversal.rb +69 -0
  53. data/test/functional/test_balanceInquiry.rb +80 -0
  54. data/test/functional/test_batch.rb +164 -0
  55. data/test/functional/test_batchStream.rb +145 -0
  56. data/test/functional/test_cancelSubscription.rb +55 -0
  57. data/test/functional/test_capture.rb +84 -0
  58. data/test/functional/test_captureGivenAuth.rb +235 -0
  59. data/test/functional/test_configuration.rb +89 -0
  60. data/test/functional/test_createPlan.rb +85 -0
  61. data/test/functional/test_credit.rb +174 -0
  62. data/test/functional/test_deactivate.rb +80 -0
  63. data/test/functional/test_deactivateReversal.rb +56 -0
  64. data/test/functional/test_depositReversal.rb +56 -0
  65. data/test/functional/test_echeckCredit.rb +134 -0
  66. data/test/functional/test_echeckRedeposit.rb +88 -0
  67. data/test/functional/test_echeckSale.rb +177 -0
  68. data/test/functional/test_echeckVerification.rb +127 -0
  69. data/test/functional/test_echeckVoid.rb +41 -0
  70. data/test/functional/test_forceCapture.rb +183 -0
  71. data/test/functional/test_litle_requests.rb +356 -0
  72. data/test/functional/test_load.rb +82 -0
  73. data/test/functional/test_loadReversal.rb +56 -0
  74. data/test/functional/test_override.rb +64 -0
  75. data/test/functional/test_refundReversal.rb +56 -0
  76. data/test/functional/test_sale.rb +259 -0
  77. data/test/functional/test_token.rb +115 -0
  78. data/test/functional/test_unload.rb +82 -0
  79. data/test/functional/test_unloadReversal.rb +56 -0
  80. data/test/functional/test_updateCardValidationNumOnToken.rb +43 -0
  81. data/test/functional/test_updatePlan.rb +58 -0
  82. data/test/functional/test_updateSubscription.rb +76 -0
  83. data/test/functional/test_xmlfields.rb +427 -0
  84. data/test/functional/ts_all.rb +66 -0
  85. data/test/unit/test_LitleAUBatch.rb +216 -0
  86. data/test/unit/test_LitleBatchRequest.rb +643 -0
  87. data/test/unit/test_LitleOnlineRequest.rb +295 -0
  88. data/test/unit/test_LitleRequest.rb +316 -0
  89. data/test/unit/test_LitleTransaction.rb +397 -0
  90. data/test/unit/test_activate.rb +92 -0
  91. data/test/unit/test_activateReversal.rb +44 -0
  92. data/test/unit/test_auth.rb +421 -0
  93. data/test/unit/test_authReversal.rb +82 -0
  94. data/test/unit/test_balanceInquiry.rb +52 -0
  95. data/test/unit/test_cancelSubscription.rb +43 -0
  96. data/test/unit/test_capture.rb +73 -0
  97. data/test/unit/test_captureGivenAuth.rb +188 -0
  98. data/test/unit/test_createPlan.rb +52 -0
  99. data/test/unit/test_credit.rb +342 -0
  100. data/test/unit/test_deactivate.rb +52 -0
  101. data/test/unit/test_deactivateReversal.rb +44 -0
  102. data/test/unit/test_depositReversal.rb +44 -0
  103. data/test/unit/test_echeckCredit.rb +71 -0
  104. data/test/unit/test_echeckRedeposit.rb +94 -0
  105. data/test/unit/test_echeckSale.rb +71 -0
  106. data/test/unit/test_echeckVerification.rb +71 -0
  107. data/test/unit/test_echeckVoid.rb +54 -0
  108. data/test/unit/test_forceCapture.rb +145 -0
  109. data/test/unit/test_load.rb +53 -0
  110. data/test/unit/test_loadReversal.rb +44 -0
  111. data/test/unit/test_refundReversal.rb +44 -0
  112. data/test/unit/test_sale.rb +465 -0
  113. data/test/unit/test_token.rb +144 -0
  114. data/test/unit/test_unload.rb +53 -0
  115. data/test/unit/test_unloadReversal.rb +44 -0
  116. data/test/unit/test_updateCardValidationNumOnToken.rb +80 -0
  117. data/test/unit/test_updatePlan.rb +45 -0
  118. data/test/unit/test_updateSubscription.rb +172 -0
  119. data/test/unit/test_xmlfields.rb +2930 -0
  120. data/test/unit/ts_unit.rb +65 -0
  121. metadata +255 -0
@@ -0,0 +1,573 @@
1
+ require File.expand_path("../../../lib/LitleOnline",__FILE__)
2
+ require 'test/unit'
3
+
4
+ module LitleOnline
5
+ class Litle_certTest2 < Test::Unit::TestCase
6
+ #test enhanced data on auth response
7
+ @@merchant_hash = {'reportGroup'=>'Planets',
8
+ 'merchantId'=>'101'
9
+ }
10
+
11
+ #test 14-31 enhanced data need merchant with smart authorization features.
12
+ def test_14
13
+ customer_hash = {
14
+ 'orderId' => '14',
15
+ 'amount' => '3000',
16
+ 'orderSource'=>'ecommerce',
17
+ 'card'=>{
18
+ 'number' =>'4457010200000247',
19
+ 'expDate' => '0812',
20
+ 'type' => 'VI'
21
+ }
22
+ }
23
+ hash = customer_hash.merge(@@merchant_hash)
24
+ auth_response = LitleOnlineRequest.new.authorization(hash)
25
+ assert_equal('000', auth_response.authorizationResponse.response)
26
+ assert_equal('Approved', auth_response.authorizationResponse.message)
27
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type']) #Ruby 1.8.7 has type as an attribute of Object
28
+ assert_equal('2000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
29
+ assert_equal('NO', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
30
+ assert_equal('GIFT', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
31
+ end
32
+
33
+ def test_15
34
+ customer_hash = {
35
+ 'orderId' => '15',
36
+ 'amount' => '3000',
37
+ 'orderSource'=>'ecommerce',
38
+ 'card'=>{
39
+ 'number' =>'5500000254444445',
40
+ 'expDate' => '0312',
41
+ 'type' => 'MC'
42
+ }
43
+ }
44
+ hash = customer_hash.merge(@@merchant_hash)
45
+ auth_response = LitleOnlineRequest.new.authorization(hash)
46
+ assert_equal('000', auth_response.authorizationResponse.response)
47
+ assert_equal('Approved', auth_response.authorizationResponse.message)
48
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
49
+ assert_equal('2000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
50
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
51
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
52
+ end
53
+
54
+ def test_16
55
+ customer_hash = {
56
+ 'orderId' => '16',
57
+ 'amount' => '3000',
58
+ 'orderSource'=>'ecommerce',
59
+ 'card'=>{
60
+ 'number' =>'5592106621450897',
61
+ 'expDate' => '0312',
62
+ 'type' => 'MC'
63
+ }
64
+ }
65
+ hash = customer_hash.merge(@@merchant_hash)
66
+ auth_response = LitleOnlineRequest.new.authorization(hash)
67
+ assert_equal('000', auth_response.authorizationResponse.response)
68
+ assert_equal('Approved', auth_response.authorizationResponse.message)
69
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
70
+ assert_equal('0', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
71
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
72
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
73
+ end
74
+
75
+ def test_17
76
+ customer_hash = {
77
+ 'orderId' => '17',
78
+ 'amount' => '3000',
79
+ 'orderSource'=>'ecommerce',
80
+ 'card'=>{
81
+ 'number' =>'5590409551104142',
82
+ 'expDate' => '0312',
83
+ 'type' => 'MC'
84
+ }
85
+ }
86
+ hash = customer_hash.merge(@@merchant_hash)
87
+ auth_response = LitleOnlineRequest.new.authorization(hash)
88
+ assert_equal('000', auth_response.authorizationResponse.response)
89
+ assert_equal('Approved', auth_response.authorizationResponse.message)
90
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
91
+ assert_equal('6500', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
92
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
93
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
94
+ end
95
+
96
+ def test_18
97
+ customer_hash = {
98
+ 'orderId' => '18',
99
+ 'amount' => '3000',
100
+ 'orderSource'=>'ecommerce',
101
+ 'card'=>{
102
+ 'number' =>'5587755665222179',
103
+ 'expDate' => '0312',
104
+ 'type' => 'MC'
105
+ }
106
+ }
107
+ hash = customer_hash.merge(@@merchant_hash)
108
+ auth_response = LitleOnlineRequest.new.authorization(hash)
109
+ assert_equal('000', auth_response.authorizationResponse.response)
110
+ assert_equal('Approved', auth_response.authorizationResponse.message)
111
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
112
+ assert_equal('12200', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
113
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
114
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
115
+ end
116
+
117
+ def test_19
118
+ customer_hash = {
119
+ 'orderId' => '19',
120
+ 'amount' => '3000',
121
+ 'orderSource'=>'ecommerce',
122
+ 'card'=>{
123
+ 'number' =>'5445840176552850',
124
+ 'expDate' => '0312',
125
+ 'type' => 'MC'
126
+ }
127
+ }
128
+ hash = customer_hash.merge(@@merchant_hash)
129
+ auth_response = LitleOnlineRequest.new.authorization(hash)
130
+ assert_equal('000', auth_response.authorizationResponse.response)
131
+ assert_equal('Approved', auth_response.authorizationResponse.message)
132
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
133
+ assert_equal('20000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
134
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
135
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
136
+ end
137
+
138
+ def test_20
139
+ customer_hash = {
140
+ 'orderId' => '20',
141
+ 'amount' => '3000',
142
+ 'orderSource'=>'ecommerce',
143
+ 'card'=>{
144
+ 'number' =>'5390016478904678',
145
+ 'expDate' => '0312',
146
+ 'type' => 'MC'
147
+ }
148
+ }
149
+ hash = customer_hash.merge(@@merchant_hash)
150
+ auth_response = LitleOnlineRequest.new.authorization(hash)
151
+ assert_equal('000', auth_response.authorizationResponse.response)
152
+ assert_equal('Approved', auth_response.authorizationResponse.message)
153
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
154
+ assert_equal('10050', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
155
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
156
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
157
+ end
158
+
159
+ def test_21
160
+ customer_hash = {
161
+ 'orderId' => '21',
162
+ 'amount' => '5000',
163
+ 'orderSource'=>'ecommerce',
164
+ 'card'=>{
165
+ 'number' =>'4457010201000246',
166
+ 'expDate' => '0912',
167
+ 'type' => 'VI'
168
+ }
169
+ }
170
+ hash = customer_hash.merge(@@merchant_hash)
171
+ auth_response = LitleOnlineRequest.new.authorization(hash)
172
+ assert_equal('000', auth_response.authorizationResponse.response)
173
+ assert_equal('Approved', auth_response.authorizationResponse.message)
174
+ assert_equal('AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
175
+ end
176
+
177
+ def test_22
178
+ customer_hash = {
179
+ 'orderId' => '22',
180
+ 'amount' => '5000',
181
+ 'orderSource'=>'ecommerce',
182
+ 'card'=>{
183
+ 'number' =>'4457010202000245',
184
+ 'expDate' => '1111',
185
+ 'type' => 'VI'
186
+ }
187
+ }
188
+ hash = customer_hash.merge(@@merchant_hash)
189
+ auth_response = LitleOnlineRequest.new.authorization(hash)
190
+ assert_equal('000', auth_response.authorizationResponse.response)
191
+ assert_equal('Approved', auth_response.authorizationResponse.message)
192
+ assert_equal('MASS AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
193
+ end
194
+
195
+ def test_23
196
+ customer_hash = {
197
+ 'orderId' => '23',
198
+ 'amount' => '5000',
199
+ 'orderSource'=>'ecommerce',
200
+ 'card'=>{
201
+ 'number' =>'5112010201000109',
202
+ 'expDate' => '0412',
203
+ 'type' => 'MC'
204
+ }
205
+ }
206
+ hash = customer_hash.merge(@@merchant_hash)
207
+ auth_response = LitleOnlineRequest.new.authorization(hash)
208
+ assert_equal('000', auth_response.authorizationResponse.response)
209
+ assert_equal('Approved', auth_response.authorizationResponse.message)
210
+ assert_equal('AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
211
+ end
212
+
213
+ def test_24
214
+ customer_hash = {
215
+ 'orderId' => '24',
216
+ 'amount' => '5000',
217
+ 'orderSource'=>'ecommerce',
218
+ 'card'=>{
219
+ 'number' =>'5112010202000108',
220
+ 'expDate' => '0812',
221
+ 'type' => 'MC'
222
+ }
223
+ }
224
+ hash = customer_hash.merge(@@merchant_hash)
225
+ auth_response = LitleOnlineRequest.new.authorization(hash)
226
+ assert_equal('000', auth_response.authorizationResponse.response)
227
+ assert_equal('Approved', auth_response.authorizationResponse.message)
228
+ assert_equal('MASS AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
229
+ end
230
+
231
+ def test_25
232
+ customer_hash = {
233
+ 'orderId' => '25',
234
+ 'amount' => '5000',
235
+ 'orderSource'=>'ecommerce',
236
+ 'card'=>{
237
+ 'number' =>'4100204446270000',
238
+ 'expDate' => '1112',
239
+ 'type' => 'VI'}
240
+ }
241
+ hash = customer_hash.merge(@@merchant_hash)
242
+ auth_response = LitleOnlineRequest.new.authorization(hash)
243
+ assert_equal('000', auth_response.authorizationResponse.response)
244
+ assert_equal('Approved', auth_response.authorizationResponse.message)
245
+ assert_equal('BRA', auth_response.authorizationResponse.enhancedAuthResponse.issuerCountry)
246
+ end
247
+
248
+ # test 26-31 healthcare iias
249
+ def test_26
250
+ customer_hash = {
251
+ 'orderId' => '26',
252
+ 'amount' => '18698',
253
+ 'orderSource'=>'ecommerce',
254
+ 'card'=>{
255
+ 'number' =>'5194560012341234',
256
+ 'expDate' => '1212',
257
+ 'type' => 'MC'},
258
+ 'allowPartialAuth' => 'true',
259
+ 'healthcareIIAS' => {
260
+ 'healthcareAmounts' => {
261
+ 'totalHealthcareAmount' =>'20000'
262
+ },
263
+ 'IIASFlag' => 'Y'
264
+ }
265
+ }
266
+ hash = customer_hash.merge(@@merchant_hash)
267
+ auth_response = LitleOnlineRequest.new.authorization(hash)
268
+ assert_equal('341', auth_response.authorizationResponse.response)
269
+ assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
270
+ end
271
+
272
+ def test_27
273
+ customer_hash = {
274
+ 'orderId' => '27',
275
+ 'amount' => '18698',
276
+ 'orderSource'=>'ecommerce',
277
+ 'card'=>{
278
+ 'number' =>'5194560012341234',
279
+ 'expDate' => '1212',
280
+ 'type' => 'MC'},
281
+ 'allowPartialAuth' => 'true',
282
+ 'healthcareIIAS' => {
283
+ 'healthcareAmounts' => {
284
+ 'totalHealthcareAmount' =>'15000',
285
+ 'RxAmount' => '16000'
286
+ },
287
+ 'IIASFlag' => 'Y'
288
+ }
289
+ }
290
+ hash = customer_hash.merge(@@merchant_hash)
291
+ auth_response = LitleOnlineRequest.new.authorization(hash)
292
+ assert_equal('341', auth_response.authorizationResponse.response)
293
+ assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
294
+ end
295
+
296
+ def test_28
297
+ customer_hash = {
298
+ 'orderId' => '28',
299
+ 'amount' => '15000',
300
+ 'orderSource'=>'ecommerce',
301
+ 'card'=>{
302
+ 'number' =>'5194560012341234',
303
+ 'expDate' => '1212',
304
+ 'type' => 'MC'},
305
+ 'allowPartialAuth' => 'true',
306
+ 'healthcareIIAS' => {
307
+ 'healthcareAmounts' => {
308
+ 'totalHealthcareAmount' =>'15000',
309
+ 'RxAmount' => '3698'
310
+ },
311
+ 'IIASFlag' => 'Y'
312
+ }
313
+ }
314
+ hash = customer_hash.merge(@@merchant_hash)
315
+ auth_response = LitleOnlineRequest.new.authorization(hash)
316
+ assert_equal('000', auth_response.authorizationResponse.response)
317
+ assert_equal('Approved', auth_response.authorizationResponse.message)
318
+ end
319
+
320
+ def test_29
321
+ customer_hash = {
322
+ 'orderId' => '29',
323
+ 'amount' => '18699',
324
+ 'orderSource'=>'ecommerce',
325
+ 'card'=>{
326
+ 'number' =>'4024720001231239',
327
+ 'expDate' => '1212',
328
+ 'type' => 'VI'},
329
+ 'allowPartialAuth' => 'true',
330
+ 'healthcareIIAS' => {
331
+ 'healthcareAmounts' => {
332
+ 'totalHealthcareAmount' =>'31000',
333
+ 'RxAmount' => '1000',
334
+ 'visionAmount' => '19901',
335
+ 'clinicOtherAmount' => '9050',
336
+ 'dentalAmount' => '1049'
337
+ },
338
+ 'IIASFlag' => 'Y'
339
+ }
340
+ }
341
+ hash = customer_hash.merge(@@merchant_hash)
342
+ auth_response = LitleOnlineRequest.new.authorization(hash)
343
+ assert_equal('341', auth_response.authorizationResponse.response)
344
+ assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
345
+ end
346
+
347
+ def test_30
348
+ customer_hash = {
349
+ 'orderId' => '30',
350
+ 'amount' => '20000',
351
+ 'orderSource'=>'ecommerce',
352
+ 'card'=>{
353
+ 'number' =>'4024720001231239',
354
+ 'expDate' => '1212',
355
+ 'type' => 'VI'},
356
+ 'allowPartialAuth' => 'true',
357
+ 'healthcareIIAS' => {
358
+ 'healthcareAmounts' => {
359
+ 'totalHealthcareAmount' =>'20000',
360
+ 'RxAmount' => '1000',
361
+ 'visionAmount' => '19901',
362
+ 'clinicOtherAmount' => '9050',
363
+ 'dentalAmount' => '1049'
364
+ },
365
+ 'IIASFlag' => 'Y'
366
+ }
367
+ }
368
+ hash = customer_hash.merge(@@merchant_hash)
369
+ auth_response = LitleOnlineRequest.new.authorization(hash)
370
+ assert_equal('341', auth_response.authorizationResponse.response)
371
+ assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
372
+ end
373
+
374
+ def test_31
375
+ customer_hash = {
376
+ 'orderId' => '31',
377
+ 'amount' => '25000',
378
+ 'orderSource'=>'ecommerce',
379
+ 'card'=>{
380
+ 'number' =>'4024720001231239',
381
+ 'expDate' => '1212',
382
+ 'type' => 'VI'},
383
+ 'allowPartialAuth' => 'true',
384
+ 'healthcareIIAS' => {
385
+ 'healthcareAmounts' => {
386
+ 'totalHealthcareAmount' =>'18699',
387
+ 'RxAmount' => '1000',
388
+ 'visionAmount' => '15099'
389
+ },
390
+ 'IIASFlag' => 'Y'
391
+ }
392
+ }
393
+ hash = customer_hash.merge(@@merchant_hash)
394
+ auth_response = LitleOnlineRequest.new.authorization(hash)
395
+ assert_equal('010', auth_response.authorizationResponse.response)
396
+ assert_equal('Partially Approved', auth_response.authorizationResponse.message)
397
+ assert_equal('18699', auth_response.authorizationResponse.approvedAmount)
398
+ end
399
+
400
+ def test_32
401
+ customer_hash = {
402
+ 'orderId' => '32',
403
+ 'amount' => '10010',
404
+ 'orderSource'=>'ecommerce',
405
+ 'billToAddress'=>{
406
+ 'name' => 'John Smith',
407
+ 'addressLine1' => '1 Main St.',
408
+ 'city' => 'Burlington',
409
+ 'state' => 'MA',
410
+ 'zip' => '01803-3747',
411
+ 'country' => 'US'},
412
+ 'card'=>{
413
+ 'number' =>'4457010000000009',
414
+ 'expDate' => '0112',
415
+ 'cardValidationNum' => '349',
416
+ 'type' => 'VI'}
417
+ }
418
+ hash = customer_hash.merge(@@merchant_hash)
419
+ authorization_response = LitleOnlineRequest.new.authorization(hash)
420
+ assert_equal('000', authorization_response.authorizationResponse.response)
421
+ assert_equal('Approved', authorization_response.authorizationResponse.message)
422
+ assert_equal('01', authorization_response.authorizationResponse.fraudResult.avsResult)
423
+ assert_equal('M', authorization_response.authorizationResponse.fraudResult.cardValidationResult)
424
+
425
+ #test 32A
426
+ capture_hash = {'litleTxnId' => authorization_response.authorizationResponse.litleTxnId, 'amount' => '5005'}
427
+ hash32a = capture_hash.merge(@@merchant_hash)
428
+ capture_response = LitleOnlineRequest.new.capture(hash32a)
429
+ assert_equal('000', capture_response.captureResponse.response)
430
+ assert_equal('Approved', capture_response.captureResponse.message)
431
+
432
+ #test 32B
433
+ authReversal_hash = {'litleTxnId' => authorization_response.authorizationResponse.litleTxnId}
434
+ hash1b = authReversal_hash.merge(@@merchant_hash)
435
+ authReversal_response = LitleOnlineRequest.new.auth_reversal(hash1b)
436
+ assert_equal('111', authReversal_response.authReversalResponse.response)
437
+ assert_equal('Authorization amount has already been depleted', authReversal_response.authReversalResponse.message)
438
+ end
439
+
440
+ def test_33
441
+ customer_hash = {
442
+ 'orderId' => '33',
443
+ 'amount' => '20020',
444
+ 'orderSource'=>'ecommerce',
445
+ 'billToAddress'=>{
446
+ 'name' => 'Mike J. Hammer',
447
+ 'addressLine1' => '2 Main St.',
448
+ 'addressLine2' => 'Apt. 222',
449
+ 'city' => 'Riverside',
450
+ 'state' => 'RI',
451
+ 'zip' => '02915',
452
+ 'country' => 'US'},
453
+ 'card'=>{
454
+ 'number' =>'5112010000000003',
455
+ 'expDate' => '0212',
456
+ 'cardValidationNum' => '261',
457
+ 'type' => 'MC'},
458
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
459
+ }
460
+ hash = customer_hash.merge(@@merchant_hash)
461
+ authorization_response = LitleOnlineRequest.new.authorization(hash)
462
+ assert_equal('000', authorization_response.authorizationResponse.response)
463
+ assert_equal('Approved', authorization_response.authorizationResponse.message)
464
+ assert_equal('22222', authorization_response.authorizationResponse.authCode)
465
+ assert_equal('10', authorization_response.authorizationResponse.fraudResult.avsResult)
466
+ assert_equal('M', authorization_response.authorizationResponse.fraudResult.cardValidationResult)
467
+
468
+ #test 33A
469
+ authReversal_hash = {'litleTxnId' => authorization_response.authorizationResponse.litleTxnId}
470
+ hash1b = authReversal_hash.merge(@@merchant_hash)
471
+ authReversal_response = LitleOnlineRequest.new.auth_reversal(hash1b)
472
+ assert_equal('000', authReversal_response.authReversalResponse.response)
473
+ assert_equal('Approved', authReversal_response.authReversalResponse.message)
474
+ end
475
+
476
+ def test_34
477
+ customer_hash = {
478
+ 'orderId' => '34',
479
+ 'amount' => '30030',
480
+ 'orderSource'=>'ecommerce',
481
+ 'billToAddress'=>{
482
+ 'name' => 'Eileen Jones',
483
+ 'addressLine1' => '3 Main St.',
484
+ 'city' => 'Bloomfield',
485
+ 'state' => 'CT',
486
+ 'zip' => '06002',
487
+ 'country' => 'US'},
488
+ 'card'=>{
489
+ 'number' =>'6011010000000003',
490
+ 'expDate' => '0312',
491
+ 'cardValidationNum' => '758',
492
+ 'type' => 'DI'},
493
+ }
494
+ hash = customer_hash.merge(@@merchant_hash)
495
+ authorization_response = LitleOnlineRequest.new.authorization(hash)
496
+ assert_equal('000', authorization_response.authorizationResponse.response)
497
+ assert_equal('Approved', authorization_response.authorizationResponse.message)
498
+ assert_equal('33333', authorization_response.authorizationResponse.authCode)
499
+ assert_equal('10', authorization_response.authorizationResponse.fraudResult.avsResult)
500
+ assert_equal('M', authorization_response.authorizationResponse.fraudResult.cardValidationResult)
501
+
502
+ #test 34A
503
+ authReversal_hash = {'litleTxnId' => authorization_response.authorizationResponse.litleTxnId}
504
+ hash1b = authReversal_hash.merge(@@merchant_hash)
505
+ authReversal_response = LitleOnlineRequest.new.auth_reversal(hash1b)
506
+ assert_equal('000', authReversal_response.authReversalResponse.response)
507
+ assert_equal('Approved', authReversal_response.authReversalResponse.message)
508
+ end
509
+
510
+ def test_35
511
+ customer_hash = {
512
+ 'orderId' => '35',
513
+ 'amount' => '40040',
514
+ 'orderSource'=>'ecommerce',
515
+ 'billToAddress'=>{
516
+ 'name' => 'Bob Black',
517
+ 'addressLine1' => '4 Main St.',
518
+ 'city' => 'Laurel',
519
+ 'state' => 'MD',
520
+ 'zip' => '20708',
521
+ 'country' => 'US'},
522
+ 'card'=>{
523
+ 'number' =>'375001000000005',
524
+ 'expDate' => '0412',
525
+ 'type' => 'AX'}
526
+ }
527
+ hash = customer_hash.merge(@@merchant_hash)
528
+ authorization_response = LitleOnlineRequest.new.authorization(hash)
529
+ assert_equal('000', authorization_response.authorizationResponse.response)
530
+ assert_equal('Approved', authorization_response.authorizationResponse.message)
531
+ assert_equal('44444', authorization_response.authorizationResponse.authCode)
532
+ assert_equal('12', authorization_response.authorizationResponse.fraudResult.avsResult)
533
+
534
+ #test 35A
535
+ capture_hash = {'litleTxnId' => authorization_response.authorizationResponse.litleTxnId, 'amount' => '20020'}
536
+ hash32a = capture_hash.merge(@@merchant_hash)
537
+ capture_response = LitleOnlineRequest.new.capture(hash32a)
538
+ assert_equal('000', capture_response.captureResponse.response)
539
+ assert_equal('Approved', capture_response.captureResponse.message)
540
+
541
+ #test 35B
542
+ authReversal_hash = {'litleTxnId' => authorization_response.authorizationResponse.litleTxnId, 'amount' => '20020'}
543
+ hash1b = authReversal_hash.merge(@@merchant_hash)
544
+ authReversal_response = LitleOnlineRequest.new.auth_reversal(hash1b)
545
+ assert_equal('000', authReversal_response.authReversalResponse.response)
546
+ assert_equal('Approved', authReversal_response.authReversalResponse.message)
547
+ end
548
+
549
+ def test_36
550
+ customer_hash = {
551
+ 'orderId' => '36',
552
+ 'amount' => '20500',
553
+ 'orderSource'=>'ecommerce',
554
+ 'card'=>{
555
+ 'number' =>'375000026600004',
556
+ 'expDate' => '0512',
557
+ 'type' => 'AX'},
558
+ }
559
+ hash = customer_hash.merge(@@merchant_hash)
560
+ authorization_response = LitleOnlineRequest.new.authorization(hash)
561
+ assert_equal('000', authorization_response.authorizationResponse.response)
562
+ assert_equal('Approved', authorization_response.authorizationResponse.message)
563
+
564
+ #test 36A
565
+ authReversal_hash = {'litleTxnId' => authorization_response.authorizationResponse.litleTxnId, 'amount' => '10000'}
566
+ hash1b = authReversal_hash.merge(@@merchant_hash)
567
+ authReversal_response = LitleOnlineRequest.new.auth_reversal(hash1b)
568
+ assert_equal('336', authReversal_response.authReversalResponse.response)
569
+ assert_equal('Reversal Amount does not match Authorization amount', authReversal_response.authReversalResponse.message)
570
+ end
571
+
572
+ end
573
+ end