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,74 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ hash = {
3
+ 'orderId'=>'1234',
4
+ 'amount'=>'106',
5
+ 'orderSource'=>'ecommerce',
6
+ 'paypage'=>{
7
+ 'type'=>'VI',
8
+ 'paypageRegistrationId' =>'QU1pTFZnV2NGQWZrZzRKeTNVR0lzejB1K2Q5VDdWMTVqb2J5WFJ2Snh4U0U4eTBxaFg2cEVWaDBWSlhtMVZTTw==',
9
+ 'expDate' =>'1210',
10
+ 'cardValidationNum' => '123'
11
+ }
12
+ }
13
+ auth_response = LitleOnline::LitleOnlineRequest.new.authorization(hash)
14
+ #display results, sample output from sandbox
15
+ puts "Response: " + auth_response.authorizationResponse.response #prints 000
16
+ puts "Message: " + auth_response.authorizationResponse.message #prints Approved
17
+ puts "Litle Transaction ID: " + auth_response.authorizationResponse.litleTxnId #prints 492578641509469583
18
+ puts "Litle Token: " + auth_response.authorizationResponse.tokenResponse.litleToken #prints 1234567890123456 - save this away so you can issue future authorizations against it
19
+
20
+ if (!auth_response.authorizationResponse.message.eql?'Approved')
21
+ raise ArgumentError, "FullPaypageLifeCycle's auth has not been Approved", caller
22
+ end
23
+ #Now, we capture the authorization
24
+ hash = {
25
+ 'litleTxnId'=>auth_response.authorizationResponse.litleTxnId #Use the litleTxnId from the auth we want to capture
26
+ }
27
+ capture_response = LitleOnline::LitleOnlineRequest.new.capture(hash)
28
+ puts "Response: " + capture_response.captureResponse.response
29
+ puts "Message: " + capture_response.captureResponse.message
30
+ puts "Litle Transaction ID: " + capture_response.captureResponse.litleTxnId
31
+
32
+ if (!capture_response.captureResponse.message.eql?'Approved')
33
+ raise ArgumentError, "FullPaypageLifeCycle's capture has not been Approved", caller
34
+ end
35
+ #Now, we issue a refund against the capture
36
+ hash = {
37
+ 'litleTxnId'=>capture_response.captureResponse.litleTxnId #Use the litleTxnId from the capture we want to refund against
38
+ }
39
+ credit_response = LitleOnline::LitleOnlineRequest.new.credit(hash)
40
+ puts "Response: " + credit_response.creditResponse.response
41
+ puts "Message: " + credit_response.creditResponse.message
42
+ puts "Litle Transaction ID: " + credit_response.creditResponse.litleTxnId
43
+
44
+ #Now, we issue an auth reversal against the refund
45
+ hash = {
46
+ 'litleTxnId'=>credit_response.creditResponse.litleTxnId #Use the litleTxnId from the capture we want to refund against
47
+ }
48
+ reversal_response = LitleOnline::LitleOnlineRequest.new.auth_reversal(hash)
49
+ puts "Response: " + reversal_response.authReversalResponse.response
50
+ puts "Message: " + reversal_response.authReversalResponse.message
51
+ puts "Litle Transaction ID: " + reversal_response.authReversalResponse.litleTxnId
52
+
53
+ if (!reversal_response.authReversalResponse.message.eql?'Approved')
54
+ raise ArgumentError, "FullPaypageLifeCycle's reversal has not been Approved", caller
55
+ end
56
+ #Let's assume next month we want to create a sale for the same card as the original authorization. The paypageRegistrationId is expired, but we have the token and can use it
57
+ hash = {
58
+ 'orderId'=>'4321',
59
+ 'amount'=>'106',
60
+ 'orderSource'=>'ecommerce',
61
+ 'token'=>{
62
+ 'type'=>'VI',
63
+ 'litleToken' => auth_response.authorizationResponse.tokenResponse.litleToken,
64
+ 'expDate' =>'1210'
65
+ }
66
+ }
67
+ sale_response = LitleOnline::LitleOnlineRequest.new.sale(hash)
68
+ puts "Response: " + sale_response.saleResponse.response
69
+ puts "Message: " + sale_response.saleResponse.message
70
+ puts "Litle Transaction ID: " + sale_response.saleResponse.litleTxnId
71
+
72
+ if (!sale_response.saleResponse.message.eql?'Approved')
73
+ raise ArgumentError, "FullPaypageLifeCycle's sale has not been Approved", caller
74
+ end
@@ -0,0 +1,17 @@
1
+ p system("rake test:all")
2
+ require File.expand_path("../../samples/Auth/LitlePaymentFullLifeCycle",__FILE__)
3
+ require File.expand_path("../../samples/Auth/LitleAuthorizationTransaction",__FILE__)
4
+ require File.expand_path("../../samples/Auth/LitleAuthReversalTransaction",__FILE__)
5
+ require File.expand_path("../../samples/Batch/AccountUpdate",__FILE__)
6
+ require File.expand_path("../../samples/Batch/SampleBatchDriver",__FILE__)
7
+ require File.expand_path("../../samples/Capture/LitleCaptureTransaction",__FILE__)
8
+ require File.expand_path("../../samples/Capture/LitlePartialCapture",__FILE__)
9
+ require File.expand_path("../../samples/Capture/LitleCaptureGivenAuthTransaction",__FILE__)
10
+ require File.expand_path("../../samples/Capture/LitleForceCaptureTransaction",__FILE__)
11
+ require File.expand_path("../../samples/Credit/LitleCreditTransaction",__FILE__)
12
+ require File.expand_path("../../samples/Credit/LitleRefundTransaction",__FILE__)
13
+ require File.expand_path("../../samples/Other/LitleAvsTransaction",__FILE__)
14
+ require File.expand_path("../../samples/Other/LitleVoidTransaction",__FILE__)
15
+ require File.expand_path("../../samples/Paypage/FullPaypageLifeCycle",__FILE__)
16
+ require File.expand_path("../../samples/Sale/LitleSaleTransaction",__FILE__)
17
+ require File.expand_path("../../samples/Sale/SampleSaleTransaction",__FILE__)
@@ -0,0 +1,29 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ #Sale
3
+ my_sale_info = {
4
+ 'orderId' => '1',
5
+ 'amount' => '10010',
6
+ 'orderSource'=>'ecommerce',
7
+ 'billToAddress'=>{
8
+ 'name' => 'John Smith',
9
+ 'addressLine1' => '1 Main St.',
10
+ 'city' => 'Burlington',
11
+ 'state' => 'MA',
12
+ 'zip' => '01803-3747',
13
+ 'country' => 'US'},
14
+ 'card'=>{
15
+ 'number' =>'4100000000000001',
16
+ 'expDate' => '0112',
17
+ 'cardValidationNum' => '349',
18
+ 'type' => 'MC'}
19
+ }
20
+ sale_response = LitleOnline::LitleOnlineRequest.new.sale(my_sale_info)
21
+
22
+ #display results
23
+ puts "Response: " + sale_response.saleResponse.response
24
+ puts "Message: " + sale_response.saleResponse.message
25
+ puts "Litle Transaction ID: " + sale_response.saleResponse.litleTxnId
26
+
27
+ if (!sale_response.saleResponse.message.eql?'Approved')
28
+ raise ArgumentError, "LitleSaleTransaction has not been Approved", caller
29
+ end
@@ -0,0 +1,24 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ # Visa $10 Sale
3
+ litleSaleTxn = {
4
+ 'merchantId' => '087900',
5
+ 'reportGroup'=>'rpt_grp',
6
+ 'orderId'=>'1234567',
7
+ 'card'=>{
8
+ 'type'=>'VI',
9
+ 'number' =>'4100000000000001',
10
+ 'expDate' =>'1212'},
11
+ 'orderSource'=>'ecommerce',
12
+ 'amount'=>'1000'
13
+ }
14
+
15
+ # Peform the transaction on the Litle Platform
16
+ response = LitleOnline::LitleOnlineRequest.new.sale(litleSaleTxn)
17
+
18
+ # display results
19
+ puts "Message: "+ response.message
20
+ puts "Litle Transaction ID: "+ response.saleResponse.litleTxnId
21
+
22
+ if (!response.saleResponse.message.eql?'Approved')
23
+ raise ArgumentError, "SampleSaleTransaction has not been Approved", caller
24
+ end
@@ -0,0 +1,945 @@
1
+ require File.expand_path("../../../lib/LitleOnline",__FILE__)
2
+ #require 'Litle_activemerchant'
3
+ require 'test/unit'
4
+
5
+ module LitleOnline
6
+ class Litle_certTest < Test::Unit::TestCase
7
+ @@merchant_hash = {'reportGroup'=>'Planets',
8
+ 'merchantId'=>'101'
9
+ }
10
+
11
+ def test_1_auth
12
+ customer_hash = {
13
+ 'orderId' => '1',
14
+ 'amount' => '10010',
15
+ 'orderSource'=>'ecommerce',
16
+ 'billToAddress'=>{
17
+ 'name' => 'John Smith',
18
+ 'addressLine1' => '1 Main St.',
19
+ 'city' => 'Burlington',
20
+ 'state' => 'MA',
21
+ 'zip' => '01803-3747',
22
+ 'country' => 'US'},
23
+ 'card'=>{
24
+ 'number' =>'4457010000000009',
25
+ 'expDate' => '0112',
26
+ 'cardValidationNum' => '349',
27
+ 'type' => 'VI'}
28
+ }
29
+ hash = customer_hash.merge(@@merchant_hash)
30
+ auth_response = LitleOnlineRequest.new.authorization(hash)
31
+ assert_equal('000', auth_response.authorizationResponse.response)
32
+ assert_equal('Approved', auth_response.authorizationResponse.message)
33
+ assert_equal('11111 ', auth_response.authorizationResponse.authCode)
34
+ assert_equal('01', auth_response.authorizationResponse.fraudResult.avsResult)
35
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
36
+
37
+ #test 1A
38
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
39
+ hash1a = capture_hash.merge(@@merchant_hash)
40
+ capture_response = LitleOnlineRequest.new.capture(hash1a)
41
+ assert_equal('000', capture_response.captureResponse.response)
42
+ assert_equal('Approved', capture_response.captureResponse.message)
43
+
44
+ #test 1B
45
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
46
+ hash1b = credit_hash.merge(@@merchant_hash)
47
+ credit_response = LitleOnlineRequest.new.credit(hash1b)
48
+ assert_equal('000', credit_response.creditResponse.response)
49
+ assert_equal('Approved', credit_response.creditResponse.message)
50
+
51
+ #test1C
52
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
53
+ hash1c = void_hash.merge(@@merchant_hash)
54
+ void_response = LitleOnlineRequest.new.void(hash1c)
55
+ assert_equal('000', void_response.voidResponse.response)
56
+ assert_equal('Approved', void_response.voidResponse.message)
57
+ end
58
+
59
+ def test_1_AVS
60
+ customer_hash = {
61
+ 'orderId' => '1',
62
+ 'amount' => '0',
63
+ 'orderSource'=>'ecommerce',
64
+ 'billToAddress'=>{
65
+ 'name' => 'John Smith',
66
+ 'addressLine1' => '1 Main St.',
67
+ 'city' => 'Burlington',
68
+ 'state' => 'MA',
69
+ 'zip' => '01803-3747',
70
+ 'country' => 'US'},
71
+ 'card'=>{
72
+ 'number' =>'4457010000000009',
73
+ 'expDate' => '0112',
74
+ 'cardValidationNum' => '349',
75
+ 'type' => 'VI'}
76
+ }
77
+ hash = customer_hash.merge(@@merchant_hash)
78
+ auth_response = LitleOnlineRequest.new.authorization(hash)
79
+ assert_equal('000', auth_response.authorizationResponse.response)
80
+ assert_equal('Approved', auth_response.authorizationResponse.message)
81
+ assert_equal('11111 ', auth_response.authorizationResponse.authCode)
82
+ assert_equal('01', auth_response.authorizationResponse.fraudResult.avsResult)
83
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
84
+ end
85
+
86
+ def test_1_sale
87
+ customer_hash = {
88
+ 'orderId' => '1',
89
+ 'amount' => '10010',
90
+ 'orderSource'=>'ecommerce',
91
+ 'billToAddress'=>{
92
+ 'name' => 'John Smith',
93
+ 'addressLine1' => '1 Main St.',
94
+ 'city' => 'Burlington',
95
+ 'state' => 'MA',
96
+ 'zip' => '01803-3747',
97
+ 'country' => 'US'},
98
+ 'card'=>{
99
+ 'number' =>'4457010000000009',
100
+ 'expDate' => '0112',
101
+ 'cardValidationNum' => '349',
102
+ 'type' => 'VI'}
103
+ }
104
+ hash = customer_hash.merge(@@merchant_hash)
105
+ sale_response = LitleOnlineRequest.new.sale(hash)
106
+ assert_equal('000', sale_response.saleResponse.response)
107
+ assert_equal('Approved', sale_response.saleResponse.message)
108
+ assert_equal('11111 ', sale_response.saleResponse.authCode)
109
+ assert_equal('01', sale_response.saleResponse.fraudResult.avsResult)
110
+ assert_equal('M', sale_response.saleResponse.fraudResult.cardValidationResult)
111
+
112
+ #test 1B
113
+ credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
114
+ hash1b = credit_hash.merge(@@merchant_hash)
115
+ credit_response = LitleOnlineRequest.new.credit(hash1b)
116
+ assert_equal('000', credit_response.creditResponse.response)
117
+ assert_equal('Approved', credit_response.creditResponse.message)
118
+
119
+ #test1C
120
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
121
+ hash1c = void_hash.merge(@@merchant_hash)
122
+ void_response = LitleOnlineRequest.new.void(hash1c)
123
+ assert_equal('000', void_response.voidResponse.response)
124
+ assert_equal('Approved', void_response.voidResponse.message)
125
+ end
126
+
127
+ def test_2_auth
128
+ customer_hash = {
129
+ 'orderId' => '2',
130
+ 'amount' => '20020',
131
+ 'orderSource'=>'ecommerce',
132
+ 'billToAddress'=>{
133
+ 'name' => 'Mike J. Hammer',
134
+ 'addressLine1' => '2 Main St.',
135
+ 'addressLine2' => 'Apt. 222',
136
+ 'city' => 'Riverside',
137
+ 'state' => 'RI',
138
+ 'zip' => '02915',
139
+ 'country' => 'US'},
140
+ 'card'=>{
141
+ 'number' =>'5112010000000003',
142
+ 'expDate' => '0212',
143
+ 'cardValidationNum' => '261',
144
+ 'type' => 'MC'
145
+ },
146
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
147
+ }
148
+ hash = customer_hash.merge(@@merchant_hash)
149
+ auth_response = LitleOnlineRequest.new.authorization(hash)
150
+ assert_equal('000', auth_response.authorizationResponse.response)
151
+ assert_equal('Approved', auth_response.authorizationResponse.message)
152
+ assert_equal('22222', auth_response.authorizationResponse.authCode)
153
+ assert_equal('10', auth_response.authorizationResponse.fraudResult.avsResult)
154
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
155
+
156
+ #test 2A
157
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
158
+ hash2a = capture_hash.merge(@@merchant_hash)
159
+ capture_response = LitleOnlineRequest.new.capture(hash2a)
160
+ assert_equal('000', capture_response.captureResponse.response)
161
+ assert_equal('Approved', capture_response.captureResponse.message)
162
+
163
+ #test 2B
164
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
165
+ hash2b = credit_hash.merge(@@merchant_hash)
166
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
167
+ assert_equal('000', credit_response.creditResponse.response)
168
+ assert_equal('Approved', credit_response.creditResponse.message)
169
+
170
+ #test 2C
171
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
172
+ hash2c = void_hash.merge(@@merchant_hash)
173
+ void_response = LitleOnlineRequest.new.void(hash2c)
174
+ assert_equal('000', void_response.voidResponse.response)
175
+ assert_equal('Approved', void_response.voidResponse.message)
176
+ end
177
+
178
+ def test_2_avs
179
+ customer_hash = {
180
+ 'orderId' => '2',
181
+ 'amount' => '0',
182
+ 'orderSource'=>'ecommerce',
183
+ 'billToAddress'=>{
184
+ 'name' => 'Mike J. Hammer',
185
+ 'addressLine1' => '2 Main St.',
186
+ 'addressLine2' => 'Apt. 222',
187
+ 'city' => 'Riverside',
188
+ 'state' => 'RI',
189
+ 'zip' => '02915',
190
+ 'country' => 'US'},
191
+ 'card'=>{
192
+ 'number' =>'5112010000000003',
193
+ 'expDate' => '0212',
194
+ 'cardValidationNum' => '261',
195
+ 'type' => 'MC'
196
+ },
197
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
198
+ }
199
+ hash = customer_hash.merge(@@merchant_hash)
200
+ auth_response = LitleOnlineRequest.new.authorization(hash)
201
+ assert_equal('000', auth_response.authorizationResponse.response)
202
+ assert_equal('Approved', auth_response.authorizationResponse.message)
203
+ assert_equal('22222', auth_response.authorizationResponse.authCode)
204
+ assert_equal('10', auth_response.authorizationResponse.fraudResult.avsResult)
205
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
206
+ end
207
+
208
+ def test_2_sale
209
+ customer_hash = {
210
+ 'orderId' => '2',
211
+ 'amount' => '20020',
212
+ 'orderSource'=>'ecommerce',
213
+ 'billToAddress'=>{
214
+ 'name' => 'Mike J. Hammer',
215
+ 'addressLine1' => '2 Main St.',
216
+ 'addressLine2' => 'Apt. 222',
217
+ 'city' => 'Riverside',
218
+ 'state' => 'RI',
219
+ 'zip' => '02915',
220
+ 'country' => 'US'},
221
+ 'card'=>{
222
+ 'number' =>'5112010000000003',
223
+ 'expDate' => '0212',
224
+ 'cardValidationNum' => '261',
225
+ 'type' => 'MC'
226
+ },
227
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
228
+ }
229
+ hash = customer_hash.merge(@@merchant_hash)
230
+ sale_response = LitleOnlineRequest.new.sale(hash)
231
+ assert_equal('000', sale_response.saleResponse.response)
232
+ assert_equal('Approved', sale_response.saleResponse.message)
233
+ assert_equal('22222', sale_response.saleResponse.authCode)
234
+ assert_equal('10', sale_response.saleResponse.fraudResult.avsResult)
235
+ assert_equal('M', sale_response.saleResponse.fraudResult.cardValidationResult)
236
+
237
+ #test 2B
238
+ credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
239
+ hash2b = credit_hash.merge(@@merchant_hash)
240
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
241
+ assert_equal('000', credit_response.creditResponse.response)
242
+ assert_equal('Approved', credit_response.creditResponse.message)
243
+
244
+ #test 2C
245
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
246
+ hash2c = void_hash.merge(@@merchant_hash)
247
+ void_response = LitleOnlineRequest.new.void(hash2c)
248
+ assert_equal('000', void_response.voidResponse.response)
249
+ assert_equal('Approved', void_response.voidResponse.message)
250
+ end
251
+
252
+ def test_3_auth
253
+ customer_hash = {
254
+ 'orderId' => '3',
255
+ 'amount' => '30030',
256
+ 'orderSource'=>'ecommerce',
257
+ 'billToAddress'=>{
258
+ 'name' => 'Eileen Jones',
259
+ 'addressLine1' => '3 Main St.',
260
+ 'city' => 'Bloomfield',
261
+ 'state' => 'CT',
262
+ 'zip' => '06002',
263
+ 'country' => 'US'},
264
+ 'card'=>{
265
+ 'number' =>'6011010000000003',
266
+ 'expDate' => '0312',
267
+ 'type' => 'DI',
268
+ 'cardValidationNum' => '758'},
269
+ }
270
+ hash = customer_hash.merge(@@merchant_hash)
271
+ auth_response = LitleOnlineRequest.new.authorization(hash)
272
+ assert_equal('000', auth_response.authorizationResponse.response)
273
+ assert_equal('Approved', auth_response.authorizationResponse.message)
274
+ assert_equal('33333', auth_response.authorizationResponse.authCode)
275
+ assert_equal('10', auth_response.authorizationResponse.fraudResult.avsResult)
276
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
277
+
278
+ #test 3A
279
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
280
+ hash2a = capture_hash.merge(@@merchant_hash)
281
+ capture_response = LitleOnlineRequest.new.capture(hash2a)
282
+ assert_equal('000', capture_response.captureResponse.response)
283
+ assert_equal('Approved', capture_response.captureResponse.message)
284
+
285
+ #test 3B
286
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
287
+ hash2b = credit_hash.merge(@@merchant_hash)
288
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
289
+ assert_equal('000', credit_response.creditResponse.response)
290
+ assert_equal('Approved', credit_response.creditResponse.message)
291
+
292
+ #test 3C
293
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
294
+ hash2c = void_hash.merge(@@merchant_hash)
295
+ void_response = LitleOnlineRequest.new.void(hash2c)
296
+ assert_equal('000', void_response.voidResponse.response)
297
+ assert_equal('Approved', void_response.voidResponse.message)
298
+ end
299
+
300
+ def test_3_avs
301
+ customer_hash = {
302
+ 'orderId' => '3',
303
+ 'amount' => '0',
304
+ 'orderSource'=>'ecommerce',
305
+ 'billToAddress'=>{
306
+ 'name' => 'Eileen Jones',
307
+ 'addressLine1' => '3 Main St.',
308
+ 'city' => 'Bloomfield',
309
+ 'state' => 'CT',
310
+ 'zip' => '06002',
311
+ 'country' => 'US'},
312
+ 'card'=>{
313
+ 'number' =>'6011010000000003',
314
+ 'expDate' => '0312',
315
+ 'type' => 'DI',
316
+ 'cardValidationNum' => '758'},
317
+ }
318
+ hash = customer_hash.merge(@@merchant_hash)
319
+ auth_response = LitleOnlineRequest.new.authorization(hash)
320
+ assert_equal('000', auth_response.authorizationResponse.response)
321
+ assert_equal('Approved', auth_response.authorizationResponse.message)
322
+ assert_equal('33333', auth_response.authorizationResponse.authCode)
323
+ assert_equal('10', auth_response.authorizationResponse.fraudResult.avsResult)
324
+ assert_equal('M', auth_response.authorizationResponse.fraudResult.cardValidationResult)
325
+ end
326
+
327
+ def test_3_sale
328
+ customer_hash = {
329
+ 'orderId' => '3',
330
+ 'amount' => '30030',
331
+ 'orderSource'=>'ecommerce',
332
+ 'billToAddress'=>{
333
+ 'name' => 'Eileen Jones',
334
+ 'addressLine1' => '3 Main St.',
335
+ 'city' => 'Bloomfield',
336
+ 'state' => 'CT',
337
+ 'zip' => '06002',
338
+ 'country' => 'US'},
339
+ 'card'=>{
340
+ 'number' =>'6011010000000003',
341
+ 'expDate' => '0312',
342
+ 'type' => 'DI',
343
+ 'cardValidationNum' => '758'},
344
+ }
345
+ hash = customer_hash.merge(@@merchant_hash)
346
+ sale_response = LitleOnlineRequest.new.sale(hash)
347
+ assert_equal('000', sale_response.saleResponse.response)
348
+ assert_equal('Approved', sale_response.saleResponse.message)
349
+ assert_equal('33333', sale_response.saleResponse.authCode)
350
+ assert_equal('10', sale_response.saleResponse.fraudResult.avsResult)
351
+ assert_equal('M', sale_response.saleResponse.fraudResult.cardValidationResult)
352
+
353
+ #test 3B
354
+ credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
355
+ hash2b = credit_hash.merge(@@merchant_hash)
356
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
357
+ assert_equal('000', credit_response.creditResponse.response)
358
+ assert_equal('Approved', credit_response.creditResponse.message)
359
+
360
+ #test 3C
361
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
362
+ hash2c = void_hash.merge(@@merchant_hash)
363
+ void_response = LitleOnlineRequest.new.void(hash2c)
364
+ assert_equal('000', void_response.voidResponse.response)
365
+ assert_equal('Approved', void_response.voidResponse.message)
366
+ end
367
+
368
+ def test_4_auth
369
+ customer_hash = {
370
+ 'orderId' => '4',
371
+ 'amount' => '40040',
372
+ 'orderSource'=>'ecommerce',
373
+ 'billToAddress'=>{
374
+ 'name' => 'Bob Black',
375
+ 'addressLine1' => '4 Main St.',
376
+ 'city' => 'Laurel',
377
+ 'state' => 'MD',
378
+ 'zip' => '20708',
379
+ 'country' => 'US'},
380
+ 'card'=>{
381
+ 'number' =>'375001000000005',
382
+ 'expDate' => '0412',
383
+ 'type' => 'AX'
384
+ },
385
+ }
386
+ hash = customer_hash.merge(@@merchant_hash)
387
+ auth_response = LitleOnlineRequest.new.authorization(hash)
388
+ assert_equal('000', auth_response.authorizationResponse.response)
389
+ assert_equal('Approved', auth_response.authorizationResponse.message)
390
+ assert_equal('44444', auth_response.authorizationResponse.authCode)
391
+ assert_equal('12', auth_response.authorizationResponse.fraudResult.avsResult)
392
+
393
+ #test 4A
394
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
395
+ hash2a = capture_hash.merge(@@merchant_hash)
396
+ capture_response = LitleOnlineRequest.new.capture(hash2a)
397
+ assert_equal('Approved', capture_response.captureResponse.message)
398
+
399
+ #test 4B
400
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
401
+ hash2b = credit_hash.merge(@@merchant_hash)
402
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
403
+ assert_equal('000', credit_response.creditResponse.response)
404
+ assert_equal('Approved', credit_response.creditResponse.message)
405
+
406
+ #test 4C
407
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
408
+ hash2c = void_hash.merge(@@merchant_hash)
409
+ void_response = LitleOnlineRequest.new.void(hash2c)
410
+ assert_equal('000', void_response.voidResponse.response)
411
+ assert_equal('Approved', void_response.voidResponse.message)
412
+ end
413
+
414
+ def test_4_avs
415
+ customer_hash = {
416
+ 'orderId' => '4',
417
+ 'amount' => '0',
418
+ 'orderSource'=>'ecommerce',
419
+ 'billToAddress'=>{
420
+ 'name' => 'Bob Black',
421
+ 'addressLine1' => '4 Main St.',
422
+ 'city' => 'Laurel',
423
+ 'state' => 'MD',
424
+ 'zip' => '20708',
425
+ 'country' => 'US'},
426
+ 'card'=>{
427
+ 'number' =>'375001000000005',
428
+ 'expDate' => '0412',
429
+ 'type' => 'AX'
430
+ },
431
+ }
432
+ hash = customer_hash.merge(@@merchant_hash)
433
+ auth_response = LitleOnlineRequest.new.authorization(hash)
434
+ assert_equal('000', auth_response.authorizationResponse.response)
435
+ assert_equal('Approved', auth_response.authorizationResponse.message)
436
+ assert_equal('44444', auth_response.authorizationResponse.authCode)
437
+ assert_equal('12', auth_response.authorizationResponse.fraudResult.avsResult)
438
+ end
439
+
440
+ def test_4_sale
441
+ customer_hash = {
442
+ 'orderId' => '4',
443
+ 'amount' => '40040',
444
+ 'orderSource'=>'ecommerce',
445
+ 'billToAddress'=>{
446
+ 'name' => 'Bob Black',
447
+ 'addressLine1' => '4 Main St.',
448
+ 'city' => 'Laurel',
449
+ 'state' => 'MD',
450
+ 'zip' => '20708',
451
+ 'country' => 'US'},
452
+ 'card'=>{
453
+ 'number' =>'375001000000005',
454
+ 'expDate' => '0412',
455
+ 'type' => 'AX'
456
+ },
457
+ }
458
+ hash = customer_hash.merge(@@merchant_hash)
459
+ sale_response = LitleOnlineRequest.new.sale(hash)
460
+ assert_equal('000', sale_response.saleResponse.response)
461
+ assert_equal('Approved', sale_response.saleResponse.message)
462
+ assert_equal('44444', sale_response.saleResponse.authCode)
463
+ assert_equal('12', sale_response.saleResponse.fraudResult.avsResult)
464
+
465
+ #test 4B
466
+ credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
467
+ hash2b = credit_hash.merge(@@merchant_hash)
468
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
469
+ assert_equal('000', credit_response.creditResponse.response)
470
+ assert_equal('Approved', credit_response.creditResponse.message)
471
+
472
+ #test 4C
473
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
474
+ hash2c = void_hash.merge(@@merchant_hash)
475
+ void_response = LitleOnlineRequest.new.void(hash2c)
476
+ assert_equal('000', void_response.voidResponse.response)
477
+ assert_equal('Approved', void_response.voidResponse.message)
478
+ end
479
+
480
+ def test_5_auth
481
+ customer_hash = {
482
+ 'orderId' => '5',
483
+ 'amount' => '50050',
484
+ 'orderSource'=>'ecommerce',
485
+ 'card'=>{
486
+ 'number' =>'4457010200000007',
487
+ 'expDate' => '0512',
488
+ 'cardValidationNum' => '463',
489
+ 'type' => 'VI'},
490
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
491
+ }
492
+ hash = customer_hash.merge(@@merchant_hash)
493
+ auth_response = LitleOnlineRequest.new.authorization(hash)
494
+ assert_equal('000', auth_response.authorizationResponse.response)
495
+ assert_equal('Approved', auth_response.authorizationResponse.message)
496
+ assert_equal('55555 ', auth_response.authorizationResponse.authCode)
497
+ assert_equal('32', auth_response.authorizationResponse.fraudResult.avsResult)
498
+ assert_equal('N', auth_response.authorizationResponse.fraudResult.cardValidationResult)
499
+
500
+ #test 5A
501
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
502
+ hash2a = capture_hash.merge(@@merchant_hash)
503
+ capture_response = LitleOnlineRequest.new.capture(hash2a)
504
+ assert_equal('000', capture_response.captureResponse.response)
505
+ assert_equal('Approved', capture_response.captureResponse.message)
506
+
507
+ #test 5B
508
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
509
+ hash2b = credit_hash.merge(@@merchant_hash)
510
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
511
+ assert_equal('000', credit_response.creditResponse.response)
512
+ assert_equal('Approved', credit_response.creditResponse.message)
513
+
514
+ #test 5C
515
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
516
+ hash2c = void_hash.merge(@@merchant_hash)
517
+ void_response = LitleOnlineRequest.new.void(hash2c)
518
+ assert_equal('000', void_response.voidResponse.response)
519
+ assert_equal('Approved', void_response.voidResponse.message)
520
+ end
521
+
522
+ def test_5_avs
523
+ customer_hash = {
524
+ 'orderId' => '5',
525
+ 'amount' => '0',
526
+ 'orderSource'=>'ecommerce',
527
+ 'card'=>{
528
+ 'number' =>'4457010200000007',
529
+ 'expDate' => '0512',
530
+ 'cardValidationNum' => '463',
531
+ 'type' => 'VI'},
532
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
533
+ }
534
+ hash = customer_hash.merge(@@merchant_hash)
535
+ auth_response = LitleOnlineRequest.new.authorization(hash)
536
+ assert_equal('000', auth_response.authorizationResponse.response)
537
+ assert_equal('Approved', auth_response.authorizationResponse.message)
538
+ assert_equal('55555 ', auth_response.authorizationResponse.authCode)
539
+ assert_equal('32', auth_response.authorizationResponse.fraudResult.avsResult)
540
+ assert_equal('N', auth_response.authorizationResponse.fraudResult.cardValidationResult)
541
+ end
542
+
543
+ def test_5_sale
544
+ customer_hash = {
545
+ 'orderId' => '5',
546
+ 'amount' => '50050',
547
+ 'orderSource'=>'ecommerce',
548
+ 'card'=>{
549
+ 'number' =>'4457010200000007',
550
+ 'expDate' => '0512',
551
+ 'cardValidationNum' => '463',
552
+ 'type' => 'VI'},
553
+ 'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
554
+ }
555
+ hash = customer_hash.merge(@@merchant_hash)
556
+ sale_response = LitleOnlineRequest.new.sale(hash)
557
+ assert_equal('000', sale_response.saleResponse.response)
558
+ assert_equal('Approved', sale_response.saleResponse.message)
559
+ assert_equal('55555 ', sale_response.saleResponse.authCode)
560
+ assert_equal('32', sale_response.saleResponse.fraudResult.avsResult)
561
+ assert_equal('N', sale_response.saleResponse.fraudResult.cardValidationResult)
562
+
563
+ #test 5B
564
+ credit_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId}
565
+ hash2b = credit_hash.merge(@@merchant_hash)
566
+ credit_response = LitleOnlineRequest.new.credit(hash2b)
567
+ assert_equal('000', credit_response.creditResponse.response)
568
+ assert_equal('Approved', credit_response.creditResponse.message)
569
+
570
+ #test 5C
571
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
572
+ hash2c = void_hash.merge(@@merchant_hash)
573
+ void_response = LitleOnlineRequest.new.void(hash2c)
574
+ assert_equal('000', void_response.voidResponse.response)
575
+ assert_equal('Approved', void_response.voidResponse.message)
576
+ end
577
+
578
+ def test_6_auth
579
+ customer_hash = {
580
+ 'orderId' => '6',
581
+ 'amount' => '60060',
582
+ 'orderSource'=>'ecommerce',
583
+ 'billToAddress'=>{
584
+ 'name' => 'Joe Green',
585
+ 'addressLine1' => '6 Main St.',
586
+ 'city' => 'Derry',
587
+ 'state' => 'NH',
588
+ 'zip' => '03038',
589
+ 'country' => 'US'},
590
+ 'card'=>{
591
+ 'number' =>'4457010100000008',
592
+ 'expDate' => '0612',
593
+ 'type' => 'VI',
594
+ 'cardValidationNum' => '992'}
595
+ }
596
+ hash = customer_hash.merge(@@merchant_hash)
597
+ auth_response = LitleOnlineRequest.new.authorization(hash)
598
+ assert_equal('110', auth_response.authorizationResponse.response)
599
+ assert_equal('Insufficient Funds', auth_response.authorizationResponse.message)
600
+ assert_equal('34', auth_response.authorizationResponse.fraudResult.avsResult)
601
+ assert_equal('P', auth_response.authorizationResponse.fraudResult.cardValidationResult)
602
+ end
603
+
604
+ def test_6_sale
605
+ customer_hash = {
606
+ 'orderId' => '6',
607
+ 'amount' => '60060',
608
+ 'orderSource'=>'ecommerce',
609
+ 'billToAddress'=>{
610
+ 'name' => 'Joe Green',
611
+ 'addressLine1' => '6 Main St.',
612
+ 'city' => 'Derry',
613
+ 'state' => 'NH',
614
+ 'zip' => '03038',
615
+ 'country' => 'US'},
616
+ 'card'=>{
617
+ 'number' =>'4457010100000008',
618
+ 'expDate' => '0612',
619
+ 'type' => 'VI',
620
+ 'cardValidationNum' => '992'}
621
+ }
622
+ hash = customer_hash.merge(@@merchant_hash)
623
+ sale_response = LitleOnlineRequest.new.sale(hash)
624
+ assert_equal('110', sale_response.saleResponse.response)
625
+ assert_equal('Insufficient Funds', sale_response.saleResponse.message)
626
+ assert_equal('34', sale_response.saleResponse.fraudResult.avsResult)
627
+ assert_equal('P', sale_response.saleResponse.fraudResult.cardValidationResult)
628
+
629
+ #test 6A
630
+ void_hash = {'litleTxnId' => sale_response.saleResponse.litleTxnId }
631
+ hash6A = void_hash.merge(@@merchant_hash)
632
+ void_response = LitleOnlineRequest.new.void(hash6A)
633
+ assert_equal('360', void_response.voidResponse.response)
634
+ assert_equal('No transaction found with specified litleTxnId', void_response.voidResponse.message)
635
+ end
636
+
637
+ def test_7_auth
638
+ customer_hash = {
639
+ 'orderId' => '7',
640
+ 'amount' => '70070',
641
+ 'orderSource'=>'ecommerce',
642
+ 'billToAddress'=>{
643
+ 'name' => 'Jane Murray',
644
+ 'addressLine1' => '7 Main St.',
645
+ 'city' => 'Amesbury',
646
+ 'state' => 'MA',
647
+ 'zip' => '01913',
648
+ 'country' => 'US'},
649
+ 'card'=>{
650
+ 'number' =>'5112010100000002',
651
+ 'expDate' => '0712',
652
+ 'cardValidationNum' => '251',
653
+ 'type' => 'MC'}
654
+ }
655
+ hash = customer_hash.merge(@@merchant_hash)
656
+ authorization_response = LitleOnlineRequest.new.authorization(hash)
657
+ assert_equal('301', authorization_response.authorizationResponse.response)
658
+ assert_equal('Invalid Account Number', authorization_response.authorizationResponse.message)
659
+ assert_equal('34', authorization_response.authorizationResponse.fraudResult.avsResult)
660
+ assert_equal('N', authorization_response.authorizationResponse.fraudResult.cardValidationResult)
661
+ end
662
+
663
+ def test_7_avs
664
+ customer_hash = {
665
+ 'orderId' => '7',
666
+ 'amount' => '0',
667
+ 'orderSource'=>'ecommerce',
668
+ 'billToAddress'=>{
669
+ 'name' => 'Jane Murray',
670
+ 'addressLine1' => '7 Main St.',
671
+ 'city' => 'Amesbury',
672
+ 'state' => 'MA',
673
+ 'zip' => '01913',
674
+ 'country' => 'US'},
675
+ 'card'=>{
676
+ 'number' =>'5112010100000002',
677
+ 'expDate' => '0712',
678
+ 'cardValidationNum' => '251',
679
+ 'type' => 'MC'}
680
+ }
681
+ hash = customer_hash.merge(@@merchant_hash)
682
+ authorization_response = LitleOnlineRequest.new.authorization(hash)
683
+ assert_equal('301', authorization_response.authorizationResponse.response)
684
+ assert_equal('Invalid Account Number', authorization_response.authorizationResponse.message)
685
+ assert_equal('34', authorization_response.authorizationResponse.fraudResult.avsResult)
686
+ assert_equal('N', authorization_response.authorizationResponse.fraudResult.cardValidationResult)
687
+ end
688
+
689
+ def test_7_sale
690
+ customer_hash = {
691
+ 'orderId' => '7',
692
+ 'amount' => '70070',
693
+ 'orderSource'=>'ecommerce',
694
+ 'billToAddress'=>{
695
+ 'name' => 'Jane Murray',
696
+ 'addressLine1' => '7 Main St.',
697
+ 'city' => 'Amesbury',
698
+ 'state' => 'MA',
699
+ 'zip' => '01913',
700
+ 'country' => 'US'},
701
+ 'card'=>{
702
+ 'number' =>'5112010100000002',
703
+ 'expDate' => '0712',
704
+ 'cardValidationNum' => '251',
705
+ 'type' => 'MC'}
706
+ }
707
+ hash = customer_hash.merge(@@merchant_hash)
708
+ sale_response = LitleOnlineRequest.new.sale(hash)
709
+ assert_equal('301', sale_response.saleResponse.response)
710
+ assert_equal('Invalid Account Number', sale_response.saleResponse.message)
711
+ assert_equal('34', sale_response.saleResponse.fraudResult.avsResult)
712
+ assert_equal('N', sale_response.saleResponse.fraudResult.cardValidationResult)
713
+ end
714
+
715
+ def test_8_auth
716
+ customer_hash = {
717
+ 'orderId' => '8',
718
+ 'amount' => '80080',
719
+ 'orderSource'=>'ecommerce',
720
+ 'billToAddress'=>{
721
+ 'name' => 'Mark Johnson',
722
+ 'addressLine1' => '8 Main St.',
723
+ 'city' => 'Manchester',
724
+ 'state' => 'NH',
725
+ 'zip' => '03101',
726
+ 'country' => 'US'},
727
+ 'card'=>{
728
+ 'number' =>'6011010100000002',
729
+ 'expDate' => '0812',
730
+ 'type' => 'DI',
731
+ 'cardValidationNum' => '184'}
732
+ }
733
+ hash = customer_hash.merge(@@merchant_hash)
734
+ auth_response = LitleOnlineRequest.new.authorization(hash)
735
+ assert_equal('123', auth_response.authorizationResponse.response)
736
+ assert_equal('Call Discover', auth_response.authorizationResponse.message)
737
+ assert_equal('P', auth_response.authorizationResponse.fraudResult.cardValidationResult)
738
+ assert_equal('34', auth_response.authorizationResponse.fraudResult.avsResult)
739
+ end
740
+
741
+ def test_8_avs
742
+ customer_hash = {
743
+ 'orderId' => '8',
744
+ 'amount' => '0',
745
+ 'orderSource'=>'ecommerce',
746
+ 'billToAddress'=>{
747
+ 'name' => 'Mark Johnson',
748
+ 'addressLine1' => '8 Main St.',
749
+ 'city' => 'Manchester',
750
+ 'state' => 'NH',
751
+ 'zip' => '03101',
752
+ 'country' => 'US'},
753
+ 'card'=>{
754
+ 'number' =>'6011010100000002',
755
+ 'expDate' => '0812',
756
+ 'type' => 'DI',
757
+ 'cardValidationNum' => '184'}
758
+ }
759
+ hash = customer_hash.merge(@@merchant_hash)
760
+ auth_response = LitleOnlineRequest.new.authorization(hash)
761
+ assert_equal('123', auth_response.authorizationResponse.response)
762
+ assert_equal('Call Discover', auth_response.authorizationResponse.message)
763
+ assert_equal('P', auth_response.authorizationResponse.fraudResult.cardValidationResult)
764
+ assert_equal('34', auth_response.authorizationResponse.fraudResult.avsResult)
765
+ end
766
+
767
+ def test_8_sale
768
+ customer_hash = {
769
+ 'orderId' => '8',
770
+ 'amount' => '80080',
771
+ 'orderSource'=>'ecommerce',
772
+ 'billToAddress'=>{
773
+ 'name' => 'Mark Johnson',
774
+ 'addressLine1' => '8 Main St.',
775
+ 'city' => 'Manchester',
776
+ 'state' => 'NH',
777
+ 'zip' => '03101',
778
+ 'country' => 'US'},
779
+ 'card'=>{
780
+ 'number' =>'6011010100000002',
781
+ 'expDate' => '0812',
782
+ 'type' => 'DI',
783
+ 'cardValidationNum' => '184'}
784
+ }
785
+ hash = customer_hash.merge(@@merchant_hash)
786
+ sale_response = LitleOnlineRequest.new.sale(hash)
787
+ assert_equal('123', sale_response.saleResponse.response)
788
+ assert_equal('Call Discover', sale_response.saleResponse.message)
789
+ assert_equal('P', sale_response.saleResponse.fraudResult.cardValidationResult)
790
+ assert_equal('34', sale_response.saleResponse.fraudResult.avsResult)
791
+ end
792
+
793
+ def test_9_auth
794
+ customer_hash = {
795
+ 'orderId' => '9',
796
+ 'amount' => '90090',
797
+ 'orderSource'=>'ecommerce',
798
+ 'billToAddress'=>{
799
+ 'name' => 'James Miller',
800
+ 'addressLine1' => '9 Main St.',
801
+ 'city' => 'Boston',
802
+ 'state' => 'MA',
803
+ 'zip' => '02134',
804
+ 'country' => 'US'},
805
+ 'card'=>{
806
+ 'number' =>'375001010000003',
807
+ 'expDate' => '0912',
808
+ 'cardValidationNum' => '0421',
809
+ 'type' => 'AX'
810
+ }
811
+ }
812
+ hash = customer_hash.merge(@@merchant_hash)
813
+ response = LitleOnlineRequest.new.authorization(hash)
814
+ assert_equal('303', response.authorizationResponse.response)
815
+ assert_equal('Pick Up Card', response.authorizationResponse.message)
816
+ assert_equal('34', response.authorizationResponse.fraudResult.avsResult)
817
+ end
818
+
819
+ def test_9_avs
820
+ customer_hash = {
821
+ 'orderId' => '9',
822
+ 'amount' => '0',
823
+ 'orderSource'=>'ecommerce',
824
+ 'billToAddress'=>{
825
+ 'name' => 'James Miller',
826
+ 'addressLine1' => '9 Main St.',
827
+ 'city' => 'Boston',
828
+ 'state' => 'MA',
829
+ 'zip' => '02134',
830
+ 'country' => 'US'},
831
+ 'card'=>{
832
+ 'number' =>'375001010000003',
833
+ 'expDate' => '0912',
834
+ 'cardValidationNum' => '0421',
835
+ 'type' => 'AX'
836
+ }
837
+ }
838
+ hash = customer_hash.merge(@@merchant_hash)
839
+ response = LitleOnlineRequest.new.authorization(hash)
840
+ assert_equal('303', response.authorizationResponse.response)
841
+ assert_equal('Pick Up Card', response.authorizationResponse.message)
842
+ assert_equal('34', response.authorizationResponse.fraudResult.avsResult)
843
+ end
844
+
845
+ def test_9_sale
846
+ customer_hash = {
847
+ 'orderId' => '9',
848
+ 'amount' => '90090',
849
+ 'orderSource'=>'ecommerce',
850
+ 'billToAddress'=>{
851
+ 'name' => 'James Miller',
852
+ 'addressLine1' => '9 Main St.',
853
+ 'city' => 'Boston',
854
+ 'state' => 'MA',
855
+ 'zip' => '02134',
856
+ 'country' => 'US'},
857
+ 'card'=>{
858
+ 'number' =>'375001010000003',
859
+ 'expDate' => '0912',
860
+ 'cardValidationNum' => '0421',
861
+ 'type' => 'AX'
862
+ }
863
+ }
864
+ hash = customer_hash.merge(@@merchant_hash)
865
+ response = LitleOnlineRequest.new.sale(hash)
866
+ assert_equal('303', response.saleResponse.response)
867
+ assert_equal('Pick Up Card', response.saleResponse.message)
868
+ assert_equal('34', response.saleResponse.fraudResult.avsResult)
869
+ end
870
+
871
+ def test_10
872
+ customer_hash = {
873
+ 'orderId' => '10',
874
+ 'amount' => '40000',
875
+ 'orderSource'=>'ecommerce',
876
+ 'card'=>{
877
+ 'number' =>'4457010140000141',
878
+ 'expDate' => '0912',
879
+ 'type' => 'VI'
880
+ },
881
+ 'allowPartialAuth' => 'true'
882
+ }
883
+ hash = customer_hash.merge(@@merchant_hash)
884
+ auth_response = LitleOnlineRequest.new.authorization(hash)
885
+ assert_equal('010', auth_response.authorizationResponse.response)
886
+ assert_equal('Partially Approved', auth_response.authorizationResponse.message)
887
+ assert_equal('32000', auth_response.authorizationResponse.approvedAmount)
888
+ end
889
+
890
+ def test_11
891
+ customer_hash = {
892
+ 'orderId' => '11',
893
+ 'amount' => '60000',
894
+ 'orderSource'=>'ecommerce',
895
+ 'card'=>{
896
+ 'number' =>'5112010140000004',
897
+ 'expDate' => '1111',
898
+ 'type' => 'MC'
899
+ },
900
+ 'allowPartialAuth' => 'true'
901
+ }
902
+ hash = customer_hash.merge(@@merchant_hash)
903
+ auth_response = LitleOnlineRequest.new.authorization(hash)
904
+ assert_equal('010', auth_response.authorizationResponse.response)
905
+ assert_equal('Partially Approved', auth_response.authorizationResponse.message)
906
+ assert_equal('48000', auth_response.authorizationResponse.approvedAmount)
907
+ end
908
+
909
+ def test_12
910
+ customer_hash = {
911
+ 'orderId' => '12',
912
+ 'amount' => '50000',
913
+ 'orderSource'=>'ecommerce',
914
+ 'card'=>{
915
+ 'number' =>'375001014000009',
916
+ 'expDate' => '0412',
917
+ 'type' => 'AX'},
918
+ 'allowPartialAuth' => 'true'
919
+ }
920
+ hash = customer_hash.merge(@@merchant_hash)
921
+ auth_response = LitleOnlineRequest.new.authorization(hash)
922
+ assert_equal('010', auth_response.authorizationResponse.response)
923
+ assert_equal('Partially Approved', auth_response.authorizationResponse.message)
924
+ assert_equal('40000', auth_response.authorizationResponse.approvedAmount)
925
+ end
926
+
927
+ def test_13
928
+ customer_hash = {
929
+ 'orderId' => '13',
930
+ 'amount' => '15000',
931
+ 'orderSource'=>'ecommerce',
932
+ 'card'=>{
933
+ 'number' =>'6011010140000004',
934
+ 'expDate' => '0812',
935
+ 'type' => 'DI'},
936
+ 'allowPartialAuth' => 'true'
937
+ }
938
+ hash = customer_hash.merge(@@merchant_hash)
939
+ auth_response = LitleOnlineRequest.new.authorization(hash)
940
+ assert_equal('010', auth_response.authorizationResponse.response)
941
+ assert_equal('Partially Approved', auth_response.authorizationResponse.message)
942
+ assert_equal('12000', auth_response.authorizationResponse.approvedAmount)
943
+ end
944
+ end
945
+ end