killbill 1.0.19 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,30 +1,150 @@
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.invoice.api'
9
31
  class InvoicePayment
10
32
 
11
33
  include com.ning.billing.invoice.api.InvoicePayment
12
34
 
13
- attr_reader :id, :created_date, :updated_date, :payment_id, :type, :invoice_id, :payment_date, :amount, :currency, :linked_invoice_payment_id, :payment_cookie_id
14
-
15
- def initialize(id, created_date, updated_date, payment_id, type, invoice_id, payment_date, amount, currency, linked_invoice_payment_id, payment_cookie_id)
16
- @id = id
17
- @created_date = created_date
18
- @updated_date = updated_date
19
- @payment_id = payment_id
20
- @type = type
21
- @invoice_id = invoice_id
22
- @payment_date = payment_date
23
- @amount = amount
24
- @currency = currency
25
- @linked_invoice_payment_id = linked_invoice_payment_id
26
- @payment_cookie_id = payment_cookie_id
35
+ attr_accessor :id, :created_date, :updated_date, :payment_id, :type, :invoice_id, :payment_date, :amount, :currency, :linked_invoice_payment_id, :payment_cookie_id
36
+
37
+ def initialize()
27
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 payment_id [type = java.util.UUID]
57
+ @payment_id = java.util.UUID.fromString(@payment_id.to_s) unless @payment_id.nil?
58
+
59
+ # conversion for type [type = com.ning.billing.invoice.api.InvoicePaymentType]
60
+ @type = Java::com.ning.billing.invoice.api.InvoicePaymentType.value_of("#{@type.to_s}") unless @type.nil?
61
+
62
+ # conversion for invoice_id [type = java.util.UUID]
63
+ @invoice_id = java.util.UUID.fromString(@invoice_id.to_s) unless @invoice_id.nil?
64
+
65
+ # conversion for payment_date [type = org.joda.time.DateTime]
66
+ if !@payment_date.nil?
67
+ @payment_date = (@payment_date.kind_of? Time) ? DateTime.parse(@payment_date.to_s) : @payment_date
68
+ @payment_date = Java::org.joda.time.DateTime.new(@payment_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
69
+ end
70
+
71
+ # conversion for amount [type = java.math.BigDecimal]
72
+ if @amount.nil?
73
+ @amount = java.math.BigDecimal::ZERO
74
+ else
75
+ @amount = java.math.BigDecimal.new(@amount.to_i)
76
+ end
77
+
78
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
79
+ @currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{@currency.to_s}") unless @currency.nil?
80
+
81
+ # conversion for linked_invoice_payment_id [type = java.util.UUID]
82
+ @linked_invoice_payment_id = java.util.UUID.fromString(@linked_invoice_payment_id.to_s) unless @linked_invoice_payment_id.nil?
83
+
84
+ # conversion for payment_cookie_id [type = java.util.UUID]
85
+ @payment_cookie_id = java.util.UUID.fromString(@payment_cookie_id.to_s) unless @payment_cookie_id.nil?
86
+ self
87
+ end
88
+
89
+ def to_ruby(j_obj)
90
+ # conversion for id [type = java.util.UUID]
91
+ @id = j_obj.id
92
+ @id = @id.nil? ? nil : @id.to_s
93
+
94
+ # conversion for created_date [type = org.joda.time.DateTime]
95
+ @created_date = j_obj.created_date
96
+ if !@created_date.nil?
97
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time
98
+ str = fmt.print(@created_date)
99
+ @created_date = DateTime.iso8601(str)
100
+ end
101
+
102
+ # conversion for updated_date [type = org.joda.time.DateTime]
103
+ @updated_date = j_obj.updated_date
104
+ if !@updated_date.nil?
105
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time
106
+ str = fmt.print(@updated_date)
107
+ @updated_date = DateTime.iso8601(str)
108
+ end
109
+
110
+ # conversion for payment_id [type = java.util.UUID]
111
+ @payment_id = j_obj.payment_id
112
+ @payment_id = @payment_id.nil? ? nil : @payment_id.to_s
113
+
114
+ # conversion for type [type = com.ning.billing.invoice.api.InvoicePaymentType]
115
+ @type = j_obj.type
116
+ @type = @type.to_s.to_sym unless @type.nil?
117
+
118
+ # conversion for invoice_id [type = java.util.UUID]
119
+ @invoice_id = j_obj.invoice_id
120
+ @invoice_id = @invoice_id.nil? ? nil : @invoice_id.to_s
121
+
122
+ # conversion for payment_date [type = org.joda.time.DateTime]
123
+ @payment_date = j_obj.payment_date
124
+ if !@payment_date.nil?
125
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time
126
+ str = fmt.print(@payment_date)
127
+ @payment_date = DateTime.iso8601(str)
128
+ end
129
+
130
+ # conversion for amount [type = java.math.BigDecimal]
131
+ @amount = j_obj.amount
132
+ @amount = @amount.nil? ? 0 : @amount.to_s.to_i
133
+
134
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
135
+ @currency = j_obj.currency
136
+ @currency = @currency.to_s.to_sym unless @currency.nil?
137
+
138
+ # conversion for linked_invoice_payment_id [type = java.util.UUID]
139
+ @linked_invoice_payment_id = j_obj.linked_invoice_payment_id
140
+ @linked_invoice_payment_id = @linked_invoice_payment_id.nil? ? nil : @linked_invoice_payment_id.to_s
141
+
142
+ # conversion for payment_cookie_id [type = java.util.UUID]
143
+ @payment_cookie_id = j_obj.payment_cookie_id
144
+ @payment_cookie_id = @payment_cookie_id.nil? ? nil : @payment_cookie_id.to_s
145
+ self
146
+ end
147
+
28
148
  end
29
149
  end
30
150
  end
@@ -0,0 +1,208 @@
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.invoice.api'
31
+ class InvoicePaymentApi
32
+
33
+ include com.ning.billing.invoice.api.InvoicePaymentApi
34
+
35
+ def initialize(real_java_api)
36
+ @real_java_api = real_java_api
37
+ end
38
+
39
+
40
+ java_signature 'Java::java.util.List getAllInvoicesByAccount(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
41
+ def get_all_invoices_by_account(accountId, context)
42
+ # conversion for accountId [type = java.util.UUID]
43
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
44
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
45
+ context = context.to_java unless context.nil?
46
+ res = @real_java_api.get_all_invoices_by_account(accountId, context)
47
+ # conversion for res [type = java.util.List]
48
+ tmp = []
49
+ (res || []).each do |m|
50
+ # conversion for m [type = com.ning.billing.invoice.api.Invoice]
51
+ m = Killbill::Plugin::Model::Invoice.new.to_ruby(m) unless m.nil?
52
+ tmp << m
53
+ end
54
+ res = tmp
55
+ return res
56
+ end
57
+
58
+ java_signature 'Java::com.ning.billing.invoice.api.Invoice getInvoice(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
59
+ def get_invoice(invoiceId, context)
60
+ # conversion for invoiceId [type = java.util.UUID]
61
+ invoiceId = java.util.UUID.fromString(invoiceId.to_s) unless invoiceId.nil?
62
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
63
+ context = context.to_java unless context.nil?
64
+ begin
65
+ res = @real_java_api.get_invoice(invoiceId, context)
66
+ # conversion for res [type = com.ning.billing.invoice.api.Invoice]
67
+ res = Killbill::Plugin::Model::Invoice.new.to_ruby(res) unless res.nil?
68
+ return res
69
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
70
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
71
+ end
72
+ end
73
+
74
+ java_signature 'Java::java.util.List getInvoicePayments(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
75
+ def get_invoice_payments(paymentId, context)
76
+ # conversion for paymentId [type = java.util.UUID]
77
+ paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.nil?
78
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
79
+ context = context.to_java unless context.nil?
80
+ res = @real_java_api.get_invoice_payments(paymentId, context)
81
+ # conversion for res [type = java.util.List]
82
+ tmp = []
83
+ (res || []).each do |m|
84
+ # conversion for m [type = com.ning.billing.invoice.api.InvoicePayment]
85
+ m = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(m) unless m.nil?
86
+ tmp << m
87
+ end
88
+ res = tmp
89
+ return res
90
+ end
91
+
92
+ java_signature 'Java::com.ning.billing.invoice.api.InvoicePayment getInvoicePaymentForAttempt(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
93
+ def get_invoice_payment_for_attempt(paymentId, context)
94
+ # conversion for paymentId [type = java.util.UUID]
95
+ paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.nil?
96
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
97
+ context = context.to_java unless context.nil?
98
+ res = @real_java_api.get_invoice_payment_for_attempt(paymentId, context)
99
+ # conversion for res [type = com.ning.billing.invoice.api.InvoicePayment]
100
+ res = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(res) unless res.nil?
101
+ return res
102
+ end
103
+
104
+ java_signature 'Java::com.ning.billing.invoice.api.InvoicePayment createChargeback(Java::java.util.UUID, Java::java.math.BigDecimal, Java::com.ning.billing.util.callcontext.CallContext)'
105
+ def create_chargeback(invoicePaymentId, amount, context)
106
+ # conversion for invoicePaymentId [type = java.util.UUID]
107
+ invoicePaymentId = java.util.UUID.fromString(invoicePaymentId.to_s) unless invoicePaymentId.nil?
108
+ # conversion for amount [type = java.math.BigDecimal]
109
+ if amount.nil?
110
+ amount = java.math.BigDecimal::ZERO
111
+ else
112
+ amount = java.math.BigDecimal.new(amount.to_i)
113
+ end
114
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
115
+ context = context.to_java unless context.nil?
116
+ begin
117
+ res = @real_java_api.create_chargeback(invoicePaymentId, amount, context)
118
+ # conversion for res [type = com.ning.billing.invoice.api.InvoicePayment]
119
+ res = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(res) unless res.nil?
120
+ return res
121
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
122
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
123
+ end
124
+ end
125
+
126
+ java_signature 'Java::java.math.BigDecimal getRemainingAmountPaid(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
127
+ def get_remaining_amount_paid(invoicePaymentId, context)
128
+ # conversion for invoicePaymentId [type = java.util.UUID]
129
+ invoicePaymentId = java.util.UUID.fromString(invoicePaymentId.to_s) unless invoicePaymentId.nil?
130
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
131
+ context = context.to_java unless context.nil?
132
+ res = @real_java_api.get_remaining_amount_paid(invoicePaymentId, context)
133
+ # conversion for res [type = java.math.BigDecimal]
134
+ res = res.nil? ? 0 : res.to_s.to_i
135
+ return res
136
+ end
137
+
138
+ java_signature 'Java::java.util.List getChargebacksByAccountId(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
139
+ def get_chargebacks_by_account_id(accountId, context)
140
+ # conversion for accountId [type = java.util.UUID]
141
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
142
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
143
+ context = context.to_java unless context.nil?
144
+ res = @real_java_api.get_chargebacks_by_account_id(accountId, context)
145
+ # conversion for res [type = java.util.List]
146
+ tmp = []
147
+ (res || []).each do |m|
148
+ # conversion for m [type = com.ning.billing.invoice.api.InvoicePayment]
149
+ m = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(m) unless m.nil?
150
+ tmp << m
151
+ end
152
+ res = tmp
153
+ return res
154
+ end
155
+
156
+ java_signature 'Java::java.util.UUID getAccountIdFromInvoicePaymentId(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
157
+ def get_account_id_from_invoice_payment_id(uuid, context)
158
+ # conversion for uuid [type = java.util.UUID]
159
+ uuid = java.util.UUID.fromString(uuid.to_s) unless uuid.nil?
160
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
161
+ context = context.to_java unless context.nil?
162
+ begin
163
+ res = @real_java_api.get_account_id_from_invoice_payment_id(uuid, context)
164
+ # conversion for res [type = java.util.UUID]
165
+ res = res.nil? ? nil : res.to_s
166
+ return res
167
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
168
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
169
+ end
170
+ end
171
+
172
+ java_signature 'Java::java.util.List getChargebacksByPaymentId(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
173
+ def get_chargebacks_by_payment_id(paymentId, context)
174
+ # conversion for paymentId [type = java.util.UUID]
175
+ paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.nil?
176
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
177
+ context = context.to_java unless context.nil?
178
+ res = @real_java_api.get_chargebacks_by_payment_id(paymentId, context)
179
+ # conversion for res [type = java.util.List]
180
+ tmp = []
181
+ (res || []).each do |m|
182
+ # conversion for m [type = com.ning.billing.invoice.api.InvoicePayment]
183
+ m = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(m) unless m.nil?
184
+ tmp << m
185
+ end
186
+ res = tmp
187
+ return res
188
+ end
189
+
190
+ java_signature 'Java::com.ning.billing.invoice.api.InvoicePayment getChargebackById(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
191
+ def get_chargeback_by_id(chargebackId, context)
192
+ # conversion for chargebackId [type = java.util.UUID]
193
+ chargebackId = java.util.UUID.fromString(chargebackId.to_s) unless chargebackId.nil?
194
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
195
+ context = context.to_java unless context.nil?
196
+ begin
197
+ res = @real_java_api.get_chargeback_by_id(chargebackId, context)
198
+ # conversion for res [type = com.ning.billing.invoice.api.InvoicePayment]
199
+ res = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(res) unless res.nil?
200
+ return res
201
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
202
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
203
+ end
204
+ end
205
+ end
206
+ end
207
+ end
208
+ 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.invoice.api'
31
+ class InvoiceService
32
+
33
+ include com.ning.billing.invoice.api.InvoiceService
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
@@ -0,0 +1,461 @@
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.invoice.api'
31
+ class InvoiceUserApi
32
+
33
+ include com.ning.billing.invoice.api.InvoiceUserApi
34
+
35
+ def initialize(real_java_api)
36
+ @real_java_api = real_java_api
37
+ end
38
+
39
+
40
+ java_signature 'Java::java.util.List getInvoicesByAccount(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
41
+ def get_invoices_by_account(accountId, context)
42
+ # conversion for accountId [type = java.util.UUID]
43
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
44
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
45
+ context = context.to_java unless context.nil?
46
+ res = @real_java_api.get_invoices_by_account(accountId, context)
47
+ # conversion for res [type = java.util.List]
48
+ tmp = []
49
+ (res || []).each do |m|
50
+ # conversion for m [type = com.ning.billing.invoice.api.Invoice]
51
+ m = Killbill::Plugin::Model::Invoice.new.to_ruby(m) unless m.nil?
52
+ tmp << m
53
+ end
54
+ res = tmp
55
+ return res
56
+ end
57
+
58
+ java_signature 'Java::java.math.BigDecimal getAccountBalance(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
59
+ def get_account_balance(accountId, context)
60
+ # conversion for accountId [type = java.util.UUID]
61
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
62
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
63
+ context = context.to_java unless context.nil?
64
+ res = @real_java_api.get_account_balance(accountId, context)
65
+ # conversion for res [type = java.math.BigDecimal]
66
+ res = res.nil? ? 0 : res.to_s.to_i
67
+ return res
68
+ end
69
+
70
+ java_signature 'Java::java.math.BigDecimal getAccountCBA(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
71
+ def get_account_cba(accountId, context)
72
+ # conversion for accountId [type = java.util.UUID]
73
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
74
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
75
+ context = context.to_java unless context.nil?
76
+ res = @real_java_api.get_account_cba(accountId, context)
77
+ # conversion for res [type = java.math.BigDecimal]
78
+ res = res.nil? ? 0 : res.to_s.to_i
79
+ return res
80
+ end
81
+
82
+ java_signature 'Java::com.ning.billing.invoice.api.Invoice getInvoice(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
83
+ def get_invoice(invoiceId, context)
84
+ # conversion for invoiceId [type = java.util.UUID]
85
+ invoiceId = java.util.UUID.fromString(invoiceId.to_s) unless invoiceId.nil?
86
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
87
+ context = context.to_java unless context.nil?
88
+ begin
89
+ res = @real_java_api.get_invoice(invoiceId, context)
90
+ # conversion for res [type = com.ning.billing.invoice.api.Invoice]
91
+ res = Killbill::Plugin::Model::Invoice.new.to_ruby(res) unless res.nil?
92
+ return res
93
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
94
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
95
+ end
96
+ end
97
+
98
+ java_signature 'Java::com.ning.billing.invoice.api.Invoice getInvoiceByNumber(Java::java.lang.Integer, Java::com.ning.billing.util.callcontext.TenantContext)'
99
+ def get_invoice_by_number(number, context)
100
+ # conversion for number [type = java.lang.Integer]
101
+ number = number
102
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
103
+ context = context.to_java unless context.nil?
104
+ begin
105
+ res = @real_java_api.get_invoice_by_number(number, context)
106
+ # conversion for res [type = com.ning.billing.invoice.api.Invoice]
107
+ res = Killbill::Plugin::Model::Invoice.new.to_ruby(res) unless res.nil?
108
+ return res
109
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
110
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
111
+ end
112
+ end
113
+
114
+ java_signature 'Java::java.util.Collection getUnpaidInvoicesByAccountId(Java::java.util.UUID, Java::org.joda.time.LocalDate, Java::com.ning.billing.util.callcontext.TenantContext)'
115
+ def get_unpaid_invoices_by_account_id(accountId, upToDate, context)
116
+ # conversion for accountId [type = java.util.UUID]
117
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
118
+ # conversion for upToDate [type = org.joda.time.LocalDate]
119
+ if !upToDate.nil?
120
+ upToDate = Java::org.joda.time.LocalDate.parse(upToDate.to_s)
121
+ end
122
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
123
+ context = context.to_java unless context.nil?
124
+ res = @real_java_api.get_unpaid_invoices_by_account_id(accountId, upToDate, context)
125
+ # conversion for res [type = java.util.Collection]
126
+ tmp = []
127
+ (res || []).each do |m|
128
+ # conversion for m [type = com.ning.billing.invoice.api.Invoice]
129
+ m = Killbill::Plugin::Model::Invoice.new.to_ruby(m) unless m.nil?
130
+ tmp << m
131
+ end
132
+ res = tmp
133
+ return res
134
+ end
135
+
136
+ java_signature 'Java::com.ning.billing.invoice.api.Invoice triggerInvoiceGeneration(Java::java.util.UUID, Java::org.joda.time.LocalDate, Java::boolean, Java::com.ning.billing.util.callcontext.CallContext)'
137
+ def trigger_invoice_generation(accountId, targetDate, dryRun, context)
138
+ # conversion for accountId [type = java.util.UUID]
139
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
140
+ # conversion for targetDate [type = org.joda.time.LocalDate]
141
+ if !targetDate.nil?
142
+ targetDate = Java::org.joda.time.LocalDate.parse(targetDate.to_s)
143
+ end
144
+ # conversion for dryRun [type = boolean]
145
+ dryRun = dryRun.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(dryRun)
146
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
147
+ context = context.to_java unless context.nil?
148
+ begin
149
+ res = @real_java_api.trigger_invoice_generation(accountId, targetDate, dryRun, context)
150
+ # conversion for res [type = com.ning.billing.invoice.api.Invoice]
151
+ res = Killbill::Plugin::Model::Invoice.new.to_ruby(res) unless res.nil?
152
+ return res
153
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
154
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
155
+ end
156
+ end
157
+
158
+ java_signature 'Java::void tagInvoiceAsWrittenOff(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.CallContext)'
159
+ def tag_invoice_as_written_off(invoiceId, context)
160
+ # conversion for invoiceId [type = java.util.UUID]
161
+ invoiceId = java.util.UUID.fromString(invoiceId.to_s) unless invoiceId.nil?
162
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
163
+ context = context.to_java unless context.nil?
164
+ @real_java_api.tag_invoice_as_written_off(invoiceId, context)
165
+ end
166
+
167
+ java_signature 'Java::void tagInvoiceAsNotWrittenOff(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.CallContext)'
168
+ def tag_invoice_as_not_written_off(invoiceId, context)
169
+ # conversion for invoiceId [type = java.util.UUID]
170
+ invoiceId = java.util.UUID.fromString(invoiceId.to_s) unless invoiceId.nil?
171
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
172
+ context = context.to_java unless context.nil?
173
+ @real_java_api.tag_invoice_as_not_written_off(invoiceId, context)
174
+ end
175
+
176
+ java_signature 'Java::com.ning.billing.invoice.api.InvoiceItem getExternalChargeById(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
177
+ def get_external_charge_by_id(externalChargeId, context)
178
+ # conversion for externalChargeId [type = java.util.UUID]
179
+ externalChargeId = java.util.UUID.fromString(externalChargeId.to_s) unless externalChargeId.nil?
180
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
181
+ context = context.to_java unless context.nil?
182
+ begin
183
+ res = @real_java_api.get_external_charge_by_id(externalChargeId, context)
184
+ # conversion for res [type = com.ning.billing.invoice.api.InvoiceItem]
185
+ res = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(res) unless res.nil?
186
+ return res
187
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
188
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
189
+ end
190
+ end
191
+
192
+ java_signature 'Java::com.ning.billing.invoice.api.InvoiceItem insertExternalCharge(Java::java.util.UUID, Java::java.math.BigDecimal, Java::java.lang.String, Java::org.joda.time.LocalDate, Java::com.ning.billing.catalog.api.Currency, Java::com.ning.billing.util.callcontext.CallContext)'
193
+ def insert_external_charge(accountId, amount, description, effectiveDate, currency, context)
194
+ # conversion for accountId [type = java.util.UUID]
195
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
196
+ # conversion for amount [type = java.math.BigDecimal]
197
+ if amount.nil?
198
+ amount = java.math.BigDecimal::ZERO
199
+ else
200
+ amount = java.math.BigDecimal.new(amount.to_i)
201
+ end
202
+ # conversion for description [type = java.lang.String]
203
+ description = description.to_s unless description.nil?
204
+ # conversion for effectiveDate [type = org.joda.time.LocalDate]
205
+ if !effectiveDate.nil?
206
+ effectiveDate = Java::org.joda.time.LocalDate.parse(effectiveDate.to_s)
207
+ end
208
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
209
+ currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{currency.to_s}") unless currency.nil?
210
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
211
+ context = context.to_java unless context.nil?
212
+ begin
213
+ res = @real_java_api.insert_external_charge(accountId, amount, description, effectiveDate, currency, context)
214
+ # conversion for res [type = com.ning.billing.invoice.api.InvoiceItem]
215
+ res = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(res) unless res.nil?
216
+ return res
217
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
218
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
219
+ end
220
+ end
221
+
222
+ java_signature 'Java::com.ning.billing.invoice.api.InvoiceItem insertExternalChargeForBundle(Java::java.util.UUID, Java::java.util.UUID, Java::java.math.BigDecimal, Java::java.lang.String, Java::org.joda.time.LocalDate, Java::com.ning.billing.catalog.api.Currency, Java::com.ning.billing.util.callcontext.CallContext)'
223
+ def insert_external_charge_for_bundle(accountId, bundleId, amount, description, effectiveDate, currency, context)
224
+ # conversion for accountId [type = java.util.UUID]
225
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
226
+ # conversion for bundleId [type = java.util.UUID]
227
+ bundleId = java.util.UUID.fromString(bundleId.to_s) unless bundleId.nil?
228
+ # conversion for amount [type = java.math.BigDecimal]
229
+ if amount.nil?
230
+ amount = java.math.BigDecimal::ZERO
231
+ else
232
+ amount = java.math.BigDecimal.new(amount.to_i)
233
+ end
234
+ # conversion for description [type = java.lang.String]
235
+ description = description.to_s unless description.nil?
236
+ # conversion for effectiveDate [type = org.joda.time.LocalDate]
237
+ if !effectiveDate.nil?
238
+ effectiveDate = Java::org.joda.time.LocalDate.parse(effectiveDate.to_s)
239
+ end
240
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
241
+ currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{currency.to_s}") unless currency.nil?
242
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
243
+ context = context.to_java unless context.nil?
244
+ begin
245
+ res = @real_java_api.insert_external_charge_for_bundle(accountId, bundleId, amount, description, effectiveDate, currency, context)
246
+ # conversion for res [type = com.ning.billing.invoice.api.InvoiceItem]
247
+ res = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(res) unless res.nil?
248
+ return res
249
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
250
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
251
+ end
252
+ end
253
+
254
+ java_signature 'Java::com.ning.billing.invoice.api.InvoiceItem insertExternalChargeForInvoice(Java::java.util.UUID, Java::java.util.UUID, Java::java.math.BigDecimal, Java::java.lang.String, Java::org.joda.time.LocalDate, Java::com.ning.billing.catalog.api.Currency, Java::com.ning.billing.util.callcontext.CallContext)'
255
+ def insert_external_charge_for_invoice(accountId, invoiceId, amount, description, effectiveDate, currency, context)
256
+ # conversion for accountId [type = java.util.UUID]
257
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
258
+ # conversion for invoiceId [type = java.util.UUID]
259
+ invoiceId = java.util.UUID.fromString(invoiceId.to_s) unless invoiceId.nil?
260
+ # conversion for amount [type = java.math.BigDecimal]
261
+ if amount.nil?
262
+ amount = java.math.BigDecimal::ZERO
263
+ else
264
+ amount = java.math.BigDecimal.new(amount.to_i)
265
+ end
266
+ # conversion for description [type = java.lang.String]
267
+ description = description.to_s unless description.nil?
268
+ # conversion for effectiveDate [type = org.joda.time.LocalDate]
269
+ if !effectiveDate.nil?
270
+ effectiveDate = Java::org.joda.time.LocalDate.parse(effectiveDate.to_s)
271
+ end
272
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
273
+ currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{currency.to_s}") unless currency.nil?
274
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
275
+ context = context.to_java unless context.nil?
276
+ begin
277
+ res = @real_java_api.insert_external_charge_for_invoice(accountId, invoiceId, amount, description, effectiveDate, currency, context)
278
+ # conversion for res [type = com.ning.billing.invoice.api.InvoiceItem]
279
+ res = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(res) unless res.nil?
280
+ return res
281
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
282
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
283
+ end
284
+ end
285
+
286
+ java_signature 'Java::com.ning.billing.invoice.api.InvoiceItem insertExternalChargeForInvoiceAndBundle(Java::java.util.UUID, Java::java.util.UUID, Java::java.util.UUID, Java::java.math.BigDecimal, Java::java.lang.String, Java::org.joda.time.LocalDate, Java::com.ning.billing.catalog.api.Currency, Java::com.ning.billing.util.callcontext.CallContext)'
287
+ def insert_external_charge_for_invoice_and_bundle(accountId, invoiceId, bundleId, amount, description, effectiveDate, currency, context)
288
+ # conversion for accountId [type = java.util.UUID]
289
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
290
+ # conversion for invoiceId [type = java.util.UUID]
291
+ invoiceId = java.util.UUID.fromString(invoiceId.to_s) unless invoiceId.nil?
292
+ # conversion for bundleId [type = java.util.UUID]
293
+ bundleId = java.util.UUID.fromString(bundleId.to_s) unless bundleId.nil?
294
+ # conversion for amount [type = java.math.BigDecimal]
295
+ if amount.nil?
296
+ amount = java.math.BigDecimal::ZERO
297
+ else
298
+ amount = java.math.BigDecimal.new(amount.to_i)
299
+ end
300
+ # conversion for description [type = java.lang.String]
301
+ description = description.to_s unless description.nil?
302
+ # conversion for effectiveDate [type = org.joda.time.LocalDate]
303
+ if !effectiveDate.nil?
304
+ effectiveDate = Java::org.joda.time.LocalDate.parse(effectiveDate.to_s)
305
+ end
306
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
307
+ currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{currency.to_s}") unless currency.nil?
308
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
309
+ context = context.to_java unless context.nil?
310
+ begin
311
+ res = @real_java_api.insert_external_charge_for_invoice_and_bundle(accountId, invoiceId, bundleId, amount, description, effectiveDate, currency, context)
312
+ # conversion for res [type = com.ning.billing.invoice.api.InvoiceItem]
313
+ res = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(res) unless res.nil?
314
+ return res
315
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
316
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
317
+ end
318
+ end
319
+
320
+ java_signature 'Java::com.ning.billing.invoice.api.InvoiceItem getCreditById(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
321
+ def get_credit_by_id(creditId, context)
322
+ # conversion for creditId [type = java.util.UUID]
323
+ creditId = java.util.UUID.fromString(creditId.to_s) unless creditId.nil?
324
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
325
+ context = context.to_java unless context.nil?
326
+ begin
327
+ res = @real_java_api.get_credit_by_id(creditId, context)
328
+ # conversion for res [type = com.ning.billing.invoice.api.InvoiceItem]
329
+ res = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(res) unless res.nil?
330
+ return res
331
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
332
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
333
+ end
334
+ end
335
+
336
+ java_signature 'Java::com.ning.billing.invoice.api.InvoiceItem insertCredit(Java::java.util.UUID, Java::java.math.BigDecimal, Java::org.joda.time.LocalDate, Java::com.ning.billing.catalog.api.Currency, Java::com.ning.billing.util.callcontext.CallContext)'
337
+ def insert_credit(accountId, amount, effectiveDate, currency, context)
338
+ # conversion for accountId [type = java.util.UUID]
339
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
340
+ # conversion for amount [type = java.math.BigDecimal]
341
+ if amount.nil?
342
+ amount = java.math.BigDecimal::ZERO
343
+ else
344
+ amount = java.math.BigDecimal.new(amount.to_i)
345
+ end
346
+ # conversion for effectiveDate [type = org.joda.time.LocalDate]
347
+ if !effectiveDate.nil?
348
+ effectiveDate = Java::org.joda.time.LocalDate.parse(effectiveDate.to_s)
349
+ end
350
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
351
+ currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{currency.to_s}") unless currency.nil?
352
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
353
+ context = context.to_java unless context.nil?
354
+ begin
355
+ res = @real_java_api.insert_credit(accountId, amount, effectiveDate, currency, context)
356
+ # conversion for res [type = com.ning.billing.invoice.api.InvoiceItem]
357
+ res = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(res) unless res.nil?
358
+ return res
359
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
360
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
361
+ end
362
+ end
363
+
364
+ java_signature 'Java::com.ning.billing.invoice.api.InvoiceItem insertCreditForInvoice(Java::java.util.UUID, Java::java.util.UUID, Java::java.math.BigDecimal, Java::org.joda.time.LocalDate, Java::com.ning.billing.catalog.api.Currency, Java::com.ning.billing.util.callcontext.CallContext)'
365
+ def insert_credit_for_invoice(accountId, invoiceId, amount, effectiveDate, currency, context)
366
+ # conversion for accountId [type = java.util.UUID]
367
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
368
+ # conversion for invoiceId [type = java.util.UUID]
369
+ invoiceId = java.util.UUID.fromString(invoiceId.to_s) unless invoiceId.nil?
370
+ # conversion for amount [type = java.math.BigDecimal]
371
+ if amount.nil?
372
+ amount = java.math.BigDecimal::ZERO
373
+ else
374
+ amount = java.math.BigDecimal.new(amount.to_i)
375
+ end
376
+ # conversion for effectiveDate [type = org.joda.time.LocalDate]
377
+ if !effectiveDate.nil?
378
+ effectiveDate = Java::org.joda.time.LocalDate.parse(effectiveDate.to_s)
379
+ end
380
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
381
+ currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{currency.to_s}") unless currency.nil?
382
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
383
+ context = context.to_java unless context.nil?
384
+ begin
385
+ res = @real_java_api.insert_credit_for_invoice(accountId, invoiceId, amount, effectiveDate, currency, context)
386
+ # conversion for res [type = com.ning.billing.invoice.api.InvoiceItem]
387
+ res = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(res) unless res.nil?
388
+ return res
389
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
390
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
391
+ end
392
+ end
393
+
394
+ java_signature 'Java::com.ning.billing.invoice.api.InvoiceItem insertInvoiceItemAdjustment(Java::java.util.UUID, Java::java.util.UUID, Java::java.util.UUID, Java::org.joda.time.LocalDate, Java::com.ning.billing.util.callcontext.CallContext)'
395
+ def insert_invoice_item_adjustment(accountId, invoiceId, invoiceItemId, effectiveDate, context)
396
+ # conversion for accountId [type = java.util.UUID]
397
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
398
+ # conversion for invoiceId [type = java.util.UUID]
399
+ invoiceId = java.util.UUID.fromString(invoiceId.to_s) unless invoiceId.nil?
400
+ # conversion for invoiceItemId [type = java.util.UUID]
401
+ invoiceItemId = java.util.UUID.fromString(invoiceItemId.to_s) unless invoiceItemId.nil?
402
+ # conversion for effectiveDate [type = org.joda.time.LocalDate]
403
+ if !effectiveDate.nil?
404
+ effectiveDate = Java::org.joda.time.LocalDate.parse(effectiveDate.to_s)
405
+ end
406
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
407
+ context = context.to_java unless context.nil?
408
+ begin
409
+ res = @real_java_api.insert_invoice_item_adjustment(accountId, invoiceId, invoiceItemId, effectiveDate, context)
410
+ # conversion for res [type = com.ning.billing.invoice.api.InvoiceItem]
411
+ res = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(res) unless res.nil?
412
+ return res
413
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
414
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
415
+ end
416
+ end
417
+
418
+ java_signature 'Java::void deleteCBA(Java::java.util.UUID, Java::java.util.UUID, Java::java.util.UUID, Java::com.ning.billing.util.callcontext.CallContext)'
419
+ def delete_cba(accountId, invoiceId, invoiceItemId, context)
420
+ # conversion for accountId [type = java.util.UUID]
421
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
422
+ # conversion for invoiceId [type = java.util.UUID]
423
+ invoiceId = java.util.UUID.fromString(invoiceId.to_s) unless invoiceId.nil?
424
+ # conversion for invoiceItemId [type = java.util.UUID]
425
+ invoiceItemId = java.util.UUID.fromString(invoiceItemId.to_s) unless invoiceItemId.nil?
426
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
427
+ context = context.to_java unless context.nil?
428
+ @real_java_api.delete_cba(accountId, invoiceId, invoiceItemId, context)
429
+ end
430
+
431
+ java_signature 'Java::java.lang.String getInvoiceAsHTML(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
432
+ def get_invoice_as_html(invoiceId, context)
433
+ # conversion for invoiceId [type = java.util.UUID]
434
+ invoiceId = java.util.UUID.fromString(invoiceId.to_s) unless invoiceId.nil?
435
+ # conversion for context [type = com.ning.billing.util.callcontext.TenantContext]
436
+ context = context.to_java unless context.nil?
437
+ begin
438
+ res = @real_java_api.get_invoice_as_html(invoiceId, context)
439
+ # conversion for res [type = java.lang.String]
440
+ return res
441
+ rescue Java::com.ning.billing.account.api.AccountApiException => e
442
+ raise Killbill::Plugin::Model::AccountApiException.new.to_ruby(e)
443
+ rescue Java::java.io.IOException => e
444
+ raise ApiException.new("java.io.IOException: #{e.msg unless e.msg.nil?}")
445
+ rescue Java::com.ning.billing.invoice.api.InvoiceApiException => e
446
+ raise Killbill::Plugin::Model::InvoiceApiException.new.to_ruby(e)
447
+ end
448
+ end
449
+
450
+ java_signature 'Java::void consumeExstingCBAOnAccountWithUnpaidInvoices(Java::java.util.UUID, Java::com.ning.billing.util.callcontext.CallContext)'
451
+ def consume_exsting_cba_onaccount_with_unpaid_invoices(accountId, context)
452
+ # conversion for accountId [type = java.util.UUID]
453
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
454
+ # conversion for context [type = com.ning.billing.util.callcontext.CallContext]
455
+ context = context.to_java unless context.nil?
456
+ @real_java_api.consume_exsting_cba_onaccount_with_unpaid_invoices(accountId, context)
457
+ end
458
+ end
459
+ end
460
+ end
461
+ end