LitleOnline 8.17.0 → 8.18.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  = LitleOnline CHANGELOG
2
2
 
3
+ == Version 8.18.0 (July 31, 2013)
4
+ * Feature: Add initial support for Recurring
5
+ * Feature: Add support for Gift Card as a card type (GC)
6
+
3
7
  == Version 8.17.0 (June 13, 2013)
4
8
  * Feature: Batch support - see https://gist.github.com/litleSDK/5687345, https://gist.github.com/litleSDK/5714803 and https://gist.github.com/litleSDK/5714847
5
9
  * Feature: Add support for surcharging credit card transactions
data/DESCRIPTION CHANGED
@@ -1,4 +1,4 @@
1
- Litle Online Ruby SDK created for version 8.17 of Litle XML format, see the XSD schema for specific fields that are supported by this format.
1
+ Litle Online Ruby SDK created for version 8.18 of Litle XML format, see the XSD schema for specific fields that are supported by this format.
2
2
 
3
3
  This gem contains an application interface in the Ruby programming language created by Litle & Co.
4
4
 
data/Rakefile CHANGED
@@ -30,11 +30,11 @@ require 'rake/clean'
30
30
  spec = Gem::Specification.new do |s|
31
31
  FileUtils.rm_rf('pkg')
32
32
  s.name = "LitleOnline"
33
- s.summary = "Ruby SDK produced by Litle & Co. for transaction processing using Litle XML format v8.17"
33
+ s.summary = "Ruby SDK produced by Litle & Co. for transaction processing using Litle XML format v8.18"
34
34
  s.description = File.read(File.join(File.dirname(__FILE__), 'DESCRIPTION'))
35
35
  s.requirements =
36
36
  [ 'Contact sdksupport@litle.com for more information' ]
37
- s.version = "8.17.0"
37
+ s.version = "8.18.0"
38
38
  s.author = "Litle & Co"
39
39
  s.email = "sdksupport@litle.com"
40
40
  s.homepage = "http://www.litle.com/developers"
@@ -149,7 +149,7 @@ module LitleOnline
149
149
 
150
150
  request.authentication = authentication
151
151
  request.merchantId = get_merchant_id(options)
152
- request.version = '8.17'
152
+ request.version = '8.18'
153
153
  request.loggedInUser = get_logged_in_user(options)
154
154
  request.xmlns = "http://www.litle.com/schema"
155
155
  request.merchantSdk = get_merchant_sdk(options)
@@ -180,7 +180,7 @@ module LitleOnline
180
180
  end
181
181
 
182
182
  def get_merchant_sdk(options)
183
- options['merchantSdk'] || 'Ruby;8.17.0'
183
+ options['merchantSdk'] || 'Ruby;8.18.0'
184
184
  end
185
185
 
186
186
  def get_report_group(options)
data/lib/LitleRequest.rb CHANGED
@@ -190,7 +190,7 @@ module LitleOnline
190
190
  litleRequest.authentication = authentication
191
191
  litleRequest.numBatchRequests = "0"
192
192
 
193
- litleRequest.version = '8.17'
193
+ litleRequest.version = '8.18'
194
194
  litleRequest.xmlns = "http://www.litle.com/schema"
195
195
 
196
196
 
@@ -490,7 +490,7 @@ module LitleOnline
490
490
  authentication.password = get_config(:password, options)
491
491
 
492
492
  litle_request.authentication = authentication
493
- litle_request.version = '8.17'
493
+ litle_request.version = '8.18'
494
494
  litle_request.xmlns = "http://www.litle.com/schema"
495
495
  # litle_request.id = options['sessionId'] #grab from options; okay if nil
496
496
  litle_request.numBatchRequests = @num_batch_requests
@@ -48,6 +48,8 @@ module LitleOnline
48
48
  transaction.fraudCheck = FraudCheck.from_hash(options,'fraudCheck')
49
49
  transaction.payPalOrderComplete = options['payPalOrderComplete']
50
50
  transaction.payPalNotes = options['payPalNotes']
51
+ transaction.recurringRequest = RecurringRequest.from_hash(options,'recurringRequest')
52
+ transaction.litleInternalRecurringRequest = LitleInternalRecurringRequest.from_hash(options,'litleInternalRecurringRequest')
51
53
 
52
54
  return transaction
