killbill 7.0.2 → 7.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00abb7d62cbbd3b1acc310c30aa019e49b77d97b
4
- data.tar.gz: 24147e06c6b475e35445ff4e6d4ff2854adc22ef
3
+ metadata.gz: 0af413a5183714f9c7cda0b9c2ec1c4240397593
4
+ data.tar.gz: 128972b51281d32b3bb1cc9bc4b88887ba7efe36
5
5
  SHA512:
6
- metadata.gz: 8dea0afb1b1749936bd9571c4b033b67ad5832d98dcafaa0ef67763c13a66a0881115d6a15cfa98f4249ac279d3b5ab6b286451dca9454edf2835229562e544c
7
- data.tar.gz: 50d34ba943202a7de31eaa8f2576825bc16da05625a6cb1a819f5b835d42ab95f1eec044a9d97c762229ef7a5a39df73943552d51314d4df7a008ca8e8392464
6
+ metadata.gz: fc0116cb6ac588e04ae7c4c365ab51d8e24cb04660a505c178c32fab49b82636ae5d22ce9a3e075818df6c312540bc82409c3c410765e68d907ac13071248f3b
7
+ data.tar.gz: 507a28b987997ae0c05296400997678606d3a73193b7a510a5fe9f2cf0ef7df2fb820b0d9d17b24a07e6ce1b0fc639bdd2cf002f15ecbb29dc40d8f3171ef95b
data/.travis.yml CHANGED
@@ -39,6 +39,7 @@ jdk:
39
39
  matrix:
40
40
  allow_failures:
41
41
  - rvm: jruby-head
42
+ - rvm: jruby-20mode # Gemfile.lock bug with --deployment?
42
43
  - jdk: oraclejdk8
43
44
  - gemfile: Gemfile.head
44
45
  fast_finish: true
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- killbill (7.0.2)
4
+ killbill (7.0.3)
5
5
  rack (>= 1.5.2)
6
6
  sinatra (~> 1.3.4)
7
7
  typhoeus (~> 0.6.9)
@@ -10,13 +10,13 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actionpack (4.1.14)
14
- actionview (= 4.1.14)
15
- activesupport (= 4.1.14)
13
+ actionpack (4.1.15)
14
+ actionview (= 4.1.15)
15
+ activesupport (= 4.1.15)
16
16
  rack (~> 1.5.2)
17
17
  rack-test (~> 0.6.2)
18
- actionview (4.1.14)
19
- activesupport (= 4.1.14)
18
+ actionview (4.1.15)
19
+ activesupport (= 4.1.15)
20
20
  builder (~> 3.1)
21
21
  erubis (~> 2.7.0)
22
22
  active_utils (3.0.0)
@@ -27,17 +27,17 @@ GEM
27
27
  builder (>= 2.1.2, < 4.0.0)
28
28
  i18n (>= 0.6.9)
29
29
  nokogiri (~> 1.4)
30
- activemodel (4.1.14)
31
- activesupport (= 4.1.14)
30
+ activemodel (4.1.15)
31
+ activesupport (= 4.1.15)
32
32
  builder (~> 3.1)
33
- activerecord (4.1.14)
34
- activemodel (= 4.1.14)
35
- activesupport (= 4.1.14)
33
+ activerecord (4.1.15)
34
+ activemodel (= 4.1.15)
35
+ activesupport (= 4.1.15)
36
36
  arel (~> 5.0.0)
37
37
  activerecord-bogacs (0.4.1)
38
- activerecord-jdbc-adapter (1.3.19)
38
+ activerecord-jdbc-adapter (1.3.20)
39
39
  activerecord (>= 2.2)
40
- activesupport (4.1.14)
40
+ activesupport (4.1.15)
41
41
  i18n (~> 0.6, >= 0.6.9)
42
42
  json (~> 1.7, >= 1.7.7)
43
43
  minitest (~> 5.1)
@@ -60,8 +60,8 @@ GEM
60
60
  ffi (>= 1.3.0)
61
61
  ffi (1.9.10-java)
62
62
  i18n (0.7.0)
