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.
Files changed (128) hide show
  1. data/Jarfile +4 -2
  2. data/VERSION +1 -1
  3. data/killbill.gemspec +4 -3
  4. data/lib/killbill.rb +7 -51
  5. data/lib/killbill/creator.rb +10 -18
  6. data/lib/killbill/gen/account.rb +208 -27
  7. data/lib/killbill/gen/account_api_exception.rb +66 -0
  8. data/lib/killbill/gen/account_data.rb +166 -23
  9. data/lib/killbill/gen/account_email.rb +80 -8
  10. data/lib/killbill/gen/account_service.rb +55 -0
  11. data/lib/killbill/gen/account_user_api.rb +187 -0
  12. data/lib/killbill/gen/audit_user_api.rb +196 -0
  13. data/lib/killbill/gen/beatrix_service.rb +55 -0
  14. data/lib/killbill/gen/billing_exception_base.rb +66 -0
  15. data/lib/killbill/gen/blockable.rb +91 -0
  16. data/lib/killbill/gen/blocking_api_exception.rb +66 -0
  17. data/lib/killbill/gen/blocking_state.rb +150 -16
  18. data/lib/killbill/gen/call_context.rb +107 -13
  19. data/lib/killbill/gen/catalog.rb +76 -0
  20. data/lib/killbill/gen/catalog_api_exception.rb +66 -0
  21. data/lib/killbill/gen/catalog_service.rb +69 -0
  22. data/lib/killbill/gen/catalog_user_api.rb +54 -0
  23. data/lib/killbill/gen/column_info.rb +67 -0
  24. data/lib/killbill/gen/control_tag.rb +112 -0
  25. data/lib/killbill/gen/currency_value_null.rb +66 -0
  26. data/lib/killbill/gen/custom_field.rb +93 -10
  27. data/lib/killbill/gen/custom_field_api_exception.rb +66 -0
  28. data/lib/killbill/gen/custom_field_user_api.rb +115 -0
  29. data/lib/killbill/gen/database_export_output_stream.rb +51 -0
  30. data/lib/killbill/gen/default_mutable_account_data.rb +180 -0
  31. data/lib/killbill/gen/duration.rb +62 -0
  32. data/lib/killbill/gen/entitlement_service.rb +55 -0
  33. data/lib/killbill/gen/entitlement_user_api.rb +272 -0
  34. data/lib/killbill/gen/entitlement_user_api_exception.rb +66 -0
  35. data/lib/killbill/gen/entity.rb +84 -0
  36. data/lib/killbill/gen/entity_persistence_exception.rb +66 -0
  37. data/lib/killbill/gen/export_user_api.rb +17 -0
  38. data/lib/killbill/gen/ext_bus_event.rb +68 -9
  39. data/lib/killbill/gen/external_bus.rb +51 -0
  40. data/lib/killbill/gen/illegal_plan_change.rb +66 -0
  41. data/lib/killbill/gen/international_price.rb +79 -0
  42. data/lib/killbill/gen/invalid_config_exception.rb +49 -0
  43. data/lib/killbill/gen/invoice.rb +238 -23
  44. data/lib/killbill/gen/invoice_api_exception.rb +66 -0
  45. data/lib/killbill/gen/invoice_creation_event.rb +51 -0
  46. data/lib/killbill/gen/invoice_item.rb +179 -21
  47. data/lib/killbill/gen/invoice_migration_api.rb +66 -0
  48. data/lib/killbill/gen/invoice_notifier.rb +51 -0
  49. data/lib/killbill/gen/invoice_payment.rb +135 -15
  50. data/lib/killbill/gen/invoice_payment_api.rb +208 -0
  51. data/lib/killbill/gen/invoice_service.rb +55 -0
  52. data/lib/killbill/gen/invoice_user_api.rb +461 -0
  53. data/lib/killbill/gen/junction_api.rb +60 -0
  54. data/lib/killbill/gen/limit.rb +68 -0
  55. data/lib/killbill/gen/listing.rb +63 -0
  56. data/lib/killbill/gen/migration_account_data.rb +228 -0
  57. data/lib/killbill/gen/migration_plan.rb +143 -0
  58. data/lib/killbill/gen/mutable_account_data.rb +182 -0
  59. data/lib/killbill/gen/no_op_payment_plugin_api.rb +254 -0
  60. data/lib/killbill/gen/payment.rb +183 -20
  61. data/lib/killbill/gen/payment_api.rb +433 -0
  62. data/lib/killbill/gen/payment_api_exception.rb +66 -0
  63. data/lib/killbill/gen/payment_attempt.rb +100 -10
  64. data/lib/killbill/gen/payment_info_plugin.rb +103 -12
  65. data/lib/killbill/gen/payment_method.rb +116 -0
  66. data/lib/killbill/gen/payment_method_info_plugin.rb +64 -7
  67. data/lib/killbill/gen/payment_method_kv_info.rb +56 -6
  68. data/lib/killbill/gen/payment_method_plugin.rb +142 -20
  69. data/lib/killbill/gen/payment_plugin_api.rb +232 -0
  70. data/lib/killbill/gen/payment_plugin_api_exception.rb +59 -0
  71. data/lib/killbill/gen/payment_service.rb +62 -0
  72. data/lib/killbill/gen/plan.rb +143 -0
  73. data/lib/killbill/gen/plan_change_result.rb +68 -0
  74. data/lib/killbill/gen/plan_phase.rb +104 -0
  75. data/lib/killbill/gen/plan_phase_specifier.rb +80 -0
  76. data/lib/killbill/gen/plan_specifier.rb +73 -0
  77. data/lib/killbill/gen/price.rb +67 -0
  78. data/lib/killbill/gen/price_list.rb +74 -0
  79. data/lib/killbill/gen/price_list_set.rb +56 -0
  80. data/lib/killbill/gen/product.rb +101 -0
  81. data/lib/killbill/gen/record_id_api.rb +55 -0
  82. data/lib/killbill/gen/refund.rb +126 -13
  83. data/lib/killbill/gen/refund_info_plugin.rb +96 -10
  84. data/lib/killbill/gen/require_gen.rb +97 -15
  85. data/lib/killbill/gen/static_catalog.rb +137 -0
  86. data/lib/killbill/gen/subscription.rb +258 -28
  87. data/lib/killbill/gen/subscription_bundle.rb +94 -10
  88. data/lib/killbill/gen/subscription_status_dry_run.rb +89 -0
  89. data/lib/killbill/gen/subscription_transition.rb +196 -0
  90. data/lib/killbill/gen/tag.rb +88 -9
  91. data/lib/killbill/gen/tag_api_exception.rb +66 -0
  92. data/lib/killbill/gen/tag_definition.rb +110 -10
  93. data/lib/killbill/gen/tag_definition_api_exception.rb +66 -0
  94. data/lib/killbill/gen/tag_user_api.rb +239 -0
  95. data/lib/killbill/gen/tenant.rb +102 -0
  96. data/lib/killbill/gen/tenant_api_exception.rb +66 -0
  97. data/lib/killbill/gen/tenant_context.rb +39 -4
  98. data/lib/killbill/gen/tenant_data.rb +67 -0
  99. data/lib/killbill/gen/tenant_kv.rb +96 -0
  100. data/lib/killbill/gen/tenant_service.rb +55 -0
  101. data/lib/killbill/gen/tenant_user_api.rb +127 -0
  102. data/lib/killbill/gen/unit.rb +55 -0
  103. data/lib/killbill/jnotification.rb +1 -1
  104. data/lib/killbill/jpayment.rb +10 -7
  105. data/lib/killbill/jplugin.rb +63 -61
  106. data/lib/killbill/killbill_api.rb +42 -9
  107. data/spec/killbill/jnotification_spec.rb +15 -1
  108. data/spec/killbill/jpayment_spec.rb +12 -8
  109. data/spec/killbill/killbillapi_spec.rb +23 -21
  110. data/spec/killbill/payment_plugin_spec.rb +1 -9
  111. data/spec/killbill/payment_test.rb +21 -5
  112. metadata +96 -22
  113. data/lib/killbill/gen/audit_log.rb +0 -28
  114. data/lib/killbill/gen/call_origin.rb +0 -34
  115. data/lib/killbill/gen/currency.rb +0 -34
  116. data/lib/killbill/gen/date_time_zone.rb +0 -35
  117. data/lib/killbill/gen/ext_bus_event_type.rb +0 -34
  118. data/lib/killbill/gen/invoice_payment_type.rb +0 -34
  119. data/lib/killbill/gen/object_type.rb +0 -34
  120. data/lib/killbill/gen/payment_plugin_status.rb +0 -34
  121. data/lib/killbill/gen/refund_plugin_status.rb +0 -34
  122. data/lib/killbill/gen/subscription_source_type.rb +0 -34
  123. data/lib/killbill/gen/subscription_state.rb +0 -34
  124. data/lib/killbill/gen/user_type.rb +0 -34
  125. data/lib/killbill/gen/uuid.rb +0 -22
  126. data/lib/killbill/jconverter.rb +0 -537
  127. data/lib/killbill/jkillbill_api.rb +0 -137
  128. data/spec/killbill/jconverter_spec.rb +0 -193
