kaui 0.14.2 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/Gemfile +1 -1
  4. data/README.md +23 -6
  5. data/app/assets/javascripts/application.js +1 -0
  6. data/app/assets/stylesheets/application.css +1 -0
  7. data/app/assets/stylesheets/kaui/header.less +11 -4
  8. data/app/controllers/kaui/accounts_controller.rb +1 -1
  9. data/app/controllers/kaui/admin_tenants_controller.rb +113 -18
  10. data/app/controllers/kaui/bundles_controller.rb +0 -2
  11. data/app/controllers/kaui/chargebacks_controller.rb +1 -1
  12. data/app/controllers/kaui/charges_controller.rb +1 -1
  13. data/app/controllers/kaui/engine_controller.rb +5 -2
  14. data/app/controllers/kaui/invoices_controller.rb +1 -1
  15. data/app/controllers/kaui/payment_methods_controller.rb +1 -1
  16. data/app/controllers/kaui/payments_controller.rb +20 -2
  17. data/app/controllers/kaui/refunds_controller.rb +1 -1
  18. data/app/controllers/kaui/subscriptions_controller.rb +8 -13
  19. data/app/helpers/kaui/account_helper.rb +9 -0
  20. data/app/helpers/kaui/subscription_helper.rb +47 -21
  21. data/app/models/kaui/admin_tenant.rb +96 -2
  22. data/app/models/kaui/bundle.rb +1 -1
  23. data/app/models/kaui/catalog.rb +138 -0
  24. data/app/models/kaui/invoice_payment.rb +39 -5
  25. data/app/models/kaui/overdue.rb +85 -0
  26. data/app/models/kaui/simple_plan.rb +4 -0
  27. data/app/models/kaui/transaction.rb +2 -0
  28. data/app/views/kaui/account_timelines/show.html.erb +2 -1
  29. data/app/views/kaui/accounts/_billing_info.html.erb +18 -20
  30. data/app/views/kaui/accounts/_payment_methods.html.erb +11 -16
  31. data/app/views/kaui/admin_tenants/_form_catalog_translation.erb +24 -0
  32. data/app/views/kaui/admin_tenants/_form_invoice_template.erb +28 -0
  33. data/app/views/kaui/admin_tenants/_form_invoice_translation.erb +24 -0
  34. data/app/views/kaui/admin_tenants/_form_plugin_config.erb +199 -0
  35. data/app/views/kaui/admin_tenants/_show_catalog.erb +25 -0
  36. data/app/views/kaui/admin_tenants/_show_catalog_simple.erb +96 -0
  37. data/app/views/kaui/admin_tenants/_show_catalog_xml.erb +44 -0
  38. data/app/views/kaui/admin_tenants/_show_overdue.erb +89 -0
  39. data/app/views/kaui/admin_tenants/new_catalog.html.erb +176 -0
  40. data/app/views/kaui/admin_tenants/new_overdue_config.html.erb +138 -0
  41. data/app/views/kaui/admin_tenants/new_plan_currency.html.erb +34 -0
  42. data/app/views/kaui/admin_tenants/show.html.erb +20 -127
  43. data/app/views/kaui/bundles/index.html.erb +1 -1
  44. data/app/views/kaui/invoice_items/_edit_form.html.erb +1 -0
  45. data/app/views/kaui/layouts/kaui_account_navbar.html.erb +2 -0
  46. data/app/views/kaui/payments/_payment_table.html.erb +16 -5
  47. data/app/views/kaui/refunds/_form.html.erb +4 -5
  48. data/app/views/kaui/subscriptions/_edit_form.html.erb +48 -1
  49. data/app/views/kaui/subscriptions/_form.html.erb +36 -0
  50. data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +12 -9
  51. data/config/routes.rb +8 -0
  52. data/db/ddl.sql +5 -2
  53. data/kaui.gemspec +3 -2
  54. data/lib/kaui/engine.rb +1 -0
  55. data/lib/kaui/version.rb +1 -1
  56. data/test/dummy/config/environments/development.rb +1 -1
  57. data/test/dummy/db/schema.rb +5 -5
  58. data/test/functional/kaui/account_emails_controller_test.rb +2 -2
  59. data/test/functional/kaui/accounts_controller_test.rb +4 -4
  60. data/test/functional/kaui/admin_tenants_controller_test.rb +5 -1
  61. data/test/functional/kaui/bundle_tags_controller_test.rb +1 -1
  62. data/test/functional/kaui/bundles_controller_test.rb +4 -4
  63. data/test/functional/kaui/chargebacks_controller_test.rb +2 -2
  64. data/test/functional/kaui/charges_controller_test.rb +2 -2
  65. data/test/functional/kaui/credits_controller_test.rb +2 -2
  66. data/test/functional/kaui/invoice_items_controller_test.rb +6 -4
  67. data/test/functional/kaui/invoices_controller_test.rb +2 -2
  68. data/test/functional/kaui/payments_controller_test.rb +4 -0
  69. data/test/functional/kaui/refunds_controller_test.rb +2 -2
  70. data/test/functional/kaui/subscriptions_controller_test.rb +6 -6
  71. data/test/killbill_test_helper.rb +7 -7
  72. metadata +47 -8
  73. data/db/migrate/20130812155313_devise_create_kaui_users.rb +0 -12
  74. data/db/migrate/20150109214021_create_kaui_tenants.rb +0 -12
  75. data/db/migrate/20150112232813_create_kaui_allowed_users.rb +0 -19