53
55
  end
data/lib/XMLFields.rb CHANGED
@@ -614,7 +614,7 @@ module LitleOnline
614
614
  this.number = base['number']
615
615
  this.expDate = base['expDate']
616
616
  this.cardValidationNum = base['cardValidationNum']
617
- SchemaValidation.validate_enum(this.mop, false, ['','MC','VI','AX','DC','DI','PP','JC','BL','EC'], name, 'type')
617
+ SchemaValidation.validate_enum(this.mop, false, ['','MC','VI','AX','DC','DI','PP','JC','BL','EC','GC'], name, 'type')
618
618
  SchemaValidation.validate_length(this.track, false, 1, 256, name, 'track')
619
619
  SchemaValidation.validate_length(this.number, false, 13, 25, name, 'number')
620
620
  SchemaValidation.validate_length(this.expDate, false, 4, 4, name, 'expDate')
@@ -719,8 +719,8 @@ module LitleOnline
719
719
  class CustomBilling
720
720
  include XML::Mapping
721
721
  optional_choice_node :if, 'phone', :then, (text_node :phone, "phone", :default_value=>nil),
722
- :elsif, 'city', :then, (text_node :city, "city", :default_vaule=>nil),
723
- :elsif, 'url', :then, (text_node :url, "url", :default_vaule=>nil)
722
+ :elsif, 'city', :then, (text_node :city, "city", :default_value=>nil),
723
+ :elsif, 'url', :then, (text_node :url, "url", :default_value=>nil)
724
724
  text_node :descriptor, "descriptor", :default_value=>nil
725
725
  def self.from_hash(hash, name='customBilling')
726
726
  base = hash[name]
@@ -889,6 +889,53 @@ module LitleOnline
889
889
  end
890
890
  end
891
891
 
892
+ class Subscription
893
+ include XML::Mapping
894
+ text_node :planCode, "planCode", :default_value=>nil
895
+ text_node :numberOfPaymentsRemaining, "numberOfPaymentsRemaining", :default_value=>nil
896
+ def self.from_hash(hash, name="subscription")
897
+ base = hash[name]
898
+ if(base)
899
+ this = Subscription.new
900
+ this.planCode = base['planCode']
901
+ this.numberOfPaymentsRemaining = base['numberOfPaymentsRemaining']
902
+ SchemaValidation.validate_length(this.planCode, true, 1, 25, name, 'planCode')
903
+ SchemaValidation.validate_size(this.numberOfPaymentsRemaining, true, 1, 99, name, 'numberOfPaymentsRemaining')
904
+ this
905
+ end
906
+ end
907
+ end
908
+
909
+ class RecurringRequest
910
+ include XML::Mapping
911
+ object_node :subscription, "subscription", :class=>Subscription, :default_value=>nil
912
+ def self.from_hash(hash, name="recurringRequest")
913
+ base = hash[name]
914
+ if(base)
915
+ this = RecurringRequest.new
916
+ this.subscription = Subscription.from_hash(base)
917
+ this
918
+ end
919
+ end
920
+ end
921
+
922
+ class LitleInternalRecurringRequest
923
+ include XML::Mapping
924
+ text_node :subscriptionId, "subscriptionId", :default_value=>nil
925
+ text_node :recurringTxnId, "recurringTxnId", :default_value=>nil
926
+ def self.from_hash(hash, name="litleInternalRecurringRequest")
927
+ base = hash[name]
928
+ if(base)
929
+ this = LitleInternalRecurringRequest.new
930
+ this.subscriptionId = base['subscriptionId']
931
+ this.recurringTxnId = base['recurringTxnId']
932
+ SchemaValidation.validate_length(this.subscriptionId, true, 19, 19, name, "subscriptionId")
933
+ SchemaValidation.validate_length(this.recurringTxnId, true, 19, 19, name, "recurringTxnId")
934
+ this
935
+ end
936
+ end
937
+ end
938
+
892
939
  class Authorization
893
940
  include XML::Mapping
894
941
  root_element_name "authorization"
@@ -960,6 +1007,8 @@ module LitleOnline
960
1007
  object_node :merchantData, "merchantData", :class=>MerchantData, :default_value=>nil
961
1008
  object_node :recyclingRequest, "recyclingRequest", :class=>RecyclingRequest, :default_value=>nil
