killbill 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.10
1
+ 1.0.11
@@ -118,6 +118,11 @@ module Killbill
118
118
  end
119
119
 
120
120
  def wrap_and_throw_exception(api, e)
121
+ message = "#{api} failure: #{e}"
122
+ unless e.backtrace.nil?
123
+ message = "#{message}\n#{e.backtrace.join("\n")}"
124
+ end
125
+ logger.warn message
121
126
  raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("#{api} failure", e.message)
122
127
  end
123
128
 
@@ -130,8 +135,8 @@ module Killbill
130
135
  JConverter.from_uuid(a)
131
136
  elsif a.java_kind_of? java.math.BigDecimal
132
137
  JConverter.from_big_decimal(a)
133
- elsif a.get_class.is_enum
134
- a.nil? ? '' : a.to_string
138
+ elsif a.java_kind_of? Java::com.ning.billing.catalog.api.Currency
139
+ a.to_string
135
140
  elsif a.java_kind_of? Java::com.ning.billing.payment.api.PaymentMethodPlugin
136
141
  JConverter.from_payment_method_plugin(a)
137
142
  elsif ((a.java_kind_of? Java::boolean) || (a.java_kind_of? java.lang.Boolean))
@@ -1,7 +1,6 @@
1
1
  require 'pathname'
2
2
 
3
3
  require 'killbill/http_servlet'
4
- require 'killbill/logger'
5
4
  require 'killbill/creator'
6
5
 
7
6
  module Killbill
@@ -37,16 +36,20 @@ module Killbill
37
36
  def rack_handler
38
37
  config_ru = Pathname.new("#{@delegate_plugin.root}/config.ru").expand_path
39
38
  if config_ru.file?
40
- @delegate_plugin.logger.info "Found Rack configuration file at #{config_ru.to_s}"
39
+ logger.info "Found Rack configuration file at #{config_ru.to_s}"
41
40
  instance = Killbill::Plugin::RackHandler.instance
42
- instance.configure(@logger, config_ru.to_s) unless instance.configured?
41
+ instance.configure(logger, config_ru.to_s) unless instance.configured?
43
42
  instance
44
43
  else
45
- @delegate_plugin.logger.info "No Rack configuration file found at #{config_ru.to_s}"
44
+ logger.info "No Rack configuration file found at #{config_ru.to_s}"
46
45
  nil
47
46
  end
48
47
  end
49
48
 
49
+ def logger
50
+ require 'logger'
51
+ @delegate_plugin.nil? ? ::Logger.new(STDOUT) : @delegate_plugin.logger
52
+ end
50
53
  end
51
54
  end
52
55
  end
@@ -1,7 +1,7 @@
1
1
  # Plugin logger that will delegate to the OSGI LogService
2
2
  module Killbill
3
3
  module Plugin
4
- class Logger
4
+ class KillbillLogger
5
5
  def initialize(delegate)
6
6
  @logger = delegate
7
7
  end
@@ -1,4 +1,4 @@
1
- require 'killbill/logger'
1
+ require 'killbill/killbill_logger'
2
2
 
3
3
  module Killbill
4
4
  # There are various types of plugins one can write for Killbill:
@@ -61,7 +61,7 @@ module Killbill
61
61
  def logger=(logger)
62
62
  # logger is an OSGI LogService in the Killbill environment. For testing purposes,
63
63
  # allow delegation to a standard logger
64
- @logger = logger.respond_to?(:info) ? logger : Killbill::Plugin::Logger.new(logger)
64
+ @logger = logger.respond_to?(:info) ? logger : Killbill::Plugin::KillbillLogger.new(logger)
65
65
  end
66
66
 
67
67
  def logger
@@ -11,6 +11,7 @@ describe Killbill::Plugin::JPayment do
11
11
  @kb_payment_method_id = java.util.UUID.fromString("bf5c926e-3d9c-470e-b34b-719d7b58323a")
12
12
  @payment_method_plugin = nil
13
13
  @amount = java.math.BigDecimal.new("50")
14
+ @currency = Java::com.ning.billing.catalog.api.Currency::USD
14
15
  end
15
16
 
16
17
  before(:each) do
@@ -18,7 +19,7 @@ describe Killbill::Plugin::JPayment do
18
19
  end
19
20
 
20
21
  it "should_test_charge_ok" do
