killbill 1.0.15 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/Jarfile +4 -2
  2. data/VERSION +1 -1
  3. data/lib/killbill.rb +69 -13
  4. data/lib/killbill/creator.rb +16 -2
  5. data/lib/killbill/enum.rb +72 -0
  6. data/lib/killbill/gen/account.rb +43 -0
  7. data/lib/killbill/gen/account_data.rb +39 -0
  8. data/lib/killbill/gen/account_email.rb +25 -0
  9. data/lib/killbill/gen/audit_log.rb +28 -0
  10. data/lib/killbill/gen/blocking_state.rb +32 -0
  11. data/lib/killbill/gen/call_context.rb +29 -0
  12. data/lib/killbill/gen/call_origin.rb +34 -0
  13. data/lib/killbill/gen/currency.rb +34 -0
  14. data/lib/killbill/gen/custom_field.rb +27 -0
  15. data/lib/killbill/gen/date_time_zone.rb +35 -0
  16. data/lib/killbill/gen/ext_bus_event.rb +25 -0
  17. data/lib/killbill/gen/ext_bus_event_type.rb +34 -0
  18. data/lib/killbill/gen/invoice.rb +39 -0
  19. data/lib/killbill/gen/invoice_item.rb +37 -0
  20. data/lib/killbill/gen/invoice_payment.rb +31 -0
  21. data/lib/killbill/gen/invoice_payment_type.rb +34 -0
  22. data/lib/killbill/gen/object_type.rb +34 -0
  23. data/lib/killbill/gen/payment.rb +36 -0
  24. data/lib/killbill/gen/payment_attempt.rb +27 -0
  25. data/lib/killbill/gen/payment_info_plugin.rb +28 -0
  26. data/lib/killbill/gen/payment_method_info_plugin.rb +24 -0
  27. data/lib/killbill/gen/payment_method_kv_info.rb +21 -0
  28. data/lib/killbill/gen/payment_method_plugin.rb +36 -0
  29. data/lib/killbill/gen/payment_plugin_status.rb +34 -0
  30. data/lib/killbill/gen/refund.rb +29 -0
  31. data/lib/killbill/gen/refund_info_plugin.rb +27 -0
  32. data/lib/killbill/gen/refund_plugin_status.rb +34 -0
  33. data/lib/killbill/gen/require_gen.rb +38 -0
  34. data/lib/killbill/gen/subscription.rb +44 -0
  35. data/lib/killbill/gen/subscription_bundle.rb +27 -0
  36. data/lib/killbill/gen/subscription_source_type.rb +34 -0
  37. data/lib/killbill/gen/subscription_state.rb +34 -0
  38. data/lib/killbill/gen/tag.rb +26 -0
  39. data/lib/killbill/gen/tag_definition.rb +27 -0
  40. data/lib/killbill/gen/tenant_context.rb +21 -0
  41. data/lib/killbill/gen/user_type.rb +34 -0
  42. data/lib/killbill/gen/uuid.rb +22 -0
  43. data/lib/killbill/http_servlet.rb +10 -3
  44. data/lib/killbill/jconverter.rb +540 -0
  45. data/lib/killbill/jkillbill_api.rb +137 -0
  46. data/lib/killbill/jnotification.rb +0 -1
  47. data/lib/killbill/jpayment.rb +7 -19
  48. data/lib/killbill/jplugin.rb +27 -16
  49. data/lib/killbill/killbill_api.rb +28 -0
  50. data/lib/killbill/killbill_logger.rb +31 -8
  51. data/lib/killbill/notification.rb +0 -1
  52. data/lib/killbill/payment.rb +0 -5
  53. data/lib/killbill/plugin.rb +4 -46
  54. data/spec/killbill/base_plugin_spec.rb +2 -1
  55. data/spec/killbill/{jresponse/jconverter_spec.rb → jconverter_spec.rb} +46 -90
  56. data/spec/killbill/jnotification_spec.rb +2 -1
  57. data/spec/killbill/jpayment_spec.rb +17 -16
  58. data/spec/killbill/killbill_integration_spec.rb +1 -1
  59. data/spec/killbill/killbillapi_spec.rb +49 -0
  60. data/spec/killbill/payment_test.rb +5 -5
  61. data/spec/killbill/rack_handler_spec.rb +1 -2
  62. data/spec/spec_helper.rb +3 -0
  63. data/tools/java2ruby.rb +440 -0
  64. metadata +48 -26
  65. data/lib/killbill/jresponse/jconverter.rb +0 -126
  66. data/lib/killbill/jresponse/jevent.rb +0 -58
  67. data/lib/killbill/jresponse/jpayment_method_response.rb +0 -148
  68. data/lib/killbill/jresponse/jpayment_method_response_internal.rb +0 -54
  69. data/lib/killbill/jresponse/jpayment_response.rb +0 -74
  70. data/lib/killbill/jresponse/jrefund_response.rb +0 -68
  71. data/lib/killbill/response/event.rb +0 -18
  72. data/lib/killbill/response/payment_method_response.rb +0 -50
  73. data/lib/killbill/response/payment_method_response_internal.rb +0 -20
  74. data/lib/killbill/response/payment_response.rb +0 -26
  75. data/lib/killbill/response/payment_status.rb +0 -10
  76. data/lib/killbill/response/refund_response.rb +0 -25
  77. data/spec/killbill/jresponse/jevent_spec.rb +0 -18
  78. data/spec/killbill/jresponse/jpayment_method_response_internal_spec.rb +0 -34
  79. data/spec/killbill/jresponse/jpayment_method_response_spec.rb +0 -53
  80. data/spec/killbill/jresponse/jpayment_response_spec.rb +0 -41
  81. data/spec/killbill/jresponse/jrefund_response_spec.rb +0 -41
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: killbill
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.15
5
+ version: 1.0.16
6
6
  platform: ruby