962
1009
  text_node :fraudFilterOverride, "fraudFilterOverride", :default_value=>nil
1010
+ object_node :recurringRequest, "recurringRequest", :class=>RecurringRequest, :default_value=>nil
1011
+ object_node :litleInternalRecurringRequest, "litleInternalRecurringRequest", :class=>LitleInternalRecurringRequest, :default_value=>nil
963
1012
  end
964
1013
 
965
1014
  class Credit
@@ -1316,4 +1365,4 @@ module LitleOnline
1316
1365
  # class XMLFields
1317
1366
  #
1318
1367
  # end
1319
- end
1368
+ end
@@ -244,7 +244,7 @@ module LitleOnline
244
244
  #Explicit - used for integrations
245
245
  assert_equal 'ActiveMerchant;3.2', litle.send(:get_merchant_sdk, {'merchantSdk'=>'ActiveMerchant;3.2'})
246
246
  #Implicit - used raw when nothing is specified
247
- assert_equal 'Ruby;8.17.0', litle.send(:get_merchant_sdk, {'NotMerchantSdk'=>'ActiveMerchant;3.2'})
247
+ assert_equal 'Ruby;8.18.0', litle.send(:get_merchant_sdk, {'NotMerchantSdk'=>'ActiveMerchant;3.2'})
248
248
  end
249
249
 
250
250
  def test_sale_paypal_order_complete_typo
@@ -274,7 +274,7 @@ module LitleOnline
274
274
  'litleTxnId' => '006'
275
275
  }
276
276
 
277
- Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*version="8\.17".*/m),kind_of(Hash))
277
+ Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*version="8\.18".*/m),kind_of(Hash))
278
278
  XMLObject.expects(:new)
279
279
 
280
280
  response = LitleOnlineRequest.new.void(hash)
@@ -304,6 +304,21 @@ module LitleOnline
304
304
  LitleOnlineRequest.new.authorization(hash)
305
305
  end
306
306
 
307
+ def test_method_of_payment_allows_giftcard
308
+ hash = {
309
+ 'orderId' => '12344',
310
+ 'amount' => '2',
311
+ 'orderSource' => 'ecommerce',
312
+ 'card' => {
313
+ 'number' => '4141000000000000',
314
+ 'expDate' => '1210',
315
+ 'type' => 'GC'
316
+ }
317
+ }
318
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<card><type>GC<\/type><number>4141000000000000<\/number><expDate>1210<\/expDate><\/card>.*/m), is_a(Hash))
319
+ LitleOnlineRequest.new.authorization(hash)
320
+ end
321
+
307
322
  end
308
323
 
309
324
  end
@@ -311,6 +311,80 @@ module LitleOnline
311
311
  LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
312
312
  LitleOnlineRequest.new.sale(hash)
313
313
  end