data/lib/kaui/engine.rb CHANGED
@@ -5,6 +5,7 @@
5
5
  #
6
6
  # See also https://github.com/carlhuda/bundler/issues/49
7
7
  require 'jquery-rails'
8
+ require 'jquery-ui-rails'
8
9
  require 'jquery-datatables-rails'
9
10
  require 'bootstrap-datepicker-rails'
10
11
  require 'd3_rails'
data/lib/kaui/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kaui
2
- VERSION = '0.14.2'
2
+ VERSION = '0.15.0'
3
3
  end
@@ -25,7 +25,7 @@ Dummy::Application.configure do
25
25
  config.assets.compress = false
26
26
 
27
27
  # Expands the lines which load the assets
28
- config.assets.debug = true
28
+ config.assets.debug = false
29
29
 
30
30
  config.eager_load = false
31
31
 
@@ -11,13 +11,13 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150112232813) do
14
+ ActiveRecord::Schema.define(version: 20151010235259) do
15
15
 
16
16
  create_table "kaui_allowed_user_tenants", force: :cascade do |t|
17
- t.integer "kaui_allowed_user_id", limit: 11
18
- t.integer "kaui_tenant_id", limit: 11
19
- t.datetime "created_at", null: false
20
- t.datetime "updated_at", null: false
17
+ t.integer "kaui_allowed_user_id", limit: 4
18
+ t.integer "kaui_tenant_id", limit: 4
19
+ t.datetime "created_at", null: false
20
+ t.datetime "updated_at", null: false
21
21
  end
22
22
 
23
23
  add_index "kaui_allowed_user_tenants", ["kaui_allowed_user_id", "kaui_tenant_id"], name: "kaui_allowed_user_tenants_uniq", unique: true, using: :btree
@@ -23,8 +23,8 @@ class Kaui::AccountEmailsControllerTest < Kaui::FunctionalTestHelper
23
23
  :account_email => {
24
24
  :email => 'toto@example.com'
25
25
  }
26
- assert_template :new
27
- assert_equal "Error while adding the email: Error 404: Account does not exist for id #{account_id}", flash[:error]
26
+ assert_redirected_to account_path(account_id)
27
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{account_id} type=ACCOUNT doesn't exist!", flash[:error]
28
28
  end
29
29
 
30
30
  test 'should handle Kill Bill errors during deletion' do
@@ -23,7 +23,7 @@ class Kaui::AccountsControllerTest < Kaui::FunctionalTestHelper
23
23
  account_id = SecureRandom.uuid.to_s
24
24
  get :show, :account_id => account_id
25
25
  assert_redirected_to home_path
26
- assert_equal "Error while communicating with the Kill Bill server: Error 404: Account does not exist for id #{account_id}", flash[:error]
26
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{account_id} type=ACCOUNT doesn't exist!", flash[:error]
27
27
  end
28
28
 
29
29
  test 'should find account by id' do
@@ -97,7 +97,7 @@ class Kaui::AccountsControllerTest < Kaui::FunctionalTestHelper
97
97
  account_id = SecureRandom.uuid.to_s
98
98
  put :set_default_payment_method, :account_id => account_id, :payment_method_id => @payment_method.payment_method_id
99
99
  assert_redirected_to home_path
