killbill 3.2.2 → 3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -2
- data/Jarfile +7 -7
- data/README.md +16 -4
- data/VERSION +1 -1
- data/gen_config/api.conf +48 -47
- data/gen_config/plugin_api.conf +17 -16
- data/generators/active_merchant/templates/.gitignore.rb +2 -2
- data/generators/active_merchant/templates/lib/api.rb +8 -0
- data/generators/active_merchant/templates/plugin.gemspec.rb +1 -0
- data/generators/active_merchant/templates/spec/base_plugin_spec.rb +1 -0
- data/generators/active_merchant/templates/spec/integration_spec.rb +5 -1
- data/killbill.gemspec +1 -0
- data/lib/killbill/creator.rb +9 -0
- data/lib/killbill/currency.rb +6 -0
- data/lib/killbill/gen/api/account_audit_logs_for_object_type.rb +9 -7
- data/lib/killbill/gen/api/catalog_user_api.rb +37 -4
- data/lib/killbill/gen/api/payment_api.rb +104 -0
- data/lib/killbill/gen/api/payment_gateway_api.rb +6 -3
- data/lib/killbill/gen/api/plan_phase.rb +1 -8
- data/lib/killbill/gen/api/price_list_set.rb +9 -7
- data/lib/killbill/gen/api/subscription.rb +20 -1
- data/lib/killbill/gen/api/tenant_user_api.rb +3 -3
- data/lib/killbill/gen/plugin-api/currency_plugin_with_events_api.rb +207 -0
- data/lib/killbill/gen/plugin-api/ext_bus_event.rb +7 -1
- data/lib/killbill/gen/plugin-api/invoice_plugin_with_events_api.rb +103 -0
- data/lib/killbill/gen/plugin-api/payment_plugin_with_events_api.rb +782 -0
- data/lib/killbill/gen/plugin-api/require_gen.rb +3 -0
- data/lib/killbill/helpers/active_merchant/configuration.rb +116 -46
- data/lib/killbill/helpers/active_merchant/killbill_spec_helper.rb +49 -32
- data/lib/killbill/helpers/active_merchant/payment_plugin.rb +18 -6
- data/lib/killbill/helpers/active_merchant/private_payment_plugin.rb +3 -3
- data/lib/killbill/helpers/active_merchant/utils.rb +37 -70
- data/lib/killbill/invoice.rb +6 -0
- data/lib/killbill/payment.rb +6 -0
- data/lib/killbill/plugin.rb +1 -1
- data/lib/killbill/rake_task.rb +1 -1
- data/spec/killbill/helpers/configuration_spec.rb +41 -5
- data/spec/killbill/helpers/payment_plugin_spec.rb +4 -1
- data/spec/killbill/helpers/private_payment_plugin_spec.rb +4 -2
- data/spec/killbill/helpers/utils_spec.rb +6 -6
- data/spec/killbill/invoice_plugin_api_spec.rb +1 -1
- data/spec/killbill/notification_plugin_api_spec.rb +1 -1
- data/spec/killbill/payment_plugin_api_spec.rb +1 -1
- metadata +19 -3
- data/lib/killbill/jnotification.rb +0 -31
@@ -39,12 +39,15 @@ module Killbill
|
|
39
39
|
end
|
40
40
|
|
41
41
|
|
42
|
-
java_signature 'Java::org.killbill.billing.payment.plugin.api.HostedPaymentPageFormDescriptor buildFormDescriptor(Java::org.killbill.billing.account.api.Account, Java::java.lang.Iterable, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
|
43
|
-
def build_form_descriptor(account, customFields, properties, context)
|
42
|
+
java_signature 'Java::org.killbill.billing.payment.plugin.api.HostedPaymentPageFormDescriptor buildFormDescriptor(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.lang.Iterable, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
|
43
|
+
def build_form_descriptor(account, paymentMethodId, customFields, properties, context)
|
44
44
|
|
45
45
|
# conversion for account [type = org.killbill.billing.account.api.Account]
|
46
46
|
account = account.to_java unless account.nil?
|
47
47
|
|
48
|
+
# conversion for paymentMethodId [type = java.util.UUID]
|
49
|
+
paymentMethodId = java.util.UUID.fromString(paymentMethodId.to_s) unless paymentMethodId.nil?
|
50
|
+
|
48
51
|
# conversion for customFields [type = java.lang.Iterable]
|
49
52
|
tmp = java.util.ArrayList.new
|
50
53
|
(customFields || []).each do |m|
|
@@ -66,7 +69,7 @@ module Killbill
|
|
66
69
|
# conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
|
67
70
|
context = context.to_java unless context.nil?
|
68
71
|
begin
|
69
|
-
res = @real_java_api.build_form_descriptor(account, customFields, properties, context)
|
72
|
+
res = @real_java_api.build_form_descriptor(account, paymentMethodId, customFields, properties, context)
|
70
73
|
# conversion for res [type = org.killbill.billing.payment.plugin.api.HostedPaymentPageFormDescriptor]
|
71
74
|
res = Killbill::Plugin::Model::HostedPaymentPageFormDescriptor.new.to_ruby(res) unless res.nil?
|
72
75
|
return res
|
@@ -34,7 +34,7 @@ module Killbill
|
|
34
34
|
|
35
35
|
include org.killbill.billing.catalog.api.PlanPhase
|
36
36
|
|
37
|
-
attr_accessor :fixed, :recurring, :usages, :name, :
|
37
|
+
attr_accessor :fixed, :recurring, :usages, :name, :duration, :phase_type
|
38
38
|
|
39
39
|
def initialize()
|
40
40
|
end
|
@@ -58,9 +58,6 @@ module Killbill
|
|
58
58
|
# conversion for name [type = java.lang.String]
|
59
59
|
@name = @name.to_s unless @name.nil?
|
60
60
|
|
61
|
-
# conversion for plan [type = org.killbill.billing.catalog.api.Plan]
|
62
|
-
@plan = @plan.to_java unless @plan.nil?
|
63
|
-
|
64
61
|
# conversion for duration [type = org.killbill.billing.catalog.api.Duration]
|
65
62
|
@duration = @duration.to_java unless @duration.nil?
|
66
63
|
|
@@ -91,10 +88,6 @@ module Killbill
|
|
91
88
|
# conversion for name [type = java.lang.String]
|
92
89
|
@name = j_obj.name
|
93
90
|
|
94
|
-
# conversion for plan [type = org.killbill.billing.catalog.api.Plan]
|
95
|
-
#@plan = j_obj.plan
|
96
|
-
#@plan = Killbill::Plugin::Model::Plan.new.to_ruby(@plan) unless @plan.nil?
|
97
|
-
|
98
91
|
# conversion for duration [type = org.killbill.billing.catalog.api.Duration]
|
99
92
|
@duration = j_obj.duration
|
100
93
|
@duration = Killbill::Plugin::Model::Duration.new.to_ruby(@duration) unless @duration.nil?
|
@@ -34,18 +34,20 @@ module Killbill
|
|
34
34
|
|
35
35
|
include org.killbill.billing.catalog.api.PriceListSet
|
36
36
|
|
37
|
+
attr_accessor
|
38
|
+
|
37
39
|
def initialize()
|
38
40
|
end
|
39
41
|
|
40
42
|
def to_java()
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
def to_ruby(j_obj)
|
45
|
-
self
|
46
|
-
end
|
47
|
-
|
43
|
+
self
|
48
44
|
end
|
45
|
+
|
46
|
+
def to_ruby(j_obj)
|
47
|
+
self
|
49
48
|
end
|
49
|
+
|
50
50
|
end
|
51
51
|
end
|
52
|
+
end
|
53
|
+
end
|
@@ -34,7 +34,7 @@ module Killbill
|
|
34
34
|
|
35
35
|
include org.killbill.billing.entitlement.api.Subscription
|
36
36
|
|
37
|
-
attr_accessor :base_entitlement_id, :bundle_id, :account_id, :external_key, :state, :source_type, :effective_start_date, :effective_end_date, :last_active_product, :last_active_plan, :last_active_phase, :last_active_price_list, :last_active_product_category, :id, :created_date, :updated_date, :billing_start_date, :billing_end_date, :charged_through_date
|
37
|
+
attr_accessor :base_entitlement_id, :bundle_id, :account_id, :external_key, :state, :source_type, :effective_start_date, :effective_end_date, :last_active_product, :last_active_plan, :last_active_phase, :last_active_price_list, :last_active_product_category, :id, :created_date, :updated_date, :billing_start_date, :billing_end_date, :charged_through_date, :subscription_events
|
38
38
|
|
39
39
|
def initialize()
|
40
40
|
end
|
@@ -112,6 +112,15 @@ module Killbill
|
|
112
112
|
if !@charged_through_date.nil?
|
113
113
|
@charged_through_date = Java::org.joda.time.LocalDate.parse(@charged_through_date.to_s)
|
114
114
|
end
|
115
|
+
|
116
|
+
# conversion for subscription_events [type = java.util.List]
|
117
|
+
tmp = java.util.ArrayList.new
|
118
|
+
(@subscription_events || []).each do |m|
|
119
|
+
# conversion for m [type = org.killbill.billing.entitlement.api.SubscriptionEvent]
|
120
|
+
m = m.to_java unless m.nil?
|
121
|
+
tmp.add(m)
|
122
|
+
end
|
123
|
+
@subscription_events = tmp
|
115
124
|
self
|
116
125
|
end
|
117
126
|
|
@@ -208,6 +217,16 @@ module Killbill
|
|
208
217
|
if !@charged_through_date.nil?
|
209
218
|
@charged_through_date = @charged_through_date.to_s
|
210
219
|
end
|
220
|
+
|
221
|
+
# conversion for subscription_events [type = java.util.List]
|
222
|
+
@subscription_events = j_obj.subscription_events
|
223
|
+
tmp = []
|
224
|
+
(@subscription_events || []).each do |m|
|
225
|
+
# conversion for m [type = org.killbill.billing.entitlement.api.SubscriptionEvent]
|
226
|
+
m = Killbill::Plugin::Model::SubscriptionEvent.new.to_ruby(m) unless m.nil?
|
227
|
+
tmp << m
|
228
|
+
end
|
229
|
+
@subscription_events = tmp
|
211
230
|
self
|
212
231
|
end
|
213
232
|
|
@@ -87,8 +87,8 @@ module Killbill
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
java_signature 'Java::java.util.List
|
91
|
-
def
|
90
|
+
java_signature 'Java::java.util.List getTenantValuesForKey(Java::java.lang.String, Java::org.killbill.billing.util.callcontext.TenantContext)'
|
91
|
+
def get_tenant_values_for_key(key, context)
|
92
92
|
|
93
93
|
# conversion for key [type = java.lang.String]
|
94
94
|
key = key.to_s unless key.nil?
|
@@ -96,7 +96,7 @@ module Killbill
|
|
96
96
|
# conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
|
97
97
|
context = context.to_java unless context.nil?
|
98
98
|
begin
|
99
|
-
res = @real_java_api.
|
99
|
+
res = @real_java_api.get_tenant_values_for_key(key, context)
|
100
100
|
# conversion for res [type = java.util.List]
|
101
101
|
tmp = []
|
102
102
|
(res || []).each do |m|
|
@@ -0,0 +1,207 @@
|
|
1
|
+
#############################################################################################
|
2
|
+
# #
|
3
|
+
# Copyright 2010-2013 Ning, Inc. #
|
4
|
+
# Copyright 2014 Groupon, Inc. #
|
5
|
+
# Copyright 2014 The Billing Project, LLC #
|
6
|
+
# #
|
7
|
+
# The Billing Project licenses this file to you under the Apache License, version 2.0 #
|
8
|
+
# (the "License"); you may not use this file except in compliance with the #
|
9
|
+
# License. You may obtain a copy of the License at: #
|
10
|
+
# #
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
12
|
+
# #
|
13
|
+
# Unless required by applicable law or agreed to in writing, software #
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
|
16
|
+
# License for the specific language governing permissions and limitations #
|
17
|
+
# under the License. #
|
18
|
+
# #
|
19
|
+
#############################################################################################
|
20
|
+
|
21
|
+
|
22
|
+
#
|
23
|
+
# DO NOT EDIT!!!
|
24
|
+
# File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
|
25
|
+
#
|
26
|
+
|
27
|
+
|
28
|
+
module Killbill
|
29
|
+
module Plugin
|
30
|
+
module Api
|
31
|
+
|
32
|
+
java_package 'org.killbill.billing.currency.plugin.api'
|
33
|
+
class CurrencyPluginWithEventsApi < JPlugin
|
34
|
+
|
35
|
+
include org.killbill.billing.currency.plugin.api.CurrencyPluginWithEventsApi
|
36
|
+
|
37
|
+
def initialize(real_class_name, services = {})
|
38
|
+
super(real_class_name, services)
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
java_signature 'Java::void onEvent(Java::org.killbill.billing.notification.plugin.api.ExtBusEvent)'
|
43
|
+
def on_event(killbillEvent)
|
44
|
+
|
45
|
+
# conversion for killbillEvent [type = org.killbill.billing.notification.plugin.api.ExtBusEvent]
|
46
|
+
killbillEvent = Killbill::Plugin::Model::ExtBusEvent.new.to_ruby(killbillEvent) unless killbillEvent.nil?
|
47
|
+
begin
|
48
|
+
@delegate_plugin.on_event(killbillEvent)
|
49
|
+
rescue Exception => e
|
50
|
+
message = "Failure in on_event: #{e}"
|
51
|
+
unless e.backtrace.nil?
|
52
|
+
message = "#{message}\n#{e.backtrace.join("\n")}"
|
53
|
+
end
|
54
|
+
logger.warn message
|
55
|
+
raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("on_event failure", e.message)
|
56
|
+
ensure
|
57
|
+
@delegate_plugin.after_request
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
java_signature 'Java::java.util.Set getBaseCurrencies()'
|
62
|
+
def get_base_currencies()
|
63
|
+
begin
|
64
|
+
res = @delegate_plugin.get_base_currencies()
|
65
|
+
# conversion for res [type = java.util.Set]
|
66
|
+
tmp = java.util.TreeSet.new
|
67
|
+
(res || []).each do |m|
|
68
|
+
# conversion for m [type = org.killbill.billing.catalog.api.Currency]
|
69
|
+
m = Java::org.killbill.billing.catalog.api.Currency.value_of("#{m.to_s}") unless m.nil?
|
70
|
+
tmp.add(m)
|
71
|
+
end
|
72
|
+
res = tmp
|
73
|
+
return res
|
74
|
+
rescue Exception => e
|
75
|
+
message = "Failure in get_base_currencies: #{e}"
|
76
|
+
unless e.backtrace.nil?
|
77
|
+
message = "#{message}\n#{e.backtrace.join("\n")}"
|
78
|
+
end
|
79
|
+
logger.warn message
|
80
|
+
raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("get_base_currencies failure", e.message)
|
81
|
+
ensure
|
82
|
+
@delegate_plugin.after_request
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
java_signature 'Java::org.joda.time.DateTime getLatestConversionDate(Java::org.killbill.billing.catalog.api.Currency)'
|
87
|
+
def get_latest_conversion_date(baseCurrency)
|
88
|
+
|
89
|
+
# conversion for baseCurrency [type = org.killbill.billing.catalog.api.Currency]
|
90
|
+
baseCurrency = baseCurrency.to_s.to_sym unless baseCurrency.nil?
|
91
|
+
begin
|
92
|
+
res = @delegate_plugin.get_latest_conversion_date(baseCurrency)
|
93
|
+
# conversion for res [type = org.joda.time.DateTime]
|
94
|
+
if !res.nil?
|
95
|
+
res = (res.kind_of? Time) ? DateTime.parse(res.to_s) : res
|
96
|
+
res = Java::org.joda.time.DateTime.new(res.to_s, Java::org.joda.time.DateTimeZone::UTC)
|
97
|
+
end
|
98
|
+
return res
|
99
|
+
rescue Exception => e
|
100
|
+
message = "Failure in get_latest_conversion_date: #{e}"
|
101
|
+
unless e.backtrace.nil?
|
102
|
+
message = "#{message}\n#{e.backtrace.join("\n")}"
|
103
|
+
end
|
104
|
+
logger.warn message
|
105
|
+
raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("get_latest_conversion_date failure", e.message)
|
106
|
+
ensure
|
107
|
+
@delegate_plugin.after_request
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
java_signature 'Java::java.util.SortedSet getConversionDates(Java::org.killbill.billing.catalog.api.Currency)'
|
112
|
+
def get_conversion_dates(baseCurrency)
|
113
|
+
|
114
|
+
# conversion for baseCurrency [type = org.killbill.billing.catalog.api.Currency]
|
115
|
+
baseCurrency = baseCurrency.to_s.to_sym unless baseCurrency.nil?
|
116
|
+
begin
|
117
|
+
res = @delegate_plugin.get_conversion_dates(baseCurrency)
|
118
|
+
# conversion for res [type = java.util.SortedSet]
|
119
|
+
tmp = java.util.TreeSet.new
|
120
|
+
(res || []).each do |m|
|
121
|
+
# conversion for m [type = org.joda.time.DateTime]
|
122
|
+
if !m.nil?
|
123
|
+
m = (m.kind_of? Time) ? DateTime.parse(m.to_s) : m
|
124
|
+
m = Java::org.joda.time.DateTime.new(m.to_s, Java::org.joda.time.DateTimeZone::UTC)
|
125
|
+
end
|
126
|
+
tmp.add(m)
|
127
|
+
end
|
128
|
+
res = tmp
|
129
|
+
return res
|
130
|
+
rescue Exception => e
|
131
|
+
message = "Failure in get_conversion_dates: #{e}"
|
132
|
+
unless e.backtrace.nil?
|
133
|
+
message = "#{message}\n#{e.backtrace.join("\n")}"
|
134
|
+
end
|
135
|
+
logger.warn message
|
136
|
+
raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("get_conversion_dates failure", e.message)
|
137
|
+
ensure
|
138
|
+
@delegate_plugin.after_request
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
java_signature 'Java::java.util.Set getCurrentRates(Java::org.killbill.billing.catalog.api.Currency)'
|
143
|
+
def get_current_rates(baseCurrency)
|
144
|
+
|
145
|
+
# conversion for baseCurrency [type = org.killbill.billing.catalog.api.Currency]
|
146
|
+
baseCurrency = baseCurrency.to_s.to_sym unless baseCurrency.nil?
|
147
|
+
begin
|
148
|
+
res = @delegate_plugin.get_current_rates(baseCurrency)
|
149
|
+
# conversion for res [type = java.util.Set]
|
150
|
+
tmp = java.util.TreeSet.new
|
151
|
+
(res || []).each do |m|
|
152
|
+
# conversion for m [type = org.killbill.billing.currency.api.Rate]
|
153
|
+
m = m.to_java unless m.nil?
|
154
|
+
tmp.add(m)
|
155
|
+
end
|
156
|
+
res = tmp
|
157
|
+
return res
|
158
|
+
rescue Exception => e
|
159
|
+
message = "Failure in get_current_rates: #{e}"
|
160
|
+
unless e.backtrace.nil?
|
161
|
+
message = "#{message}\n#{e.backtrace.join("\n")}"
|
162
|
+
end
|
163
|
+
logger.warn message
|
164
|
+
raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("get_current_rates failure", e.message)
|
165
|
+
ensure
|
166
|
+
@delegate_plugin.after_request
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
java_signature 'Java::java.util.Set getRates(Java::org.killbill.billing.catalog.api.Currency, Java::org.joda.time.DateTime)'
|
171
|
+
def get_rates(baseCurrency, conversionDate)
|
172
|
+
|
173
|
+
# conversion for baseCurrency [type = org.killbill.billing.catalog.api.Currency]
|
174
|
+
baseCurrency = baseCurrency.to_s.to_sym unless baseCurrency.nil?
|
175
|
+
|
176
|
+
# conversion for conversionDate [type = org.joda.time.DateTime]
|
177
|
+
if !conversionDate.nil?
|
178
|
+
fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
|
179
|
+
str = fmt.print(conversionDate)
|
180
|
+
conversionDate = DateTime.iso8601(str)
|
181
|
+
end
|
182
|
+
begin
|
183
|
+
res = @delegate_plugin.get_rates(baseCurrency, conversionDate)
|
184
|
+
# conversion for res [type = java.util.Set]
|
185
|
+
tmp = java.util.TreeSet.new
|
186
|
+
(res || []).each do |m|
|
187
|
+
# conversion for m [type = org.killbill.billing.currency.api.Rate]
|
188
|
+
m = m.to_java unless m.nil?
|
189
|
+
tmp.add(m)
|
190
|
+
end
|
191
|
+
res = tmp
|
192
|
+
return res
|
193
|
+
rescue Exception => e
|
194
|
+
message = "Failure in get_rates: #{e}"
|
195
|
+
unless e.backtrace.nil?
|
196
|
+
message = "#{message}\n#{e.backtrace.join("\n")}"
|
197
|
+
end
|
198
|
+
logger.warn message
|
199
|
+
raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("get_rates failure", e.message)
|
200
|
+
ensure
|
201
|
+
@delegate_plugin.after_request
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
@@ -34,7 +34,7 @@ module Killbill
|
|
34
34
|
|
35
35
|
include org.killbill.billing.notification.plugin.api.ExtBusEvent
|
36
36
|
|
37
|
-
attr_accessor :event_type, :object_type, :object_id, :account_id, :tenant_id
|
37
|
+
attr_accessor :event_type, :object_type, :object_id, :meta_data, :account_id, :tenant_id
|
38
38
|
|
39
39
|
def initialize()
|
40
40
|
end
|
@@ -49,6 +49,9 @@ module Killbill
|
|
49
49
|
# conversion for object_id [type = java.util.UUID]
|
50
50
|
@object_id = java.util.UUID.fromString(@object_id.to_s) unless @object_id.nil?
|
51
51
|
|
52
|
+
# conversion for meta_data [type = java.lang.String]
|
53
|
+
@meta_data = @meta_data.to_s unless @meta_data.nil?
|
54
|
+
|
52
55
|
# conversion for account_id [type = java.util.UUID]
|
53
56
|
@account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?
|
54
57
|
|
@@ -70,6 +73,9 @@ module Killbill
|
|
70
73
|
@object_id = j_obj.object_id
|
71
74
|
@object_id = @object_id.nil? ? nil : @object_id.to_s
|
72
75
|
|
76
|
+
# conversion for meta_data [type = java.lang.String]
|
77
|
+
@meta_data = j_obj.meta_data
|
78
|
+
|
73
79
|
# conversion for account_id [type = java.util.UUID]
|
74
80
|
@account_id = j_obj.account_id
|
75
81
|
@account_id = @account_id.nil? ? nil : @account_id.to_s
|
@@ -0,0 +1,103 @@
|
|
1
|
+
#############################################################################################
|
2
|
+
# #
|
3
|
+
# Copyright 2010-2013 Ning, Inc. #
|
4
|
+
# Copyright 2014 Groupon, Inc. #
|
5
|
+
# Copyright 2014 The Billing Project, LLC #
|
6
|
+
# #
|
7
|
+
# The Billing Project licenses this file to you under the Apache License, version 2.0 #
|
8
|
+
# (the "License"); you may not use this file except in compliance with the #
|
9
|
+
# License. You may obtain a copy of the License at: #
|
10
|
+
# #
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
12
|
+
# #
|
13
|
+
# Unless required by applicable law or agreed to in writing, software #
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
|
16
|
+
# License for the specific language governing permissions and limitations #
|
17
|
+
# under the License. #
|
18
|
+
# #
|
19
|
+
#############################################################################################
|
20
|
+
|
21
|
+
|
22
|
+
#
|
23
|
+
# DO NOT EDIT!!!
|
24
|
+
# File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
|
25
|
+
#
|
26
|
+
|
27
|
+
|
28
|
+
module Killbill
|
29
|
+
module Plugin
|
30
|
+
module Api
|
31
|
+
|
32
|
+
java_package 'org.killbill.billing.invoice.plugin.api'
|
33
|
+
class InvoicePluginWithEventsApi < JPlugin
|
34
|
+
|
35
|
+
include org.killbill.billing.invoice.plugin.api.InvoicePluginWithEventsApi
|
36
|
+
|
37
|
+
def initialize(real_class_name, services = {})
|
38
|
+
super(real_class_name, services)
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
java_signature 'Java::void onEvent(Java::org.killbill.billing.notification.plugin.api.ExtBusEvent)'
|
43
|
+
def on_event(killbillEvent)
|
44
|
+
|
45
|
+
# conversion for killbillEvent [type = org.killbill.billing.notification.plugin.api.ExtBusEvent]
|
46
|
+
killbillEvent = Killbill::Plugin::Model::ExtBusEvent.new.to_ruby(killbillEvent) unless killbillEvent.nil?
|
47
|
+
begin
|
48
|
+
@delegate_plugin.on_event(killbillEvent)
|
49
|
+
rescue Exception => e
|
50
|
+
message = "Failure in on_event: #{e}"
|
51
|
+
unless e.backtrace.nil?
|
52
|
+
message = "#{message}\n#{e.backtrace.join("\n")}"
|
53
|
+
end
|
54
|
+
logger.warn message
|
55
|
+
raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("on_event failure", e.message)
|
56
|
+
ensure
|
57
|
+
@delegate_plugin.after_request
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
java_signature 'Java::java.util.List getAdditionalInvoiceItems(Java::org.killbill.billing.invoice.api.Invoice, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
|
62
|
+
def get_additional_invoice_items(invoice, properties, context)
|
63
|
+
|
64
|
+
# conversion for invoice [type = org.killbill.billing.invoice.api.Invoice]
|
65
|
+
invoice = Killbill::Plugin::Model::Invoice.new.to_ruby(invoice) unless invoice.nil?
|
66
|
+
|
67
|
+
# conversion for properties [type = java.lang.Iterable]
|
68
|
+
tmp = []
|
69
|
+
(properties.nil? ? [] : properties.iterator).each do |m|
|
70
|
+
# conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
|
71
|
+
m = Killbill::Plugin::Model::PluginProperty.new.to_ruby(m) unless m.nil?
|
72
|
+
tmp << m
|
73
|
+
end
|
74
|
+
properties = tmp
|
75
|
+
|
76
|
+
# conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
|
77
|
+
context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
|
78
|
+
begin
|
79
|
+
res = @delegate_plugin.get_additional_invoice_items(invoice, properties, context)
|
80
|
+
# conversion for res [type = java.util.List]
|
81
|
+
tmp = java.util.ArrayList.new
|
82
|
+
(res || []).each do |m|
|
83
|
+
# conversion for m [type = org.killbill.billing.invoice.api.InvoiceItem]
|
84
|
+
m = m.to_java unless m.nil?
|
85
|
+
tmp.add(m)
|
86
|
+
end
|
87
|
+
res = tmp
|
88
|
+
return res
|
89
|
+
rescue Exception => e
|
90
|
+
message = "Failure in get_additional_invoice_items: #{e}"
|
91
|
+
unless e.backtrace.nil?
|
92
|
+
message = "#{message}\n#{e.backtrace.join("\n")}"
|
93
|
+
end
|
94
|
+
logger.warn message
|
95
|
+
raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("get_additional_invoice_items failure", e.message)
|
96
|
+
ensure
|
97
|
+
@delegate_plugin.after_request
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|