LitleOnline 8.10.0 → 8.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/Rakefile +1 -1
  2. data/lib/Communications.rb +3 -4
  3. data/lib/Configuration.rb +1 -1
  4. data/lib/LitleOnlineRequest.rb +170 -139
  5. data/lib/XMLFields.rb +29 -29
  6. data/test/certification/certTest1_base.rb +602 -606
  7. data/test/certification/certTest2_authenhanced.rb +6 -6
  8. data/test/certification/certTest3_authreversal.rb +29 -30
  9. data/test/certification/certTest4_echeck.rb +13 -16
  10. data/test/certification/certTest5_token.rb +11 -31
  11. data/test/functional/test_auth.rb +6 -6
  12. data/test/functional/test_authReversal.rb +6 -6
  13. data/test/functional/test_capture.rb +3 -3
  14. data/test/functional/test_captureGivenAuth.rb +12 -12
  15. data/test/functional/test_credit.rb +7 -7
  16. data/test/functional/test_echeckCredit.rb +11 -11
  17. data/test/functional/test_echeckRedeposit.rb +8 -8
  18. data/test/functional/test_echeckSale.rb +34 -32
  19. data/test/functional/test_echeckVerification.rb +8 -8
  20. data/test/functional/test_forceCapture.rb +8 -8
  21. data/test/functional/test_sale.rb +9 -11
  22. data/test/functional/test_token.rb +12 -12
  23. data/test/functional/test_xmlfields.rb +18 -18
  24. data/test/unit/test_LitleOnlineRequest.rb +26 -17
  25. data/test/unit/test_auth.rb +22 -10
  26. data/test/unit/test_authReversal.rb +2 -2
  27. data/test/unit/test_capture.rb +1 -1
  28. data/test/unit/test_captureGivenAuth.rb +6 -6
  29. data/test/unit/test_credit.rb +4 -7
  30. data/test/unit/test_echeckCredit.rb +2 -2
  31. data/test/unit/test_echeckRedeposit.rb +8 -8
  32. data/test/unit/test_echeckSale.rb +2 -2
  33. data/test/unit/test_echeckVerification.rb +8 -8
  34. data/test/unit/test_forceCapture.rb +8 -8
  35. data/test/unit/test_sale.rb +9 -9
  36. data/test/unit/test_token.rb +4 -4
  37. data/test/unit/test_xmlfields.rb +7 -9
  38. metadata +12 -12
@@ -26,7 +26,7 @@ require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
28
  class TestForceCapture < Test::Unit::TestCase
29
- def test_simple_forceCapturewithCard
29
+ def test_simple_force_capture_with_card
30
30
  hash = {
31
31
  'merchantId' => '101',
32
32
  'version'=>'8.8',
@@ -40,11 +40,11 @@ class TestForceCapture < Test::Unit::TestCase
40
40
  'number' =>'4100000000000001',
41
41
  'expDate' =>'1210'
42
42
  }}
43
- response= LitleOnlineRequest.new.forceCapture(hash)
43
+ response= LitleOnlineRequest.new.force_capture(hash)
44
44
  assert_equal('000', response.forceCaptureResponse.response)
45
45
  end
46
46
 
47
- def test_simple_forceCapturewithtoken
47
+ def test_simple_force_capture_with_token
48
48
  hash = {
49
49
  'merchantId' => '101',
50
50
  'version'=>'8.8',
@@ -59,11 +59,11 @@ class TestForceCapture < Test::Unit::TestCase
59
59
  'cardValidationNum'=>'555',
60
60
  'type'=>'VI'
61
61
  }}
62
- response= LitleOnlineRequest.new.forceCapture(hash)
62
+ response= LitleOnlineRequest.new.force_capture(hash)
63
63
  assert_equal('Valid Format', response.message)
64
64
  end
65
65
 
