killbill 1.0.19 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. data/Jarfile +4 -2
  2. data/VERSION +1 -1
  3. data/killbill.gemspec +4 -3
  4. data/lib/killbill.rb +7 -51
  5. data/lib/killbill/creator.rb +10 -18
  6. data/lib/killbill/gen/account.rb +208 -27
  7. data/lib/killbill/gen/account_api_exception.rb +66 -0
  8. data/lib/killbill/gen/account_data.rb +166 -23
  9. data/lib/killbill/gen/account_email.rb +80 -8
  10. data/lib/killbill/gen/account_service.rb +55 -0
  11. data/lib/killbill/gen/account_user_api.rb +187 -0
  12. data/lib/killbill/gen/audit_user_api.rb +196 -0
  13. data/lib/killbill/gen/beatrix_service.rb +55 -0
  14. data/lib/killbill/gen/billing_exception_base.rb +66 -0
  15. data/lib/killbill/gen/blockable.rb +91 -0
  16. data/lib/killbill/gen/blocking_api_exception.rb +66 -0
  17. data/lib/killbill/gen/blocking_state.rb +150 -16
  18. data/lib/killbill/gen/call_context.rb +107 -13
  19. data/lib/killbill/gen/catalog.rb +76 -0
  20. data/lib/killbill/gen/catalog_api_exception.rb +66 -0
  21. data/lib/killbill/gen/catalog_service.rb +69 -0
  22. data/lib/killbill/gen/catalog_user_api.rb +54 -0
  23. data/lib/killbill/gen/column_info.rb +67 -0
  24. data/lib/killbill/gen/control_tag.rb +112 -0
  25. data/lib/killbill/gen/currency_value_null.rb +66 -0
  26. data/lib/killbill/gen/custom_field.rb +93 -10
  27. data/lib/killbill/gen/custom_field_api_exception.rb +66 -0
  28. data/lib/killbill/gen/custom_field_user_api.rb +115 -0
  29. data/lib/killbill/gen/database_export_output_stream.rb +51 -0
  30. data/lib/killbill/gen/default_mutable_account_data.rb +180 -0
  31. data/lib/killbill/gen/duration.rb +62 -0
  32. data/lib/killbill/gen/entitlement_service.rb +55 -0
  33. data/lib/killbill/gen/entitlement_user_api.rb +272 -0
  34. data/lib/killbill/gen/entitlement_user_api_exception.rb +66 -0
  35. data/lib/killbill/gen/entity.rb +84 -0
  36. data/lib/killbill/gen/entity_persistence_exception.rb +66 -0
  37. data/lib/killbill/gen/export_user_api.rb +17 -0
  38. data/lib/killbill/gen/ext_bus_event.rb +68 -9
  39. data/lib/killbill/gen/external_bus.rb +51 -0
  40. data/lib/killbill/gen/illegal_plan_change.rb +66 -0
  41. data/lib/killbill/gen/international_price.rb +79 -0
  42. data/lib/killbill/gen/invalid_config_exception.rb +49 -0
  43. data/lib/killbill/gen/invoice.rb +238 -23
  44. data/lib/killbill/gen/invoice_api_exception.rb +66 -0
  45. data/lib/killbill/gen/invoice_creation_event.rb +51 -0
  46. data/lib/killbill/gen/invoice_item.rb +179 -21
  47. data/lib/killbill/gen/invoice_migration_api.rb +66 -0
  48. data/lib/killbill/gen/invoice_notifier.rb +51 -0
  49. data/lib/killbill/gen/invoice_payment.rb +135 -15
  50. data/lib/killbill/gen/invoice_payment_api.rb +208 -0
  51. data/lib/killbill/gen/invoice_service.rb +55 -0
  52. data/lib/killbill/gen/invoice_user_api.rb +461 -0
  53. data/lib/killbill/gen/junction_api.rb +60 -0
  54. data/lib/killbill/gen/limit.rb +68 -0
  55. data/lib/killbill/gen/listing.rb +63 -0
  56. data/lib/killbill/gen/migration_account_data.rb +228 -0
  57. data/lib/killbill/gen/migration_plan.rb +143 -0
  58. data/lib/killbill/gen/mutable_account_data.rb +182 -0
  59. data/lib/killbill/gen/no_op_payment_plugin_api.rb +254 -0
  60. data/lib/killbill/gen/payment.rb +183 -20
  61. data/lib/killbill/gen/payment_api.rb +433 -0
  62. data/lib/killbill/gen/payment_api_exception.rb +66 -0
  63. data/lib/killbill/gen/payment_attempt.rb +100 -10
  64. data/lib/killbill/gen/payment_info_plugin.rb +103 -12
  65. data/lib/killbill/gen/payment_method.rb +116 -0
  66. data/lib/killbill/gen/payment_method_info_plugin.rb +64 -7
  67. data/lib/killbill/gen/payment_method_kv_info.rb +56 -6
  68. data/lib/killbill/gen/payment_method_plugin.rb +142 -20
  69. data/lib/killbill/gen/payment_plugin_api.rb +232 -0
  70. data/lib/killbill/gen/payment_plugin_api_exception.rb +59 -0
  71. data/lib/killbill/gen/payment_service.rb +62 -0
  72. data/lib/killbill/gen/plan.rb +143 -0
  73. data/lib/killbill/gen/plan_change_result.rb +68 -0
  74. data/lib/killbill/gen/plan_phase.rb +104 -0
  75. data/lib/killbill/gen/plan_phase_specifier.rb +80 -0
  76. data/lib/killbill/gen/plan_specifier.rb +73 -0
  77. data/lib/killbill/gen/price.rb +67 -0
  78. data/lib/killbill/gen/price_list.rb +74 -0
  79. data/lib/killbill/gen/price_list_set.rb +56 -0
  80. data/lib/killbill/gen/product.rb +101 -0
  81. data/lib/killbill/gen/record_id_api.rb +55 -0
  82. data/lib/killbill/gen/refund.rb +126 -13
  83. data/lib/killbill/gen/refund_info_plugin.rb +96 -10
  84. data/lib/killbill/gen/require_gen.rb +97 -15
  85. data/lib/killbill/gen/static_catalog.rb +137 -0
  86. data/lib/killbill/gen/subscription.rb +258 -28
  87. data/lib/killbill/gen/subscription_bundle.rb +94 -10
  88. data/lib/killbill/gen/subscription_status_dry_run.rb +89 -0
  89. data/lib/killbill/gen/subscription_transition.rb +196 -0
  90. data/lib/killbill/gen/tag.rb +88 -9
  91. data/lib/killbill/gen/tag_api_exception.rb +66 -0
  92. data/lib/killbill/gen/tag_definition.rb +110 -10
  93. data/lib/killbill/gen/tag_definition_api_exception.rb +66 -0
  94. data/lib/killbill/gen/tag_user_api.rb +239 -0
  95. data/lib/killbill/gen/tenant.rb +102 -0
  96. data/lib/killbill/gen/tenant_api_exception.rb +66 -0
  97. data/lib/killbill/gen/tenant_context.rb +39 -4
  98. data/lib/killbill/gen/tenant_data.rb +67 -0
  99. data/lib/killbill/gen/tenant_kv.rb +96 -0
  100. data/lib/killbill/gen/tenant_service.rb +55 -0
  101. data/lib/killbill/gen/tenant_user_api.rb +127 -0
  102. data/lib/killbill/gen/unit.rb +55 -0
  103. data/lib/killbill/jnotification.rb +1 -1
  104. data/lib/killbill/jpayment.rb +10 -7
  105. data/lib/killbill/jplugin.rb +63 -61
  106. data/lib/killbill/killbill_api.rb +42 -9
  107. data/spec/killbill/jnotification_spec.rb +15 -1
  108. data/spec/killbill/jpayment_spec.rb +12 -8
  109. data/spec/killbill/killbillapi_spec.rb +23 -21
  110. data/spec/killbill/payment_plugin_spec.rb +1 -9
  111. data/spec/killbill/payment_test.rb +21 -5
  112. metadata +96 -22
  113. data/lib/killbill/gen/audit_log.rb +0 -28
  114. data/lib/killbill/gen/call_origin.rb +0 -34
  115. data/lib/killbill/gen/currency.rb +0 -34
  116. data/lib/killbill/gen/date_time_zone.rb +0 -35
  117. data/lib/killbill/gen/ext_bus_event_type.rb +0 -34
  118. data/lib/killbill/gen/invoice_payment_type.rb +0 -34
  119. data/lib/killbill/gen/object_type.rb +0 -34
  120. data/lib/killbill/gen/payment_plugin_status.rb +0 -34
  121. data/lib/killbill/gen/refund_plugin_status.rb +0 -34
  122. data/lib/killbill/gen/subscription_source_type.rb +0 -34
  123. data/lib/killbill/gen/subscription_state.rb +0 -34
  124. data/lib/killbill/gen/user_type.rb +0 -34
  125. data/lib/killbill/gen/uuid.rb +0 -22
  126. data/lib/killbill/jconverter.rb +0 -537
  127. data/lib/killbill/jkillbill_api.rb +0 -137
  128. data/spec/killbill/jconverter_spec.rb +0 -193
