killbill 5.1.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd154059c01dd7e7ec40938f0b30249bec32030b
4
- data.tar.gz: f1e2f74e199f56c257dac3ae427bbc268c60de65
3
+ metadata.gz: 4267aac031e411928647f3f7958a91afb9bef67a
4
+ data.tar.gz: 9027ef5b616bd146e07386d67120b9fea7120c03
5
5
  SHA512:
6
- metadata.gz: 739d5e790759d50a5bea73a79c143c49b5543ff7addd19d6b1496ece7ced5fa10bf332f5d4665e94c4471781f71a042fa2c76e1b9b76538685b90a3957e52685
7
- data.tar.gz: 065200616fd8c310892d03440b2309cbf9d128e43e3469208ab13a0250348b5c5d4d56d42dbb3fe039e4cf6481376c7203ae48d805b810417a56d52cbf863a56
6
+ metadata.gz: 5a8cc8856a04eac9d2161b6ac28d35acf0f3a6bc0e6898e19aec5f87bf9a6d02b80ab02ab5d37471eec6afe35f49f5bc99e3f39f18e2906eddb7450881db713e
7
+ data.tar.gz: 42c3432815d7f6f94fecd91152ae2234dd77a3e5be840c34a3eb5b46c43ba58270e71fa46d0337ecdabe2207be22ab1fb2a76460ec0205f03026df0813dbc610
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- killbill (5.1.0)
4
+ killbill (5.2.0)
5
5
  rack (>= 1.5.2)
6
6
  sinatra (~> 1.3.4)
7
7
  typhoeus (~> 0.6.9)
@@ -50,7 +50,7 @@ GEM
50
50
  erubis (2.7.0)
51
51
  ethon (0.7.4)
52
52
  ffi (>= 1.3.0)
53
- ffi (1.9.10-java)
53
+ ffi (1.9.9-java)
54
54
  i18n (0.7.0)
55
55
  jbundler (0.4.3)
56
56
  maven-tools (~> 0.32.1)
@@ -129,6 +129,3 @@ DEPENDENCIES
129
129
  rspec (~> 2.12.0)
130
130
  thor (~> 0.19.1)
131
131
  thread_safe (~> 0.3.4)
132
-
133
- BUNDLED WITH
134
- 1.10.6
data/Jarfile CHANGED
@@ -1,11 +1,11 @@
1
- jar 'org.kill-bill.billing:killbill-api', '0.19'
2
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.12'
3
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.12'
4
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.12'
5
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.12'
6
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-routing', '0.12'
7
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-catalog', '0.12'
8
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-entitlement', '0.12'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.23'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.16'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.16'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.16'
5
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.16'
6
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-control', '0.16'
7
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-catalog', '0.16'
8
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-entitlement', '0.16'
9
9
  jar 'org.kill-bill.billing:killbill-util:tests', '0.14.0'
10
10
  jar 'org.mockito:mockito-all', '1.10.19'
11
11
  jar 'javax.servlet:javax.servlet-api', '3.1.0'
data/Jarfile.lock CHANGED
@@ -1,13 +1,13 @@
1
- org.kill-bill.billing:killbill-api:jar:0.19
1
+ org.kill-bill.billing:killbill-api:jar:0.23
2
2
  com.fasterxml.jackson.core:jackson-annotations:jar:2.4.3
3
3
  joda-time:joda-time:jar:2.3
4
- org.kill-bill.billing.plugin:killbill-plugin-api-currency:jar:0.12
5
- org.kill-bill.billing.plugin:killbill-plugin-api-invoice:jar:0.12
6
- org.kill-bill.billing.plugin:killbill-plugin-api-notification:jar:0.12
7
- org.kill-bill.billing.plugin:killbill-plugin-api-payment:jar:0.12
8
- org.kill-bill.billing.plugin:killbill-plugin-api-routing:jar:0.12
9
- org.kill-bill.billing.plugin:killbill-plugin-api-catalog:jar:0.12
10
- org.kill-bill.billing.plugin:killbill-plugin-api-entitlement:jar:0.12
4
+ org.kill-bill.billing.plugin:killbill-plugin-api-currency:jar:0.15
5
+ org.kill-bill.billing.plugin:killbill-plugin-api-invoice:jar:0.15
6
+ org.kill-bill.billing.plugin:killbill-plugin-api-notification:jar:0.15
7
+ org.kill-bill.billing.plugin:killbill-plugin-api-payment:jar:0.15
8
+ org.kill-bill.billing.plugin:killbill-plugin-api-control:jar:0.15
9
+ org.kill-bill.billing.plugin:killbill-plugin-api-catalog:jar:0.15
10
+ org.kill-bill.billing.plugin:killbill-plugin-api-entitlement:jar:0.15
11
11
  org.kill-bill.billing:killbill-util:jar:tests:0.14.0