7
7
  authors:
8
8
  - Killbill core team
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-09 00:00:00.000000000 Z
12
+ date: 2013-05-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jbundler
@@ -107,44 +107,70 @@ files:
107
107
  - killbill.gemspec
108
108
  - lib/killbill.rb
109
109
  - lib/killbill/creator.rb
110
+ - lib/killbill/enum.rb
111
+ - lib/killbill/gen/account.rb
112
+ - lib/killbill/gen/account_data.rb
113
+ - lib/killbill/gen/account_email.rb
114
+ - lib/killbill/gen/audit_log.rb
115
+ - lib/killbill/gen/blocking_state.rb
116
+ - lib/killbill/gen/call_context.rb
117
+ - lib/killbill/gen/call_origin.rb
118
+ - lib/killbill/gen/currency.rb
119
+ - lib/killbill/gen/custom_field.rb
120
+ - lib/killbill/gen/date_time_zone.rb
121
+ - lib/killbill/gen/ext_bus_event.rb
122
+ - lib/killbill/gen/ext_bus_event_type.rb
123
+ - lib/killbill/gen/invoice.rb
124
+ - lib/killbill/gen/invoice_item.rb
125
+ - lib/killbill/gen/invoice_payment.rb
126
+ - lib/killbill/gen/invoice_payment_type.rb
127
+ - lib/killbill/gen/object_type.rb
128
+ - lib/killbill/gen/payment.rb
129
+ - lib/killbill/gen/payment_attempt.rb
130
+ - lib/killbill/gen/payment_info_plugin.rb
131
+ - lib/killbill/gen/payment_method_info_plugin.rb
132
+ - lib/killbill/gen/payment_method_kv_info.rb
133
+ - lib/killbill/gen/payment_method_plugin.rb
134
+ - lib/killbill/gen/payment_plugin_status.rb
135
+ - lib/killbill/gen/refund.rb
136
+ - lib/killbill/gen/refund_info_plugin.rb
137
+ - lib/killbill/gen/refund_plugin_status.rb
138
+ - lib/killbill/gen/require_gen.rb
139
+ - lib/killbill/gen/subscription.rb
140
+ - lib/killbill/gen/subscription_bundle.rb
141
+ - lib/killbill/gen/subscription_source_type.rb
142
+ - lib/killbill/gen/subscription_state.rb
143
+ - lib/killbill/gen/tag.rb
144
+ - lib/killbill/gen/tag_definition.rb
145
+ - lib/killbill/gen/tenant_context.rb
146
+ - lib/killbill/gen/user_type.rb
147
+ - lib/killbill/gen/uuid.rb
110
148
  - lib/killbill/http_servlet.rb