@@ -0,0 +1,66 @@
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
+ class EntityPersistenceException
31
+
32
+
33
+ attr_accessor :message, :cause, :code
34
+
35
+ def initialize()
36
+ end
37
+
38
+ def to_java()
39
+ # conversion for message [type = java.lang.String]
40
+ @message = @message.to_s unless @message.nil?
41
+
42
+ # conversion for cause [type = java.lang.Throwable]
43
+ @cause = @cause.to_s unless cause.nil?
44
+
45
+ # conversion for code [type = int]
46
+ @code = @code
47
+ Java::com.ning.billing.util.entity.EntityPersistenceException.new(@message, @cause, @code)
48
+ end
49
+
50
+ def to_ruby(j_obj)
51
+ # conversion for message [type = java.lang.String]
52
+ @message = j_obj.message
53
+
54
+ # conversion for cause [type = java.lang.Throwable]
55
+ @cause = j_obj.cause
56
+ @cause = @cause.to_s unless @cause.nil?
57
+
58
+ # conversion for code [type = int]
59
+ @code = j_obj.code
60
+ self
61
+ end
62
+
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,17 @@
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
+ ###################################################################################
@@ -1,24 +1,83 @@
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
+
1
19
 
2
20
  #
3
- # Ruby classes automatically generated from java classes-- don't edit
21
+ # DO NOT EDIT!!!
22
+ # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
4
23
  #
