killbill 8.1.0 → 8.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,175 @@
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.catalog.api'
33
+ class MutableStaticCatalog
34
+
35
+ include org.killbill.billing.catalog.api.MutableStaticCatalog
36
+
37
+ attr_accessor :catalog_name, :recurring_billing_mode, :effective_date, :current_supported_currencies, :current_products, :current_units, :current_plans, :available_base_plan_listings
38
+
39
+ def initialize()
40
+ end
41
+
42
+ def to_java()
43
+ # conversion for catalog_name [type = java.lang.String]
44
+ @catalog_name = @catalog_name.to_s unless @catalog_name.nil?
45
+
46
+ # conversion for recurring_billing_mode [type = org.killbill.billing.catalog.api.BillingMode]
47
+ @recurring_billing_mode = Java::org.killbill.billing.catalog.api.BillingMode.value_of( @recurring_billing_mode.to_s ) unless @recurring_billing_mode.nil?
48
+
49
+ # conversion for effective_date [type = java.util.Date]
50
+ if !@effective_date.nil?
51
+ @effective_date = (@effective_date.kind_of? Time) ? DateTime.parse(@effective_date.to_s) : @effective_date
52
+ @effective_date = Java::org.joda.time.DateTime.new(@effective_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
53
+ @effective_date = @effective_date.to_date
54
+ end
55
+
56
+ # conversion for current_supported_currencies [type = org.killbill.billing.catalog.api.Currency[]]
57
+ tmp = []
58
+ (@current_supported_currencies || []).each do |m|
59
+ # conversion for m [type = org.killbill.billing.catalog.api.Currency]
60
+ m = Java::org.killbill.billing.catalog.api.Currency.value_of( m.to_s ) unless m.nil?
61
+ tmp << m
62
+ end
63
+ @current_supported_currencies = tmp.to_java Java::org.killbill.billing.catalog.api.Currency
64
+
65
+ # conversion for current_products [type = org.killbill.billing.catalog.api.Product[]]
66
+ tmp = []
67
+ (@current_products || []).each do |m|
68
+ # conversion for m [type = org.killbill.billing.catalog.api.Product]
69
+ m = m.to_java unless m.nil?
70
+ tmp << m
71
+ end
72
+ @current_products = tmp.to_java Java::org.killbill.billing.catalog.api.Product
73
+
74
+ # conversion for current_units [type = org.killbill.billing.catalog.api.Unit[]]
75
+ tmp = []
76
+ (@current_units || []).each do |m|
77
+ # conversion for m [type = org.killbill.billing.catalog.api.Unit]
78
+ m = m.to_java unless m.nil?
79
+ tmp << m
80
+ end
81
+ @current_units = tmp.to_java Java::org.killbill.billing.catalog.api.Unit
82
+
83
+ # conversion for current_plans [type = org.killbill.billing.catalog.api.Plan[]]
84
+ tmp = []
85
+ (@current_plans || []).each do |m|
86
+ # conversion for m [type = org.killbill.billing.catalog.api.Plan]
87
+ m = m.to_java unless m.nil?
88
+ tmp << m
89
+ end
90
+ @current_plans = tmp.to_java Java::org.killbill.billing.catalog.api.Plan
91
+
92
+ # conversion for available_base_plan_listings [type = java.util.List]
93
+ tmp = java.util.ArrayList.new
94
+ (@available_base_plan_listings || []).each do |m|
95
+ # conversion for m [type = org.killbill.billing.catalog.api.Listing]
96
+ m = m.to_java unless m.nil?
97
+ tmp.add(m)
98
+ end
99
+ @available_base_plan_listings = tmp
100
+ self
101
+ end
102
+
103
+ def to_ruby(j_obj)
104
+ # conversion for catalog_name [type = java.lang.String]
105
+ @catalog_name = j_obj.catalog_name
106
+
107
+ # conversion for recurring_billing_mode [type = org.killbill.billing.catalog.api.BillingMode]
108
+ @recurring_billing_mode = j_obj.recurring_billing_mode
109
+ @recurring_billing_mode = @recurring_billing_mode.to_s.to_sym unless @recurring_billing_mode.nil?
110
+
111
+ # conversion for effective_date [type = java.util.Date]
112
+ @effective_date = j_obj.effective_date
113
+ if !@effective_date.nil?
114
+ @effective_date = Java::org.joda.time.DateTime.new(@effective_date)
115
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
116
+ str = fmt.print(@effective_date)
117
+ @effective_date = DateTime.iso8601(str)
118
+ end
119
+
120
+ # conversion for current_supported_currencies [type = org.killbill.billing.catalog.api.Currency[]]
121
+ @current_supported_currencies = j_obj.current_supported_currencies
122
+ tmp = []
123
+ (@current_supported_currencies || []).each do |m|
124
+ # conversion for m [type = org.killbill.billing.catalog.api.Currency]
125
+ m = m.to_s.to_sym unless m.nil?
126
+ tmp << m
127
+ end
128
+ @current_supported_currencies = tmp
129
+
130
+ # conversion for current_products [type = org.killbill.billing.catalog.api.Product[]]
131
+ @current_products = j_obj.current_products
132
+ tmp = []
133
+ (@current_products || []).each do |m|
134
+ # conversion for m [type = org.killbill.billing.catalog.api.Product]
135
+ m = Killbill::Plugin::Model::Product.new.to_ruby(m) unless m.nil?
136
+ tmp << m
137
+ end
138
+ @current_products = tmp
139
+
140
+ # conversion for current_units [type = org.killbill.billing.catalog.api.Unit[]]
141
+ @current_units = j_obj.current_units
142
+ tmp = []
143
+ (@current_units || []).each do |m|
144
+ # conversion for m [type = org.killbill.billing.catalog.api.Unit]
145
+ m = Killbill::Plugin::Model::Unit.new.to_ruby(m) unless m.nil?
146
+ tmp << m
147
+ end
148
+ @current_units = tmp
149
+
150
+ # conversion for current_plans [type = org.killbill.billing.catalog.api.Plan[]]
151
+ @current_plans = j_obj.current_plans
152
+ tmp = []
153
+ (@current_plans || []).each do |m|
154
+ # conversion for m [type = org.killbill.billing.catalog.api.Plan]
155
+ m = Killbill::Plugin::Model::Plan.new.to_ruby(m) unless m.nil?
156
+ tmp << m
157
+ end
158
+ @current_plans = tmp
159
+
160
+ # conversion for available_base_plan_listings [type = java.util.List]
161
+ @available_base_plan_listings = j_obj.available_base_plan_listings
162
+ tmp = []
163
+ (@available_base_plan_listings || []).each do |m|
164
+ # conversion for m [type = org.killbill.billing.catalog.api.Listing]
165
+ m = Killbill::Plugin::Model::Listing.new.to_ruby(m) unless m.nil?
166
+ tmp << m
167
+ end
168
+ @available_base_plan_listings = tmp
169
+ self
170
+ end
171
+
172
+ end
173
+ end
174
+ end
175
+ end
@@ -34,7 +34,7 @@ module Killbill
34
34
 
35
35
  include org.killbill.billing.payment.api.Payment
36
36
 
37
- attr_accessor :id, :created_date, :updated_date, :account_id, :payment_method_id, :payment_number, :external_key, :auth_amount, :captured_amount, :purchased_amount, :credited_amount, :refunded_amount, :is_auth_voided, :currency, :transactions
37
+ attr_accessor :id, :created_date, :updated_date, :account_id, :payment_method_id, :payment_number, :external_key, :auth_amount, :captured_amount, :purchased_amount, :credited_amount, :refunded_amount, :is_auth_voided, :currency, :transactions, :payment_attempts
38
38
 
39
39
  def initialize()
40
40
  end
@@ -116,6 +116,15 @@ module Killbill
116
116
  tmp.add(m)
117
117
  end
118
118
  @transactions = tmp
119
+
120
+ # conversion for payment_attempts [type = java.util.List]
121
+ tmp = java.util.ArrayList.new
122
+ (@payment_attempts || []).each do |m|
123
+ # conversion for m [type = org.killbill.billing.payment.api.PaymentAttempt]
124
+ m = m.to_java unless m.nil?
125
+ tmp.add(m)
126
+ end
127
+ @payment_attempts = tmp
119
128
  self
120
129
  end
121
130
 
@@ -196,6 +205,16 @@ module Killbill
196
205
  tmp << m
197
206
  end
198
207
  @transactions = tmp
208
+
209
+ # conversion for payment_attempts [type = java.util.List]
210
+ @payment_attempts = j_obj.payment_attempts
211
+ tmp = []
212
+ (@payment_attempts || []).each do |m|
213
+ # conversion for m [type = org.killbill.billing.payment.api.PaymentAttempt]
214
+ m = Killbill::Plugin::Model::PaymentAttempt.new.to_ruby(m) unless m.nil?
215
+ tmp << m
216
+ end
217
+ @payment_attempts = tmp
199
218
  self
200
219
  end
201
220
 
@@ -762,8 +762,8 @@ module Killbill
762
762
  end
763
763
  end
764
764
 
765
- java_signature 'Java::java.util.List getAccountPayments(Java::java.util.UUID, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
766
- def get_account_payments(accountId, withPluginInfo, properties, context)
765
+ java_signature 'Java::java.util.List getAccountPayments(Java::java.util.UUID, Java::boolean, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
766
+ def get_account_payments(accountId, withPluginInfo, withAttempts, properties, context)
767
767
 
768
768
  # conversion for accountId [type = java.util.UUID]
769
769
  accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
@@ -771,6 +771,9 @@ module Killbill
771
771
  # conversion for withPluginInfo [type = boolean]
772
772
  withPluginInfo = withPluginInfo.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withPluginInfo)
