kaui 0.15.2 → 0.15.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03876ed3f2f539ca41f5d6ae33378309a842c6ba
4
- data.tar.gz: 94fc7dd36b710fdaf45c27668b5791d64524914c
3
+ metadata.gz: 28ef571db6b75b46644076075d33cb15e11a3dd8
4
+ data.tar.gz: 99e00ae3e2183b20bf86572c406fffc8eafa7430
5
5
  SHA512:
6
- metadata.gz: 8117303c14d31d75080506897654684d52fb44b1d85e4153b626df24b9b89d16ce8cb787329d68c7cff89e65f2e7bb731e785b23e7cfe82707286a45e832a464
7
- data.tar.gz: 4b895ba401fb46e454206d26381dbfbcf648520af5e5bcdbdabce0da6cbfbb30386823c557f06edf0eb88e278899ce195cb92af0f060206c82cd55e889afc240
6
+ metadata.gz: 32268720a72836539a2c3bf0ea790c0296518d655827201c18811bd65f27efc4bfc1b4fd6623b0e866cd7296356d7195a99530dadb0e22a1d4bfe9e59b4763dd
7
+ data.tar.gz: fa8f0bddaf0be5b1ed46b279615abd31266ebf6fe6d9573ce3c1f3331918c2d2ca7e6dbdf927ad13875ecf7fc0d54f54031e46eb16c180c619c563ff974e1c76
@@ -58,6 +58,7 @@ class Kaui::AdminTenantsController < Kaui::EngineController
58
58
  # Select the tenant, see TenantsController
59
59
  session[:kb_tenant_id] = tenant_model.kb_tenant_id
60
60
  session[:kb_tenant_name] = tenant_model.name
61
+ session[:tenant_id] = tenant_model.id
61
62
 
62
63
  redirect_to admin_tenant_path(tenant_model[:id]), :notice => 'Tenant was successfully configured'
63
64
  end
