Class: Killbill::Plugin::Model::InvoiceFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/killbill/gen/api/invoice_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInvoiceFormatter

Returns a new instance of InvoiceFormatter.



39
40
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 39

def initialize()
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def 
  @account_id
end

#balanceObject

Returns the value of attribute balance.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def balance
  @balance
end

#charged_amountObject

Returns the value of attribute charged_amount.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def charged_amount
  @charged_amount
end

#created_dateObject

Returns the value of attribute created_date.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def created_date
  @created_date
end

#credited_amountObject

Returns the value of attribute credited_amount.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def credited_amount
  @credited_amount
end

#currencyObject

Returns the value of attribute currency.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def currency
  @currency
end

#formatted_balanceObject

Returns the value of attribute formatted_balance.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def formatted_balance
  @formatted_balance
end

#formatted_charged_amountObject

Returns the value of attribute formatted_charged_amount.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def formatted_charged_amount
  @formatted_charged_amount
end

#formatted_invoice_dateObject

Returns the value of attribute formatted_invoice_date.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def formatted_invoice_date
  @formatted_invoice_date
end

#formatted_paid_amountObject

Returns the value of attribute formatted_paid_amount.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def formatted_paid_amount
  @formatted_paid_amount
end

#idObject

Returns the value of attribute id.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def id
  @id
end

#invoice_dateObject

Returns the value of attribute invoice_date.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def invoice_date
  @invoice_date
end

#invoice_itemsObject

Returns the value of attribute invoice_items.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def invoice_items
  @invoice_items
end

#invoice_numberObject

Returns the value of attribute invoice_number.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def invoice_number
  @invoice_number
end

#is_migration_invoiceObject

Returns the value of attribute is_migration_invoice.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def is_migration_invoice
  @is_migration_invoice
end

#is_parent_invoiceObject

Returns the value of attribute is_parent_invoice.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def is_parent_invoice
  @is_parent_invoice
end

#number_of_itemsObject

Returns the value of attribute number_of_items.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def number_of_items
  @number_of_items
end

#number_of_paymentsObject

Returns the value of attribute number_of_payments.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def number_of_payments
  @number_of_payments
end

#original_charged_amountObject

Returns the value of attribute original_charged_amount.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def original_charged_amount
  @original_charged_amount
end

Returns the value of attribute paid_amount.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def paid_amount
  @paid_amount
end

#parent_account_idObject

Returns the value of attribute parent_account_id.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def 
  
end

#parent_invoice_idObject

Returns the value of attribute parent_invoice_id.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def parent_invoice_id
  @parent_invoice_id
end

#paymentsObject

Returns the value of attribute payments.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def payments
  @payments
end

#processed_currencyObject

Returns the value of attribute processed_currency.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def processed_currency
  @processed_currency
end

#processed_payment_rateObject

Returns the value of attribute processed_payment_rate.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def processed_payment_rate
  @processed_payment_rate
end

#refunded_amountObject

Returns the value of attribute refunded_amount.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def refunded_amount
  @refunded_amount
end

#statusObject

Returns the value of attribute status.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def status
  @status
end

#target_dateObject

Returns the value of attribute target_date.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def target_date
  @target_date
end

#updated_dateObject

Returns the value of attribute updated_date.



37
38
39
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 37

def updated_date
  @updated_date
end

Instance Method Details

#to_javaObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 42

