kaui 0.2.6 → 0.3.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/Gemfile.lock +32 -19
  4. data/README.md +13 -0
  5. data/app/controllers/kaui/account_tags_controller.rb +9 -10
  6. data/app/controllers/kaui/account_timelines_controller.rb +6 -6
  7. data/app/controllers/kaui/accounts_controller.rb +28 -27
  8. data/app/controllers/kaui/analytics_controller.rb +5 -5
  9. data/app/controllers/kaui/bundle_tags_controller.rb +10 -10
  10. data/app/controllers/kaui/bundles_controller.rb +21 -21
  11. data/app/controllers/kaui/chargebacks_controller.rb +9 -10
  12. data/app/controllers/kaui/charges_controller.rb +6 -6
  13. data/app/controllers/kaui/credits_controller.rb +10 -10
  14. data/app/controllers/kaui/engine_controller.rb +44 -3
  15. data/app/controllers/kaui/invoice_items_controller.rb +4 -4
  16. data/app/controllers/kaui/invoices_controller.rb +14 -14
  17. data/app/controllers/kaui/payment_methods_controller.rb +3 -3
  18. data/app/controllers/kaui/payments_controller.rb +4 -4
  19. data/app/controllers/kaui/refunds_controller.rb +16 -16
  20. data/app/controllers/kaui/sessions_controller.rb +6 -0
  21. data/app/controllers/kaui/subscriptions_controller.rb +28 -28
  22. data/app/controllers/kaui/tag_definitions_controller.rb +7 -7
  23. data/app/helpers/kaui/killbill_helper.rb +168 -130
  24. data/app/models/kaui/ability.rb +25 -0
  25. data/app/models/kaui/account_email.rb +10 -14
  26. data/app/models/kaui/entitlement.rb +2 -0
  27. data/app/models/kaui/killbill_authenticatable.rb +50 -0
  28. data/app/models/kaui/tag_definition.rb +8 -8
  29. data/app/models/kaui/user.rb +36 -0
  30. data/app/views/kaui/account_timelines/index.html.erb +1 -1
  31. data/app/views/kaui/account_timelines/show.html.erb +32 -24
  32. data/app/views/kaui/accounts/index.html.erb +2 -2
  33. data/app/views/kaui/accounts/show.html.erb +14 -10
  34. data/app/views/kaui/home/index.html.erb +2 -2
  35. data/app/views/kaui/invoices/show.html.erb +7 -5
  36. data/app/views/kaui/layouts/kaui_application.html.erb +12 -10
  37. data/app/views/kaui/payment_methods/_payment_methods_table.html.erb +1 -0
  38. data/app/views/kaui/payment_methods/index.html.erb +1 -1
  39. data/app/views/kaui/payment_methods/show.html.erb +1 -0
  40. data/app/views/kaui/payments/new.html.erb +9 -7
  41. data/app/views/kaui/refunds/new.html.erb +23 -19
  42. data/app/views/kaui/sessions/new.html.erb +21 -0
  43. data/config/initializers/devise.rb +259 -0
  44. data/config/initializers/killbill_authenticatable.rb +38 -0
  45. data/config/locales/devise.en.yml +60 -0
  46. data/config/routes.rb +5 -0
  47. data/db/migrate/20130812155313_devise_create_kaui_users.rb +14 -0
  48. data/kaui.gemspec +8 -5
  49. data/lib/generators/kaui/install/templates/app/assets/javascripts/kaui/all.js +1 -1
  50. data/lib/kaui/engine.rb +2 -0
  51. data/lib/kaui/version.rb +1 -1
  52. data/script/sandbox +6 -1
  53. data/test/dummy/app/assets/javascripts/application.js +1 -1
  54. data/test/dummy/app/controllers/application_controller.rb +0 -4
  55. data/test/dummy/config/database.yml +3 -38
  56. data/test/dummy/db/migrate/20130819152643_devise_create_kaui_users.kaui.rb +15 -0
  57. data/test/dummy/db/schema.rb +26 -0
  58. data/test/test_helper.rb +43 -18
  59. metadata +68 -13
  60. data/lib/kaui/error_helper.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9dda6885d003eff4164274878c7dd5e0781cf4d
