killbill 1.1.2 → 1.2.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 (123) hide show
  1. data/VERSION +1 -1
  2. data/gen_config/api.conf +42 -0
  3. data/gen_config/plugin_api.conf +14 -0
  4. data/lib/killbill.rb +3 -3
  5. data/lib/killbill/gen/{account.rb → api/account.rb} +0 -0
  6. data/lib/killbill/gen/{account_api_exception.rb → api/account_api_exception.rb} +0 -0
  7. data/lib/killbill/gen/{account_data.rb → api/account_data.rb} +0 -0
  8. data/lib/killbill/gen/{account_email.rb → api/account_email.rb} +0 -0
  9. data/lib/killbill/gen/{account_user_api.rb → api/account_user_api.rb} +19 -16
  10. data/lib/killbill/gen/{audit_user_api.rb → api/audit_user_api.rb} +25 -0
  11. data/lib/killbill/gen/{billing_exception_base.rb → api/billing_exception_base.rb} +0 -0
  12. data/lib/killbill/gen/{blockable.rb → api/blockable.rb} +0 -0
  13. data/lib/killbill/gen/{blocking_api_exception.rb → api/blocking_api_exception.rb} +0 -0
  14. data/lib/killbill/gen/{blocking_state.rb → api/blocking_state.rb} +0 -0
  15. data/lib/killbill/gen/{call_context.rb → api/call_context.rb} +0 -0
  16. data/lib/killbill/gen/{catalog.rb → api/catalog.rb} +0 -0
  17. data/lib/killbill/gen/{catalog_api_exception.rb → api/catalog_api_exception.rb} +0 -0
  18. data/lib/killbill/gen/{catalog_user_api.rb → api/catalog_user_api.rb} +2 -0
  19. data/lib/killbill/gen/{column_info.rb → api/column_info.rb} +0 -0
  20. data/lib/killbill/gen/{control_tag.rb → api/control_tag.rb} +0 -0
  21. data/lib/killbill/gen/{currency_value_null.rb → api/currency_value_null.rb} +0 -0
  22. data/lib/killbill/gen/{custom_field.rb → api/custom_field.rb} +0 -0
  23. data/lib/killbill/gen/{custom_field_api_exception.rb → api/custom_field_api_exception.rb} +0 -0
  24. data/lib/killbill/gen/{custom_field_user_api.rb → api/custom_field_user_api.rb} +10 -0
  25. data/lib/killbill/gen/{database_export_output_stream.rb → api/database_export_output_stream.rb} +0 -0
  26. data/lib/killbill/gen/{duration.rb → api/duration.rb} +0 -0
  27. data/lib/killbill/gen/{entitlement_user_api.rb → api/entitlement_user_api.rb} +31 -0
  28. data/lib/killbill/gen/{entitlement_user_api_exception.rb → api/entitlement_user_api_exception.rb} +0 -0
  29. data/lib/killbill/gen/{entity.rb → api/entity.rb} +0 -0
  30. data/lib/killbill/gen/{illegal_plan_change.rb → api/illegal_plan_change.rb} +0 -0
  31. data/lib/killbill/gen/{international_price.rb → api/international_price.rb} +2 -2
  32. data/lib/killbill/gen/{invalid_config_exception.rb → api/invalid_config_exception.rb} +0 -0
  33. data/lib/killbill/gen/{invoice.rb → api/invoice.rb} +12 -12
  34. data/lib/killbill/gen/{invoice_api_exception.rb → api/invoice_api_exception.rb} +0 -0
  35. data/lib/killbill/gen/{invoice_creation_event.rb → api/invoice_creation_event.rb} +0 -0
  36. data/lib/killbill/gen/api/invoice_formatter.rb +278 -0
  37. data/lib/killbill/gen/{invoice_item.rb → api/invoice_item.rb} +4 -4
  38. data/lib/killbill/gen/api/invoice_item_formatter.rb +213 -0
  39. data/lib/killbill/gen/{invoice_payment.rb → api/invoice_payment.rb} +2 -2
  40. data/lib/killbill/gen/{invoice_payment_api.rb → api/invoice_payment_api.rb} +23 -2
  41. data/lib/killbill/gen/{invoice_user_api.rb → api/invoice_user_api.rb} +85 -8
  42. data/lib/killbill/gen/{junction_api.rb → api/junction_api.rb} +2 -0
  43. data/lib/killbill/gen/{limit.rb → api/limit.rb} +0 -0
  44. data/lib/killbill/gen/{listing.rb → api/listing.rb} +0 -0
  45. data/lib/killbill/gen/{migration_plan.rb → api/migration_plan.rb} +0 -0
  46. data/lib/killbill/gen/{mutable_account_data.rb → api/mutable_account_data.rb} +0 -0
  47. data/lib/killbill/gen/api/osgi_killbill.rb +175 -0
  48. data/lib/killbill/gen/{external_bus.rb → api/osgi_plugin_properties.rb} +3 -3
  49. data/lib/killbill/gen/{payment.rb → api/payment.rb} +4 -4
  50. data/lib/killbill/gen/{payment_api.rb → api/payment_api.rb} +63 -4
  51. data/lib/killbill/gen/{payment_api_exception.rb → api/payment_api_exception.rb} +0 -0
  52. data/lib/killbill/gen/{payment_attempt.rb → api/payment_attempt.rb} +0 -0
  53. data/lib/killbill/gen/{payment_method.rb → api/payment_method.rb} +0 -0
  54. data/lib/killbill/gen/{payment_method_kv_info.rb → api/payment_method_kv_info.rb} +0 -0
  55. data/lib/killbill/gen/{payment_method_plugin.rb → api/payment_method_plugin.rb} +0 -0
  56. data/lib/killbill/gen/{plan.rb → api/plan.rb} +0 -0
  57. data/lib/killbill/gen/{plan_change_result.rb → api/plan_change_result.rb} +0 -0
  58. data/lib/killbill/gen/{plan_phase.rb → api/plan_phase.rb} +0 -0
  59. data/lib/killbill/gen/{plan_phase_specifier.rb → api/plan_phase_specifier.rb} +0 -0
  60. data/lib/killbill/gen/{plan_specifier.rb → api/plan_specifier.rb} +0 -0
  61. data/lib/killbill/gen/api/plugin_config_service_api.rb +64 -0
  62. data/lib/killbill/gen/{price.rb → api/price.rb} +2 -2
  63. data/lib/killbill/gen/{price_list.rb → api/price_list.rb} +0 -0
  64. data/lib/killbill/gen/{price_list_set.rb → api/price_list_set.rb} +0 -0
  65. data/lib/killbill/gen/{product.rb → api/product.rb} +0 -0
  66. data/lib/killbill/gen/{record_id_api.rb → api/record_id_api.rb} +3 -0
  67. data/lib/killbill/gen/{refund.rb → api/refund.rb} +2 -2
  68. data/lib/killbill/gen/api/require_gen.rb +107 -0
  69. data/lib/killbill/gen/api/rolled_up_usage.rb +101 -0
  70. data/lib/killbill/gen/{static_catalog.rb → api/static_catalog.rb} +0 -0
  71. data/lib/killbill/gen/{subscription.rb → api/subscription.rb} +0 -0
  72. data/lib/killbill/gen/{subscription_bundle.rb → api/subscription_bundle.rb} +0 -0
  73. data/lib/killbill/gen/{subscription_status_dry_run.rb → api/subscription_status_dry_run.rb} +0 -0
  74. data/lib/killbill/gen/{subscription_transition.rb → api/subscription_transition.rb} +0 -0
  75. data/lib/killbill/gen/{tag.rb → api/tag.rb} +0 -0
  76. data/lib/killbill/gen/{tag_api_exception.rb → api/tag_api_exception.rb} +0 -0
  77. data/lib/killbill/gen/{tag_definition.rb → api/tag_definition.rb} +0 -0
  78. data/lib/killbill/gen/{tag_definition_api_exception.rb → api/tag_definition_api_exception.rb} +0 -0
  79. data/lib/killbill/gen/{tag_user_api.rb → api/tag_user_api.rb} +34 -0
  80. data/lib/killbill/gen/{tenant.rb → api/tenant.rb} +0 -0
  81. data/lib/killbill/gen/{tenant_api_exception.rb → api/tenant_api_exception.rb} +0 -0
  82. data/lib/killbill/gen/{tenant_context.rb → api/tenant_context.rb} +0 -0
  83. data/lib/killbill/gen/{tenant_data.rb → api/tenant_data.rb} +0 -0
  84. data/lib/killbill/gen/{tenant_kv.rb → api/tenant_kv.rb} +0 -0
  85. data/lib/killbill/gen/{tenant_user_api.rb → api/tenant_user_api.rb} +11 -0
  86. data/lib/killbill/gen/{unit.rb → api/unit.rb} +0 -0
  87. data/lib/killbill/gen/api/usage_user_api.rb +89 -0
  88. data/lib/killbill/gen/{ext_bus_event.rb → plugin-api/ext_bus_event.rb} +0 -0
  89. data/lib/killbill/gen/plugin-api/notification_plugin_api.rb +61 -0
  90. data/lib/killbill/gen/{payment_info_plugin.rb → plugin-api/payment_info_plugin.rb} +2 -2
  91. data/lib/killbill/gen/{payment_method_info_plugin.rb → plugin-api/payment_method_info_plugin.rb} +0 -0
  92. data/lib/killbill/gen/plugin-api/payment_plugin_api.rb +356 -0
  93. data/lib/killbill/gen/{payment_plugin_api_exception.rb → plugin-api/payment_plugin_api_exception.rb} +0 -0
  94. data/lib/killbill/gen/{refund_info_plugin.rb → plugin-api/refund_info_plugin.rb} +2 -2
  95. data/lib/killbill/gen/plugin-api/require_gen.rb +32 -0
  96. data/lib/killbill/jplugin.rb +0 -71
  97. data/lib/killbill/killbill_api.rb +0 -7
  98. data/spec/killbill/killbillapi_spec.rb +1 -1
  99. data/spec/killbill/notification_plugin_api_spec.rb +22 -0
  100. data/spec/killbill/payment_plugin_api_spec.rb +122 -0
  101. data/spec/killbill/payment_test.rb +1 -1
  102. metadata +100 -107
  103. data/lib/killbill/enum.rb +0 -72
  104. data/lib/killbill/gen/account_service.rb +0 -55
  105. data/lib/killbill/gen/beatrix_service.rb +0 -55
  106. data/lib/killbill/gen/catalog_service.rb +0 -69
  107. data/lib/killbill/gen/default_mutable_account_data.rb +0 -180
  108. data/lib/killbill/gen/entitlement_service.rb +0 -55
  109. data/lib/killbill/gen/entity_persistence_exception.rb +0 -66
  110. data/lib/killbill/gen/export_user_api.rb +0 -17
  111. data/lib/killbill/gen/invoice_migration_api.rb +0 -66
  112. data/lib/killbill/gen/invoice_notifier.rb +0 -51
  113. data/lib/killbill/gen/invoice_service.rb +0 -55
  114. data/lib/killbill/gen/migration_account_data.rb +0 -228
  115. data/lib/killbill/gen/no_op_payment_plugin_api.rb +0 -254
  116. data/lib/killbill/gen/payment_plugin_api.rb +0 -232
  117. data/lib/killbill/gen/payment_service.rb +0 -62
  118. data/lib/killbill/gen/require_gen.rb +0 -120
  119. data/lib/killbill/gen/tenant_service.rb +0 -55
  120. data/lib/killbill/jpayment.rb +0 -107
  121. data/spec/killbill/jnotification_spec.rb +0 -39
  122. data/spec/killbill/jpayment_spec.rb +0 -126
  123. data/tools/java2ruby.rb +0 -440