24
+
25
+
5
26
  module Killbill
6
27
  module Plugin
7
28
  module Model
8
29
 
30
+ java_package 'com.ning.billing.notification.plugin.api'
9
31
  class ExtBusEvent
10
32
 
11
- include com.ning.billing.beatrix.bus.api.ExtBusEvent
33
+ include com.ning.billing.notification.plugin.api.ExtBusEvent
34
+
35
+ attr_accessor :event_type, :object_type, :object_id, :account_id, :tenant_id
36
+
37
+ def initialize()
38
+ end
39
+
40
+ def to_java()
41
+ # conversion for event_type [type = com.ning.billing.notification.plugin.api.ExtBusEventType]
42
+ @event_type = Java::com.ning.billing.notification.plugin.api.ExtBusEventType.value_of("#{@event_type.to_s}") unless @event_type.nil?
43
+
44
+ # conversion for object_type [type = com.ning.billing.ObjectType]
45
+ @object_type = Java::com.ning.billing.ObjectType.value_of("#{@object_type.to_s}") unless @object_type.nil?
12
46
 
13
- attr_reader :event_type, :object_type, :object_id, :account_id, :tenant_id
47
+ # conversion for object_id [type = java.util.UUID]
48
+ @object_id = java.util.UUID.fromString(@object_id.to_s) unless @object_id.nil?
14
49
 
