Class: Killbill::Plugin::Model::InvoiceNotificationMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/killbill/gen/plugin-api/invoice_notification_metadata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInvoiceNotificationMetadata

Returns a new instance of InvoiceNotificationMetadata.



37
38
# File 'lib/killbill/gen/plugin-api/invoice_notification_metadata.rb', line 37

def initialize()
end

Instance Attribute Details

#amount_owedObject

Returns the value of attribute amount_owed.



35
36
37
# File 'lib/killbill/gen/plugin-api/invoice_notification_metadata.rb', line 35

def amount_owed
  @amount_owed
end

#currencyObject

Returns the value of attribute currency.



35
36
37
# File 'lib/killbill/gen/plugin-api/invoice_notification_metadata.rb', line 35

def currency
  @currency
end

#target_dateObject

Returns the value of attribute target_date.



35
36
37
# File 'lib/killbill/gen/plugin-api/invoice_notification_metadata.rb', line 35

def target_date
  @target_date
end

Instance Method Details

#to_javaObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/killbill/gen/plugin-api/invoice_notification_metadata.rb', line 40

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

  # conversion for amount_owed [type = java.math.BigDecimal]
  if @amount_owed.nil?
    @amount_owed = java.math.BigDecimal::ZERO
  else
    @amount_owed = java.math.BigDecimal.new(@amount_owed.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?
  Java::org.killbill.billing.notification.plugin.api.InvoiceNotificationMetadata.new(@target_date, @amount_owed, @currency)
end

#to_ruby(j_obj) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/killbill/gen/plugin-api/invoice_notification_metadata.rb', line 59

def to_ruby(j_obj)
  # conversion for target_date [type = org.joda.time.DateTime]
  @target_date = j_obj.target_date
  if !@target_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(@target_date)
    @target_date = DateTime.iso8601(str)
  end

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

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