773
773
 
774
+ # conversion for withAttempts [type = boolean]
775
+ withAttempts = withAttempts.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withAttempts)
776
+
774
777
  # conversion for properties [type = java.lang.Iterable]
775
778
  tmp = java.util.ArrayList.new
776
779
  (properties || []).each do |m|
@@ -783,7 +786,7 @@ module Killbill
783
786
  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
784
787
  context = context.to_java unless context.nil?
785
788
  begin
786
- res = @real_java_api.get_account_payments(accountId, withPluginInfo, properties, context)
789
+ res = @real_java_api.get_account_payments(accountId, withPluginInfo, withAttempts, properties, context)
787
790
  # conversion for res [type = java.util.List]
788
791
  tmp = []
789
792
  (res || []).each do |m|
@@ -798,8 +801,8 @@ module Killbill
798
801
  end
799
802
  end
800
803
 
801
- java_signature 'Java::org.killbill.billing.payment.api.Payment getPayment(Java::java.util.UUID, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
802
- def get_payment(paymentId, withPluginInfo, properties, context)
804
+ java_signature 'Java::org.killbill.billing.payment.api.Payment getPayment(Java::java.util.UUID, Java::boolean, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
805
+ def get_payment(paymentId, withPluginInfo, withAttempts, properties, context)
803
806
 