15
- def initialize(event_type, object_type, object_id, account_id, tenant_id)
16
- @event_type = event_type
17
- @object_type = object_type
18
- @object_id = object_id
19
- @account_id = account_id
20
- @tenant_id = tenant_id
50
+ # conversion for account_id [type = java.util.UUID]
51
+ @account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?
52
+
53
+ # conversion for tenant_id [type = java.util.UUID]
54
+ @tenant_id = java.util.UUID.fromString(@tenant_id.to_s) unless @tenant_id.nil?
55
+ self
56
+ end
57
+
58
+ def to_ruby(j_obj)
59
+ # conversion for event_type [type = com.ning.billing.notification.plugin.api.ExtBusEventType]
60
+ @event_type = j_obj.event_type
61
+ @event_type = @event_type.to_s.to_sym unless @event_type.nil?
62
+
63
+ # conversion for object_type [type = com.ning.billing.ObjectType]
64
+ @object_type = j_obj.object_type
65
+ @object_type = @object_type.to_s.to_sym unless @object_type.nil?
66
+
67
+ # conversion for object_id [type = java.util.UUID]
68
+ @object_id = j_obj.object_id
69
+ @object_id = @object_id.nil? ? nil : @object_id.to_s
70
+
71
+ # conversion for account_id [type = java.util.UUID]
72
+ @account_id = j_obj.account_id
73
+ @account_id = @account_id.nil? ? nil : @account_id.to_s
74
+
75
+ # conversion for tenant_id [type = java.util.UUID]
76
+ @tenant_id = j_obj.tenant_id
77
+ @tenant_id = @tenant_id.nil? ? nil : @tenant_id.to_s
78
+ self
21
79
  end
80
+
22
81
  end
23
82
  end
24
83
  end
@@ -0,0 +1,51 @@
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 'com.ning.billing.beatrix.bus.api'
31
+ class ExternalBus
32
+
33
+ include com.ning.billing.beatrix.bus.api.ExternalBus
34
+
35
+ attr_accessor
36
+
37
+ def initialize()
38
+ end
39
+
40
+ def to_java()
41
+ self
42
+ end
43
+
44
+ def to_ruby(j_obj)
45
+ self
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,66 @@
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
+ class IllegalPlanChange
31
+
32
+
33
+ attr_accessor :message, :cause, :code
34
+
35
+ def initialize()
36
+ end
37
+
38
+ def to_java()
39
+ # conversion for message [type = java.lang.String]
40
+ @message = @message.to_s unless @message.nil?
41
+
42
+ # conversion for cause [type = java.lang.Throwable]
43
+ @cause = @cause.to_s unless cause.nil?
44
+
45
+ # conversion for code [type = int]
46
+ @code = @code
47
+ Java::com.ning.billing.catalog.api.IllegalPlanChange.new(@message, @cause, @code)
48
+ end
49
+
50
+ def to_ruby(j_obj)
51
+ # conversion for message [type = java.lang.String]
52
+ @message = j_obj.message
53
+
54
+ # conversion for cause [type = java.lang.Throwable]
55
+ @cause = j_obj.cause
56
+ @cause = @cause.to_s unless @cause.nil?
57
+
58
+ # conversion for code [type = int]
59
+ @code = j_obj.code
60
+ self
61
+ end
62
+
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,79 @@
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 'com.ning.billing.catalog.api'
31
+ class InternationalPrice
32
+
33
+ include com.ning.billing.catalog.api.InternationalPrice
34
+
35
+ attr_accessor :prices, :price, :is_zero
36
+
37
+ def initialize()
38
+ end
39
+
40
+ def to_java()
41
+ # conversion for prices [type = com.ning.billing.catalog.api.Price]
42
+ @prices = @prices.to_java unless @prices.nil?
43
+
44
+ # conversion for price [type = java.math.BigDecimal]
45
+ if @price.nil?
46
+ @price = java.math.BigDecimal::ZERO
47
+ else
48
+ @price = java.math.BigDecimal.new(@price.to_i)
49
+ end
50
+
51
+ # conversion for is_zero [type = boolean]
52
+ @is_zero = @is_zero.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(@is_zero)
53
+ self
54
+ end
55
+
56
+ def to_ruby(j_obj)
57
+ # conversion for prices [type = com.ning.billing.catalog.api.Price]
58
+ @prices = j_obj.prices
59
+ @prices = Killbill::Plugin::Model::Price.new.to_ruby(@prices) unless @prices.nil?
60
+
61
+ # conversion for price [type = java.math.BigDecimal]
62
+ @price = j_obj.price
63
+ @price = @price.nil? ? 0 : @price.to_s.to_i
64
+
65
+ # conversion for is_zero [type = boolean]
66
+ @is_zero = j_obj.is_zero
67
+ if @is_zero.nil?
68
+ @is_zero = false
69
+ else
70
+ tmp_bool = (@is_zero.java_kind_of? java.lang.Boolean) ? @is_zero.boolean_value : @is_zero
71
+ @is_zero = tmp_bool ? true : false
72
+ end
73
+ self
74
+ end
75
+
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,49 @@
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
+ class InvalidConfigException
31
+
32
+
33
+ attr_accessor
34
+
35
+ def initialize()
36
+ end
37
+
38
+ def to_java()
39
+ Java::com.ning.billing.catalog.api.InvalidConfigException.new()
40
+ end
41
+
42
+ def to_ruby(j_obj)
43
+ self
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,38 +1,253 @@
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
+
1
19
 