100
- assert_equal "Error while communicating with the Kill Bill server: Error 404: Account does not exist for id #{account_id}", flash[:error]
100
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{account_id} type=ACCOUNT doesn't exist!", flash[:error]
101
101
  end
102
102
 
103
103
  test 'should set default payment method' do
@@ -109,7 +109,7 @@ class Kaui::AccountsControllerTest < Kaui::FunctionalTestHelper
109
109
  account_id = SecureRandom.uuid.to_s
110
110
  put :toggle_email_notifications, :account_id => account_id, :is_notified => true
111
111
  assert_redirected_to home_path
112
- assert_equal "Error while communicating with the Kill Bill server: Error 404: Account does not exist for id #{account_id}", flash[:error]
112
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{account_id} type=ACCOUNT doesn't exist!", flash[:error]
113
113
  end
114
114
 
115
115
  test 'should toggle email notifications' do
@@ -121,7 +121,7 @@ class Kaui::AccountsControllerTest < Kaui::FunctionalTestHelper
121
121
  account_id = SecureRandom.uuid.to_s
122
122
  post :pay_all_invoices, :account_id => account_id
123
123
  assert_redirected_to home_path
124
- assert_equal "Error while communicating with the Kill Bill server: Error 404: Account does not exist for id #{account_id}", flash[:error]
124
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{account_id} type=ACCOUNT doesn't exist!", flash[:error]
125
125
  end
126
126
 
127
127
  test 'should pay all invoices' do
@@ -88,7 +88,11 @@ class Kaui::AdminTenantsControllerTest < Kaui::FunctionalTestHelper
88
88
 
89
89
  test 'should upload plugin config' do
90
90
  tenant = create_kaui_tenant
91
- post :upload_plugin_config, :id => tenant.id, :plugin_name => 'killbill-stripe', :plugin_config => fixture_file_upload('stripe.yml')
91
+
92
+ stripe_yml = YAML.load_file(File.join(self.class.fixture_path, 'stripe.yml'))[:stripe]
93
+ stripe_yml.stringify_keys!
94
+ stripe_yml.each { |k, v| stripe_yml[k] = v.to_s }
95
+ post :upload_plugin_config, :id => tenant.id, :plugin_name => 'killbill-stripe', :plugin_type => 'ruby', :plugin_properties => stripe_yml
92
96
 
93
97
  assert_redirected_to admin_tenant_path(tenant.id)
94
98
  assert_equal 'Config for plugin was successfully uploaded', flash[:notice]
@@ -10,7 +10,7 @@ class Kaui::BundleTagsControllerTest < Kaui::FunctionalTestHelper
10
10
  bundle_id = SecureRandom.uuid.to_s
11
11
  get :edit, :account_id => @account.account_id, :bundle_id => bundle_id
12
12
  assert_redirected_to account_path(@account.account_id)
13
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{bundle_id} type=BUNDLE doesn't exist!", flash[:error]
13
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{bundle_id} type=BUNDLE doesn't exist!", flash[:error]
14
14
  end
15
15
 
16
16
  test 'should get edit' do
@@ -6,7 +6,7 @@ class Kaui::BundlesControllerTest < Kaui::FunctionalTestHelper
6
6
  account_id = SecureRandom.uuid.to_s
7
7
  get :index, :account_id => account_id
8
8
  assert_redirected_to account_path(account_id)
9
- assert_equal "Error while communicating with the Kill Bill server: Error 404: Account does not exist for id #{account_id}", flash[:error]
9
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{account_id} type=ACCOUNT doesn't exist!", flash[:error]
10
10
  end
11
11
 
12
12
  test 'should get index with existing tags' do
@@ -35,12 +35,12 @@ class Kaui::BundlesControllerTest < Kaui::FunctionalTestHelper
35
35
  new_account_key = SecureRandom.uuid.to_s
36
36
  post :do_transfer, :id => @bundle.bundle_id, :new_account_key => new_account_key
37
37
  assert_redirected_to home_path
38
- assert_equal "Error while communicating with the Kill Bill server: Error 404: Account does not exist for id #{new_account_key}", flash[:error]
38
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{new_account_key} type=ACCOUNT doesn't exist!", flash[:error]
39
39
 
40
40
  bundle_id = SecureRandom.uuid.to_s
41
41
  post :do_transfer, :id => bundle_id, :new_account_key => @account2.external_key
42
42
  assert_redirected_to home_path