314
+
315
+ def test_recurringRequest
316
+ hash = {
317
+ 'card'=>{
318
+ 'type'=>'VI',
319
+ 'number'=>'4100000000000001',
320
+ 'expDate'=>'1213',
321
+ },
322
+ 'orderId'=>'12344',
323
+ 'amount'=>'2',
324
+ 'orderSource'=>'ecommerce',
325
+ 'fraudFilterOverride'=>'true',
326
+ 'recurringRequest'=>{
327
+ 'subscription'=>{
328
+ 'planCode'=>'abc123',
329
+ 'numberOfPaymentsRemaining'=>'12'
330
+ }
331
+ }
332
+ }
333
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><recurringRequest><subscription><planCode>abc123<\/planCode><numberOfPaymentsRemaining>12<\/numberOfPaymentsRemaining><\/subscription><\/recurringRequest>.*/m), is_a(Hash))
334
+ LitleOnlineRequest.new.sale(hash)
335
+ end
336
+
337
+ def test_recurringRequest_optional
338
+ hash = {
339
+ 'card'=>{
340
+ 'type'=>'VI',
341
+ 'number'=>'4100000000000001',
342
+ 'expDate'=>'1213',
343
+ },
344
+ 'orderId'=>'12344',
345
+ 'amount'=>'2',
346
+ 'orderSource'=>'ecommerce',
347
+ 'fraudFilterOverride'=>'true',
348
+ }
349
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><\/sale>.*/m), is_a(Hash))
350
+ LitleOnlineRequest.new.sale(hash)
351
+ end
352
+
353
+ def test_litleInternalRecurringRequest
354
+ hash = {
355
+ 'card'=>{
356
+ 'type'=>'VI',
357
+ 'number'=>'4100000000000001',
358
+ 'expDate'=>'1213',
359
+ },
360
+ 'orderId'=>'12344',
361
+ 'amount'=>'2',
362
+ 'orderSource'=>'ecommerce',
363
+ 'fraudFilterOverride'=>'true',
364
+ 'litleInternalRecurringRequest'=>{
365
+ 'subscriptionId'=>'1234567890123456789',
366
+ 'recurringTxnId'=>'1234567890123456789',
367
+ },
368
+ }
369
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><litleInternalRecurringRequest><subscriptionId>1234567890123456789<\/subscriptionId><recurringTxnId>1234567890123456789<\/recurringTxnId><\/litleInternalRecurringRequest>.*/m), is_a(Hash))
370
+ LitleOnlineRequest.new.sale(hash)
371
+ end
372
+
373
+ def test_litleInternalRecurringRequest_optional
374
+ hash = {
375
+ 'card'=>{
376
+ 'type'=>'VI',
377
+ 'number'=>'4100000000000001',
378
+ 'expDate'=>'1213',
379
+ },
380
+ 'orderId'=>'12344',
381
+ 'amount'=>'2',
382
+ 'orderSource'=>'ecommerce',
383
+ 'fraudFilterOverride'=>'true',
384
+ }
385
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><\/sale>.*/m), is_a(Hash))
386
+ LitleOnlineRequest.new.sale(hash)
387
+ end
314
388
 
315
389
  end
316
390
  end
@@ -2002,7 +2002,7 @@ module LitleOnline
2002
2002
  exception = assert_raise(RuntimeError){
2003
2003
  Card.from_hash({ 'card'=>{'type'=>'ZZ' }})
2004
2004
  }
2005
- assert_equal "If card type is specified, it must be in [\"\", \"MC\", \"VI\", \"AX\", \"DC\", \"DI\", \"PP\", \"JC\", \"BL\", \"EC\"]", exception.message
2005
+ assert_equal "If card type is specified, it must be in [\"\", \"MC\", \"VI\", \"AX\", \"DC\", \"DI\", \"PP\", \"JC\", \"BL\", \"EC\", \"GC\"]", exception.message
2006
2006
  end
2007
2007
 
2008
2008
  def test_card_track
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: LitleOnline
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.17.0
4
+ version: 8.18.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-13 00:00:00.000000000 Z
12
+ date: 2013-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-object
16
- requirement: &132509660 !ruby/object:Gem::Requirement
16
+ requirement: &36593220 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *132509660
24
+ version_requirements: *36593220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: xml-mapping
27
- requirement: &132509240 !ruby/object:Gem::Requirement
27
+ requirement: &36592800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *132509240
35
+ version_requirements: *36592800
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: net-sftp
38
- requirement: &132508780 !ruby/object:Gem::Requirement
38
+ requirement: &36592380 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *132508780
46
+ version_requirements: *36592380
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: libxml-ruby
49
- requirement: &132508280 !ruby/object:Gem::Requirement
49
+ requirement: &36657920 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *132508280
57
+ version_requirements: *36657920
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: crack
60
- requirement: &132507860 !ruby/object:Gem::Requirement
60
+ requirement: &36657500 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *132507860
68
+ version_requirements: *36657500
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mocha
71
- requirement: &132507440 !ruby/object:Gem::Requirement
71
+ requirement: &36657080 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,8 +76,8 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *132507440
80
- description: ! 'Litle Online Ruby SDK created for version 8.17 of Litle XML format,
79
+ version_requirements: *36657080
80
+ description: ! 'Litle Online Ruby SDK created for version 8.18 of Litle XML format,
81
81
  see the XSD schema for specific fields that are supported by this format.
82
82
 
83
83
 
@@ -186,6 +186,6 @@ rubygems_version: 1.8.15
186
186
  signing_key:
187
187
  specification_version: 3
188
188
  summary: Ruby SDK produced by Litle & Co. for transaction processing using Litle XML
189
- format v8.17
189
+ format v8.18
190
190
  test_files:
191
191
  - test/unit/ts_unit.rb