4
- data.tar.gz: a19b25d1af270e4b3355df0a5ac33d117e5e1a95
3
+ metadata.gz: 44e6088db793de66aab1c622dac27f3ae50c8d8a
4
+ data.tar.gz: 1c33caaa564cc276412f6e7ca9cc721421c2ecff
5
5
  SHA512:
6
- metadata.gz: 0c22f0940c23cb17f5afa93c937da47ced42edd855b218b14de02eb4cb4d8ed3e9ff6996075e8ce8a53f51f1a08aadc8f72e51da69f748ceda923c0b298de51d
7
- data.tar.gz: 5fbcc849e2de8d1125b903f259a11df802dc5aba6597d9c744267ead7b80cf39896694f43a48712e4433c04e0ebd1e99c17efe5144a0651843c45fc39067e526
6
+ metadata.gz: c7d1fd9ea17cca4ecaab91417b0119d87f4d99d17a2ffd660c83208d2c7385d5d5ff37350ee76b4d0d4ae33ee90a638e65c94f1eb4dbc5e9b58b7d0727ff1d42
7
+ data.tar.gz: b07a484c935a30a48388e3a20047f4b494430559fb27ad917459a69e5588c184be03de1ada2b270da563322102d06bae3c727dde61a0b70128545047b52b8ea6
data/.gitignore CHANGED
@@ -8,3 +8,5 @@ test/dummy/.sass-cache
8
8
  .idea
9
9
  sandbox
10
10
  foo
11
+ # Local testing credentials
12
+ config/initializers/killbill_client.rb
data/Gemfile.lock CHANGED
@@ -1,12 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kaui (0.2.6)
5
- d3_rails (~> 2.10.3)
6
- jquery-rails (~> 2.0)
7
- killbill-client (~> 0.1.3)
8
- money-rails (~> 0.5.0)
9
- rails (~> 3.2.3)
4
+ kaui (0.3.0)
5
+ cancan (~> 1.6.10)
6
+ d3_rails (~> 3.2.8)
7
+ devise (~> 3.0.2)
8
+ jquery-rails (~> 3.0.4)
9
+ killbill-client (~> 0.2.0)
10
+ money-rails (~> 0.8.1)
11
+ rails (~> 3.2.14)
10
12
  rest-client (~> 1.6.7)
11
13
 
12
14
  GEM
@@ -40,31 +42,38 @@ GEM
40
42
  i18n (~> 0.6, >= 0.6.4)
41
43
  multi_json (~> 1.0)
42
44
  arel (3.0.2)
45
+ bcrypt-ruby (3.1.1)
43
46
  builder (3.0.4)
44
- d3_rails (2.10.3)
47
+ cancan (1.6.10)
48
+ d3_rails (3.2.8)
45
49
  railties (>= 3.1.0)
50
+ devise (3.0.3)
51
+ bcrypt-ruby (~> 3.0)
52
+ orm_adapter (~> 0.1)
53
+ railties (>= 3.2.6, < 5)
54
+ warden (~> 1.2.3)
46
55
  erubis (2.7.0)
47
56
  hike (1.2.3)
48
- i18n (0.6.4)
57
+ i18n (0.6.5)
49
58
  journey (1.0.4)
50
- jquery-rails (2.3.0)
59
+ jquery-rails (3.0.4)
51
60
  railties (>= 3.0, < 5.0)
52
61
  thor (>= 0.14, < 2.0)
53
62
  json (1.8.0)
54
- killbill-client (0.1.3)
63
+ killbill-client (0.2.0)
55
64
  mail (2.5.4)
56
65
  mime-types (~> 1.16)
57
66
  treetop (~> 1.4.8)
58
- mime-types (1.23)
59
- money (5.0.0)
60
- i18n (~> 0.4)
61
- json
62
- money-rails (0.5.0)
63
- activesupport (~> 3.0)
64
- money (~> 5.0.0)
65
- railties (~> 3.0)
67
+ mime-types (1.24)
68
+ money (5.1.1)
69
+ i18n (~> 0.6.0)
70
+ money-rails (0.8.1)
71
+ activesupport (>= 3.0)
72
+ money (~> 5.1.0)
73
+ railties (>= 3.0)
66
74
  multi_json (1.7.9)
67
75
  mysql2 (0.3.13)