File without changes
File without changes
@@ -39,8 +39,10 @@ module Killbill
39
39
 
40
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
41
  def create_tenant(data, context)
42
+
42
43
  # conversion for data [type = com.ning.billing.tenant.api.TenantData]
43
44
  data = data.to_java unless data.nil?
45
+
44
46
  # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
45
47
  context = context.to_java unless context.nil?
46
48
  begin
@@ -55,6 +57,7 @@ module Killbill
55
57
 
56
58
  java_signature 'Java::com.ning.billing.tenant.api.Tenant getTenantByApiKey(Java::java.lang.String)'
57
59
  def get_tenant_by_api_key(key)
60
+
58
61
  # conversion for key [type = java.lang.String]
59
62
  key = key.to_s unless key.nil?
60
63
  begin
@@ -69,6 +72,7 @@ module Killbill
69
72
 
70
73
  java_signature 'Java::com.ning.billing.tenant.api.Tenant getTenantById(Java::java.util.UUID)'
71
74
  def get_tenant_by_id(tenantId)
75
+
72
76
  # conversion for tenantId [type = java.util.UUID]
73
77
  tenantId = java.util.UUID.fromString(tenantId.to_s) unless tenantId.nil?
74
78
  begin
@@ -83,8 +87,10 @@ module Killbill
83
87
 
