Class: Killbill::Plugin::Api::PaymentPluginApi

Inherits:
NotificationPluginApi show all
Defined in:
lib/killbill/gen/plugin-api/payment_plugin_api.rb

Instance Attribute Summary

Attributes inherited from JPlugin

#delegate_plugin, #rack_handler

Instance Method Summary collapse

Methods inherited from NotificationPluginApi

#on_event

Methods inherited from JPlugin

#is_active, #logger, #start_plugin, #stop_plugin

Constructor Details

#initialize(real_class_name, services = {}) ⇒ PaymentPluginApi

Returns a new instance of PaymentPluginApi.



38
39
40
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 38

def initialize(real_class_name, services = {})
  super(real_class_name, services)
end

Instance Method Details

#add_payment_method(kbAccountId, kbPaymentMethodId, paymentMethodProps, setDefault, properties, context) ⇒ Object



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 412

def add_payment_method(kbAccountId, kbPaymentMethodId, paymentMethodProps, setDefault, properties, context)

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

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

  # conversion for paymentMethodProps [type = org.killbill.billing.payment.api.PaymentMethodPlugin]
  paymentMethodProps = Killbill::Plugin::Model::PaymentMethodPlugin.new.to_ruby(paymentMethodProps) unless paymentMethodProps.nil?

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    @delegate_plugin.add_payment_method(kbAccountId, kbPaymentMethodId, paymentMethodProps, setDefault, properties, context)
  rescue Exception => e
    message = "Failure in add_payment_method: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("add_payment_method failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#authorize_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context) ⇒ Object



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

def authorize_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context)

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

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

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

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

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.authorize_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context)
    # conversion for res [type = org.killbill.billing.payment.plugin.api.PaymentTransactionInfoPlugin]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in authorize_payment: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("authorize_payment failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#build_form_descriptor(kbAccountId, customFields, properties, context) ⇒ Object



687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 687

def build_form_descriptor(kbAccountId, customFields, properties, context)

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

  # conversion for customFields [type = java.lang.Iterable]
  tmp = []
  (customFields.nil? ? [] : customFields.iterator).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
  customFields = tmp

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.build_form_descriptor(kbAccountId, customFields, properties, context)
    # conversion for res [type = org.killbill.billing.payment.plugin.api.HostedPaymentPageFormDescriptor]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in build_form_descriptor: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("build_form_descriptor failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#capture_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context) ⇒ Object



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

def capture_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context)

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

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

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

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

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.capture_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context)
    # conversion for res [type = org.killbill.billing.payment.plugin.api.PaymentTransactionInfoPlugin]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in capture_payment: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("capture_payment failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#credit_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context) ⇒ Object



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

def credit_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context)

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

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

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

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

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.credit_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context)
    # conversion for res [type = org.killbill.billing.payment.plugin.api.PaymentTransactionInfoPlugin]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in credit_payment: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("credit_payment failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#delete_payment_method(kbAccountId, kbPaymentMethodId, properties, context) ⇒ Object



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 457

def delete_payment_method(kbAccountId, kbPaymentMethodId, properties, context)

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    @delegate_plugin.delete_payment_method(kbAccountId, kbPaymentMethodId, properties, context)
  rescue Exception => e
    message = "Failure in delete_payment_method: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("delete_payment_method failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#get_payment_info(kbAccountId, kbPaymentId, properties, context) ⇒ Object



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 332

def get_payment_info(kbAccountId, kbPaymentId, properties, context)

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
  context = Killbill::Plugin::Model::TenantContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.get_payment_info(kbAccountId, kbPaymentId, properties, context)
    # conversion for res [type = java.util.List]
    tmp = java.util.ArrayList.new
    (res || []).each do |m|
      # conversion for m [type = org.killbill.billing.payment.plugin.api.PaymentTransactionInfoPlugin]
      m = m.to_java unless m.nil?
      tmp.add(m)
    end
    res = tmp
    return res
  rescue Exception => e
    message = "Failure in get_payment_info: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("get_payment_info failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#get_payment_method_detail(kbAccountId, kbPaymentMethodId, properties, context) ⇒ Object



491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 491

def get_payment_method_detail(kbAccountId, kbPaymentMethodId, properties, context)

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
  context = Killbill::Plugin::Model::TenantContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.get_payment_method_detail(kbAccountId, kbPaymentMethodId, properties, context)
    # conversion for res [type = org.killbill.billing.payment.api.PaymentMethodPlugin]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in get_payment_method_detail: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("get_payment_method_detail failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#get_payment_methods(kbAccountId, refreshFromGateway, properties, context) ⇒ Object



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 562