12
12
  com.fasterxml.jackson.core:jackson-databind:jar:2.4.3
13
13
  com.fasterxml.jackson.core:jackson-core:jar:2.4.3
data/NEWS CHANGED
@@ -1,3 +1,6 @@
1
+ 5.2.0
2
+ Regenerate files for killbill-api 0.23 and killbill-plugin-api 0.16
3
+
1
4
  5.1.0
2
5
  Fix missing require file
3
6
 
@@ -1,11 +1,11 @@
1
- jar 'org.kill-bill.billing:killbill-api', '0.19'
2
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.12'
3
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.12'
4
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.12'
5
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.12'
6
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-routing', '0.12'
7
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-catalog', '0.12'
8
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-entitlement', '0.12'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.23'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.16'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.16'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.16'
5
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.16'
6
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-control', '0.16'
7
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-catalog', '0.16'
8
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-entitlement', '0.16'
9
9
  jar 'org.kill-bill.billing:killbill-util:tests', '0.14.0'
10
10
  jar 'org.mockito:mockito-all', '1.10.19'
11
11
  jar 'javax.servlet:javax.servlet-api', '3.1.0'
@@ -34,7 +34,7 @@ module Killbill
34
34
 
35
35
  include org.killbill.billing.account.api.Account
36
36
 
37
- attr_accessor :id, :created_date, :updated_date, :external_key, :name, :first_name_length, :email, :bill_cycle_day_local, :currency, :payment_method_id, :time_zone, :locale, :address1, :address2, :company_name, :city, :state_or_province, :postal_code, :country, :phone, :is_migrated, :is_notified_for_invoices
37
+ attr_accessor :id, :created_date, :updated_date, :external_key, :currency, :time_zone, :name, :first_name_length, :email, :bill_cycle_day_local, :payment_method_id, :locale, :address1, :address2, :company_name, :city, :state_or_province, :postal_code, :country, :phone, :is_migrated, :is_notified_for_invoices
38
38
 
39
39
  def initialize()
40
40
  end
@@ -58,6 +58,14 @@ module Killbill
58
58
  # conversion for external_key [type = java.lang.String]
59
59
  @external_key = @external_key.to_s unless @external_key.nil?
60
60
 
61
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
62
+ @currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @currency.to_s ) unless @currency.nil?
63
+
64
+ # conversion for time_zone [type = org.joda.time.DateTimeZone]
65
+ if !@time_zone.nil?
66
+ @time_zone = Java::org.joda.time.DateTimeZone.forID((@time_zone.respond_to?(:identifier) ? @time_zone.identifier : @time_zone.to_s))
67
+ end
68
+
61
69
  # conversion for name [type = java.lang.String]
62
70
  @name = @name.to_s unless @name.nil?
63
71
 
@@ -70,17 +78,9 @@ module Killbill
70
78
  # conversion for bill_cycle_day_local [type = java.lang.Integer]
71
79
  @bill_cycle_day_local = @bill_cycle_day_local
72
80
 
73
- # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
74
- @currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @currency.to_s ) unless @currency.nil?
75
-
76
81
  # conversion for payment_method_id [type = java.util.UUID]
77
82
  @payment_method_id = java.util.UUID.fromString(@payment_method_id.to_s) unless @payment_method_id.nil?
78
83
 
79
- # conversion for time_zone [type = org.joda.time.DateTimeZone]
80
- if !@time_zone.nil?
81
- @time_zone = Java::org.joda.time.DateTimeZone.forID((@time_zone.respond_to?(:identifier) ? @time_zone.identifier : @time_zone.to_s))
82
- end
83
-
84
84
  # conversion for locale [type = java.lang.String]
85
85
  @locale = @locale.to_s unless @locale.nil?
86
86
 
@@ -140,6 +140,16 @@ module Killbill
140
140
  # conversion for external_key [type = java.lang.String]
141
141
  @external_key = j_obj.external_key
142
142
 
143
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
144
+ @currency = j_obj.currency
145
+ @currency = @currency.to_s.to_sym unless @currency.nil?
146
+
147
+ # conversion for time_zone [type = org.joda.time.DateTimeZone]
148
+ @time_zone = j_obj.time_zone
149
+ if !@time_zone.nil?
150
+ @time_zone = TZInfo::Timezone.get(@time_zone.get_id)
151
+ end
152
+
143
153
  # conversion for name [type = java.lang.String]