76
+ orm_adapter (0.4.0)
68
77
  polyglot (0.3.3)
69
78
  rack (1.4.5)
70
79
  rack-cache (1.2)
@@ -98,12 +107,15 @@ GEM
98
107
  multi_json (~> 1.0)
99
108
  rack (~> 1.0)
100
109
  tilt (~> 1.1, != 1.3.0)
110
+ sqlite3 (1.3.8)
101
111
  thor (0.18.1)
102
112
  tilt (1.4.1)
103
- treetop (1.4.14)
113
+ treetop (1.4.15)
104
114
  polyglot
105
115
  polyglot (>= 0.3.1)
106
116
  tzinfo (0.3.37)
117
+ warden (1.2.3)
118
+ rack (>= 1.0)
107
119
 
108
120
  PLATFORMS
109
121
  ruby
@@ -111,3 +123,4 @@ PLATFORMS
111
123
  DEPENDENCIES
112
124
  kaui!
113
125
  mysql2
126
+ sqlite3
data/README.md CHANGED
@@ -30,6 +30,19 @@ Finally, Killbill server needs to be running for Kaui to fetch its information.
30
30
  variable to point to your existing Killbill installation (e.g. http://killbill.company.com:8080).
31
31
 
32
32
 
33
+ Multi-Tenancy
34
+ -------------
35
+
36
+ If you are using Kaui against a single tenant, specify your api key and secret in ```config/initializers/killbill_client.rb```:
37
+
38
+ ```
39
+ KillBillClient.api_key = 'bob'
40
+ KillBillClient.api_secret = 'lazar'
41
+ ```
42
+
43
+ Sharing a Kaui instance across multiple tenants is not supported yet (you need to spawn one instance per tenant).
44
+
45
+
33
46
  Running tests
34
47
  -------------
35
48
 
@@ -5,13 +5,12 @@ class Kaui::AccountTagsController < Kaui::EngineController
5
5
 
6
6
  if account_id.present?
7
7
  begin
8
- tags = Kaui::KillbillHelper::get_tags_for_account(account_id)
8
+ @tags = Kaui::KillbillHelper::get_tags_for_account(account_id, options_for_klient)
9
9
  rescue => e
10
- flash[:error] = "Error while getting tags: #{as_string(e)}"
11
-
10
+ flash.now[:error] = "Error while getting tags: #{as_string(e)}"
12
11
  end
13
12
  else
14
- flash[:error] = "No account id given"
13
+ flash.now[:error] = "No account id given"
15
14
  end
16
15
  end
17
16
 
@@ -19,16 +18,16 @@ class Kaui::AccountTagsController < Kaui::EngineController
19
18
  @account_id = params[:account_id]
20
19
  begin
21
20
  @available_tags = Kaui::TagDefinition.all_for_account.sort
22
- @account = Kaui::KillbillHelper::get_account(@account_id)
23
- @tag_names = Kaui::KillbillHelper::get_tags_for_account(@account.account_id).map { |tag| tag.tag_definition_name }
21
+ @account = Kaui::KillbillHelper::get_account(@account_id, false, false, options_for_klient)
22
+ @tag_names = Kaui::KillbillHelper::get_tags_for_account(@account.account_id, options_for_klient).map { |tag| tag.tag_definition_name }
24
23
  rescue => e
25
- flash[:error] = "Error while editing tags: #{as_string(e)}"
24
+ flash.now[:error] = "Error while editing tags: #{as_string(e)}"
26
25
  end
27
26
  end
28
27
 
29
28
  def update
30
29
  begin
31
- current_tags = Kaui::KillbillHelper::get_tags_for_account(params[:account_id]).map { |tag| tag.tag_definition_id }
30
+ current_tags = Kaui::KillbillHelper::get_tags_for_account(params[:account_id], options_for_klient).map { |tag| tag.tag_definition_id }
32
31
 
33
32
  new_tags = []
34
33
  params.each do |tag, tag_name|
@@ -49,8 +48,8 @@ class Kaui::AccountTagsController < Kaui::EngineController
49
48
  tags_to_add << new_tag_definition_id unless current_tags.include?(new_tag_definition_id)
50
49
  end
51
50
 
52
- Kaui::KillbillHelper::remove_tags_for_account(params[:account_id], tags_to_remove) unless tags_to_remove.empty?
53
- Kaui::KillbillHelper::add_tags_for_account(params[:account_id], tags_to_add) unless tags_to_add.empty?
51
+ Kaui::KillbillHelper::remove_tags_for_account(params[:account_id], tags_to_remove, options_for_klient) unless tags_to_remove.empty?
52
+ Kaui::KillbillHelper::add_tags_for_account(params[:account_id], tags_to_add, options_for_klient) unless tags_to_add.empty?
54
53
  rescue => e
55
54
  flash[:error] = "Error while updating tags: #{as_string(e)}"
56
55
  end
@@ -13,8 +13,8 @@ class Kaui::AccountTimelinesController < Kaui::EngineController
13
13
  return
14
14
  end
15
15
  begin
16
- @account = Kaui::KillbillHelper::get_account(@account_id)
17
- @timeline = Kaui::KillbillHelper::get_account_timeline(@account_id)
16
+ @account = Kaui::KillbillHelper::get_account(@account_id, false, false, options_for_klient)
17
+ @timeline = Kaui::KillbillHelper::get_account_timeline(@account_id, "MINIMAL", options_for_klient)
18
18
  rescue => e
19
19
  flash[:error] = "Could not load the account timeline for #{@account_id}: #{as_string(e)}"
20
20
  redirect_to :action => :index
@@ -27,9 +27,9 @@ class Kaui::AccountTimelinesController < Kaui::EngineController
27
27
  @timeline.payments.each do |payment|
28
28
  if payment.invoice_id.present? && payment.payment_id.present?
29
29
  begin
30
- @invoices_by_id[payment.invoice_id] = Kaui::KillbillHelper::get_invoice(payment.invoice_id)
30
+ @invoices_by_id[payment.invoice_id] = Kaui::KillbillHelper::get_invoice(payment.invoice_id, true, options_for_klient)
31
31
  rescue => e
32
- flash[:error] = "Could not get invoice information for the timeline #{@account_id}: #{as_string(e)}"
32
+ flash.now[:error] = "Could not get invoice information for the timeline #{@account_id}: #{as_string(e)}"
33
33
  end
34
34
  payment.bundle_keys.split(",").each do |bundle_key|
35
35
  unless @bundle_names.has_key?(bundle_key)
@@ -41,9 +41,9 @@ class Kaui::AccountTimelinesController < Kaui::EngineController
41
41
  @timeline.invoices.each do |invoice|
42
42
  if invoice.invoice_id.present? && !@invoices_by_id.has_key?(invoice.invoice_id)
43
43
  begin
44
- @invoices_by_id[invoice.invoice_id] = Kaui::KillbillHelper::get_invoice(invoice.invoice_id)
44
+ @invoices_by_id[invoice.invoice_id] = Kaui::KillbillHelper::get_invoice(invoice.invoice_id, true, options_for_klient)
45
45
  rescue => e
46
- flash[:error] = "Could not get invoice information for the timeline #{@account_id}: #{as_string(e)}"
46
+ flash.now[:error] = "Could not get invoice information for the timeline #{@account_id}: #{as_string(e)}"
47
47
  end
48
48
  invoice.bundle_keys.split(",").each do |bundle_key|
49
49
  unless @bundle_names.has_key?(bundle_key)
@@ -6,49 +6,50 @@ class Kaui::AccountsController < Kaui::EngineController
6
6
  end
7
7
 
8
8
  def show
9
- key = params[:id]
10
- if key.present?
9
+ @key = params[:id]
10
+ if @key.present?
11
11
  # Remove extra whitespaces
12
- key.strip!
12
+ @key.strip!
13
13
 
14
14
  begin
15
- @account = Kaui::KillbillHelper::get_account_by_key_with_balance_and_cba(key)
15
+ @account = Kaui::KillbillHelper::get_account_by_key_with_balance_and_cba(@key, options_for_klient)
16
16
  rescue URI::InvalidURIError => e
17
- flash[:error] = "Error while retrieving the account for #{key}: #{e.message}"
17
+ flash.now[:error] = "Error while retrieving the account for #{@key}: #{e.message}"
18
18
  render :action => :index and return
19
19
  rescue => e
20
- flash[:error] = "Error while retrieving the account for #{key}: #{as_string(e)}"
20
+ flash.now[:error] = "Error while retrieving the account for #{@key}: #{as_string(e)}"
21
21
  render :action => :index and return
22
22
  end
23
23
 
24
24
  if @account.present? and @account.is_a? Kaui::Account
25
25
  begin
26
- @tags = Kaui::KillbillHelper::get_tags_for_account(@account.account_id).sort
27
- @account_emails = Kaui::AccountEmail.where(:account_id => @account.account_id)
26
+ @tags = Kaui::KillbillHelper::get_tags_for_account(@account.account_id, options_for_klient).sort
27
+ @account_emails = Kaui::AccountEmail.where({ :account_id => @account.account_id }, options_for_klient)
28
28
 
29
- @payment_methods = Kaui::KillbillHelper::get_non_external_payment_methods(@account.account_id)
30
- @bundles = Kaui::KillbillHelper::get_bundles(@account.account_id)
29
+ @payment_methods = Kaui::KillbillHelper::get_non_external_payment_methods(@account.account_id, options_for_klient)
30
+ @bundles = Kaui::KillbillHelper::get_bundles(@account.account_id, options_for_klient)
31
31
 
32
32
  @overdue_state_by_bundle_id = {}
33
33
  @subscriptions_by_bundle_id = {}
34
34
 
35
35
  @bundles.each do |bundle|
36
- @overdue_state_by_bundle_id[bundle.bundle_id] = Kaui::KillbillHelper::get_overdue_state_for_bundle(bundle.bundle_id)
36
+ @overdue_state_by_bundle_id[bundle.bundle_id] = Kaui::KillbillHelper::get_overdue_state_for_bundle(bundle.bundle_id, options_for_klient)
37
37
 
38
- subscriptions = Kaui::KillbillHelper::get_subscriptions_for_bundle(bundle.bundle_id)
38
+ subscriptions = Kaui::KillbillHelper::get_subscriptions_for_bundle(bundle.bundle_id, options_for_klient)
39
39
  if subscriptions.present?
40
40
  @subscriptions_by_bundle_id[bundle.bundle_id.to_s] = (@subscriptions_by_bundle_id[bundle.bundle_id.to_s] || []) + subscriptions
41
41
  end
42
42
  end
43
43
  rescue => e
44
- flash[:error] = "Error while retrieving account information for account: #{as_string(e)}"
44
+ flash.now[:error] = "Error while retrieving account information for account: #{as_string(e)}"
45
+ render :action => :index
45
46
  end
46
47
  else
47
- flash[:error] = "Account #{@account_id} not found: #{@account}"
48
+ flash.now[:error] = "Account #{@account_id} not found: #{@account}"
48
49
  render :action => :index
49
50
  end
50
51
  else
51
- flash[:error] = "No id given"
52
+ flash.now[:error] = "No id given"
52
53
  end
53
54
  end
54
55
 
@@ -56,9 +57,9 @@ class Kaui::AccountsController < Kaui::EngineController
56
57
  @account_id = params[:id]
57
58
  if @account_id.present?
58
59
  begin
59
- @payment_methods = Kaui::KillbillHelper::get_non_external_payment_methods(@account_id)
60
+ @payment_methods = Kaui::KillbillHelper::get_non_external_payment_methods(@account_id, options_for_klient)
60
61
  rescue => e
61
- flash[:error] = "Error while getting payment methods: #{as_string(e)}"
62
+ flash.now[:error] = "Error while getting payment methods: #{as_string(e)}"
62
63
  end
63
64
  unless @payment_methods.is_a?(Array)
64
65
  flash[:notice] = "No payment methods for account_id '#{@account_id}'"
@@ -66,16 +67,16 @@ class Kaui::AccountsController < Kaui::EngineController
66
67
  return
67
68
  end
68
69
  else
69
- flash[:notice] = "No account_id given"
70
+ flash.now[:notice] = "No account_id given"
70
71
  end
71
72
  end
72
73
 
73
74
  def add_payment_method
74
75
  account_id = params[:id]
75
76
  begin
76
- @account = Kaui::KillbillHelper::get_account(account_id)
77
+ @account = Kaui::KillbillHelper::get_account(account_id, false, false, options_for_klient)
77
78
  rescue => e
78
- flash[:error] = "Error while adding payment methods: #{as_string(e)}"
79
+ flash.now[:error] = "Error while adding payment methods: #{as_string(e)}"
79
80
  end
80
81
  if @account.nil?
81
82
  flash[:error] = "Account not found for id #{account_id}"
@@ -88,7 +89,7 @@ class Kaui::AccountsController < Kaui::EngineController
88
89
  def do_add_payment_method
89
90
  account_id = params[:id]
90
91
  # Needed in the failure case scenario
91
- @account = Kaui::KillbillHelper::get_account(account_id)
92
+ @account = Kaui::KillbillHelper::get_account(account_id, false, false, options_for_klient)
92
93
 
93
94
  # Implementation example using standard credit card fields
94
95
  @card_type = params[:card_type]
@@ -126,11 +127,11 @@ class Kaui::AccountsController < Kaui::EngineController
126
127
  }