43
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{bundle_id} type=BUNDLE doesn't exist!", flash[:error]
43
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{bundle_id} type=BUNDLE doesn't exist!", flash[:error]
44
44
  end
45
45
 
46
46
  test 'should get transfer' do
@@ -97,6 +97,6 @@ class Kaui::BundlesControllerTest < Kaui::FunctionalTestHelper
97
97
  end
98
98
 
99
99
  def check_bundle_owner(new_owner)
100
- assert_equal new_owner, Kaui::Bundle.find_by_external_key(@bundle.external_key, options).account_id
100
+ assert_equal new_owner, Kaui::Bundle.find_by_external_key(@bundle.external_key, false, options).account_id
101
101
  end
102
102
  end
@@ -6,7 +6,7 @@ class Kaui::ChargebacksControllerTest < Kaui::FunctionalTestHelper
6
6
  payment_id = SecureRandom.uuid.to_s
7
7
  get :new, :account_id => @account.account_id, :payment_id => payment_id
8
8
  assert_redirected_to account_path(@account.account_id)
9
- assert_equal "Error while communicating with the Kill Bill server: Error 404: Payment #{payment_id} does not exist", flash[:error]
9
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{payment_id} type=PAYMENT doesn't exist!", flash[:error]
10
10
  end
11
11
 
12
12
  test 'should get new' do
@@ -24,7 +24,7 @@ class Kaui::ChargebacksControllerTest < Kaui::FunctionalTestHelper
24
24
  :currency => @payment.currency
25
25
  }
26
26
  assert_template :new
27
- assert_equal "Error while creating a new chargeback: Error 404: Payment #{payment_id} does not exist", flash[:error]
27
+ assert_equal "Error while creating a new chargeback: Error 404: Object id=#{payment_id} type=PAYMENT doesn't exist!", flash[:error]
28
28
  end
29
29
 
30
30
  test 'should create chargeback' do
@@ -6,7 +6,7 @@ class Kaui::ChargesControllerTest < Kaui::FunctionalTestHelper
6
6
  invoice_id = SecureRandom.uuid.to_s
7
7
  get :new, :account_id => @account.account_id, :invoice_id => invoice_id
8
8
  assert_redirected_to account_path(@account.account_id)
9
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
9
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
10
10
  end
11
11
 
12
12
  test 'should get new for new invoice' do
@@ -30,7 +30,7 @@ class Kaui::ChargesControllerTest < Kaui::FunctionalTestHelper
30
30
  :description => SecureRandom.uuid
31
31
  }
32
32
  assert_redirected_to account_path(@account.account_id)
33
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
33
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
34
34
  end
35
35
 
36
36
  test 'should create charge' do
@@ -6,7 +6,7 @@ class Kaui::CreditsControllerTest < Kaui::FunctionalTestHelper
6
6
  invoice_id = SecureRandom.uuid.to_s
7
7
  get :new, :account_id => @account.account_id, :invoice_id => invoice_id
8
8
  assert_redirected_to account_path(@account.account_id)
9
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
9
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
10
10
  end
11
11
 
12
12
  test 'should get new for new invoice' do
@@ -28,7 +28,7 @@ class Kaui::CreditsControllerTest < Kaui::FunctionalTestHelper
28
28
  :credit_amount => 5.34
29
29
  }
30
30
  assert_redirected_to account_path(@account.account_id)
31
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
31
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
32
32
  end
33
33
 
34
34
  test 'should create credit' do
@@ -10,7 +10,7 @@ class Kaui::InvoiceItemsControllerTest < Kaui::FunctionalTestHelper
10
10
  invoice_id = SecureRandom.uuid.to_s
11
11
  get :edit, :account_id => @account.account_id, :id => @invoice_item.invoice_item_id, :invoice_id => invoice_id
12
12
  assert_redirected_to account_path(@account.account_id)
13
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
13
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
14
14
 
15
15
  invoice_item_id = SecureRandom.uuid.to_s
16
16
  get :edit, :account_id => @account.account_id, :id => invoice_item_id, :invoice_id => @invoice_item.invoice_id
@@ -32,10 +32,11 @@ class Kaui::InvoiceItemsControllerTest < Kaui::FunctionalTestHelper
32
32
  :account_id => @account.account_id,
33
33
  :invoice_id => invoice_id,
34
34
  :invoice_item_id => @invoice_item.invoice_item_id,
35
- :amount => 5.34
35
+ :amount => 5.34,
36
+ :currency => :USD
36
37
  }