84
88
  java_signature 'Java::java.util.List getTenantValueForKey(Java::java.lang.String, Java::com.ning.billing.util.callcontext.TenantContext)'
85
89
  def get_tenant_value_for_key(key, context)
90
+
86
91
  # conversion for key [type = java.lang.String]
87
92
  key = key.to_s unless key.nil?
93
+
88
94
  # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
89
95
  context = context.to_java unless context.nil?
90
96
  begin
@@ -104,10 +110,13 @@ module Killbill
104
110
 
105
111
  java_signature 'Java::void addTenantKeyValue(Java::java.lang.String, Java::java.lang.String, Java::com.ning.billing.util.callcontext.CallContext)'
106
112
  def add_tenant_key_value(key, value, context)
113
+
107
114
  # conversion for key [type = java.lang.String]
108
115
  key = key.to_s unless key.nil?
116
+
109
117
  # conversion for value [type = java.lang.String]
110
118
  value = value.to_s unless value.nil?
119
+
111
120
  # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
112
121
  context = context.to_java unless context.nil?
113
122
  @real_java_api.add_tenant_key_value(key, value, context)
@@ -115,8 +124,10 @@ module Killbill
115
124
 
116
125
  java_signature 'Java::void deleteTenantKey(Java::java.lang.String, Java::com.ning.billing.util.callcontext.CallContext)'