2
20
  #
3
- # Ruby classes automatically generated from java classes-- don't edit
21
+ # DO NOT EDIT!!!
22
+ # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
4
23
  #
24
+
25
+
5
26
  module Killbill
6
27
  module Plugin
7
28
  module Model
8
29
 
30
+ java_package 'com.ning.billing.invoice.api'
9
31
  class Invoice
10
32
 
11
33
  include com.ning.billing.invoice.api.Invoice
12
34
 
13
- attr_reader :id, :created_date, :updated_date, :invoice_items, :number_of_items, :payments, :number_of_payments, :account_id, :invoice_number, :invoice_date, :target_date, :currency, :paid_amount, :original_charged_amount, :charged_amount, :credited_amount, :refunded_amount, :balance, :is_migration_invoice
14
-
15
- def initialize(id, created_date, updated_date, invoice_items, number_of_items, payments, number_of_payments, account_id, invoice_number, invoice_date, target_date, currency, paid_amount, original_charged_amount, charged_amount, credited_amount, refunded_amount, balance, is_migration_invoice)
16
- @id = id
17
- @created_date = created_date
18
- @updated_date = updated_date
19
- @invoice_items = invoice_items
20
- @number_of_items = number_of_items
21
- @payments = payments
22
- @number_of_payments = number_of_payments
23
- @account_id = account_id
24
- @invoice_number = invoice_number
25
- @invoice_date = invoice_date
26
- @target_date = target_date
27
- @currency = currency
28
- @paid_amount = paid_amount
29
- @original_charged_amount = original_charged_amount
30
- @charged_amount = charged_amount
31
- @credited_amount = credited_amount
32
- @refunded_amount = refunded_amount
33
- @balance = balance
34
- @is_migration_invoice = is_migration_invoice
35
+ attr_accessor :id, :created_date, :updated_date, :invoice_items, :number_of_items, :payments, :number_of_payments, :account_id, :invoice_number, :invoice_date, :target_date, :currency, :paid_amount, :original_charged_amount, :charged_amount, :credited_amount, :refunded_amount, :balance, :is_migration_invoice
36
+
37
+ def initialize()
35
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 invoice_items [type = java.util.List]
57
+ tmp = java.util.ArrayList.new
58
+ (@invoice_items || []).each do |m|
59
+ # conversion for m [type = com.ning.billing.invoice.api.InvoiceItem]
60
+ m = m.to_java unless m.nil?
61
+ tmp.add(m)
62
+ end
63
+ @invoice_items = tmp
64
+
65
+ # conversion for number_of_items [type = int]
66
+ @number_of_items = @number_of_items
67
+
68
+ # conversion for payments [type = java.util.List]
69
+ tmp = java.util.ArrayList.new
70
+ (@payments || []).each do |m|
71
+ # conversion for m [type = com.ning.billing.invoice.api.InvoicePayment]
72
+ m = m.to_java unless m.nil?
73
+ tmp.add(m)
74
+ end
75
+ @payments = tmp
76
+
77
+ # conversion for number_of_payments [type = int]
78
+ @number_of_payments = @number_of_payments
79
+
80
+ # conversion for account_id [type = java.util.UUID]
81
+ @account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?
82
+
83
+ # conversion for invoice_number [type = java.lang.Integer]
84
+ @invoice_number = @invoice_number
85
+
86
+ # conversion for invoice_date [type = org.joda.time.LocalDate]
87
+ if !@invoice_date.nil?
88
+ @invoice_date = Java::org.joda.time.LocalDate.parse(@invoice_date.to_s)
89
+ end
90
+
91
+ # conversion for target_date [type = org.joda.time.LocalDate]
92
+ if !@target_date.nil?
93
+ @target_date = Java::org.joda.time.LocalDate.parse(@target_date.to_s)
94
+ end
95
+
96
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
97
+ @currency = Java::com.ning.billing.catalog.api.Currency.value_of("#{@currency.to_s}") unless @currency.nil?
98
+
99
+ # conversion for paid_amount [type = java.math.BigDecimal]
100
+ if @paid_amount.nil?
101
+ @paid_amount = java.math.BigDecimal::ZERO
102
+ else
103
+ @paid_amount = java.math.BigDecimal.new(@paid_amount.to_i)
104
+ end
105
+
106
+ # conversion for original_charged_amount [type = java.math.BigDecimal]
107
+ if @original_charged_amount.nil?
108
+ @original_charged_amount = java.math.BigDecimal::ZERO
109
+ else
110
+ @original_charged_amount = java.math.BigDecimal.new(@original_charged_amount.to_i)
111
+ end
112
+
113
+ # conversion for charged_amount [type = java.math.BigDecimal]
114
+ if @charged_amount.nil?
115
+ @charged_amount = java.math.BigDecimal::ZERO
116
+ else
117
+ @charged_amount = java.math.BigDecimal.new(@charged_amount.to_i)
118
+ end
119
+
120
+ # conversion for credited_amount [type = java.math.BigDecimal]
121
+ if @credited_amount.nil?
122
+ @credited_amount = java.math.BigDecimal::ZERO
123
+ else
124
+ @credited_amount = java.math.BigDecimal.new(@credited_amount.to_i)
125
+ end
126
+
127
+ # conversion for refunded_amount [type = java.math.BigDecimal]
128
+ if @refunded_amount.nil?
129
+ @refunded_amount = java.math.BigDecimal::ZERO
130
+ else
131
+ @refunded_amount = java.math.BigDecimal.new(@refunded_amount.to_i)
132
+ end
133
+
134
+ # conversion for balance [type = java.math.BigDecimal]
135
+ if @balance.nil?
136
+ @balance = java.math.BigDecimal::ZERO
137
+ else
138
+ @balance = java.math.BigDecimal.new(@balance.to_i)
139
+ end
140
+
141
+ # conversion for is_migration_invoice [type = boolean]
142
+ @is_migration_invoice = @is_migration_invoice.nil? ? java.lang.Boolean.new(false) : java.lang.Boolean.new(@is_migration_invoice)
143
+ self
144
+ end
145
+
146
+ def to_ruby(j_obj)
147
+ # conversion for id [type = java.util.UUID]
148
+ @id = j_obj.id
149
+ @id = @id.nil? ? nil : @id.to_s
150
+
151
+ # conversion for created_date [type = org.joda.time.DateTime]
152
+ @created_date = j_obj.created_date
153
+ if !@created_date.nil?
154
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time
155
+ str = fmt.print(@created_date)
156
+ @created_date = DateTime.iso8601(str)
157
+ end
158
+
159
+ # conversion for updated_date [type = org.joda.time.DateTime]
160
+ @updated_date = j_obj.updated_date
161
+ if !@updated_date.nil?
162
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time
163
+ str = fmt.print(@updated_date)
164
+ @updated_date = DateTime.iso8601(str)
165
+ end
166
+
167
+ # conversion for invoice_items [type = java.util.List]
168
+ @invoice_items = j_obj.invoice_items
169
+ tmp = []
170
+ (@invoice_items || []).each do |m|
171
+ # conversion for m [type = com.ning.billing.invoice.api.InvoiceItem]
172
+ m = Killbill::Plugin::Model::InvoiceItem.new.to_ruby(m) unless m.nil?
173
+ tmp << m
174
+ end
175
+ @invoice_items = tmp
176
+
177
+ # conversion for number_of_items [type = int]
178
+ @number_of_items = j_obj.number_of_items
179
+
180
+ # conversion for payments [type = java.util.List]
181
+ @payments = j_obj.payments
182
+ tmp = []
183
+ (@payments || []).each do |m|
184
+ # conversion for m [type = com.ning.billing.invoice.api.InvoicePayment]
185
+ m = Killbill::Plugin::Model::InvoicePayment.new.to_ruby(m) unless m.nil?
186
+ tmp << m
187
+ end
188
+ @payments = tmp
189
+
190
+ # conversion for number_of_payments [type = int]
191
+ @number_of_payments = j_obj.number_of_payments
192
+
193
+ # conversion for account_id [type = java.util.UUID]
194
+ @account_id = j_obj.account_id
195
+ @account_id = @account_id.nil? ? nil : @account_id.to_s
196
+
197
+ # conversion for invoice_number [type = java.lang.Integer]
198
+ @invoice_number = j_obj.invoice_number
199
+
200
+ # conversion for invoice_date [type = org.joda.time.LocalDate]
201
+ @invoice_date = j_obj.invoice_date
202
+ if !@invoice_date.nil?
203
+ @invoice_date = @invoice_date.to_s
204
+ end
205
+
206
+ # conversion for target_date [type = org.joda.time.LocalDate]
207
+ @target_date = j_obj.target_date
208
+ if !@target_date.nil?
209
+ @target_date = @target_date.to_s
210
+ end
211
+
212
+ # conversion for currency [type = com.ning.billing.catalog.api.Currency]
213
+ @currency = j_obj.currency
214
+ @currency = @currency.to_s.to_sym unless @currency.nil?
215
+
216
+ # conversion for paid_amount [type = java.math.BigDecimal]
217
+ @paid_amount = j_obj.paid_amount
218
+ @paid_amount = @paid_amount.nil? ? 0 : @paid_amount.to_s.to_i
219
+
220
+ # conversion for original_charged_amount [type = java.math.BigDecimal]
221
+ @original_charged_amount = j_obj.original_charged_amount
222
+ @original_charged_amount = @original_charged_amount.nil? ? 0 : @original_charged_amount.to_s.to_i
223
+
224
+ # conversion for charged_amount [type = java.math.BigDecimal]
225
+ @charged_amount = j_obj.charged_amount
226
+ @charged_amount = @charged_amount.nil? ? 0 : @charged_amount.to_s.to_i
227
+
228
+ # conversion for credited_amount [type = java.math.BigDecimal]
229
+ @credited_amount = j_obj.credited_amount
230
+ @credited_amount = @credited_amount.nil? ? 0 : @credited_amount.to_s.to_i
231
+
232
+ # conversion for refunded_amount [type = java.math.BigDecimal]
233
+ @refunded_amount = j_obj.refunded_amount
234
+ @refunded_amount = @refunded_amount.nil? ? 0 : @refunded_amount.to_s.to_i
235
+
236
+ # conversion for balance [type = java.math.BigDecimal]
237
+ @balance = j_obj.balance
238
+ @balance = @balance.nil? ? 0 : @balance.to_s.to_i
239
+
240
+ # conversion for is_migration_invoice [type = boolean]
241
+ @is_migration_invoice = j_obj.is_migration_invoice
242
+ if @is_migration_invoice.nil?
243
+ @is_migration_invoice = false
244
+ else
245
+ tmp_bool = (@is_migration_invoice.java_kind_of? java.lang.Boolean) ? @is_migration_invoice.boolean_value : @is_migration_invoice
246
+ @is_migration_invoice = tmp_bool ? true : false
247
+ end
248
+ self
249
+ end
250
+
36
251
  end
37
252
  end
38
253
  end