149
+ - lib/killbill/jconverter.rb
150
+ - lib/killbill/jkillbill_api.rb
111
151
  - lib/killbill/jnotification.rb
112
152
  - lib/killbill/jpayment.rb
113
153
  - lib/killbill/jplugin.rb
114
- - lib/killbill/jresponse/jconverter.rb
115
- - lib/killbill/jresponse/jevent.rb
116
- - lib/killbill/jresponse/jpayment_method_response.rb
117
- - lib/killbill/jresponse/jpayment_method_response_internal.rb
118
- - lib/killbill/jresponse/jpayment_response.rb
119
- - lib/killbill/jresponse/jrefund_response.rb
154
+ - lib/killbill/killbill_api.rb
120
155
  - lib/killbill/killbill_logger.rb
121
156
  - lib/killbill/notification.rb
122
157
  - lib/killbill/payment.rb
123
158
  - lib/killbill/plugin.rb
124
159
  - lib/killbill/rake_task.rb
125
- - lib/killbill/response/event.rb
126
- - lib/killbill/response/payment_method_response.rb
127
- - lib/killbill/response/payment_method_response_internal.rb
128
- - lib/killbill/response/payment_response.rb
129
- - lib/killbill/response/payment_status.rb
130
- - lib/killbill/response/refund_response.rb
131
160
  - spec/killbill/base_plugin_spec.rb
132
161
  - spec/killbill/config_test.ru
162
+ - spec/killbill/jconverter_spec.rb
133
163
  - spec/killbill/jnotification_spec.rb
134
164
  - spec/killbill/jpayment_spec.rb
135
- - spec/killbill/jresponse/jconverter_spec.rb
136
- - spec/killbill/jresponse/jevent_spec.rb
137
- - spec/killbill/jresponse/jpayment_method_response_internal_spec.rb
138
- - spec/killbill/jresponse/jpayment_method_response_spec.rb
139
- - spec/killbill/jresponse/jpayment_response_spec.rb
140
- - spec/killbill/jresponse/jrefund_response_spec.rb
141
165
  - spec/killbill/killbill_integration_spec.rb
166
+ - spec/killbill/killbillapi_spec.rb
142
167
  - spec/killbill/notification_plugin_spec.rb
143
168
  - spec/killbill/notification_test.rb
144
169
  - spec/killbill/payment_plugin_spec.rb
145
170
  - spec/killbill/payment_test.rb
146
171
  - spec/killbill/rack_handler_spec.rb
147
172
  - spec/spec_helper.rb
173
+ - tools/java2ruby.rb
148
174
  homepage: http://www.killbilling.org
149
175
  licenses:
150
176
  - Apache License (2.0)
@@ -179,15 +205,11 @@ summary: Framework to write Killbill plugins in Ruby.
179
205
  test_files:
180
206
  - spec/killbill/base_plugin_spec.rb
181
207
  - spec/killbill/config_test.ru
208
+ - spec/killbill/jconverter_spec.rb
182
209
  - spec/killbill/jnotification_spec.rb
183
210
  - spec/killbill/jpayment_spec.rb
184
- - spec/killbill/jresponse/jconverter_spec.rb
185
- - spec/killbill/jresponse/jevent_spec.rb
186
- - spec/killbill/jresponse/jpayment_method_response_internal_spec.rb
187
- - spec/killbill/jresponse/jpayment_method_response_spec.rb
188
- - spec/killbill/jresponse/jpayment_response_spec.rb
189
- - spec/killbill/jresponse/jrefund_response_spec.rb
190
211
  - spec/killbill/killbill_integration_spec.rb