144
154
  @name = j_obj.name
145
155
 
@@ -152,20 +162,10 @@ module Killbill
152
162
  # conversion for bill_cycle_day_local [type = java.lang.Integer]
153
163
  @bill_cycle_day_local = j_obj.bill_cycle_day_local
154
164
 
155
- # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
156
- @currency = j_obj.currency
157
- @currency = @currency.to_s.to_sym unless @currency.nil?
158
-
159
165
  # conversion for payment_method_id [type = java.util.UUID]
160
166
  @payment_method_id = j_obj.payment_method_id
161
167
  @payment_method_id = @payment_method_id.nil? ? nil : @payment_method_id.to_s
162
168
 
163
- # conversion for time_zone [type = org.joda.time.DateTimeZone]
164
- @time_zone = j_obj.time_zone
165
- if !@time_zone.nil?
166
- @time_zone = TZInfo::Timezone.get(@time_zone.get_id)
167
- end
168
-
169
169
  # conversion for locale [type = java.lang.String]
170
170
  @locale = j_obj.locale
171
171
 
@@ -34,12 +34,15 @@ module Killbill
34
34
 
35
35
  include org.killbill.billing.invoice.api.DryRunArguments
36
36
 
37
- attr_accessor :plan_phase_specifier, :action, :subscription_id, :effective_date, :bundle_id, :billing_action_policy, :plan_phase_priceoverrides
37
+ attr_accessor :dry_run_type, :plan_phase_specifier, :action, :subscription_id, :effective_date, :bundle_id, :billing_action_policy, :plan_phase_price_overrides
38
38
 
39
39
  def initialize()
40
40
  end
41
41
 
42
42
  def to_java()
43
+ # conversion for dry_run_type [type = org.killbill.billing.invoice.api.DryRunType]
44
+ @dry_run_type = Java::org.killbill.billing.invoice.api.DryRunType.value_of( @dry_run_type.to_s ) unless @dry_run_type.nil?
45
+
43
46
  # conversion for plan_phase_specifier [type = org.killbill.billing.catalog.api.PlanPhaseSpecifier]
44
47
  @plan_phase_specifier = @plan_phase_specifier.to_java unless @plan_phase_specifier.nil?
45
48
 
@@ -61,18 +64,22 @@ module Killbill
61
64
  # conversion for billing_action_policy [type = org.killbill.billing.catalog.api.BillingActionPolicy]
62
65
  @billing_action_policy = Java::org.killbill.billing.catalog.api.BillingActionPolicy.value_of( @billing_action_policy.to_s ) unless @billing_action_policy.nil?
63
66
 
64
- # conversion for plan_phase_priceoverrides [type = java.util.List]
67
+ # conversion for plan_phase_price_overrides [type = java.util.List]
65
68
  tmp = java.util.ArrayList.new
66
- (@plan_phase_priceoverrides || []).each do |m|
69
+ (@plan_phase_price_overrides || []).each do |m|
67
70
  # conversion for m [type = org.killbill.billing.catalog.api.PlanPhasePriceOverride]
68
71
  m = m.to_java unless m.nil?
69
72
  tmp.add(m)
70
73
  end
71
- @plan_phase_priceoverrides = tmp
74
+ @plan_phase_price_overrides = tmp
72
75
  self
73
76
  end
74
77
 
75
78
  def to_ruby(j_obj)
79
+ # conversion for dry_run_type [type = org.killbill.billing.invoice.api.DryRunType]
80
+ @dry_run_type = j_obj.dry_run_type
81
+ @dry_run_type = @dry_run_type.to_s.to_sym unless @dry_run_type.nil?
82
+
76
83
  # conversion for plan_phase_specifier [type = org.killbill.billing.catalog.api.PlanPhaseSpecifier]
77
84
  @plan_phase_specifier = j_obj.plan_phase_specifier
78
85
  @plan_phase_specifier = Killbill::Plugin::Model::PlanPhaseSpecifier.new.to_ruby(@plan_phase_specifier) unless @plan_phase_specifier.nil?
@@ -101,15 +108,15 @@ module Killbill
101
108
  @billing_action_policy = j_obj.billing_action_policy
102
109
  @billing_action_policy = @billing_action_policy.to_s.to_sym unless @billing_action_policy.nil?
103
110
 
104
- # conversion for plan_phase_priceoverrides [type = java.util.List]
105
- @plan_phase_priceoverrides = j_obj.plan_phase_priceoverrides
111
+ # conversion for plan_phase_price_overrides [type = java.util.List]
112
+ @plan_phase_price_overrides = j_obj.plan_phase_price_overrides
106
113
  tmp = []