804
807
  # conversion for paymentId [type = java.util.UUID]
805
808
  paymentId = java.util.UUID.fromString(paymentId.to_s) unless paymentId.nil?
@@ -807,6 +810,9 @@ module Killbill
807
810
  # conversion for withPluginInfo [type = boolean]
808
811
  withPluginInfo = withPluginInfo.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withPluginInfo)
809
812
 
813
+ # conversion for withAttempts [type = boolean]
814
+ withAttempts = withAttempts.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withAttempts)
815
+
810
816
  # conversion for properties [type = java.lang.Iterable]
811
817
  tmp = java.util.ArrayList.new
812
818
  (properties || []).each do |m|
@@ -819,7 +825,7 @@ module Killbill
819
825
  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
820
826
  context = context.to_java unless context.nil?
821
827
  begin
822
- res = @real_java_api.get_payment(paymentId, withPluginInfo, properties, context)
828
+ res = @real_java_api.get_payment(paymentId, withPluginInfo, withAttempts, properties, context)
823
829
  # conversion for res [type = org.killbill.billing.payment.api.Payment]
824
830
  res = Killbill::Plugin::Model::Payment.new.to_ruby(res) unless res.nil?
825
831
  return res
@@ -828,8 +834,8 @@ module Killbill
828
834
  end
829
835
  end
830
836
 
831
- java_signature 'Java::org.killbill.billing.payment.api.Payment getPaymentByExternalKey(Java::java.lang.String, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
832
- def get_payment_by_external_key(paymentExternalKey, withPluginInfo, properties, context)
837
+ java_signature 'Java::org.killbill.billing.payment.api.Payment getPaymentByExternalKey(Java::java.lang.String, Java::boolean, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
838
+ def get_payment_by_external_key(paymentExternalKey, withPluginInfo, withAttempts, properties, context)
833
839
 
834
840
  # conversion for paymentExternalKey [type = java.lang.String]
835
841
  paymentExternalKey = paymentExternalKey.to_s unless paymentExternalKey.nil?
@@ -837,6 +843,9 @@ module Killbill
837
843
  # conversion for withPluginInfo [type = boolean]
838
844
  withPluginInfo = withPluginInfo.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withPluginInfo)
839
845
 
846
+ # conversion for withAttempts [type = boolean]
847
+ withAttempts = withAttempts.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withAttempts)
848
+
840
849
  # conversion for properties [type = java.lang.Iterable]
