killbill 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Jarfile +5 -5
  4. data/NEWS +4 -0
  5. data/README.md +45 -8
  6. data/VERSION +1 -1
  7. data/generators/active_merchant/active_merchant_generator.rb +38 -0
  8. data/generators/active_merchant/templates/.gitignore.rb +36 -0
  9. data/generators/active_merchant/templates/.travis.yml.rb +19 -0
  10. data/generators/active_merchant/templates/Gemfile.rb +3 -0
  11. data/generators/active_merchant/templates/Jarfile.rb +6 -0
  12. data/generators/active_merchant/templates/LICENSE.rb +201 -0
  13. data/generators/active_merchant/templates/NEWS.rb +2 -0
  14. data/generators/active_merchant/templates/Rakefile.rb +30 -0
  15. data/generators/active_merchant/templates/VERSION.rb +1 -0
  16. data/generators/active_merchant/templates/config.ru.rb +4 -0
  17. data/generators/active_merchant/templates/config.yml.rb +13 -0
  18. data/generators/active_merchant/templates/db/ddl.sql.rb +64 -0
  19. data/generators/active_merchant/templates/db/schema.rb +64 -0
  20. data/generators/active_merchant/templates/killbill.properties.rb +3 -0
  21. data/generators/active_merchant/templates/lib/api.rb +119 -0
  22. data/generators/active_merchant/templates/lib/application.rb +84 -0
  23. data/generators/active_merchant/templates/lib/models/payment_method.rb +22 -0
  24. data/generators/active_merchant/templates/lib/models/response.rb +22 -0
  25. data/generators/active_merchant/templates/lib/models/transaction.rb +11 -0
  26. data/generators/active_merchant/templates/lib/plugin.rb +23 -0
  27. data/generators/active_merchant/templates/lib/private_api.rb +6 -0
  28. data/generators/active_merchant/templates/lib/views/form.erb +8 -0
  29. data/generators/active_merchant/templates/plugin.gemspec.rb +48 -0
  30. data/generators/active_merchant/templates/pom.xml.rb +44 -0
  31. data/generators/active_merchant/templates/release.sh.rb +41 -0
  32. data/generators/active_merchant/templates/spec/base_plugin_spec.rb +30 -0
  33. data/generators/active_merchant/templates/spec/integration_spec.rb +31 -0
  34. data/generators/active_merchant/templates/spec/spec_helper.rb +24 -0
  35. data/generators/killbill_generator.rb +38 -0
  36. data/killbill.gemspec +10 -2
  37. data/lib/killbill/gen/api/block.rb +82 -0
  38. data/lib/killbill/gen/api/direct_payment.rb +176 -0
  39. data/lib/killbill/gen/api/direct_payment_api.rb +329 -0
  40. data/lib/killbill/gen/api/direct_payment_transaction.rb +156 -0
  41. data/lib/killbill/gen/api/fixed.rb +63 -0
  42. data/lib/killbill/gen/api/invoice_item.rb +7 -1
  43. data/lib/killbill/gen/api/invoice_item_formatter.rb +7 -1
  44. data/lib/killbill/gen/api/invoice_user_api.rb +18 -136
  45. data/lib/killbill/gen/api/migration_plan.rb +6 -6
  46. data/lib/killbill/gen/api/payment_api.rb +216 -54
  47. data/lib/killbill/gen/api/payment_method_plugin.rb +3 -3
  48. data/lib/killbill/gen/api/plan.rb +6 -6
  49. data/lib/killbill/gen/api/plan_phase.rb +16 -23
  50. data/lib/killbill/gen/api/plugin_property.rb +71 -0
  51. data/lib/killbill/gen/api/recurring.rb +63 -0
  52. data/lib/killbill/gen/api/require_gen.rb +10 -1
  53. data/lib/killbill/gen/api/static_catalog.rb +8 -1
  54. data/lib/killbill/gen/api/tier.rb +77 -0
  55. data/lib/killbill/gen/api/tiered_block.rb +88 -0
  56. data/lib/killbill/gen/api/usage.rb +111 -0
  57. data/lib/killbill/gen/api/usage_user_api.rb +59 -3
  58. data/lib/killbill/gen/plugin-api/billing_address.rb +85 -0
  59. data/lib/killbill/gen/plugin-api/customer.rb +73 -0
  60. data/lib/killbill/gen/plugin-api/hosted_payment_page_descriptor_fields.rb +145 -0
  61. data/lib/killbill/gen/plugin-api/hosted_payment_page_form_descriptor.rb +80 -0
  62. data/lib/killbill/gen/plugin-api/hosted_payment_page_notification.rb +129 -0
  63. data/lib/killbill/gen/plugin-api/payment_info_plugin.rb +20 -1
  64. data/lib/killbill/gen/plugin-api/payment_plugin_api.rb +358 -39
  65. data/lib/killbill/gen/plugin-api/refund_info_plugin.rb +20 -1
  66. data/lib/killbill/gen/plugin-api/require_gen.rb +3 -0
  67. data/lib/killbill/helpers/active_merchant.rb +21 -0
  68. data/lib/killbill/helpers/active_merchant/active_record.rb +17 -0
  69. data/lib/killbill/helpers/active_merchant/active_record/models/helpers.rb +25 -0
  70. data/lib/killbill/helpers/active_merchant/active_record/models/payment_method.rb +195 -0
  71. data/lib/killbill/helpers/active_merchant/active_record/models/response.rb +178 -0
  72. data/lib/killbill/helpers/active_merchant/active_record/models/streamy_result_set.rb +35 -0
  73. data/lib/killbill/helpers/active_merchant/active_record/models/transaction.rb +63 -0
  74. data/lib/killbill/helpers/active_merchant/configuration.rb +54 -0
  75. data/lib/killbill/helpers/active_merchant/core_ext.rb +41 -0
  76. data/lib/killbill/helpers/active_merchant/gateway.rb +35 -0
  77. data/lib/killbill/helpers/active_merchant/killbill_spec_helper.rb +117 -0
  78. data/lib/killbill/helpers/active_merchant/payment_plugin.rb +365 -0
  79. data/lib/killbill/helpers/active_merchant/private_payment_plugin.rb +119 -0
  80. data/lib/killbill/helpers/active_merchant/properties.rb +20 -0
  81. data/lib/killbill/helpers/active_merchant/sinatra.rb +30 -0
  82. data/lib/killbill/helpers/active_merchant/utils.rb +23 -0
  83. data/lib/killbill/payment.rb +22 -10
  84. data/script/generate +15 -0
  85. data/spec/killbill/helpers/payment_method_spec.rb +101 -0
  86. data/spec/killbill/helpers/response_spec.rb +74 -0
  87. data/spec/killbill/helpers/test_schema.rb +57 -0
  88. data/spec/killbill/helpers/utils_spec.rb +22 -0
  89. data/spec/killbill/payment_plugin_api_spec.rb +23 -18
  90. data/spec/killbill/payment_plugin_spec.rb +11 -10
  91. data/spec/killbill/payment_test.rb +9 -9
  92. data/spec/spec_helper.rb +8 -3
  93. metadata +130 -5