37
38
  assert_template :edit
38
- assert_equal "Error while adjusting invoice item: Error 500: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
39
+ assert_equal "Error while adjusting invoice item: Error 404: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
39
40
  end
40
41
 
41
42
  test 'should adjust invoice item' do
@@ -45,7 +46,8 @@ class Kaui::InvoiceItemsControllerTest < Kaui::FunctionalTestHelper
45
46
  :account_id => @account.account_id,
46
47
  :invoice_id => @invoice_item.invoice_id,
47
48
  :invoice_item_id => @invoice_item.invoice_item_id,
48
- :amount => 5.34
49
+ :amount => 5.34,
50
+ :currency => :USD
49
51
  }
50
52
  assert_redirected_to account_invoice_path(@account.account_id, assigns(:invoice_item).invoice_id)
51
53
  assert_equal 'Adjustment item was successfully created', flash[:notice]
@@ -23,7 +23,7 @@ class Kaui::InvoicesControllerTest < Kaui::FunctionalTestHelper
23
23
  invoice_id = SecureRandom.uuid.to_s
24
24
  get :show, :account_id => @invoice_item.account_id, :id => invoice_id
25
25
  assert_redirected_to account_path(@invoice_item.account_id)
26
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
26
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
27
27
  end
28
28
 
29
29
  test 'should find unpaid invoice by id' do
@@ -65,7 +65,7 @@ class Kaui::InvoicesControllerTest < Kaui::FunctionalTestHelper
65
65
  invoice_id = SecureRandom.uuid.to_s
66
66
  get :show_html, :id => invoice_id
67
67
  assert_redirected_to home_path
68
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
68
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
69
69
  end
70
70
 
71
71
  test 'should expose restful endpoint' do
@@ -37,5 +37,9 @@ class Kaui::PaymentsControllerTest < Kaui::FunctionalTestHelper
37
37
  test 'should expose restful endpoint' do
38
38
  get :restful_show, :id => @payment.payment_id
39
39
  assert_redirected_to account_payment_path(@payment.account_id, @payment.payment_id)
40
+
41
+ # Search by external_key
42
+ get :restful_show, :id => @payment.payment_external_key
43
+ assert_redirected_to account_payment_path(@payment.account_id, @payment.payment_id)
40
44
  end
41
45
  end
@@ -6,12 +6,12 @@ class Kaui::RefundsControllerTest < Kaui::FunctionalTestHelper
6
6
  invoice_id = SecureRandom.uuid.to_s
7
7
  get :new, :account_id => @account.account_id, :invoice_id => invoice_id, :payment_id => @payment.payment_id
8
8
  assert_redirected_to account_path(@account.account_id)
9
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
9
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{invoice_id} type=INVOICE doesn't exist!", flash[:error]
10
10
 
11
11
  payment_id = SecureRandom.uuid.to_s
12
12
  get :new, :account_id => @account.account_id, :invoice_id => @paid_invoice_item.invoice_id, :payment_id => payment_id
13
13
  assert_redirected_to account_path(@account.account_id)
14
- assert_equal "Error while communicating with the Kill Bill server: Error 404: Payment #{payment_id} does not exist", flash[:error]
14
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{payment_id} type=PAYMENT doesn't exist!", flash[:error]
15
15
  end
16
16
 
17
17
  test 'should get new' do
@@ -6,7 +6,7 @@ class Kaui::SubscriptionsControllerTest < Kaui::FunctionalTestHelper
6
6
  bundle_id = SecureRandom.uuid.to_s
7
7
  get :new, :bundle_id => bundle_id, :account_id => @account.account_id, :product_category => 'ADD_ON'
8
8
  assert_redirected_to account_path(@account.account_id)
9
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{bundle_id} type=BUNDLE doesn't exist!", flash[:error]
9
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{bundle_id} type=BUNDLE doesn't exist!", flash[:error]
10
10
  end
11
11
 
12
12
  test 'should get new page for base plan' do
@@ -75,7 +75,7 @@ class Kaui::SubscriptionsControllerTest < Kaui::FunctionalTestHelper
75
75
  subscription_id = SecureRandom.uuid.to_s
76
76
  get :edit, :id => subscription_id
77
77
  assert_redirected_to home_path
78
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{subscription_id} type=SUBSCRIPTION doesn't exist!", flash[:error]
78
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{subscription_id} type=SUBSCRIPTION doesn't exist!", flash[:error]
79
79
  end
