Class: Killbill::Plugin::Model::PaymentAttempt

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePaymentAttempt

Returns a new instance of PaymentAttempt.



39
40
# File 'lib/killbill/gen/api/payment_attempt.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/payment_attempt.rb', line 37

def 
  @account_id
end

#amountObject

Returns the value of attribute amount.



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

def amount
  @amount
end

#created_dateObject

Returns the value of attribute created_date.



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

def created_date
  @created_date
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#effective_dateObject

Returns the value of attribute effective_date.



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

def effective_date
  @effective_date
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#payment_external_keyObject

Returns the value of attribute payment_external_key.



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

def payment_external_key
  @payment_external_key
end

#payment_method_idObject

Returns the value of attribute payment_method_id.



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

def payment_method_id
  @payment_method_id
end

#plugin_nameObject

Returns the value of attribute plugin_name.



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

def plugin_name
  @plugin_name
end

#plugin_propertiesObject

Returns the value of attribute plugin_properties.



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

def plugin_properties
  @plugin_properties
end

#state_nameObject

Returns the value of attribute state_name.



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

def state_name
  @state_name
end

#transaction_external_keyObject

Returns the value of attribute transaction_external_key.



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

def transaction_external_key
  @transaction_external_key
end

#transaction_idObject

Returns the value of attribute transaction_id.



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

def transaction_id
  @transaction_id
end

#transaction_typeObject

Returns the value of attribute transaction_type.



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

def transaction_type
  @transaction_type
end

#updated_dateObject

Returns the value of attribute updated_date.



37
38
39
# File 'lib/killbill/gen/api/payment_attempt.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
# File 'lib/killbill/gen/api/payment_attempt.rb', line 42

def to_java()
  # 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 account_id [type = java.util.UUID]
  @account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?

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

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

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

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

  # conversion for transaction_type [type = org.killbill.billing.payment.api.TransactionType]
  @transaction_type = Java::org.killbill.billing.payment.api.TransactionType.value_of( @transaction_type.to_s ) unless @transaction_type.nil?

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

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

  # conversion for amount [type = java.math.BigDecimal]
  if @amount.nil?
    @amount = java.math.BigDecimal::ZERO
  else
    @amount = java.math.BigDecimal.new(@amount.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 plugin_name [type = java.lang.String]
  @plugin_name = @plugin_name.to_s unless @plugin_name.nil?

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

#to_ruby(j_obj) ⇒ Object



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
177
178
179
180
181
182
183
184
# File 'lib/killbill/gen/api/payment_attempt.rb', line 109

def to_ruby(j_obj)
  # 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 account_id [type = java.util.UUID]
  @account_id = j_obj.
  @account_id = @account_id.nil? ? nil : @account_id.to_s

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

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

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

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

  # conversion for transaction_type [type = org.killbill.billing.payment.api.TransactionType]
  @transaction_type = j_obj.transaction_type
  @transaction_type = @transaction_type.to_s.to_sym unless @transaction_type.nil?

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

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

  # conversion for amount [type = java.math.BigDecimal]
  @amount = j_obj.amount
  @amount = @amount.nil? ? 0 : BigDecimal.new(@amount.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?

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

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