killbill 1.0.14 → 1.0.15
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.
- data/VERSION +1 -1
- data/lib/killbill.rb +2 -2
- data/lib/killbill/jnotification.rb +4 -7
- data/lib/killbill/jplugin.rb +9 -5
- data/lib/killbill/jresponse/jevent.rb +3 -1
- data/lib/killbill/notification.rb +1 -0
- data/spec/killbill/jnotification_spec.rb +24 -0
- data/spec/killbill/jresponse/jevent_spec.rb +18 -0
- data/spec/killbill/notification_test.rb +19 -0
- data/spec/spec_helper.rb +1 -0
- metadata +8 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.15
|
data/lib/killbill.rb
CHANGED
@@ -36,12 +36,12 @@ begin
|
|
36
36
|
warn 'Unable to load killbill-api. For development purposes, use JBundler (create the following Jarfile: http://git.io/eobYXA and run: `bundle install && jbundle install\')'
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
40
39
|
# jbundler needs to be loaded first!
|
41
40
|
require 'killbill/jplugin'
|
42
41
|
require 'killbill/jpayment'
|
42
|
+
require 'killbill/jnotification'
|
43
43
|
rescue LoadError => e
|
44
|
-
warn
|
44
|
+
warn "You need JRuby to run Killbill plugins #{e}"
|
45
45
|
end
|
46
46
|
|
47
47
|
require 'killbill/notification'
|
@@ -4,10 +4,7 @@ require 'singleton'
|
|
4
4
|
|
5
5
|
require 'killbill/creator'
|
6
6
|
require 'killbill/plugin'
|
7
|
-
require 'killbill/jresponse/
|
8
|
-
require 'killbill/jresponse/jrefund_response'
|
9
|
-
require 'killbill/jresponse/jpayment_method_response'
|
10
|
-
require 'killbill/jresponse/jpayment_method_response_internal'
|
7
|
+
require 'killbill/jresponse/jevent'
|
11
8
|
|
12
9
|
include Java
|
13
10
|
|
@@ -17,14 +14,14 @@ module Killbill
|
|
17
14
|
java_package 'com.ning.billing.notification.plugin.api'
|
18
15
|
class JNotification < JPlugin
|
19
16
|
|
20
|
-
include
|
17
|
+
include com.ning.billing.notification.plugin.api.NotificationPluginApi
|
21
18
|
|
22
19
|
def initialize(real_class_name, services = {})
|
23
20
|
super(real_class_name, services)
|
24
21
|
end
|
25
22
|
|
26
|
-
java_signature 'void onEvent(Java::com.ning.billing.beatrix.bus.api.ExtBusEvent
|
27
|
-
def on_event(
|
23
|
+
java_signature 'void onEvent(Java::com.ning.billing.beatrix.bus.api.ExtBusEvent)'
|
24
|
+
def on_event(*args)
|
28
25
|
do_call_handle_exception(__method__, *args) do |res|
|
29
26
|
return nil
|
30
27
|
end
|
data/lib/killbill/jplugin.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
require 'java'
|
2
|
+
|
1
3
|
require 'pathname'
|
2
4
|
|
3
5
|
require 'killbill/http_servlet'
|
4
6
|
require 'killbill/creator'
|
5
7
|
|
8
|
+
include Java
|
9
|
+
|
6
10
|
module Killbill
|
7
11
|
# There are various types of plugins one can write for Killbill:
|
8
12
|
#
|
@@ -75,7 +79,7 @@ module Killbill
|
|
75
79
|
end
|
76
80
|
|
77
81
|
def convert_args(api, args)
|
78
|
-
|
82
|
+
args.collect! do |a|
|
79
83
|
if a.nil?
|
80
84
|
nil
|
81
85
|
elsif a.java_kind_of? java.util.UUID
|
@@ -111,11 +115,11 @@ module Killbill
|
|
111
115
|
#raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("#{api} failure", "Unexpected parameter type #{a.class}")
|
112
116
|
nil
|
113
117
|
end
|
114
|
-
end
|
115
|
-
# Remove last argument if this is null (it means we passed a context)
|
116
|
-
args.delete_at(-1) if args[-1].nil?
|
117
|
-
args
|
118
118
|
end
|
119
|
+
# Remove last argument if this is null (it means we passed a context)
|
120
|
+
args.delete_at(-1) if args[-1].nil?
|
121
|
+
args
|
122
|
+
end
|
119
123
|
|
120
124
|
end
|
121
125
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'killbill/jnotification'
|
4
|
+
|
5
|
+
describe Killbill::Plugin::JNotification do
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
@jnotification = Killbill::Plugin::JNotification.new("Killbill::Plugin::NotificationTest")
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
it "should_test_on_event_ok" do
|
13
|
+
|
14
|
+
object_type = Java::com.ning.billing.ObjectType::INVOICE
|
15
|
+
event_type = Java::com.ning.billing.beatrix.bus.api.ExtBusEventType::INVOICE_CREATION
|
16
|
+
uuid = java.util.UUID.random_uuid
|
17
|
+
|
18
|
+
event = Java::com.ning.billing.mock.api.MockExtBusEvent.new(event_type, object_type, uuid, uuid, uuid)
|
19
|
+
@jnotification.on_event(event)
|
20
|
+
@jnotification.on_event(event)
|
21
|
+
@jnotification.on_event(event)
|
22
|
+
@jnotification.delegate_plugin.counter.should == 3
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
require 'killbill/response/event'
|
5
|
+
require 'killbill/jresponse/jevent'
|
6
|
+
|
7
|
+
|
8
|
+
describe Killbill::Plugin::JEvent do
|
9
|
+
|
10
|
+
it "should_test_jevent" do
|
11
|
+
object_type = Java::com.ning.billing.ObjectType::INVOICE
|
12
|
+
event_type = Java::com.ning.billing.beatrix.bus.api.ExtBusEventType::INVOICE_CREATION
|
13
|
+
uuid = java.util.UUID.random_uuid
|
14
|
+
|
15
|
+
input = Killbill::Plugin::JEvent.new(event_type, object_type, uuid, uuid, uuid)
|
16
|
+
#input.should be_an_instance_of Java::com.ning.billing.beatrix.bus.api.ExtBusEvent
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'killbill/notification'
|
2
|
+
|
3
|
+
module Killbill
|
4
|
+
module Plugin
|
5
|
+
class NotificationTest < Notification
|
6
|
+
|
7
|
+
attr_reader :counter
|
8
|
+
|
9
|
+
def initialize(*args)
|
10
|
+
@counter = 0
|
11
|
+
end
|
12
|
+
|
13
|
+
def on_event(event)
|
14
|
+
@counter += 1
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.14
|
5
4
|
prerelease:
|
5
|
+
version: 1.0.15
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Killbill core team
|
@@ -130,14 +130,17 @@ files:
|
|
130
130
|
- lib/killbill/response/refund_response.rb
|
131
131
|
- spec/killbill/base_plugin_spec.rb
|
132
132
|
- spec/killbill/config_test.ru
|
133
|
+
- spec/killbill/jnotification_spec.rb
|
133
134
|
- spec/killbill/jpayment_spec.rb
|
134
135
|
- spec/killbill/jresponse/jconverter_spec.rb
|
136
|
+
- spec/killbill/jresponse/jevent_spec.rb
|
135
137
|
- spec/killbill/jresponse/jpayment_method_response_internal_spec.rb
|
136
138
|
- spec/killbill/jresponse/jpayment_method_response_spec.rb
|
137
139
|
- spec/killbill/jresponse/jpayment_response_spec.rb
|
138
140
|
- spec/killbill/jresponse/jrefund_response_spec.rb
|
139
141
|
- spec/killbill/killbill_integration_spec.rb
|
140
142
|
- spec/killbill/notification_plugin_spec.rb
|
143
|
+
- spec/killbill/notification_test.rb
|
141
144
|
- spec/killbill/payment_plugin_spec.rb
|
142
145
|
- spec/killbill/payment_test.rb
|
143
146
|
- spec/killbill/rack_handler_spec.rb
|
@@ -163,9 +166,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
166
|
- !ruby/object:Gem::Version
|
164
167
|
segments:
|
165
168
|
- 0
|
169
|
+
hash: 2
|
166
170
|
version: !binary |-
|
167
171
|
MA==
|
168
|
-
hash: 2
|
169
172
|
none: false
|
170
173
|
requirements: []
|
171
174
|
rubyforge_project:
|
@@ -176,14 +179,17 @@ summary: Framework to write Killbill plugins in Ruby.
|
|
176
179
|
test_files:
|
177
180
|
- spec/killbill/base_plugin_spec.rb
|
178
181
|
- spec/killbill/config_test.ru
|
182
|
+
- spec/killbill/jnotification_spec.rb
|
179
183
|
- spec/killbill/jpayment_spec.rb
|
180
184
|
- spec/killbill/jresponse/jconverter_spec.rb
|
185
|
+
- spec/killbill/jresponse/jevent_spec.rb
|
181
186
|
- spec/killbill/jresponse/jpayment_method_response_internal_spec.rb
|
182
187
|
- spec/killbill/jresponse/jpayment_method_response_spec.rb
|
183
188
|
- spec/killbill/jresponse/jpayment_response_spec.rb
|
184
189
|
- spec/killbill/jresponse/jrefund_response_spec.rb
|
185
190
|
- spec/killbill/killbill_integration_spec.rb
|
186
191
|
- spec/killbill/notification_plugin_spec.rb
|
192
|
+
- spec/killbill/notification_test.rb
|
187
193
|
- spec/killbill/payment_plugin_spec.rb
|
188
194
|
- spec/killbill/payment_test.rb
|
189
195
|
- spec/killbill/rack_handler_spec.rb
|