killbill 3.0.0 → 3.1.0

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 (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,57 @@
1
+ require 'active_record'
2
+
3
+ ActiveRecord::Schema.define(:version => 20140410153635) do
4
+ create_table "test_payment_methods", :force => true do |t|
5
+ t.string "kb_account_id", :null => false
6
+ t.string "kb_payment_method_id" # NULL before Kill Bill knows about it
7
+ t.string "token"
8
+ t.string "cc_first_name"
9
+ t.string "cc_last_name"
10
+ t.string "cc_type"
11
+ t.integer "cc_exp_month"
12
+ t.integer "cc_exp_year"
13
+ t.integer "cc_last_4"
14
+ t.string "address1"
15
+ t.string "address2"
16
+ t.string "city"
17
+ t.string "state"
18
+ t.string "zip"
19
+ t.string "country"
20
+ t.boolean "is_deleted", :null => false, :default => false
21
+ t.datetime "created_at", :null => false
22
+ t.datetime "updated_at", :null => false
23
+ end
24
+
25
+ add_index(:test_payment_methods, :kb_account_id)
26
+ add_index(:test_payment_methods, :kb_payment_method_id)
27
+
28
+ create_table "test_transactions", :force => true do |t|
29
+ t.integer "response_id", :null => false
30
+ t.string "api_call", :null => false
31
+ t.string "kb_payment_id", :null => false
32
+ t.integer "amount_in_cents", :null => false
33
+ t.string "currency", :null => false
34
+ t.datetime "created_at", :null => false
35
+ t.datetime "updated_at", :null => false
36
+ end
37
+
38
+ add_index(:test_transactions, :kb_payment_id)
39
+
40
+ create_table "test_responses", :force => true do |t|
41
+ t.string "api_call", :null => false
42
+ t.string "kb_payment_id"
43
+ t.string "message"
44
+ t.string "authorization"
45
+ t.boolean "fraud_review"
46
+ t.boolean "test"
47
+ t.string "avs_result_code"
48
+ t.string "avs_result_message"
49
+ t.string "avs_result_street_match"
50
+ t.string "avs_result_postal_match"
51
+ t.string "cvv_result_code"
52
+ t.string "cvv_result_message"
53
+ t.boolean "success"
54
+ t.datetime "created_at", :null => false
55
+ t.datetime "updated_at", :null => false
56
+ end
57
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Killbill::Plugin::ActiveMerchant::Utils do
4
+ it "should convert back and forth UUIDs" do
5
+ uuid = SecureRandom.uuid
6
+ packed = Killbill::Plugin::ActiveMerchant::Utils.compact_uuid(uuid)
7
+ unpacked = Killbill::Plugin::ActiveMerchant::Utils.unpack_uuid(packed)
8
+ unpacked.should == uuid
9
+ end
10
+
11
+ it "should respect leading 0s" do
12
+ uuid = "0ae18a4c-be57-44c3-84ba-a82962a2de03"
13
+ 0.upto(35) do |i|
14
+ # Skip hyphens
15
+ next if [8, 13, 18, 23].include?(i)
16
+ uuid[i] = '0'
17
+ packed = Killbill::Plugin::ActiveMerchant::Utils.compact_uuid(uuid)
18
+ unpacked = Killbill::Plugin::ActiveMerchant::Utils.unpack_uuid(packed)
19
+ unpacked.should == uuid
20
+ end
21
+ end
22
+ end
@@ -12,6 +12,11 @@ describe Killbill::Plugin::Api::PaymentPluginApi do
12
12
  @payment_method_plugin = nil
13
13
  @amount = java.math.BigDecimal.new("50")
14
14
  @currency = Java::org.killbill.billing.catalog.api.Currency::USD
15
+ propertyA = Java::org.killbill.billing.payment.api.PluginProperty.new('keyA', 'valueA', false)
16
+ propertyB = Java::org.killbill.billing.payment.api.PluginProperty.new('keyB', 'valueB', true)
17
+ @properties = java.util.ArrayList.new
18
+ @properties.add(propertyA)
19
+ @properties.add(propertyB)
15
20
  end
16
21
 
17
22
  before(:each) do
@@ -19,7 +24,7 @@ describe Killbill::Plugin::Api::PaymentPluginApi do
19
24
  end
20
25
 
21
26
  it "should_test_charge_ok" do
22
- output = @paymentPluginApi.process_payment(@kb_account_id, @kb_payment_id, @kb_payment_method_id, @amount, @currency, nil)
27
+ output = @paymentPluginApi.process_payment(@kb_account_id, @kb_payment_id, @kb_payment_method_id, @amount, @currency, @properties, nil)
23
28
  output.amount.should be_an_instance_of java.math.BigDecimal
24
29
  output.amount.compare_to(@amount).should == 0
25
30
  output.status.java_kind_of?(Java::org.killbill.billing.payment.plugin.api.PaymentPluginStatus).should == true
@@ -28,11 +33,11 @@ describe Killbill::Plugin::Api::PaymentPluginApi do
28
33
 
29
34
  it "should_test_charge_exception" do
30
35
  @paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
31
- lambda { @paymentPluginApi.process_payment(@kb_account_id, @kb_payment_id, @kb_payment_method_id, @amount, @currency, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
36
+ lambda { @paymentPluginApi.process_payment(@kb_account_id, @kb_payment_id, @kb_payment_method_id, @amount, @currency, @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
32
37
  end
33
38
 
34
39
  it "should_test_get_payment_info_ok" do
35
- output = @paymentPluginApi.get_payment_info(@kb_account_id, @kb_payment_method_id, nil)
40
+ output = @paymentPluginApi.get_payment_info(@kb_account_id, @kb_payment_method_id, @properties, nil)
36
41
  output.amount.should be_an_instance_of java.math.BigDecimal
37
42
  output.amount.compare_to(java.math.BigDecimal.new(0)).should == 0
38
43
  output.status.java_kind_of?(Java::org.killbill.billing.payment.plugin.api.PaymentPluginStatus).should == true
@@ -42,11 +47,11 @@ describe Killbill::Plugin::Api::PaymentPluginApi do
42
47
 
43
48
  it "should_test_get_payment_info_exception" do
44
49
  @paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
45
- lambda { @paymentPluginApi.get_payment_info(@kb_account_id, @kb_payment_method_id, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
50
+ lambda { @paymentPluginApi.get_payment_info(@kb_account_id, @kb_payment_method_id, @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
46
51
  end
47
52
 
48
53
  it "should_test_refund_ok" do
49
- output = @paymentPluginApi.process_refund(@kb_account_id, @kb_payment_method_id, @amount, @currency, nil)
54
+ output = @paymentPluginApi.process_refund(@kb_account_id, @kb_payment_method_id, @amount, @currency, @properties, nil)
50
55
  output.amount.should be_an_instance_of java.math.BigDecimal
51
56
  output.amount.compare_to(@amount).should == 0
52
57
  output.status.java_kind_of?(Java::org.killbill.billing.payment.plugin.api.RefundPluginStatus).should == true
@@ -56,49 +61,49 @@ describe Killbill::Plugin::Api::PaymentPluginApi do
56
61
 
57
62
  it "should_test_refund_exception" do
58
63
  @paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
59
- lambda { @paymentPluginApi.process_refund(@kb_account_id, @kb_payment_method_id, @amount, @currency, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
64
+ lambda { @paymentPluginApi.process_refund(@kb_account_id, @kb_payment_method_id, @amount, @currency, @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
60
65
  end
61
66
 
62
67
  it "should_test_add_payment_method_ok" do
63
- @paymentPluginApi.add_payment_method(@kb_account_id, @kb_payment_method_id, @payment_method_plugin, java.lang.Boolean.new("true"), nil)
68
+ @paymentPluginApi.add_payment_method(@kb_account_id, @kb_payment_method_id, @payment_method_plugin, java.lang.Boolean.new("true"), @properties, nil)
64
69
  end
65
70
 
66
71
  it "should_test_add_payment_method_exception" do
67
72
  @paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
68
- lambda { @paymentPluginApi.add_payment_method(@kb_account_id, @kb_payment_method_id, @payment_method_plugin, true, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
73
+ lambda { @paymentPluginApi.add_payment_method(@kb_account_id, @kb_payment_method_id, @payment_method_plugin, true, @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
69
74
  end
70
75
 
71
76
  it "should_test_delete_payment_method_ok" do
72
- @paymentPluginApi.delete_payment_method(@kb_account_id, @kb_payment_method_id, nil)
77
+ @paymentPluginApi.delete_payment_method(@kb_account_id, @kb_payment_method_id, @properties, nil)
73
78
  end
74
79
 
75
80
  it "should_test_delete_payment_method_exception" do
76
81
  @paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
77
- lambda { @paymentPluginApi.delete_payment_method(@kb_account_id, @kb_payment_method_id, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
82
+ lambda { @paymentPluginApi.delete_payment_method(@kb_account_id, @kb_payment_method_id, @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
78
83
  end
79
84
 
80
85
  it "should_test_get_payment_method_detail_ok" do
81
- output = @paymentPluginApi.get_payment_method_detail(@kb_account_id, @kb_payment_method_id, nil)
86
+ output = @paymentPluginApi.get_payment_method_detail(@kb_account_id, @kb_payment_method_id, @properties, nil)
82
87
  #output.external_payment_method_id.should be_an_instance_of java.lang.String
83
88
  output.external_payment_method_id.should == "external_payment_method_id"
84
89
  end
85
90
 
86
91
  it "should_test_get_payment_method_detail_exception" do
87
92
  @paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
88
- lambda { @paymentPluginApi.get_payment_method_detail(@kb_account_id, @kb_payment_method_id, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
93
+ lambda { @paymentPluginApi.get_payment_method_detail(@kb_account_id, @kb_payment_method_id, @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
89
94
  end
90
95
 
91
96
  it "should_test_set_default_payment_method_ok" do
92
- @paymentPluginApi.set_default_payment_method(@kb_account_id, @kb_payment_method_id, nil)
97
+ @paymentPluginApi.set_default_payment_method(@kb_account_id, @kb_payment_method_id, @properties, nil)
93
98
  end
94
99
 
95
100
  it "should_test_set_default_payment_method_exception" do
96
101
  @paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
97
- lambda { @paymentPluginApi.set_default_payment_method(@kb_account_id, @kb_payment_method_id, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
102
+ lambda { @paymentPluginApi.set_default_payment_method(@kb_account_id, @kb_payment_method_id, @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
98
103
  end
99
104
 
100
105
  it "should_get_payment_methods_ok" do
101
- output = @paymentPluginApi.get_payment_methods(@kb_account_id, java.lang.Boolean.new("true"), nil)
106
+ output = @paymentPluginApi.get_payment_methods(@kb_account_id, java.lang.Boolean.new("true"), @properties, nil)
102
107
  output.should be_an_instance_of java.util.ArrayList
103
108
  output.size.should == 1
104
109
 
@@ -108,15 +113,15 @@ describe Killbill::Plugin::Api::PaymentPluginApi do
108
113
 
109
114
  it "should_get_payment_methods_exception" do
110
115
  @paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
111
- lambda { @paymentPluginApi.get_payment_methods(@kb_account_id, java.lang.Boolean.new("true"), nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
116
+ lambda { @paymentPluginApi.get_payment_methods(@kb_account_id, java.lang.Boolean.new("true"), @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
112
117
  end
113
118
 
114
119
  it "should_test_reset_payment_methods_ok" do
115
- @paymentPluginApi.reset_payment_methods(@kb_account_id, java.util.ArrayList.new)
120
+ @paymentPluginApi.reset_payment_methods(@kb_account_id, java.util.ArrayList.new, @properties)
116
121
  end
117
122
 
118
123
  it "should_test_reset_payment_methods_exception" do
119
124
  @paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
120
- lambda { @paymentPluginApi.reset_payment_methods(@kb_account_id, java.util.ArrayList.new) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
125
+ lambda { @paymentPluginApi.reset_payment_methods(@kb_account_id, java.util.ArrayList.new, @properties) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
121
126
  end
122
127
  end
@@ -14,6 +14,7 @@ describe Killbill::Plugin::Payment do
14
14
  @payment_method = Hash.new(:credit_card => SecureRandom.uuid)
15
15
  @kb_payment_method_id = SecureRandom.uuid
16
16
 
17
+ @properties = [::Killbill::Plugin::Model::PluginProperty.new]
17
18
  @payment_method_props = Hash.new
18
19
  @payment_methods = Hash.new
19
20
  @killbill_account = Hash.new(:name => SecureRandom.uuid)
@@ -22,16 +23,16 @@ describe Killbill::Plugin::Payment do
22
23
  end
23
24
 
24
25
  it "should raise exceptions for unsupported operations" do
25
- lambda { @plugin.process_payment(@kb_account_id, @kb_payment_id, @kb_payment_method_id, @amount_in_cents, @currency, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
26
- lambda { @plugin.process_refund(@kb_account_id, @kb_payment_id, @amount_in_cents, @currency, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
27
- lambda { @plugin.get_payment_info(@kb_account_id, @kb_payment_id, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
28
- lambda { @plugin.get_refund_info(@kb_account_id, @kb_payment_id, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
29
- lambda { @plugin.add_payment_method(@kb_account_id, @payment_method, @payment_method_props, true, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
30
- lambda { @plugin.delete_payment_method(@kb_account_id, @kb_payment_method_id, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
31
- lambda { @plugin.set_default_payment_method(@kb_account_id, @payment_method, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
26
+ lambda { @plugin.process_payment(@kb_account_id, @kb_payment_id, @kb_payment_method_id, @amount_in_cents, @currency, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
27
+ lambda { @plugin.process_refund(@kb_account_id, @kb_payment_id, @amount_in_cents, @currency, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
28
+ lambda { @plugin.get_payment_info(@kb_account_id, @kb_payment_id, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
29
+ lambda { @plugin.get_refund_info(@kb_account_id, @kb_payment_id, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
30
+ lambda { @plugin.add_payment_method(@kb_account_id, @payment_method, @payment_method_props, true, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
31
+ lambda { @plugin.delete_payment_method(@kb_account_id, @kb_payment_method_id, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
32
+ lambda { @plugin.set_default_payment_method(@kb_account_id, @payment_method, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
32
33
 
33
- lambda { @plugin.get_payment_method_detail(@kb_account_id, @payment_method, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
34
- lambda { @plugin.get_payment_methods(@kb_account_id, true, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
35
- lambda { @plugin.reset_payment_methods(@kb_account_id, @payment_methods) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
34
+ lambda { @plugin.get_payment_method_detail(@kb_account_id, @payment_method, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
35
+ lambda { @plugin.get_payment_methods(@kb_account_id, true, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
36
+ lambda { @plugin.reset_payment_methods(@kb_account_id, @properties, @payment_methods) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
36
37
  end
37
38
  end
@@ -8,7 +8,7 @@ module Killbill
8
8
  @raise_exception = false
9
9
  end
10
10
 
11
- def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id, amount_in_cents, currency, options = {})
11
+ def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id, amount_in_cents, currency, properties, context)
12
12
  if @raise_exception
13
13
  raise StandardError.new("Test exception")
14
14
  else
@@ -19,7 +19,7 @@ module Killbill
19
19
  end
20
20
  end
21
21
 
22
- def get_payment_info(kb_account_id, kb_payment_id, options = {})
22
+ def get_payment_info(kb_account_id, kb_payment_id, properties, context)
23
23
  if @raise_exception
24
24
  raise StandardError.new("Test exception")
25
25
  else
@@ -30,7 +30,7 @@ module Killbill
30
30
  end
31
31
  end
32
32
 
33
- def process_refund(kb_account_id, kb_payment_id, amount_in_cents, currency, options = {})
33
+ def process_refund(kb_account_id, kb_payment_id, amount_in_cents, currency, properties, context)
34
34
  if @raise_exception
35
35
  raise StandardError.new("Test exception")
36
36
  else
@@ -41,19 +41,19 @@ module Killbill
41
41
  end
42
42
  end
43
43
 
44
- def add_payment_method(kb_account_id, kb_payment_method_id, payment_method_props, set_default, options = {})
44
+ def add_payment_method(kb_account_id, kb_payment_method_id, payment_method_props, set_default, properties, context)
45
45
  if @raise_exception
46
46
  raise StandardError.new("Test exception")
47
47
  end
48
48
  end
49
49
 
50
- def delete_payment_method(kb_account_id, kb_payment_method_id, options = {})
50
+ def delete_payment_method(kb_account_id, kb_payment_method_id, properties, context)
51
51
  if @raise_exception
52
52
  raise StandardError.new("Test exception")
53
53
  end
54
54
  end
55
55
 
56
- def get_payment_method_detail(kb_account_id, kb_payment_method_id, options = {})
56
+ def get_payment_method_detail(kb_account_id, kb_payment_method_id, properties, context)
57
57
  if @raise_exception
58
58
  raise StandardError.new("Test exception")
59
59
  else
@@ -63,13 +63,13 @@ module Killbill
63
63
  end
64
64
  end
65
65
 
66
- def set_default_payment_method(kb_account_id, kb_payment_method_id, options = {})
66
+ def set_default_payment_method(kb_account_id, kb_payment_method_id, properties, context)
67
67
  if @raise_exception
68
68
  raise StandardError.new("Test exception")
69
69
  end
70
70
  end
71
71
 
72
- def get_payment_methods(kb_account_id, refresh_from_gateway, options = {})
72
+ def get_payment_methods(kb_account_id, refresh_from_gateway, properties, context)
73
73
  if @raise_exception
74
74
  raise StandardError.new("Test exception")
75
75
  else
@@ -82,7 +82,7 @@ module Killbill
82
82
  end
83
83
  end
84
84
 
85
- def reset_payment_methods(kb_account_id, payment_methods)
85
+ def reset_payment_methods(kb_account_id, payment_methods, properties)
86
86
  if @raise_exception
87
87
  raise StandardError.new("Test exception")
88
88
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  require 'java'
4
2
 
5
3
  require 'bundler'
@@ -12,7 +10,7 @@ require 'killbill/http_servlet'
12
10
 
13
11
  require 'killbill/payment_test'
14
12
  require 'killbill/notification_test'
15
-
13
+ require 'killbill/helpers/active_merchant'
16
14
 
17
15
  %w(
18
16
  MockAccountUserApi
@@ -31,6 +29,13 @@ RSpec.configure do |config|
31
29
  config.formatter = 'documentation'
32
30
  end
33
31
 
32
+ require 'active_record'
33
+ ActiveRecord::Base.establish_connection(
34
+ :adapter => 'sqlite3',
35
+ :database => 'test.db'
36
+ )
37
+ require File.expand_path(File.dirname(__FILE__) + '/killbill/helpers/test_schema.rb')
38
+
34
39
  begin
35
40
  require 'securerandom'
36
41
  SecureRandom.uuid
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-08 00:00:00.000000000 Z
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -30,14 +30,56 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.37
33
+ version: 1.1.0
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: 0.3.37
38
+ version: 1.1.0
39
39
  prerelease: false
40
40
  type: :runtime
41
+ - !ruby/object:Gem::Dependency
42
+ name: activerecord
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 4.1.0
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ~>
51
+ - !ruby/object:Gem::Version
52
+ version: 4.1.0
53
+ prerelease: false
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ name: activerecord-jdbcsqlite3-adapter
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.7
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: 1.3.7
67
+ prerelease: false
68
+ type: :development
69
+ - !ruby/object:Gem::Dependency
70
+ name: activemerchant
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 1.36.0
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ~>
79
+ - !ruby/object:Gem::Version
80
+ version: 1.36.0
81
+ prerelease: false
82
+ type: :development
41
83
  - !ruby/object:Gem::Dependency
42
84
  name: jbundler
43
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -94,6 +136,20 @@ dependencies:
94
136
  version: 2.12.0
95
137
  prerelease: false
96
138
  type: :development
139
+ - !ruby/object:Gem::Dependency
140
+ name: thor
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: 0.19.1
146
+ requirement: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ~>
149
+ - !ruby/object:Gem::Version
150
+ version: 0.19.1
151
+ prerelease: false
152
+ type: :development
97
153
  description: Base classes to write plugins.
98
154
  email: killbilling-users@googlegroups.com
99
155
  executables: []
@@ -110,6 +166,35 @@ files:
110
166
  - VERSION
111
167
  - gen_config/api.conf
112
168
  - gen_config/plugin_api.conf
169
+ - generators/active_merchant/active_merchant_generator.rb
170
+ - generators/active_merchant/templates/.gitignore.rb
171
+ - generators/active_merchant/templates/.travis.yml.rb
172
+ - generators/active_merchant/templates/Gemfile.rb
173
+ - generators/active_merchant/templates/Jarfile.rb
174
+ - generators/active_merchant/templates/LICENSE.rb
175
+ - generators/active_merchant/templates/NEWS.rb
176
+ - generators/active_merchant/templates/Rakefile.rb
177
+ - generators/active_merchant/templates/VERSION.rb
178
+ - generators/active_merchant/templates/config.ru.rb
179
+ - generators/active_merchant/templates/config.yml.rb
180
+ - generators/active_merchant/templates/db/ddl.sql.rb
181
+ - generators/active_merchant/templates/db/schema.rb
182
+ - generators/active_merchant/templates/killbill.properties.rb
183
+ - generators/active_merchant/templates/lib/api.rb
184
+ - generators/active_merchant/templates/lib/application.rb
185
+ - generators/active_merchant/templates/lib/models/payment_method.rb
186
+ - generators/active_merchant/templates/lib/models/response.rb
187
+ - generators/active_merchant/templates/lib/models/transaction.rb
188
+ - generators/active_merchant/templates/lib/plugin.rb
189
+ - generators/active_merchant/templates/lib/private_api.rb
190
+ - generators/active_merchant/templates/lib/views/form.erb
191
+ - generators/active_merchant/templates/plugin.gemspec.rb
192
+ - generators/active_merchant/templates/pom.xml.rb
193
+ - generators/active_merchant/templates/release.sh.rb
194
+ - generators/active_merchant/templates/spec/base_plugin_spec.rb
195
+ - generators/active_merchant/templates/spec/integration_spec.rb
196
+ - generators/active_merchant/templates/spec/spec_helper.rb
197
+ - generators/killbill_generator.rb
113
198
  - killbill.gemspec
114
199
  - lib/killbill.rb
115
200
  - lib/killbill/creator.rb
@@ -124,6 +209,7 @@ files:
124
209
  - lib/killbill/gen/api/audit_log.rb
125
210
  - lib/killbill/gen/api/audit_user_api.rb
126
211
  - lib/killbill/gen/api/billing_exception_base.rb
212
+ - lib/killbill/gen/api/block.rb
127
213
  - lib/killbill/gen/api/blockable.rb
128
214
  - lib/killbill/gen/api/blocking_api_exception.rb
129
215
  - lib/killbill/gen/api/blocking_state.rb
@@ -141,6 +227,9 @@ files:
141
227
  - lib/killbill/gen/api/custom_field_api_exception.rb
142
228
  - lib/killbill/gen/api/custom_field_user_api.rb
143
229
  - lib/killbill/gen/api/database_export_output_stream.rb
230
+ - lib/killbill/gen/api/direct_payment.rb
231
+ - lib/killbill/gen/api/direct_payment_api.rb
232
+ - lib/killbill/gen/api/direct_payment_transaction.rb
144
233
  - lib/killbill/gen/api/duration.rb
145
234
  - lib/killbill/gen/api/entitlement.rb
146
235
  - lib/killbill/gen/api/entitlement_ao_status_dry_run.rb
@@ -148,6 +237,7 @@ files:
148
237
  - lib/killbill/gen/api/entitlement_api_exception.rb
149
238
  - lib/killbill/gen/api/entity.rb
150
239
  - lib/killbill/gen/api/enumerator_iterator.rb
240
+ - lib/killbill/gen/api/fixed.rb
151
241
  - lib/killbill/gen/api/illegal_plan_change.rb
152
242
  - lib/killbill/gen/api/international_price.rb
153
243
  - lib/killbill/gen/api/invalid_config_exception.rb
@@ -180,12 +270,14 @@ files:
180
270
  - lib/killbill/gen/api/plan_phase_specifier.rb
181
271
  - lib/killbill/gen/api/plan_specifier.rb
182
272
  - lib/killbill/gen/api/plugin_config_service_api.rb
273
+ - lib/killbill/gen/api/plugin_property.rb
183
274
  - lib/killbill/gen/api/price.rb
184
275
  - lib/killbill/gen/api/price_list.rb
185
276
  - lib/killbill/gen/api/price_list_set.rb
186
277
  - lib/killbill/gen/api/product.rb
187
278
  - lib/killbill/gen/api/rate.rb
188
279
  - lib/killbill/gen/api/record_id_api.rb
280
+ - lib/killbill/gen/api/recurring.rb
189
281
  - lib/killbill/gen/api/refund.rb
190
282
  - lib/killbill/gen/api/require_gen.rb
191
283
  - lib/killbill/gen/api/rolled_up_usage.rb
@@ -208,10 +300,18 @@ files:
208
300
  - lib/killbill/gen/api/tenant_data.rb
209
301
  - lib/killbill/gen/api/tenant_kv.rb
210
302
  - lib/killbill/gen/api/tenant_user_api.rb
303
+ - lib/killbill/gen/api/tier.rb
304
+ - lib/killbill/gen/api/tiered_block.rb
211
305
  - lib/killbill/gen/api/unit.rb
306
+ - lib/killbill/gen/api/usage.rb
212
307
  - lib/killbill/gen/api/usage_user_api.rb
308
+ - lib/killbill/gen/plugin-api/billing_address.rb
213
309
  - lib/killbill/gen/plugin-api/currency_plugin_api.rb
310
+ - lib/killbill/gen/plugin-api/customer.rb
214
311
  - lib/killbill/gen/plugin-api/ext_bus_event.rb
312
+ - lib/killbill/gen/plugin-api/hosted_payment_page_descriptor_fields.rb
313
+ - lib/killbill/gen/plugin-api/hosted_payment_page_form_descriptor.rb
314
+ - lib/killbill/gen/plugin-api/hosted_payment_page_notification.rb
215
315
  - lib/killbill/gen/plugin-api/notification_plugin_api.rb
216
316
  - lib/killbill/gen/plugin-api/payment_info_plugin.rb
217
317
  - lib/killbill/gen/plugin-api/payment_method_info_plugin.rb
@@ -219,6 +319,22 @@ files:
219
319
  - lib/killbill/gen/plugin-api/payment_plugin_api_exception.rb
220
320
  - lib/killbill/gen/plugin-api/refund_info_plugin.rb
221
321
  - lib/killbill/gen/plugin-api/require_gen.rb
322
+ - lib/killbill/helpers/active_merchant.rb
323
+ - lib/killbill/helpers/active_merchant/active_record.rb
324
+ - lib/killbill/helpers/active_merchant/active_record/models/helpers.rb
325
+ - lib/killbill/helpers/active_merchant/active_record/models/payment_method.rb
326
+ - lib/killbill/helpers/active_merchant/active_record/models/response.rb
327
+ - lib/killbill/helpers/active_merchant/active_record/models/streamy_result_set.rb
328
+ - lib/killbill/helpers/active_merchant/active_record/models/transaction.rb
329
+ - lib/killbill/helpers/active_merchant/configuration.rb
330
+ - lib/killbill/helpers/active_merchant/core_ext.rb
331
+ - lib/killbill/helpers/active_merchant/gateway.rb
332
+ - lib/killbill/helpers/active_merchant/killbill_spec_helper.rb
333
+ - lib/killbill/helpers/active_merchant/payment_plugin.rb
334
+ - lib/killbill/helpers/active_merchant/private_payment_plugin.rb
335
+ - lib/killbill/helpers/active_merchant/properties.rb
336
+ - lib/killbill/helpers/active_merchant/sinatra.rb
337
+ - lib/killbill/helpers/active_merchant/utils.rb
222
338
  - lib/killbill/http_servlet.rb
223
339
  - lib/killbill/jnotification.rb
224
340
  - lib/killbill/jplugin.rb
@@ -228,8 +344,13 @@ files:
228
344
  - lib/killbill/payment.rb
229
345
  - lib/killbill/plugin.rb
230
346
  - lib/killbill/rake_task.rb
347
+ - script/generate
231
348
  - spec/killbill/base_plugin_spec.rb
232
349
  - spec/killbill/config_test.ru
350
+ - spec/killbill/helpers/payment_method_spec.rb
351
+ - spec/killbill/helpers/response_spec.rb
352
+ - spec/killbill/helpers/test_schema.rb
353
+ - spec/killbill/helpers/utils_spec.rb
233
354
  - spec/killbill/killbill_integration_spec.rb
234
355
  - spec/killbill/killbillapi_spec.rb
235
356
  - spec/killbill/notification_plugin_api_spec.rb
@@ -264,13 +385,17 @@ requirements:
264
385
  - jar 'org.kill-bill.billing:killbill-api'
265
386
  - jar 'org.kill-bill.billing:killbill-util:tests'
266
387
  rubyforge_project:
267
- rubygems_version: 2.1.9
388
+ rubygems_version: 2.2.2
268
389
  signing_key:
269
390
  specification_version: 4
270
391
  summary: Framework to write Kill Bill plugins in Ruby.
271
392
  test_files:
272
393
  - spec/killbill/base_plugin_spec.rb
273
394
  - spec/killbill/config_test.ru
395
+ - spec/killbill/helpers/payment_method_spec.rb
396
+ - spec/killbill/helpers/response_spec.rb
397
+ - spec/killbill/helpers/test_schema.rb
398
+ - spec/killbill/helpers/utils_spec.rb
274
399
  - spec/killbill/killbill_integration_spec.rb
275
400
  - spec/killbill/killbillapi_spec.rb
276
401
  - spec/killbill/notification_plugin_api_spec.rb