def get_payment_methods(kbAccountId, refreshFromGateway, properties, context)

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.get_payment_methods(kbAccountId, refreshFromGateway, properties, context)
    # conversion for res [type = java.util.List]
    tmp = java.util.ArrayList.new
    (res || []).each do |m|
      # conversion for m [type = org.killbill.billing.payment.plugin.api.PaymentMethodInfoPlugin]
      m = m.to_java unless m.nil?
      tmp.add(m)
    end
    res = tmp
    return res
  rescue Exception => e
    message = "Failure in get_payment_methods: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("get_payment_methods failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#process_notification(notification, properties, context) ⇒ Object



730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 730

def process_notification(notification, properties, context)

  # conversion for notification [type = java.lang.String]

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.process_notification(notification, properties, context)
    # conversion for res [type = org.killbill.billing.payment.plugin.api.GatewayNotification]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in process_notification: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("process_notification failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#purchase_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context) ⇒ Object



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

def purchase_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context)

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

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

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

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

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.purchase_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context)
    # conversion for res [type = org.killbill.billing.payment.plugin.api.PaymentTransactionInfoPlugin]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in purchase_payment: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("purchase_payment failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#refund_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context) ⇒ Object



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

def refund_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context)

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

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

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

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

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.refund_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context)
    # conversion for res [type = org.killbill.billing.payment.plugin.api.PaymentTransactionInfoPlugin]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in refund_payment: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("refund_payment failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#reset_payment_methods(kbAccountId, paymentMethods, properties, context) ⇒ Object



647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 647

def reset_payment_methods(kbAccountId, paymentMethods, properties, context)

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    @delegate_plugin.reset_payment_methods(kbAccountId, paymentMethods, properties, context)
  rescue Exception => e
    message = "Failure in reset_payment_methods: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("reset_payment_methods failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#search_payment_methods(searchKey, offset, limit, properties, context) ⇒ Object



610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 610

def search_payment_methods(searchKey, offset, limit, properties, context)

  # conversion for searchKey [type = java.lang.String]

  # conversion for offset [type = java.lang.Long]

  # conversion for limit [type = java.lang.Long]

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
  context = Killbill::Plugin::Model::TenantContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.search_payment_methods(searchKey, offset, limit, properties, context)
    # conversion for res [type = org.killbill.billing.util.entity.Pagination]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in search_payment_methods: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("search_payment_methods failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#search_payments(searchKey, offset, limit, properties, context) ⇒ Object



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 375

def search_payments(searchKey, offset, limit, properties, context)

  # conversion for searchKey [type = java.lang.String]

  # conversion for offset [type = java.lang.Long]

  # conversion for limit [type = java.lang.Long]

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
  context = Killbill::Plugin::Model::TenantContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.search_payments(searchKey, offset, limit, properties, context)
    # conversion for res [type = org.killbill.billing.util.entity.Pagination]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in search_payments: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("search_payments failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#set_default_payment_method(kbAccountId, kbPaymentMethodId, properties, context) ⇒ Object



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
# File 'lib/killbill/gen/plugin-api/payment_plugin_api.rb', line 528

def set_default_payment_method(kbAccountId, kbPaymentMethodId, properties, context)

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    @delegate_plugin.set_default_payment_method(kbAccountId, kbPaymentMethodId, properties, context)
  rescue Exception => e
    message = "Failure in set_default_payment_method: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("set_default_payment_method failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end

#void_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, properties, context) ⇒ Object



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

def void_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, properties, context)

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

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

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

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

  # conversion for properties [type = java.lang.Iterable]
  tmp = []
  (properties.nil? ? [] : properties.iterator).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
  properties = tmp

  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
  begin
    res = @delegate_plugin.void_payment(kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, properties, context)
    # conversion for res [type = org.killbill.billing.payment.plugin.api.PaymentTransactionInfoPlugin]
    res = res.to_java unless res.nil?
    return res
  rescue Exception => e
    message = "Failure in void_payment: #{e}"
    unless e.backtrace.nil?
      message = "#{message}\n#{e.backtrace.join("\n")}"
    end
    logger.warn message
    raise Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException.new("void_payment failure", e.message)
  ensure
    @delegate_plugin.after_request
  end
end