killbill 1.0.19 → 1.1.1
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/Jarfile +4 -2
- data/VERSION +1 -1
- data/killbill.gemspec +4 -3
- data/lib/killbill.rb +7 -51
- data/lib/killbill/creator.rb +10 -18
- data/lib/killbill/gen/account.rb +208 -27
- data/lib/killbill/gen/account_api_exception.rb +66 -0
- data/lib/killbill/gen/account_data.rb +166 -23
- data/lib/killbill/gen/account_email.rb +80 -8
- data/lib/killbill/gen/account_service.rb +55 -0
- data/lib/killbill/gen/account_user_api.rb +187 -0
- data/lib/killbill/gen/audit_user_api.rb +196 -0
- data/lib/killbill/gen/beatrix_service.rb +55 -0
- data/lib/killbill/gen/billing_exception_base.rb +66 -0
- data/lib/killbill/gen/blockable.rb +91 -0
- data/lib/killbill/gen/blocking_api_exception.rb +66 -0
- data/lib/killbill/gen/blocking_state.rb +150 -16
- data/lib/killbill/gen/call_context.rb +107 -13
- data/lib/killbill/gen/catalog.rb +76 -0
- data/lib/killbill/gen/catalog_api_exception.rb +66 -0
- data/lib/killbill/gen/catalog_service.rb +69 -0
- data/lib/killbill/gen/catalog_user_api.rb +54 -0
- data/lib/killbill/gen/column_info.rb +67 -0
- data/lib/killbill/gen/control_tag.rb +112 -0
- data/lib/killbill/gen/currency_value_null.rb +66 -0
- data/lib/killbill/gen/custom_field.rb +93 -10
- data/lib/killbill/gen/custom_field_api_exception.rb +66 -0
- data/lib/killbill/gen/custom_field_user_api.rb +115 -0
- data/lib/killbill/gen/database_export_output_stream.rb +51 -0
- data/lib/killbill/gen/default_mutable_account_data.rb +180 -0
- data/lib/killbill/gen/duration.rb +62 -0
- data/lib/killbill/gen/entitlement_service.rb +55 -0
- data/lib/killbill/gen/entitlement_user_api.rb +272 -0
- data/lib/killbill/gen/entitlement_user_api_exception.rb +66 -0
- data/lib/killbill/gen/entity.rb +84 -0
- data/lib/killbill/gen/entity_persistence_exception.rb +66 -0
- data/lib/killbill/gen/export_user_api.rb +17 -0
- data/lib/killbill/gen/ext_bus_event.rb +68 -9
- data/lib/killbill/gen/external_bus.rb +51 -0
- data/lib/killbill/gen/illegal_plan_change.rb +66 -0
- data/lib/killbill/gen/international_price.rb +79 -0
- data/lib/killbill/gen/invalid_config_exception.rb +49 -0
- data/lib/killbill/gen/invoice.rb +238 -23
- data/lib/killbill/gen/invoice_api_exception.rb +66 -0
- data/lib/killbill/gen/invoice_creation_event.rb +51 -0
- data/lib/killbill/gen/invoice_item.rb +179 -21
- data/lib/killbill/gen/invoice_migration_api.rb +66 -0
- data/lib/killbill/gen/invoice_notifier.rb +51 -0
- data/lib/killbill/gen/invoice_payment.rb +135 -15
- data/lib/killbill/gen/invoice_payment_api.rb +208 -0
- data/lib/killbill/gen/invoice_service.rb +55 -0
- data/lib/killbill/gen/invoice_user_api.rb +461 -0
- data/lib/killbill/gen/junction_api.rb +60 -0
- data/lib/killbill/gen/limit.rb +68 -0
- data/lib/killbill/gen/listing.rb +63 -0
- data/lib/killbill/gen/migration_account_data.rb +228 -0
- data/lib/killbill/gen/migration_plan.rb +143 -0
- data/lib/killbill/gen/mutable_account_data.rb +182 -0
- data/lib/killbill/gen/no_op_payment_plugin_api.rb +254 -0
- data/lib/killbill/gen/payment.rb +183 -20
- data/lib/killbill/gen/payment_api.rb +433 -0
- data/lib/killbill/gen/payment_api_exception.rb +66 -0
- data/lib/killbill/gen/payment_attempt.rb +100 -10
- data/lib/killbill/gen/payment_info_plugin.rb +103 -12
- data/lib/killbill/gen/payment_method.rb +116 -0
- data/lib/killbill/gen/payment_method_info_plugin.rb +64 -7
- data/lib/killbill/gen/payment_method_kv_info.rb +56 -6
- data/lib/killbill/gen/payment_method_plugin.rb +142 -20
- data/lib/killbill/gen/payment_plugin_api.rb +232 -0
- data/lib/killbill/gen/payment_plugin_api_exception.rb +59 -0
- data/lib/killbill/gen/payment_service.rb +62 -0
- data/lib/killbill/gen/plan.rb +143 -0
- data/lib/killbill/gen/plan_change_result.rb +68 -0
- data/lib/killbill/gen/plan_phase.rb +104 -0
- data/lib/killbill/gen/plan_phase_specifier.rb +80 -0
- data/lib/killbill/gen/plan_specifier.rb +73 -0
- data/lib/killbill/gen/price.rb +67 -0
- data/lib/killbill/gen/price_list.rb +74 -0
- data/lib/killbill/gen/price_list_set.rb +56 -0
- data/lib/killbill/gen/product.rb +101 -0
- data/lib/killbill/gen/record_id_api.rb +55 -0
- data/lib/killbill/gen/refund.rb +126 -13
- data/lib/killbill/gen/refund_info_plugin.rb +96 -10
- data/lib/killbill/gen/require_gen.rb +97 -15
- data/lib/killbill/gen/static_catalog.rb +137 -0
- data/lib/killbill/gen/subscription.rb +258 -28
- data/lib/killbill/gen/subscription_bundle.rb +94 -10
- data/lib/killbill/gen/subscription_status_dry_run.rb +89 -0
- data/lib/killbill/gen/subscription_transition.rb +196 -0
- data/lib/killbill/gen/tag.rb +88 -9
- data/lib/killbill/gen/tag_api_exception.rb +66 -0
- data/lib/killbill/gen/tag_definition.rb +110 -10
- data/lib/killbill/gen/tag_definition_api_exception.rb +66 -0
- data/lib/killbill/gen/tag_user_api.rb +239 -0
- data/lib/killbill/gen/tenant.rb +102 -0
- data/lib/killbill/gen/tenant_api_exception.rb +66 -0
- data/lib/killbill/gen/tenant_context.rb +39 -4
- data/lib/killbill/gen/tenant_data.rb +67 -0
- data/lib/killbill/gen/tenant_kv.rb +96 -0
- data/lib/killbill/gen/tenant_service.rb +55 -0
- data/lib/killbill/gen/tenant_user_api.rb +127 -0
- data/lib/killbill/gen/unit.rb +55 -0
- data/lib/killbill/jnotification.rb +1 -1
- data/lib/killbill/jpayment.rb +10 -7
- data/lib/killbill/jplugin.rb +63 -61
- data/lib/killbill/killbill_api.rb +42 -9
- data/spec/killbill/jnotification_spec.rb +15 -1
- data/spec/killbill/jpayment_spec.rb +12 -8
- data/spec/killbill/killbillapi_spec.rb +23 -21
- data/spec/killbill/payment_plugin_spec.rb +1 -9
- data/spec/killbill/payment_test.rb +21 -5
- metadata +96 -22
- data/lib/killbill/gen/audit_log.rb +0 -28
- data/lib/killbill/gen/call_origin.rb +0 -34
- data/lib/killbill/gen/currency.rb +0 -34
- data/lib/killbill/gen/date_time_zone.rb +0 -35
- data/lib/killbill/gen/ext_bus_event_type.rb +0 -34
- data/lib/killbill/gen/invoice_payment_type.rb +0 -34
- data/lib/killbill/gen/object_type.rb +0 -34
- data/lib/killbill/gen/payment_plugin_status.rb +0 -34
- data/lib/killbill/gen/refund_plugin_status.rb +0 -34
- data/lib/killbill/gen/subscription_source_type.rb +0 -34
- data/lib/killbill/gen/subscription_state.rb +0 -34
- data/lib/killbill/gen/user_type.rb +0 -34
- data/lib/killbill/gen/uuid.rb +0 -22
- data/lib/killbill/jconverter.rb +0 -537
- data/lib/killbill/jkillbill_api.rb +0 -137
- data/spec/killbill/jconverter_spec.rb +0 -193
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
###################################################################################
|
|
2
|
+
# #
|
|
3
|
+
# Copyright 2010-2013 Ning, Inc. #
|
|
4
|
+
# #
|
|
5
|
+
# Ning licenses this file to you under the Apache License, version 2.0 #
|
|
6
|
+
# (the "License"); you may not use this file except in compliance with the #
|
|
7
|
+
# License. You may obtain a copy of the License at: #
|
|
8
|
+
# #
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
10
|
+
# #
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software #
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
|
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
|
|
14
|
+
# License for the specific language governing permissions and limitations #
|
|
15
|
+
# under the License. #
|
|
16
|
+
# #
|
|
17
|
+
###################################################################################
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
#
|
|
21
|
+
# DO NOT EDIT!!!
|
|
22
|
+
# File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
|
|
23
|
+
#
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
module Killbill
|
|
27
|
+
module Plugin
|
|
28
|
+
module Api
|
|
29
|
+
|
|
30
|
+
java_package 'com.ning.billing.tenant.api'
|
|
31
|
+
class TenantUserApi
|
|
32
|
+
|
|
33
|
+
include com.ning.billing.tenant.api.TenantUserApi
|
|
34
|
+
|
|
35
|
+
def initialize(real_java_api)
|
|
36
|
+
@real_java_api = real_java_api
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
java_signature 'Java::com.ning.billing.tenant.api.Tenant createTenant(Java::com.ning.billing.tenant.api.TenantData, Java::com.ning.billing.util.callcontext.CallContext)'
|
|
41
|
+
def create_tenant(data, context)
|
|
42
|
+
# conversion for data [type = com.ning.billing.tenant.api.TenantData]
|
|
43
|
+
data = data.to_java unless data.nil?
|
|
44
|
+
# conversion for context [type = com.ning.billing.util.callcontext.CallContext]
|
|
45
|
+
context = context.to_java unless context.nil?
|
|
46
|
+
begin
|
|
47
|
+
res = @real_java_api.create_tenant(data, context)
|
|
48
|
+
# conversion for res [type = com.ning.billing.tenant.api.Tenant]
|
|
49
|
+
res = Killbill::Plugin::Model::Tenant.new.to_ruby(res) unless res.nil?
|
|
50
|
+
return res
|
|
51
|
+
rescue Java::com.ning.billing.tenant.api.TenantApiException => e
|
|
52
|
+
raise Killbill::Plugin::Model::TenantApiException.new.to_ruby(e)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
java_signature 'Java::com.ning.billing.tenant.api.Tenant getTenantByApiKey(Java::java.lang.String)'
|
|
57
|
+
def get_tenant_by_api_key(key)
|
|
58
|
+
# conversion for key [type = java.lang.String]
|
|
59
|
+
key = key.to_s unless key.nil?
|
|
60
|
+
begin
|
|
61
|
+
res = @real_java_api.get_tenant_by_api_key(key)
|
|
62
|
+
# conversion for res [type = com.ning.billing.tenant.api.Tenant]
|
|
63
|
+
res = Killbill::Plugin::Model::Tenant.new.to_ruby(res) unless res.nil?
|
|
64
|
+
return res
|
|
65
|
+
rescue Java::com.ning.billing.tenant.api.TenantApiException => e
|
|
66
|
+
raise Killbill::Plugin::Model::TenantApiException.new.to_ruby(e)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
java_signature 'Java::com.ning.billing.tenant.api.Tenant getTenantById(Java::java.util.UUID)'
|
|
71
|
+
def get_tenant_by_id(tenantId)
|
|
72
|
+
# conversion for tenantId [type = java.util.UUID]
|
|
73
|
+
tenantId = java.util.UUID.fromString(tenantId.to_s) unless tenantId.nil?
|
|
74
|
+
begin
|
|
75
|
+
res = @real_java_api.get_tenant_by_id(tenantId)
|
|
76
|
+
# conversion for res [type = com.ning.billing.tenant.api.Tenant]
|
|
77
|
+
res = Killbill::Plugin::Model::Tenant.new.to_ruby(res) unless res.nil?
|
|
78
|
+
return res
|
|
79
|
+
rescue Java::com.ning.billing.tenant.api.TenantApiException => e
|
|
80
|
+
raise Killbill::Plugin::Model::TenantApiException.new.to_ruby(e)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
java_signature 'Java::java.util.List getTenantValueForKey(Java::java.lang.String, Java::com.ning.billing.util.callcontext.TenantContext)'
|
|
85
|
+
def get_tenant_value_for_key(key, context)
|
|
86
|
+
# conversion for key [type = java.lang.String]
|
|
87
|
+
key = key.to_s unless key.nil?
|
|
88
|
+
# conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
|
|
89
|
+
context = context.to_java unless context.nil?
|
|
90
|
+
begin
|
|
91
|
+
res = @real_java_api.get_tenant_value_for_key(key, context)
|
|
92
|
+
# conversion for res [type = java.util.List]
|
|
93
|
+
tmp = []
|
|
94
|
+
(res || []).each do |m|
|
|
95
|
+
# conversion for m [type = java.lang.String]
|
|
96
|
+
tmp << m
|
|
97
|
+
end
|
|
98
|
+
res = tmp
|
|
99
|
+
return res
|
|
100
|
+
rescue Java::com.ning.billing.tenant.api.TenantApiException => e
|
|
101
|
+
raise Killbill::Plugin::Model::TenantApiException.new.to_ruby(e)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
java_signature 'Java::void addTenantKeyValue(Java::java.lang.String, Java::java.lang.String, Java::com.ning.billing.util.callcontext.CallContext)'
|
|
106
|
+
def add_tenant_key_value(key, value, context)
|
|
107
|
+
# conversion for key [type = java.lang.String]
|
|
108
|
+
key = key.to_s unless key.nil?
|
|
109
|
+
# conversion for value [type = java.lang.String]
|
|
110
|
+
value = value.to_s unless value.nil?
|
|
111
|
+
# conversion for context [type = com.ning.billing.util.callcontext.CallContext]
|
|
112
|
+
context = context.to_java unless context.nil?
|
|
113
|
+
@real_java_api.add_tenant_key_value(key, value, context)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
java_signature 'Java::void deleteTenantKey(Java::java.lang.String, Java::com.ning.billing.util.callcontext.CallContext)'
|
|
117
|
+
def delete_tenant_key(key, context)
|
|
118
|
+
# conversion for key [type = java.lang.String]
|
|
119
|
+
key = key.to_s unless key.nil?
|
|
120
|
+
# conversion for context [type = com.ning.billing.util.callcontext.CallContext]
|
|
121
|
+
context = context.to_java unless context.nil?
|
|
122
|
+
@real_java_api.delete_tenant_key(key, context)
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
###################################################################################
|
|
2
|
+
# #
|
|
3
|
+
# Copyright 2010-2013 Ning, Inc. #
|
|
4
|
+
# #
|
|
5
|
+
# Ning licenses this file to you under the Apache License, version 2.0 #
|
|
6
|
+
# (the "License"); you may not use this file except in compliance with the #
|
|
7
|
+
# License. You may obtain a copy of the License at: #
|
|
8
|
+
# #
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
10
|
+
# #
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software #
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
|
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
|
|
14
|
+
# License for the specific language governing permissions and limitations #
|
|
15
|
+
# under the License. #
|
|
16
|
+
# #
|
|
17
|
+
###################################################################################
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
#
|
|
21
|
+
# DO NOT EDIT!!!
|
|
22
|
+
# File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
|
|
23
|
+
#
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
module Killbill
|
|
27
|
+
module Plugin
|
|
28
|
+
module Model
|
|
29
|
+
|
|
30
|
+
java_package 'com.ning.billing.catalog.api'
|
|
31
|
+
class Unit
|
|
32
|
+
|
|
33
|
+
include com.ning.billing.catalog.api.Unit
|
|
34
|
+
|
|
35
|
+
attr_accessor :name
|
|
36
|
+
|
|
37
|
+
def initialize()
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def to_java()
|
|
41
|
+
# conversion for name [type = java.lang.String]
|
|
42
|
+
@name = @name.to_s unless @name.nil?
|
|
43
|
+
self
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def to_ruby(j_obj)
|
|
47
|
+
# conversion for name [type = java.lang.String]
|
|
48
|
+
@name = j_obj.name
|
|
49
|
+
self
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -19,7 +19,7 @@ module Killbill
|
|
|
19
19
|
super(real_class_name, services)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
java_signature 'void onEvent(Java::com.ning.billing.
|
|
22
|
+
java_signature 'void onEvent(Java::com.ning.billing.notification.plugin.api.ExtBusEvent)'
|
|
23
23
|
def on_event(*args)
|
|
24
24
|
do_call_handle_exception(__method__, *args) do |res|
|
|
25
25
|
return nil
|
data/lib/killbill/jpayment.rb
CHANGED
|
@@ -4,7 +4,6 @@ require 'singleton'
|
|
|
4
4
|
|
|
5
5
|
require 'killbill/creator'
|
|
6
6
|
require 'killbill/plugin'
|
|
7
|
-
require 'killbill/jconverter'
|
|
8
7
|
|
|
9
8
|
include Java
|
|
10
9
|
|
|
@@ -24,21 +23,24 @@ module Killbill
|
|
|
24
23
|
java_signature 'com.ning.billing.payment.plugin.api.PaymentInfoPlugin processPayment(java.util.UUID, java.util.UUID, java.util.UUID, java.lang.BigDecimal, com.ning.billing.catalog.api.Currency, com.ning.billing.util.callcontext.CallContext)'
|
|
25
24
|
def process_payment(*args)
|
|
26
25
|
do_call_handle_exception(__method__, *args) do |res|
|
|
27
|
-
|
|
26
|
+
res.to_java
|
|
27
|
+
return res
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
java_signature 'Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin getPaymentInfo(java.util.UUID, java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
|
|
32
32
|
def get_payment_info(*args)
|
|
33
33
|
do_call_handle_exception(__method__, *args) do |res|
|
|
34
|
-
|
|
34
|
+
res.to_java
|
|
35
|
+
return res
|
|
35
36
|
end
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
java_signature 'Java::com.ning.billing.payment.plugin.api.RefundInfoPlugin processRefund(java.util.UUID, java.util.UUID, java.lang.BigDecimal, com.ning.billing.catalog.api.Currency, Java::com.ning.billing.util.callcontext.CallContext)'
|
|
39
40
|
def process_refund(*args)
|
|
40
41
|
do_call_handle_exception(__method__, *args) do |res|
|
|
41
|
-
|
|
42
|
+
res.to_java
|
|
43
|
+
return res
|
|
42
44
|
end
|
|
43
45
|
end
|
|
44
46
|
|
|
@@ -47,7 +49,7 @@ module Killbill
|
|
|
47
49
|
do_call_handle_exception(__method__, *args) do |res|
|
|
48
50
|
array_res = java.util.ArrayList.new
|
|
49
51
|
res.each do |el|
|
|
50
|
-
array_res.add(
|
|
52
|
+
array_res.add(el.to_java)
|
|
51
53
|
end
|
|
52
54
|
return array_res
|
|
53
55
|
end
|
|
@@ -70,7 +72,8 @@ module Killbill
|
|
|
70
72
|
java_signature 'Java::com.ning.billing.payment.api.PaymentMethodPlugin getPaymentMethodDetail(java.util.UUID, java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
|
|
71
73
|
def get_payment_method_detail(*args)
|
|
72
74
|
do_call_handle_exception(__method__, *args) do |res|
|
|
73
|
-
|
|
75
|
+
res.to_java
|
|
76
|
+
return res
|
|
74
77
|
end
|
|
75
78
|
end
|
|
76
79
|
|
|
@@ -86,7 +89,7 @@ module Killbill
|
|
|
86
89
|
do_call_handle_exception(__method__, *args) do |res|
|
|
87
90
|
array_res = java.util.ArrayList.new
|
|
88
91
|
res.each do |el|
|
|
89
|
-
array_res.add(
|
|
92
|
+
array_res.add(el.to_java)
|
|
90
93
|
end
|
|
91
94
|
return array_res
|
|
92
95
|
end
|
data/lib/killbill/jplugin.rb
CHANGED
|
@@ -65,67 +65,69 @@ module Killbill
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def do_call_handle_exception(method_name, *args)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
68
|
+
begin
|
|
69
|
+
rargs = convert_args(method_name, args)
|
|
70
|
+
res = @delegate_plugin.send(method_name.to_s.snake_case.to_sym, *rargs)
|
|
71
|
+
yield(res)
|
|
72
|
+
rescue Exception => e
|
|
73
|
+
wrap_and_throw_exception(method_name, e)
|
|
74
|
+
ensure
|
|
75
|
+
@delegate_plugin.after_request
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def wrap_and_throw_exception(api, e)
|
|
80
|
+
message = "#{api} failure: #{e}"
|
|
81
|
+
unless e.backtrace.nil?
|
|
82
|
+
message = "#{message}\n#{e.backtrace.join("\n")}"
|
|
83
|
+
end
|
|
84
|
+
logger.warn message
|
|
85
|
+
raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("#{api} failure", e.message)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def convert_args(api, args)
|
|
89
|
+
args.collect! do |a|
|
|
90
|
+
if a.nil?
|
|
91
|
+
nil
|
|
92
|
+
elsif a.java_kind_of? java.util.UUID
|
|
93
|
+
a.nil? ? nil : a.to_s
|
|
94
|
+
elsif a.java_kind_of? java.math.BigDecimal
|
|
95
|
+
a.nil? ? 0 : a.to_s.to_i
|
|
96
|
+
elsif a.java_kind_of? Java::com.ning.billing.catalog.api.Currency
|
|
97
|
+
a.to_string
|
|
98
|
+
elsif a.java_kind_of? Java::com.ning.billing.payment.api.PaymentMethodPlugin
|
|
99
|
+
Killbill::Plugin::Model::PaymentMethodPlugin.new.to_ruby(a)
|
|
100
|
+
elsif a.java_kind_of? Java::com.ning.billing.notification.plugin.api.ExtBusEvent
|
|
101
|
+
Killbill::Plugin::Model::ExtBusEvent.new.to_ruby(a)
|
|
102
|
+
elsif ((a.java_kind_of? Java::boolean) || (a.java_kind_of? java.lang.Boolean))
|
|
103
|
+
elsif ((a.java_kind_of? TrueClass) || (a.java_kind_of? FalseClass))
|
|
104
|
+
if a.nil?
|
|
105
|
+
false
|
|
106
|
+
else
|
|
107
|
+
b_value = (a.java_kind_of? java.lang.Boolean) ? a.boolean_value : a
|
|
108
|
+
b_value ? true : false
|
|
109
|
+
end
|
|
110
|
+
elsif a.java_kind_of? java.util.List
|
|
111
|
+
result = Array.new
|
|
112
|
+
if a.size > 0
|
|
113
|
+
first_element = a.get(0)
|
|
114
|
+
if first_element.java_kind_of? Java::com.ning.billing.payment.plugin.api.PaymentMethodInfoPlugin
|
|
115
|
+
a.each do |el|
|
|
116
|
+
result << Killbill::Plugin::Model::PaymentMethodInfoPlugin.new.to_ruby(el)
|
|
117
|
+
end
|
|
118
|
+
else
|
|
119
|
+
raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("#{api} failure", "Unexpected parameter type #{first_element.class} for list")
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
result
|
|
123
|
+
elsif a.java_kind_of? Java::com.ning.billing.util.callcontext.CallContext
|
|
124
|
+
Killbill::Plugin::Model::CallContext.new.to_ruby(a)
|
|
125
|
+
elsif a.java_kind_of? Java::com.ning.billing.util.callcontext.TenantContext
|
|
126
|
+
Killbill::Plugin::Model::TenantContext.new.to_ruby(a)
|
|
127
|
+
else
|
|
128
|
+
# Since we don't pass the Context at this point, we can't raise any exceptions for unexpected types.
|
|
129
|
+
raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("#{api} failure", "Unexpected parameter type #{a.class}")
|
|
130
|
+
end
|
|
129
131
|
end
|
|
130
132
|
# Remove last argument if this is null (it means we passed a context)
|
|
131
133
|
#args.delete_at(-1) if args[-1].nil?
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
require 'date'
|
|
2
2
|
|
|
3
3
|
module Killbill
|
|
4
4
|
module Plugin
|
|
@@ -8,21 +8,54 @@ module Killbill
|
|
|
8
8
|
#
|
|
9
9
|
class KillbillApi
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
def initialize(plugin_name, java_service_map)
|
|
12
|
+
@plugin_name = plugin_name
|
|
13
|
+
@services = {}
|
|
14
|
+
puts "STEPH ::::::::::::::::: #{java_service_map.inspect}"
|
|
15
|
+
java_service_map.each do |k,v|
|
|
16
|
+
@services[k.to_sym] = create_proxy_api(k, v)
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
19
|
|
|
20
|
+
#
|
|
21
|
+
# Returns the proxy to the java api
|
|
22
|
+
#
|
|
19
23
|
def method_missing(m, *args, &block)
|
|
20
|
-
|
|
21
|
-
puts "
|
|
22
|
-
|
|
24
|
+
|
|
25
|
+
puts "Looking for api #{m}"
|
|
26
|
+
|
|
27
|
+
return @services[m.to_sym] if @services.include? m.to_sym
|
|
23
28
|
raise NoMethodError.new("undefined method `#{m}' for #{self}")
|
|
24
29
|
end
|
|
25
30
|
|
|
31
|
+
|
|
32
|
+
def create_context(tenant_id=nil, user_token=nil, reason_code=nil, comments=nil)
|
|
33
|
+
context = Killbill::Plugin::Model::CallContext.new
|
|
34
|
+
context.tenant_id= tenant_id
|
|
35
|
+
context.user_token= user_token
|
|
36
|
+
context.user_name= @plugin_name
|
|
37
|
+
context.call_origin= :EXTERNAL
|
|
38
|
+
context.user_type= :SYSTEM
|
|
39
|
+
context.reason_code= reason_code
|
|
40
|
+
context.comments= comments
|
|
41
|
+
context.created_date= DateTime.new
|
|
42
|
+
context.updated_date= DateTime.new
|
|
43
|
+
context
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def create_proxy_api(api_name, java_api)
|
|
49
|
+
if api_name == "overdue_user_api"
|
|
50
|
+
return nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
puts "create_proxy_api #{api_name} #{java_api.inspect}"
|
|
54
|
+
|
|
55
|
+
proxy_class_name = "Killbill::Plugin::Api::#{api_name.to_s.split('_').map{|e| e.capitalize}.join}"
|
|
56
|
+
proxy_class_name.to_class.new(java_api)
|
|
57
|
+
end
|
|
58
|
+
|
|
26
59
|
end
|
|
27
60
|
end
|
|
28
61
|
end
|