841
850
  tmp = java.util.ArrayList.new
842
851
  (properties || []).each do |m|
@@ -849,7 +858,7 @@ module Killbill
849
858
  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
850
859
  context = context.to_java unless context.nil?
851
860
  begin
852
- res = @real_java_api.get_payment_by_external_key(paymentExternalKey, withPluginInfo, properties, context)
861
+ res = @real_java_api.get_payment_by_external_key(paymentExternalKey, withPluginInfo, withAttempts, properties, context)
853
862
  # conversion for res [type = org.killbill.billing.payment.api.Payment]
854
863
  res = Killbill::Plugin::Model::Payment.new.to_ruby(res) unless res.nil?
855
864
  return res
@@ -858,8 +867,8 @@ module Killbill
858
867
  end
859
868
  end
860
869
 
861
- java_signature 'Java::org.killbill.billing.util.entity.Pagination getPayments(Java::java.lang.Long, Java::java.lang.Long, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
862
- def get_payments(offset, limit, withPluginInfo, properties, context)
870
+ java_signature 'Java::org.killbill.billing.util.entity.Pagination getPayments(Java::java.lang.Long, Java::java.lang.Long, Java::boolean, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
871
+ def get_payments(offset, limit, withPluginInfo, withAttempts, properties, context)
863
872
 
864
873
  # conversion for offset [type = java.lang.Long]
865
874
  offset = offset
@@ -870,6 +879,9 @@ module Killbill
870
879
  # conversion for withPluginInfo [type = boolean]
871
880
  withPluginInfo = withPluginInfo.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withPluginInfo)
872
881
 
882
+ # conversion for withAttempts [type = boolean]
883
+ withAttempts = withAttempts.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withAttempts)
884
+
873
885
  # conversion for properties [type = java.lang.Iterable]
874
886
  tmp = java.util.ArrayList.new
875
887
  (properties || []).each do |m|
@@ -881,14 +893,14 @@ module Killbill
881
893
 
882
894
  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
883
895
  context = context.to_java unless context.nil?
884
- res = @real_java_api.get_payments(offset, limit, withPluginInfo, properties, context)
896
+ res = @real_java_api.get_payments(offset, limit, withPluginInfo, withAttempts, properties, context)
885
897
  # conversion for res [type = org.killbill.billing.util.entity.Pagination]
886
898
  res = Killbill::Plugin::Model::Pagination.new.to_ruby(res) unless res.nil?
887
899
  return res
888
900
  end
889
901
 
890
- java_signature 'Java::org.killbill.billing.util.entity.Pagination searchPayments(Java::java.lang.String, Java::java.lang.Long, Java::java.lang.Long, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
891
- def search_payments(searchKey, offset, limit, withPluginInfo, properties, context)
902
+ java_signature 'Java::org.killbill.billing.util.entity.Pagination searchPayments(Java::java.lang.String, Java::java.lang.Long, Java::java.lang.Long, Java::boolean, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
903
+ def search_payments(searchKey, offset, limit, withPluginInfo, withAttempts, properties, context)
892
904
 
893
905
  # conversion for searchKey [type = java.lang.String]
894
906
  searchKey = searchKey.to_s unless searchKey.nil?
@@ -902,6 +914,9 @@ module Killbill
902
914
  # conversion for withPluginInfo [type = boolean]
903
915
  withPluginInfo = withPluginInfo.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withPluginInfo)
904
916
 
917
+ # conversion for withAttempts [type = boolean]
918
+ withAttempts = withAttempts.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withAttempts)
919
+
905
920
  # conversion for properties [type = java.lang.Iterable]
906
921
  tmp = java.util.ArrayList.new
907
922
  (properties || []).each do |m|
@@ -913,7 +928,7 @@ module Killbill
913
928
 
914
929
  # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
915
930
  context = context.to_java unless context.nil?
916
- res = @real_java_api.search_payments(searchKey, offset, limit, withPluginInfo, properties, context)
931
+ res = @real_java_api.search_payments(searchKey, offset, limit, withPluginInfo, withAttempts, properties, context)
917
932
  # conversion for res [type = org.killbill.billing.util.entity.Pagination]
918
933
  res = Killbill::Plugin::Model::Pagination.new.to_ruby(res) unless res.nil?
919
934
  return res
@@ -1121,8 +1136,8 @@ module Killbill
1121
1136
  return res
1122
1137
  end
1123
1138
 