63
- ice_nine (0.11.1)
64
- jar-dependencies (0.3.1)
63
+ ice_nine (0.11.2)
64
+ jar-dependencies (0.3.2)
65
65
  jbundler (0.9.2)
66
66
  bundler (~> 1.5)
67
67
  jar-dependencies (~> 0.2)
@@ -72,12 +72,12 @@ GEM
72
72
  json (1.8.3-java)
73
73
  maven-tools (1.0.13)
74
74
  virtus (~> 1.0)
75
- minitest (5.8.3)
75
+ minitest (5.8.4)
76
76
  monetize (1.1.0)
77
77
  money (~> 6.5.0)
78
78
  money (6.5.1)
79
79
  i18n (>= 0.6.4, <= 0.7.0)
80
- nokogiri (1.6.7.1-java)
80
+ nokogiri (1.6.7.2-java)
81
81
  offsite_payments (2.1.0)
82
82
  actionpack (>= 3.2.20, < 5.0.0)
83
83
  active_utils (~> 3.0.0)
@@ -91,7 +91,7 @@ GEM
91
91
  rack
92
92
  rack-test (0.6.3)
93
93
  rack (>= 1.0)
94
- rake (10.4.2)
94
+ rake (10.5.0)
95
95
  rspec (2.12.0)
96
96
  rspec-core (~> 2.12.0)
97
97
  rspec-expectations (~> 2.12.0)
@@ -100,7 +100,7 @@ GEM
100
100
  rspec-expectations (2.12.1)
101
101
  diff-lcs (~> 1.1.3)
102
102
  rspec-mocks (2.12.2)
103
- ruby-maven (3.3.8)
103
+ ruby-maven (3.3.10)
104
104
  ruby-maven-libs (~> 3.3.1)
105
105
  ruby-maven-libs (3.3.3)
106
106
  sinatra (1.3.6)
@@ -137,10 +137,10 @@ DEPENDENCIES
137
137
  monetize (~> 1.1.0)
138
138
  money (~> 6.5.1)
139
139
  offsite_payments (~> 2.1.0)
140
- rake (>= 10.0.0)
140
+ rake (>= 10.0.0, < 11.0.0)
141
141
  rspec (~> 2.12.0)
142
142
  thor (~> 0.19.1)
143
143
  thread_safe (~> 0.3.4)
144
144
 
145
145
  BUNDLED WITH
146
- 1.10.6
146
+ 1.11.2
data/NEWS CHANGED
@@ -1,3 +1,9 @@
1
+ 7.0.3
2
+ Java API: set default dates in context to now()
3
+ Expose the underlying object from LazyEvaluator
4
+ https://github.com/killbill/killbill-plugin-framework-ruby/issues/53
5
+ Introduce Utils.normalize_property
6
+
1
7
  7.0.2
2
8
  Handle blank tokens
3
9
 
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
41
41
  s.add_dependency 'money', '~> 6.5.1'
42
42
 
43
43
  s.add_development_dependency 'jbundler', '~> 0.9.2'
44
- s.add_development_dependency 'rake', '>= 10.0.0'
44
+ s.add_development_dependency 'rake', '>= 10.0.0', '< 11.0.0'
45
45
  s.add_development_dependency 'rspec', '~> 2.12.0'
46
46
  if defined?(JRUBY_VERSION)
47
47
  s.add_development_dependency 'jdbc-sqlite3', '~> 3.7'
data/killbill.gemspec CHANGED
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
46
46
  s.add_development_dependency 'money', '~> 6.5.1'
47
47
  # testing/development :
48
48
  s.add_development_dependency 'jbundler', '~> 0.9.2'
49
- s.add_development_dependency 'rake', '>= 10.0.0'
49
+ s.add_development_dependency 'rake', '>= 10.0.0', '< 11.0.0'
50
50
  s.add_development_dependency 'rspec', '~> 2.12.0'
51
51
  s.add_development_dependency 'thor', '~> 0.19.1'
52
52
  if defined?(JRUBY_VERSION)
@@ -20,7 +20,7 @@ module Killbill
20
20
  where(:kb_payment_id => kb_payment_id, :kb_tenant_id => kb_tenant_id).order(:created_at)
21
21
  end
22
22
 
