killbill 3.1.11 → 3.1.12

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/Jarfile +6 -6
  3. data/NEWS +6 -0
  4. data/VERSION +1 -1
  5. data/generators/active_merchant/templates/Jarfile.rb +7 -7
  6. data/generators/active_merchant/templates/db/ddl.sql.rb +2 -0
  7. data/generators/active_merchant/templates/db/schema.rb +2 -0
  8. data/generators/active_merchant/templates/lib/application.rb +1 -5
  9. data/generators/active_merchant/templates/lib/models/response.rb +2 -1
  10. data/generators/active_merchant/templates/lib/plugin.rb +1 -0
  11. data/generators/active_merchant/templates/lib/private_api.rb +7 -0
  12. data/generators/active_merchant/templates/plugin.gemspec.rb +3 -2
  13. data/generators/active_merchant/templates/spec/integration_spec.rb +103 -2
  14. data/killbill.gemspec +4 -1
  15. data/lib/killbill/gen/api/dry_run_arguments.rb +100 -0
  16. data/lib/killbill/gen/api/invoice_user_api.rb +5 -5
  17. data/lib/killbill/gen/api/killbill_api.rb +19 -18
  18. data/lib/killbill/gen/api/payment_options.rb +17 -5
  19. data/lib/killbill/gen/api/require_gen.rb +5 -0
  20. data/lib/killbill/gen/api/rolled_up_unit.rb +63 -0
  21. data/lib/killbill/gen/api/rolled_up_usage.rb +31 -35
  22. data/lib/killbill/gen/api/static_catalog.rb +8 -8
  23. data/lib/killbill/gen/api/subscription_usage_record.rb +75 -0
  24. data/lib/killbill/gen/api/unit_usage_record.rb +74 -0
  25. data/lib/killbill/gen/api/usage_record.rb +66 -0
  26. data/lib/killbill/gen/api/usage_user_api.rb +22 -56
  27. data/lib/killbill/gen/plugin-api/currency_plugin_api.rb +19 -18
  28. data/lib/killbill/gen/plugin-api/ext_bus_event.rb +19 -18
  29. data/lib/killbill/gen/plugin-api/gateway_notification.rb +19 -18
  30. data/lib/killbill/gen/plugin-api/hosted_payment_page_form_descriptor.rb +19 -18
  31. data/lib/killbill/gen/plugin-api/notification_plugin_api.rb +19 -18
  32. data/lib/killbill/gen/plugin-api/payment_method_info_plugin.rb +19 -18
  33. data/lib/killbill/gen/plugin-api/payment_plugin_api.rb +19 -18
  34. data/lib/killbill/gen/plugin-api/payment_plugin_api_exception.rb +19 -18
  35. data/lib/killbill/gen/plugin-api/payment_transaction_info_plugin.rb +19 -18
  36. data/lib/killbill/gen/plugin-api/require_gen.rb +19 -18
  37. data/lib/killbill/helpers/active_merchant/active_record/models/payment_method.rb +4 -0
  38. data/lib/killbill/helpers/active_merchant/active_record/models/response.rb +65 -34
  39. data/lib/killbill/helpers/active_merchant/active_record/models/streamy_result_set.rb +14 -2
  40. data/lib/killbill/helpers/active_merchant/active_record/models/transaction.rb +9 -5
  41. data/lib/killbill/helpers/active_merchant/killbill_spec_helper.rb +28 -23
  42. data/lib/killbill/helpers/active_merchant/payment_plugin.rb +66 -36
  43. data/lib/killbill/helpers/active_merchant/private_payment_plugin.rb +18 -31
  44. data/lib/killbill/helpers/active_merchant/sinatra.rb +7 -2
  45. data/lib/killbill/helpers/active_merchant/utils.rb +12 -0
  46. data/spec/killbill/helpers/killbill_spec_helper_spec.rb +24 -0
  47. data/spec/killbill/helpers/payment_method_spec.rb +5 -0
  48. data/spec/killbill/helpers/payment_plugin_spec.rb +33 -2
  49. data/spec/killbill/helpers/private_payment_plugin_spec.rb +83 -0
  50. data/spec/killbill/helpers/response_spec.rb +47 -24
  51. data/spec/killbill/helpers/streamy_result_set_spec.rb +38 -0
  52. data/spec/killbill/helpers/test_schema.rb +2 -0
  53. metadata +57 -8
  54. data/lib/killbill/gen/api/payment_attempt.rb +0 -117
  55. data/lib/killbill/gen/api/payment_method_kv_info.rb +0 -71
  56. data/lib/killbill/gen/plugin-api/billing_address.rb +0 -85
  57. data/lib/killbill/gen/plugin-api/customer.rb +0 -73
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aabe3a8f982505fbc0553841a657da0c8594ce57
4
- data.tar.gz: 794bbb1623029efe0eb5689457b940703b1d4282
3
+ metadata.gz: eb6ce6556b61301d292afa1aa2747c108fd4687e
4
+ data.tar.gz: b3416f3c099da146bfbe28436af347b23e12c7ee
5
5
  SHA512:
6
- metadata.gz: 8d3ffd5609c96255b83964709465f29b1a16619a4fa00c585ac3d1c4ad6000ab08448c608c2987de3871925900f0f65385c2f16f36affe07313611e9d5c64837
7
- data.tar.gz: 6bfaf6c5de3339383920799042f9054215e33538ff08f02cf61d463fbc91ef66ad8b30b94efa386126c9f515e255b7ea83e07c3b4330ffd69eeada56cb08bafb
6
+ metadata.gz: 341509f358870f14af3ed361cc6d32b8bd234b2a18277fefd88dac6ea5876c2533e4576b32523b0de739c112d3b6974bff147c44c88b9404ca2b6ef67ce6d1eb
7
+ data.tar.gz: 0cf95757be6be80a1cf04757f284cdef25bccf4936db9d46ed02f8fe5ea2f0068092270fe9adbb0a934afb11c3207c36289dfc5eda7728bbc14baa2fe714dd1b
data/Jarfile CHANGED
@@ -1,8 +1,8 @@
1
- jar 'org.kill-bill.billing:killbill-api', '0.9.9'
2
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.7.4'
3
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.7.4'
4
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.7.4'
5
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-retry', '0.7.4'
6
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.7.4'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.10.2'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.8.1'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.8.1'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.8.1'
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.1'
7
7
  jar 'org.kill-bill.billing:killbill-util:tests', '0.11.9'
8
8
  jar 'javax.servlet:javax.servlet-api', '3.0.1'
data/NEWS CHANGED
@@ -1,3 +1,9 @@
1
+ 3.1.12
2
+ ActiveMerchant:
3
+ - store payment_processor_account_id (DDL change)
4
+ - let the plugin override the linked transaction type (capture/refund)
5
+ - generator enhancements
6
+
1
7
  3.1.11
2
8
  ActiveMerchant:
3
9
  - add proxy support
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.11
1
+ 3.1.12
@@ -1,8 +1,8 @@
1
- jar 'org.kill-bill.billing:killbill-api', '0.9.8'
2
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.7.4'
3
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.7.4'
4
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.7.4'
5
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-retry', '0.7.4'
6
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.7.4'
7
- jar 'org.kill-bill.billing:killbill-util:tests', '0.11.3'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.10.2'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.8.1'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.8.1'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.8.1'
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.1'
7
+ jar 'org.kill-bill.billing:killbill-util:tests', '0.11.9'
8
8
  jar 'javax.servlet:javax.servlet-api', '3.0.1'