127
128
 
128
129
  begin
129
- Kaui::KillbillHelper::add_payment_method(@is_default == 1, payment_method, current_user, @reason, @comment)
130
- flash[:info] = 'Payment method created'
130
+ Kaui::KillbillHelper::add_payment_method(@is_default == 1, payment_method, current_user, @reason, @comment, options_for_klient)
131
+ flash[:notice] = 'Payment method created'
131
132
  redirect_to kaui_engine.account_timeline_path(account_id)
132
133
  rescue => e
133
- flash[:error] = "Error while adding payment method: #{as_string(e)}"
134
+ flash.now[:error] = "Error while adding payment method: #{as_string(e)}"
134
135
  render "kaui/payment_methods/new"
135
136
  end
136
137
  end
@@ -140,7 +141,7 @@ class Kaui::AccountsController < Kaui::EngineController
140
141
  @payment_method_id = params[:payment_method_id]
141
142
  if @account_id.present? && @payment_method_id.present?
142
143
  begin
143
- @payment_methods = Kaui::KillbillHelper::set_payment_method_as_default(@account_id, @payment_method_id, current_user, params[:reason], params[:comment])
144
+ @payment_methods = Kaui::KillbillHelper::set_payment_method_as_default(@account_id, @payment_method_id, current_user, params[:reason], params[:comment], options_for_klient)
144
145
  rescue => e