23
- [:authorize, :capture, :purchase, :credit, :refund].each do |transaction_type|
23
+ [:authorize, :capture, :purchase, :credit, :refund, :void].each do |transaction_type|
24
24
  define_method("#{transaction_type.to_s}s_from_kb_payment_id") do |kb_payment_id, kb_tenant_id|
25
25
  transaction_from_kb_payment_id(transaction_type.to_s.upcase, kb_payment_id, kb_tenant_id, :multiple)
26
26
  end
@@ -29,20 +29,30 @@ module Killbill
29
29
  # For convenience
30
30
  alias_method :authorizations_from_kb_payment_id, :authorizes_from_kb_payment_id
31
31
 
32
- # For convenience
33
- def voids_from_kb_payment_id(kb_payment_id, kb_tenant_id)
34
- [void_from_kb_payment_id(kb_payment_id, kb_tenant_id)]
35
- end
36
-
37
- # void is special: unique void per payment_id
38
- def void_from_kb_payment_id(kb_payment_id, kb_tenant_id)
39
- transaction_from_kb_payment_id(:VOID, kb_payment_id, kb_tenant_id, :single)
40
- end
41
-
42
32
  def from_kb_payment_transaction_id(kb_payment_transaction_id, kb_tenant_id)
43
33
  transaction_from_kb_payment_transaction_id(nil, kb_payment_transaction_id, kb_tenant_id, :single)
44
34
  end
45
35
 
36
+ def find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id, linked_transaction_type = nil)
37
+ # Default behavior to search for the last voidable transaction
38
+ # If an authorization is being voided, we're performing an 'auth_reversal', otherwise,
39
+ # we're voiding an unsettled capture or purchase (which often needs to happen within 24 hours).
40
+ transactions = transaction_from_kb_payment_id(nil, kb_payment_id, kb_tenant_id, :multiple).to_a
41
+ tx_to_void = 0
42
+ transactions.reverse.each do |t|
43
+ if t.transaction_type == 'VOID'
44
+ tx_to_void += 1
45
+ else
46
+ if tx_to_void > 0
47
+ tx_to_void -= 1
48
+ elsif linked_transaction_type.nil? || t.transaction_type.downcase == linked_transaction_type.to_s.downcase
49
+ return t
50
+ end
51
+ end
52
+ end
53
+ nil
54
+ end
55
+
46
56
  def find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id, transaction_type = nil)
47
57
  if transaction_type.nil?
48
58
  find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id, :AUTHORIZE) || find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id, :PURCHASE)
@@ -91,24 +91,7 @@ module Killbill
91
91
 
92
92
  linked_transaction_proc = Proc.new do |amount_in_cents, options|
93
93
  linked_transaction_type = find_value_from_properties(properties, :linked_transaction_type)
94
- if linked_transaction_type.nil?
95
- # Default behavior to search for the last transaction
96
- # If an authorization is being voided, we're performing an 'auth_reversal', otherwise,
97
- # we're voiding an unsettled capture or purchase (which often needs to happen within 24 hours).
98
- last_transaction = @transaction_model.purchases_from_kb_payment_id(kb_payment_id, context.tenant_id).last
99
- if last_transaction.nil?
100
- last_transaction = @transaction_model.captures_from_kb_payment_id(kb_payment_id, context.tenant_id).last
101
- if last_transaction.nil?
102
- last_transaction = @transaction_model.authorizations_from_kb_payment_id(kb_payment_id, context.tenant_id).last
103
- if last_transaction.nil?
104
- raise ArgumentError.new("Kill Bill payment #{kb_payment_id} has no auth, capture or purchase, thus cannot be voided")
105
- end
106
- end
107
- end
108
- else
109
- last_transaction = @transaction_model.send("#{linked_transaction_type.to_s}s_from_kb_payment_id", kb_payment_id, context.tenant_id).last
110
- end
111
- last_transaction
94
+ @transaction_model.find_candidate_transaction_for_void(kb_payment_id, context.tenant_id, linked_transaction_type)
112
95
  end
113
96
 
114
97
  dispatch_to_gateways(:void, kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, nil, nil, properties, context, gateway_call_proc, linked_transaction_proc)
@@ -58,6 +58,17 @@ module Killbill
58
58
  end