@@ -37,6 +37,7 @@ CREATE TABLE `<%= identifier %>_transactions` (
37
37
  `kb_payment_id` varchar(255) NOT NULL,
38
38
  `kb_payment_transaction_id` varchar(255) NOT NULL,
39
39
  `transaction_type` varchar(255) NOT NULL,
40
+ `payment_processor_account_id` varchar(255) DEFAULT NULL,
40
41
  `txn_id` varchar(255) DEFAULT NULL,
41
42
  `amount_in_cents` int(11) DEFAULT NULL,
42
43
  `currency` varchar(255) DEFAULT NULL,
@@ -54,6 +55,7 @@ CREATE TABLE `<%= identifier %>_responses` (
54
55
  `kb_payment_id` varchar(255) DEFAULT NULL,
55
56
  `kb_payment_transaction_id` varchar(255) DEFAULT NULL,
56
57
  `transaction_type` varchar(255) DEFAULT NULL,
58
+ `payment_processor_account_id` varchar(255) DEFAULT NULL,
57
59
  `message` varchar(255) DEFAULT NULL,
58
60
  `authorization` varchar(255) DEFAULT NULL,
59
61
  `fraud_review` tinyint(1) DEFAULT NULL,
@@ -38,6 +38,7 @@ ActiveRecord::Schema.define(:version => 20140410153635) do
38
38
  t.string "kb_payment_id", :null => false
39
39
  t.string "kb_payment_transaction_id", :null => false
40
40
  t.string "transaction_type", :null => false
41
+ t.string "payment_processor_account_id"
41
42
  t.string "txn_id" # <%= identifier %> transaction id
42
43
  # Both null for void
43
44
  t.integer "amount_in_cents"
@@ -55,6 +56,7 @@ ActiveRecord::Schema.define(:version => 20140410153635) do
55
56
  t.string "kb_payment_id"
56
57
  t.string "kb_payment_transaction_id"
57
58
  t.string "transaction_type"
59
+ t.string "payment_processor_account_id"
58
60
  t.string "message"
59
61
  t.string "authorization"
60
62
  t.boolean "fraud_review"
@@ -18,11 +18,7 @@ end
18
18
 
19
19
  helpers do
20
20
  def plugin(session = {})
21
- ::Killbill::<%= class_name %>::PrivatePaymentPlugin.new(:<%= identifier %>,
22
- ::Killbill::<%= class_name %>::<%= class_name %>PaymentMethod,
23
- ::Killbill::<%= class_name %>::<%= class_name %>Transaction,
24
- ::Killbill::<%= class_name %>::<%= class_name %>Response,
25
- session)
21
+ ::Killbill::<%= class_name %>::PrivatePaymentPlugin.new(session)
26
22
  end
27
23
  end
28
24
 
@@ -6,12 +6,13 @@ module Killbill #:nodoc:
6
6
 
7
7
  has_one :<%= identifier %>_transaction
8
8
 
9
- def self.from_response(api_call, kb_account_id, kb_payment_id, kb_payment_transaction_id, transaction_type, kb_tenant_id, response, extra_params = {}, model = ::Killbill::<%= class_name %>::<%= class_name %>Response)
9
+ def self.from_response(api_call, kb_account_id, kb_payment_id, kb_payment_transaction_id, transaction_type, payment_processor_account_id, kb_tenant_id, response, extra_params = {}, model = ::Killbill::<%= class_name %>::<%= class_name %>Response)
10
10
  super(api_call,
11
11
  kb_account_id,
12
12
  kb_payment_id,
13
13
  kb_payment_transaction_id,
14
14
  transaction_type,
15
+ payment_processor_account_id,
15
16
  kb_tenant_id,
16
17
  response,
17
18
  {
@@ -6,6 +6,7 @@ require 'active_support'
6
6
  require 'bigdecimal'
7
7
  require 'money'
8
8
  require 'monetize'
9
+ require 'offsite_payments'
9
10
  require 'pathname'
10
11
  require 'sinatra'
11
12
  require 'singleton'
@@ -1,6 +1,13 @@
1
1
  module Killbill #:nodoc:
2
2
  module <%= class_name %> #:nodoc:
3
3
  class PrivatePaymentPlugin < ::Killbill::Plugin::ActiveMerchant::PrivatePaymentPlugin
4
+ def initialize(session = {})
5
+ super(:<%= identifier %>,
6
+ ::Killbill::<%= class_name %>::<%= class_name %>PaymentMethod,
7
+ ::Killbill::<%= class_name %>::<%= class_name %>Transaction,
8
+ ::Killbill::<%= class_name %>::<%= class_name %>Response,
9
+ session)
10
+ end
4
11
  end
5
12
  end
6
13
  end
@@ -22,8 +22,9 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.rdoc_options << '--exclude' << '.'
24
24
 
25
- s.add_dependency 'killbill', '~> 3.1.8'
26
- s.add_dependency 'activemerchant', '~> 1.42.9'
25
+ s.add_dependency 'killbill', '~> 3.1.11'
26
+ s.add_dependency 'activemerchant', '~> 1.44.1'
27
+ s.add_dependency 'offsite_payments', '~> 2.0.1'
27
28
  s.add_dependency 'activerecord', '~> 4.1.0'
28
29
  s.add_dependency 'actionpack', '~> 4.1.0'
29
30
  s.add_dependency 'actionview', '~> 4.1.0'
@@ -10,22 +10,123 @@ describe Killbill::<%= class_name %>::PaymentPlugin do
10
10
  @plugin = Killbill::<%= class_name %>::PaymentPlugin.new
11
11
 
12
12
  @account_api = ::Killbill::Plugin::ActiveMerchant::RSpec::FakeJavaUserAccountApi.new
13
- svcs = {:account_user_api => @account_api}
13
+ @payment_api = ::Killbill::Plugin::ActiveMerchant::RSpec::FakeJavaPaymentApi.new
14
+ svcs = {:account_user_api => @account_api, :payment_api => @payment_api}
14
15
  @plugin.kb_apis = Killbill::Plugin::KillbillApi.new('<%= identifier %>', svcs)
15
16
 
17
+ @call_context = ::Killbill::Plugin::Model::CallContext.new
18
+ @call_context.tenant_id = '00000011-0022-0033-0044-000000000055'
19
+ @call_context = @call_context.to_ruby(@call_context)
20
+
16
21
  @plugin.logger = Logger.new(STDOUT)
17
22
  @plugin.logger.level = Logger::INFO
18
23
  @plugin.conf_dir = File.expand_path(File.dirname(__FILE__) + '../../../../')
19
24
  @plugin.start_plugin
25
+
26
+ @properties = []
27
+ @pm = create_payment_method(::Killbill::<%= class_name %>::<%= class_name %>PaymentMethod, nil, @call_context.tenant_id, @properties)
28
+ @amount = BigDecimal.new('100')
29
+ @currency = 'USD'
30
+
31
+ kb_payment_id = SecureRandom.uuid
32
+ 1.upto(6) do
33
+ @kb_payment = @payment_api.add_payment(kb_payment_id)
34
+ end
20
35
  end
21
36
 
22
37
  after(:each) do
23
38
  @plugin.stop_plugin
24
39
  end
25
40
 
26
- it 'should be able to create and retrieve payment methods' do
41
+ it 'should be able to charge a Credit Card directly' do
42
+ properties = build_pm_properties
43
+
44
+ # We created the payment method, hence the rows
45
+ Killbill::<%= class_name %>::<%= class_name %>Response.all.size.should == 1
46
+ Killbill::<%= class_name %>::<%= class_name %>Transaction.all.size.should == 0
47
+
48
+ payment_response = @plugin.purchase_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[0].id, SecureRandom.uuid, @amount, @currency, properties, @call_context)
49
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
50
+ payment_response.amount.should == @amount
51
+ payment_response.transaction_type.should == :PURCHASE
52
+
53
+ responses = Killbill::<%= class_name %>::<%= class_name %>Response.all
54
+ responses.size.should == 2
55
+ responses[0].api_call.should == 'add_payment_method'
56
+ responses[0].message.should == 'Successful transaction'
57
+ responses[1].api_call.should == 'purchase'
58
+ responses[1].message.should == 'Successful transaction'
59
+ transactions = Killbill::<%= class_name %>::<%= class_name %>Transaction.all
60
+ transactions.size.should == 1
61
+ transactions[0].api_call.should == 'purchase'
27
62
  end
28
63
 
29
64
  it 'should be able to charge and refund' do
65
+ payment_response = @plugin.purchase_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[0].id, @pm.kb_payment_method_id, @amount, @currency, @properties, @call_context)
66
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
67
+ payment_response.amount.should == @amount
68
+ payment_response.transaction_type.should == :PURCHASE
69
+
70
+ # Try a full refund
71
+ refund_response = @plugin.refund_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[1].id, @pm.kb_payment_method_id, @amount, @currency, @properties, @call_context)
72
+ refund_response.status.should eq(:PROCESSED), refund_response.gateway_error
73
+ refund_response.amount.should == @amount
74
+ refund_response.transaction_type.should == :REFUND
75
+ end
76
+
77
+ it 'should be able to auth, capture and refund' do
78
+ payment_response = @plugin.authorize_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[0].id, @pm.kb_payment_method_id, @amount, @currency, @properties, @call_context)
79
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
80
+ payment_response.amount.should == @amount
81
+ payment_response.transaction_type.should == :AUTHORIZE
82
+
83
+ # Try multiple partial captures
84
+ partial_capture_amount = BigDecimal.new('10')
85
+ 1.upto(3) do |i|
86
+ payment_response = @plugin.capture_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[i].id, @pm.kb_payment_method_id, partial_capture_amount, @currency, @properties, @call_context)
87
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
88
+ payment_response.amount.should == partial_capture_amount
89
+ payment_response.transaction_type.should == :CAPTURE
90
+ end
91
+
92
+ # Try a partial refund
93
+ refund_response = @plugin.refund_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[4].id, @pm.kb_payment_method_id, partial_capture_amount, @currency, @properties, @call_context)
94
+ refund_response.status.should eq(:PROCESSED), refund_response.gateway_error
95
+ refund_response.amount.should == partial_capture_amount
96
+ refund_response.transaction_type.should == :REFUND
97
+
98
+ # Try to capture again
99
+ payment_response = @plugin.capture_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[5].id, @pm.kb_payment_method_id, partial_capture_amount, @currency, @properties, @call_context)
100
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
101
+ payment_response.amount.should == partial_capture_amount
102
+ payment_response.transaction_type.should == :CAPTURE
103
+ end
104
+
105
+ it 'should be able to auth and void' do
106
+ payment_response = @plugin.authorize_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[0].id, @pm.kb_payment_method_id, @amount, @currency, @properties, @call_context)
107
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
108
+ payment_response.amount.should == @amount
109
+ payment_response.transaction_type.should == :AUTHORIZE
110
+
111
+ payment_response = @plugin.void_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[1].id, @pm.kb_payment_method_id, @properties, @call_context)
112
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
113
+ payment_response.transaction_type.should == :VOID
114
+ end
115
+
116
+ it 'should be able to auth, partial capture and void' do
117
+ payment_response = @plugin.authorize_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[0].id, @pm.kb_payment_method_id, @amount, @currency, @properties, @call_context)
118
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
119
+ payment_response.amount.should == @amount
120
+ payment_response.transaction_type.should == :AUTHORIZE
121
+
122
+ partial_capture_amount = BigDecimal.new('10')
123
+ payment_response = @plugin.capture_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[1].id, @pm.kb_payment_method_id, partial_capture_amount, @currency, @properties, @call_context)
124
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
125
+ payment_response.amount.should == partial_capture_amount
126
+ payment_response.transaction_type.should == :CAPTURE
127
+
128
+ payment_response = @plugin.void_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[2].id, @pm.kb_payment_method_id, @properties, @call_context)
129
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
130
+ payment_response.transaction_type.should == :VOID
30
131
  end