145
146
  flash[:error] = "Error while setting payment method as default #{@payment_method_id}: #{as_string(e)}"
146
147
  end
@@ -152,7 +153,7 @@ class Kaui::AccountsController < Kaui::EngineController
152
153
 
153
154
  def toggle_email_notifications
154
155
  begin
155
- @account = Kaui::KillbillHelper::update_email_notifications(params[:id], params[:is_notified])
156
+ @account = Kaui::KillbillHelper::update_email_notifications(params[:id], params[:is_notified], options_for_klient)
156
157
  flash[:notice] = "Email preferences updated"
157
158
  rescue => e
158
159
  flash[:error] = "Error while switching email notifications #{invoice_id}: #{as_string(e)}"
@@ -162,7 +163,7 @@ class Kaui::AccountsController < Kaui::EngineController
162
163
 
163
164
  def pay_all_invoices
164
165
  begin
165
- @account = Kaui::KillbillHelper::pay_all_invoices(params[:id], false, current_user, params[:reason], params[:comment])
166
+ @account = Kaui::KillbillHelper::pay_all_invoices(params[:id], false, current_user, params[:reason], params[:comment], options_for_klient)
166
167
  flash[:notice] = "Successfully triggered a payment for all unpaid invoices"
167
168
  rescue => e
168
169
  flash[:error] = "Error while triggering payments: #{as_string(e)}"