@@ -0,0 +1,182 @@
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.account.api'
31
+ class MutableAccountData
32
+
33
+ include com.ning.billing.account.api.MutableAccountData
34
+
35
+ attr_accessor :external_key, :name, :first_name_length, :email, :bill_cycle_day_local, :currency, :payment_method_id, :time_zone, :locale, :address1, :address2, :company_name, :city, :state_or_province, :postal_code, :country, :phone, :is_migrated, :is_notified_for_invoices
36
+
37
+ def initialize()
38
+ end
39
+
40
+ def to_java()
41
+ # conversion for external_key [type = java.lang.String]
42
+ @external_key = @external_key.to_s unless @external_key.nil?
43
+
44
+ # conversion for name [type = java.lang.String]
45
+ @name = @name.to_s unless @name.nil?
46
+
47
+ # conversion for first_name_length [type = java.lang.Integer]
48
+ @first_name_length = @first_name_length
49
+
50
+ # conversion for email [type = java.lang.String]
51
+ @email = @email.to_s unless @email.nil?
52
+
53
+ # conversion for bill_cycle_day_local [type = java.lang.Integer]
54
+ @bill_cycle_day_local = @bill_cycle_day_local
55
+
56
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
57
+ @currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{@currency.to_s}") unless @currency.nil?
58
+
59
+ # conversion for payment_method_id [type = java.util.UUID]
60
+ @payment_method_id = java.util.UUID.fromString(@payment_method_id.to_s) unless @payment_method_id.nil?
61
+
62
+ # conversion for time_zone [type = org.joda.time.DateTimeZone]
63
+ if !@time_zone.nil?
64
+ @time_zone = Java::org.joda.time.DateTimeZone.forID((@time_zone.respond_to?(:identifier) ? @time_zone.identifier : @time_zone.to_s))
65
+ end
66
+
67
+ # conversion for locale [type = java.lang.String]
68
+ @locale = @locale.to_s unless @locale.nil?
69
+
70
+ # conversion for address1 [type = java.lang.String]
71
+ @address1 = @address1.to_s unless @address1.nil?
72
+
73
+ # conversion for address2 [type = java.lang.String]
74
+ @address2 = @address2.to_s unless @address2.nil?
75
+
76
+ # conversion for company_name [type = java.lang.String]
77
+ @company_name = @company_name.to_s unless @company_name.nil?
78
+
79
+ # conversion for city [type = java.lang.String]
80
+ @city = @city.to_s unless @city.nil?
81
+
82
+ # conversion for state_or_province [type = java.lang.String]
83
+ @state_or_province = @state_or_province.to_s unless @state_or_province.nil?
84
+
85
+ # conversion for postal_code [type = java.lang.String]
86
+ @postal_code = @postal_code.to_s unless @postal_code.nil?
87
+
88
+ # conversion for country [type = java.lang.String]
89
+ @country = @country.to_s unless @country.nil?
90
+
91
+ # conversion for phone [type = java.lang.String]
92
+ @phone = @phone.to_s unless @phone.nil?
93
+
94
+ # conversion for is_migrated [type = java.lang.Boolean]
95
+ @is_migrated = @is_migrated.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(@is_migrated)
96
+
97
+ # conversion for is_notified_for_invoices [type = java.lang.Boolean]
98
+ @is_notified_for_invoices = @is_notified_for_invoices.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(@is_notified_for_invoices)
99
+ self
100
+ end
101
+
102
+ def to_ruby(j_obj)
103
+ # conversion for external_key [type = java.lang.String]
104
+ @external_key = j_obj.external_key
105
+
106
+ # conversion for name [type = java.lang.String]
107
+ @name = j_obj.name
108
+
109
+ # conversion for first_name_length [type = java.lang.Integer]
110
+ @first_name_length = j_obj.first_name_length
111
+
112
+ # conversion for email [type = java.lang.String]
113
+ @email = j_obj.email
114
+
115
+ # conversion for bill_cycle_day_local [type = java.lang.Integer]
116
+ @bill_cycle_day_local = j_obj.bill_cycle_day_local
117
+
118
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
119
+ @currency = j_obj.currency
120
+ @currency = @currency.to_s.to_sym unless @currency.nil?
121
+
122
+ # conversion for payment_method_id [type = java.util.UUID]
123
+ @payment_method_id = j_obj.payment_method_id
124
+ @payment_method_id = @payment_method_id.nil? ? nil : @payment_method_id.to_s
125
+
126
+ # conversion for time_zone [type = org.joda.time.DateTimeZone]
127
+ @time_zone = j_obj.time_zone
128
+ if !@time_zone.nil?
129
+ @time_zone = TZInfo::Timezone.get(@time_zone.get_id)
130
+ end
131
+
132
+ # conversion for locale [type = java.lang.String]
133
+ @locale = j_obj.locale
134
+
135
+ # conversion for address1 [type = java.lang.String]
136
+ @address1 = j_obj.address1
137
+
138
+ # conversion for address2 [type = java.lang.String]
139
+ @address2 = j_obj.address2
140
+
141
+ # conversion for company_name [type = java.lang.String]
142
+ @company_name = j_obj.company_name
143
+
144
+ # conversion for city [type = java.lang.String]
145
+ @city = j_obj.city
146
+
147
+ # conversion for state_or_province [type = java.lang.String]
148
+ @state_or_province = j_obj.state_or_province
149
+
150
+ # conversion for postal_code [type = java.lang.String]
151
+ @postal_code = j_obj.postal_code
152
+
153
+ # conversion for country [type = java.lang.String]
154
+ @country = j_obj.country
155
+
156
+ # conversion for phone [type = java.lang.String]
157
+ @phone = j_obj.phone
158
+
159
+ # conversion for is_migrated [type = java.lang.Boolean]
160
+ @is_migrated = j_obj.is_migrated
161
+ if @is_migrated.nil?
162
+ @is_migrated = false
163
+ else
164
+ tmp_bool = (@is_migrated.java_kind_of? java.lang.Boolean) ? @is_migrated.boolean_value : @is_migrated
165
+ @is_migrated = tmp_bool ? true : false
166
+ end
167
+
168
+ # conversion for is_notified_for_invoices [type = java.lang.Boolean]
169
+ @is_notified_for_invoices = j_obj.is_notified_for_invoices
170
+ if @is_notified_for_invoices.nil?
171
+ @is_notified_for_invoices = false
172
+ else
173
+ tmp_bool = (@is_notified_for_invoices.java_kind_of? java.lang.Boolean) ? @is_notified_for_invoices.boolean_value : @is_notified_for_invoices
174
+ @is_notified_for_invoices = tmp_bool ? true : false
175
+ end
176
+ self
177
+ end
178
+
179
+ end
180
+ end
181
+ end
182
+ end
@@ -0,0 +1,254 @@
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 NoOpPaymentPluginApi
32
+
33
+ include com.ning.billing.payment.plugin.api.NoOpPaymentPluginApi
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.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
+ # conversion for kbAccountId [type = java.util.UUID]
43
+ kbAccountId = java.util.UUID.fromString(kbAccountId.to_s) unless kbAccountId.nil?
44
+ # conversion for kbPaymentId [type = java.util.UUID]
45
+ kbPaymentId = java.util.UUID.fromString(kbPaymentId.to_s) unless kbPaymentId.nil?
46
+ # conversion for kbPaymentMethodId [type = java.util.UUID]
47
+ kbPaymentMethodId = java.util.UUID.fromString(kbPaymentMethodId.to_s) unless kbPaymentMethodId.nil?
48
+ # conversion for amount [type = java.math.BigDecimal]
49
+ if amount.nil?
50
+ amount = java.math.BigDecimal::ZERO
51
+ else
52
+ amount = java.math.BigDecimal.new(amount.to_i)
53
+ end
54
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
55
+ currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{currency.to_s}") unless currency.nil?
56
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
57
+ context = context.to_java unless context.nil?
58
+ begin
59
+ res = @real_java_api.process_payment(kbAccountId, kbPaymentId, kbPaymentMethodId, amount, currency, context)
60
+ # conversion for res [type = com.ning.billing.payment.plugin.api.PaymentInfoPlugin]
61
+ res = Killbill::Plugin::Model::PaymentInfoPlugin.new.to_ruby(res) unless res.nil?
62
+ return res
63
+ rescue Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException => e
64
+ raise Killbill::Plugin::Model::PaymentPluginApiException.new.to_ruby(e)
65
+ end
66
+ end
67
+
68
+ 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)'
69
+ def get_payment_info(kbAccountId, kbPaymentId, context)
70
+ # conversion for kbAccountId [type = java.util.UUID]
71
+ kbAccountId = java.util.UUID.fromString(kbAccountId.to_s) unless kbAccountId.nil?
72
+ # conversion for kbPaymentId [type = java.util.UUID]
73
+ kbPaymentId = java.util.UUID.fromString(kbPaymentId.to_s) unless kbPaymentId.nil?
74
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
75
+ context = context.to_java unless context.nil?
76
+ begin
77
+ res = @real_java_api.get_payment_info(kbAccountId, kbPaymentId, context)
78
+ # conversion for res [type = com.ning.billing.payment.plugin.api.PaymentInfoPlugin]
79
+ res = Killbill::Plugin::Model::PaymentInfoPlugin.new.to_ruby(res) unless res.nil?
80
+ return res
81
+ rescue Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException => e
82
+ raise Killbill::Plugin::Model::PaymentPluginApiException.new.to_ruby(e)
83
+ end
84
+ end
85
+
86
+ 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)'
87
+ def process_refund(kbAccountId, kbPaymentId, refundAmount, currency, context)
88
+ # conversion for kbAccountId [type = java.util.UUID]
89
+ kbAccountId = java.util.UUID.fromString(kbAccountId.to_s) unless kbAccountId.nil?
90
+ # conversion for kbPaymentId [type = java.util.UUID]
91
+ kbPaymentId = java.util.UUID.fromString(kbPaymentId.to_s) unless kbPaymentId.nil?
92
+ # conversion for refundAmount [type = java.math.BigDecimal]
93
+ if refundAmount.nil?
94
+ refundAmount = java.math.BigDecimal::ZERO
95
+ else
96
+ refundAmount = java.math.BigDecimal.new(refundAmount.to_i)
97
+ end
98
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
99
+ currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{currency.to_s}") unless currency.nil?
100
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
101
+ context = context.to_java unless context.nil?
102
+ begin
103
+ res = @real_java_api.process_refund(kbAccountId, kbPaymentId, refundAmount, currency, context)
104
+ # conversion for res [type = com.ning.billing.payment.plugin.api.RefundInfoPlugin]
105
+ res = Killbill::Plugin::Model::RefundInfoPlugin.new.to_ruby(res) unless res.nil?
106
+ return res
107
+ rescue Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException => e
108
+ raise Killbill::Plugin::Model::PaymentPluginApiException.new.to_ruby(e)
109
+ end
110
+ end
111
+
112
+ java_signature 'Java::java.util.List getRefundInfo(Java::java.util.UUID, Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
113
+ def get_refund_info(kbAccountId, kbPaymentId, context)
114
+ # conversion for kbAccountId [type = java.util.UUID]
115
+ kbAccountId = java.util.UUID.fromString(kbAccountId.to_s) unless kbAccountId.nil?
116
+ # conversion for kbPaymentId [type = java.util.UUID]
117
+ kbPaymentId = java.util.UUID.fromString(kbPaymentId.to_s) unless kbPaymentId.nil?
118
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
119
+ context = context.to_java unless context.nil?
120
+ begin
121
+ res = @real_java_api.get_refund_info(kbAccountId, kbPaymentId, context)
122
+ # conversion for res [type = java.util.List]
123
+ tmp = []
124
+ (res || []).each do |m|
125
+ # conversion for m [type = com.ning.billing.payment.plugin.api.RefundInfoPlugin]
126
+ m = Killbill::Plugin::Model::RefundInfoPlugin.new.to_ruby(m) unless m.nil?
127
+ tmp << m
128
+ end
129
+ res = tmp
130
+ return res
131
+ rescue Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException => e
132
+ raise Killbill::Plugin::Model::PaymentPluginApiException.new.to_ruby(e)
133
+ end
134
+ end
135
+
136
+ 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)'
137
+ def add_payment_method(kbAccountId, kbPaymentMethodId, paymentMethodProps, setDefault, context)
138
+ # conversion for kbAccountId [type = java.util.UUID]
139
+ kbAccountId = java.util.UUID.fromString(kbAccountId.to_s) unless kbAccountId.nil?
140
+ # conversion for kbPaymentMethodId [type = java.util.UUID]
141
+ kbPaymentMethodId = java.util.UUID.fromString(kbPaymentMethodId.to_s) unless kbPaymentMethodId.nil?
142
+ # conversion for paymentMethodProps [type = com.ning.billing.payment.api.PaymentMethodPlugin]
143
+ paymentMethodProps = paymentMethodProps.to_java unless paymentMethodProps.nil?
144
+ # conversion for setDefault [type = boolean]
145
+ setDefault = setDefault.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(setDefault)
146
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
147
+ context = context.to_java unless context.nil?
148
+ @real_java_api.add_payment_method(kbAccountId, kbPaymentMethodId, paymentMethodProps, setDefault, context)
149
+ end
150
+
151
+ java_signature 'Java::void deletePaymentMethod(Java::java.util.UUID, Java::java.util.UUID, Java::com.ning.billing.util.callcontext.CallContext)'
152
+ def delete_payment_method(kbAccountId, kbPaymentMethodId, context)
153
+ # conversion for kbAccountId [type = java.util.UUID]
154
+ kbAccountId = java.util.UUID.fromString(kbAccountId.to_s) unless kbAccountId.nil?
155
+ # conversion for kbPaymentMethodId [type = java.util.UUID]
156
+ kbPaymentMethodId = java.util.UUID.fromString(kbPaymentMethodId.to_s) unless kbPaymentMethodId.nil?
157
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
158
+ context = context.to_java unless context.nil?
159
+ @real_java_api.delete_payment_method(kbAccountId, kbPaymentMethodId, context)
160
+ end
161
+
162
+ 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)'
163
+ def get_payment_method_detail(kbAccountId, kbPaymentMethodId, context)
164
+ # conversion for kbAccountId [type = java.util.UUID]
165
+ kbAccountId = java.util.UUID.fromString(kbAccountId.to_s) unless kbAccountId.nil?
166
+ # conversion for kbPaymentMethodId [type = java.util.UUID]
167
+ kbPaymentMethodId = java.util.UUID.fromString(kbPaymentMethodId.to_s) unless kbPaymentMethodId.nil?
168
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
169
+ context = context.to_java unless context.nil?
170
+ begin
171
+ res = @real_java_api.get_payment_method_detail(kbAccountId, kbPaymentMethodId, context)
172
+ # conversion for res [type = com.ning.billing.payment.api.PaymentMethodPlugin]
173
+ res = Killbill::Plugin::Model::PaymentMethodPlugin.new.to_ruby(res) unless res.nil?
174
+ return res
175
+ rescue Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException => e
176
+ raise Killbill::Plugin::Model::PaymentPluginApiException.new.to_ruby(e)
177
+ end
178
+ end
179
+
180
+ java_signature 'Java::void setDefaultPaymentMethod(Java::java.util.UUID, Java::java.util.UUID, Java::com.ning.billing.util.callcontext.CallContext)'
181
+ def set_default_payment_method(kbAccountId, kbPaymentMethodId, context)
182
+ # conversion for kbAccountId [type = java.util.UUID]
183
+ kbAccountId = java.util.UUID.fromString(kbAccountId.to_s) unless kbAccountId.nil?
184
+ # conversion for kbPaymentMethodId [type = java.util.UUID]
185
+ kbPaymentMethodId = java.util.UUID.fromString(kbPaymentMethodId.to_s) unless kbPaymentMethodId.nil?
186
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
187
+ context = context.to_java unless context.nil?
188
+ @real_java_api.set_default_payment_method(kbAccountId, kbPaymentMethodId, context)
189
+ end
190
+
191
+ java_signature 'Java::java.util.List getPaymentMethods(Java::java.util.UUID, Java::boolean, Java::com.ning.billing.util.callcontext.CallContext)'
192
+ def get_payment_methods(kbAccountId, refreshFromGateway, context)
193
+ # conversion for kbAccountId [type = java.util.UUID]
194
+ kbAccountId = java.util.UUID.fromString(kbAccountId.to_s) unless kbAccountId.nil?
195
+ # conversion for refreshFromGateway [type = boolean]
196
+ refreshFromGateway = refreshFromGateway.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(refreshFromGateway)
197
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
198
+ context = context.to_java unless context.nil?
199
+ begin
200
+ res = @real_java_api.get_payment_methods(kbAccountId, refreshFromGateway, context)
201
+ # conversion for res [type = java.util.List]
202
+ tmp = []
203
+ (res || []).each do |m|
204
+ # conversion for m [type = com.ning.billing.payment.plugin.api.PaymentMethodInfoPlugin]
205
+ m = Killbill::Plugin::Model::PaymentMethodInfoPlugin.new.to_ruby(m) unless m.nil?
206
+ tmp << m
207
+ end
208
+ res = tmp
209
+ return res
210
+ rescue Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException => e
211
+ raise Killbill::Plugin::Model::PaymentPluginApiException.new.to_ruby(e)
212
+ end
213
+ end
214
+
215
+ java_signature 'Java::void resetPaymentMethods(Java::java.util.UUID, Java::java.util.List)'
216
+ def reset_payment_methods(kbAccountId, paymentMethods)
217
+ # conversion for kbAccountId [type = java.util.UUID]
218
+ kbAccountId = java.util.UUID.fromString(kbAccountId.to_s) unless kbAccountId.nil?
219
+ # conversion for paymentMethods [type = java.util.List]
220
+ tmp = java.util.ArrayList.new
221
+ (paymentMethods || []).each do |m|
222
+ # conversion for m [type = com.ning.billing.payment.plugin.api.PaymentMethodInfoPlugin]
223
+ m = m.to_java unless m.nil?
224
+ tmp.add(m)
225
+ end
226
+ paymentMethods = tmp
227
+ @real_java_api.reset_payment_methods(kbAccountId, paymentMethods)
228
+ end
229
+
230
+ java_signature 'Java::void clear()'
231
+ def clear()
232
+ @real_java_api.clear()
233
+ end
234
+
235
+ java_signature 'Java::void makeNextPaymentFailWithError()'
236
+ def make_next_payment_fail_with_error()
237
+ @real_java_api.make_next_payment_fail_with_error()
238
+ end
239
+
240
+ java_signature 'Java::void makeNextPaymentFailWithException()'
241
+ def make_next_payment_fail_with_exception()
242
+ @real_java_api.make_next_payment_fail_with_exception()
243
+ end
244
+
245
+ java_signature 'Java::void makeAllInvoicesFailWithError(Java::boolean)'
246
+ def make_all_invoices_fail_with_error(failure)
247
+ # conversion for failure [type = boolean]
248
+ failure = failure.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(failure)
249
+ @real_java_api.make_all_invoices_fail_with_error(failure)
250
+ end
251
+ end
252
+ end
253
+ end
254
+ end
@@ -1,35 +1,198 @@
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
+
1
19
 