107
- (@plan_phase_priceoverrides || []).each do |m|
114
+ (@plan_phase_price_overrides || []).each do |m|
108
115
  # conversion for m [type = org.killbill.billing.catalog.api.PlanPhasePriceOverride]
109
116
  m = Killbill::Plugin::Model::PlanPhasePriceOverride.new.to_ruby(m) unless m.nil?
110
117
  tmp << m
111
118
  end
112
- @plan_phase_priceoverrides = tmp
119
+ @plan_phase_price_overrides = tmp
113
120
  self
114
121
  end
115
122
 
@@ -0,0 +1,82 @@
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.account.api'
33
+ class ImmutableAccountData
34
+
35
+ include org.killbill.billing.account.api.ImmutableAccountData
36
+
37
+ attr_accessor :id, :external_key, :currency, :time_zone
38
+
39
+ def initialize()
40
+ end
41
+
42
+ def to_java()
43
+ # conversion for id [type = java.util.UUID]
44
+ @id = java.util.UUID.fromString(@id.to_s) unless @id.nil?
45
+
46
+ # conversion for external_key [type = java.lang.String]
47
+ @external_key = @external_key.to_s unless @external_key.nil?
48
+
49
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
50
+ @currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @currency.to_s ) unless @currency.nil?
51
+
52
+ # conversion for time_zone [type = org.joda.time.DateTimeZone]
53
+ if !@time_zone.nil?
54
+ @time_zone = Java::org.joda.time.DateTimeZone.forID((@time_zone.respond_to?(:identifier) ? @time_zone.identifier : @time_zone.to_s))
55
+ end
56
+ self
57
+ end
58
+
59
+ def to_ruby(j_obj)
60
+ # conversion for id [type = java.util.UUID]
61
+ @id = j_obj.id
62
+ @id = @id.nil? ? nil : @id.to_s
63
+
64
+ # conversion for external_key [type = java.lang.String]
65
+ @external_key = j_obj.external_key
66
+
67
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
68
+ @currency = j_obj.currency
69
+ @currency = @currency.to_s.to_sym unless @currency.nil?
70
+
71
+ # conversion for time_zone [type = org.joda.time.DateTimeZone]
72
+ @time_zone = j_obj.time_zone
73
+ if !@time_zone.nil?
74
+ @time_zone = TZInfo::Timezone.get(@time_zone.get_id)
75
+ end
76
+ self
77
+ end
78
+
79
+ end
80
+ end
81
+ end
82
+ end
@@ -34,7 +34,7 @@ module Killbill
34
34
 
35
35
  include org.killbill.billing.invoice.api.InvoicePayment
36
36
 
37
- attr_accessor :id, :created_date, :updated_date, :payment_id, :type, :invoice_id, :payment_date, :amount, :currency, :linked_invoice_payment_id, :payment_cookie_id, :processed_currency
37
+ attr_accessor :id, :created_date, :updated_date, :payment_id, :type, :invoice_id, :payment_date, :amount, :currency, :linked_invoice_payment_id, :payment_cookie_id, :processed_currency, :is_success
38
38
 
39
39
  def initialize()
40
40
  end
@@ -88,6 +88,9 @@ module Killbill
88
88
 
89
89
  # conversion for processed_currency [type = org.killbill.billing.catalog.api.Currency]
90
90
  @processed_currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @processed_currency.to_s ) unless @processed_currency.nil?
91
+
92
+ # conversion for is_success [type = java.lang.Boolean]
93
+ @is_success = @is_success.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(@is_success)
91
94
  self
92
95
  end
93
96
 
@@ -150,6 +153,15 @@ module Killbill
150
153
  # conversion for processed_currency [type = org.killbill.billing.catalog.api.Currency]
151
154
  @processed_currency = j_obj.processed_currency
152
155
  @processed_currency = @processed_currency.to_s.to_sym unless @processed_currency.nil?
156
+
157
+ # conversion for is_success [type = java.lang.Boolean]
158
+ @is_success = j_obj.is_success
159
+ if @is_success.nil?
160
+ @is_success = false
161
+ else
162
+ tmp_bool = (@is_success.java_kind_of? java.lang.Boolean) ? @is_success.boolean_value : @is_success
163
+ @is_success = tmp_bool ? true : false
164
+ end
153
165
  self
154
166
  end
155
167
 
@@ -30,6 +30,7 @@ require 'killbill/gen/api/account_api_exception'
30
30
  require 'killbill/gen/api/account_data'