80
80
 
81
81
  test 'should get edit page' do
@@ -94,11 +94,11 @@ class Kaui::SubscriptionsControllerTest < Kaui::FunctionalTestHelper
94
94
  subscription_id = SecureRandom.uuid.to_s
95
95
  post :update, :id => subscription_id, :plan_name => 'super-monthly'
96
96
  assert_redirected_to home_path
97
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{subscription_id} type=SUBSCRIPTION doesn't exist!", flash[:error]
97
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{subscription_id} type=SUBSCRIPTION doesn't exist!", flash[:error]
98
98
 
99
99
  post :update, :id => @bundle.subscriptions.first.subscription_id, :plan_name => 'not-exists'
100
100
  assert_redirected_to home_path
101
- assert_equal 'Error: Unable to find plan not-exists', flash[:error]
101
+ assert_equal "Error while communicating with the Kill Bill server: Error 400: Could not find any plans named 'not-exists'", flash[:error]
102
102
  end
103
103
 
104
104
  test 'should update' do
@@ -112,14 +112,14 @@ class Kaui::SubscriptionsControllerTest < Kaui::FunctionalTestHelper
112
112
  subscription_id = SecureRandom.uuid.to_s
113
113
  delete :destroy, :id => subscription_id, :plan_name => 'super-monthly'
114
114
  assert_redirected_to home_path
115
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{subscription_id} type=SUBSCRIPTION doesn't exist!", flash[:error]
115
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{subscription_id} type=SUBSCRIPTION doesn't exist!", flash[:error]
116
116
  end
117
117
 
118
118
  test 'should handle errors during reinstate' do
119
119
  subscription_id = SecureRandom.uuid.to_s
120
120
  put :reinstate, :id => subscription_id
121
121
  assert_redirected_to home_path
122
- assert_equal "Error while communicating with the Kill Bill server: Error 500: Object id=#{subscription_id} type=SUBSCRIPTION doesn't exist!", flash[:error]
122
+ assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{subscription_id} type=SUBSCRIPTION doesn't exist!", flash[:error]
123
123
  end
124
124
 
125
125
  test 'should cancel and reinstate subscription' do
@@ -27,10 +27,10 @@ module Kaui
27
27
  @account2 = create_account(@tenant)
28
28
  @bundle = create_bundle(@account, @tenant)
29
29
  @invoice_item = create_charge(@account, @tenant)
30
- @paid_invoice_item = create_charge(@account, @tenant)
30
+ @paid_invoice_item = create_charge(@account, @tenant, true)
31
31
  @bundle_invoice = @account.invoices(true, build_options(@tenant)).first
32
32
  @payment_method = create_payment_method(true, @account, @tenant)
33
- @cba = create_cba(@invoice_item.invoice_id, @account, @tenant)
33
+ @cba = create_cba(@invoice_item.invoice_id, @account, @tenant, true)
34
34
  @payment = create_payment(@paid_invoice_item, @account, @tenant)
35
35
 
36
36
  if setup_tenant_key_secret
@@ -126,7 +126,7 @@ module Kaui
126
126
  end
127
127
 
128
128
  # Return the created external charge
129
- def create_charge(account = nil, tenant = nil, username = USERNAME, password = PASSWORD, user = 'Kaui test', reason = nil, comment = nil)
129
+ def create_charge(account = nil, tenant = nil, auto_commit=false, username = USERNAME, password = PASSWORD, user = 'Kaui test', reason = nil, comment = nil)
130
130
  tenant = create_tenant(user, reason, comment) if tenant.nil?
131
131
  account = create_account(tenant, username, password, user, reason, comment) if account.nil?
132
132
 
@@ -135,13 +135,13 @@ module Kaui
135
135
  invoice_item.currency = account.currency
136
136
  invoice_item.amount = 123.98
137
137
 
138
- invoice_item.create(user, reason, comment, build_options(tenant, username, password))
138
+ invoice_item.create(auto_commit, user, reason, comment, build_options(tenant, username, password))
139
139
  rescue
140
140
  nil
141
141
  end
142
142
 
143
143
  # Return the created credit