def to_java()
  # conversion for invoice_items [type = java.util.List]
  tmp = java.util.ArrayList.new
  (@invoice_items || []).each do |m|
    # conversion for m [type = org.killbill.billing.invoice.api.InvoiceItem]
    m = m.to_java unless m.nil?
    tmp.add(m)
  end
  @invoice_items = tmp

  # conversion for number_of_items [type = int]
  @number_of_items = @number_of_items

  # conversion for payments [type = java.util.List]
  tmp = java.util.ArrayList.new
  (@payments || []).each do |m|
    # conversion for m [type = org.killbill.billing.invoice.api.InvoicePayment]
    m = m.to_java unless m.nil?
    tmp.add(m)
  end
  @payments = tmp

  # conversion for number_of_payments [type = int]
  @number_of_payments = @number_of_payments

  # conversion for account_id [type = java.util.UUID]
  @account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?

  # conversion for invoice_number [type = java.lang.Integer]
  @invoice_number = @invoice_number

  # conversion for invoice_date [type = org.joda.time.LocalDate]
  if !@invoice_date.nil?
    @invoice_date = Java::org.joda.time.LocalDate.parse(@invoice_date.to_s)
  end

  # conversion for target_date [type = org.joda.time.LocalDate]
  if !@target_date.nil?
    @target_date = Java::org.joda.time.LocalDate.parse(@target_date.to_s)
  end

  # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
  @currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @currency.to_s ) unless @currency.nil?

  # conversion for paid_amount [type = java.math.BigDecimal]
  if @paid_amount.nil?
    @paid_amount = java.math.BigDecimal::ZERO
  else
    @paid_amount = java.math.BigDecimal.new(@paid_amount.to_s)
  end

  # conversion for original_charged_amount [type = java.math.BigDecimal]
  if @original_charged_amount.nil?
    @original_charged_amount = java.math.BigDecimal::ZERO
  else
    @original_charged_amount = java.math.BigDecimal.new(@original_charged_amount.to_s)
  end

  # conversion for charged_amount [type = java.math.BigDecimal]
  if @charged_amount.nil?
    @charged_amount = java.math.BigDecimal::ZERO
  else
    @charged_amount = java.math.BigDecimal.new(@charged_amount.to_s)
  end

  # conversion for credited_amount [type = java.math.BigDecimal]
  if @credited_amount.nil?
    @credited_amount = java.math.BigDecimal::ZERO
  else
    @credited_amount = java.math.BigDecimal.new(@credited_amount.to_s)
  end

  # conversion for refunded_amount [type = java.math.BigDecimal]
  if @refunded_amount.nil?
    @refunded_amount = java.math.BigDecimal::ZERO
  else
    @refunded_amount = java.math.BigDecimal.new(@refunded_amount.to_s)
  end

  # conversion for balance [type = java.math.BigDecimal]
  if @balance.nil?
    @balance = java.math.BigDecimal::ZERO
  else
    @balance = java.math.BigDecimal.new(@balance.to_s)
  end

  # conversion for is_migration_invoice [type = boolean]
  @is_migration_invoice = @is_migration_invoice.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(@is_migration_invoice)

  # conversion for status [type = org.killbill.billing.invoice.api.InvoiceStatus]
  @status = Java::org.killbill.billing.invoice.api.InvoiceStatus.value_of( @status.to_s ) unless @status.nil?

  # conversion for is_parent_invoice [type = boolean]
  @is_parent_invoice = @is_parent_invoice.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(@is_parent_invoice)

  # conversion for parent_account_id [type = java.util.UUID]
   = java.util.UUID.fromString(.to_s) unless .nil?

  # conversion for parent_invoice_id [type = java.util.UUID]
  @parent_invoice_id = java.util.UUID.fromString(@parent_invoice_id.to_s) unless @parent_invoice_id.nil?

  # conversion for id [type = java.util.UUID]
  @id = java.util.UUID.fromString(@id.to_s) unless @id.nil?

  # conversion for created_date [type = org.joda.time.DateTime]
  if !@created_date.nil?
    @created_date =  (@created_date.kind_of? Time) ? DateTime.parse(@created_date.to_s) : @created_date
    @created_date = Java::org.joda.time.DateTime.new(@created_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
  end

  # conversion for updated_date [type = org.joda.time.DateTime]
  if !@updated_date.nil?
    @updated_date =  (@updated_date.kind_of? Time) ? DateTime.parse(@updated_date.to_s) : @updated_date
    @updated_date = Java::org.joda.time.DateTime.new(@updated_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
  end

  # conversion for formatted_invoice_date [type = java.lang.String]
  @formatted_invoice_date = @formatted_invoice_date.to_s unless @formatted_invoice_date.nil?

  # conversion for formatted_charged_amount [type = java.lang.String]
  @formatted_charged_amount = @formatted_charged_amount.to_s unless @formatted_charged_amount.nil?

  # conversion for formatted_paid_amount [type = java.lang.String]
  @formatted_paid_amount = @formatted_paid_amount.to_s unless @formatted_paid_amount.nil?

  # conversion for formatted_balance [type = java.lang.String]
  @formatted_balance = @formatted_balance.to_s unless @formatted_balance.nil?

  # conversion for processed_currency [type = org.killbill.billing.catalog.api.Currency]
  @processed_currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @processed_currency.to_s ) unless @processed_currency.nil?

  # conversion for processed_payment_rate [type = java.lang.String]
  @processed_payment_rate = @processed_payment_rate.to_s unless @processed_payment_rate.nil?
  self
end

#to_ruby(j_obj) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/killbill/gen/api/invoice_formatter.rb', line 178

def to_ruby(j_obj)
  # conversion for invoice_items [type = java.util.List]
  @invoice_items = j_obj.invoice_items
  tmp = []
  (@invoice_items || []).each do |m|
    # conversion for m [type = org.killbill.billing.invoice.api.InvoiceItem]
    m = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(m) unless m.nil?
    tmp << m
  end
  @invoice_items = tmp

  # conversion for number_of_items [type = int]
  @number_of_items = j_obj.number_of_items

  # conversion for payments [type = java.util.List]
  @payments = j_obj.payments
  tmp = []
  (@payments || []).each do |m|
    # conversion for m [type = org.killbill.billing.invoice.api.InvoicePayment]
    m = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(m) unless m.nil?
    tmp << m
  end
  @payments = tmp

  # conversion for number_of_payments [type = int]
  @number_of_payments = j_obj.number_of_payments

  # conversion for account_id [type = java.util.UUID]
  @account_id = j_obj.
  @account_id = @account_id.nil? ? nil : @account_id.to_s

  # conversion for invoice_number [type = java.lang.Integer]
  @invoice_number = j_obj.invoice_number

  # conversion for invoice_date [type = org.joda.time.LocalDate]
  @invoice_date = j_obj.invoice_date
  if !@invoice_date.nil?
    @invoice_date = @invoice_date.to_s
  end

  # conversion for target_date [type = org.joda.time.LocalDate]
  @target_date = j_obj.target_date
  if !@target_date.nil?
    @target_date = @target_date.to_s
  end

  # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
  @currency = j_obj.currency
  @currency = @currency.to_s.to_sym unless @currency.nil?

  # conversion for paid_amount [type = java.math.BigDecimal]
  @paid_amount = j_obj.paid_amount
  @paid_amount = @paid_amount.nil? ? 0 : BigDecimal.new(@paid_amount.to_s)

  # conversion for original_charged_amount [type = java.math.BigDecimal]
  @original_charged_amount = j_obj.original_charged_amount
  @original_charged_amount = @original_charged_amount.nil? ? 0 : BigDecimal.new(@original_charged_amount.to_s)

  # conversion for charged_amount [type = java.math.BigDecimal]
  @charged_amount = j_obj.charged_amount
  @charged_amount = @charged_amount.nil? ? 0 : BigDecimal.new(@charged_amount.to_s)

  # conversion for credited_amount [type = java.math.BigDecimal]
  @credited_amount = j_obj.credited_amount
  @credited_amount = @credited_amount.nil? ? 0 : BigDecimal.new(@credited_amount.to_s)

  # conversion for refunded_amount [type = java.math.BigDecimal]
  @refunded_amount = j_obj.refunded_amount
  @refunded_amount = @refunded_amount.nil? ? 0 : BigDecimal.new(@refunded_amount.to_s)

  # conversion for balance [type = java.math.BigDecimal]
  @balance = j_obj.balance
  @balance = @balance.nil? ? 0 : BigDecimal.new(@balance.to_s)

  # conversion for is_migration_invoice [type = boolean]
  @is_migration_invoice = j_obj.is_migration_invoice
  if @is_migration_invoice.nil?
    @is_migration_invoice = false
  else
    tmp_bool = (@is_migration_invoice.java_kind_of? java.lang.Boolean) ? @is_migration_invoice.boolean_value : @is_migration_invoice
    @is_migration_invoice = tmp_bool ? true : false
  end

  # conversion for status [type = org.killbill.billing.invoice.api.InvoiceStatus]
  @status = j_obj.status
  @status = @status.to_s.to_sym unless @status.nil?

  # conversion for is_parent_invoice [type = boolean]
  @is_parent_invoice = j_obj.is_parent_invoice
  if @is_parent_invoice.nil?
    @is_parent_invoice = false
  else
    tmp_bool = (@is_parent_invoice.java_kind_of? java.lang.Boolean) ? @is_parent_invoice.boolean_value : @is_parent_invoice
    @is_parent_invoice = tmp_bool ? true : false
  end

  # conversion for parent_account_id [type = java.util.UUID]
   = j_obj.
   = .nil? ? nil : .to_s

  # conversion for parent_invoice_id [type = java.util.UUID]
  @parent_invoice_id = j_obj.parent_invoice_id
  @parent_invoice_id = @parent_invoice_id.nil? ? nil : @parent_invoice_id.to_s

  # conversion for id [type = java.util.UUID]
  @id = j_obj.id
  @id = @id.nil? ? nil : @id.to_s

  # conversion for created_date [type = org.joda.time.DateTime]
  @created_date = j_obj.created_date
  if !@created_date.nil?
    fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
    str = fmt.print(@created_date)
    @created_date = DateTime.iso8601(str)
  end

  # conversion for updated_date [type = org.joda.time.DateTime]
  @updated_date = j_obj.updated_date
  if !@updated_date.nil?
    fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
    str = fmt.print(@updated_date)
    @updated_date = DateTime.iso8601(str)
  end

  # conversion for formatted_invoice_date [type = java.lang.String]
  @formatted_invoice_date = j_obj.formatted_invoice_date

  # conversion for formatted_charged_amount [type = java.lang.String]
  @formatted_charged_amount = j_obj.formatted_charged_amount

  # conversion for formatted_paid_amount [type = java.lang.String]
  @formatted_paid_amount = j_obj.formatted_paid_amount

  # conversion for formatted_balance [type = java.lang.String]
  @formatted_balance = j_obj.formatted_balance

  # conversion for processed_currency [type = org.killbill.billing.catalog.api.Currency]
  @processed_currency = j_obj.processed_currency
  @processed_currency = @processed_currency.to_s.to_sym unless @processed_currency.nil?

  # conversion for processed_payment_rate [type = java.lang.String]
  @processed_payment_rate = j_obj.processed_payment_rate
  self
end