31
31
  require 'killbill/gen/api/account_email'
32
32
  require 'killbill/gen/api/account_user_api'
33
+ require 'killbill/gen/api/immutable_account_data'
33
34
  require 'killbill/gen/api/mutable_account_data'
34
35
  require 'killbill/gen/api/billing_exception_base'
35
36
  require 'killbill/gen/api/block'
@@ -40,12 +40,20 @@ module Killbill
40
40
  end
41
41
 
42
42
 
43
- java_signature 'Java::java.util.List getAdditionalInvoiceItems(Java::org.killbill.billing.invoice.api.Invoice, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
44
- def get_additional_invoice_items(invoice, properties, context)
43
+ java_signature 'Java::java.util.List getAdditionalInvoiceItems(Java::org.killbill.billing.invoice.api.Invoice, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
44
+ def get_additional_invoice_items(invoice, dryRun, properties, context)
45
45
 
46
46
  # conversion for invoice [type = org.killbill.billing.invoice.api.Invoice]
47
47
  invoice = Killbill::Plugin::Model::Invoice.new.to_ruby(invoice) unless invoice.nil?
48
48
 
49
+ # conversion for dryRun [type = boolean]
50
+ if dryRun.nil?
51
+ dryRun = false
52
+ else
53
+ tmp_bool = (dryRun.java_kind_of? java.lang.Boolean) ? dryRun.boolean_value : dryRun
54
+ dryRun = tmp_bool ? true : false
55
+ end
56
+
49
57
  # conversion for properties [type = java.lang.Iterable]
50
58
  tmp = []
51
59
  (properties.nil? ? [] : properties.iterator).each do |m|
@@ -58,7 +66,7 @@ module Killbill
58
66
  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
59
67
  context = Killbill::Plugin::Model::CallContext.new.to_ruby(context) unless context.nil?
60
68
  begin
61
- res = @delegate_plugin.get_additional_invoice_items(invoice, properties, context)
69
+ res = @delegate_plugin.get_additional_invoice_items(invoice, dryRun, properties, context)
62
70
  # conversion for res [type = java.util.List]
63
71
  tmp = java.util.ArrayList.new
64
72
  (res || []).each do |m|
@@ -43,36 +43,25 @@ module Killbill
43
43
  transaction_from_kb_payment_transaction_id(nil, kb_payment_transaction_id, kb_tenant_id, :single)
44
44
  end
45
45
 
46
- def find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id, amount_in_cents, transaction_type = nil)
46
+ def find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id, transaction_type = nil)
47
47
  if transaction_type.nil?
48
- begin
49
- do_find_candidate_transaction_for_refund(:authorize, kb_payment_id, kb_tenant_id, amount_in_cents)
50
- rescue
51
- do_find_candidate_transaction_for_refund(:purchase, kb_payment_id, kb_tenant_id, amount_in_cents)
52
- end
48
+ find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id, :AUTHORIZE) || find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id, :PURCHASE)
53
49
  else
54
- do_find_candidate_transaction_for_refund(transaction_type, kb_payment_id, kb_tenant_id, amount_in_cents)
50
+ do_find_candidate_transaction_for_refund(transaction_type, kb_payment_id, kb_tenant_id)
55
51
  end
56
52
  end
57
53
 
58
54
  private
59
55
 
60
- def do_find_candidate_transaction_for_refund(api_call, kb_payment_id, kb_tenant_id, amount_in_cents)
61
- # Find one successful charge which amount is at least the amount we are trying to refund
56
+ # Note: this does not check any amount, as the behavior is gateway specific (some allow to refund more than what was captured):
57
+ # we just want to find the reference transaction to pass the id to the gateway
58
+ def do_find_candidate_transaction_for_refund(transaction_type, kb_payment_id, kb_tenant_id)
59
+ # Assume the last one was successful
62
60
  if kb_tenant_id.nil?
63
- transactions = where("amount_in_cents >= #{@@quotes_cache[amount_in_cents]} AND api_call = #{@@quotes_cache[api_call]} AND kb_tenant_id is NULL AND kb_payment_id = #{@@quotes_cache[kb_payment_id]}").order(:created_at)
61
+ transactions = where("transaction_type = #{@@quotes_cache[transaction_type]} AND kb_tenant_id is NULL AND kb_payment_id = #{@@quotes_cache[kb_payment_id]}").order(:created_at => :desc)
64
62
  else
