Class: Killbill::Plugin::Api::InvoicePaymentApi

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

Instance Method Summary collapse

Constructor Details

#initialize(real_java_api) ⇒ InvoicePaymentApi

Returns a new instance of InvoicePaymentApi.



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

def initialize(real_java_api)
  @real_java_api = real_java_api
end

Instance Method Details

#create_chargeback_for_invoice_payment(account, paymentId, amount, currency, effectiveDate, paymentTransactionExternalKey, properties, paymentOptions, context) ⇒ Object



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

def create_chargeback_for_invoice_payment(, paymentId, amount, currency, effectiveDate, paymentTransactionExternalKey, properties, paymentOptions, context)

  # conversion for account [type = org.killbill.billing.account.api.Account]
   = .to_java unless .nil?

  # conversion for paymentId [type = java.util.UUID]
  paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.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 effectiveDate [type = org.joda.time.DateTime]
  if !effectiveDate.nil?
    effectiveDate =  (effectiveDate.kind_of? Time) ? DateTime.parse(effectiveDate.to_s) : effectiveDate
    effectiveDate = Java::org.joda.time.DateTime.new(effectiveDate.to_s, Java::org.joda.time.DateTimeZone::UTC)
  end

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = java.util.ArrayList.new
  (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
  properties = tmp

  # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
  paymentOptions = paymentOptions.to_java unless paymentOptions.nil?

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = context.to_java unless context.nil?
  begin
    res = @real_java_api.create_chargeback_for_invoice_payment(, paymentId, amount, currency, effectiveDate, paymentTransactionExternalKey, properties, paymentOptions, context)
    # conversion for res [type = org.killbill.billing.invoice.api.InvoicePayment]
    res = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(res) unless res.nil?
    return res
  rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
    raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
  end
end

#create_chargeback_reversal_for_invoice_payment(account, paymentId, effectiveDate, paymentTransactionExternalKey, properties, paymentOptions, context) ⇒ Object



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
322
323
324
325
326
327
328
# File 'lib/killbill/gen/api/invoice_payment_api.rb', line 289

def create_chargeback_reversal_for_invoice_payment(, paymentId, effectiveDate, paymentTransactionExternalKey, properties, paymentOptions, context)

  # conversion for account [type = org.killbill.billing.account.api.Account]
   = .to_java unless .nil?

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

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = java.util.ArrayList.new
  (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
  properties = tmp

  # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
  paymentOptions = paymentOptions.to_java unless paymentOptions.nil?

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = context.to_java unless context.nil?
  begin
    res = @real_java_api.create_chargeback_reversal_for_invoice_payment(, paymentId, effectiveDate, paymentTransactionExternalKey, properties, paymentOptions, context)
    # conversion for res [type = org.killbill.billing.invoice.api.InvoicePayment]
    res = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(res) unless res.nil?
    return res
  rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
    raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
  end
end

#create_credit_for_invoice_payment(isAdjusted, adjustments, account, originalPaymentId, paymentMethodId, paymentId, amount, currency, effectiveDate, paymentExternalKey, paymentTransactionExternalKey, properties, paymentOptions, context) ⇒ Object



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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/killbill/gen/api/invoice_payment_api.rb', line 166

def create_credit_for_invoice_payment(isAdjusted, adjustments, , originalPaymentId, paymentMethodId, paymentId, amount, currency, effectiveDate, paymentExternalKey, paymentTransactionExternalKey, properties, paymentOptions, context)

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

      # conversion for adjustments [type = java.util.Map]
      tmp = java.util.HashMap.new
      (adjustments || {}).each do |k,v|
      tmp.put(k, v)
    end
  adjustments = tmp

  # conversion for account [type = org.killbill.billing.account.api.Account]
   = .to_java unless .nil?

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

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

  # conversion for paymentId [type = java.util.UUID]
  paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.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 effectiveDate [type = org.joda.time.DateTime]
  if !effectiveDate.nil?
    effectiveDate =  (effectiveDate.kind_of? Time) ? DateTime.parse(effectiveDate.to_s) : effectiveDate
    effectiveDate = Java::org.joda.time.DateTime.new(effectiveDate.to_s, Java::org.joda.time.DateTimeZone::UTC)
  end

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = java.util.ArrayList.new
  (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
  properties = tmp

  # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
  paymentOptions = paymentOptions.to_java unless paymentOptions.nil?

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = context.to_java unless context.nil?
  begin
    res = @real_java_api.create_credit_for_invoice_payment(isAdjusted, adjustments, , originalPaymentId, paymentMethodId, paymentId, amount, currency, effectiveDate, paymentExternalKey, paymentTransactionExternalKey, properties, paymentOptions, context)
    # conversion for res [type = org.killbill.billing.invoice.api.InvoicePayment]
    res = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(res) unless res.nil?
    return res
  rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
    raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
  end
end

#create_purchase_for_invoice_payment(account, invoiceId, paymentMethodId, paymentId, amount, currency, effectiveDate, paymentExternalKey, paymentTransactionExternalKey, properties, paymentOptions, context) ⇒ Object



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

def create_purchase_for_invoice_payment(, invoiceId, paymentMethodId, paymentId, amount, currency, effectiveDate, paymentExternalKey, paymentTransactionExternalKey, properties, paymentOptions, context)

  # conversion for account [type = org.killbill.billing.account.api.Account]
   = .to_java unless .nil?

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

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

  # conversion for paymentId [type = java.util.UUID]
  paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.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 effectiveDate [type = org.joda.time.DateTime]
  if !effectiveDate.nil?
    effectiveDate =  (effectiveDate.kind_of? Time) ? DateTime.parse(effectiveDate.to_s) : effectiveDate
    effectiveDate = Java::org.joda.time.DateTime.new(effectiveDate.to_s, Java::org.joda.time.DateTimeZone::UTC)
  end

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = java.util.ArrayList.new
  (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
  properties = tmp

  # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
  paymentOptions = paymentOptions.to_java unless paymentOptions.nil?

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = context.to_java unless context.nil?
  begin
    res = @real_java_api.create_purchase_for_invoice_payment(, invoiceId, paymentMethodId, paymentId, amount, currency, effectiveDate, paymentExternalKey, paymentTransactionExternalKey, properties, paymentOptions, context)
    # conversion for res [type = org.killbill.billing.invoice.api.InvoicePayment]
    res = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(res) unless res.nil?
    return res
  rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
    raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
  end
end

#create_refund_for_invoice_payment(isAdjusted, adjustments, account, paymentId, amount, currency, effectiveDate, paymentTransactionExternalKey, properties, paymentOptions, context) ⇒ Object



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

def create_refund_for_invoice_payment(isAdjusted, adjustments, , paymentId, amount, currency, effectiveDate, paymentTransactionExternalKey, properties, paymentOptions, context)

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

      # conversion for adjustments [type = java.util.Map]
      tmp = java.util.HashMap.new
      (adjustments || {}).each do |k,v|
      tmp.put(k, v)
    end
  adjustments = tmp

  # conversion for account [type = org.killbill.billing.account.api.Account]
   = .to_java unless .nil?

  # conversion for paymentId [type = java.util.UUID]
  paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.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 effectiveDate [type = org.joda.time.DateTime]
  if !effectiveDate.nil?
    effectiveDate =  (effectiveDate.kind_of? Time) ? DateTime.parse(effectiveDate.to_s) : effectiveDate
    effectiveDate = Java::org.joda.time.DateTime.new(effectiveDate.to_s, Java::org.joda.time.DateTimeZone::UTC)
  end

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = java.util.ArrayList.new
  (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
  properties = tmp

  # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
  paymentOptions = paymentOptions.to_java unless paymentOptions.nil?

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = context.to_java unless context.nil?
  begin
    res = @real_java_api.create_refund_for_invoice_payment(isAdjusted, adjustments, , paymentId, amount, currency, effectiveDate, paymentTransactionExternalKey, properties, paymentOptions, context)
    # conversion for res [type = org.killbill.billing.invoice.api.InvoicePayment]
    res = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(res) unless res.nil?
    return res
  rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
    raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
  end
end

#get_invoice_payments(paymentId, context) ⇒ Object



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/killbill/gen/api/invoice_payment_api.rb', line 331

def get_invoice_payments(paymentId, context)

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

  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
  context = context.to_java unless context.nil?
  res = @real_java_api.get_invoice_payments(paymentId, context)
  # conversion for res [type = java.util.List]
  tmp = []
  (res || []).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
  res = tmp
  return res
end

#get_invoice_payments_by_account(accountId, context) ⇒ Object



351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/killbill/gen/api/invoice_payment_api.rb', line 351

def (accountId, context)

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

  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
  context = context.to_java unless context.nil?
  res = @real_java_api.(accountId, context)
  # conversion for res [type = java.util.List]
  tmp = []
  (res || []).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
  res = tmp
  return res
end