LitleOnline 8.12.3 → 8.12.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG +4 -0
  2. data/Rakefile +1 -1
  3. data/lib/Communications.rb +34 -32
  4. data/lib/Configuration.rb +13 -11
  5. data/lib/LitleOnline.rb +0 -1
  6. data/lib/LitleOnlineRequest.rb +546 -543
  7. data/lib/LitleXmlMapper.rb +17 -15
  8. data/lib/XMLFields.rb +903 -901
  9. data/test/certification/certTest1_base.rb +935 -933
  10. data/test/certification/certTest2_authenhanced.rb +548 -546
  11. data/test/certification/certTest3_authreversal.rb +179 -177
  12. data/test/certification/certTest4_echeck.rb +245 -243
  13. data/test/certification/certTest5_token.rb +198 -196
  14. data/test/functional/test_auth.rb +205 -204
  15. data/test/functional/test_authReversal.rb +41 -39
  16. data/test/functional/test_capture.rb +54 -52
  17. data/test/functional/test_captureGivenAuth.rb +153 -152
  18. data/test/functional/test_credit.rb +126 -126
  19. data/test/functional/test_echeckCredit.rb +88 -87
  20. data/test/functional/test_echeckRedeposit.rb +85 -84
  21. data/test/functional/test_echeckSale.rb +132 -131
  22. data/test/functional/test_echeckVerification.rb +97 -95
  23. data/test/functional/test_forceCapture.rb +113 -111
  24. data/test/functional/test_sale.rb +200 -198
  25. data/test/functional/test_token.rb +75 -73
  26. data/test/functional/test_xmlfields.rb +558 -558
  27. data/test/unit/test_LitleOnlineRequest.rb +210 -207
  28. data/test/unit/test_auth.rb +119 -116
  29. data/test/unit/test_authReversal.rb +16 -16
  30. data/test/unit/test_capture.rb +10 -8
  31. data/test/unit/test_captureGivenAuth.rb +62 -59
  32. data/test/unit/test_credit.rb +103 -100
  33. data/test/unit/test_echeckCredit.rb +15 -14
  34. data/test/unit/test_echeckRedeposit.rb +14 -13
  35. data/test/unit/test_echeckSale.rb +16 -15
  36. data/test/unit/test_echeckVerification.rb +14 -13
  37. data/test/unit/test_forceCapture.rb +61 -58
  38. data/test/unit/test_sale.rb +206 -205
  39. data/test/unit/test_token.rb +43 -41
  40. data/test/unit/test_xmlfields.rb +101 -99
  41. metadata +58 -77
  42. data/lib/Obj2xml.rb +0 -37
@@ -1,202 +1,204 @@
1
1
  require 'lib/LitleOnline'
2
2
  require 'test/unit'
3
3
 