2
20
  #
3
- # Ruby classes automatically generated from java classes-- don't edit
21
+ # DO NOT EDIT!!!
22
+ # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
4
23
  #
24
+
25
+
5
26
  module Killbill
6
27
  module Plugin
7
28
  module Model
8
29
 
30
+ java_package 'com.ning.billing.payment.api'
9
31
  class Payment
10
32
 
11
33
  include com.ning.billing.payment.api.Payment
12
34
 
13
- attr_reader :id, :created_date, :updated_date, :account_id, :invoice_id, :payment_method_id, :payment_number, :amount, :paid_amount, :effective_date, :currency, :payment_status, :attempts, :ext_first_payment_id_ref, :ext_second_payment_id_ref, :payment_info_plugin
14
-
15
- def initialize(id, created_date, updated_date, account_id, invoice_id, payment_method_id, payment_number, amount, paid_amount, effective_date, currency, payment_status, attempts, ext_first_payment_id_ref, ext_second_payment_id_ref, payment_info_plugin)
16
- @id = id
17
- @created_date = created_date
18
- @updated_date = updated_date
19
- @account_id = account_id
20
- @invoice_id = invoice_id
21
- @payment_method_id = payment_method_id
22
- @payment_number = payment_number
23
- @amount = amount
24
- @paid_amount = paid_amount
25
- @effective_date = effective_date
26
- @currency = currency
27
- @payment_status = payment_status
28
- @attempts = attempts
29
- @ext_first_payment_id_ref = ext_first_payment_id_ref
30
- @ext_second_payment_id_ref = ext_second_payment_id_ref
31
- @payment_info_plugin = payment_info_plugin
35
+ attr_accessor :id, :created_date, :updated_date, :account_id, :invoice_id, :payment_method_id, :payment_number, :amount, :paid_amount, :effective_date, :currency, :payment_status, :attempts, :ext_first_payment_id_ref, :ext_second_payment_id_ref, :payment_info_plugin
36
+
37
+ def initialize()
32
38
  end