@@ -0,0 +1,329 @@
1
+ ###################################################################################
2
+ # #
3
+ # Copyright 2010-2013 Ning, Inc. #
4
+ # #
5
+ # Ning licenses this file to you under the Apache License, version 2.0 #
6
+ # (the "License"); you may not use this file except in compliance with the #
7
+ # License. You may obtain a copy of the License at: #
8
+ # #
9
+ # http://www.apache.org/licenses/LICENSE-2.0 #
10
+ # #
11
+ # Unless required by applicable law or agreed to in writing, software #
12
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
13
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
14
+ # License for the specific language governing permissions and limitations #
15
+ # under the License. #
16
+ # #
17
+ ###################################################################################
18
+
19
+
20
+ #
21
+ # DO NOT EDIT!!!
22
+ # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
23
+ #
24
+
25
+
26
+ module Killbill
27
+ module Plugin
28
+ module Api
29
+
30
+ java_package 'org.killbill.billing.payment.api'
31
+ class DirectPaymentApi
32
+
33
+ include org.killbill.billing.payment.api.DirectPaymentApi
34
+
35
+ def initialize(real_java_api)
36
+ @real_java_api = real_java_api
37
+ end
38
+
39
+
40
+ java_signature 'Java::org.killbill.billing.payment.api.DirectPayment createAuthorization(Java::org.killbill.billing.account.api.Account, Java::java.math.BigDecimal, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
41
+ def create_authorization(account, amount, externalKey, properties, context)
42
+
43
+ # conversion for account [type = org.killbill.billing.account.api.Account]
44
+ account = account.to_java unless account.nil?
45
+
46
+ # conversion for amount [type = java.math.BigDecimal]
47
+ if amount.nil?
48
+ amount = java.math.BigDecimal::ZERO
49
+ else
50
+ amount = java.math.BigDecimal.new(amount.to_s)
51
+ end
52
+
53
+ # conversion for externalKey [type = java.lang.String]
54
+ externalKey = externalKey.to_s unless externalKey.nil?
55
+
56
+ # conversion for properties [type = java.lang.Iterable]
57
+ tmp = java.util.ArrayList.new
58
+ (properties || []).each do |m|
59
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
60
+ m = m.to_java unless m.nil?
61
+ tmp.add(m)
62
+ end
63
+ properties = tmp
64
+
65
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
66
+ context = context.to_java unless context.nil?
67
+ begin
68
+ res = @real_java_api.create_authorization(account, amount, externalKey, properties, context)
69
+ # conversion for res [type = org.killbill.billing.payment.api.DirectPayment]
70
+ res = Killbill::Plugin::Model::DirectPayment.new.to_ruby(res) unless res.nil?
71
+ return res
72
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
73
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
74
+ end
75
+ end
76
+
77
+ java_signature 'Java::org.killbill.billing.payment.api.DirectPayment createCapture(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.math.BigDecimal, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
78
+ def create_capture(account, directPaymentId, amount, properties, context)
79
+
80
+ # conversion for account [type = org.killbill.billing.account.api.Account]
81
+ account = account.to_java unless account.nil?
82
+
83
+ # conversion for directPaymentId [type = java.util.UUID]
84
+ directPaymentId = java.util.UUID.fromString(directPaymentId.to_s) unless directPaymentId.nil?
85
+
86
+ # conversion for amount [type = java.math.BigDecimal]
87
+ if amount.nil?
88
+ amount = java.math.BigDecimal::ZERO
89
+ else
90
+ amount = java.math.BigDecimal.new(amount.to_s)
91
+ end
92
+
93
+ # conversion for properties [type = java.lang.Iterable]
94
+ tmp = java.util.ArrayList.new
95
+ (properties || []).each do |m|
96
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
97
+ m = m.to_java unless m.nil?
98
+ tmp.add(m)
99
+ end
100
+ properties = tmp
101
+
102
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
103
+ context = context.to_java unless context.nil?
104
+ begin
105
+ res = @real_java_api.create_capture(account, directPaymentId, amount, properties, context)
106
+ # conversion for res [type = org.killbill.billing.payment.api.DirectPayment]
107
+ res = Killbill::Plugin::Model::DirectPayment.new.to_ruby(res) unless res.nil?
108
+ return res
109
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
110
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
111
+ end
112
+ end
113
+
114
+ java_signature 'Java::org.killbill.billing.payment.api.DirectPayment createPurchase(Java::org.killbill.billing.account.api.Account, Java::java.math.BigDecimal, Java::java.lang.String, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
115
+ def create_purchase(account, amount, externalKey, properties, context)
116
+
117
+ # conversion for account [type = org.killbill.billing.account.api.Account]
118
+ account = account.to_java unless account.nil?
119
+
120
+ # conversion for amount [type = java.math.BigDecimal]
121
+ if amount.nil?
122
+ amount = java.math.BigDecimal::ZERO
123
+ else
124
+ amount = java.math.BigDecimal.new(amount.to_s)
125
+ end
126
+
127
+ # conversion for externalKey [type = java.lang.String]
128
+ externalKey = externalKey.to_s unless externalKey.nil?
129
+
130
+ # conversion for properties [type = java.lang.Iterable]
131
+ tmp = java.util.ArrayList.new
132
+ (properties || []).each do |m|
133
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
134
+ m = m.to_java unless m.nil?
135
+ tmp.add(m)
136
+ end
137
+ properties = tmp
138
+
139
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
140
+ context = context.to_java unless context.nil?
141
+ begin
142
+ res = @real_java_api.create_purchase(account, amount, externalKey, properties, context)
143
+ # conversion for res [type = org.killbill.billing.payment.api.DirectPayment]
144
+ res = Killbill::Plugin::Model::DirectPayment.new.to_ruby(res) unless res.nil?
145
+ return res
146
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
147
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
148
+ end
149
+ end
150
+
151
+ java_signature 'Java::org.killbill.billing.payment.api.DirectPayment createVoid(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
152
+ def create_void(account, directPaymentId, properties, context)
153
+
154
+ # conversion for account [type = org.killbill.billing.account.api.Account]
155
+ account = account.to_java unless account.nil?
156
+
157
+ # conversion for directPaymentId [type = java.util.UUID]
158
+ directPaymentId = java.util.UUID.fromString(directPaymentId.to_s) unless directPaymentId.nil?
159
+
160
+ # conversion for properties [type = java.lang.Iterable]
161
+ tmp = java.util.ArrayList.new
162
+ (properties || []).each do |m|
163
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
164
+ m = m.to_java unless m.nil?
165
+ tmp.add(m)
166
+ end
167
+ properties = tmp
168
+
169
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
170
+ context = context.to_java unless context.nil?
171
+ begin
172
+ res = @real_java_api.create_void(account, directPaymentId, properties, context)
173
+ # conversion for res [type = org.killbill.billing.payment.api.DirectPayment]
174
+ res = Killbill::Plugin::Model::DirectPayment.new.to_ruby(res) unless res.nil?
175
+ return res
176
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
177
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
178
+ end
179
+ end
180
+
181
+ java_signature 'Java::org.killbill.billing.payment.api.DirectPayment createCredit(Java::org.killbill.billing.account.api.Account, Java::java.util.UUID, Java::java.math.BigDecimal, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.CallContext)'
182
+ def create_credit(account, directPaymentId, amount, properties, context)
183
+
184
+ # conversion for account [type = org.killbill.billing.account.api.Account]
185
+ account = account.to_java unless account.nil?
186
+
187
+ # conversion for directPaymentId [type = java.util.UUID]
188
+ directPaymentId = java.util.UUID.fromString(directPaymentId.to_s) unless directPaymentId.nil?
189
+
190
+ # conversion for amount [type = java.math.BigDecimal]
191
+ if amount.nil?
192
+ amount = java.math.BigDecimal::ZERO
193
+ else
194
+ amount = java.math.BigDecimal.new(amount.to_s)
195
+ end
196
+
197
+ # conversion for properties [type = java.lang.Iterable]
198
+ tmp = java.util.ArrayList.new
199
+ (properties || []).each do |m|
200
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
201
+ m = m.to_java unless m.nil?
202
+ tmp.add(m)
203
+ end
204
+ properties = tmp
205
+
206
+ # conversion for context [type = org.killbill.billing.util.callcontext.CallContext]
207
+ context = context.to_java unless context.nil?
208
+ begin
209
+ res = @real_java_api.create_credit(account, directPaymentId, amount, properties, context)
210
+ # conversion for res [type = org.killbill.billing.payment.api.DirectPayment]
211
+ res = Killbill::Plugin::Model::DirectPayment.new.to_ruby(res) unless res.nil?
212
+ return res
213
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
214
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
215
+ end
216
+ end
217
+
218
+ java_signature 'Java::java.util.List getAccountPayments(Java::java.util.UUID, Java::org.killbill.billing.util.callcontext.TenantContext)'
219
+ def get_account_payments(accountId, context)
220
+
221
+ # conversion for accountId [type = java.util.UUID]
222
+ accountId = java.util.UUID.fromString(accountId.to_s) unless accountId.nil?
223
+
224
+ # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
225
+ context = context.to_java unless context.nil?
226
+ begin
227
+ res = @real_java_api.get_account_payments(accountId, context)
228
+ # conversion for res [type = java.util.List]
229
+ tmp = []
230
+ (res || []).each do |m|
231
+ # conversion for m [type = org.killbill.billing.payment.api.DirectPayment]
232
+ m = Killbill::Plugin::Model::DirectPayment.new.to_ruby(m) unless m.nil?
233
+ tmp << m
234
+ end
235
+ res = tmp
236
+ return res
237
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
238
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
239
+ end
240
+ end
241
+
242
+ java_signature 'Java::org.killbill.billing.payment.api.DirectPayment getPayment(Java::java.util.UUID, Java::boolean, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
243
+ def get_payment(directPaymentId, withPluginInfo, properties, context)
244
+
245
+ # conversion for directPaymentId [type = java.util.UUID]
246
+ directPaymentId = java.util.UUID.fromString(directPaymentId.to_s) unless directPaymentId.nil?
247
+
248
+ # conversion for withPluginInfo [type = boolean]
249
+ withPluginInfo = withPluginInfo.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(withPluginInfo)
250
+
251
+ # conversion for properties [type = java.lang.Iterable]
252
+ tmp = java.util.ArrayList.new
253
+ (properties || []).each do |m|
254
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
255
+ m = m.to_java unless m.nil?
256
+ tmp.add(m)
257
+ end
258
+ properties = tmp
259
+
260
+ # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
261
+ context = context.to_java unless context.nil?
262
+ begin
263
+ res = @real_java_api.get_payment(directPaymentId, withPluginInfo, properties, context)
264
+ # conversion for res [type = org.killbill.billing.payment.api.DirectPayment]
265
+ res = Killbill::Plugin::Model::DirectPayment.new.to_ruby(res) unless res.nil?
266
+ return res
267
+ rescue Java::org.killbill.billing.payment.api.PaymentApiException => e
268
+ raise Killbill::Plugin::Model::PaymentApiException.new.to_ruby(e)
269
+ end
270
+ end
271
+
272
+ java_signature 'Java::org.killbill.billing.util.entity.Pagination getPayments(Java::java.lang.Long, Java::java.lang.Long, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
273
+ def get_payments(offset, limit, properties, context)
274
+
275
+ # conversion for offset [type = java.lang.Long]
276
+ offset = offset
277
+
278
+ # conversion for limit [type = java.lang.Long]
279
+ limit = limit
280
+
281
+ # conversion for properties [type = java.lang.Iterable]
282
+ tmp = java.util.ArrayList.new
283
+ (properties || []).each do |m|
284
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
285
+ m = m.to_java unless m.nil?
286
+ tmp.add(m)
287
+ end
288
+ properties = tmp
289
+
290
+ # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
291
+ context = context.to_java unless context.nil?
292
+ res = @real_java_api.get_payments(offset, limit, properties, context)
293
+ # conversion for res [type = org.killbill.billing.util.entity.Pagination]
294
+ res = Killbill::Plugin::Model::Pagination.new.to_ruby(res) unless res.nil?
295
+ return res
296
+ end
297
+
298
+ java_signature 'Java::org.killbill.billing.util.entity.Pagination searchPayments(Java::java.lang.String, Java::java.lang.Long, Java::java.lang.Long, Java::java.lang.Iterable, Java::org.killbill.billing.util.callcontext.TenantContext)'
299
+ def search_payments(searchKey, offset, limit, properties, context)
300
+
301
+ # conversion for searchKey [type = java.lang.String]
302
+ searchKey = searchKey.to_s unless searchKey.nil?
303
+
304
+ # conversion for offset [type = java.lang.Long]
305
+ offset = offset
306
+
307
+ # conversion for limit [type = java.lang.Long]
308
+ limit = limit
309
+
310
+ # conversion for properties [type = java.lang.Iterable]
311
+ tmp = java.util.ArrayList.new
312
+ (properties || []).each do |m|
313
+ # conversion for m [type = org.killbill.billing.payment.api.PluginProperty]
314
+ m = m.to_java unless m.nil?
315
+ tmp.add(m)
316
+ end
317
+ properties = tmp
318
+
319
+ # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
320
+ context = context.to_java unless context.nil?
321
+ res = @real_java_api.search_payments(searchKey, offset, limit, properties, context)
322
+ # conversion for res [type = org.killbill.billing.util.entity.Pagination]
323
+ res = Killbill::Plugin::Model::Pagination.new.to_ruby(res) unless res.nil?
324
+ return res
325
+ end
326
+ end
327
+ end
328
+ end
329
+ end
@@ -0,0 +1,156 @@
1
+ ###################################################################################
2
+ # #
3
+ # Copyright 2010-2013 Ning, Inc. #
4
+ # #
5
+ # Ning licenses this file to you under the Apache License, version 2.0 #
6
+ # (the "License"); you may not use this file except in compliance with the #
7
+ # License. You may obtain a copy of the License at: #
8
+ # #
9
+ # http://www.apache.org/licenses/LICENSE-2.0 #
10
+ # #
11
+ # Unless required by applicable law or agreed to in writing, software #
12
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
13
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
14
+ # License for the specific language governing permissions and limitations #
15
+ # under the License. #
16
+ # #
17
+ ###################################################################################
18
+
19
+
20
+ #
21
+ # DO NOT EDIT!!!
22
+ # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
23
+ #
24
+
25
+
26
+ module Killbill
27
+ module Plugin
28
+ module Model
29
+
30
+ java_package 'org.killbill.billing.payment.api'
31
+ class DirectPaymentTransaction
32
+
33
+ include org.killbill.billing.payment.api.DirectPaymentTransaction
34
+
35
+ attr_accessor :id, :created_date, :updated_date, :direct_payment_id, :transaction_type, :effective_date, :amount, :currency, :gateway_error_code, :gateway_error_msg, :payment_status, :payment_info_plugin
36
+
37
+ def initialize()
38
+ end
39
+
40
+ def to_java()
41
+ # conversion for id [type = java.util.UUID]
42
+ @id = java.util.UUID.fromString(@id.to_s) unless @id.nil?
43
+
44
+ # conversion for created_date [type = org.joda.time.DateTime]
45
+ if !@created_date.nil?
46
+ @created_date = (@created_date.kind_of? Time) ? DateTime.parse(@created_date.to_s) : @created_date
47
+ @created_date = Java::org.joda.time.DateTime.new(@created_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
48
+ end
49
+
50
+ # conversion for updated_date [type = org.joda.time.DateTime]
51
+ if !@updated_date.nil?
52
+ @updated_date = (@updated_date.kind_of? Time) ? DateTime.parse(@updated_date.to_s) : @updated_date
53
+ @updated_date = Java::org.joda.time.DateTime.new(@updated_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
54
+ end
55
+
56
+ # conversion for direct_payment_id [type = java.util.UUID]
57
+ @direct_payment_id = java.util.UUID.fromString(@direct_payment_id.to_s) unless @direct_payment_id.nil?
58
+
59
+ # conversion for transaction_type [type = org.killbill.billing.payment.api.TransactionType]
60
+ @transaction_type = Java::org.killbill.billing.payment.api.TransactionType.value_of("#{@transaction_type.to_s}") unless @transaction_type.nil?
61
+
62
+ # conversion for effective_date [type = org.joda.time.DateTime]
63
+ if !@effective_date.nil?
64
+ @effective_date = (@effective_date.kind_of? Time) ? DateTime.parse(@effective_date.to_s) : @effective_date
65
+ @effective_date = Java::org.joda.time.DateTime.new(@effective_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
66
+ end
67
+
68
+ # conversion for amount [type = java.math.BigDecimal]
69
+ if @amount.nil?
70
+ @amount = java.math.BigDecimal::ZERO
71
+ else
72
+ @amount = java.math.BigDecimal.new(@amount.to_s)
73
+ end
74
+
75
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
76
+ @currency = Java::org.killbill.billing.catalog.api.Currency.value_of("#{@currency.to_s}") unless @currency.nil?
77
+
78
+ # conversion for gateway_error_code [type = java.lang.String]
79
+ @gateway_error_code = @gateway_error_code.to_s unless @gateway_error_code.nil?
80
+
81
+ # conversion for gateway_error_msg [type = java.lang.String]
82
+ @gateway_error_msg = @gateway_error_msg.to_s unless @gateway_error_msg.nil?
83
+
84
+ # conversion for payment_status [type = org.killbill.billing.payment.api.PaymentStatus]
85
+ @payment_status = Java::org.killbill.billing.payment.api.PaymentStatus.value_of("#{@payment_status.to_s}") unless @payment_status.nil?
86
+
87
+ # conversion for payment_info_plugin [type = org.killbill.billing.payment.plugin.api.PaymentInfoPlugin]
88
+ @payment_info_plugin = @payment_info_plugin.to_java unless @payment_info_plugin.nil?
89
+ self
90
+ end
91
+
92
+ def to_ruby(j_obj)
93
+ # conversion for id [type = java.util.UUID]
94
+ @id = j_obj.id
95
+ @id = @id.nil? ? nil : @id.to_s
96
+
97
+ # conversion for created_date [type = org.joda.time.DateTime]
98
+ @created_date = j_obj.created_date
99
+ if !@created_date.nil?
100
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
101
+ str = fmt.print(@created_date)
102
+ @created_date = DateTime.iso8601(str)
103
+ end
104
+
105
+ # conversion for updated_date [type = org.joda.time.DateTime]
106
+ @updated_date = j_obj.updated_date
107
+ if !@updated_date.nil?
108
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
109
+ str = fmt.print(@updated_date)
110
+ @updated_date = DateTime.iso8601(str)
111
+ end
112
+
113
+ # conversion for direct_payment_id [type = java.util.UUID]
114
+ @direct_payment_id = j_obj.direct_payment_id
115
+ @direct_payment_id = @direct_payment_id.nil? ? nil : @direct_payment_id.to_s
116
+
117
+ # conversion for transaction_type [type = org.killbill.billing.payment.api.TransactionType]
118
+ @transaction_type = j_obj.transaction_type
119
+ @transaction_type = @transaction_type.to_s.to_sym unless @transaction_type.nil?
120
+
121
+ # conversion for effective_date [type = org.joda.time.DateTime]
122
+ @effective_date = j_obj.effective_date
123
+ if !@effective_date.nil?
124
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
125
+ str = fmt.print(@effective_date)
126
+ @effective_date = DateTime.iso8601(str)
127
+ end
128
+
129
+ # conversion for amount [type = java.math.BigDecimal]
130
+ @amount = j_obj.amount
131
+ @amount = @amount.nil? ? 0 : BigDecimal.new(@amount.to_s)
132
+
133
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
134
+ @currency = j_obj.currency
135
+ @currency = @currency.to_s.to_sym unless @currency.nil?
136
+
137
+ # conversion for gateway_error_code [type = java.lang.String]
138
+ @gateway_error_code = j_obj.gateway_error_code
139
+
140
+ # conversion for gateway_error_msg [type = java.lang.String]
141
+ @gateway_error_msg = j_obj.gateway_error_msg
142
+
143
+ # conversion for payment_status [type = org.killbill.billing.payment.api.PaymentStatus]
144
+ @payment_status = j_obj.payment_status
145
+ @payment_status = @payment_status.to_s.to_sym unless @payment_status.nil?
146
+
147
+ # conversion for payment_info_plugin [type = org.killbill.billing.payment.plugin.api.PaymentInfoPlugin]
148
+ @payment_info_plugin = j_obj.payment_info_plugin
149
+ @payment_info_plugin = Killbill::Plugin::Model::PaymentInfoPlugin.new.to_ruby(@payment_info_plugin) unless @payment_info_plugin.nil?
150
+ self
151
+ end
152
+
153
+ end
154
+ end
155
+ end
156
+ end