144
- def create_cba(invoice_id = nil, account = nil, tenant = nil, username = USERNAME, password = PASSWORD, user = 'Kaui test', reason = nil, comment = nil)
144
+ def create_cba(invoice_id = nil, account = nil, tenant = nil, auto_commit=false, username = USERNAME, password = PASSWORD, user = 'Kaui test', reason = nil, comment = nil)
145
145
  tenant = create_tenant(user, reason, comment) if tenant.nil?
146
146
  account = create_account(tenant, username, password, user, reason, comment) if account.nil?
147
147
 
@@ -155,7 +155,7 @@ module Kaui
155
155
  def create_payment(invoice_item = nil, account = nil, tenant = nil, username = USERNAME, password = PASSWORD, user = 'Kaui test', reason = nil, comment = nil)
156
156
  tenant = create_tenant(user, reason, comment) if tenant.nil?
157
157
  account = create_account(tenant, username, password, user, reason, comment) if account.nil?
158
- invoice_item = create_charge(account, tenant, username, password, user, reason, comment) if invoice_item.nil?
158
+ invoice_item = create_charge(account, tenant, true, username, password, user, reason, comment) if invoice_item.nil?
159
159
 
160
160
  payment = Kaui::InvoicePayment.new({:account_id => account.account_id, :target_invoice_id => invoice_item.invoice_id, :purchased_amount => invoice_item.amount})
161
161
  payment.create(true, user, reason, comment, build_options(tenant, username, password))
@@ -170,7 +170,7 @@ module Kaui
170
170
  tenant.api_key = api_key
171
171
  tenant.api_secret = api_secret
172
172
 
173
- tenant = tenant.create(user, reason, comment, build_options)
173
+ tenant = tenant.create(true, user, reason, comment, build_options)
174
174
 
175
175
  # Re-hydrate the secret, which is not returned
176
176
  tenant.api_secret = api_secret
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Killbill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-18 00:00:00.000000000 Z
11
+ date: 2016-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,6 +66,20 @@ dependencies:
66
66
  version: 3.0.4
67
67
  prerelease: false
68
68
  type: :runtime
69
+ - !ruby/object:Gem::Dependency
70
+ name: jquery-ui-rails
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 5.0.5
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ~>
79
+ - !ruby/object:Gem::Version
80
+ version: 5.0.5
81
+ prerelease: false
82
+ type: :runtime
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: jquery-datatables-rails
71
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -114,12 +128,12 @@ dependencies:
114
128
  requirements:
115
129
  - - ~>
116
130
  - !ruby/object:Gem::Version
117
- version: '0.22'
131
+ version: '1.0'
118
132
  requirement: !ruby/object:Gem::Requirement
119
133
  requirements:
120
134
  - - ~>
121
135
  - !ruby/object:Gem::Version
122
- version: '0.22'
136
+ version: '1.0'
123
137
  prerelease: false
124
138
  type: :runtime
125
139
  - !ruby/object:Gem::Dependency
@@ -248,6 +262,20 @@ dependencies:
248
262
  version: 1.0.0.pre1
249
263
  prerelease: false
250
264
  type: :runtime
265
+ - !ruby/object:Gem::Dependency
266
+ name: sprockets-rails
267
+ version_requirements: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - '='
270
+ - !ruby/object:Gem::Version
271
+ version: 2.3.3
272
+ requirement: !ruby/object:Gem::Requirement
273
+ requirements:
274
+ - - '='
275
+ - !ruby/object:Gem::Version
276
+ version: 2.3.3
277
+ prerelease: false
278
+ type: :runtime
251
279
  - !ruby/object:Gem::Dependency
252
280
  name: fakeweb
253
281
  version_requirements: !ruby/object:Gem::Requirement
@@ -450,6 +478,7 @@ files:
450
478
  - app/controllers/kaui/tags_controller.rb
451
479
  - app/controllers/kaui/tenants_controller.rb
452
480
  - app/controllers/kaui/transactions_controller.rb
481
+ - app/helpers/kaui/account_helper.rb
453
482
  - app/helpers/kaui/application_helper.rb
454
483
  - app/helpers/kaui/date_helper.rb
455
484
  - app/helpers/kaui/home_helper.rb
@@ -477,11 +506,13 @@ files:
477
506
  - app/models/kaui/invoice_payment.rb
478
507
  - app/models/kaui/killbill_authenticatable.rb
479
508
  - app/models/kaui/killbill_registerable.rb
509
+ - app/models/kaui/overdue.rb
480
510
  - app/models/kaui/payment.rb
481
511
  - app/models/kaui/payment_method.rb