65
- transactions = where("amount_in_cents >= #{@@quotes_cache[amount_in_cents]} AND api_call = #{@@quotes_cache[api_call]} AND kb_tenant_id = #{@@quotes_cache[kb_tenant_id]} AND kb_payment_id = #{@@quotes_cache[kb_payment_id]}").order(:created_at)
63
+ transactions = where("transaction_type = #{@@quotes_cache[transaction_type]} AND kb_tenant_id = #{@@quotes_cache[kb_tenant_id]} AND kb_payment_id = #{@@quotes_cache[kb_payment_id]}").order(:created_at => :desc)
66
64
  end
67
- raise "Unable to find transaction for payment #{kb_payment_id} and api_call #{api_call}" if transactions.size == 0
68
-
69
- # We have candidates, but we now need to make sure we didn't refund more than for the specified amount
70
- amount_refunded_in_cents = where("api_call = #{@@quotes_cache['refund']} and kb_payment_id = #{@@quotes_cache[kb_payment_id]}").sum('amount_in_cents')
71
-
72
- amount_left_to_refund_in_cents = -amount_refunded_in_cents
73
- transactions.map { |transaction| amount_left_to_refund_in_cents += transaction.amount_in_cents }
74
- raise "Amount #{amount_in_cents} too large to refund for payment #{kb_payment_id}" if amount_left_to_refund_in_cents < amount_in_cents
75
-
76
65
  transactions.first
77
66
  end
78
67
 
@@ -129,7 +129,8 @@ module Killbill
129
129
 
130
130
  linked_transaction_proc = Proc.new do |amount_in_cents, options|
131
131
  linked_transaction_type = find_value_from_properties(properties, :linked_transaction_type)
132
- transaction = @transaction_model.find_candidate_transaction_for_refund(kb_payment_id, context.tenant_id, amount_in_cents, linked_transaction_type)
132
+ transaction = @transaction_model.find_candidate_transaction_for_refund(kb_payment_id, context.tenant_id, linked_transaction_type)
133
+ # This should never happen
133
134
  raise "Unable to retrieve transaction to refund for operation=refund, kb_payment_id=#{kb_payment_id}, kb_payment_transaction_id=#{kb_payment_transaction_id}, kb_payment_method_id=#{kb_payment_method_id}" if transaction.nil?
134
135
  transaction
135
136
  end
@@ -5,7 +5,7 @@ module Killbill
5
5
  module Plugin
6
6
  class Invoice < Notification
7
7
 
8
- def get_additional_invoice_items(invoice, properties, context)
8
+ def get_additional_invoice_items(invoice, dry_run, properties, context)
9
9
  []
10
10
  end
11
11
 
@@ -1,3 +1,3 @@
1
1
  module Killbill
2
- VERSION = '5.1.0'
2
+ VERSION = '5.2.0'
3
3
  end
@@ -114,6 +114,33 @@ describe Killbill::Plugin::ActiveMerchant::PaymentPlugin do
114
114
  plugin.get_payment_methods(@kb_account_id, true, @properties, @call_context).size.should == 0
115
115
  end
116
116
 
117
+ # https://github.com/killbill/killbill-plugin-framework-ruby/issues/51
118
+ it 'supports multiple refunds regardless of the amount against auth' do
119
+ ptip = trigger_auth(@properties)
120
+ verify_auth_status(ptip, :PROCESSED)
121
+
122
+ ptip = trigger_capture(@properties)
123
+ verify_capture_status(ptip, :PROCESSED)
124
+
125
+ ptip = trigger_refund(@properties)
126
+ verify_refund_status(ptip, :PROCESSED)
127
+
128
+ ptip = trigger_refund(@properties)
129
+ verify_refund_status(ptip, :PROCESSED)
130
+ end
131
+
132
+ # https://github.com/killbill/killbill-plugin-framework-ruby/issues/51
133
+ it 'supports multiple refunds regardless of the amount against purchase' do
134
+ ptip = trigger_purchase(@properties)
135
+ verify_purchase_status(ptip, :PROCESSED)
136
+
137
+ ptip = trigger_refund(@properties)
138
+ verify_refund_status(ptip, :PROCESSED)
139
+
140
+ ptip = trigger_refund(@properties)
141
+ verify_refund_status(ptip, :PROCESSED)
142
+ end
143
+
117
144
  it 'should support different payment_processor_account_ids' do
118
145
  plugin.get_payment_methods(@kb_account_id, true, @properties, @call_context).size.should == 0
119
146
 
@@ -485,13 +512,46 @@ describe Killbill::Plugin::ActiveMerchant::PaymentPlugin do
485
512
 
486
513
  private
487
514
 
