killbill 3.2.2 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -2
  3. data/Jarfile +7 -7
  4. data/README.md +16 -4
  5. data/VERSION +1 -1
  6. data/gen_config/api.conf +48 -47
  7. data/gen_config/plugin_api.conf +17 -16
  8. data/generators/active_merchant/templates/.gitignore.rb +2 -2
  9. data/generators/active_merchant/templates/lib/api.rb +8 -0
  10. data/generators/active_merchant/templates/plugin.gemspec.rb +1 -0
  11. data/generators/active_merchant/templates/spec/base_plugin_spec.rb +1 -0
  12. data/generators/active_merchant/templates/spec/integration_spec.rb +5 -1
  13. data/killbill.gemspec +1 -0
  14. data/lib/killbill/creator.rb +9 -0
  15. data/lib/killbill/currency.rb +6 -0
  16. data/lib/killbill/gen/api/account_audit_logs_for_object_type.rb +9 -7
  17. data/lib/killbill/gen/api/catalog_user_api.rb +37 -4
  18. data/lib/killbill/gen/api/payment_api.rb +104 -0
  19. data/lib/killbill/gen/api/payment_gateway_api.rb +6 -3
  20. data/lib/killbill/gen/api/plan_phase.rb +1 -8
  21. data/lib/killbill/gen/api/price_list_set.rb +9 -7
  22. data/lib/killbill/gen/api/subscription.rb +20 -1
  23. data/lib/killbill/gen/api/tenant_user_api.rb +3 -3
  24. data/lib/killbill/gen/plugin-api/currency_plugin_with_events_api.rb +207 -0
  25. data/lib/killbill/gen/plugin-api/ext_bus_event.rb +7 -1
  26. data/lib/killbill/gen/plugin-api/invoice_plugin_with_events_api.rb +103 -0
  27. data/lib/killbill/gen/plugin-api/payment_plugin_with_events_api.rb +782 -0
  28. data/lib/killbill/gen/plugin-api/require_gen.rb +3 -0
  29. data/lib/killbill/helpers/active_merchant/configuration.rb +116 -46
  30. data/lib/killbill/helpers/active_merchant/killbill_spec_helper.rb +49 -32
  31. data/lib/killbill/helpers/active_merchant/payment_plugin.rb +18 -6
  32. data/lib/killbill/helpers/active_merchant/private_payment_plugin.rb +3 -3
  33. data/lib/killbill/helpers/active_merchant/utils.rb +37 -70
  34. data/lib/killbill/invoice.rb +6 -0
  35. data/lib/killbill/payment.rb +6 -0
  36. data/lib/killbill/plugin.rb +1 -1
  37. data/lib/killbill/rake_task.rb +1 -1
  38. data/spec/killbill/helpers/configuration_spec.rb +41 -5
  39. data/spec/killbill/helpers/payment_plugin_spec.rb +4 -1
  40. data/spec/killbill/helpers/private_payment_plugin_spec.rb +4 -2
  41. data/spec/killbill/helpers/utils_spec.rb +6 -6
  42. data/spec/killbill/invoice_plugin_api_spec.rb +1 -1
  43. data/spec/killbill/notification_plugin_api_spec.rb +1 -1
  44. data/spec/killbill/payment_plugin_api_spec.rb +1 -1
  45. metadata +19 -3
  46. data/lib/killbill/jnotification.rb +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78a98058965b5bbd7559afd32426452aa08fcd0c
4
- data.tar.gz: 33b92e5f2629345f60769ed4b4c076982a474daf
3
+ metadata.gz: 81fd77593c6707e51b7365481f0796b8df77cd6c
4
+ data.tar.gz: 78da91e758f7cc14cf63ebe0b5581220dd52545f
5
5
  SHA512:
6
- metadata.gz: 7e49b1e770ff125e918d2d58aa1a4a204e87c3a13b71c2b738a8e8ea902a160d069e6b4b777a9ddfc55d92ecb7d04c141145dabd1c48776f3ee4daac229a1f63
7
- data.tar.gz: 9274aa2930d128170b6939c9e73e72bb075ddf26d79e49056aa18adbb8bfc01e2a0924a1323c885545248844e3721860b4463f1908c6814cb0b3607ea4ea8132
6
+ metadata.gz: d36c0fd012d95ea600cc317a8b7c23e1355987989d66b564e5ce54dd8d75c457f4d3ef757787c2db5f0bd3179464865e9235e42abb53c455e6eb583d13e0c263
7
+ data.tar.gz: 5510fa30a9acc0cc9ca5fc6cd15b0aef3f22d7cad6d7ba4385007a1ff88c20633a55466fdcc9bae41fe40b8896636179fa7d9c106116be88524e5250a47461e0
data/.travis.yml CHANGED
@@ -5,8 +5,8 @@ notifications:
5
5
  - kill-bill-commits@googlegroups.com
6
6
 
7
7
  rvm:
8
- - jruby-19mode
9
- - jruby-20mode
8
+ - jruby-1.7.16
9
+ - jruby-20mode # latest 1.7.x
10
10
  - jruby-head
11
11
 
12
12
  jdk:
@@ -17,3 +17,6 @@ jdk:
17
17
  matrix:
18
18
  allow_failures:
19
19
  - rvm: jruby-head
20
+ exclude:
21
+ - rvm: jruby-head
22
+ jdk: openjdk6
data/Jarfile CHANGED
@@ -1,9 +1,9 @@
1
- jar 'org.kill-bill.billing:killbill-api', '0.10.2'
2
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.8.2'
3
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.8.2'
4
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.8.2'
5
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-retry', '0.8.1'
6
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.8.2'
7
- jar 'org.kill-bill.billing:killbill-util:tests', '0.12.0'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.12.4'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.8.3'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.8.3'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.8.3'
5
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-retry', '0.8.3'
6
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.8.3'
7
+ jar 'org.kill-bill.billing:killbill-util:tests', '0.13.4'
8
8
  jar 'org.mockito:mockito-all', '1.9.0'
9
9
  jar 'javax.servlet:javax.servlet-api', '3.0.1'
data/README.md CHANGED
@@ -4,14 +4,17 @@
4
4
  killbill-plugin-framework-ruby
5
5
  ==============================
6
6
 
7
- Framework to write Killbill plugins in Ruby.
7
+ Framework to write Kill Bill plugins in Ruby.
8
8
 
9
9
  There are various types of plugins one can write for Killbill:
10
10
 
11
- 1. notifications plugins, which listen to external bus events and can react to it
12
- 2. payment plugins, which are used to issue payments against a payment gateway
11
+ * notifications plugins, which listen to external bus events and can react to it
12
+ * payment plugins, which issue payments against a payment gateway
13
+ * payment routing plugins, which modify the behavior of payments
14
+ * invoice plugins, which add line items during the creation of an invoice
15
+ * currency plugins, which return currency conversion information
13
16
 
14
- Both types of plugin can interact with Killbill directly via killbill-library APIs and expose HTTP endpoints.
17
+ All plugin types can interact with Kill Bill directly via APIs and expose HTTP endpoints.
15
18
 
16
19
  How to write a Notification plugin
17
20
  ----------------------------------
@@ -140,6 +143,15 @@ In case the templates behind the generator change and you want to upgrade your p
140
143
  generate command on top of your existing code. For each file, you'll be prompted whether you want to overwrite it, show a
141
144
  diff, etc.
142
145
 