212
+ - spec/killbill/killbillapi_spec.rb
191
213
  - spec/killbill/notification_plugin_spec.rb
192
214
  - spec/killbill/notification_test.rb
193
215
  - spec/killbill/payment_plugin_spec.rb
@@ -1,126 +0,0 @@
1
-
2
- require 'date'
3
- require 'killbill/response/payment_status'
4
-
5
- module Killbill
6
- module Plugin
7
-
8
- class JConverter
9
-
10
- class << self
11
-
12
- #
13
- # Convert from ruby -> java
14
- #
15
- def to_uuid(uuid)
16
- uuid.nil? ? nil : java.util.UUID.fromString(uuid.to_s)
17
- end
18
-
19
- def to_joda_date_time(time)
20
- date_time = (time.kind_of? Time) ? DateTime.parse(time.to_s) : time
21
- date_time.nil? ? nil : org.joda.time.DateTime.new(date_time.to_s, org.joda.time.DateTimeZone::UTC)
22
- end
23
-
24
- def to_string(str)
25
- str.nil? ? nil : java.lang.String.new(str)
26
- end
27
-
28
- def to_payment_plugin_status(status)
29
- if status == PaymentStatus::SUCCESS
30
- Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus::PROCESSED
31
- elsif status == PaymentStatus::ERROR
32
- Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus::ERROR
33
- else
34
- Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus::UNDEFINED
35
- end
36
- end
37
-
38
- def to_refund_plugin_status(status)
39
- if status == PaymentStatus::SUCCESS
40
- Java::com.ning.billing.payment.plugin.api.RefundInfoPlugin::RefundPluginStatus::PROCESSED
41
- elsif status == PaymentStatus::ERROR
42
- Java::com.ning.billing.payment.plugin.api.RefundInfoPlugin::RefundPluginStatus::ERROR
43
- else
44
- Java::com.ning.billing.payment.plugin.api.RefundInfoPlugin::RefundPluginStatus::UNDEFINED
45
- end
46
- end
47
-
48
- def to_big_decimal(amount_in_cents)
49
- amount_in_cents.nil? ? java.math.BigDecimal::ZERO : java.math.BigDecimal.new('%.2f' % (amount_in_cents.to_i/100.0))
50
- end
51
-
52
- def to_boolean(b)
53
- java.lang.Boolean.new(b)
54
- end
55
-
56
-
57
- #
58
- # Convert from java -> ruby
59
- #
60
- def from_uuid(uuid)
61
- uuid.nil? ? nil : uuid.to_s
62
- end
63
-
64
- def from_joda_date_time(joda_time)
65
- if joda_time.nil?
66
- return nil
67
- end
68
-
69
- fmt = org.joda.time.format.ISODateTimeFormat.date_time
70
- str = fmt.print(joda_time);
71
- DateTime.iso8601(str)
72
- end
73
-
74
- def from_string(str)
75
- str.nil? ? nil : str.to_s
76
- end
77
-
78
- def from_payment_plugin_status(status)
79
- if status == Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus::PROCESSED
80
- PaymentStatus::SUCCESS
81
- elsif status == Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus::ERROR
82
- PaymentStatus::ERROR
83
- else
84
- PaymentStatus::UNDEFINED
85
- end
86
- end
87
-
88
- def from_refund_plugin_status(status)
89
- if status == Java::com.ning.billing.payment.plugin.api.RefundInfoPlugin::RefundPluginStatus::PROCESSED
90
- PaymentStatus::SUCCESS
91
- elsif status == Java::com.ning.billing.payment.plugin.api.RefundInfoPlugin::RefundPluginStatus::ERROR
92
- PaymentStatus::ERROR
93
- else
94
- PaymentStatus::UNDEFINED
95
- end
96
- end
97
-
98
- def from_big_decimal(big_decimal)
99
- big_decimal.nil? ? 0 : big_decimal.multiply(java.math.BigDecimal.valueOf(100)).to_s.to_i
100
- end
101
-
102
- def from_boolean(b)
103
- if b.nil?
104
- return false
105
- end
106
-
107
- b_value = (b.java_kind_of? java.lang.Boolean) ? b.boolean_value : b
108
- return b_value ? true : false
109
- end
110
-
111
- def from_payment_method_plugin(payment_method_plugin)
112
- JPaymentMethodResponse.to_payment_method_response(payment_method_plugin)
113
- end
114
-
115
- def from_payment_method_info_plugin(payment_method_info_plugin)
116
- JPaymentMethodResponseInternal.to_payment_method_response_internal(payment_method_info_plugin)
117
- end
118
-
119
- def from_ext_bus_event(ext_bus)
120
- JEvent.to_event(ext_bus)
121
- end
122
-
123
- end
124
- end
125
- end
126
- end
@@ -1,58 +0,0 @@
1
- require 'killbill/jresponse/jconverter'
2
-
3
- module Killbill
4
- module Plugin
5
-
6
- java_package 'com.ning.billing.beatrix.bus.api'
7
- class JEvent
8
-
9
- include Java::com.ning.billing.beatrix.bus.api.ExtBusEvent
10
-
11
- attr_reader :event_type, :object_type, :object_id, :account_id, :tenant_id
12
-
13
- def initialize(event_type, object_type, object_id, account_id, tenant_id)
14
- @event_type = event_type
15
- @object_type = object_type
16
- @object_id = object_id
17
- @account_id = account_id
18
- @tenant_id = tenant_id
19
- end
20
-
21
- java_signature 'Java::com.ning.billing.beatrix.bus.api.ExtBusEventType getEventType()'
22
- def get_event_type
23
- @event_type
24
- end
25
-
26
- java_signature 'Java::com.ning.billing.ObjectType getObjectType()'
27
- def get_object_type
28
- @object_type
29
- end
30
-
31
- java_signature 'java.lang.UUID getObjectId()'
32
- def get_object_id
33
- @object_id
34
- end
35
-
36
- java_signature 'java.lang.UUID getAccountId()'
37
- def get_account_id
38
- @account_id
39
- end
40
-
41
- java_signature 'java.lang.UUID getTenantId()'
42
- def get_tenant_id
43
- @tenant_id
44
- end
45
-
46
- class << self
47
- def to_event(jevent)
48
- event_type = jevent.get_event_type.to_s
49
- object_type = jevent.get_object_type.to_s
50
- object_id = JConverter.from_uuid(jevent.get_object_id)
51
- account_id = JConverter.from_uuid(jevent.get_account_id)
52
- tenant_id = JConverter.from_uuid(jevent.get_tenant_id)
53
- Event.new(event_type, object_type, object_id, account_id, tenant_id)
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,148 +0,0 @@
1
- require 'killbill/response/payment_method_response'
2
- require 'killbill/jresponse/jconverter'
3
-
4
- module Killbill
5
- module Plugin
6
-
7
- class JPaymentMethodProperty < Java::com.ning.billing.payment.api.PaymentMethodPlugin::PaymentMethodKVInfo
8
-
9
- class << self
10
- def create_from(payment_method_prop)
11
-
12
- key = JConverter.to_string(payment_method_prop.key)
13
- value = JConverter.to_string(payment_method_prop.value)
14
- is_updatable = JConverter.to_boolean(payment_method_prop.is_updatable)
15
- Java::com.ning.billing.payment.api.PaymentMethodPlugin::PaymentMethodKVInfo.new(key, value, is_updatable)
16
- end
17
-
18
- def to_payment_method_property(jpayment_method_prop)
19
- key = JConverter.from_string(jpayment_method_prop.get_key)
20
- value = JConverter.from_string(jpayment_method_prop.get_value)
21
- is_updatable = JConverter.from_boolean(jpayment_method_prop.get_is_updatable)
22
- PaymentMethodProperty.new(key, value, is_updatable)
23
- end
24
-
25
- end
26
-
27
- end
28
-
29
- java_package 'com.ning.billing.payment.api'
30
- class JPaymentMethodResponse
31
-
32
- include Java::com.ning.billing.payment.api.PaymentMethodPlugin
33
-
34
- attr_reader :external_payment_method_id,
35
- :is_default,
36
- :properties
37
-
38
- class << self
39
- def to_payment_method_response(jpayment_method_response)
40
- props = Array.new
41
- jpayment_method_response.get_properties.each do |p|
42
- props << JPaymentMethodProperty.to_payment_method_property(p)
43
- end
44
- pmid = JConverter.from_string(jpayment_method_response.get_external_payment_method_id)
45
- default = JConverter.from_boolean(jpayment_method_response.is_default_payment_method)
46
- PaymentMethodResponse.new(pmid, default, props)
47
- end
48
-
49
- end
50
-
51
- def initialize(payment_method_response)
52
- @external_payment_method_id = JConverter.to_string(payment_method_response.external_payment_method_id)
53
- @is_default = JConverter.to_boolean(payment_method_response.is_default)
54
- @properties = java.util.ArrayList.new
55
- payment_method_response.properties.each do |p|
56
- jp = JPaymentMethodProperty.create_from(p)
57
- @properties.add(jp)
58
- end
59
- end
60
-
61
- java_signature 'java.lang.String getExternalPaymentMethodId()'
62
- def get_external_payment_method_id
63
- @external_payment_method_id
64
- end
65
-
66
- java_signature 'java.lang.Boolean isDefaultPaymentMethod()'
67
- def is_default_payment_method
68
- @is_default
69
- end
70
-
71
- java_signature 'java.util.List getProperties()'
72
- def get_properties
73
- @properties
74
- end
75
-
76
- java_signature 'java.lang.String getValueString(java.lang.String)'
77
- def get_value_string(key)
78
- @properties.each do |p|
79
- if p.key == key
80
- return p
81
- end
82
- end
83
- nil
84
- end
85
-
86
- java_signature 'java.lang.String getType()'
87
- def get_type
88
- get_value_string(PaymentMethodResponse::PROP_TYPE)
89
- end
90
-
91
- java_signature 'java.lang.String getCCName()'
92
- def get_cc_name
93
- get_value_string(PaymentMethodResponse::PROP_CC_NAME)
94
- end
95
-
96
- java_signature 'java.lang.String getCCType()'
97
- def get_cc_type
98
- get_value_string(PaymentMethodResponse::PROP_CC_TYPE)
99
- end
100
-
101
- java_signature 'java.lang.String getCCExpirationMonth()'
102
- def get_cc_expiration_month
103
- get_value_string(PaymentMethodResponse::PROP_CC_EXP_MONTH)
104
- end
105
-
106
- java_signature 'java.lang.String getCCExpirationYear()'
107
- def get_cc_expiration_year
108
- get_value_string(PaymentMethodResponse::PROP_CC_EXP_YEAR)
109
- end
110
-
111
- java_signature 'java.lang.String getCCLast4()'
112
- def get_cc_last4
113
- get_value_string(PaymentMethodResponse::PROP_CC_LAST_4)
114
- end
115
-
116
- java_signature 'java.lang.String getAddress1()'
117
- def get_address1
118
- get_value_string(PaymentMethodResponse::PROP_ADDRESS1)
119
- end
120
-
121
- java_signature 'java.lang.String getAddress2()'
122
- def get_address2
123
- get_value_string(PaymentMethodResponse::PROP_ADDRESS2)
124
- end
125
-
126
- java_signature 'java.lang.String getCity()'
127
- def get_city
128
- get_value_string(PaymentMethodResponse::PROP_CITY)
129
- end
130
-
131
- java_signature 'java.lang.String getState()'
132
- def get_state
133
- get_value_string(PaymentMethodResponse::PROP_STATE)
134
- end
135
-
136
- java_signature 'java.lang.String getZip()'
137
- def get_zip
138
- get_value_string(PaymentMethodResponse::PROP_ZIP)
139
- end
140
-
141
- java_signature 'java.lang.String getCountry()'
142
- def get_country
143
- get_value_string(PaymentMethodResponse::PROP_COUNTRY)
144
- end
145
-
146
- end
147
- end
148
- end