515
+ def add_payment_method_if_needed(pm_properties = [])
516
+ plugin.get_payment_method_detail(@kb_account_id, @kb_payment_method_id, pm_properties, @call_context) rescue plugin.add_payment_method(@kb_account_id, @kb_payment_method_id, @payment_method_props, true, pm_properties, @call_context)
517
+ end
518
+
488
519
  def trigger_purchase(purchase_properties=[], kb_payment_transaction_id=SecureRandom.uuid)
489
- plugin.get_payment_method_detail(@kb_account_id, @kb_payment_method_id, [], @call_context) rescue plugin.add_payment_method(@kb_account_id, @kb_payment_method_id, @payment_method_props, true, [], @call_context)
520
+ add_payment_method_if_needed(purchase_properties)
490
521
  plugin.purchase_payment(@kb_account_id, @kb_payment_id, kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, purchase_properties, @call_context)
491
522
  end
492
523
 
524
+ def trigger_auth(auth_properties=[], kb_payment_transaction_id=SecureRandom.uuid)
525
+ add_payment_method_if_needed(auth_properties)
526
+ plugin.authorize_payment(@kb_account_id, @kb_payment_id, kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, auth_properties, @call_context)
527
+ end
528
+
529
+ def trigger_capture(capture_properties=[], kb_payment_transaction_id=SecureRandom.uuid)
530
+ plugin.capture_payment(@kb_account_id, @kb_payment_id, kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, capture_properties, @call_context)
531
+ end
532
+
533
+ def trigger_refund(refund_properties=[], kb_payment_transaction_id=SecureRandom.uuid)
534
+ plugin.refund_payment(@kb_account_id, @kb_payment_id, kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, refund_properties, @call_context)
535
+ end
536
+
537
+ def verify_transaction_status(t_info_plugin, status, transaction_type)
538
+ verify_transaction_info_plugin(t_info_plugin, t_info_plugin.kb_transaction_payment_id, transaction_type, nil, 'default', status)
539
+ end
540
+
493
541
  def verify_purchase_status(t_info_plugin, status)
494
- verify_transaction_info_plugin(t_info_plugin, t_info_plugin.kb_transaction_payment_id, :PURCHASE, nil, 'default', status)
542
+ verify_transaction_status(t_info_plugin, status, :PURCHASE)
543
+ end
544
+
545
+ def verify_auth_status(t_info_plugin, status)
546
+ verify_transaction_status(t_info_plugin, status, :AUTHORIZE)
547
+ end
548
+
549
+ def verify_capture_status(t_info_plugin, status)
550
+ verify_transaction_status(t_info_plugin, status, :CAPTURE)
551
+ end
552
+
553
+ def verify_refund_status(t_info_plugin, status)
554
+ verify_transaction_status(t_info_plugin, status, :REFUND)
495
555
  end
496
556
 
497
557
  def verify_transaction_info_plugin(t_info_plugin, kb_transaction_id, type, transaction_nb, payment_processor_account_id='default', status=:PROCESSED)
@@ -2,10 +2,32 @@ require 'spec_helper'
2
2
 
3
3
  describe Killbill::Plugin::ActiveMerchant::ActiveRecord::Transaction do
4
4
 
5
- before :all do
5
+ before :each do
6
6
  ::Killbill::Test::TestTransaction.delete_all
7
7
  end
8
8
 
9
+ # https://github.com/killbill/killbill-plugin-framework-ruby/issues/51
10
+ it 'always finds a transaction for refund' do
11
+ api_call = 'for debugging only'
12
+ amount_in_cents = 1242
13
+ currency = :USD
14
+ kb_account_id = SecureRandom.uuid
15
+ kb_tenant_id = SecureRandom.uuid
16
+ kb_payment_id = SecureRandom.uuid
17
+
18
+ auth_tx = create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :AUTHORIZE, amount_in_cents, currency, kb_account_id, kb_tenant_id)
19
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id).id.should == auth_tx.id
20
+
21
+ create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :CAPTURE, amount_in_cents, currency, kb_account_id, kb_tenant_id)
22
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id).id.should == auth_tx.id
23
+
24
+ create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :REFUND, amount_in_cents, currency, kb_account_id, kb_tenant_id)
25
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id).id.should == auth_tx.id
26
+
27
+ create_transaction(api_call, kb_payment_id, SecureRandom.uuid, :REFUND, amount_in_cents, currency, kb_account_id, kb_tenant_id)
28
+ ::Killbill::Test::TestTransaction.find_candidate_transaction_for_refund(kb_payment_id, kb_tenant_id).id.should == auth_tx.id
29
+ end
30
+
9
31
  it 'should store and retrieve transactions correctly' do