59
59
  end
60
60
 
61
+ def self.normalize_property(properties, key)
62
+ return if key.nil?
63
+
64
+ (properties || []).each do |property|
65
+ # Be friendly with Java-style conventions
66
+ if property.key == key || property.key == key.to_s.camelize(false)
67
+ property.value = normalize(property.value)
68
+ end
69
+ end
70
+ end
71
+
61
72
  class KBWiredumpDevice < IO
62
73
 
63
74
  # Required for compatibility, but unused
@@ -85,8 +96,6 @@ module Killbill
85
96
  __instance_object__.send(method, *args)
86
97
  end
87
98
 
88
- private
89
-
90
99
  def __instance_object__
91
100
  @__instance_object__ ||= @instantiator.call
92
101
  end
@@ -37,8 +37,8 @@ module Killbill
37
37
  context.user_type= :SYSTEM
38
38
  context.reason_code= reason_code
39
39
  context.comments= comments
40
- context.created_date= DateTime.new
41
- context.updated_date= DateTime.new
40
+ context.created_date= DateTime.now.new_offset(0)
41
+ context.updated_date= context.created_date
42
42
  context
43
43
  end
44
44
 
@@ -1,3 +1,3 @@
1
1
  module Killbill
2
- VERSION = '7.0.2'
2
+ VERSION = '7.0.3'
3
3
  end
@@ -21,4 +21,10 @@ describe Killbill::Plugin::ActiveMerchant::RSpec do
21
21
 
22
22
  (props3.find { |p| p.key == :foo }).value.should == :bar
23
23
  end
24
+
25
+ it 'should build test contexts in Ruby' do
26
+ call_context = build_call_context('12345')
27
+ call_context.tenant_id.should == '12345'
28
+ call_context.created_date.should be_nil
29
+ end
24
30
  end
@@ -114,6 +114,27 @@ describe Killbill::Plugin::ActiveMerchant::PaymentPlugin do
114
114
  plugin.get_payment_methods(@kb_account_id, true, @properties, @call_context).size.should == 0
115
115
  end
116
116
 
117
+ # https://github.com/killbill/killbill-plugin-framework-ruby/issues/53
118
+ it 'supports multiple voids' do
119
+ ptip = trigger_auth(@properties)
120
+ verify_auth_status(ptip, :PROCESSED)
121
+
122
+ ptip = trigger_capture(@properties)
123
+ verify_capture_status(ptip, :PROCESSED)
124
+
125
+ ptip = trigger_void(@properties)
126
+ verify_void_status(ptip, :PROCESSED)
127
+
128
+ ptip = trigger_capture(@properties)
129
+ verify_capture_status(ptip, :PROCESSED)
130
+
131
+ ptip = trigger_void(@properties)
132
+ verify_void_status(ptip, :PROCESSED)
133
+
134
+ ptip = trigger_void(@properties)
135
+ verify_void_status(ptip, :PROCESSED)
136
+ end
137
+
117
138
  # https://github.com/killbill/killbill-plugin-framework-ruby/issues/51
118
139
  it 'supports multiple refunds regardless of the amount against auth' do
119
140
  ptip = trigger_auth(@properties)
@@ -528,6 +549,10 @@ describe Killbill::Plugin::ActiveMerchant::PaymentPlugin do
528
549
  plugin.authorize_payment(@kb_account_id, @kb_payment_id, kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, auth_properties, @call_context)
529
550
  end
530
551
 
552
+ def trigger_void(void_properties=[], kb_payment_transaction_id=SecureRandom.uuid)
553
+ plugin.void_payment(@kb_account_id, @kb_payment_id, kb_payment_transaction_id, @kb_payment_method_id, void_properties, @call_context)
554
+ end
555
+
531
556
  def trigger_capture(capture_properties=[], kb_payment_transaction_id=SecureRandom.uuid)
532
557
  plugin.capture_payment(@kb_account_id, @kb_payment_id, kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, capture_properties, @call_context)
533
558
  end
@@ -548,6 +573,10 @@ describe Killbill::Plugin::ActiveMerchant::PaymentPlugin do
548
573
  verify_transaction_status(t_info_plugin, status, :AUTHORIZE)