146
+ How to write an Invoice plugin
147
+ ------------------------------
148
+
149
+ See the [killbill-invoice-test-plugin](https://github.com/killbill/killbill-invoice-test-plugin).
150
+
151
+ How to write a Currency plugin
152
+ ------------------------------
153
+
154
+ See the [killbill-currency-plugin](https://github.com/killbill/killbill-currency-plugin).
143
155
 
144
156
  How to expose HTTP endpoints
145
157
  ----------------------------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.2.3
data/gen_config/api.conf CHANGED
@@ -1,48 +1,49 @@
1
- -i
2
- file:///<PATH_TO_REPO>/killbill-api/src/main/java/
3
- -o
4
- /tmp/output
5
- -t
6
- JRUBY_PLUGIN
7
- -q
8
- org.killbill.billing,
9
- org.killbill.billing.account,
10
- org.killbill.billing.account.api,
11
- org.killbill.billing.catalog,
12
- org.killbill.billing.catalog.api,
13
- org.killbill.billing.entitlement,
14
- org.killbill.billing.entitlement.api,
15
- org.killbill.billing.entitlement.api.user,
16
- org.killbill.billing.invoice,
17
- org.killbill.billing.invoice.api,
18
- org.killbill.billing.invoice.api.formatters,
19
- org.killbill.billing.junction,
20
- org.killbill.billing.junction.api,
21
- org.killbill.billing.osgi,
22
- org.killbill.billing.osgi.api,
23
- org.killbill.billing.osgi.api.config,
24
- org.killbill.billing.payment,
25
- org.killbill.billing.payment.api,
26
- org.killbill.billing.subscription,
27
- org.killbill.billing.subscription.api,
28
- org.killbill.billing.subscription.api.user,
29
- org.killbill.billing.tenant,
30
- org.killbill.billing.tenant.api,
31
- org.killbill.billing.usage,
32
- org.killbill.billing.usage.api,
33
- org.killbill.billing.util,
34
- org.killbill.billing.util.api,
35
- org.killbill.billing.util.audit,
36
- org.killbill.billing.util.callcontext,
37
- org.killbill.billing.util.customfield,
38
- org.killbill.billing.util.entity,
39
- org.killbill.billing.util.tag,
40
- org.killbill.billing.security,
41
- org.killbill.billing.currency.api
42
- -x
43
- ExportUserApi,
44
- PluginConfig,
45
- PluginJavaConfig,
46
- PluginRubyConfig
47
- -m
1
+ java -cp target/killbill-java-parser-0.0.1-SNAPSHOT.jar com.ning.killbill.KillbillParser \
2
+ -i \
3
+ file:///PATH_TO_REPO/killbill-api/src/main/java/ \
4
+ -o \
5
+ /tmp/output \
6
+ -t \
7
+ JRUBY_PLUGIN \
8
+ -q \
9
+ org.killbill.billing, \
10
+ org.killbill.billing.account, \
11
+ org.killbill.billing.account.api, \
12
+ org.killbill.billing.catalog, \
13
+ org.killbill.billing.catalog.api, \
14
+ org.killbill.billing.entitlement, \
15
+ org.killbill.billing.entitlement.api, \
16
+ org.killbill.billing.entitlement.api.user, \
17
+ org.killbill.billing.invoice, \
18
+ org.killbill.billing.invoice.api, \
19
+ org.killbill.billing.invoice.api.formatters, \
20
+ org.killbill.billing.junction, \
21
+ org.killbill.billing.junction.api, \
22
+ org.killbill.billing.osgi, \
23
+ org.killbill.billing.osgi.api, \
24
+ org.killbill.billing.osgi.api.config, \
25
+ org.killbill.billing.payment, \
26
+ org.killbill.billing.payment.api, \
27
+ org.killbill.billing.subscription, \
28
+ org.killbill.billing.subscription.api, \
29
+ org.killbill.billing.subscription.api.user, \
30
+ org.killbill.billing.tenant, \
31
+ org.killbill.billing.tenant.api, \
32
+ org.killbill.billing.usage, \
33
+ org.killbill.billing.usage.api, \
34
+ org.killbill.billing.util, \
35
+ org.killbill.billing.util.api, \
36
+ org.killbill.billing.util.audit, \
37
+ org.killbill.billing.util.callcontext, \
38
+ org.killbill.billing.util.customfield, \
39
+ org.killbill.billing.util.entity, \
40
+ org.killbill.billing.util.tag, \
41
+ org.killbill.billing.security, \
42
+ org.killbill.billing.currency.api \
43
+ -x \
44
+ ExportUserApi, \
45
+ PluginConfig, \
46
+ PluginJavaConfig, \
47
+ PluginRubyConfig \
48
+ -m \
48
49
  JRUBY_API
@@ -1,18 +1,19 @@
1
- -i
2
- file:///PATH_TO_REPO/killbill-plugin-api/payment/src/main/java,
3
- file:///PATH_TO_REPO/killbill-plugin-api/notification/src/main/java,
4
- file:///PATH_TO_REPO/killbill-plugin-api/invoice/src/main/java,
5
- file:///PATH_TO_REPO/killbill-plugin-api/currency/src/main/java,
6
- file:///PATH_TO_REPO/killbill-api/src/main/java/
7
- -o
8
- /tmp/output
9
- -t
10
- JRUBY_PLUGIN
11
- -q
12
- org.killbill.billing.payment.plugin.api,
13
- org.killbill.billing.notification.plugin.api,
14
- org.killbill.billing.invoice.plugin.api
15
- org.killbill.billing.currency.plugin.api
16
- -m
1
+ java -cp target/killbill-java-parser-0.0.1-SNAPSHOT.jar com.ning.killbill.KillbillParser \
2
+ -i \
3
+ file:///PATH_TO_REPO/killbill-plugin-api/payment/src/main/java, \
4
+ file:///PATH_TO_REPO/killbill-plugin-api/notification/src/main/java, \
5
+ file:///PATH_TO_REPO/killbill-plugin-api/invoice/src/main/java, \
6
+ file:///PATH_TO_REPO/killbill-plugin-api/currency/src/main/java, \
7
+ file:///PATH_TO_REPO/killbill-api/src/main/java/ \
8
+ -o \
9
+ /tmp/output \
10
+ -t \
11
+ JRUBY_PLUGIN \
12
+ -q \
13
+ org.killbill.billing.payment.plugin.api, \
14
+ org.killbill.billing.notification.plugin.api, \
15
+ org.killbill.billing.invoice.plugin.api \
16
+ org.killbill.billing.currency.plugin.api \
17
+ -m \
17
18
  JRUBY_PLUGIN_API
18
19
 
@@ -19,8 +19,6 @@ _yardoc
19
19
  doc/
20
20
 
21
21
  .jbundler
22
- Jarfile.lock
23
- Gemfile.lock
24
22
 
25
23
  .DS_Store
26
24
 
@@ -30,6 +28,8 @@ killbill-<%= identifier %>/
30
28
  # Testing database
31
29
  test.db
32
30
 
31
+ <%= identifier %>.log
32
+
33
33
  target
34
34
  pom.xml.asc
35
35
 
@@ -15,6 +15,14 @@ module Killbill #:nodoc:
15
15
  ::Killbill::<%= class_name %>::<%= class_name %>Response)
16
16
  end
17
17
 
18
+ def on_event(event)
19
+ # Require to deal with per tenant configuration invalidation
20
+ super(event)
21
+ #
22
+ # Custom event logic could be added below...
23
+ #
24
+ end
25
+
18
26
  def authorize_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
19
27
  # Pass extra parameters for the gateway here
20
28
  options = {}
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency 'money', '~> 6.1.1'
33
33
  s.add_dependency 'monetize', '~> 0.3.0'
34
34
  s.add_dependency 'sinatra', '~> 1.3.4'
35
+ s.add_dependency 'thread_safe', '~> 0.3.4'
35
36
  if defined?(JRUBY_VERSION)
36
37
  s.add_dependency 'activerecord-jdbcmysql-adapter', '~> 1.3.7'
37
38
  # Required to avoid errors like java.lang.NoClassDefFoundError: org/bouncycastle/asn1/DERBoolean
@@ -19,6 +19,7 @@ describe Killbill::<%= class_name %>::PaymentPlugin do
19
19
  @plugin.logger.level = Logger::INFO
20
20
  @plugin.conf_dir = File.dirname(file)
21
21
  @plugin.kb_apis = Killbill::Plugin::KillbillApi.new('<%= identifier %>', {})
22
+ @plugin.root = '/foo/killbill-<%= identifier %>/0.0.1'
22
23
 
23
24
  # Start the plugin here - since the config file will be deleted
24
25
  @plugin.start_plugin
@@ -11,7 +11,9 @@ describe Killbill::<%= class_name %>::PaymentPlugin do
11
11
 
12
12
  @account_api = ::Killbill::Plugin::ActiveMerchant::RSpec::FakeJavaUserAccountApi.new
13
13
  @payment_api = ::Killbill::Plugin::ActiveMerchant::RSpec::FakeJavaPaymentApi.new
14
- svcs = {:account_user_api => @account_api, :payment_api => @payment_api}
14
+ @tenant_api = ::Killbill::Plugin::ActiveMerchant::RSpec::FakeJavaTenantUserApi.new({})
15
+
16
+ svcs = {:account_user_api => @account_api, :payment_api => @payment_api, :tenant_user_api => @tenant_api}
15
17
  @plugin.kb_apis = Killbill::Plugin::KillbillApi.new('<%= identifier %>', svcs)
16
18
 
17
19
  @call_context = ::Killbill::Plugin::Model::CallContext.new
@@ -21,6 +23,8 @@ describe Killbill::<%= class_name %>::PaymentPlugin do
21
23
  @plugin.logger = Logger.new(STDOUT)
22
24
  @plugin.logger.level = Logger::INFO
23
25
  @plugin.conf_dir = File.expand_path(File.dirname(__FILE__) + '../../../../')
26
+ @plugin.root = '/foo/killbill-<%= identifier %>/0.0.1'
27
+
24
28
  @plugin.start_plugin
25
29
 
26
30
  @properties = []
data/killbill.gemspec CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency 'sinatra', '~> 1.3.4'
26
26
  s.add_dependency 'typhoeus', '~> 0.6.9'
27
27
  s.add_dependency 'tzinfo', '~> 1.1.0'
28
+ s.add_dependency 'thread_safe', '~> 0.3.4'
28
29
 
29
30
  s.add_development_dependency 'activerecord', '~> 4.1.0'
30
31
  if defined?(JRUBY_VERSION)
@@ -1,4 +1,5 @@
1
1
  require 'java'
2
+ require 'pathname'
2
3
 
3
4
  require 'killbill/killbill_api'
4
5
 
@@ -19,6 +20,7 @@ module Killbill
19
20
 
20
21
  plugin_delegate = real_class.new
21
22
  plugin_delegate.root = services.delete("root")
23
+ plugin_delegate.plugin_name = extract_plugin_name(plugin_delegate.root)
22
24
  plugin_delegate.logger = services.delete("logger")
23
25
  plugin_delegate.conf_dir = services.delete("conf_dir")
24
26
  # At this point we removed everything from the map which is not API, so we can build the APIs
@@ -28,6 +30,13 @@ module Killbill
28
30
  end
29
31
 
30
32
 
33
+ private
34
+
35
+ def extract_plugin_name(root)
36
+ p = Pathname.new(root)
37
+ p.split[0].split[-1].to_s
38
+ end
39
+
31
40
  end
32
41
  end
33
42
  end
@@ -27,6 +27,12 @@ module Killbill
27
27
  raise OperationUnsupportedError
28
28
  end
29
29
 
30
+ # Override this method in your plugin to act upon received events
31
+ def on_event(event)
32
+ # No-op by default
33
+ end
34
+
35
+
30
36
  end
31
37
  end
32
38
  end
@@ -34,18 +34,20 @@ module Killbill
34
34
 
35
35
  include org.killbill.billing.util.audit.AccountAuditLogsForObjectType
36
36
 
37
+ attr_accessor
38
+
37
39
  def initialize()
38
40
  end
39
41
 
40
42
  def to_java()
41
- self
42
- end
43
-
44
- def to_ruby(j_obj)
45
- self
46
- end
47
-
43
+ self
48
44
  end
45
+
46
+ def to_ruby(j_obj)
47
+ self
49
48
  end
49
+
50
50
  end
51
51
  end
52
+ end
53
+ end
@@ -47,10 +47,43 @@ module Killbill
47
47
 
48
48
  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
49
49
  context = context.to_java unless context.nil?
50
- res = @real_java_api.get_catalog(catalogName, context)
51
- # conversion for res [type = org.killbill.billing.catalog.api.Catalog]
52
- res = Killbill::Plugin::Model::Catalog.new.to_ruby(res) unless res.nil?
53
- return res
50
+ begin
51
+ res = @real_java_api.get_catalog(catalogName, context)
52
+ # conversion for res [type = org.killbill.billing.catalog.api.Catalog]
53
+ res = Killbill::Plugin::Model::Catalog.new.to_ruby(res) unless res.nil?
54
+ return res
55
+ rescue Java::org.killbill.billing.catalog.api.CatalogApiException => e
56
+ raise Killbill::Plugin::Model::CatalogApiException.new.to_ruby(e)
57
+ end
58
+ end
59
+
60
+ java_signature 'Java::org.killbill.billing.catalog.api.StaticCatalog getCurrentCatalog(Java::java.lang.String, Java::org.killbill.billing.util.callcontext.TenantContext)'
61
+ def get_current_catalog(catalogName, context)
62
+
63
+ # conversion for catalogName [type = java.lang.String]
64
+ catalogName = catalogName.to_s unless catalogName.nil?
65
+
66
+ # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
67
+ context = context.to_java unless context.nil?
68
+ begin
69
+ res = @real_java_api.get_current_catalog(catalogName, context)
70
+ # conversion for res [type = org.killbill.billing.catalog.api.StaticCatalog]
71
+ res = Killbill::Plugin::Model::StaticCatalog.new.to_ruby(res) unless res.nil?
72
+ return res
73
+ rescue Java::org.killbill.billing.catalog.api.CatalogApiException => e
74
+ raise Killbill::Plugin::Model::CatalogApiException.new.to_ruby(e)
75
+ end
76
+ end
77
+
78
+ java_signature 'Java::void uploadCatalog(Java::java.lang.String, Java::org.killbill.billing.util.callcontext.CallContext)'
79
+ def upload_catalog(catalogXML, context)
80
+
81
+ # conversion for catalogXML [type = java.lang.String]
82
+ catalogXML = catalogXML.to_s unless catalogXML.nil?
83
+
84
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
85
+ context = context.to_java unless context.nil?
86
+ @real_java_api.upload_catalog(catalogXML, context)
54
87
  end
55
88
  end
56
89
  end
@@ -88,6 +88,58 @@ module Killbill
88
88
  end
89
89
  end
90
90
 
91
+ java_signature 'Java::org.killbill.billing.payment.api.Payment createAuthorizationWithPaymentControl(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.util.UUID, Java::java.math.BigDecimal, Java::org.killbill.billing.catalog.api.Currency, Java::java.lang.String, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.payment.api.PaymentOptions, Java::org.killbill.billing.util.callcontext.CallContext)'
92
+ def create_authorization_with_payment_control(account, paymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey, properties, paymentOptions, context)
93
+
94
+ # conversion for account [type = org.killbill.billing.account.api.Account]
95
+ account = account.to_java unless account.nil?
96
+
97
+ # conversion for paymentMethodId [type = java.util.UUID]
98
+ paymentMethodId = java.util.UUID.fromString(paymentMethodId.to_s) unless paymentMethodId.nil?
99
+
100
+ # conversion for paymentId [type = java.util.UUID]
101
+ paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.nil?
102
+
103
+ # conversion for amount [type = java.math.BigDecimal]
104
+ if amount.nil?
105
+ amount = java.math.BigDecimal::ZERO
106
+ else
107
+ amount = java.math.BigDecimal.new(amount.to_s)
108
+ end
109
+
110
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
111
+ currency = Java::org.killbill.billing.catalog.api.Currency.value_of("#{currency.to_s}") unless currency.nil?
112
+
113
+ # conversion for paymentExternalKey [type = java.lang.String]
114
+ paymentExternalKey = paymentExternalKey.to_s unless paymentExternalKey.nil?
115
+
116
+ # conversion for paymentTransactionExternalKey [type = java.lang.String]
117
+ paymentTransactionExternalKey = paymentTransactionExternalKey.to_s unless paymentTransactionExternalKey.nil?
118
+
119
+ # conversion for properties [type = java.lang.Iterable]
120
+ tmp = java.util.ArrayList.new
121
+ (properties || []).each do |m|
122
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
123
+ m = m.to_java unless m.nil?
124
+ tmp.add(m)
125
+ end
126
+ properties = tmp
127
+
128
+ # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
129
+ paymentOptions = paymentOptions.to_java unless paymentOptions.nil?
130
+
131
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
132
+ context = context.to_java unless context.nil?
133
+ begin
134
+ res = @real_java_api.create_authorization_with_payment_control(account, paymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey, properties, paymentOptions, context)
135
+ # conversion for res [type = org.killbill.billing.payment.api.Payment]
136
+ res = Killbill::Plugin::Model::Payment.new.to_ruby(res) unless res.nil?
137
+ return res
138
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
139
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
140
+ end
141
+ end
142
+
91
143
  java_signature 'Java::org.killbill.billing.payment.api.Payment createCapture(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.math.BigDecimal, Java::org.killbill.billing.catalog.api.Currency, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
92
144
  def create_capture(account, paymentId, amount, currency, paymentTransactionExternalKey, properties, context)
93
145
 
@@ -403,6 +455,58 @@ module Killbill
403
455
  end
404
456
  end
405
457
 
458
+ java_signature 'Java::org.killbill.billing.payment.api.Payment createCreditWithPaymentControl(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.util.UUID, Java::java.math.BigDecimal, Java::org.killbill.billing.catalog.api.Currency, Java::java.lang.String, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.payment.api.PaymentOptions, Java::org.killbill.billing.util.callcontext.CallContext)'
459
+ def create_credit_with_payment_control(account, paymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey, properties, paymentOptions, context)
460
+
461
+ # conversion for account [type = org.killbill.billing.account.api.Account]
462
+ account = account.to_java unless account.nil?
463
+
464
+ # conversion for paymentMethodId [type = java.util.UUID]
465
+ paymentMethodId = java.util.UUID.fromString(paymentMethodId.to_s) unless paymentMethodId.nil?
466
+
467
+ # conversion for paymentId [type = java.util.UUID]
468
+ paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.nil?
469
+
470
+ # conversion for amount [type = java.math.BigDecimal]
471
+ if amount.nil?
472
+ amount = java.math.BigDecimal::ZERO
473
+ else
474
+ amount = java.math.BigDecimal.new(amount.to_s)
475
+ end
476
+
477
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
478
+ currency = Java::org.killbill.billing.catalog.api.Currency.value_of("#{currency.to_s}") unless currency.nil?
479
+
480
+ # conversion for paymentExternalKey [type = java.lang.String]
481
+ paymentExternalKey = paymentExternalKey.to_s unless paymentExternalKey.nil?
482
+
483
+ # conversion for paymentTransactionExternalKey [type = java.lang.String]
484
+ paymentTransactionExternalKey = paymentTransactionExternalKey.to_s unless paymentTransactionExternalKey.nil?
485
+
486
+ # conversion for properties [type = java.lang.Iterable]
487
+ tmp = java.util.ArrayList.new
488
+ (properties || []).each do |m|
489
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
490
+ m = m.to_java unless m.nil?
491
+ tmp.add(m)
492
+ end
493
+ properties = tmp
494
+
495
+ # conversion for paymentOptions [type = org.killbill.billing.payment.api.PaymentOptions]
496
+ paymentOptions = paymentOptions.to_java unless paymentOptions.nil?
497
+
498
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
499
+ context = context.to_java unless context.nil?
500
+ begin
501
+ res = @real_java_api.create_credit_with_payment_control(account, paymentMethodId, paymentId, amount, currency, paymentExternalKey, paymentTransactionExternalKey, properties, paymentOptions, context)
502
+ # conversion for res [type = org.killbill.billing.payment.api.Payment]
503
+ res = Killbill::Plugin::Model::Payment.new.to_ruby(res) unless res.nil?
504
+ return res
505
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
506
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
507
+ end
508
+ end
509
+
406
510
  java_signature 'Java::org.killbill.billing.payment.api.Payment createChargeback(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.math.BigDecimal, Java::org.killbill.billing.catalog.api.Currency, Java::java.lang.String, Java::org.killbill.billing.util.callcontext.CallContext)'
407
511
  def create_chargeback(account, paymentId, amount, currency, paymentTransactionExternalKey, context)
408
512