killbill 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +12 -3
  3. data/Jarfile +8 -7
  4. data/Jarfile.lock +9 -8
  5. data/README.md +131 -108
  6. data/gen_config/api.conf +1 -1
  7. data/gen_config/plugin_api.conf +7 -6
  8. data/generators/active_merchant/templates/Jarfile.rb +7 -7
  9. data/generators/active_merchant/templates/plugin.gemspec.rb +2 -3
  10. data/killbill.gemspec +5 -2
  11. data/lib/killbill.rb +26 -22
  12. data/lib/killbill/gen/api/admin_payment_api.rb +76 -0
  13. data/lib/killbill/gen/api/payment_api.rb +82 -0
  14. data/lib/killbill/gen/api/payment_gateway_api.rb +75 -0
  15. data/lib/killbill/gen/api/require_gen.rb +1 -0
  16. data/lib/killbill/gen/plugin-api/catalog_plugin_api.rb +76 -0
  17. data/lib/killbill/gen/plugin-api/on_failure_payment_routing_result.rb +65 -0
  18. data/lib/killbill/gen/plugin-api/on_success_payment_routing_result.rb +53 -0
  19. data/lib/killbill/gen/plugin-api/payment_routing_api_exception.rb +51 -0
  20. data/lib/killbill/gen/plugin-api/payment_routing_context.rb +246 -0
  21. data/lib/killbill/gen/plugin-api/payment_routing_plugin_api.rb +138 -0
  22. data/lib/killbill/gen/plugin-api/prior_payment_routing_result.rb +107 -0
  23. data/lib/killbill/gen/plugin-api/require_gen.rb +9 -0
  24. data/lib/killbill/gen/plugin-api/standalone_plugin_catalog.rb +174 -0
  25. data/lib/killbill/gen/plugin-api/versioned_plugin_catalog.rb +83 -0
  26. data/lib/killbill/helpers/active_merchant.rb +6 -4
  27. data/lib/killbill/helpers/active_merchant/active_record/models/response.rb +16 -4
  28. data/lib/killbill/helpers/active_merchant/configuration.rb +7 -2
  29. data/lib/killbill/helpers/active_merchant/gateway.rb +76 -5
  30. data/lib/killbill/helpers/active_merchant/payment_plugin.rb +12 -8
  31. data/lib/killbill/helpers/catalog.rb +15 -0
  32. data/lib/killbill/payment_control.rb +23 -0
  33. data/lib/killbill/version.rb +3 -0
  34. data/spec/killbill/helpers/configuration_spec.rb +18 -4
  35. data/spec/killbill/helpers/payment_plugin_spec.rb +140 -36
  36. data/spec/killbill/helpers/response_spec.rb +1 -1
  37. metadata +49 -5
  38. data/VERSION +0 -1
@@ -1,9 +1,9 @@
1
- jar 'org.kill-bill.billing:killbill-api', '0.14'
2
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.9'
3
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.9'
4
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.9'
5
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.9'
6
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-routing', '0.9'
7
- jar 'org.kill-bill.billing:killbill-util:tests', '0.13.7'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.17'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.10'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.10'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.10'
5
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.10'
6
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-routing', '0.10'
7
+ jar 'org.kill-bill.billing:killbill-util:tests', '0.14.0'
8
8
  jar 'org.mockito:mockito-all', '1.10.19'
9
9
  jar 'javax.servlet:javax.servlet-api', '3.1.0'
@@ -29,9 +29,8 @@ Gem::Specification.new do |s|
29
29
  s.add_dependency 'activerecord', '~> 4.1.0'
30
30
  if defined?(JRUBY_VERSION)
31
31
  s.add_dependency 'activerecord-bogacs', '~> 0.3'
32
- s.add_dependency 'activerecord-jdbc-adapter', '~> 1.3'
33
- # Required to avoid errors like java.lang.NoClassDefFoundError: org/bouncycastle/asn1/DERBoolean
34
- s.add_dependency 'jruby-openssl', '~> 0.9.6'
32
+ s.add_dependency 'activerecord-jdbc-adapter', '~> 1.3', '< 1.5'
33
+ s.add_dependency 'jruby-openssl', '~> 0.9.7'
35
34
  end