1124
- java_signature 'Java::void deletePaymentMethod(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
1125
- def delete_payment_method(account, paymentMethodId, deleteDefaultPaymentMethodWithAutoPayOff, properties, context)
1139
+ java_signature 'Java::void deletePaymentMethod(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::boolean, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
1140
+ def delete_payment_method(account, paymentMethodId, deleteDefaultPaymentMethodWithAutoPayOff, forceDefaultPaymentMethodDeletion, properties, context)
1126
1141
 
1127
1142
  # conversion for account [type = org.killbill.billing.account.api.Account]
1128
1143
  account = account.to_java unless account.nil?
@@ -1133,6 +1148,9 @@ module Killbill
1133
1148
  # conversion for deleteDefaultPaymentMethodWithAutoPayOff [type = boolean]
1134
1149
  deleteDefaultPaymentMethodWithAutoPayOff = deleteDefaultPaymentMethodWithAutoPayOff.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(deleteDefaultPaymentMethodWithAutoPayOff)
1135
1150
 
1151
+ # conversion for forceDefaultPaymentMethodDeletion [type = boolean]
1152
+ forceDefaultPaymentMethodDeletion = forceDefaultPaymentMethodDeletion.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(forceDefaultPaymentMethodDeletion)
1153
+
1136
1154
  # conversion for properties [type = java.lang.Iterable]
1137
1155
  tmp = java.util.ArrayList.new
1138
1156
  (properties || []).each do |m|
@@ -1144,7 +1162,7 @@ module Killbill
1144
1162
 
1145
1163
  # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
1146
1164
  context = context.to_java unless context.nil?
1147
- @real_java_api.delete_payment_method(account, paymentMethodId, deleteDefaultPaymentMethodWithAutoPayOff, properties, context)
1165
+ @real_java_api.delete_payment_method(account, paymentMethodId, deleteDefaultPaymentMethodWithAutoPayOff, forceDefaultPaymentMethodDeletion, properties, context)
1148
1166
  end
1149
1167
 
1150
1168
  java_signature 'Java::void setDefaultPaymentMethod(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