117
126
  def delete_tenant_key(key, context)
127
+
118
128
  # conversion for key [type = java.lang.String]
119
129
  key = key.to_s unless key.nil?
130
+
120
131
  # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
121
132
  context = context.to_java unless context.nil?
122
133
  @real_java_api.delete_tenant_key(key, context)
File without changes
@@ -0,0 +1,89 @@
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.usage.api'
31
+ class UsageUserApi
32
+
33
+ include com.ning.billing.usage.api.UsageUserApi
34
+
35
+ def initialize(real_java_api)
36
+ @real_java_api = real_java_api
37
+ end
38
+
39
+
40
+ java_signature 'Java::void recordRolledUpUsage(Java::java.util.UUID, Java::java.lang.String, Java::org.joda.time.DateTime, Java::org.joda.time.DateTime, Java::java.math.BigDecimal, Java::com.ning.billing.util.callcontext.CallContext)'
41
+ def record_rolled_up_usage(subscriptionId, unitType, startTime, endTime, amount, context)
42
+
43
+ # conversion for subscriptionId [type = java.util.UUID]
44
+ subscriptionId = java.util.UUID.fromString(subscriptionId.to_s) unless subscriptionId.nil?
45
+
46
+ # conversion for unitType [type = java.lang.String]
47
+ unitType = unitType.to_s unless unitType.nil?
48
+
49
+ # conversion for startTime [type = org.joda.time.DateTime]
50
+ if !startTime.nil?
51
+ startTime = (startTime.kind_of? Time) ? DateTime.parse(startTime.to_s) : startTime
52
+ startTime = Java::org.joda.time.DateTime.new(startTime.to_s, Java::org.joda.time.DateTimeZone::UTC)
53
+ end
54
+
55
+ # conversion for endTime [type = org.joda.time.DateTime]
56
+ if !endTime.nil?
57
+ endTime = (endTime.kind_of? Time) ? DateTime.parse(endTime.to_s) : endTime
58
+ endTime = Java::org.joda.time.DateTime.new(endTime.to_s, Java::org.joda.time.DateTimeZone::UTC)
59
+ end
60
+
61
+ # conversion for amount [type = java.math.BigDecimal]
62
+ if amount.nil?
63
+ amount = java.math.BigDecimal::ZERO
64
+ else
65
+ amount = java.math.BigDecimal.new(amount.to_s)
66
+ end
67
+
68
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
69
+ context = context.to_java unless context.nil?
70
+ @real_java_api.record_rolled_up_usage(subscriptionId, unitType, startTime, endTime, amount, context)
71
+ end
72
+
73
+ java_signature 'Java::com.ning.billing.usage.api.RolledUpUsage getUsageForSubscription(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
74
+ def get_usage_for_subscription(subscriptionId, context)
75
+
76
+ # conversion for subscriptionId [type = java.util.UUID]
77
+ subscriptionId = java.util.UUID.fromString(subscriptionId.to_s) unless subscriptionId.nil?
78
+
79
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
80
+ context = context.to_java unless context.nil?
81
+ res = @real_java_api.get_usage_for_subscription(subscriptionId, context)
82
+ # conversion for res [type = com.ning.billing.usage.api.RolledUpUsage]
83
+ res = Killbill::Plugin::Model::RolledUpUsage.new.to_ruby(res) unless res.nil?
84
+ return res
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,61 @@
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.notification.plugin.api'
31
+ class NotificationPluginApi < JPlugin
32
+
33
+ include com.ning.billing.notification.plugin.api.NotificationPluginApi
34
+
35
+ def initialize(real_class_name, services = {})
36
+ super(real_class_name, services)
37
+ end
38
+
39
+
40
+ java_signature 'Java::void onEvent(Java::com.ning.billing.notification.plugin.api.ExtBusEvent)'
41
+ def on_event(killbillEvent)
42
+
43
+ # conversion for killbillEvent [type = com.ning.billing.notification.plugin.api.ExtBusEvent]
44
+ killbillEvent = Killbill::Plugin::Model::ExtBusEvent.new.to_ruby(killbillEvent) unless killbillEvent.nil?
45
+ begin
46
+ @delegate_plugin.on_event(killbillEvent)
47
+ rescue Exception => e
48
+ message = "Failure in on_event: #{e}"
49
+ unless e.backtrace.nil?
50
+ message = "#{message}\n#{e.backtrace.join("\n")}"
51
+ end
52
+ logger.warn message
53
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("on_event failure", e.message)
54
+ ensure
55
+ @delegate_plugin.after_request
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -42,7 +42,7 @@ module Killbill
42
42
  if @amount.nil?