36
35
  s.add_dependency 'actionpack', '~> 4.1.0'
37
36
  s.add_dependency 'actionview', '~> 4.1.0'
data/killbill.gemspec CHANGED
@@ -1,8 +1,11 @@
1
- version = File.read(File.expand_path('../VERSION', __FILE__)).strip
1
+ # coding: utf-8
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'killbill'
5
- s.version = version
5
+
6
+ path = File.expand_path('lib/killbill/version.rb', File.dirname(__FILE__))
7
+ s.version = File.read(path).match( /.*VERSION\s*=\s*['"](.*)['"]/m )[1]
8
+
6
9
  s.summary = 'Framework to write Kill Bill plugins in Ruby.'
7
10
  s.description = 'Base classes to write plugins.'
8
11
 
data/lib/killbill.rb CHANGED
@@ -1,22 +1,21 @@
1
- begin
2
- require 'java'
1
+ # Add method snake_case to String as early as possible so all classes below can use it
2
+ class String
3
+ def snake_case
4
+ return downcase if match(/\A[A-Z]+\z/)
5
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
6
+ gsub(/([a-z])([A-Z])/, '\1_\2').
7
+ downcase
8
+ end
3
9
 
4
- # Add method snake_case to String as early as possible so all classes below can use it
5
- class String
6
- def snake_case
7
- return downcase if match(/\A[A-Z]+\z/)
8
- gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
9
- gsub(/([a-z])([A-Z])/, '\1_\2').
10
- downcase
10
+ def to_class
11
+ self.split('::').inject(Kernel) do |mod, class_name|
12
+ mod.const_get(class_name)
11
13
  end
14
+ end
15
+ end
12
16
 
13
- def to_class
14
- self.split('::').inject(Kernel) do |mod, class_name|
15
- mod.const_get(class_name)
16
- end
17
- end
18
- end
19
-
17
+ begin
18
+ require 'java'
20
19
 
21
20
  #
22
21
  # The Killbill Java APIs imported into that jruby bridge
@@ -59,9 +58,14 @@ end
59
58
 
60
59
  require 'tzinfo'
61
60
  require 'bigdecimal'
62
- require 'killbill/gen/api/require_gen'
63
- require 'killbill/gen/plugin-api/require_gen'
64
- require 'killbill/notification'
65
- require 'killbill/payment'
66
- require 'killbill/invoice'
67
- require 'killbill/currency'
61
+
62
+ module Killbill
63
+ require 'killbill/gen/api/require_gen'
64
+ require 'killbill/gen/plugin-api/require_gen'
65
+ require 'killbill/notification'
66
+ require 'killbill/payment'
67
+ require 'killbill/payment_control'
68
+ require 'killbill/invoice'
69
+ require 'killbill/currency'
70
+ end
71
+ KillBill = Killbill
@@ -0,0 +1,76 @@
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.payment.api'
33
+ class AdminPaymentApi
34
+
35
+ include org.killbill.billing.payment.api.AdminPaymentApi
36
+
37
+ def initialize(real_java_api)
38
+ @real_java_api = real_java_api
39
+ end
40
+
41
+
42
+ java_signature 'Java::void fixPaymentTransactionState(Java::org.killbill.billing.payment.api.Payment, Java::org.killbill.billing.payment.api.PaymentTransaction, Java::org.killbill.billing.payment.api.TransactionStatus, Java::java.lang.String, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
43
+ def fix_payment_transaction_state(payment, paymentTransaction, transactionStatus, lastSuccessPaymentState, currentPaymentStateName, properties, context)
44
+
45
+ # conversion for payment [type = org.killbill.billing.payment.api.Payment]
46
+ payment = payment.to_java unless payment.nil?
47
+
48
+ # conversion for paymentTransaction [type = org.killbill.billing.payment.api.PaymentTransaction]
49
+ paymentTransaction = paymentTransaction.to_java unless paymentTransaction.nil?
50
+
51
+ # conversion for transactionStatus [type = org.killbill.billing.payment.api.TransactionStatus]
52
+ transactionStatus = Java::org.killbill.billing.payment.api.TransactionStatus.value_of( transactionStatus.to_s ) unless transactionStatus.nil?
53
+
54
+ # conversion for lastSuccessPaymentState [type = java.lang.String]
55
+ lastSuccessPaymentState = lastSuccessPaymentState.to_s unless lastSuccessPaymentState.nil?
56
+
57
+ # conversion for currentPaymentStateName [type = java.lang.String]
58
+ currentPaymentStateName = currentPaymentStateName.to_s unless currentPaymentStateName.nil?
59
+
60
+ # conversion for properties [type = java.lang.Iterable]
61
+ tmp = java.util.ArrayList.new
62
+ (properties || []).each do |m|
63
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
64
+ m = m.to_java unless m.nil?
65
+ tmp.add(m)
66
+ end
67
+ properties = tmp
68
+
69
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
70
+ context = context.to_java unless context.nil?
71
+ @real_java_api.fix_payment_transaction_state(payment, paymentTransaction, transactionStatus, lastSuccessPaymentState, currentPaymentStateName, properties, context)
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -183,6 +183,52 @@ module Killbill
183
183
  end
184
184
  end
185
185
 
186
+ java_signature 'Java::org.killbill.billing.payment.api.Payment createCaptureWithPaymentControl(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.math.BigDecimal, Java::org.killbill.billing.catalog.api.Currency, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.payment.api.PaymentOptions, Java::org.killbill.billing.util.callcontext.CallContext)'
187
+ def create_capture_with_payment_control(account, paymentId, amount, currency, paymentTransactionExternalKey, properties, paymentOptions, context)
188
+
189
+ # conversion for account [type = org.killbill.billing.account.api.Account]
190
+ account = account.to_java unless account.nil?
191
+
192
+ # conversion for paymentId [type = java.util.UUID]
193
+ paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.nil?
194
+
195
+ # conversion for amount [type = java.math.BigDecimal]
196
+ if amount.nil?
197
+ amount = java.math.BigDecimal::ZERO
198
+ else
199
+ amount = java.math.BigDecimal.new(amount.to_s)
200
+ end
201
+
202
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
203
+ currency = Java::org.killbill.billing.catalog.api.Currency.value_of( currency.to_s ) unless currency.nil?
204
+
205
+ # conversion for paymentTransactionExternalKey [type = java.lang.String]
206
+ paymentTransactionExternalKey = paymentTransactionExternalKey.to_s unless paymentTransactionExternalKey.nil?
207
+
208
+ # conversion for properties [type = java.lang.Iterable]
209
+ tmp = java.util.ArrayList.new
210
+ (properties || []).each do |m|
211
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
212
+ m = m.to_java unless m.nil?
213
+ tmp.add(m)
214
+ end
215
+ properties = tmp
216
+
217
+ # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
218
+ paymentOptions = paymentOptions.to_java unless paymentOptions.nil?
219
+
220
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
221
+ context = context.to_java unless context.nil?
222
+ begin
223
+ res = @real_java_api.create_capture_with_payment_control(account, paymentId, amount, currency, paymentTransactionExternalKey, properties, paymentOptions, context)
224
+ # conversion for res [type = org.killbill.billing.payment.api.Payment]
225
+ res = Killbill::Plugin::Model::Payment.new.to_ruby(res) unless res.nil?
226
+ return res
227
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
228
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
229
+ end
230
+ end
231
+
186
232
  java_signature 'Java::org.killbill.billing.payment.api.Payment createPurchase(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.util.UUID, Java::java.math.BigDecimal, Java::org.killbill.billing.catalog.api.Currency, Java::java.lang.String, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
187
233
  def create_purchase(account, paymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey, properties, context)
188
234
 
@@ -317,6 +363,42 @@ module Killbill
317
363
  end
318
364
  end
319
365
 
366
+ java_signature 'Java::org.killbill.billing.payment.api.Payment createVoidWithPaymentControl(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.payment.api.PaymentOptions, Java::org.killbill.billing.util.callcontext.CallContext)'
367
+ def create_void_with_payment_control(account, paymentId, paymentTransactionExternalKey, properties, paymentOptions, context)
368
+
369
+ # conversion for account [type = org.killbill.billing.account.api.Account]
370
+ account = account.to_java unless account.nil?
371
+
372
+ # conversion for paymentId [type = java.util.UUID]
373
+ paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.nil?
374
+
375
+ # conversion for paymentTransactionExternalKey [type = java.lang.String]
376
+ paymentTransactionExternalKey = paymentTransactionExternalKey.to_s unless paymentTransactionExternalKey.nil?
377
+
378
+ # conversion for properties [type = java.lang.Iterable]
379
+ tmp = java.util.ArrayList.new
380
+ (properties || []).each do |m|
381
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
382
+ m = m.to_java unless m.nil?
383
+ tmp.add(m)
384
+ end
385
+ properties = tmp
386
+
387
+ # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
388
+ paymentOptions = paymentOptions.to_java unless paymentOptions.nil?
389
+
390
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
391
+ context = context.to_java unless context.nil?
392
+ begin
393
+ res = @real_java_api.create_void_with_payment_control(account, paymentId, paymentTransactionExternalKey, properties, paymentOptions, context)
394
+ # conversion for res [type = org.killbill.billing.payment.api.Payment]
395
+ res = Killbill::Plugin::Model::Payment.new.to_ruby(res) unless res.nil?
396
+ return res
397
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
398
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
399
+ end
400
+ end
401
+
320
402
  java_signature 'Java::org.killbill.billing.payment.api.Payment createRefund(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.math.BigDecimal, Java::org.killbill.billing.catalog.api.Currency, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
321
403
  def create_refund(account, paymentId, amount, currency, paymentTransactionExternalKey, properties, context)
322
404
 
@@ -78,6 +78,48 @@ module Killbill
78
78
  end
79
79
  end
80
80
 
81
+ java_signature 'Java::org.killbill.billing.payment.plugin.api.HostedPaymentPageFormDescriptor buildFormDescriptorWithPaymentControl(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.lang.Iterable, Java::java.lang.Iterable, Java::org.killbill.billing.payment.api.PaymentOptions, Java::org.killbill.billing.util.callcontext.CallContext)'
82
+ def build_form_descriptor_with_payment_control(account, paymentMethodId, customFields, properties, paymentOptions, context)
83
+
84
+ # conversion for account [type = org.killbill.billing.account.api.Account]
85
+ account = account.to_java unless account.nil?
86
+
87
+ # conversion for paymentMethodId [type = java.util.UUID]
88
+ paymentMethodId = java.util.UUID.fromString(paymentMethodId.to_s) unless paymentMethodId.nil?
89
+
90
+ # conversion for customFields [type = java.lang.Iterable]
91
+ tmp = java.util.ArrayList.new
92
+ (customFields || []).each do |m|
93
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
94
+ m = m.to_java unless m.nil?
95
+ tmp.add(m)
96
+ end
97
+ customFields = tmp
98
+
99
+ # conversion for properties [type = java.lang.Iterable]
100
+ tmp = java.util.ArrayList.new
101
+ (properties || []).each do |m|
102
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
103
+ m = m.to_java unless m.nil?
104
+ tmp.add(m)
105
+ end
106
+ properties = tmp
107
+
108
+ # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
109
+ paymentOptions = paymentOptions.to_java unless paymentOptions.nil?
110
+
111
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
112
+ context = context.to_java unless context.nil?
113
+ begin
114
+ res = @real_java_api.build_form_descriptor_with_payment_control(account, paymentMethodId, customFields, properties, paymentOptions, context)
115
+ # conversion for res [type = org.killbill.billing.payment.plugin.api.HostedPaymentPageFormDescriptor]
116
+ res = Killbill::Plugin::Model::HostedPaymentPageFormDescriptor.new.to_ruby(res) unless res.nil?
117
+ return res
118
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
119
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
120
+ end
121
+ end
122
+
81
123
  java_signature 'Java::org.killbill.billing.payment.plugin.api.GatewayNotification processNotification(Java::java.lang.String, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
82
124
  def process_notification(notification, pluginName, properties, context)
83
125
 
@@ -107,6 +149,39 @@ module Killbill
107
149
  raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
108
150
  end
109
151
  end
152
+
153
+ java_signature 'Java::org.killbill.billing.payment.plugin.api.GatewayNotification processNotificationWithPaymentControl(Java::java.lang.String, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.payment.api.PaymentOptions, Java::org.killbill.billing.util.callcontext.CallContext)'
154
+ def process_notification_with_payment_control(notification, pluginName, properties, paymentOptions, context)
155
+
156
+ # conversion for notification [type = java.lang.String]
157
+ notification = notification.to_s unless notification.nil?
158
+
159
+ # conversion for pluginName [type = java.lang.String]
160
+ pluginName = pluginName.to_s unless pluginName.nil?
161
+
162
+ # conversion for properties [type = java.lang.Iterable]
163
+ tmp = java.util.ArrayList.new
164
+ (properties || []).each do |m|
165
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
166
+ m = m.to_java unless m.nil?
167
+ tmp.add(m)
168
+ end
169
+ properties = tmp
170
+
171
+ # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
172
+ paymentOptions = paymentOptions.to_java unless paymentOptions.nil?
173
+
174
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
175
+ context = context.to_java unless context.nil?
176
+ begin
177
+ res = @real_java_api.process_notification_with_payment_control(notification, pluginName, properties, paymentOptions, context)
178
+ # conversion for res [type = org.killbill.billing.payment.plugin.api.GatewayNotification]
179
+ res = Killbill::Plugin::Model::GatewayNotification.new.to_ruby(res) unless res.nil?
180
+ return res
181
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
182
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
183
+ end
184
+ end
110
185
  end
111
186
  end
112
187
  end
@@ -93,6 +93,7 @@ require 'killbill/gen/api/killbill_api'
93
93
  require 'killbill/gen/api/plugin_config_service_api'
94
94
  require 'killbill/gen/api/osgi_killbill'
95
95
  require 'killbill/gen/api/osgi_plugin_properties'
96
+ require 'killbill/gen/api/admin_payment_api'
96
97
  require 'killbill/gen/api/payment'
97
98
  require 'killbill/gen/api/payment_api'
98
99
  require 'killbill/gen/api/payment_api_exception'
@@ -0,0 +1,76 @@
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
+ require 'killbill/gen/plugin-api/notification_plugin_api'
29
+ module Killbill
30
+ module Plugin
31
+ module Api
32
+
33
+ java_package 'org.killbill.billing.catalog.plugin.api'
34
+ class CatalogPluginApi < NotificationPluginApi
35
+
36
+ include org.killbill.billing.catalog.plugin.api.CatalogPluginApi
37
+
38
+ def initialize(real_class_name, services = {})
39
+ super(real_class_name, services)
40
+ end
41
+
42
+
43
+ java_signature 'Java::org.killbill.billing.catalog.plugin.api.VersionedPluginCatalog getVersionedPluginCatalog(Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
44
+ def get_versioned_plugin_catalog(properties, context)
45
+
46
+ # conversion for properties [type = java.lang.Iterable]
47
+ tmp = []
48
+ (properties.nil? ? [] : properties.iterator).each do |m|
49
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
50
+ m = Killbill::Plugin::Model::PluginProperty.new.to_ruby(m) unless m.nil?
51
+ tmp << m
52
+ end
53
+ properties = tmp
54
+
55
+ # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
56
+ context = Killbill::Plugin::Model::TenantContext.new.to_ruby(context) unless context.nil?
57
+ begin
58
+ res = @delegate_plugin.get_versioned_plugin_catalog(properties, context)
59
+ # conversion for res [type = org.killbill.billing.catalog.plugin.api.VersionedPluginCatalog]
60
+ res = res.to_java unless res.nil?
61
+ return res
62
+ rescue Exception => e
63
+ message = "Failure in get_versioned_plugin_catalog: #{e}"
64
+ unless e.backtrace.nil?
65
+ message = "#{message}\n#{e.backtrace.join("\n")}"
66
+ end
67
+ logger.warn message
68
+ raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("get_versioned_plugin_catalog failure", e.message)
69
+ ensure
70
+ @delegate_plugin.after_request
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end