10
32
  api_call = 'for debugging only'
11
33
  amount_in_cents = 1242
@@ -10,7 +10,7 @@ describe Killbill::Plugin::Api::InvoicePluginApi do
10
10
  it 'should add items' do
11
11
  invoice = create_invoice
12
12
 
13
- items = @invoicePluginApi.get_additional_invoice_items(invoice, java.util.ArrayList.new, nil)
13
+ items = @invoicePluginApi.get_additional_invoice_items(invoice, java.lang.Boolean::FALSE, java.util.ArrayList.new, nil)
14
14
  items.size.should == 2
15
15
 
16
16
  items.get(0).invoice_id.should == invoice.id
@@ -7,7 +7,7 @@ describe Killbill::Plugin::Invoice do
7
7
 
8
8
  it 'should not raise exceptions by default' do
9
9
  plugin = DummyInvoicePlugin.new
10
- plugin.get_additional_invoice_items(nil, nil, nil).size.should == 0
10
+ plugin.get_additional_invoice_items(nil, false, nil, nil).size.should == 0
11
11
  end
12
12
 
13
13
  it 'should be able to build items' do
@@ -5,7 +5,7 @@ module Killbill
5
5
  module Plugin
6
6
  class InvoiceTest < Invoice
7
7
 
8
- def get_additional_invoice_items(invoice, properties, context)
8
+ def get_additional_invoice_items(invoice, dry_run, properties, context)
9
9
  additional_items = []
10
10
  invoice.invoice_items.each do |original_item|
11
11
  additional_items << build_item(original_item, original_item.amount * 7 / 100, 'Tax item', :TAX)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-13 00:00:00.000000000 Z
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -393,6 +393,7 @@ files:
393
393
  - lib/killbill/gen/api/enumerator_iterator.rb
394
394
  - lib/killbill/gen/api/fixed.rb
395
395
  - lib/killbill/gen/api/illegal_plan_change.rb
396
+ - lib/killbill/gen/api/immutable_account_data.rb
396
397
  - lib/killbill/gen/api/international_price.rb
397
398
  - lib/killbill/gen/api/invalid_config_exception.rb
398
399
  - lib/killbill/gen/api/invoice.rb
@@ -581,40 +582,8 @@ requirements:
581
582
  - jar 'org.kill-bill.billing:killbill-api'
582
583
  - jar 'org.kill-bill.billing:killbill-util:tests'
583
584
  rubyforge_project:
584
- rubygems_version: 2.4.8
585
+ rubygems_version: 2.1.9
585
586
  signing_key:
586
587
  specification_version: 4
587
588
  summary: Framework to write Kill Bill plugins in Ruby.
588
- test_files:
589
- - spec/killbill/base_plugin_spec.rb
590
- - spec/killbill/config_test.ru
591
- - spec/killbill/gen_conversions_spec.rb
592
- - spec/killbill/helpers/configuration_spec.rb
593
- - spec/killbill/helpers/connection_spec.rb
594
- - spec/killbill/helpers/killbill_spec_helper_spec.rb
595
- - spec/killbill/helpers/payment_method_spec.rb
596
- - spec/killbill/helpers/payment_plugin_spec.rb
597
- - spec/killbill/helpers/private_payment_plugin_spec.rb
598
- - spec/killbill/helpers/response_spec.rb
599
- - spec/killbill/helpers/streamy_result_set_spec.rb
600
- - spec/killbill/helpers/test_payment_method.rb
601
- - spec/killbill/helpers/test_response.rb
602
- - spec/killbill/helpers/test_schema.rb
603
- - spec/killbill/helpers/test_transaction.rb
604
- - spec/killbill/helpers/transaction_spec.rb
605
- - spec/killbill/helpers/utils_spec.rb
606
- - spec/killbill/invoice_plugin_api_spec.rb
607
- - spec/killbill/invoice_plugin_spec.rb
608
- - spec/killbill/invoice_test.rb
609
- - spec/killbill/killbill_integration_spec.rb
610
- - spec/killbill/killbill_logger_spec.rb
611
- - spec/killbill/killbillapi_spec.rb
612
- - spec/killbill/notification_plugin_api_spec.rb
613
- - spec/killbill/notification_plugin_spec.rb
614
- - spec/killbill/notification_test.rb
615
- - spec/killbill/payment_plugin_api_spec.rb
616
- - spec/killbill/payment_plugin_spec.rb
617
- - spec/killbill/payment_test.rb
618
- - spec/killbill/rack_handler_spec.rb
619
- - spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
620
- - spec/spec_helper.rb
589
+ test_files: []