@@ -0,0 +1,189 @@
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.payment.api'
33
+ class PaymentAttempt
34
+
35
+ include org.killbill.billing.payment.api.PaymentAttempt
36
+
37
+ attr_accessor :id, :created_date, :updated_date, :account_id, :payment_method_id, :payment_external_key, :transaction_id, :transaction_external_key, :transaction_type, :effective_date, :state_name, :amount, :currency, :plugin_name, :plugin_properties
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 created_date [type = org.joda.time.DateTime]
47
+ if !@created_date.nil?
48
+ @created_date = (@created_date.kind_of? Time) ? DateTime.parse(@created_date.to_s) : @created_date
49
+ @created_date = Java::org.joda.time.DateTime.new(@created_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
50
+ end
51
+
52
+ # conversion for updated_date [type = org.joda.time.DateTime]
53
+ if !@updated_date.nil?
54
+ @updated_date = (@updated_date.kind_of? Time) ? DateTime.parse(@updated_date.to_s) : @updated_date
55
+ @updated_date = Java::org.joda.time.DateTime.new(@updated_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
56
+ end
57
+
58
+ # conversion for account_id [type = java.util.UUID]
59
+ @account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?
60
+
61
+ # conversion for payment_method_id [type = java.util.UUID]
62
+ @payment_method_id = java.util.UUID.fromString(@payment_method_id.to_s) unless @payment_method_id.nil?
63
+
64
+ # conversion for payment_external_key [type = java.lang.String]
65
+ @payment_external_key = @payment_external_key.to_s unless @payment_external_key.nil?
66
+
67
+ # conversion for transaction_id [type = java.util.UUID]
68
+ @transaction_id = java.util.UUID.fromString(@transaction_id.to_s) unless @transaction_id.nil?
69
+
70
+ # conversion for transaction_external_key [type = java.lang.String]
71
+ @transaction_external_key = @transaction_external_key.to_s unless @transaction_external_key.nil?
72
+
73
+ # conversion for transaction_type [type = org.killbill.billing.payment.api.TransactionType]
74
+ @transaction_type = Java::org.killbill.billing.payment.api.TransactionType.value_of( @transaction_type.to_s ) unless @transaction_type.nil?
75
+
76
+ # conversion for effective_date [type = org.joda.time.DateTime]
77
+ if !@effective_date.nil?
78
+ @effective_date = (@effective_date.kind_of? Time) ? DateTime.parse(@effective_date.to_s) : @effective_date
79
+ @effective_date = Java::org.joda.time.DateTime.new(@effective_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
80
+ end
81
+
82
+ # conversion for state_name [type = java.lang.String]
83
+ @state_name = @state_name.to_s unless @state_name.nil?
84
+
85
+ # conversion for amount [type = java.math.BigDecimal]
86
+ if @amount.nil?
87
+ @amount = java.math.BigDecimal::ZERO
88
+ else
89
+ @amount = java.math.BigDecimal.new(@amount.to_s)
90
+ end
91
+
92
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
93
+ @currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @currency.to_s ) unless @currency.nil?
94
+
95
+ # conversion for plugin_name [type = java.lang.String]
96
+ @plugin_name = @plugin_name.to_s unless @plugin_name.nil?
97
+
98
+ # conversion for plugin_properties [type = java.util.List]
99
+ tmp = java.util.ArrayList.new
100
+ (@plugin_properties || []).each do |m|
101
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
102
+ m = m.to_java unless m.nil?
103
+ tmp.add(m)
104
+ end
105
+ @plugin_properties = tmp
106
+ self
107
+ end
108
+
109
+ def to_ruby(j_obj)
110
+ # conversion for id [type = java.util.UUID]
111
+ @id = j_obj.id
112
+ @id = @id.nil? ? nil : @id.to_s
113
+
114
+ # conversion for created_date [type = org.joda.time.DateTime]
115
+ @created_date = j_obj.created_date
116
+ if !@created_date.nil?
117
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
118
+ str = fmt.print(@created_date)
119
+ @created_date = DateTime.iso8601(str)
120
+ end
121
+
122
+ # conversion for updated_date [type = org.joda.time.DateTime]
123
+ @updated_date = j_obj.updated_date
124
+ if !@updated_date.nil?
125
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
126
+ str = fmt.print(@updated_date)
127
+ @updated_date = DateTime.iso8601(str)
128
+ end
129
+
130
+ # conversion for account_id [type = java.util.UUID]
131
+ @account_id = j_obj.account_id
132
+ @account_id = @account_id.nil? ? nil : @account_id.to_s
133
+
134
+ # conversion for payment_method_id [type = java.util.UUID]
135
+ @payment_method_id = j_obj.payment_method_id
136
+ @payment_method_id = @payment_method_id.nil? ? nil : @payment_method_id.to_s
137
+
138
+ # conversion for payment_external_key [type = java.lang.String]
139
+ @payment_external_key = j_obj.payment_external_key
140
+
141
+ # conversion for transaction_id [type = java.util.UUID]
142
+ @transaction_id = j_obj.transaction_id
143
+ @transaction_id = @transaction_id.nil? ? nil : @transaction_id.to_s
144
+
145
+ # conversion for transaction_external_key [type = java.lang.String]
146
+ @transaction_external_key = j_obj.transaction_external_key
147
+
148
+ # conversion for transaction_type [type = org.killbill.billing.payment.api.TransactionType]
149
+ @transaction_type = j_obj.transaction_type
150
+ @transaction_type = @transaction_type.to_s.to_sym unless @transaction_type.nil?
151
+
152
+ # conversion for effective_date [type = org.joda.time.DateTime]
153
+ @effective_date = j_obj.effective_date
154
+ if !@effective_date.nil?
155
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
156
+ str = fmt.print(@effective_date)
157
+ @effective_date = DateTime.iso8601(str)
158
+ end
159
+
160
+ # conversion for state_name [type = java.lang.String]
161
+ @state_name = j_obj.state_name
162
+
163
+ # conversion for amount [type = java.math.BigDecimal]
164
+ @amount = j_obj.amount
165
+ @amount = @amount.nil? ? 0 : BigDecimal.new(@amount.to_s)
166
+
167
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
168
+ @currency = j_obj.currency
169
+ @currency = @currency.to_s.to_sym unless @currency.nil?
170
+
171
+ # conversion for plugin_name [type = java.lang.String]
172
+ @plugin_name = j_obj.plugin_name
173
+
174
+ # conversion for plugin_properties [type = java.util.List]
175
+ @plugin_properties = j_obj.plugin_properties
176
+ tmp = []
177
+ (@plugin_properties || []).each do |m|
178
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
179
+ m = Killbill::Plugin::Model::PluginProperty.new.to_ruby(m) unless m.nil?
180
+ tmp << m
181
+ end
182
+ @plugin_properties = tmp
183
+ self
184
+ end
185
+
186
+ end
187
+ end
188
+ end
189
+ end