killbill 4.0.0 → 4.1.0

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.
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
@@ -0,0 +1,65 @@
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 Model
31
+
32
+ java_package 'org.killbill.billing.routing.plugin.api'
33
+ class OnFailurePaymentRoutingResult
34
+
35
+ include org.killbill.billing.routing.plugin.api.OnFailurePaymentRoutingResult
36
+
37
+ attr_accessor :next_retry_date
38
+
39
+ def initialize()
40
+ end
41
+
42
+ def to_java()
43
+ # conversion for next_retry_date [type = org.joda.time.DateTime]
44
+ if !@next_retry_date.nil?
45
+ @next_retry_date = (@next_retry_date.kind_of? Time) ? DateTime.parse(@next_retry_date.to_s) : @next_retry_date
46
+ @next_retry_date = Java::org.joda.time.DateTime.new(@next_retry_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
47
+ end
48
+ self
49
+ end
50
+
51
+ def to_ruby(j_obj)
52
+ # conversion for next_retry_date [type = org.joda.time.DateTime]
53
+ @next_retry_date = j_obj.next_retry_date
54
+ if !@next_retry_date.nil?
55
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
56
+ str = fmt.print(@next_retry_date)
57
+ @next_retry_date = DateTime.iso8601(str)
58
+ end
59
+ self
60
+ end
61
+
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,53 @@
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 Model
31
+
32
+ java_package 'org.killbill.billing.routing.plugin.api'
33
+ class OnSuccessPaymentRoutingResult
34
+
35
+ include org.killbill.billing.routing.plugin.api.OnSuccessPaymentRoutingResult
36
+
37
+ attr_accessor
38
+
39
+ def initialize()
40
+ end
41
+
42
+ def to_java()
43
+ self
44
+ end
45
+
46
+ def to_ruby(j_obj)
47
+ self
48
+ end
49
+
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,51 @@
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 Model
31
+
32
+ class PaymentRoutingApiException
33
+
34
+
35
+ attr_accessor
36
+
37
+ def initialize()
38
+ end
39
+
40
+ def to_java()
41
+ Java::org.killbill.billing.routing.plugin.api.PaymentRoutingApiException.new()
42
+ end
43
+
44
+ def to_ruby(j_obj)
45
+ self
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,246 @@
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 Model
31
+
32
+ java_package 'org.killbill.billing.routing.plugin.api'
33
+ class PaymentRoutingContext
34
+
35
+ include org.killbill.billing.routing.plugin.api.PaymentRoutingContext
36
+
37
+ attr_accessor :user_token, :user_name, :call_origin, :user_type, :reason_code, :comments, :created_date, :updated_date, :tenant_id, :account_id, :payment_id, :attempt_payment_id, :payment_external_key, :transaction_id, :transaction_external_key, :transaction_type, :amount, :currency, :payment_method_id, :processed_amount, :processed_currency, :is_api_payment, :plugin_properties
38
+
39
+ def initialize()
40
+ end
41
+
42
+ def to_java()
43
+ # conversion for user_token [type = java.util.UUID]
44
+ @user_token = java.util.UUID.fromString(@user_token.to_s) unless @user_token.nil?
45
+
46
+ # conversion for user_name [type = java.lang.String]
47
+ @user_name = @user_name.to_s unless @user_name.nil?
48
+
49
+ # conversion for call_origin [type = org.killbill.billing.util.callcontext.CallOrigin]
50
+ @call_origin = Java::org.killbill.billing.util.callcontext.CallOrigin.value_of( @call_origin.to_s ) unless @call_origin.nil?
51
+
52
+ # conversion for user_type [type = org.killbill.billing.util.callcontext.UserType]
53
+ @user_type = Java::org.killbill.billing.util.callcontext.UserType.value_of( @user_type.to_s ) unless @user_type.nil?
54
+
55
+ # conversion for reason_code [type = java.lang.String]
56
+ @reason_code = @reason_code.to_s unless @reason_code.nil?
57
+
58
+ # conversion for comments [type = java.lang.String]
59
+ @comments = @comments.to_s unless @comments.nil?
60
+
61
+ # conversion for created_date [type = org.joda.time.DateTime]
62
+ if !@created_date.nil?
63
+ @created_date = (@created_date.kind_of? Time) ? DateTime.parse(@created_date.to_s) : @created_date
64
+ @created_date = Java::org.joda.time.DateTime.new(@created_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
65
+ end
66
+
67
+ # conversion for updated_date [type = org.joda.time.DateTime]
68
+ if !@updated_date.nil?
69
+ @updated_date = (@updated_date.kind_of? Time) ? DateTime.parse(@updated_date.to_s) : @updated_date
70
+ @updated_date = Java::org.joda.time.DateTime.new(@updated_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
71
+ end
72
+
73
+ # conversion for tenant_id [type = java.util.UUID]
74
+ @tenant_id = java.util.UUID.fromString(@tenant_id.to_s) unless @tenant_id.nil?
75
+
76
+ # conversion for account_id [type = java.util.UUID]
77
+ @account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?
78
+
79
+ # conversion for payment_id [type = java.util.UUID]
80
+ @payment_id = java.util.UUID.fromString(@payment_id.to_s) unless @payment_id.nil?
81
+
82
+ # conversion for attempt_payment_id [type = java.util.UUID]
83
+ @attempt_payment_id = java.util.UUID.fromString(@attempt_payment_id.to_s) unless @attempt_payment_id.nil?
84
+
85
+ # conversion for payment_external_key [type = java.lang.String]
86
+ @payment_external_key = @payment_external_key.to_s unless @payment_external_key.nil?
87
+
88
+ # conversion for transaction_id [type = java.util.UUID]
89
+ @transaction_id = java.util.UUID.fromString(@transaction_id.to_s) unless @transaction_id.nil?
90
+
91
+ # conversion for transaction_external_key [type = java.lang.String]
92
+ @transaction_external_key = @transaction_external_key.to_s unless @transaction_external_key.nil?
93
+
94
+ # conversion for transaction_type [type = org.killbill.billing.payment.api.TransactionType]
95
+ @transaction_type = Java::org.killbill.billing.payment.api.TransactionType.value_of( @transaction_type.to_s ) unless @transaction_type.nil?
96
+
97
+ # conversion for amount [type = java.math.BigDecimal]
98
+ if @amount.nil?
99
+ @amount = java.math.BigDecimal::ZERO
100
+ else
101
+ @amount = java.math.BigDecimal.new(@amount.to_s)
102
+ end
103
+
104
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
105
+ @currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @currency.to_s ) unless @currency.nil?
106
+
107
+ # conversion for payment_method_id [type = java.util.UUID]
108
+ @payment_method_id = java.util.UUID.fromString(@payment_method_id.to_s) unless @payment_method_id.nil?
109
+
110
+ # conversion for processed_amount [type = java.math.BigDecimal]
111
+ if @processed_amount.nil?
112
+ @processed_amount = java.math.BigDecimal::ZERO
113
+ else
114
+ @processed_amount = java.math.BigDecimal.new(@processed_amount.to_s)
115
+ end
116
+
117
+ # conversion for processed_currency [type = org.killbill.billing.catalog.api.Currency]
118
+ @processed_currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @processed_currency.to_s ) unless @processed_currency.nil?
119
+
120
+ # conversion for is_api_payment [type = boolean]
121
+ @is_api_payment = @is_api_payment.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(@is_api_payment)
122
+
123
+ # conversion for plugin_properties [type = java.lang.Iterable]
124
+ tmp = java.util.ArrayList.new
125
+ (@plugin_properties || []).each do |m|
126
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
127
+ m = m.to_java unless m.nil?
128
+ tmp.add(m)
129
+ end
130
+ @plugin_properties = tmp
131
+ self
132
+ end
133
+
134
+ def to_ruby(j_obj)
135
+ # conversion for user_token [type = java.util.UUID]
136
+ @user_token = j_obj.user_token
137
+ @user_token = @user_token.nil? ? nil : @user_token.to_s
138
+
139
+ # conversion for user_name [type = java.lang.String]
140
+ @user_name = j_obj.user_name
141
+
142
+ # conversion for call_origin [type = org.killbill.billing.util.callcontext.CallOrigin]
143
+ @call_origin = j_obj.call_origin
144
+ @call_origin = @call_origin.to_s.to_sym unless @call_origin.nil?
145
+
146
+ # conversion for user_type [type = org.killbill.billing.util.callcontext.UserType]
147
+ @user_type = j_obj.user_type
148
+ @user_type = @user_type.to_s.to_sym unless @user_type.nil?
149
+
150
+ # conversion for reason_code [type = java.lang.String]
151
+ @reason_code = j_obj.reason_code
152
+
153
+ # conversion for comments [type = java.lang.String]
154
+ @comments = j_obj.comments
155
+
156
+ # conversion for created_date [type = org.joda.time.DateTime]
157
+ @created_date = j_obj.created_date
158
+ if !@created_date.nil?
159
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
160
+ str = fmt.print(@created_date)
161
+ @created_date = DateTime.iso8601(str)
162
+ end
163
+
164
+ # conversion for updated_date [type = org.joda.time.DateTime]
165
+ @updated_date = j_obj.updated_date
166
+ if !@updated_date.nil?
167
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
168
+ str = fmt.print(@updated_date)
169
+ @updated_date = DateTime.iso8601(str)
170
+ end
171
+
172
+ # conversion for tenant_id [type = java.util.UUID]
173
+ @tenant_id = j_obj.tenant_id
174
+ @tenant_id = @tenant_id.nil? ? nil : @tenant_id.to_s
175
+
176
+ # conversion for account_id [type = java.util.UUID]
177
+ @account_id = j_obj.account_id
178
+ @account_id = @account_id.nil? ? nil : @account_id.to_s
179
+
180
+ # conversion for payment_id [type = java.util.UUID]
181
+ @payment_id = j_obj.payment_id
182
+ @payment_id = @payment_id.nil? ? nil : @payment_id.to_s
183
+
184
+ # conversion for attempt_payment_id [type = java.util.UUID]
185
+ @attempt_payment_id = j_obj.attempt_payment_id
186
+ @attempt_payment_id = @attempt_payment_id.nil? ? nil : @attempt_payment_id.to_s
187
+
188
+ # conversion for payment_external_key [type = java.lang.String]
189
+ @payment_external_key = j_obj.payment_external_key
190
+
191
+ # conversion for transaction_id [type = java.util.UUID]
192
+ @transaction_id = j_obj.transaction_id
193
+ @transaction_id = @transaction_id.nil? ? nil : @transaction_id.to_s
194
+
195
+ # conversion for transaction_external_key [type = java.lang.String]
196
+ @transaction_external_key = j_obj.transaction_external_key
197
+
198
+ # conversion for transaction_type [type = org.killbill.billing.payment.api.TransactionType]
199
+ @transaction_type = j_obj.transaction_type
200
+ @transaction_type = @transaction_type.to_s.to_sym unless @transaction_type.nil?
201
+
202
+ # conversion for amount [type = java.math.BigDecimal]
203
+ @amount = j_obj.amount
204
+ @amount = @amount.nil? ? 0 : BigDecimal.new(@amount.to_s)
205
+
206
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
207
+ @currency = j_obj.currency
208
+ @currency = @currency.to_s.to_sym unless @currency.nil?
209
+
210
+ # conversion for payment_method_id [type = java.util.UUID]
211
+ @payment_method_id = j_obj.payment_method_id
212
+ @payment_method_id = @payment_method_id.nil? ? nil : @payment_method_id.to_s
213
+
214
+ # conversion for processed_amount [type = java.math.BigDecimal]
215
+ @processed_amount = j_obj.processed_amount
216
+ @processed_amount = @processed_amount.nil? ? 0 : BigDecimal.new(@processed_amount.to_s)
217
+
218
+ # conversion for processed_currency [type = org.killbill.billing.catalog.api.Currency]
219
+ @processed_currency = j_obj.processed_currency
220
+ @processed_currency = @processed_currency.to_s.to_sym unless @processed_currency.nil?
221
+
222
+ # conversion for is_api_payment [type = boolean]
223
+ @is_api_payment = j_obj.is_api_payment
224
+ if @is_api_payment.nil?
225
+ @is_api_payment = false
226
+ else
227
+ tmp_bool = (@is_api_payment.java_kind_of? java.lang.Boolean) ? @is_api_payment.boolean_value : @is_api_payment
228
+ @is_api_payment = tmp_bool ? true : false
229
+ end
230
+
231
+ # conversion for plugin_properties [type = java.lang.Iterable]
232
+ @plugin_properties = j_obj.plugin_properties
233
+ tmp = []
234
+ (@plugin_properties.nil? ? [] : @plugin_properties.iterator).each do |m|
235
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
236
+ m = Killbill::Plugin::Model::PluginProperty.new.to_ruby(m) unless m.nil?
237
+ tmp << m
238
+ end
239
+ @plugin_properties = tmp
240
+ self
241
+ end
242
+
243
+ end
244
+ end
245
+ end
246
+ end
@@ -0,0 +1,138 @@
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.routing.plugin.api'
34
+ class PaymentRoutingPluginApi < NotificationPluginApi
35
+
36
+ include org.killbill.billing.routing.plugin.api.PaymentRoutingPluginApi
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.routing.plugin.api.PriorPaymentRoutingResult priorCall(Java::org.killbill.billing.routing.plugin.api.PaymentRoutingContext, Java::java.lang.Iterable)'
44
+ def prior_call(context, properties)
45
+
46
+ # conversion for context [type = org.killbill.billing.routing.plugin.api.PaymentRoutingContext]
47
+ context = Killbill::Plugin::Model::PaymentRoutingContext.new.to_ruby(context) unless context.nil?
48
+
49
+ # conversion for properties [type = java.lang.Iterable]
50
+ tmp = []
51
+ (properties.nil? ? [] : properties.iterator).each do |m|
52
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
53
+ m = Killbill::Plugin::Model::PluginProperty.new.to_ruby(m) unless m.nil?
54
+ tmp << m
55
+ end
56
+ properties = tmp
57
+ begin
58
+ res = @delegate_plugin.prior_call(context, properties)
59
+ # conversion for res [type = org.killbill.billing.routing.plugin.api.PriorPaymentRoutingResult]
60
+ res = res.to_java unless res.nil?
61
+ return res
62
+ rescue Exception => e
63
+ message = "Failure in prior_call: #{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("prior_call failure", e.message)
69
+ ensure
70
+ @delegate_plugin.after_request
71
+ end
72
+ end
73
+
74
+ java_signature 'Java::org.killbill.billing.routing.plugin.api.OnSuccessPaymentRoutingResult onSuccessCall(Java::org.killbill.billing.routing.plugin.api.PaymentRoutingContext, Java::java.lang.Iterable)'
75
+ def on_success_call(context, properties)
76
+
77
+ # conversion for context [type = org.killbill.billing.routing.plugin.api.PaymentRoutingContext]
78
+ context = Killbill::Plugin::Model::PaymentRoutingContext.new.to_ruby(context) unless context.nil?
79
+
80
+ # conversion for properties [type = java.lang.Iterable]
81
+ tmp = []
82
+ (properties.nil? ? [] : properties.iterator).each do |m|
83
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
84
+ m = Killbill::Plugin::Model::PluginProperty.new.to_ruby(m) unless m.nil?
85
+ tmp << m
86
+ end
87
+ properties = tmp
88
+ begin
89
+ res = @delegate_plugin.on_success_call(context, properties)
90
+ # conversion for res [type = org.killbill.billing.routing.plugin.api.OnSuccessPaymentRoutingResult]
91
+ res = res.to_java unless res.nil?
92
+ return res
93
+ rescue Exception => e
94
+ message = "Failure in on_success_call: #{e}"
95
+ unless e.backtrace.nil?
96
+ message = "#{message}\n#{e.backtrace.join("\n")}"
97
+ end
98
+ logger.warn message
99
+ raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("on_success_call failure", e.message)
100
+ ensure
101
+ @delegate_plugin.after_request
102
+ end
103
+ end
104
+
105
+ java_signature 'Java::org.killbill.billing.routing.plugin.api.OnFailurePaymentRoutingResult onFailureCall(Java::org.killbill.billing.routing.plugin.api.PaymentRoutingContext, Java::java.lang.Iterable)'
106
+ def on_failure_call(context, properties)
107
+
108
+ # conversion for context [type = org.killbill.billing.routing.plugin.api.PaymentRoutingContext]
109
+ context = Killbill::Plugin::Model::PaymentRoutingContext.new.to_ruby(context) unless context.nil?
110
+
111
+ # conversion for properties [type = java.lang.Iterable]
112
+ tmp = []
113
+ (properties.nil? ? [] : properties.iterator).each do |m|
114
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
115
+ m = Killbill::Plugin::Model::PluginProperty.new.to_ruby(m) unless m.nil?
116
+ tmp << m
117
+ end
118
+ properties = tmp
119
+ begin
120
+ res = @delegate_plugin.on_failure_call(context, properties)
121
+ # conversion for res [type = org.killbill.billing.routing.plugin.api.OnFailurePaymentRoutingResult]
122
+ res = res.to_java unless res.nil?
123
+ return res
124
+ rescue Exception => e
125
+ message = "Failure in on_failure_call: #{e}"
126
+ unless e.backtrace.nil?
127
+ message = "#{message}\n#{e.backtrace.join("\n")}"
128
+ end
129
+ logger.warn message
130
+ raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("on_failure_call failure", e.message)
131
+ ensure
132
+ @delegate_plugin.after_request
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end