66
- def test_FieldsOutOfOrder
66
+ def test_fields_out_of_order
67
67
  hash = {
68
68
  'merchantId' => '101',
69
69
  'version'=>'8.8',
@@ -78,11 +78,11 @@ class TestForceCapture < Test::Unit::TestCase
78
78
  'reportGroup'=>'Planets',
79
79
  'orderId'=>'12344'
80
80
  }
81
- response= LitleOnlineRequest.new.forceCapture(hash)
81
+ response= LitleOnlineRequest.new.force_capture(hash)
82
82
  assert_equal('Valid Format', response.message)
83
83
  end
84
84
 
85
- def test_InvalidField
85
+ def test_invalid_field
86
86
  hash = {
87
87
  'merchantId' => '101',
88
88
  'version'=>'8.8',
@@ -97,7 +97,7 @@ class TestForceCapture < Test::Unit::TestCase
97
97
  'number' =>'4100000000000001',
98
98
  'expDate' =>'1210'
99
99
  }}
100
- response= LitleOnlineRequest.new.forceCapture(hash)
100
+ response= LitleOnlineRequest.new.force_capture(hash)
101
101
  assert_equal('Valid Format', response.message)
102
102
  end
103
103
 
@@ -26,7 +26,7 @@ require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
28
  class TestSale < Test::Unit::TestCase