31
132
  end
data/killbill.gemspec CHANGED
@@ -33,7 +33,10 @@ Gem::Specification.new do |s|
33
33
  else
34
34
  s.add_development_dependency 'sqlite3', '~> 1.3.7'
35
35
  end
36
- s.add_development_dependency 'activemerchant', '~> 1.42.0'
36
+ s.add_development_dependency 'actionpack', '~> 4.1.0'
37
+ s.add_development_dependency 'actionview', '~> 4.1.0'
38
+ s.add_development_dependency 'activemerchant', '~> 1.44.1'
39
+ s.add_development_dependency 'offsite_payments', '~> 2.0.1'
37
40
  s.add_development_dependency 'monetize', '~> 0.3.0'
38
41
  s.add_development_dependency 'money', '~> 6.1.1'
39
42
  s.add_development_dependency 'jbundler', '~> 0.4.3'
@@ -0,0 +1,100 @@
1
+ #############################################################################################
2
+ # #
3
+ # Copyright 2010-2013 Ning, Inc. #
4
+ # Copyright 2014 Groupon, Inc. #
5
+ # Copyright 2014 The Billing Project, LLC #
6
+ # #
7
+ # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
+ # (the "License"); you may not use this file except in compliance with the #
9
+ # License. You may obtain a copy of the License at: #
10
+ # #
11
+ # http://www.apache.org/licenses/LICENSE-2.0 #
12
+ # #
13
+ # Unless required by applicable law or agreed to in writing, software #
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
+ # License for the specific language governing permissions and limitations #
17
+ # under the License. #
18
+ # #
19
+ #############################################################################################
20
+
21
+
22
+ #
23
+ # DO NOT EDIT!!!
24
+ # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
25
+ #
26
+
27
+
28
+ module Killbill
29
+ module Plugin
30
+ module Model
31
+
32
+ java_package 'org.killbill.billing.invoice.api'
33
+ class DryRunArguments
34
+
35
+ include org.killbill.billing.invoice.api.DryRunArguments
36
+
37
+ attr_accessor :plan_phase_specifier, :action, :subscription_id, :effective_date, :bundle_id, :billing_action_policy
38
+
39
+ def initialize()
40
+ end
41
+
42
+ def to_java()
43
+ # conversion for plan_phase_specifier [type = org.killbill.billing.catalog.api.PlanPhaseSpecifier]
44
+ @plan_phase_specifier = @plan_phase_specifier.to_java unless @plan_phase_specifier.nil?
45
+
46
+ # conversion for action [type = org.killbill.billing.entitlement.api.SubscriptionEventType]
47
+ @action = Java::org.killbill.billing.entitlement.api.SubscriptionEventType.value_of("#{@action.to_s}") unless @action.nil?
48
+
49
+ # conversion for subscription_id [type = java.util.UUID]
50
+ @subscription_id = java.util.UUID.fromString(@subscription_id.to_s) unless @subscription_id.nil?
51
+
52
+ # conversion for effective_date [type = org.joda.time.DateTime]
53
+ if !@effective_date.nil?
54
+ @effective_date = (@effective_date.kind_of? Time) ? DateTime.parse(@effective_date.to_s) : @effective_date
55
+ @effective_date = Java::org.joda.time.DateTime.new(@effective_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
56
+ end
57
+
58
+ # conversion for bundle_id [type = java.util.UUID]
59
+ @bundle_id = java.util.UUID.fromString(@bundle_id.to_s) unless @bundle_id.nil?
60
+
61
+ # conversion for billing_action_policy [type = org.killbill.billing.catalog.api.BillingActionPolicy]
62
+ @billing_action_policy = Java::org.killbill.billing.catalog.api.BillingActionPolicy.value_of("#{@billing_action_policy.to_s}") unless @billing_action_policy.nil?
63
+ self
64
+ end
65
+
66
+ def to_ruby(j_obj)
67
+ # conversion for plan_phase_specifier [type = org.killbill.billing.catalog.api.PlanPhaseSpecifier]
68
+ @plan_phase_specifier = j_obj.plan_phase_specifier
69
+ @plan_phase_specifier = Killbill::Plugin::Model::PlanPhaseSpecifier.new.to_ruby(@plan_phase_specifier) unless @plan_phase_specifier.nil?
70
+
71
+ # conversion for action [type = org.killbill.billing.entitlement.api.SubscriptionEventType]
72
+ @action = j_obj.action
73
+ @action = @action.to_s.to_sym unless @action.nil?
74
+
75
+ # conversion for subscription_id [type = java.util.UUID]
76
+ @subscription_id = j_obj.subscription_id
77
+ @subscription_id = @subscription_id.nil? ? nil : @subscription_id.to_s
78
+
79
+ # conversion for effective_date [type = org.joda.time.DateTime]
80
+ @effective_date = j_obj.effective_date
81
+ if !@effective_date.nil?
82
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
83
+ str = fmt.print(@effective_date)
84
+ @effective_date = DateTime.iso8601(str)
85
+ end
86
+
87
+ # conversion for bundle_id [type = java.util.UUID]
88
+ @bundle_id = j_obj.bundle_id
89
+ @bundle_id = @bundle_id.nil? ? nil : @bundle_id.to_s
90
+
91
+ # conversion for billing_action_policy [type = org.killbill.billing.catalog.api.BillingActionPolicy]
92
+ @billing_action_policy = j_obj.billing_action_policy
93
+ @billing_action_policy = @billing_action_policy.to_s.to_sym unless @billing_action_policy.nil?
94
+ self
95
+ end
96
+
97
+ end
98
+ end
99
+ end
100
+ end
@@ -203,8 +203,8 @@ module Killbill
203
203
  return res
204
204
  end
205
205
 
206
- java_signature 'Java::org.killbill.billing.invoice.api.Invoice triggerInvoiceGeneration(Java::java.util.UUID, Java::org.joda.time.LocalDate, Java::boolean, Java::org.killbill.billing.util.callcontext.CallContext)'
207
- def trigger_invoice_generation(accountId, targetDate, dryRun, context)
206
+ java_signature 'Java::org.killbill.billing.invoice.api.Invoice triggerInvoiceGeneration(Java::java.util.UUID, Java::org.joda.time.LocalDate, Java::org.killbill.billing.invoice.api.DryRunArguments, Java::org.killbill.billing.util.callcontext.CallContext)'
207
+ def trigger_invoice_generation(accountId, targetDate, dryRunArguments, context)
208
208
 
209
209
  # conversion for accountId [type = java.util.UUID]
210
210
  accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
@@ -214,13 +214,13 @@ module Killbill
214
214
  targetDate = Java::org.joda.time.LocalDate.parse(targetDate.to_s)
215
215
  end
216
216
 
217
- # conversion for dryRun [type = boolean]
218
- dryRun = dryRun.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(dryRun)
217
+ # conversion for dryRunArguments [type = org.killbill.billing.invoice.api.DryRunArguments]
218
+ dryRunArguments = dryRunArguments.to_java unless dryRunArguments.nil?
219
219
 
220
220
  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
221
221
  context = context.to_java unless context.nil?
222
222
  begin
223
- res = @real_java_api.trigger_invoice_generation(accountId, targetDate, dryRun, context)
223
+ res = @real_java_api.trigger_invoice_generation(accountId, targetDate, dryRunArguments, context)
224
224
  # conversion for res [type = org.killbill.billing.invoice.api.Invoice]
225
225
  res = Killbill::Plugin::Model::Invoice.new.to_ruby(res) unless res.nil?
226
226
  return res
@@ -1,21 +1,22 @@
1
- ###################################################################################
2
- # #
3
- # Copyright 2010-2013 Ning, Inc. #
4
- # Copyright 2014 The Billing Project, LLC #
5
- # #
6
- # The Billing Project licenses this file to you under the Apache License, #
7
- # version 2.0 (the "License"); you may not use this file except in #
8
- # compliance with the License. You may obtain a copy of the License at: #
9
- # #
10
- # http://www.apache.org/licenses/LICENSE-2.0 #
11
- # #
12
- # Unless required by applicable law or agreed to in writing, software #
13
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
14
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
15
- # License for the specific language governing permissions and limitations #
16
- # under the License. #
17
- # #
18
- ###################################################################################
1
+ #############################################################################################
2
+ # #
3
+ # Copyright 2010-2013 Ning, Inc. #
4
+ # Copyright 2014 Groupon, Inc. #
5
+ # Copyright 2014 The Billing Project, LLC #
6
+ # #
7
+ # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
+ # (the "License"); you may not use this file except in compliance with the #
9
+ # License. You may obtain a copy of the License at: #
10
+ # #
11
+ # http://www.apache.org/licenses/LICENSE-2.0 #
12
+ # #
13
+ # Unless required by applicable law or agreed to in writing, software #
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
+ # License for the specific language governing permissions and limitations #
17
+ # under the License. #
18
+ # #
19
+ #############################################################################################
19
20
 
20
21
 
21
22
  #