21
- output = @jpayment.process_payment(@kb_payment_id, @kb_payment_method_id, @amount)
22
+ output = @jpayment.process_payment(@kb_account_id, @kb_payment_id, @kb_payment_method_id, @amount, @currency)
22
23
  output.get_amount.should be_an_instance_of java.math.BigDecimal
23
24
  output.get_amount.to_s.should == "50.00";
24
25
  output.get_status.should be_an_instance_of Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus
@@ -27,11 +28,11 @@ describe Killbill::Plugin::JPayment do
27
28
 
28
29
  it "should_test_charge_exception" do
29
30
  @jpayment.delegate_plugin.send(:raise_exception_on_next_calls)
30
- lambda { @jpayment.process_payment(@kb_payment_id, @kb_payment_method_id, @amount) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
31
+ lambda { @jpayment.process_payment(@kb_account_id, @kb_payment_id, @kb_payment_method_id, @amount, @currency) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
31
32
  end
32
33
 
33
34
  it "should_test_get_payment_info_ok" do
34
- output = @jpayment.get_payment_info(@kb_payment_method_id)
35
+ output = @jpayment.get_payment_info(@kb_account_id, @kb_payment_method_id)
35
36
  output.get_amount.should be_an_instance_of java.math.BigDecimal
36
37
  output.get_amount.to_s.should == "0.00";
37
38
  output.get_status.should be_an_instance_of Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus
@@ -40,11 +41,11 @@ describe Killbill::Plugin::JPayment do
40
41
 
41
42
  it "should_test_get_payment_info_exception" do
42
43
  @jpayment.delegate_plugin.send(:raise_exception_on_next_calls)
43
- lambda { @jpayment.get_payment_info(@kb_payment_method_id) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
44
+ lambda { @jpayment.get_payment_info(@kb_account_id, @kb_payment_method_id) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
44
45
  end
45
46
 
46
47
  it "should_test_refund_ok" do
47
- output = @jpayment.process_refund(@kb_payment_method_id, @amount)
48
+ output = @jpayment.process_refund(@kb_account_id, @kb_payment_method_id, @amount, @currency)
48
49
  output.get_amount.should be_an_instance_of java.math.BigDecimal
49
50
  output.get_amount.to_s.should == "50.00";
50
51
  output.get_status.should be_an_instance_of Java::com.ning.billing.payment.plugin.api.RefundInfoPlugin::RefundPluginStatus
@@ -53,7 +54,7 @@ describe Killbill::Plugin::JPayment do
53
54
 
54
55
  it "should_test_refund_exception" do
55
56
  @jpayment.delegate_plugin.send(:raise_exception_on_next_calls)
56
- lambda { @jpayment.process_refund(@kb_payment_method_id, @amount) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
57
+ lambda { @jpayment.process_refund(@kb_account_id, @kb_payment_method_id, @amount, @currency) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
57
58
  end
58
59
 
59
60
  it "should_test_add_payment_method_ok" do
@@ -65,14 +66,13 @@ describe Killbill::Plugin::JPayment do
65
66
  lambda { @jpayment.add_payment_method(@kb_account_id, @kb_payment_method_id, @payment_method_plugin, true) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
66
67
  end
67
68
 
68
-
69
69
  it "should_test_delete_payment_method_ok" do
70
- @jpayment.delete_payment_method(@kb_payment_method_id)
70
+ @jpayment.delete_payment_method(@kb_account_id, @kb_payment_method_id)
71
71
  end
72
72
 
73
73
  it "should_test_delete_payment_method_exception" do
74
74
  @jpayment.delegate_plugin.send(:raise_exception_on_next_calls)
75
- lambda { @jpayment.delete_payment_method(@kb_payment_method_id) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
75
+ lambda { @jpayment.delete_payment_method(@kb_account_id, @kb_payment_method_id) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
76
76
  end
77
77
 
78
78
  it "should_test_get_payment_method_detail_ok" do
@@ -87,12 +87,12 @@ describe Killbill::Plugin::JPayment do
87
87
  end
88
88
 
89
89
  it "should_test_set_default_payment_method_ok" do
90
- @jpayment.set_default_payment_method(@kb_payment_method_id)
90
+ @jpayment.set_default_payment_method(@kb_account_id, @kb_payment_method_id)
91
91
  end
92
92
 
93
93
  it "should_test_set_default_payment_method_exception" do
94
94
  @jpayment.delegate_plugin.send(:raise_exception_on_next_calls)
95
- lambda { @jpayment.set_default_payment_method(@kb_payment_method_id) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
95
+ lambda { @jpayment.set_default_payment_method(@kb_account_id, @kb_payment_method_id) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
96
96
  end
97
97
 
98
98
  it "should_get_payment_methods_ok" do
@@ -104,17 +104,18 @@ describe Killbill::Plugin::JPayment do
104
104
  current_payment_method = output.get(0)
105
105
  current_payment_method.get_account_id.to_s.should == @kb_account_id.to_s
106
106
  end
107
+
107
108
  it "should_get_payment_methods_exception" do
108
109
  @jpayment.delegate_plugin.send(:raise_exception_on_next_calls)
109
110
  lambda { @jpayment.get_payment_methods(@kb_account_id, true) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
110
111
  end
111
112
 
112
113
  it "should_test_reset_payment_methods_ok" do
113
- @jpayment.reset_payment_methods(java.util.ArrayList.new)
114
+ @jpayment.reset_payment_methods(@kb_account_id, java.util.ArrayList.new)
114
115
  end
115
116
 
116
117
  it "should_test_reset_payment_methods_exception" do
117
118
  @jpayment.delegate_plugin.send(:raise_exception_on_next_calls)
118
- lambda { @jpayment.reset_payment_methods(java.util.ArrayList.new) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
119
+ lambda { @jpayment.reset_payment_methods(@kb_account_id, java.util.ArrayList.new) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
119
120
  end
120
121
  end
@@ -11,7 +11,7 @@ module Killbill
11
11
  def get_name
12
12
  end
13
13
 
14
- def process_payment(kb_payment_id, kb_payment_method_id, amount_in_cents, options = {})
14
+ def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id, amount_in_cents, currency, options = {})
15
15
  if @raise_exception
16
16
  raise StandardError.new("Test exception")
17
17
  else
@@ -19,7 +19,7 @@ module Killbill
19
19
  end
20
20
  end
21
21
 
22
- def get_payment_info(kb_payment_id, options = {})
22
+ def get_payment_info(kb_account_id, kb_payment_id, options = {})
23
23
  if @raise_exception
24
24
  raise StandardError.new("Test exception")
25
25
  else
@@ -27,7 +27,7 @@ module Killbill
27
27
  end
28
28
  end
29
29
 
30
- def process_refund(kb_payment_id, amount_in_cents, options = {})
30
+ def process_refund(kb_account_id, kb_payment_id, amount_in_cents, currency, options = {})
31
31
  if @raise_exception
32
32
  raise StandardError.new("Test exception")
33
33
  else
@@ -41,7 +41,7 @@ module Killbill
41
41
  end
42
42
  end
43
43
 
44
- def delete_payment_method(kb_payment_method_id, options = {})
44
+ def delete_payment_method(kb_account_id, kb_payment_method_id, options = {})
45
45
  if @raise_exception
46
46
  raise StandardError.new("Test exception")
47
47
  end
@@ -55,7 +55,7 @@ module Killbill
55
55
  end
56
56
  end
57
57
 
58
- def set_default_payment_method(kb_payment_method_id, options = {})
58
+ def set_default_payment_method(kb_account_id, kb_payment_method_id, options = {})
59
59
  if @raise_exception
60
60
  raise StandardError.new("Test exception")
61
61
  end
@@ -69,7 +69,7 @@ module Killbill
69
69
  end
70
70
  end
71
71
 
72
- def reset_payment_methods(payment_methods)
72
+ def reset_payment_methods(kb_account_id, payment_methods)
73
73
  if @raise_exception
74
74
  raise StandardError.new("Test exception")
75
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -115,7 +115,7 @@ files:
115
115
  - lib/killbill/jresponse/jpayment_method_response_internal.rb
116
116
  - lib/killbill/jresponse/jpayment_response.rb
117
117
  - lib/killbill/jresponse/jrefund_response.rb
118
- - lib/killbill/logger.rb
118
+ - lib/killbill/killbill_logger.rb
119
119
  - lib/killbill/notification.rb
120
120
  - lib/killbill/payment.rb
121
121
  - lib/killbill/plugin.rb