Class: Killbill::Plugin::Model::Payment

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePayment

Returns a new instance of Payment.



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

def 
  @account_id
end

#auth_amountObject

Returns the value of attribute auth_amount.



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

def auth_amount
  @auth_amount
end

#captured_amountObject

Returns the value of attribute captured_amount.



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

def captured_amount
  @captured_amount
end

#created_dateObject

Returns the value of attribute created_date.



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

def credited_amount
  @credited_amount
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#external_keyObject

Returns the value of attribute external_key.



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

def external_key
  @external_key
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#is_auth_voidedObject

Returns the value of attribute is_auth_voided.



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

def is_auth_voided
  @is_auth_voided
end

#payment_attemptsObject

Returns the value of attribute payment_attempts.



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

def payment_attempts
  @payment_attempts
end

#payment_method_idObject

Returns the value of attribute payment_method_id.



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

def payment_method_id
  @payment_method_id
end

#payment_numberObject

Returns the value of attribute payment_number.



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

def payment_number
  @payment_number
end

#purchased_amountObject

Returns the value of attribute purchased_amount.



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

def purchased_amount
  @purchased_amount
end

#refunded_amountObject

Returns the value of attribute refunded_amount.



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

def refunded_amount
  @refunded_amount
end

#transactionsObject

Returns the value of attribute transactions.



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

def transactions
  @transactions
end

#updated_dateObject

Returns the value of attribute updated_date.



37
38
39
# File 'lib/killbill/gen/api/payment.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
# File 'lib/killbill/gen/api/payment.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_number [type = java.lang.Integer]
  @payment_number = @payment_number

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

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

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

  # conversion for purchased_amount [type = java.math.BigDecimal]
  if @purchased_amount.nil?
    @purchased_amount = java.math.BigDecimal::ZERO
  else
    @purchased_amount = java.math.BigDecimal.new(@purchased_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 is_auth_voided [type = java.lang.Boolean]
  @is_auth_voided = @is_auth_voided.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(@is_auth_voided)

  # 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 transactions [type = java.util.List]
  tmp = java.util.ArrayList.new
  (@transactions || []).each do |m|
    # conversion for m [type = org.killbill.billing.payment.api.PaymentTransaction]
    m = m.to_java unless m.nil?
    tmp.add(m)
  end
  @transactions = tmp

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

#to_ruby(j_obj) ⇒ Object



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
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
# File 'lib/killbill/gen/api/payment.rb', line 131

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_number [type = java.lang.Integer]
  @payment_number = j_obj.payment_number

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

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

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

  # conversion for purchased_amount [type = java.math.BigDecimal]
  @purchased_amount = j_obj.purchased_amount
  @purchased_amount = @purchased_amount.nil? ? 0 : BigDecimal.new(@purchased_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 is_auth_voided [type = java.lang.Boolean]
  @is_auth_voided = j_obj.is_auth_voided
  if @is_auth_voided.nil?
    @is_auth_voided = false
  else
    tmp_bool = (@is_auth_voided.java_kind_of? java.lang.Boolean) ? @is_auth_voided.boolean_value : @is_auth_voided
    @is_auth_voided = tmp_bool ? true : false
  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 transactions [type = java.util.List]
  @transactions = j_obj.transactions
  tmp = []
  (@transactions || []).each do |m|
    # conversion for m [type = org.killbill.billing.payment.api.PaymentTransaction]
    m = Killbill::Plugin::Model::PaymentTransaction.new.to_ruby(m) unless m.nil?
    tmp << m
  end
  @transactions = tmp

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