39
+
40
+ def to_java()
41
+ # conversion for id [type = java.util.UUID]
42
+ @id = java.util.UUID.fromString(@id.to_s) unless @id.nil?
43
+
44
+ # conversion for created_date [type = org.joda.time.DateTime]
45
+ if !@created_date.nil?
46
+ @created_date = (@created_date.kind_of? Time) ? DateTime.parse(@created_date.to_s) : @created_date
47
+ @created_date = Java::org.joda.time.DateTime.new(@created_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
48
+ end
49
+
50
+ # conversion for updated_date [type = org.joda.time.DateTime]
51
+ if !@updated_date.nil?
52
+ @updated_date = (@updated_date.kind_of? Time) ? DateTime.parse(@updated_date.to_s) : @updated_date
53
+ @updated_date = Java::org.joda.time.DateTime.new(@updated_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
54
+ end
55
+
56
+ # conversion for account_id [type = java.util.UUID]
57
+ @account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?
58
+
59
+ # conversion for invoice_id [type = java.util.UUID]
60
+ @invoice_id = java.util.UUID.fromString(@invoice_id.to_s) unless @invoice_id.nil?
61
+
62
+ # conversion for payment_method_id [type = java.util.UUID]
63
+ @payment_method_id = java.util.UUID.fromString(@payment_method_id.to_s) unless @payment_method_id.nil?
64
+
65
+ # conversion for payment_number [type = java.lang.Integer]
66
+ @payment_number = @payment_number
67
+
68
+ # conversion for amount [type = java.math.BigDecimal]
69
+ if @amount.nil?
70
+ @amount = java.math.BigDecimal::ZERO
71
+ else
72
+ @amount = java.math.BigDecimal.new(@amount.to_i)
73
+ end
74
+
75
+ # conversion for paid_amount [type = java.math.BigDecimal]
76
+ if @paid_amount.nil?
77
+ @paid_amount = java.math.BigDecimal::ZERO
78
+ else
79
+ @paid_amount = java.math.BigDecimal.new(@paid_amount.to_i)
80
+ end
81
+
82
+ # conversion for effective_date [type = org.joda.time.DateTime]
83
+ if !@effective_date.nil?
84
+ @effective_date = (@effective_date.kind_of? Time) ? DateTime.parse(@effective_date.to_s) : @effective_date
85
+ @effective_date = Java::org.joda.time.DateTime.new(@effective_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
86
+ end
87
+
88
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
89
+ @currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{@currency.to_s}") unless @currency.nil?
90
+
91
+ # conversion for payment_status [type = com.ning.billing.payment.api.PaymentStatus]
92
+ @payment_status = Java::com.ning.billing.payment.api.PaymentStatus.value_of("#{@payment_status.to_s}") unless @payment_status.nil?
93
+
94
+ # conversion for attempts [type = java.util.List]
95
+ tmp = java.util.ArrayList.new
96
+ (@attempts || []).each do |m|
97
+ # conversion for m [type = com.ning.billing.payment.api.PaymentAttempt]
98
+ m = m.to_java unless m.nil?
99
+ tmp.add(m)
100
+ end
101
+ @attempts = tmp
102
+
103
+ # conversion for ext_first_payment_id_ref [type = java.lang.String]
104
+ @ext_first_payment_id_ref = @ext_first_payment_id_ref.to_s unless @ext_first_payment_id_ref.nil?
105
+
106
+ # conversion for ext_second_payment_id_ref [type = java.lang.String]
107
+ @ext_second_payment_id_ref = @ext_second_payment_id_ref.to_s unless @ext_second_payment_id_ref.nil?
108
+
109
+ # conversion for payment_info_plugin [type = com.ning.billing.payment.plugin.api.PaymentInfoPlugin]
110
+ @payment_info_plugin = @payment_info_plugin.to_java unless @payment_info_plugin.nil?
111
+ self
112
+ end
113
+
114
+ def to_ruby(j_obj)
115
+ # conversion for id [type = java.util.UUID]
116
+ @id = j_obj.id
117
+ @id = @id.nil? ? nil : @id.to_s
118
+
119
+ # conversion for created_date [type = org.joda.time.DateTime]
120
+ @created_date = j_obj.created_date
121
+ if !@created_date.nil?
122
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time
123
+ str = fmt.print(@created_date)
124
+ @created_date = DateTime.iso8601(str)
125
+ end
126
+
127
+ # conversion for updated_date [type = org.joda.time.DateTime]
128
+ @updated_date = j_obj.updated_date
129
+ if !@updated_date.nil?
130
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time
131
+ str = fmt.print(@updated_date)
132
+ @updated_date = DateTime.iso8601(str)
133
+ end
134
+
135
+ # conversion for account_id [type = java.util.UUID]
136
+ @account_id = j_obj.account_id
137
+ @account_id = @account_id.nil? ? nil : @account_id.to_s
138
+
139
+ # conversion for invoice_id [type = java.util.UUID]
140
+ @invoice_id = j_obj.invoice_id
141
+ @invoice_id = @invoice_id.nil? ? nil : @invoice_id.to_s
142
+
143
+ # conversion for payment_method_id [type = java.util.UUID]
144
+ @payment_method_id = j_obj.payment_method_id
145
+ @payment_method_id = @payment_method_id.nil? ? nil : @payment_method_id.to_s
146
+
147
+ # conversion for payment_number [type = java.lang.Integer]
148
+ @payment_number = j_obj.payment_number
149
+
150
+ # conversion for amount [type = java.math.BigDecimal]
151
+ @amount = j_obj.amount
152
+ @amount = @amount.nil? ? 0 : @amount.to_s.to_i
153
+
154
+ # conversion for paid_amount [type = java.math.BigDecimal]
155
+ @paid_amount = j_obj.paid_amount
156
+ @paid_amount = @paid_amount.nil? ? 0 : @paid_amount.to_s.to_i
157
+
158
+ # conversion for effective_date [type = org.joda.time.DateTime]
159
+ @effective_date = j_obj.effective_date
160
+ if !@effective_date.nil?
161
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time
162
+ str = fmt.print(@effective_date)
163
+ @effective_date = DateTime.iso8601(str)
164
+ end
165
+
166
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
167
+ @currency = j_obj.currency
168
+ @currency = @currency.to_s.to_sym unless @currency.nil?
169
+
170
+ # conversion for payment_status [type = com.ning.billing.payment.api.PaymentStatus]
171
+ @payment_status = j_obj.payment_status
172
+ @payment_status = @payment_status.to_s.to_sym unless @payment_status.nil?
173
+
174
+ # conversion for attempts [type = java.util.List]
175
+ @attempts = j_obj.attempts
176
+ tmp = []
177
+ (@attempts || []).each do |m|
178
+ # conversion for m [type = com.ning.billing.payment.api.PaymentAttempt]
179
+ m = Killbill::Plugin::Model::PaymentAttempt.new.to_ruby(m) unless m.nil?
180
+ tmp << m
181
+ end
182
+ @attempts = tmp
183
+
184
+ # conversion for ext_first_payment_id_ref [type = java.lang.String]
185
+ @ext_first_payment_id_ref = j_obj.ext_first_payment_id_ref
186
+
187
+ # conversion for ext_second_payment_id_ref [type = java.lang.String]
188
+ @ext_second_payment_id_ref = j_obj.ext_second_payment_id_ref
189
+
190
+ # conversion for payment_info_plugin [type = com.ning.billing.payment.plugin.api.PaymentInfoPlugin]
191
+ @payment_info_plugin = j_obj.payment_info_plugin
192
+ @payment_info_plugin = Killbill::Plugin::Model::PaymentInfoPlugin.new.to_ruby(@payment_info_plugin) unless @payment_info_plugin.nil?
193
+ self
194
+ end
195
+
33
196
  end
34
197
  end
35
198
  end