4
- class Litle_certTest5 < Test::Unit::TestCase
5
- @@merchant_hash = {'reportGroup'=>'Planets',
6
- 'merchantId'=>'101'
7
- }
8
-
9
- def test_50
10
- customer_hash = {
11
- 'orderId' => '50',
12
- 'accountNumber' => '4457119922390123'
13
- }
14
- hash = customer_hash.merge(@@merchant_hash)
15
- token_response = LitleOnlineRequest.new.register_token_request(hash)
16
- assert_equal('445711', token_response.registerTokenResponse.bin)
17
- assert_equal('VI', token_response.registerTokenResponse['type'])
18
- assert_equal('801', token_response.registerTokenResponse.response)
19
- assert_equal('1111222233330123', token_response.registerTokenResponse.litleToken)
20
- assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
21
- end
22
-
23
- def test_51
24
- customer_hash = {
25
- 'orderId' => '51',
26
- 'accountNumber' => '4457119999999999'
27
- }
28
- hash = customer_hash.merge(@@merchant_hash)
29
- token_response = LitleOnlineRequest.new.register_token_request(hash)
30
- assert_equal('820', token_response.registerTokenResponse.response)
31
- assert_equal('Credit card number was invalid', token_response.registerTokenResponse.message)
32
- end
33
-
34
- def test_52
35
- customer_hash = {
36
- 'orderId' => '52',
37
- 'accountNumber' => '4457119922390123'
38
- }
39
- hash = customer_hash.merge(@@merchant_hash)
40
- token_response = LitleOnlineRequest.new.register_token_request(hash)
41
- assert_equal('445711', token_response.registerTokenResponse.bin)
42
- assert_equal('VI', token_response.registerTokenResponse['type'])
43
- assert_equal('802', token_response.registerTokenResponse.response)
44
- assert_equal('1111222233330123', token_response.registerTokenResponse.litleToken)
45
- assert_equal('Account number was previously registered', token_response.registerTokenResponse.message)
46
- end
47
-
48
- def test_53
49
- customer_hash = {
50
- 'orderId' => '53',
51
- 'echeckForToken'=>{'accNum'=>'1099999998','routingNum'=>'114567895'}
52
- }
53
- hash = customer_hash.merge(@@merchant_hash)
54
- token_response = LitleOnlineRequest.new.register_token_request(hash)
55
- assert_equal('EC', token_response.registerTokenResponse['type'])
56
- assert_equal('998', token_response.registerTokenResponse.eCheckAccountSuffix)
57
- assert_equal('801', token_response.registerTokenResponse.response)
58
- assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
59
- assert_equal('111922223333000998', token_response.registerTokenResponse.litleToken)
60
- end
61
-
62
- def test_54
63
- customer_hash = {
64
- 'orderId' => '54',
65
- 'echeckForToken'=>{'accNum'=>'1022222102','routingNum'=>'1145_7895'}
66
- }
67
- hash = customer_hash.merge(@@merchant_hash)
68
- token_response = LitleOnlineRequest.new.register_token_request(hash)
69
- assert_equal('900', token_response.registerTokenResponse.response)
70
- assert_equal('Invalid bank routing number', token_response.registerTokenResponse.message)
71
- end
72
-
73
- def test_55
74
- customer_hash = {
75
- 'orderId' => '55',
76
- 'amount' => '15000',
77
- 'orderSource' => 'ecommerce',
78
- 'card' => {'number' => '5435101234510196', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
79
- }
80
- hash = customer_hash.merge(@@merchant_hash)
81
- token_response = LitleOnlineRequest.new.authorization(hash)
82
- assert_equal('000', token_response.authorizationResponse.response)
83
- assert_equal('Approved', token_response.authorizationResponse.message)
84
- assert_equal('801', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
85
- assert_equal('Account number was successfully registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
86
- assert_equal('MC', token_response.authorizationResponse.tokenResponse['type'])
87
- assert_equal('543510', token_response.authorizationResponse.tokenResponse.bin)
88
- end
89
-
90
- def test_56
91
- customer_hash = {
92
- 'orderId' => '56',
93
- 'amount' => '15000',
94
- 'orderSource' => 'ecommerce',
95
- 'card' => {'number' => '5435109999999999', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
96
- }
97
- hash = customer_hash.merge(@@merchant_hash)
98
- token_response = LitleOnlineRequest.new.authorization(hash)
99
- assert_equal('301', token_response.authorizationResponse.response)
100
- assert_equal('Invalid account number', token_response.authorizationResponse.message)
101
- end
102
-
103
- def test_57
104
- customer_hash = {
105
- 'orderId' => '57',
106
- 'amount' => '15000',
107
- 'orderSource' => 'ecommerce',
108
- 'card' => {'number' => '5435101234510196', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
4
+ module LitleOnline
5
+ class Litle_certTest5 < Test::Unit::TestCase
6
+ @@merchant_hash = {'reportGroup'=>'Planets',
7
+ 'merchantId'=>'101'
109
8
  }
110
- hash = customer_hash.merge(@@merchant_hash)
111
- token_response = LitleOnlineRequest.new.authorization(hash)
112
- assert_equal('000', token_response.authorizationResponse.response)
113
- assert_equal('Approved', token_response.authorizationResponse.message)
114
- assert_equal('802', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
115
- assert_equal('Account number was previously registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
116
- assert_equal('MC', token_response.authorizationResponse.tokenResponse['type'])
117
- assert_equal('543510', token_response.authorizationResponse.tokenResponse.bin)
118
- end
119
9
 
120
- def test_59
121
- customer_hash = {
122
- 'orderId' => '59',
123
- 'amount' => '15000',
124
- 'orderSource' => 'ecommerce',
125
- 'token' => {'litleToken' => '1712990000040196', 'expDate' => '1112'}
126
- }
127
- hash = customer_hash.merge(@@merchant_hash)
128
- token_response = LitleOnlineRequest.new.authorization(hash)
129
- assert_equal('822', token_response.authorizationResponse.response)
130
- assert_equal('Token was not found', token_response.authorizationResponse.message)
131
- end
132
-
133
- def test_60
134
- customer_hash = {
135
- 'orderId' => '60',
136
- 'amount' => '15000',
137
- 'orderSource' => 'ecommerce',
138
- 'token' => {'litleToken' => '1712999999999999', 'expDate' => '1112'}
139
- }
140
- hash = customer_hash.merge(@@merchant_hash)
141
- token_response = LitleOnlineRequest.new.authorization(hash)
142
- assert_equal('823', token_response.authorizationResponse.response)
143
- assert_equal('Token was invalid', token_response.authorizationResponse.message)
144
- end
145
-
146
- def test_61
147
- customer_hash = {
148
- 'orderId' => '61',
149
- 'amount' => '15000',
150
- 'orderSource' => 'ecommerce',
151
- 'billToAddress'=>{
152
- 'firstName' => 'Tom',
153
- 'lastName' => 'Black'},
154
- 'echeck' => {'accType' => 'Checking', 'accNum' => '1099999003', 'routingNum' => '114567895'}
155
- }
156
- hash = customer_hash.merge(@@merchant_hash)
157
- token_response = LitleOnlineRequest.new.echeck_sale(hash)
158
- assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
159
- assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
160
- assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
161
- assert_equal('003', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
162
- assert_equal('111922223333444003', token_response.echeckSalesResponse.tokenResponse.litleToken)
163
- end
164
-
165
- def test_62
166
- customer_hash = {
167
- 'orderId' => '62',
168
- 'amount' => '15000',
169
- 'orderSource' => 'ecommerce',
170
- 'billToAddress'=>{
171
- 'firstName' => 'Tom',
172
- 'lastName' => 'Black'},
173
- 'echeck' => {'accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '114567895'}
174
- }
175
- hash = customer_hash.merge(@@merchant_hash)
176
- token_response = LitleOnlineRequest.new.echeck_sale(hash)
177
- assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
178
- assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
179
- assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
180
- assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
181
- assert_equal('111922223333444999', token_response.echeckSalesResponse.tokenResponse.litleToken)
182
- end
183
-
184
- def test_63
185
- customer_hash = {
186
- 'orderId' => '63',
187
- 'amount' => '15000',
188
- 'orderSource' => 'ecommerce',
189
- 'billToAddress'=>{
190
- 'firstName' => 'Tom',
191
- 'lastName' => 'Black'},
192
- 'echeck' => {'accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '214567892'}
193
- }
194
- hash = customer_hash.merge(@@merchant_hash)
195
- token_response = LitleOnlineRequest.new.echeck_sale(hash)
196
- assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
197
- assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
198
- assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
199
- assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
200
- assert_equal('111922223333555999', token_response.echeckSalesResponse.tokenResponse.litleToken)
10
+ def test_50
11
+ customer_hash = {
12
+ 'orderId' => '50',
13
+ 'accountNumber' => '4457119922390123'
14
+ }
15
+ hash = customer_hash.merge(@@merchant_hash)
16
+ token_response = LitleOnlineRequest.new.register_token_request(hash)
17
+ assert_equal('445711', token_response.registerTokenResponse.bin)
18
+ assert_equal('VI', token_response.registerTokenResponse['type'])
19
+ assert_equal('801', token_response.registerTokenResponse.response)
20
+ assert_equal('1111222233330123', token_response.registerTokenResponse.litleToken)
21
+ assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
22
+ end
23
+
24
+ def test_51
25
+ customer_hash = {
26
+ 'orderId' => '51',
27
+ 'accountNumber' => '4457119999999999'
28
+ }
29
+ hash = customer_hash.merge(@@merchant_hash)
30
+ token_response = LitleOnlineRequest.new.register_token_request(hash)
31
+ assert_equal('820', token_response.registerTokenResponse.response)
32
+ assert_equal('Credit card number was invalid', token_response.registerTokenResponse.message)
33
+ end
34
+
35
+ def test_52
36
+ customer_hash = {
37
+ 'orderId' => '52',
38
+ 'accountNumber' => '4457119922390123'
39
+ }
40
+ hash = customer_hash.merge(@@merchant_hash)
41
+ token_response = LitleOnlineRequest.new.register_token_request(hash)
42
+ assert_equal('445711', token_response.registerTokenResponse.bin)
43
+ assert_equal('VI', token_response.registerTokenResponse['type'])
44
+ assert_equal('802', token_response.registerTokenResponse.response)
45
+ assert_equal('1111222233330123', token_response.registerTokenResponse.litleToken)
46
+ assert_equal('Account number was previously registered', token_response.registerTokenResponse.message)
47
+ end
48
+
49
+ def test_53
50
+ customer_hash = {
51
+ 'orderId' => '53',
52
+ 'echeckForToken'=>{'accNum'=>'1099999998','routingNum'=>'114567895'}
53
+ }
54
+ hash = customer_hash.merge(@@merchant_hash)
55
+ token_response = LitleOnlineRequest.new.register_token_request(hash)
56
+ assert_equal('EC', token_response.registerTokenResponse['type'])
57
+ assert_equal('998', token_response.registerTokenResponse.eCheckAccountSuffix)
58
+ assert_equal('801', token_response.registerTokenResponse.response)
59
+ assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
60
+ assert_equal('111922223333000998', token_response.registerTokenResponse.litleToken)
61
+ end
62
+
63
+ def test_54
64
+ customer_hash = {
65
+ 'orderId' => '54',
66
+ 'echeckForToken'=>{'accNum'=>'1022222102','routingNum'=>'1145_7895'}
67
+ }
68
+ hash = customer_hash.merge(@@merchant_hash)
69
+ token_response = LitleOnlineRequest.new.register_token_request(hash)
70
+ assert_equal('900', token_response.registerTokenResponse.response)
71
+ assert_equal('Invalid bank routing number', token_response.registerTokenResponse.message)
72
+ end
73
+
74
+ def test_55
75
+ customer_hash = {
76
+ 'orderId' => '55',
77
+ 'amount' => '15000',
78
+ 'orderSource' => 'ecommerce',
79
+ 'card' => {'number' => '5435101234510196', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
80
+ }
81
+ hash = customer_hash.merge(@@merchant_hash)
82
+ token_response = LitleOnlineRequest.new.authorization(hash)
83
+ assert_equal('000', token_response.authorizationResponse.response)
84
+ assert_equal('Approved', token_response.authorizationResponse.message)
85
+ assert_equal('801', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
86
+ assert_equal('Account number was successfully registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
87
+ assert_equal('MC', token_response.authorizationResponse.tokenResponse['type'])
88
+ assert_equal('543510', token_response.authorizationResponse.tokenResponse.bin)
89
+ end
90
+
91
+ def test_56
92
+ customer_hash = {
93
+ 'orderId' => '56',
94
+ 'amount' => '15000',
95
+ 'orderSource' => 'ecommerce',
96
+ 'card' => {'number' => '5435109999999999', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
97
+ }
98
+ hash = customer_hash.merge(@@merchant_hash)
99
+ token_response = LitleOnlineRequest.new.authorization(hash)
100
+ assert_equal('301', token_response.authorizationResponse.response)
101
+ assert_equal('Invalid account number', token_response.authorizationResponse.message)
102
+ end
103
+
104
+ def test_57
105
+ customer_hash = {
106
+ 'orderId' => '57',
107
+ 'amount' => '15000',
108
+ 'orderSource' => 'ecommerce',
109
+ 'card' => {'number' => '5435101234510196', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
110
+ }
111
+ hash = customer_hash.merge(@@merchant_hash)
112
+ token_response = LitleOnlineRequest.new.authorization(hash)
113
+ assert_equal('000', token_response.authorizationResponse.response)
114
+ assert_equal('Approved', token_response.authorizationResponse.message)
115
+ assert_equal('802', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
116
+ assert_equal('Account number was previously registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
117
+ assert_equal('MC', token_response.authorizationResponse.tokenResponse['type'])
118
+ assert_equal('543510', token_response.authorizationResponse.tokenResponse.bin)
119
+ end
120
+
121
+ def test_59
122
+ customer_hash = {
123
+ 'orderId' => '59',
124
+ 'amount' => '15000',
125
+ 'orderSource' => 'ecommerce',
126
+ 'token' => {'litleToken' => '1712990000040196', 'expDate' => '1112'}
127
+ }
128
+ hash = customer_hash.merge(@@merchant_hash)
129
+ token_response = LitleOnlineRequest.new.authorization(hash)
130
+ assert_equal('822', token_response.authorizationResponse.response)
131
+ assert_equal('Token was not found', token_response.authorizationResponse.message)
132
+ end
133
+
134
+ def test_60
135
+ customer_hash = {
136
+ 'orderId' => '60',
137
+ 'amount' => '15000',
138
+ 'orderSource' => 'ecommerce',
139
+ 'token' => {'litleToken' => '1712999999999999', 'expDate' => '1112'}
140
+ }
141
+ hash = customer_hash.merge(@@merchant_hash)
142
+ token_response = LitleOnlineRequest.new.authorization(hash)
143
+ assert_equal('823', token_response.authorizationResponse.response)
144
+ assert_equal('Token was invalid', token_response.authorizationResponse.message)
145
+ end
146
+
147
+ def test_61
148
+ customer_hash = {
149
+ 'orderId' => '61',
150
+ 'amount' => '15000',
151
+ 'orderSource' => 'ecommerce',
152
+ 'billToAddress'=>{
153
+ 'firstName' => 'Tom',
154
+ 'lastName' => 'Black'},
155
+ 'echeck' => {'accType' => 'Checking', 'accNum' => '1099999003', 'routingNum' => '114567895'}
156
+ }
157
+ hash = customer_hash.merge(@@merchant_hash)
158
+ token_response = LitleOnlineRequest.new.echeck_sale(hash)
159
+ assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
160
+ assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
161
+ assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
162
+ assert_equal('003', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
163
+ assert_equal('111922223333444003', token_response.echeckSalesResponse.tokenResponse.litleToken)
164
+ end
165
+
166
+ def test_62
167
+ customer_hash = {
168
+ 'orderId' => '62',
169
+ 'amount' => '15000',
170
+ 'orderSource' => 'ecommerce',
171
+ 'billToAddress'=>{
172
+ 'firstName' => 'Tom',
173
+ 'lastName' => 'Black'},
174
+ 'echeck' => {'accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '114567895'}
175
+ }
176
+ hash = customer_hash.merge(@@merchant_hash)
177
+ token_response = LitleOnlineRequest.new.echeck_sale(hash)
178
+ assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
179
+ assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
180
+ assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
181
+ assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
182
+ assert_equal('111922223333444999', token_response.echeckSalesResponse.tokenResponse.litleToken)
183
+ end
184
+
185
+ def test_63
186
+ customer_hash = {
187
+ 'orderId' => '63',
188
+ 'amount' => '15000',
189
+ 'orderSource' => 'ecommerce',
190
+ 'billToAddress'=>{
191
+ 'firstName' => 'Tom',
192
+ 'lastName' => 'Black'},
193
+ 'echeck' => {'accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '214567892'}
194
+ }
195
+ hash = customer_hash.merge(@@merchant_hash)
196
+ token_response = LitleOnlineRequest.new.echeck_sale(hash)
197
+ assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
198
+ assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
199
+ assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
200
+ assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
201
+ assert_equal('111922223333555999', token_response.echeckSalesResponse.tokenResponse.litleToken)
202
+ end
201
203
  end
202
- end
204
+ end
@@ -26,213 +26,214 @@ require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
28
  #test Authorization Transaction
29
- class TestAuth < Test::Unit::TestCase
30
- def test_simple_auth_with_card
31
- hash = {
32
- 'merchantId' => '101',
33
- 'version'=>'8.8',
34
- 'reportGroup'=>'Planets',
35
- 'orderId'=>'12344',
36
- 'amount'=>'106',
37
- 'orderSource'=>'ecommerce',
38
- 'card'=>{
39
- 'type'=>'VI',
40
- 'number' =>'4100000000000000',
41
- 'expDate' =>'1210'
42
- }}
43
- response= LitleOnlineRequest.new.authorization(hash)
44
- assert_equal('000', response.authorizationResponse.response)
45
- end
46
-
47
- def test_simple_auth_with_paypal
48
- hash = {
49
- 'merchantId' => '101',
50
- 'version'=>'8.8',
51
- 'reportGroup'=>'Planets',
52
- 'amount'=>'106',
53
- 'orderId'=>'123456',
54
- 'orderSource'=>'ecommerce',
55
- 'paypal'=>{
56
- 'payerId'=>'1234',
57
- 'token'=>'1234',
58
- 'transactionId'=>'123456'
59
- }}
60
- response= LitleOnlineRequest.new.authorization(hash)
61
- assert_equal 'Valid Format', response.message
62
- end
63
-
64
- def test_illegal_order_source
65
- hash = {
66
- 'merchantId' => '101',
67
- 'version'=>'8.8',
68
- 'reportGroup'=>'Planets',
69
- 'orderId'=>'12344',
70
- 'amount'=>'106',
71
- 'orderSource'=>'ecomerce', #This order source is mispelled on purpose!
72
- 'card'=>{
73
- 'type'=>'VI',
74
- 'number' =>'4100000000000001',
75
- 'expDate' =>'1210'
76
- }}
77
- response= LitleOnlineRequest.new.authorization(hash)
78
- assert(response.message =~ /Error validating xml data against the schema/)
79
- end
80
-
81
- def test_fields_out_of_order
82
- hash = {
83
- 'merchantId' => '101',
84
- 'version'=>'8.8',
85
- 'reportGroup'=>'Planets',
86
- 'orderId'=>'12344',
87
- 'card'=>{
88
- 'type'=>'VI',
89
- 'number' =>'4100000000000000',
90
- 'expDate' =>'1210'
91
- },
92
- 'orderSource'=>'ecommerce',
93
- 'amount'=>'106'
94
- }
95
- response= LitleOnlineRequest.new.authorization(hash)
96
- assert_equal('000', response.authorizationResponse.response)
97
- end
98
-
99
- def test_invalid_field
100
- hash = {
101
- 'merchantId' => '101',
102
- 'version'=>'8.8',
103
- 'reportGroup'=>'Planets',
104
- 'orderId'=>'12344',
105
- 'amount'=>'106',
106
- 'orderSource'=>'ecommerce',
107
- 'card'=>{
108
- 'NOexistantField' => 'ShouldNotCauseError',
109
- 'type'=>'VI',
110
- 'number' =>'4100000000000000',
111
- 'expDate' =>'1210'
112
- }}
113
- response= LitleOnlineRequest.new.authorization(hash)
114
- assert_equal('000', response.authorizationResponse.response)
115
- end
116
-
117
- def test_pos_without_capability_and_entry_mode
118
- hash = {
119
- 'merchantId' => '101',
120
- 'version'=>'8.8',
121
- 'reportGroup'=>'Planets',
122
- 'orderId'=>'12344',
123
- 'amount'=>'106',
124
- 'orderSource'=>'ecommerce',
125
- 'pos'=>{'cardholderId'=>'pin'},
126
- 'card'=>{
127
- 'type'=>'VI',
128
- 'number' =>'4100000000000001',
129
- 'expDate' =>'1210'
130
- }}
131
- response= LitleOnlineRequest.new.authorization(hash)
132
- assert(response.message =~ /Error validating xml data against the schema/)
133
- end
29
+ module LitleOnline
30
+ class TestAuth < Test::Unit::TestCase
31
+ def test_simple_auth_with_card
32
+ hash = {
33
+ 'merchantId' => '101',
34
+ 'version'=>'8.8',
35
+ 'reportGroup'=>'Planets',
36
+ 'orderId'=>'12344',
37
+ 'amount'=>'106',
38
+ 'orderSource'=>'ecommerce',
39
+ 'card'=>{
40
+ 'type'=>'VI',
41
+ 'number' =>'4100000000000000',
42
+ 'expDate' =>'1210'
43
+ }}
44
+ response= LitleOnlineRequest.new.authorization(hash)
45
+ assert_equal('000', response.authorizationResponse.response)
46
+ end
134
47
 
135
- def test_no_order_id
136
- hash = {
137
- 'merchantId' => '101',
138
- 'version'=>'8.8',
139
- 'reportGroup'=>'Planets',
140
- 'amount'=>'106',
141
- 'orderSource'=>'ecommerce',
142
- 'card'=>{
143
- 'type'=>'VI',
144
- 'number' =>'4100000000000001',
145
- 'expDate' =>'1210'
146
- }}
147
- response= LitleOnlineRequest.new.authorization(hash)
148
- assert(response.message =~ /Error validating xml data against the schema/)
149
- end
48
+ def test_simple_auth_with_paypal
49
+ hash = {
50
+ 'merchantId' => '101',
51
+ 'version'=>'8.8',
52
+ 'reportGroup'=>'Planets',
53
+ 'amount'=>'106',
54
+ 'orderId'=>'123456',
55
+ 'orderSource'=>'ecommerce',
56
+ 'paypal'=>{
57
+ 'payerId'=>'1234',
58
+ 'token'=>'1234',
59
+ 'transactionId'=>'123456'
60
+ }}
61
+ response= LitleOnlineRequest.new.authorization(hash)
62
+ assert_equal 'Valid Format', response.message
63
+ end
150
64
 
151
- def test_no_amount
152
- hash = {
153
- 'merchantId' => '101',
154
- 'version'=>'8.8',
155
- 'reportGroup'=>'Planets',
156
- 'orderId'=>'12344',
157
- 'orderSource'=>'ecommerce',
158
- 'card'=>{
159
- 'type'=>'VI',
160
- 'number' =>'4100000000000001',
161
- 'expDate' =>'1210'
162
- }}
163
- response= LitleOnlineRequest.new.authorization(hash)
164
- assert(response.message =~ /Error validating xml data against the schema/)
165
- end
166
-
167
- def test_no_order_source
168
- hash = {
169
- 'merchantId' => '101',
170
- 'version'=>'8.8',
171
- 'reportGroup'=>'Planets',
172
- # 'litleTxnId'=>'123456',
173
- 'orderId'=>'12344',
174
- 'amount'=>'106',
175
- 'card'=>{
176
- 'type'=>'VI',
177
- 'number' =>'4100000000000001',
178
- 'expDate' =>'1210'
179
- }}
180
- response= LitleOnlineRequest.new.authorization(hash)
181
- assert(response.message =~ /Error validating xml data against the schema/)
182
- end
183
-
184
- def test_authorization_missing_attributes
185
- hash={
186
- 'reportGroup'=>'Planets',
187
- 'amount'=>'106',
188
-
189
- 'orderSource'=>'ecommerce',
190
- 'card'=>{
191
- 'type'=>'VI',
192
- 'number' =>'4100000000000001',
193
- 'expDate' =>'1210'
194
- }}
195
-
196
- response= LitleOnlineRequest.new.authorization(hash)
197
- assert(response.message =~ /Error validating xml data against the schema/)
198
- end
199
-
200
- def test_orderId_required
201
- start_hash = {
202
- 'merchantId'=>'101',
203
- 'reportGroup'=>'Planets',
204
- 'amount'=>'101',
205
- 'orderSource'=>'ecommerce',
206
- 'card' => {
207
- 'type' => 'VI',
208
- 'number' => '1111222233334444'
65
+ def test_illegal_order_source
66
+ hash = {
67
+ 'merchantId' => '101',
68
+ 'version'=>'8.8',
69
+ 'reportGroup'=>'Planets',
70
+ 'orderId'=>'12344',
71
+ 'amount'=>'106',
72
+ 'orderSource'=>'ecomerce', #This order source is mispelled on purpose!
73
+ 'card'=>{
74
+ 'type'=>'VI',
75
+ 'number' =>'4100000000000001',
76
+ 'expDate' =>'1210'
77
+ }}
78
+ response= LitleOnlineRequest.new.authorization(hash)
79
+ assert(response.message =~ /Error validating xml data against the schema/)
80
+ end
81
+
82
+ def test_fields_out_of_order
83
+ hash = {
84
+ 'merchantId' => '101',
85
+ 'version'=>'8.8',
86
+ 'reportGroup'=>'Planets',
87
+ 'orderId'=>'12344',
88
+ 'card'=>{
89
+ 'type'=>'VI',
90
+ 'number' =>'4100000000000000',
91
+ 'expDate' =>'1210'
92
+ },
93
+ 'orderSource'=>'ecommerce',
94
+ 'amount'=>'106'
209
95
  }
210
- }
211
- response= LitleOnlineRequest.new.authorization(start_hash)
212
- assert(response.message =~ /Error validating xml data against the schema/)
96
+ response= LitleOnlineRequest.new.authorization(hash)
97
+ assert_equal('000', response.authorizationResponse.response)
98
+ end
213
99
 
214
- response = LitleOnlineRequest.new.authorization(start_hash.merge({'orderId'=>'1234'}))
215
- assert_equal('000', response.authorizationResponse.response)
216
- end
217
-
218
- def test_ssn_optional
219
- start_hash = {
220
- 'orderId'=>'12344',
221
- 'merchantId'=>'101',
222
- 'reportGroup'=>'Planets',
223
- 'amount'=>'101',
224
- 'orderSource'=>'ecommerce',
225
- 'card' => {
226
- 'type' => 'VI',
227
- 'number' => '1111222233334444'
228
- },
229
- }
230
- response = LitleOnlineRequest.new.authorization(start_hash)
231
- assert_equal('000', response.authorizationResponse.response)
100
+ def test_invalid_field
101
+ hash = {
102
+ 'merchantId' => '101',
103
+ 'version'=>'8.8',
104
+ 'reportGroup'=>'Planets',
105
+ 'orderId'=>'12344',
106
+ 'amount'=>'106',
107
+ 'orderSource'=>'ecommerce',
108
+ 'card'=>{
109
+ 'NOexistantField' => 'ShouldNotCauseError',
110
+ 'type'=>'VI',
111
+ 'number' =>'4100000000000000',
112
+ 'expDate' =>'1210'
113
+ }}
114
+ response= LitleOnlineRequest.new.authorization(hash)
115
+ assert_equal('000', response.authorizationResponse.response)
116
+ end
232
117
 
233
- response = LitleOnlineRequest.new.authorization(start_hash.merge({'customerInfo'=>{'ssn'=>'000112222'} }))
234
- assert_equal('000', response.authorizationResponse.response)
235
- end
118
+ def test_pos_without_capability_and_entry_mode
119
+ hash = {
120
+ 'merchantId' => '101',
121
+ 'version'=>'8.8',
122
+ 'reportGroup'=>'Planets',
123
+ 'orderId'=>'12344',
124
+ 'amount'=>'106',
125
+ 'orderSource'=>'ecommerce',
126
+ 'pos'=>{'cardholderId'=>'pin'},
127
+ 'card'=>{
128
+ 'type'=>'VI',
129
+ 'number' =>'4100000000000001',
130
+ 'expDate' =>'1210'
131
+ }}
132
+ response= LitleOnlineRequest.new.authorization(hash)
133
+ assert(response.message =~ /Error validating xml data against the schema/)
134
+ end
135
+
136
+ def test_no_order_id
137
+ hash = {
138
+ 'merchantId' => '101',
139
+ 'version'=>'8.8',
140
+ 'reportGroup'=>'Planets',
141
+ 'amount'=>'106',
142
+ 'orderSource'=>'ecommerce',
143
+ 'card'=>{
144
+ 'type'=>'VI',
145
+ 'number' =>'4100000000000001',
146
+ 'expDate' =>'1210'
147
+ }}
148
+ response= LitleOnlineRequest.new.authorization(hash)
149
+ assert(response.message =~ /Error validating xml data against the schema/)
150
+ end
151
+
152
+ def test_no_amount
153
+ hash = {
154
+ 'merchantId' => '101',
155
+ 'version'=>'8.8',
156
+ 'reportGroup'=>'Planets',
157
+ 'orderId'=>'12344',
158
+ 'orderSource'=>'ecommerce',
159
+ 'card'=>{
160
+ 'type'=>'VI',
161
+ 'number' =>'4100000000000001',
162
+ 'expDate' =>'1210'
163
+ }}
164
+ response= LitleOnlineRequest.new.authorization(hash)
165
+ assert(response.message =~ /Error validating xml data against the schema/)
166
+ end
236
167
 
237
- end
238
-
168
+ def test_no_order_source
169
+ hash = {
170
+ 'merchantId' => '101',
171
+ 'version'=>'8.8',
172
+ 'reportGroup'=>'Planets',
173
+ # 'litleTxnId'=>'123456',
174
+ 'orderId'=>'12344',
175
+ 'amount'=>'106',
176
+ 'card'=>{
177
+ 'type'=>'VI',
178
+ 'number' =>'4100000000000001',
179
+ 'expDate' =>'1210'
180
+ }}
181
+ response= LitleOnlineRequest.new.authorization(hash)
182
+ assert(response.message =~ /Error validating xml data against the schema/)
183
+ end
184
+
185
+ def test_authorization_missing_attributes
186
+ hash={
187
+ 'reportGroup'=>'Planets',
188
+ 'amount'=>'106',
189
+
190
+ 'orderSource'=>'ecommerce',
191
+ 'card'=>{
192
+ 'type'=>'VI',
193
+ 'number' =>'4100000000000001',
194
+ 'expDate' =>'1210'
195
+ }}
196
+
197
+ response= LitleOnlineRequest.new.authorization(hash)
198
+ assert(response.message =~ /Error validating xml data against the schema/)
199
+ end
200
+
201
+ def test_orderId_required
202
+ start_hash = {
203
+ 'merchantId'=>'101',
204
+ 'reportGroup'=>'Planets',
205
+ 'amount'=>'101',
206
+ 'orderSource'=>'ecommerce',
207
+ 'card' => {
208
+ 'type' => 'VI',
209
+ 'number' => '1111222233334444'
210
+ }
211
+ }
212
+ response= LitleOnlineRequest.new.authorization(start_hash)
213
+ assert(response.message =~ /Error validating xml data against the schema/)
214
+
215
+ response = LitleOnlineRequest.new.authorization(start_hash.merge({'orderId'=>'1234'}))
216
+ assert_equal('000', response.authorizationResponse.response)
217
+ end
218
+
219
+ def test_ssn_optional
220
+ start_hash = {
221
+ 'orderId'=>'12344',
222
+ 'merchantId'=>'101',
223
+ 'reportGroup'=>'Planets',
224
+ 'amount'=>'101',
225
+ 'orderSource'=>'ecommerce',
226
+ 'card' => {
227
+ 'type' => 'VI',
228
+ 'number' => '1111222233334444'
229
+ },
230
+ }
231
+ response = LitleOnlineRequest.new.authorization(start_hash)
232
+ assert_equal('000', response.authorizationResponse.response)
233
+
234
+ response = LitleOnlineRequest.new.authorization(start_hash.merge({'customerInfo'=>{'ssn'=>'000112222'} }))
235
+ assert_equal('000', response.authorizationResponse.response)
236
+ end
237
+
238
+ end
239
+ end