549
574
  end
550
575
 
576
+ def verify_void_status(t_info_plugin, status)
577
+ verify_transaction_status(t_info_plugin, status, :VOID)
578
+ end
579
+
551
580
  def verify_capture_status(t_info_plugin, status)
552
581
  verify_transaction_status(t_info_plugin, status, :CAPTURE)
553
582
  end
@@ -28,6 +28,51 @@ describe Killbill::Plugin::ActiveMerchant::ActiveRecord::Transaction do
28
28
  ::Killbill::Test::TestTransaction.find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id).id.should == auth_tx.id
29
29
  end
30
30
 
31
+ # https://github.com/killbill/killbill-plugin-framework-ruby/issues/53
32
+ it 'finds the right transaction to void' do
33
+ api_call = 'for debugging only'
34
+ amount_in_cents = 1242
35
+ currency = :USD
36
+ kb_account_id = SecureRandom.uuid
37
+ kb_tenant_id = SecureRandom.uuid
38
+ kb_payment_id = SecureRandom.uuid
39
+
40
+ auth_tx = create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :AUTHORIZE, amount_in_cents, currency, kb_account_id, kb_tenant_id)
41
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id).id.should == auth_tx.id
42
+
43
+ capture_tx1 = create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :CAPTURE, amount_in_cents, currency, kb_account_id, kb_tenant_id)
44
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id).id.should == capture_tx1.id
45
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id, :AUTHORIZE).id.should == auth_tx.id
46
+
47
+ # Void the first capture
48
+ create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :VOID, nil, nil, kb_account_id, kb_tenant_id)
49
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id).id.should == auth_tx.id
50
+
51
+ capture_tx2 = create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :CAPTURE, amount_in_cents, currency, kb_account_id, kb_tenant_id)
52
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id).id.should == capture_tx2.id
53
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id, :CAPTURE).id.should == capture_tx2.id
54
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id, :AUTHORIZE).id.should == auth_tx.id
55
+
56
+ capture_tx3 = create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :CAPTURE, amount_in_cents, currency, kb_account_id, kb_tenant_id)
57
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id).id.should == capture_tx3.id
58
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id, :CAPTURE).id.should == capture_tx3.id
59
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id, :AUTHORIZE).id.should == auth_tx.id
60
+
61
+ # Void the third capture
62
+ create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :VOID, nil, nil, kb_account_id, kb_tenant_id)
63
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id).id.should == capture_tx2.id
64
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id, :CAPTURE).id.should == capture_tx2.id
65
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id, :AUTHORIZE).id.should == auth_tx.id
66
+
67
+ # Void the second capture
68
+ create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :VOID, nil, nil, kb_account_id, kb_tenant_id)
69
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id).id.should == auth_tx.id
70
+
71
+ # Void the authorization
72
+ create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :VOID, nil, nil, kb_account_id, kb_tenant_id)
73
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_void(kb_payment_id, kb_tenant_id).should be_nil
74
+ end
75
+
31
76
  it 'should store and retrieve transactions correctly' do
32
77
  api_call = 'for debugging only'
33
78
  amount_in_cents = 1242
@@ -95,7 +140,7 @@ describe Killbill::Plugin::ActiveMerchant::ActiveRecord::Transaction do
95
140
  ::Killbill::Test::TestTransaction.refunds_from_kb_payment_id(kb_payment_id1, kb_tenant_id).size.should == 0
96
141
 
97
142
  # Lookup VOID for kb_payment_id1
98
- ::Killbill::Test::TestTransaction.void_from_kb_payment_id(kb_payment_id1, kb_tenant_id).should be_nil
143
+ ::Killbill::Test::TestTransaction.voids_from_kb_payment_id(kb_payment_id1, kb_tenant_id).size.should == 0
99
144
 
100
145
  # Lookup AUTH for kb_payment_id2
101
146
  ::Killbill::Test::TestTransaction.authorizes_from_kb_payment_id(kb_payment_id2, kb_tenant_id).size.should == 0
@@ -118,7 +163,7 @@ describe Killbill::Plugin::ActiveMerchant::ActiveRecord::Transaction do
118
163
  ts[0].kb_payment_transaction_id.should == kb_payment_transaction_id5