29
- def test_simpleSalewithCard
29
+ def test_simple_sale_with_card
30
30
  hash = {
31
31
  'merchantId' => '101',
32
32
  'version'=>'8.8',
@@ -44,7 +44,7 @@ class TestSale < Test::Unit::TestCase
44
44
  assert_equal('000', response.saleResponse.response)
45
45
  end
46
46
 
47
- def test_simpleSalewithpaypal
47
+ def test_simple_sale_with_paypal
48
48
  hash = {
49
49
  'merchantId' => '101',
50
50
  'version'=>'8.8',
@@ -62,7 +62,7 @@ class TestSale < Test::Unit::TestCase
62
62
  assert_equal 'Valid Format', response.message
63
63
  end
64
64
 
65
- def test_illegalorderSource
65
+ def test_illegal_order_source
66
66
  hash = {
67
67
  'merchantId' => '101',
68
68
  'version'=>'8.8',
@@ -80,7 +80,7 @@ class TestSale < Test::Unit::TestCase
80
80
  assert(response.message =~ /Error validating xml data against the schema/)
81
81
  end
82
82
 
83
- def test_illegalcardType
83
+ def test_illegal_card_type
84
84
  hash = {
85
85
  'merchantId' => '101',
86
86
  'version'=>'8.8',
@@ -98,7 +98,7 @@ class TestSale < Test::Unit::TestCase
98
98
  assert(response.message =~ /Error validating xml data against the schema/)
99
99
  end
100
100
 
101
- def test_noReportGroup
101
+ def test_no_report_group
102
102
  hash = {
103
103
  'merchantId' => '101',
104
104
  'version'=>'8.8',
@@ -116,7 +116,7 @@ class TestSale < Test::Unit::TestCase
116
116
  assert_equal('000', response.saleResponse.response)
117
117
  end
118
118
 
119
- def test_FieldsOutOfOrder
119
+ def test_fields_out_of_order
120
120
  hash = {
121
121
  'merchantId' => '101',
122
122
  'version'=>'8.8',
@@ -135,7 +135,7 @@ class TestSale < Test::Unit::TestCase
135
135
  assert_equal('000', response.saleResponse.response)
136
136
  end
137
137
 
138
- def test_InvalidField
138
+ def test_invalid_field
139
139
  hash = {
140
140
  'merchantId' => '101',
141
141
  'version'=>'8.8',
@@ -154,7 +154,7 @@ class TestSale < Test::Unit::TestCase
154
154
  assert_equal('000', response.saleResponse.response)
155
155
  end
156
156
 
157
- def test_InvalidEmbeddedFieldValues
157
+ def test_invalid_embedded_field_values
158
158
  #becasue there are sub fields under fraud check that are not specified
159
159
  hash = {
160
160
  'merchantId' => '101',
@@ -174,11 +174,9 @@ class TestSale < Test::Unit::TestCase
174
174
  assert_equal('000', response.saleResponse.response)
175
175
  end
176
176
 
177
- def test_simpleSalewithCard
177
+ def test_simple_sale_with_card
178
178
  hash = {
179
179
  'merchantId'=>'101',
180
- 'proxy_addr' => '10.1.2.254',
181
- 'proxy_port' => '8080',
182
180
  'version'=>'8.8',
183
181
  'reportGroup'=>'Planets',
184
182
  'litleTxnId'=>'123456',
@@ -26,7 +26,7 @@ require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
28
  class TestToken < Test::Unit::TestCase
29
- def test_simpleToken
29
+ def test_simple_token
30
30
  hash = {
31
31
  'merchantId' => '101',
32
32
  'version'=>'8.8',
@@ -34,11 +34,11 @@ class TestToken < Test::Unit::TestCase
34
34
  'orderId'=>'12344',
35
35
  'accountNumber'=>'1233456789103801'
36
36
  }
37
- response= LitleOnlineRequest.new.registerTokenRequest(hash)
37
+ response= LitleOnlineRequest.new.register_token_request(hash)
38
38
  assert_equal('Valid Format', response.message)
39
39
  end
40
40
 
41
- def test_simpleTokenwithpaypage
41
+ def test_simple_token_with_paypage
42
42
  hash = {
43
43
  'merchantId' => '101',
44
44
  'version'=>'8.8',
@@ -46,11 +46,11 @@ class TestToken < Test::Unit::TestCase
46
46
  'orderId'=>'12344',
47
47
  'paypageRegistrationId'=>'1233456789101112'
48
48
  }
49
- response= LitleOnlineRequest.new.registerTokenRequest(hash)
49
+ response= LitleOnlineRequest.new.register_token_request(hash)
50
50
  assert_equal('Valid Format', response.message)
51
51
  end
52
52
 
53
- def test_simpleTokenecheck
53
+ def test_simple_token_echeck
54
54
  hash = {
55
55
  'reportGroup'=>'Planets',
56
56
  'merchantId' => '101',
@@ -58,11 +58,11 @@ class TestToken < Test::Unit::TestCase
58
58
  'orderId'=>'12344',
59
59
  'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'}
60
60
  }
61
- response= LitleOnlineRequest.new.registerTokenRequest(hash)
61
+ response= LitleOnlineRequest.new.register_token_request(hash)
62
62
  assert_equal('Valid Format', response.message)
63
63
  end
64
64
 
65
- def test_Tokenecheckmissingrequired
65
+ def test_token_echeck_missing_required
66
66
  hash = {
67
67
  'merchantId' => '101',
68
68
  'version'=>'8.8',
@@ -70,11 +70,11 @@ class TestToken < Test::Unit::TestCase
70
70
  'orderId'=>'12344',
71
71
  'echeckForToken'=>{'routingNum'=>'132344565'}
72
72
  }
73
- response= LitleOnlineRequest.new.registerTokenRequest(hash)
73
+ response= LitleOnlineRequest.new.register_token_request(hash)
74
74
  assert(response.message =~ /Error validating xml data against the schema/)
75
75
  end
76
76
 
77
- def test_FieldsOutOfOrder
77
+ def test_fields_out_of_order
78
78
  hash = {
79
79
  'merchantId' => '101',
80
80
  'version'=>'8.8',
@@ -82,11 +82,11 @@ class TestToken < Test::Unit::TestCase
82
82
  'accountNumber'=>'1233456789103801',
83
83
  'reportGroup'=>'Planets',
84
84
  }
85
- response= LitleOnlineRequest.new.registerTokenRequest(hash)
85
+ response= LitleOnlineRequest.new.register_token_request(hash)
86
86
  assert_equal('Valid Format', response.message)
87
87
  end
88
88
 
89
- def test_InvalidField
89
+ def test_invalid_field
90
90
  hash = {
91
91
  'merchantId' => '101',
92
92
  'version'=>'8.8',
@@ -95,7 +95,7 @@ class TestToken < Test::Unit::TestCase
95
95
  'accountNumber'=>'1233456789103801',
96
96
  'reportGroup'=>'Planets',
97
97
  }
98
- response= LitleOnlineRequest.new.registerTokenRequest(hash)
98
+ response= LitleOnlineRequest.new.register_token_request(hash)
99
99
  assert_equal('Valid Format', response.message)
100
100
  end
101
101
  end
@@ -26,7 +26,7 @@ require 'lib/LitleOnline'
26
26
  require 'test/unit'
27
27
 
28
28
  class TestXmlfields < Test::Unit::TestCase
29
- def test_cardnoRequiredtypeortrack
29
+ def test_card_no_required_type_or_track
30
30
  hash = {
31
31
  'merchantId' => '101',
32
32
  'version'=>'8.8',
@@ -44,7 +44,7 @@ class TestXmlfields < Test::Unit::TestCase
44
44
  assert(response.message =~ /Error validating xml data against the schema/)
45
45
  end
46
46
 
47
- def test_simpleCustomBilling
47
+ def test_simple_custom_billing
48
48
  hash = {
49
49
  'merchantId' => '101',
50
50
  'version'=>'8.8',
@@ -63,7 +63,7 @@ class TestXmlfields < Test::Unit::TestCase
63
63
  assert_equal('Valid Format', response.message)
64
64
  end
65
65
 
66
- def test_BillMeLater
66
+ def test_bill_me_later
67
67
  hash = {
68
68
  'merchantId' => '101',
69
69
  'version'=>'8.8',
@@ -83,7 +83,7 @@ class TestXmlfields < Test::Unit::TestCase
83
83
  assert_equal('000', response.saleResponse.response)
84
84
  end
85
85
 
86
- def test_CustomerInfo
86
+ def test__customer_info
87
87
  hash = {
88
88
  'merchantId' => '101',
89
89
  'version'=>'8.8',
@@ -102,7 +102,7 @@ class TestXmlfields < Test::Unit::TestCase
102
102
  assert_equal('Valid Format', response.message)
103
103
  end
104
104
 
105
- def test_simplebilltoAddress
105
+ def test_simple_bill_to_address
106
106
  hash = {
107
107
  'merchantId' => '101',
108
108
  'version'=>'8.8',
@@ -120,7 +120,7 @@ class TestXmlfields < Test::Unit::TestCase
120
120
  assert_equal('Valid Format', response.message)
121
121
  end
122
122
 
123
- def test_processingInstructions
123
+ def test_processing_instructions
124
124
  hash = {
125
125
  'merchantId' => '101',
126
126
  'version'=>'8.8',
@@ -156,7 +156,7 @@ class TestXmlfields < Test::Unit::TestCase
156
156
  assert_equal('Valid Format', response.message)
157
157
  end
158
158
 
159
- def test_poswithinvalidentryMode
159
+ def test_pos_with_invalid_entry_mode
160
160
  hash = {
161
161
  'merchantId' => '101',
162
162
  'version'=>'8.8',
@@ -174,7 +174,7 @@ class TestXmlfields < Test::Unit::TestCase
174
174
  assert(response.message =~ /Error validating xml data against the schema/)
175
175
  end
176
176
 
177
- def test_amexData
177
+ def test_amex_data
178
178
  hash = {
179
179
  'merchantId' => '101',
180
180
  'version'=>'8.8',
@@ -192,7 +192,7 @@ class TestXmlfields < Test::Unit::TestCase
192
192
  assert_equal('Valid Format', response.message)
193
193
  end
194
194
 
195
- def test_amexDatamissingsellerId
195
+ def test_amex_data_missing_seller_id
196
196
  hash = {
197
197
  'merchantId' => '101',
198
198
  'version'=>'8.8',
@@ -210,7 +210,7 @@ class TestXmlfields < Test::Unit::TestCase
210
210
  assert(response.message =~ /Error validating xml data against the schema/)
211
211
  end
212
212
 
213
- def test_simpleEnhancedData
213
+ def test_simple_enhanced_data
214
214
  hash = {
215
215
  'merchantId' => '101',
216
216
  'version'=>'8.8',
@@ -234,7 +234,7 @@ class TestXmlfields < Test::Unit::TestCase
234
234
  assert_equal('Valid Format', response.message)
235
235
  end
236
236
 
237
- def test_simpleEnhancedDataincorrectEnumforCountryCode
237
+ def test_simple_enhanced_data_incorrect_enum_for_country_code
238
238
  hash = {
239
239
  'merchantId' => '101',
240
240
  'version'=>'8.8',
@@ -258,7 +258,7 @@ class TestXmlfields < Test::Unit::TestCase
258
258
  assert(response.message =~ /Error validating xml data against the schema/)
259
259
  end
260
260
 
261
- def test_EnhancedDatawithdetailtax
261
+ def test_enhanced_data_with_detail_tax
262
262
  hash = {
263
263
  'merchantId' => '101',
264
264
  'version'=>'8.8',
@@ -283,7 +283,7 @@ class TestXmlfields < Test::Unit::TestCase
283
283
  assert_equal('Valid Format', response.message)
284
284
  end
285
285
 
286
- def test_EnhancedDatawithlineItem
286
+ def test_enhanced_data_with_line_item
287
287
  hash = {
288
288
  'merchantId' => '101',
289
289
  'version'=>'8.8',
@@ -314,7 +314,7 @@ class TestXmlfields < Test::Unit::TestCase
314
314
  assert_equal('Valid Format', response.message)
315
315
  end
316
316
 
317
- def test_simpletoken
317
+ def test_simple_token
318
318
  hash = {
319
319
  'merchantId' => '101',
320
320
  'version'=>'8.8',
@@ -332,7 +332,7 @@ class TestXmlfields < Test::Unit::TestCase
332
332
  assert_equal('Valid Format', response.message)
333
333
  end
334
334
 
335
- def test_tokenwithincorrecttokenLength
335
+ def test_token_with_incorrect_token_Length
336
336
  hash = {
337
337
  'merchantId' => '101',
338
338
  'version'=>'8.8',
@@ -350,7 +350,7 @@ class TestXmlfields < Test::Unit::TestCase
350
350
  assert(response.message =~ /Error validating xml data against the schema/)
351
351
  end
352
352
 
353
- def test_tokenmissingexpDatandvalidNum
353
+ def test_token_missing_exp_dat_and_valid_num
354
354
  hash = {
355
355
  'merchantId' => '101',
356
356
  'version'=>'8.8',
@@ -366,7 +366,7 @@ class TestXmlfields < Test::Unit::TestCase
366
366
  assert_equal('Valid Format', response.message)
367
367
  end
368
368
 
369
- def test_simplePaypage
369
+ def test_simple_paypage
370
370
  hash = {
371
371
  'merchantId' => '101',
372
372
  'version'=>'8.8',
@@ -384,7 +384,7 @@ class TestXmlfields < Test::Unit::TestCase
384
384
  assert_equal('Valid Format', response.message)
385
385
  end
386
386
 
387
- def test_paypagemissingexpDatandvalidNum
387
+ def test_paypage_missing_exp_dat_and_valid_num
388
388
  hash = {
389
389
  'merchantId' => '101',
390
390
  'version'=>'8.8',
@@ -150,7 +150,7 @@ class Newtest < Test::Unit::TestCase
150
150
  response = LitleOnlineRequest.new.sale(hash)
151
151
  end
152
152
 
153
- def test_capture_amountUnsetShouldNotBeInXML
153
+ def test_capture_amount_unset_should_not_be_in_xml
154
154
  Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
155
155
  hash={
156
156
  'id' => '006',
@@ -164,7 +164,7 @@ class Newtest < Test::Unit::TestCase
164
164
  response = LitleOnlineRequest.new.capture(hash)
165
165
  end
166
166
 
167
- def test_force_capture_amountUnsetShouldNotBeInXML
167
+ def test_force_capture_amount_unset_should_not_be_in_xml
168
168
  Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
169
169
  hash={
170
170
  'id' => '006',
@@ -177,7 +177,7 @@ class Newtest < Test::Unit::TestCase
177
177
  Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
178
178
  XMLObject.expects(:new)
179
179
 
180
- response = LitleOnlineRequest.new.forceCapture(hash)
180
+ response = LitleOnlineRequest.new.force_capture(hash)
181
181
  end
182
182
 
183
183
  def test_amount_is_not_required_in_echeck_credit
@@ -193,7 +193,7 @@ class Newtest < Test::Unit::TestCase
193
193
  Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
194
194
  XMLObject.expects(:new)
195
195
 
196
- response = LitleOnlineRequest.new.echeckCredit(hash)
196
+ response = LitleOnlineRequest.new.echeck_credit(hash)
197
197
  end
198
198
 
199
199
  def test_amount_is_not_required_in_echeck_sale
@@ -209,7 +209,7 @@ class Newtest < Test::Unit::TestCase
209
209
  Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
210
210
  XMLObject.expects(:new)
211
211
 
212
- response = LitleOnlineRequest.new.echeckSale(hash)
212
+ response = LitleOnlineRequest.new.echeck_sale(hash)
213
213
  end
214
214
 
215
215
  def test_choice_between_card_token
@@ -227,22 +227,31 @@ class Newtest < Test::Unit::TestCase
227
227
  'number' => '1111222233334444'
228
228
  }
229
229
  }
230
- token_only = {
231
- 'token'=> {
232
- 'litleToken' => '1111222233334444'
233
- }
234
- }
235
230
 
236
231
  XMLObject.expects(:new)
237
- Communications.expects(:http_post).with(regexp_matches(/.*card.*/m))
238
- Communications.expects(:http_post).with(Not(regexp_matches(/.*token.*/m)),kind_of(Hash))
232
+ Communications.expects(:http_post).with(regexp_matches(/.*card.*/m),kind_of(Hash))
239
233
  LitleOnlineRequest.new.authorization(start_hash.merge(card_only))
240
-
241
- XMLObject.expects(:new)
242
- Communications.expects(:http_post).with(regexp_matches(/.*token.*/m))
243
- Communications.expects(:http_post).with(Not(regexp_matches(/.*card.*/m)),kind_of(Hash))
244
- LitleOnlineRequest.new.authorization(start_hash.merge(token_only))
245
234
  end
235
+
236
+ def test_choice_between_card_token2
237
+ start_hash = {
238
+ 'orderId'=>'12344',
239
+ 'merchantId'=>'101',
240
+ 'reportGroup'=>'Planets',
241
+ 'amount'=>'101',
242
+ 'orderSource'=>'ecommerce'
243
+ }
244
+
245
+ token_only = {
246
+ 'token'=> {
247
+ 'litleToken' => '1111222233334444'
248
+ }
249
+ }
250
+
251
+ XMLObject.expects(:new)
252
+ Communications.expects(:http_post).with(regexp_matches(/.*token.*/m),kind_of(Hash))
253
+ LitleOnlineRequest.new.authorization(start_hash.merge(token_only))
254
+ end
246
255
 
247
256
  def test_orderId_required
248
257
  start_hash = {