43
43
  @amount = java.math.BigDecimal::ZERO
44
44
  else
45
- @amount = java.math.BigDecimal.new(@amount.to_i)
45
+ @amount = java.math.BigDecimal.new(@amount.to_s)
46
46
  end
47
47
 
48
48
  # conversion for created_date [type = org.joda.time.DateTime]
@@ -77,7 +77,7 @@ module Killbill
77
77
  def to_ruby(j_obj)
78
78
  # conversion for amount [type = java.math.BigDecimal]
79
79
  @amount = j_obj.amount
80
- @amount = @amount.nil? ? 0 : @amount.to_s.to_i
80
+ @amount = @amount.nil? ? 0 : BigDecimal.new(@amount.to_s)
81
81
 
82
82
  # conversion for created_date [type = org.joda.time.DateTime]
83
83
  @created_date = j_obj.created_date
@@ -0,0 +1,356 @@
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.payment.plugin.api'
31
+ class PaymentPluginApi < JPlugin
32
+
33
+ include com.ning.billing.payment.plugin.api.PaymentPluginApi
34
+
35
+ def initialize(real_class_name, services = {})
36
+ super(real_class_name, services)
37
+ end
38
+
39
+
40
+ java_signature 'Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin processPayment(Java::java.util.UUID, Java::java.util.UUID, Java::java.util.UUID, Java::java.math.BigDecimal, Java::com.ning.billing.catalog.api.Currency, Java::com.ning.billing.util.callcontext.CallContext)'
41
+ def process_payment(kbAccountId, kbPaymentId, kbPaymentMethodId, amount, currency, context)
42
+
43
+ # conversion for kbAccountId [type = java.util.UUID]
44
+ kbAccountId = kbAccountId.nil? ? nil : kbAccountId.to_s
45
+
46
+ # conversion for kbPaymentId [type = java.util.UUID]
47
+ kbPaymentId = kbPaymentId.nil? ? nil : kbPaymentId.to_s
48
+
49
+ # conversion for kbPaymentMethodId [type = java.util.UUID]
50
+ kbPaymentMethodId = kbPaymentMethodId.nil? ? nil : kbPaymentMethodId.to_s
51
+
52
+ # conversion for amount [type = java.math.BigDecimal]
53
+ amount = amount.nil? ? 0 : BigDecimal.new(amount.to_s)
54
+
55
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
56
+ currency = currency.to_s.to_sym unless currency.nil?
57
+
58
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
59
+ context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
60
+ begin
61
+ res = @delegate_plugin.process_payment(kbAccountId, kbPaymentId, kbPaymentMethodId, amount, currency, context)
62
+ # conversion for res [type = com.ning.billing.payment.plugin.api.PaymentInfoPlugin]
63
+ res = res.to_java unless res.nil?
64
+ return res
65
+ rescue Exception => e
66
+ message = "Failure in process_payment: #{e}"
67
+ unless e.backtrace.nil?
68
+ message = "#{message}\n#{e.backtrace.join("\n")}"
69
+ end
70
+ logger.warn message
71
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("process_payment failure", e.message)
72
+ ensure
73
+ @delegate_plugin.after_request
74
+ end
75
+ end
76
+
77
+ java_signature 'Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin getPaymentInfo(Java::java.util.UUID, Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
78
+ def get_payment_info(kbAccountId, kbPaymentId, context)
79
+
80
+ # conversion for kbAccountId [type = java.util.UUID]
81
+ kbAccountId = kbAccountId.nil? ? nil : kbAccountId.to_s
82
+
83
+ # conversion for kbPaymentId [type = java.util.UUID]
84
+ kbPaymentId = kbPaymentId.nil? ? nil : kbPaymentId.to_s
85
+
86
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
87
+ context = Killbill::Plugin::Model::TenantContext.new.to_ruby(context) unless context.nil?
88
+ begin
89
+ res = @delegate_plugin.get_payment_info(kbAccountId, kbPaymentId, context)
90
+ # conversion for res [type = com.ning.billing.payment.plugin.api.PaymentInfoPlugin]
91
+ res = res.to_java unless res.nil?
92
+ return res
93
+ rescue Exception => e
94
+ message = "Failure in get_payment_info: #{e}"
95
+ unless e.backtrace.nil?
96
+ message = "#{message}\n#{e.backtrace.join("\n")}"
97
+ end
98
+ logger.warn message
99
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("get_payment_info failure", e.message)
100
+ ensure
101
+ @delegate_plugin.after_request
102
+ end
103
+ end
104
+
105
+ java_signature 'Java::com.ning.billing.payment.plugin.api.RefundInfoPlugin processRefund(Java::java.util.UUID, Java::java.util.UUID, Java::java.math.BigDecimal, Java::com.ning.billing.catalog.api.Currency, Java::com.ning.billing.util.callcontext.CallContext)'
106
+ def process_refund(kbAccountId, kbPaymentId, refundAmount, currency, context)
107
+
108
+ # conversion for kbAccountId [type = java.util.UUID]
109
+ kbAccountId = kbAccountId.nil? ? nil : kbAccountId.to_s
110
+
111
+ # conversion for kbPaymentId [type = java.util.UUID]
112
+ kbPaymentId = kbPaymentId.nil? ? nil : kbPaymentId.to_s
113
+
114
+ # conversion for refundAmount [type = java.math.BigDecimal]
115
+ refundAmount = refundAmount.nil? ? 0 : BigDecimal.new(refundAmount.to_s)
116
+
117
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
118
+ currency = currency.to_s.to_sym unless currency.nil?
119
+
120
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
121
+ context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
122
+ begin
123
+ res = @delegate_plugin.process_refund(kbAccountId, kbPaymentId, refundAmount, currency, context)
124
+ # conversion for res [type = com.ning.billing.payment.plugin.api.RefundInfoPlugin]
125
+ res = res.to_java unless res.nil?
126
+ return res
127
+ rescue Exception => e
128
+ message = "Failure in process_refund: #{e}"
129
+ unless e.backtrace.nil?
130
+ message = "#{message}\n#{e.backtrace.join("\n")}"
131
+ end
132
+ logger.warn message
133
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("process_refund failure", e.message)
134
+ ensure
135
+ @delegate_plugin.after_request
136
+ end
137
+ end
138
+
139
+ java_signature 'Java::java.util.List getRefundInfo(Java::java.util.UUID, Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
140
+ def get_refund_info(kbAccountId, kbPaymentId, context)
141
+
142
+ # conversion for kbAccountId [type = java.util.UUID]
143
+ kbAccountId = kbAccountId.nil? ? nil : kbAccountId.to_s
144
+
145
+ # conversion for kbPaymentId [type = java.util.UUID]
146
+ kbPaymentId = kbPaymentId.nil? ? nil : kbPaymentId.to_s
147
+
148
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
149
+ context = Killbill::Plugin::Model::TenantContext.new.to_ruby(context) unless context.nil?
150
+ begin
151
+ res = @delegate_plugin.get_refund_info(kbAccountId, kbPaymentId, context)
152
+ # conversion for res [type = java.util.List]
153
+ tmp = java.util.ArrayList.new
154
+ (res || []).each do |m|
155
+ # conversion for m [type = com.ning.billing.payment.plugin.api.RefundInfoPlugin]
156
+ m = m.to_java unless m.nil?
157
+ tmp.add(m)
158
+ end
159
+ res = tmp
160
+ return res
161
+ rescue Exception => e
162
+ message = "Failure in get_refund_info: #{e}"
163
+ unless e.backtrace.nil?
164
+ message = "#{message}\n#{e.backtrace.join("\n")}"
165
+ end
166
+ logger.warn message
167
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("get_refund_info failure", e.message)
168
+ ensure
169
+ @delegate_plugin.after_request
170
+ end
171
+ end
172
+
173
+ java_signature 'Java::void addPaymentMethod(Java::java.util.UUID, Java::java.util.UUID, Java::com.ning.billing.payment.api.PaymentMethodPlugin, Java::boolean, Java::com.ning.billing.util.callcontext.CallContext)'
174
+ def add_payment_method(kbAccountId, kbPaymentMethodId, paymentMethodProps, setDefault, context)
175
+
176
+ # conversion for kbAccountId [type = java.util.UUID]
177
+ kbAccountId = kbAccountId.nil? ? nil : kbAccountId.to_s
178
+
179
+ # conversion for kbPaymentMethodId [type = java.util.UUID]
180
+ kbPaymentMethodId = kbPaymentMethodId.nil? ? nil : kbPaymentMethodId.to_s
181
+
182
+ # conversion for paymentMethodProps [type = com.ning.billing.payment.api.PaymentMethodPlugin]
183
+ paymentMethodProps = Killbill::Plugin::Model::PaymentMethodPlugin.new.to_ruby(paymentMethodProps) unless paymentMethodProps.nil?
184
+
185
+ # conversion for setDefault [type = boolean]
186
+ if setDefault.nil?
187
+ setDefault = false
188
+ else
189
+ tmp_bool = (setDefault.java_kind_of? java.lang.Boolean) ? setDefault.boolean_value : setDefault
190
+ setDefault = tmp_bool ? true : false
191
+ end
192
+
193
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
194
+ context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
195
+ begin
196
+ @delegate_plugin.add_payment_method(kbAccountId, kbPaymentMethodId, paymentMethodProps, setDefault, context)
197
+ rescue Exception => e
198
+ message = "Failure in add_payment_method: #{e}"
199
+ unless e.backtrace.nil?
200
+ message = "#{message}\n#{e.backtrace.join("\n")}"
201
+ end
202
+ logger.warn message
203
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("add_payment_method failure", e.message)
204
+ ensure
205
+ @delegate_plugin.after_request
206
+ end
207
+ end
208
+
209
+ java_signature 'Java::void deletePaymentMethod(Java::java.util.UUID, Java::java.util.UUID, Java::com.ning.billing.util.callcontext.CallContext)'
210
+ def delete_payment_method(kbAccountId, kbPaymentMethodId, context)
211
+
212
+ # conversion for kbAccountId [type = java.util.UUID]
213
+ kbAccountId = kbAccountId.nil? ? nil : kbAccountId.to_s
214
+
215
+ # conversion for kbPaymentMethodId [type = java.util.UUID]
216
+ kbPaymentMethodId = kbPaymentMethodId.nil? ? nil : kbPaymentMethodId.to_s
217
+
218
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
219
+ context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
220
+ begin
221
+ @delegate_plugin.delete_payment_method(kbAccountId, kbPaymentMethodId, context)
222
+ rescue Exception => e
223
+ message = "Failure in delete_payment_method: #{e}"
224
+ unless e.backtrace.nil?
225
+ message = "#{message}\n#{e.backtrace.join("\n")}"
226
+ end
227
+ logger.warn message
228
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("delete_payment_method failure", e.message)
229
+ ensure
230
+ @delegate_plugin.after_request
231
+ end
232
+ end
233
+
234
+ java_signature 'Java::com.ning.billing.payment.api.PaymentMethodPlugin getPaymentMethodDetail(Java::java.util.UUID, Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
235
+ def get_payment_method_detail(kbAccountId, kbPaymentMethodId, context)
236
+
237
+ # conversion for kbAccountId [type = java.util.UUID]
238
+ kbAccountId = kbAccountId.nil? ? nil : kbAccountId.to_s
239
+
240
+ # conversion for kbPaymentMethodId [type = java.util.UUID]
241
+ kbPaymentMethodId = kbPaymentMethodId.nil? ? nil : kbPaymentMethodId.to_s
242
+
243
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
244
+ context = Killbill::Plugin::Model::TenantContext.new.to_ruby(context) unless context.nil?
245
+ begin
246
+ res = @delegate_plugin.get_payment_method_detail(kbAccountId, kbPaymentMethodId, context)
247
+ # conversion for res [type = com.ning.billing.payment.api.PaymentMethodPlugin]
248
+ res = res.to_java unless res.nil?
249
+ return res
250
+ rescue Exception => e
251
+ message = "Failure in get_payment_method_detail: #{e}"
252
+ unless e.backtrace.nil?
253
+ message = "#{message}\n#{e.backtrace.join("\n")}"
254
+ end
255
+ logger.warn message
256
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("get_payment_method_detail failure", e.message)
257
+ ensure
258
+ @delegate_plugin.after_request
259
+ end
260
+ end
261
+
262
+ java_signature 'Java::void setDefaultPaymentMethod(Java::java.util.UUID, Java::java.util.UUID, Java::com.ning.billing.util.callcontext.CallContext)'
263
+ def set_default_payment_method(kbAccountId, kbPaymentMethodId, context)
264
+
265
+ # conversion for kbAccountId [type = java.util.UUID]
266
+ kbAccountId = kbAccountId.nil? ? nil : kbAccountId.to_s
267
+
268
+ # conversion for kbPaymentMethodId [type = java.util.UUID]
269
+ kbPaymentMethodId = kbPaymentMethodId.nil? ? nil : kbPaymentMethodId.to_s
270
+
271
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
272
+ context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
273
+ begin
274
+ @delegate_plugin.set_default_payment_method(kbAccountId, kbPaymentMethodId, context)
275
+ rescue Exception => e
276
+ message = "Failure in set_default_payment_method: #{e}"
277
+ unless e.backtrace.nil?
278
+ message = "#{message}\n#{e.backtrace.join("\n")}"
279
+ end
280
+ logger.warn message
281
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("set_default_payment_method failure", e.message)
282
+ ensure
283
+ @delegate_plugin.after_request
284
+ end
285
+ end
286
+
287
+ java_signature 'Java::java.util.List getPaymentMethods(Java::java.util.UUID, Java::boolean, Java::com.ning.billing.util.callcontext.CallContext)'
288
+ def get_payment_methods(kbAccountId, refreshFromGateway, context)
289
+
290
+ # conversion for kbAccountId [type = java.util.UUID]
291
+ kbAccountId = kbAccountId.nil? ? nil : kbAccountId.to_s
292
+
293
+ # conversion for refreshFromGateway [type = boolean]
294
+ if refreshFromGateway.nil?
295
+ refreshFromGateway = false
296
+ else
297
+ tmp_bool = (refreshFromGateway.java_kind_of? java.lang.Boolean) ? refreshFromGateway.boolean_value : refreshFromGateway
298
+ refreshFromGateway = tmp_bool ? true : false
299
+ end
300
+
301
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
302
+ context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
303
+ begin
304
+ res = @delegate_plugin.get_payment_methods(kbAccountId, refreshFromGateway, context)
305
+ # conversion for res [type = java.util.List]
306
+ tmp = java.util.ArrayList.new
307
+ (res || []).each do |m|
308
+ # conversion for m [type = com.ning.billing.payment.plugin.api.PaymentMethodInfoPlugin]
309
+ m = m.to_java unless m.nil?
310
+ tmp.add(m)
311
+ end
312
+ res = tmp
313
+ return res
314
+ rescue Exception => e
315
+ message = "Failure in get_payment_methods: #{e}"
316
+ unless e.backtrace.nil?
317
+ message = "#{message}\n#{e.backtrace.join("\n")}"
318
+ end
319
+ logger.warn message
320
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("get_payment_methods failure", e.message)
321
+ ensure
322
+ @delegate_plugin.after_request
323
+ end
324
+ end
325
+
326
+ java_signature 'Java::void resetPaymentMethods(Java::java.util.UUID, Java::java.util.List)'
327
+ def reset_payment_methods(kbAccountId, paymentMethods)
328
+
329
+ # conversion for kbAccountId [type = java.util.UUID]
330
+ kbAccountId = kbAccountId.nil? ? nil : kbAccountId.to_s
331
+
332
+ # conversion for paymentMethods [type = java.util.List]
333
+ tmp = []
334
+ (paymentMethods || []).each do |m|
335
+ # conversion for m [type = com.ning.billing.payment.plugin.api.PaymentMethodInfoPlugin]
336
+ m = Killbill::Plugin::Model::PaymentMethodInfoPlugin.new.to_ruby(m) unless m.nil?
337
+ tmp << m
338
+ end
339
+ paymentMethods = tmp
340
+ begin
341
+ @delegate_plugin.reset_payment_methods(kbAccountId, paymentMethods)
342
+ rescue Exception => e
343
+ message = "Failure in reset_payment_methods: #{e}"
344
+ unless e.backtrace.nil?
345
+ message = "#{message}\n#{e.backtrace.join("\n")}"
346
+ end
347
+ logger.warn message
348
+ raise Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException.new("reset_payment_methods failure", e.message)
349
+ ensure
350
+ @delegate_plugin.after_request
351
+ end
352
+ end
353
+ end
354
+ end
355
+ end
356
+ end