kaui 4.0.7 → 4.0.8
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.
- checksums.yaml +4 -4
- data/app/controllers/kaui/accounts_controller.rb +2 -0
- data/app/controllers/kaui/admin_tenants_controller.rb +9 -4
- data/app/controllers/kaui/subscriptions_controller.rb +1 -1
- data/app/helpers/kaui/account_helper.rb +22 -0
- data/app/models/kaui/catalog.rb +1 -1
- data/app/views/kaui/accounts/_billing_details.html.erb +3 -2
- data/app/views/kaui/accounts/_billing_info.html.erb +3 -2
- data/app/views/kaui/admin_tenants/new_plan_currency.html.erb +1 -1
- data/app/views/kaui/components/breadcrumb/_breadcrumb.html.erb +6 -3
- data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +1 -1
- data/lib/kaui/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b2c56656e3f87a1f9ec78f971f9fad26c7b91c774ca073325dae08f5b8a047cb
|
|
4
|
+
data.tar.gz: a1bb18736365bcbd1178dc061de7bb49af25fd354260f51889aa86cfa50615dc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4c4fd476791af712ce1be6f3f92e1152b13884f422511f58cedd52a15958428ea78c4ab3b7184555cb938d1d17faaf0673d7e55df8863bc0b6762230b95d3cc5
|
|
7
|
+
data.tar.gz: bc90a81429952f5d1db664f9e8531e6a18aa5096814bc0008e16f37282fd89c015e2a614e81857ec09cb65f2b6a0366311e65e9960fae106028e404781d125b3
|
|
@@ -173,6 +173,7 @@ module Kaui
|
|
|
173
173
|
ops
|
|
174
174
|
end
|
|
175
175
|
fetch_available_tags = promise { Kaui::TagDefinition.all_for_account(cached_options_for_klient) }
|
|
176
|
+
fetch_bundles = promise { @account.bundles(cached_options_for_klient) }
|
|
176
177
|
|
|
177
178
|
@overdue_state = wait(fetch_overdue_state)
|
|
178
179
|
@tags = wait(fetch_account_tags)
|
|
@@ -184,6 +185,7 @@ module Kaui
|
|
|
184
185
|
@children = wait(fetch_children)
|
|
185
186
|
@account_parent = @account.parent_account_id.nil? ? nil : wait(fetch_parent)
|
|
186
187
|
@email_notification_configuration = is_email_notifications_plugin_available ? wait(fetch_email_notification_configuration) : []
|
|
188
|
+
@bundles = wait(fetch_bundles)
|
|
187
189
|
|
|
188
190
|
@last_transaction_by_payment_method_id = {}
|
|
189
191
|
wait(fetch_payments).each do |payment|
|
|
@@ -114,7 +114,7 @@ module Kaui
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
@latest_version = begin
|
|
117
|
-
@catalog_versions[
|
|
117
|
+
@catalog_versions[-1][:version_date]
|
|
118
118
|
rescue StandardError
|
|
119
119
|
nil
|
|
120
120
|
end
|
|
@@ -199,6 +199,7 @@ module Kaui
|
|
|
199
199
|
|
|
200
200
|
is_plan_id_found = false
|
|
201
201
|
plan_id = params[:plan_id]
|
|
202
|
+
product = nil
|
|
202
203
|
|
|
203
204
|
options = tenant_options_for_client
|
|
204
205
|
options[:api_key] = @tenant.api_key
|
|
@@ -207,9 +208,12 @@ module Kaui
|
|
|
207
208
|
catalog = Kaui::Catalog.get_catalog_json(true, nil, nil, options)
|
|
208
209
|
|
|
209
210
|
# seek if plan id exists
|
|
210
|
-
catalog.products.each do |
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
catalog.products.each do |p|
|
|
212
|
+
p.plans.each { |plan| is_plan_id_found |= plan.name == plan_id }
|
|
213
|
+
if is_plan_id_found
|
|
214
|
+
product = p
|
|
215
|
+
break
|
|
216
|
+
end
|
|
213
217
|
end
|
|
214
218
|
|
|
215
219
|
unless is_plan_id_found
|
|
@@ -219,6 +223,7 @@ module Kaui
|
|
|
219
223
|
|
|
220
224
|
@simple_plan = Kaui::SimplePlan.new
|
|
221
225
|
@simple_plan.plan_id = params[:plan_id]
|
|
226
|
+
@simple_plan.product_name = product.name if product
|
|
222
227
|
end
|
|
223
228
|
|
|
224
229
|
def create_simple_plan
|
|
@@ -237,7 +237,7 @@ module Kaui
|
|
|
237
237
|
return [] if catalog.blank?
|
|
238
238
|
|
|
239
239
|
plans = []
|
|
240
|
-
catalog[
|
|
240
|
+
catalog[-1].products.each do |product|
|
|
241
241
|
next if product.type == 'ADD_ON' || (!product_category.nil? && product.type != product_category)
|
|
242
242
|
|
|
243
243
|
product.plans.each do |plan|
|
|
@@ -69,5 +69,27 @@ module Kaui
|
|
|
69
69
|
style = "style='#{style}'" unless style.empty?
|
|
70
70
|
style
|
|
71
71
|
end
|
|
72
|
+
|
|
73
|
+
# Get the effective BCD for an account
|
|
74
|
+
# If there's an active subscription with its own BCD, return that
|
|
75
|
+
# Otherwise return the account-level BCD
|
|
76
|
+
def effective_bcd(account, bundles = nil)
|
|
77
|
+
# If bundles are provided, check for subscription BCD
|
|
78
|
+
if bundles.present?
|
|
79
|
+
bundles.each do |bundle|
|
|
80
|
+
next unless bundle.subscriptions.present?
|
|
81
|
+
|
|
82
|
+
bundle.subscriptions.each do |subscription|
|
|
83
|
+
# Skip cancelled subscriptions
|
|
84
|
+
next if subscription.state == 'CANCELLED'
|
|
85
|
+
# If subscription has a BCD set, return it (subscription BCD takes precedence)
|
|
86
|
+
return subscription.bill_cycle_day_local if subscription.bill_cycle_day_local.present? && subscription.bill_cycle_day_local.positive?
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Fall back to account BCD
|
|
92
|
+
account.bill_cycle_day_local
|
|
93
|
+
end
|
|
72
94
|
end
|
|
73
95
|
end
|
data/app/models/kaui/catalog.rb
CHANGED
|
@@ -37,7 +37,7 @@ module Kaui
|
|
|
37
37
|
|
|
38
38
|
def get_catalog_json(latest, requested_date, account_id, options)
|
|
39
39
|
catalogs = get_tenant_catalog_json(requested_date, account_id, options)
|
|
40
|
-
return catalogs.length.positive? ? catalogs[
|
|
40
|
+
return catalogs.length.positive? ? catalogs[-1] : nil if latest
|
|
41
41
|
|
|
42
42
|
# Order by latest
|
|
43
43
|
result = []
|
|
@@ -110,8 +110,9 @@
|
|
|
110
110
|
<div class="col-md-4">
|
|
111
111
|
<div class="info-item">
|
|
112
112
|
<b>Bill cycle day</b>
|
|
113
|
-
<%
|
|
114
|
-
|
|
113
|
+
<% effective_bcd_value = effective_bcd(@account, @bundles) %>
|
|
114
|
+
<% if effective_bcd_value.present? && effective_bcd_value > 0 %>
|
|
115
|
+
<p><%= effective_bcd_value %> (user timezone)</p>
|
|
115
116
|
<% else %>
|
|
116
117
|
<p>N/A</p>
|
|
117
118
|
<% end %>
|
|
@@ -78,8 +78,9 @@
|
|
|
78
78
|
<tr>
|
|
79
79
|
<th>Bill cycle day</th>
|
|
80
80
|
<td>
|
|
81
|
-
<%
|
|
82
|
-
|
|
81
|
+
<% effective_bcd_value = effective_bcd(@account, @bundles) %>
|
|
82
|
+
<% if effective_bcd_value.present? && effective_bcd_value > 0 %>
|
|
83
|
+
<span class='label'><%= effective_bcd_value %> (user timezone)</span>
|
|
83
84
|
<% else %>
|
|
84
85
|
<span class='label'>N/A</span>
|
|
85
86
|
<% end %>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<div class="form-group d-flex pb-3">
|
|
22
22
|
<%= f.label :amount, 'Amount', :class => 'col-sm-3 control-label' %>
|
|
23
23
|
<div class="col-sm-9 d-flex currency-select">
|
|
24
|
-
<%= f.text_field :amount, :class => 'form-control w-100 amount-input' %>
|
|
24
|
+
<%= f.text_field :amount, :class => 'form-control w-100 amount-input', :required => true %>
|
|
25
25
|
<%= f.select :currency, currencies, {:selected => 'USD'}, :class => 'form-control' %>
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
# Try to determine root path dynamically
|
|
7
7
|
if request.path.start_with?('/kaui')
|
|
8
8
|
dynamic_root = '/kaui'
|
|
9
|
+
elsif request.path.start_with?('/aviate')
|
|
10
|
+
dynamic_root = '/aviate'
|
|
9
11
|
else
|
|
10
12
|
dynamic_root = '/'
|
|
11
13
|
end
|
|
@@ -90,11 +92,12 @@
|
|
|
90
92
|
<% end %>
|
|
91
93
|
<% end %>
|
|
92
94
|
|
|
93
|
-
<%# Process remaining segments (excluding root "kaui"
|
|
95
|
+
<%# Process remaining segments (excluding root segments like "kaui" or "aviate") %>
|
|
94
96
|
<% sanitized_segments = segments.map { |segment| CGI.escapeHTML(segment) } %>
|
|
95
97
|
<%
|
|
96
|
-
# Skip the first segment if it's
|
|
97
|
-
|
|
98
|
+
# Skip the first segment if it's a root mount point since we already handled home
|
|
99
|
+
root_segments = %w[kaui aviate]
|
|
100
|
+
display_segments = root_segments.include?(sanitized_segments.first) ? sanitized_segments[1..-1] : sanitized_segments
|
|
98
101
|
%>
|
|
99
102
|
|
|
100
103
|
<% display_segments.each_with_index do |segment, index| %>
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
} %>
|
|
143
143
|
<% end %>
|
|
144
144
|
|
|
145
|
-
<% if can?(:create, Kaui::Subscription) && @subscription[bundle.bundle_id].present? %>
|
|
145
|
+
<% if can?(:create, Kaui::Subscription) && @subscription[bundle.bundle_id].present? && sub.product_category != 'ADD_ON' %>
|
|
146
146
|
<% menu_items << {
|
|
147
147
|
label: @subscription[bundle.bundle_id].product_category == 'BASE' ? 'Add add-on' : 'Add standalone subscription',
|
|
148
148
|
path: kaui_engine.new_subscription_path(
|
data/lib/kaui/version.rb
CHANGED