@@ -3,7 +3,7 @@ module Kaui
3
3
  def index
4
4
  @slugs = []
5
5
  begin
6
- catalog = Kaui::KillbillHelper::get_full_catalog()
6
+ catalog = Kaui::KillbillHelper::get_full_catalog(options_for_klient)
7
7
  catalog['products'].each do |product|
8
8
  product['plans'].each do |plan|
9
9
  name = plan['name']
@@ -22,8 +22,8 @@ module Kaui
22
22
  def account_snapshot
23
23
  # params[:account_id] can either be a uuid or an external key
24
24
  begin
25
- @account = Kaui::KillbillHelper::get_account_by_key(params[:account_id])
26
- @snapshot = Kaui::KillbillHelper::get_account_snapshot(@account.account_id)
25
+ @account = Kaui::KillbillHelper::get_account_by_key(params[:account_id], false, false, options_for_klient)
26
+ @snapshot = Kaui::KillbillHelper::get_account_snapshot(@account.account_id, options_for_klient)
27
27
  rescue => e
28
28
  flash[:error] = "Error while retrieving account snapshot: #{as_string(e)}"
29
29
  redirect_to :analytics
@@ -32,7 +32,7 @@ module Kaui
32
32
 
33
33
  def refresh_account
34
34
  begin