482
512
  - app/models/kaui/payment_state.rb
483
513
  - app/models/kaui/rails_methods.rb
484
514
  - app/models/kaui/refund.rb
515
+ - app/models/kaui/simple_plan.rb
485
516
  - app/models/kaui/subscription.rb
486
517
  - app/models/kaui/tag.rb
487
518
  - app/models/kaui/tag_definition.rb
@@ -508,9 +539,20 @@ files:
508
539
  - app/views/kaui/admin_allowed_users/new.html.erb
509
540
  - app/views/kaui/admin_allowed_users/show.html.erb
510
541
  - app/views/kaui/admin_tenants/_form.html.erb
542
+ - app/views/kaui/admin_tenants/_form_catalog_translation.erb
543
+ - app/views/kaui/admin_tenants/_form_invoice_template.erb
544
+ - app/views/kaui/admin_tenants/_form_invoice_translation.erb
545
+ - app/views/kaui/admin_tenants/_form_plugin_config.erb
546
+ - app/views/kaui/admin_tenants/_show_catalog.erb
547
+ - app/views/kaui/admin_tenants/_show_catalog_simple.erb
548
+ - app/views/kaui/admin_tenants/_show_catalog_xml.erb
549
+ - app/views/kaui/admin_tenants/_show_overdue.erb
511
550
  - app/views/kaui/admin_tenants/_tenants_table.html.erb
512
551
  - app/views/kaui/admin_tenants/index.html.erb
513
552
  - app/views/kaui/admin_tenants/new.html.erb
553
+ - app/views/kaui/admin_tenants/new_catalog.html.erb
554
+ - app/views/kaui/admin_tenants/new_overdue_config.html.erb
555
+ - app/views/kaui/admin_tenants/new_plan_currency.html.erb
514
556
  - app/views/kaui/admin_tenants/show.html.erb
515
557
  - app/views/kaui/bundle_tags/_form.html.erb
516
558
  - app/views/kaui/bundle_tags/_form_bar.html.erb
@@ -581,9 +623,6 @@ files:
581
623
  - config/routes.rb
582
624
  - config/symmetric-encryption.yml
583
625
  - db/ddl.sql
584
- - db/migrate/20130812155313_devise_create_kaui_users.rb
585
- - db/migrate/20150109214021_create_kaui_tenants.rb
586
- - db/migrate/20150112232813_create_kaui_allowed_users.rb
587
626
  - db/schema.rb
588
627
  - kaui.gemspec
589
628
  - lib/generators/kaui/install/install_generator.rb
@@ -699,7 +738,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
699
738
  version: '0'
700
739
  requirements: []
701
740
  rubyforge_project:
702
- rubygems_version: 2.1.9
741
+ rubygems_version: 2.4.6
703
742
  signing_key:
704
743
  specification_version: 4
705
744
  summary: Killbill Admin UI mountable engine
@@ -1,12 +0,0 @@
1
- class DeviseCreateKauiUsers < ActiveRecord::Migration
2
- def change
3
- create_table(:kaui_users) do |t|
4
- # From Kill Bill
5
- t.string :kb_username, :null => false
6
- t.string :kb_session_id, :null => true
7
- t.timestamps
8
- end
9
-
10
- add_index :kaui_users, [:kb_username], :unique => true
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- class CreateKauiTenants < ActiveRecord::Migration
2
- def change
3
- create_table :kaui_tenants do |t|
4
- t.string :name
5
- t.string :kb_tenant_id
6
- t.string :api_key
7
- t.string :encrypted_api_secret
8
-
9
- t.timestamps
10
- end
11
- end
12
- end
@@ -1,19 +0,0 @@
1
- class CreateKauiAllowedUsers < ActiveRecord::Migration
2
- def change
3
- create_table :kaui_allowed_users do |t|
4
- t.string :kb_username
5
- t.string :description
6
- t.timestamps
7
- end
8
-
9
- add_index :kaui_allowed_users, [:kb_username], :unique => true
10
-
11
- create_table :kaui_allowed_user_tenants do |t|
12
- t.belongs_to :kaui_allowed_user
13
- t.belongs_to :kaui_tenant
14
- t.timestamps null: false
15
- end
16
-
17
- add_index :kaui_allowed_user_tenants, [:kaui_allowed_user_id, :kaui_tenant_id], :unique => true, :name => 'kaui_allowed_user_tenants_uniq'
18
- end
19
- end