119
164
 
120
165
  # Lookup VOID for kb_payment_id2
121
- ::Killbill::Test::TestTransaction.void_from_kb_payment_id(kb_payment_id2, kb_tenant_id).should be_nil
166
+ ::Killbill::Test::TestTransaction.voids_from_kb_payment_id(kb_payment_id1, kb_tenant_id).size.should == 0
122
167
 
123
168
  # Lookup individual transactions
124
169
  ::Killbill::Test::TestTransaction.from_kb_payment_transaction_id(kb_payment_transaction_id1, SecureRandom.uuid).should be_nil
@@ -2,6 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe Killbill::Plugin::ActiveMerchant::Utils do
4
4
 
5
+ include ::Killbill::Plugin::PropertiesHelper
6
+
5
7
  context 'UUID' do
6
8
  it 'should convert back and forth UUIDs' do
7
9
  uuid = SecureRandom.uuid
@@ -56,6 +58,25 @@ describe Killbill::Plugin::ActiveMerchant::Utils do
56
58
  ::Killbill::Plugin::ActiveMerchant::Utils.normalized({:cc_first_name => 'Paul'}, :cc_first_name).should == 'Paul'
57
59
  ::Killbill::Plugin::ActiveMerchant::Utils.normalized({:ccFirstName => 'Paul'}, :cc_first_name).should == 'Paul'
58
60
  end
61
+
62
+ it 'normalizes properties' do
63
+ properties = []
64
+ properties << build_property('dontTouch', 'true')
65
+ properties << build_property(:dont_touch, false)
66
+ properties << build_property('changeMe', 'false')
67
+ properties << build_property('dont_touch', 'null')
68
+
69
+ ::Killbill::Plugin::ActiveMerchant::Utils.normalize_property(properties, 'change_me')
70
+
71
+ properties[0].key.should == 'dontTouch'
72
+ properties[0].value.should == 'true'
73
+ properties[1].key.should == :dont_touch
74
+ properties[1].value.should == false
75
+ properties[2].key.should == 'changeMe'
76
+ properties[2].value.should == false
77
+ properties[3].key.should == 'dont_touch'
78
+ properties[3].value.should == 'null'
79
+ end
59
80
  end
60
81
 
61
82
  context 'KBWiredumpDevice' do
@@ -4,8 +4,6 @@ require 'killbill/killbill_api'
4
4
 
5
5
  require 'killbill/gen/api/account_data'
6
6
 
7
-
8
-
9
7
  describe Killbill::Plugin do
10
8
 
11
9
  before(:each) do
@@ -27,7 +25,6 @@ describe Killbill::Plugin do
27
25
  end
28
26
 
29
27
  it 'should test create/get_account_by_id' do
30
-
31
28
  account_user_api = @kb_apis.account_user_api
32
29
  account_created = account_user_api.create_account(@account, @context)
33
30
  account_created.should be_an_instance_of Killbill::Plugin::Model::Account
@@ -48,4 +45,9 @@ describe Killbill::Plugin do
48
45
  account_fetched.time_zone.to_s.should == :UTC.to_s
49
46
  end
50
47
 
48
+ it 'should create contexts' do
49
+ context = @kb_apis.create_context
50
+ # The offset representation will differ (Z vs +00:00)
51
+ context.created_date.iso8601[0..18].should == Time.now.utc.iso8601[0..18]
52
+ end
51
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.2
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-19 00:00:00.000000000 Z
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -241,11 +241,17 @@ dependencies:
241
241
  - - '>='
242
242
  - !ruby/object:Gem::Version
243
243
  version: 10.0.0
244
+ - - <
245
+ - !ruby/object:Gem::Version
246
+ version: 11.0.0
244
247
  requirement: !ruby/object:Gem::Requirement
245
248
  requirements:
246
249
  - - '>='
247
250
  - !ruby/object:Gem::Version
248
251
  version: 10.0.0
252
+ - - <
253
+ - !ruby/object:Gem::Version
254
+ version: 11.0.0
249
255
  prerelease: false
250
256
  type: :development
251
257
  - !ruby/object:Gem::Dependency