35
- Kaui::KillbillHelper::refresh_account(params[:account_id])
35
+ Kaui::KillbillHelper::refresh_account(params[:account_id], options_for_klient)
36
36
  flash[:notice] = "Account successfully refreshed!"
37
37
  rescue => e
38
38
  flash[:error] = "Error while refreshing account: #{as_string(e)}"
@@ -57,7 +57,7 @@ module Kaui
57
57
 
58
58
  def sanity
59
59
  begin
60
- @sanity = Kaui::KillbillHelper::check_analytics_sanity
60
+ @sanity = Kaui::KillbillHelper::check_analytics_sanity(options_for_klient)
61
61
  rescue => e
62
62
  flash[:error] = "Error while checking Analytics sanity: #{as_string(e)}"
63
63
  redirect_to :analytics
@@ -4,36 +4,36 @@ class Kaui::BundleTagsController < Kaui::EngineController
4
4
  bundle_id = params[:id]
5
5
  if bundle_id.present?
6
6
  begin
7
- tags = Kaui::KillbillHelper::get_tags_for_bundle(bundle_id)
7
+ tags = Kaui::KillbillHelper::get_tags_for_bundle(bundle_id, options_for_klient)
8
8
  rescue => e
9
- flash[:error] = "Error while retrieving tags information: #{as_string(e)}"
9
+ flash.now[:error] = "Error while retrieving tags information: #{as_string(e)}"
10
10
  end
11
11
  else
12
- flash[:error] = "No account id given"
12
+ flash.now[:error] = "No account id given"
13
13
  end
14
14
  end
15
15
 
16
16
  def edit
17
17
  @bundle_id = params[:bundle_id]
18
18
  begin
19
- @available_tags = Kaui::KillbillHelper::get_tag_definitions.sort {|tag_a, tag_b| tag_a.name.downcase <=> tag_b.name.downcase }
19
+ @available_tags = Kaui::KillbillHelper::get_tag_definitions(options_for_klient).sort {|tag_a, tag_b| tag_a.name.downcase <=> tag_b.name.downcase }
20
20
 
21
- @bundle = Kaui::KillbillHelper::get_bundle(@bundle_id)
22
- @tags = Kaui::KillbillHelper::get_tags_for_bundle(@bundle_id)
21
+ @bundle = Kaui::KillbillHelper::get_bundle(@bundle_id, options_for_klient)
22
+ @tags = Kaui::KillbillHelper::get_tags_for_bundle(@bundle_id, options_for_klient)
23
23
  rescue => e
24
- flash[:error] = "Error while retrieving tags information: #{as_string(e)}"
24
+ flash.now[:error] = "Error while retrieving tags information: #{as_string(e)}"
25
25
  end
26
26
  end
27
27
 
28
28
  def update
29
29
  begin
30
- bundle = Kaui::KillbillHelper::get_bundle(params[:bundle_id])
30
+ bundle = Kaui::KillbillHelper::get_bundle(params[:bundle_id], options_for_klient)
31
31
  tags = params[:tags]
32
32
 
33
- Kaui::KillbillHelper::set_tags_for_bundle(bundle.bundle_id, tags)
33
+ Kaui::KillbillHelper::set_tags_for_bundle(bundle.bundle_id, tags, options_for_klient)
34
34
  redirect_to Kaui.bundle_home_path.call(bundle.bundle_id)
35
35
  rescue => e
36
- flash[:error] = "Error while updating tags: #{as_string(e)}"
36
+ flash.now[:error] = "Error while updating tags: #{as_string(e)}"
37
37
  end
38
38
  end
39
39