@@ -53,6 +53,7 @@ class Kaui::PaymentsController < Kaui::EngineController
53
53
  [
54
54
  payment.payment_number.to_i,
55
55
  payment.payment_date,
56
+ payment.total_authed_amount_to_money,
56
57
  payment.paid_amount_to_money,
57
58
  payment.returned_amount_to_money,
58
59
  payment.transactions.empty? ? nil : payment.transactions[-1].status
@@ -63,6 +64,7 @@ class Kaui::PaymentsController < Kaui::EngineController
63
64
  [
64
65
  view_context.link_to(payment.payment_number, view_context.url_for(:controller => :payments, :action => :show, :account_id => payment.account_id, :id => payment.payment_id)),
65
66
  view_context.format_date(payment.payment_date),
67
+ view_context.humanized_money_with_symbol(payment.total_authed_amount_to_money),
66
68
  view_context.humanized_money_with_symbol(payment.paid_amount_to_money),
67
69
  view_context.humanized_money_with_symbol(payment.returned_amount_to_money),
68
70
  payment.transactions.empty? ? nil : view_context.colored_transaction_status(payment.transactions[-1].status)
@@ -16,13 +16,13 @@ class Kaui::TenantsController < Kaui::EngineController
16
16
  when 0
17
17
  tenant = KillBillClient.api_key.nil? ? nil : KillBillClient::Model::Tenant.find_by_api_key(KillBillClient.api_key, :session_id => current_user.kb_session_id)
18
18
  if tenant.present?
19
- select_tenant_for_tenant_id(tenant.tenant_id, tenant.external_key)
19
+ select_tenant_for_tenant_id(tenant.tenant_id, tenant.external_key, nil)
20
20
  else
21
21
  redirect_to new_admin_tenant_path
22
22
  end
23
23
  when 1
24
24
  # If there is only one tenant defined we skip the screen and set the tenant for the user
25
- select_tenant_for_tenant_id(@tenants[0].kb_tenant_id, @tenants[0].name)
25
+ select_tenant_for_tenant_id(@tenants[0].kb_tenant_id, @tenants[0].name, @tenants[0].id)
26
26
  else
27
27
  # Jump to default view allowing to chose which tenant to pick
28
28
  end
@@ -30,15 +30,16 @@ class Kaui::TenantsController < Kaui::EngineController
30
30
 
31
31
  def select_tenant
32
32
  tenant = Kaui::Tenant.find_by_kb_tenant_id(params.require(:kb_tenant_id))
33
- select_tenant_for_tenant_id(tenant.kb_tenant_id, tenant.name)
33
+ select_tenant_for_tenant_id(tenant.kb_tenant_id, tenant.name, tenant.id)
34
34
  end
35
35
 
36
36
  private
37
37
 
38
- def select_tenant_for_tenant_id(kb_tenant_id, kb_tenant_name_or_key)
38
+ def select_tenant_for_tenant_id(kb_tenant_id, kb_tenant_name_or_key, tenant_id)
39
39
  # Set kb_tenant_id in the session
40
40
  session[:kb_tenant_id] = kb_tenant_id
41
41
  session[:kb_tenant_name] = kb_tenant_name_or_key
42
+ session[:tenant_id] = tenant_id
42
43
 
43
44
  # Devise will have stored the requested url while signed-out
44
45
  redirect_to stored_location_for(:user) || Kaui.home_path.call
@@ -32,6 +32,9 @@ class Kaui::AdminTenant < KillBillClient::Model::Tenant
32
32
 
33
33
  source = URI.parse('https://raw.githubusercontent.com/killbill/killbill-cloud/master/kpm/lib/kpm/plugins_directory.yml').read
34
34
  YAML.load(source)
35
+ rescue
36
+ # Ignore gracefully
37
+ {}
35
38
  end
36
39
 
37
40
  def get_oss_plugin_info(plugin_directory)
@@ -2,7 +2,7 @@ class Kaui::AuditLog
2
2
 
3
3
  def self.description(log)
4
4
  if log.changed_by.present?
5
- changed_str = "Done by #{log.changed_by.strip}"
5
+ changed_str = "#{log.change_type} by #{log.changed_by.strip}"
6
6
  if log.reason_code.blank? && log.comments.blank?
7
7
  changed_str
8
8
  elsif log.reason_code.blank?
@@ -37,6 +37,10 @@ module Kaui::PaymentState
37
37
  refundable?
38
38
  end
39
39
 
40
+ def total_authed_amount_to_money
41
+ auth_amount_to_money + purchased_amount_to_money
42
+ end
43
+
40
44
  def paid_amount_to_money
41
45
  captured_amount_to_money + purchased_amount_to_money
42
46
  end
@@ -125,8 +125,11 @@
125
125
  <td><%= transaction.transaction_type %></td>
126
126
  <td>
127
127
  <ul>
128
- <li><%= 'Amount:' %>&nbsp;<%= humanized_money_with_symbol Kaui::Transaction.amount_to_money(transaction) %>
129
- (<%= transaction.currency %>)
128
+ <li>
129
+ <% unless transaction.transaction_type == 'VOID' %>
130
+ <%= 'Amount:' %>&nbsp;<%= humanized_money_with_symbol Kaui::Transaction.amount_to_money(transaction) %>
131
+ (<%= transaction.currency %>)
132
+ <% end %>
130
133
  </li>
131
134
  <li>
132
135
  <%= colored_transaction_status(transaction.status) %>
@@ -140,8 +143,12 @@
140
143
  <td>
141
144
  <% if transaction.audit_logs.present? %>
142
145
  <ul>
143
- <% transaction.audit_logs.each do |entry| %>
144
- <li><%= Kaui::AuditLog.description(entry) %></li>
146
+ <% transaction.audit_logs
147
+ .map { |entry| Kaui::AuditLog.description(entry) }
148
+ .chunk { |x| x }
149
+ .map(&:first)
150
+ .each do |entry| %>
151
+ <li><%= entry %></li>
145
152
  <% end %>
146
153
  </ul>
147
154
  <% end %>
@@ -64,7 +64,17 @@
64
64
  <nav>
65
65
  <ul class="account-menu">
66
66
  <% if user_signed_in? -%>
67
- <li><%= session[:kb_tenant_name].present? ? "#{current_user.kb_username} / #{session[:kb_tenant_name]}" : current_user.kb_username %></li>
67
+ <li>
68
+ <% if session[:kb_tenant_name].present? %>
69
+ <% if session[:tenant_id].present? %>
70
+ <%= link_to("#{current_user.kb_username} / #{session[:kb_tenant_name]}", kaui_engine.admin_tenant_path(session[:tenant_id])) %>
71
+ <% else %>
72
+ <%= "#{current_user.kb_username} / #{session[:kb_tenant_name]}" %>
73
+ <% end %>
74
+ <% else %>
75
+ <%= current_user.kb_username %>
76
+ <% end %>
77
+ </li>
68
78
  <li><%= link_to 'Sign Out', kaui_engine.destroy_user_session_path, :method => :delete %></li>
69
79
  <% else %>
70
80
  <li><%= link_to 'Login'.html_safe, kaui_engine.new_user_session_path %></li>
@@ -9,7 +9,8 @@
9
9
  <tr>
10
10
  <th>Number</th>
11
11
  <th>Date</th>
12
- <th>Amount</th>
12
+ <th>Auth amount</th>
13
+ <th>Capture amount</th>
13
14
  <th>Refund amount</th>
14
15
  <th>Last transaction status</th>
15
16
  </tr>
data/lib/kaui/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kaui
2
- VERSION = '0.15.2'
2
+ VERSION = '0.15.3'
3
3
  end
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.15.2
4
+ version: 0.15.3
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: 2017-02-02 00:00:00.000000000 Z
11
+ date: 2017-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement