killbill 1.0.15 → 1.0.16

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 (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
@@ -1,54 +0,0 @@
1
- require 'killbill/response/payment_method_response_internal'
2
- require 'killbill/jresponse/jconverter'
3
-
4
- module Killbill
5
- module Plugin
6
-
7
- java_package 'com.ning.billing.payment.plugin.api'
8
- class JPaymentMethodResponseInternal
9
-
10
- include Java::com.ning.billing.payment.plugin.api.PaymentMethodInfoPlugin
11
- attr_reader :kb_account_id,
12
- :kb_payment_method_id,
13
- :is_default
14
- :external_payment_method_id
15
-
16
- class << self
17
- def to_payment_method_response_internal(jinfo)
18
- account_id = JConverter.from_uuid(jinfo.get_account_id)
19
- payment_method_id = JConverter.from_uuid(jinfo.get_payment_method_id)
20
- is_default = JConverter.from_boolean(jinfo.is_default)
21
- external_payment_method_id = JConverter.from_string(jinfo.get_external_payment_method_id)
22
- PaymentMethodResponseInternal.new(account_id, payment_method_id, is_default, external_payment_method_id)
23
- end
24
- end
25
-
26
- def initialize(payment_method_response_internal)
27
- @kb_account_id = JConverter.to_uuid(payment_method_response_internal.kb_account_id)
28
- @kb_payment_method_id = JConverter.to_uuid(payment_method_response_internal.kb_payment_method_id)
29
- @is_default = JConverter.to_boolean(payment_method_response_internal.is_default)
30
- @external_payment_method_id = JConverter.to_string(payment_method_response_internal.external_payment_method_id)
31
- end
32
-
33
- java_signature 'java.lang.UUID getAccountId()'
34
- def get_account_id
35
- @kb_account_id
36
- end
37
-
38
- java_signature 'java.lang.UUID getPaymentMethodId()'
39
- def get_payment_method_id
40
- @kb_payment_method_id
41
- end
42
-
43
- java_signature 'java.lang.Boolean isDefault()'
44
- def is_default
45
- @is_default
46
- end
47
-
48
- java_signature 'java.lang.String getExternalPaymentMethodId()'
49
- def get_external_payment_method_id
50
- @external_payment_method_id
51
- end
52
- end
53
- end
54
- end
@@ -1,74 +0,0 @@
1
- require 'killbill/response/payment_response'
2
- require 'killbill/jresponse/jconverter'
3
-
4
- module Killbill
5
- module Plugin
6
-
7
- java_package 'com.ning.billing.payment.plugin.api'
8
- class JPaymentResponse
9
-
10
- include Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin
11
-
12
- attr_reader :amount,
13
- :created_date,
14
- :effective_date,
15
- :status,
16
- :gateway_error,
17
- :gateway_error_code,
18
- :first_payment_reference_id,
19
- :second_payment_reference_id
20
-
21
- def initialize(payment_response)
22
- @amount = JConverter.to_big_decimal(payment_response.amount_in_cents)
23
- @created_date = JConverter.to_joda_date_time(payment_response.created_date)
24
- @effective_date = JConverter.to_joda_date_time(payment_response.effective_date)
25
- @status = JConverter.to_payment_plugin_status(payment_response.status)
26
- @gateway_error = JConverter.to_string(payment_response.gateway_error)
27
- @gateway_error_code = JConverter.to_string(payment_response.gateway_error_code)
28
- @first_payment_reference_id = JConverter.to_string(payment_response.first_payment_reference_id)
29
- @second_payment_reference_id = JConverter.to_string(payment_response.second_payment_reference_id)
30
- end
31
-
32
- java_signature 'java.math.BigDecimal getAmount()'
33
- def get_amount
34
- @amount
35
- end
36
-
37
- java_signature 'org.joda.time.DateTime getCreatedDate()'
38
- def get_created_date
39
- @created_date
40
- end
41
-
42
- java_signature 'org.joda.time.DateTime getEffectiveDate()'
43
- def get_effective_date
44
- @effective_date
45
- end
46
-
47
- java_signature 'Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus getStatus()'
48
- def get_status
49
- @status
50
- end
51
-
52
- java_signature 'java.lang.String getGatewayError()'
53
- def get_gateway_error
54
- @gateway_error
55
- end
56
-
57
- java_signature 'java.lang.String getGatewayErrorCode()'
58
- def get_gateway_error_code
59
- @gateway_error_code
60
- end
61
-
62
- java_signature 'java.lang.String getFirstPaymentReferenceId()'
63
- def get_first_payment_reference_id
64
- @first_payment_reference_id
65
- end
66
-
67
- java_signature 'java.lang.String getSecondPaymentReferenceId()'
68
- def get_second_payment_reference_id
69
- @second_payment_reference_id
70
- end
71
-
72
- end
73
- end
74
- end
@@ -1,68 +0,0 @@
1
- require 'killbill/response/refund_response'
2
- require 'killbill/jresponse/jconverter'
3
-
4
- module Killbill
5
- module Plugin
6
-
7
- java_package 'com.ning.billing.payment.plugin.api'
8
- class JRefundResponse
9
-
10
- include Java::com.ning.billing.payment.plugin.api.RefundInfoPlugin
11
-
12
- attr_reader :amount,
13
- :created_date,
14
- :effective_date,
15
- :status,
16
- :gateway_error,
17
- :gateway_error_code,
18
- :reference_id
19
-
20
- def initialize(refund_response)
21
- @amount = JConverter.to_big_decimal(refund_response.amount_in_cents)
22
- @created_date = JConverter.to_joda_date_time(refund_response.created_date)
23
- @effective_date = JConverter.to_joda_date_time(refund_response.effective_date)
24
- @status = JConverter.to_refund_plugin_status(refund_response.status)
25
- @gateway_error = JConverter.to_string(refund_response.gateway_error)
26
- @gateway_error_code = JConverter.to_string(refund_response.gateway_error_code)
27
- @reference_id = JConverter.to_string(refund_response.reference_id)
28
- end
29
-
30
-
31
- java_signature 'java.math.BigDecimal getAmount()'
32
- def get_amount
33
- @amount
34
- end
35
-
36
- java_signature 'org.joda.time.DateTime getCreatedDate()'
37
- def get_created_date
38
- @created_date
39
- end
40
-
41
- java_signature 'org.joda.time.DateTime getEffectiveDate()'
42
- def get_effective_date
43
- @effective_date
44
- end
45
-
46
- java_signature 'Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus getStatus()'
47
- def get_status
48
- @status
49
- end
50
-
51
- java_signature 'java.lang.String getGatewayError()'
52
- def get_gateway_error
53
- @gateway_error
54
- end
55
-
56
- java_signature 'java.lang.String getGatewayErrorCode()'
57
- def get_gateway_error_code
58
- @gateway_error_code
59
- end
60
-
61
- java_signature 'java.lang.String getReferenceId()'
62
- def get_reference_id
63
- @reference_id
64
- end
65
-
66
- end
67
- end
68
- end
@@ -1,18 +0,0 @@
1
-
2
- module Killbill
3
- module Plugin
4
- class Event
5
-
6
- attr_reader :event_type, :object_type, :object_id, :account_id, :tenant_id
7
-
8
- def initialize(event_type, object_type, object_id, account_id, tenant_id)
9
- @event_type = event_type
10
- @object_type = object_type
11
- @object_id = object_id
12
- @account_id = account_id
13
- @tenant_id = tenant_id
14
- end
15
-
16
- end
17
- end
18
- end
@@ -1,50 +0,0 @@
1
- module Killbill
2
- module Plugin
3
-
4
- class PaymentMethodProperty
5
-
6
- attr_reader :key,
7
- :value,
8
- :is_updatable
9
-
10
- def initialize(key, value, is_updatable)
11
- @key = key
12
- @value = value
13
- @is_updatable = is_updatable
14
- end
15
- end
16
-
17
- class PaymentMethodResponse
18
-
19
- PROP_TYPE = "type";
20
- PROP_CC_NAME = "cc_name";
21
- PROP_CC_TYPE = "cc_type";
22
- PROP_CC_EXP_MONTH = "cc_exp_month";
23
- PROP_CC_EXP_YEAR = "cc_exp_year";
24
- PROP_CC_LAST_4 = "cc_last_4";
25
- PROP_ADDRESS1 = "address1";
26
- PROP_ADDRESS2 = "address2";
27
- PROP_CITY = "city";
28
- PROP_STATE = "state";
29
- PROP_ZIP = "zip";
30
- PROP_COUNTRY = "country";
31
-
32
- attr_reader :external_payment_method_id,
33
- :is_default,
34
- :properties
35
-
36
- def initialize(external_payment_method_id, is_default, properties)
37
- @external_payment_method_id = external_payment_method_id
38
- @is_default = is_default
39
- @properties = properties
40
- end
41
-
42
- def value(key)
43
- (@properties || []).each do |prop|
44
- return prop.value if prop.key == key
45
- end
46
- nil
47
- end
48
- end
49
- end
50
- end
@@ -1,20 +0,0 @@
1
- module Killbill
2
- module Plugin
3
-
4
- class PaymentMethodResponseInternal
5
-
6
- attr_reader :kb_account_id,
7
- :kb_payment_method_id,
8
- :is_default,
9
- :external_payment_method_id
10
-
11
- def initialize(kb_account_id, kb_payment_method_id, is_default, external_payment_method_id)
12
- @kb_account_id = kb_account_id
13
- @kb_payment_method_id = kb_payment_method_id
14
- @is_default = is_default
15
- @external_payment_method_id = external_payment_method_id
16
- end
17
-
18
- end
19
- end
20
- end
@@ -1,26 +0,0 @@
1
- module Killbill
2
- module Plugin
3
- class PaymentResponse
4
-
5
- attr_reader :amount_in_cents,
6
- :created_date,
7
- :effective_date,
8
- :status,
9
- :gateway_error,
10
- :gateway_error_code,
11
- :first_payment_reference_id,
12
- :second_payment_reference_id
13
-
14
- def initialize(amount_in_cents, created_date, effective_date, status, gateway_error=nil, gateway_error_code=nil, first_payment_reference_id=nil, second_payment_reference_id=nil)
15
- @amount_in_cents = amount_in_cents
16
- @created_date = created_date
17
- @effective_date = effective_date
18
- @status = status
19
- @gateway_error = gateway_error
20
- @gateway_error_code = gateway_error_code
21
- @first_payment_reference_id = first_payment_reference_id
22
- @second_payment_reference_id = second_payment_reference_id
23
- end
24
- end
25
- end
26
- end
@@ -1,10 +0,0 @@
1
- module Killbill
2
- module Plugin
3
-
4
- module PaymentStatus
5
- SUCCESS = 1,
6
- ERROR = 2,
7
- UNDEFINED = 3
8
- end
9
- end
10
- end
@@ -1,25 +0,0 @@
1
- module Killbill
2
- module Plugin
3
-
4
- class RefundResponse
5
-
6
- attr_reader :amount_in_cents,
7
- :created_date,
8
- :effective_date,
9
- :status,
10
- :gateway_error,
11
- :gateway_error_code,
12
- :reference_id
13
-
14
- def initialize(amount_in_cents, created_date, effective_date, status, gateway_error=nil, gateway_error_code=nil, reference_id=nil)
15
- @amount_in_cents = amount_in_cents
16
- @created_date = created_date
17
- @effective_date = effective_date
18
- @status = status
19
- @gateway_error = gateway_error
20
- @gateway_error_code = gateway_error_code
21
- @reference_id = reference_id
22
- end
23
- end
24
- end
25
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
- require 'date'
3
-
4
- require 'killbill/response/event'
5
- require 'killbill/jresponse/jevent'
6
-
7
-
8
- describe Killbill::Plugin::JEvent do
9
-
10
- it "should_test_jevent" do
11
- object_type = Java::com.ning.billing.ObjectType::INVOICE
12
- event_type = Java::com.ning.billing.beatrix.bus.api.ExtBusEventType::INVOICE_CREATION
13
- uuid = java.util.UUID.random_uuid
14
-
15
- input = Killbill::Plugin::JEvent.new(event_type, object_type, uuid, uuid, uuid)
16
- #input.should be_an_instance_of Java::com.ning.billing.beatrix.bus.api.ExtBusEvent
17
- end
18
- end
@@ -1,34 +0,0 @@
1
- require 'spec_helper'
2
- require 'date'
3
-
4
- require 'killbill/response/payment_status'
5
- require 'killbill/response/payment_method_response_internal'
6
-
7
- require 'killbill/jresponse/jpayment_method_response_internal'
8
-
9
-
10
- describe Killbill::Plugin::JPaymentMethodResponseInternal do
11
-
12
- it "should_test_jpayment_method_response_internal" do
13
-
14
- kb_account_id = "935e9aba-0031-4911-a137-aad7dd9a75b9"
15
- kb_payment_method_id = "37462cc7-834b-48c6-8fd6-e8e038f4c41d"
16
- is_default = true
17
- external_payment_method_id = "foo"
18
-
19
- input = Killbill::Plugin::PaymentMethodResponseInternal.new(kb_account_id, kb_payment_method_id, is_default, external_payment_method_id)
20
- output = Killbill::Plugin::JPaymentMethodResponseInternal.new(input)
21
-
22
- output.get_account_id.should be_an_instance_of java.util.UUID
23
- output.get_account_id.to_s.should == kb_account_id
24
-
25
- output.get_payment_method_id.should be_an_instance_of java.util.UUID
26
- output.get_payment_method_id.to_s.should == kb_payment_method_id
27
-
28
- output.is_default.should be_an_instance_of java.lang.Boolean
29
- output.is_default.to_s.should == is_default.to_s
30
-
31
- output.get_external_payment_method_id.should be_an_instance_of java.lang.String
32
- output.get_external_payment_method_id.should == external_payment_method_id
33
- end
34
- end
@@ -1,53 +0,0 @@
1
- require 'spec_helper'
2
- require 'date'
3
-
4
- require 'killbill/response/payment_status'
5
- require 'killbill/response/payment_method_response'
6
-
7
- require 'killbill/jresponse/jpayment_method_response'
8
-
9
-
10
- describe Killbill::Plugin::JPaymentMethodResponse do
11
-
12
- it "should_test_jpayment_method_response" do
13
-
14
- prop1 = Killbill::Plugin::PaymentMethodProperty.new('key1', 'value1', true)
15
- prop2 = Killbill::Plugin::PaymentMethodProperty.new('key2', 'value2', false)
16
- props = []
17
- props << prop1
18
- props << prop2
19
-
20
- external_payment_method_id = "935e9aba-0031-4911-a137-aad7dd9a75b9"
21
- is_default = true
22
- input = Killbill::Plugin::PaymentMethodResponse.new(external_payment_method_id, is_default, props)
23
- output = Killbill::Plugin::JPaymentMethodResponse.new(input)
24
-
25
- output.get_external_payment_method_id.should be_an_instance_of java.lang.String
26
- output.get_external_payment_method_id.to_s.should == external_payment_method_id
27
-
28
- output.is_default_payment_method.should be_an_instance_of java.lang.Boolean
29
- output.is_default_payment_method.to_s.should == is_default.to_s
30
-
31
- output.get_properties.should be_an_instance_of java.util.ArrayList
32
-
33
-
34
- output.get_properties.each_with_index do |p, i|
35
- =begin
36
- p.get_key.should be_an_instance_of java.lang.String
37
- p.get_value.should be_an_instance_of string # java.lang.Object
38
- p.is_updateable be_an_instance_of TrueClass # java.lang.Boolean
39
- =end
40
- if i == 0
41
- p.get_key.should == 'key1'
42
- p.get_value.to_s.should == 'value1'
43
- p.is_updatable.to_s.should == 'true'
44
- else
45
- p.get_key.should == 'key2'
46
- p.get_value.to_s.should == 'value2'
47
- p.is_updatable.to_s.should == 'false'
48
- end
49
- end
50
-
51
- end
52
-
53
- end