kaui 3.0.5 → 3.0.6
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/assets/javascripts/kaui/kaui_override.js +1 -6
- data/app/controllers/kaui/accounts_controller.rb +11 -24
- data/app/controllers/kaui/admin_tenants_controller.rb +1 -1
- data/app/controllers/kaui/engine_controller_util.rb +1 -0
- data/app/controllers/kaui/invoices_controller.rb +1 -7
- data/app/controllers/kaui/payments_controller.rb +1 -9
- data/app/services/dependencies/kenui.rb +40 -0
- data/app/views/kaui/invoices/index.html.erb +3 -0
- data/app/views/kaui/payments/index.html.erb +3 -0
- data/lib/kaui/engine.rb +0 -1
- data/lib/kaui/version.rb +1 -1
- data/lib/kaui.rb +14 -3
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f1640604b51f6dc5c1d70ed464a59445fd16fc830d69797bb73c18a351db03f
|
4
|
+
data.tar.gz: b385394d51aed523a26d34b437a7e4f8f869de07447b18a0fcce3d81948e275f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca50c69637a9fa3e7b7bd866ad3ac638bf676e8f8a61ff8b56e68eb7591f59fefa6536739b8c326523cf7013502586b23edc7fe62a08766e586cbcc73996aa07
|
7
|
+
data.tar.gz: 2ef386342bd738b4089d50dd1621c2e5e0542c37099435ef8a80f5419a30dd956d478ea3762a553b741985c5f6e1878686d502915b02b2f47f471d671ff11746
|
@@ -132,12 +132,7 @@ jQuery(document).ready(function ($) {
|
|
132
132
|
|
133
133
|
function set_first_name_length(name){
|
134
134
|
var name_in_parts = name.trim().split(' ');
|
135
|
-
|
136
|
-
if (name_in_parts.length > 1){
|
137
|
-
$('#account_first_name_length').val(name_in_parts[0].length);
|
138
|
-
}else{
|
139
|
-
$('#account_first_name_length').val('');
|
140
|
-
}
|
135
|
+
$('#account_first_name_length').val(name_in_parts[0].length);
|
141
136
|
}
|
142
137
|
|
143
138
|
|
@@ -135,12 +135,10 @@ module Kaui
|
|
135
135
|
fetch_account_emails = promise { Kaui::AccountEmail.find_all_sorted_by_account_id(@account.account_id, 'NONE', cached_options_for_klient) }
|
136
136
|
fetch_payments = promise { @account.payments(cached_options_for_klient).map! { |payment| Kaui::Payment.build_from_raw_payment(payment) } }
|
137
137
|
fetch_payment_methods = promise { Kaui::PaymentMethod.find_all_by_account_id(@account.account_id, false, cached_options_for_klient) }
|
138
|
-
|
139
|
-
# is email notification plugin available
|
140
|
-
is_email_notifications_plugin_available = Kenui::EmailNotificationService.email_notification_plugin_available?(cached_options_for_klient).first
|
138
|
+
is_email_notifications_plugin_available = Dependencies::Kenui::EmailNotification.email_notification_plugin_available?(cached_options_for_klient).first
|
141
139
|
fetch_email_notification_configuration = if is_email_notifications_plugin_available
|
142
140
|
promise do
|
143
|
-
Kenui::
|
141
|
+
Dependencies::Kenui::EmailNotification.get_configuration_per_account(params.require(:account_id), cached_options_for_klient)
|
144
142
|
end.then do |configuration|
|
145
143
|
if configuration.first.is_a?(FalseClass)
|
146
144
|
Rails.logger.warn(configuration[1])
|
@@ -175,7 +173,7 @@ module Kaui
|
|
175
173
|
@available_tags = wait(fetch_available_tags)
|
176
174
|
@children = wait(fetch_children)
|
177
175
|
@account_parent = @account.parent_account_id.nil? ? nil : wait(fetch_parent)
|
178
|
-
@email_notification_configuration = wait(fetch_email_notification_configuration)
|
176
|
+
@email_notification_configuration = is_email_notifications_plugin_available ? wait(fetch_email_notification_configuration) : []
|
179
177
|
|
180
178
|
@last_transaction_by_payment_method_id = {}
|
181
179
|
wait(fetch_payments).each do |payment|
|
@@ -345,15 +343,15 @@ module Kaui
|
|
345
343
|
event_types = configuration[:event_types]
|
346
344
|
cached_options_for_klient = options_for_klient
|
347
345
|
|
348
|
-
is_success, message = email_notification_plugin_available?(cached_options_for_klient)
|
346
|
+
is_success, message = Dependencies::Kenui::EmailNotification.email_notification_plugin_available?(cached_options_for_klient)
|
349
347
|
|
350
348
|
if is_success
|
351
|
-
is_success, message = Kenui::
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
349
|
+
is_success, message = Dependencies::Kenui::EmailNotification.set_configuration_per_account(account_id,
|
350
|
+
event_types,
|
351
|
+
current_user.kb_username,
|
352
|
+
params[:reason],
|
353
|
+
params[:comment],
|
354
|
+
cached_options_for_klient)
|
357
355
|
end
|
358
356
|
if is_success
|
359
357
|
flash[:notice] = message
|
@@ -365,7 +363,7 @@ module Kaui
|
|
365
363
|
|
366
364
|
def events_to_consider
|
367
365
|
json_response do
|
368
|
-
{ data: Kenui::
|
366
|
+
{ data: Dependencies::Kenui::EmailNotification.get_events_to_consider(options_for_klient) }
|
369
367
|
end
|
370
368
|
end
|
371
369
|
|
@@ -373,16 +371,5 @@ module Kaui
|
|
373
371
|
data = KillBillClient::Model::Export.find_by_account_id(params[:account_id], current_user.kb_username, options_for_klient)
|
374
372
|
send_data data, filename: "account#{params[:account_id]}.txt", type: :txt
|
375
373
|
end
|
376
|
-
|
377
|
-
private
|
378
|
-
|
379
|
-
def email_notification_plugin_available?(options_for_klient)
|
380
|
-
error_message = 'Email notification plugin is not installed'
|
381
|
-
|
382
|
-
is_available = Kenui::EmailNotificationService.email_notification_plugin_available?(options_for_klient).first
|
383
|
-
[is_available, is_available ? nil : error_message]
|
384
|
-
rescue StandardError
|
385
|
-
[false, error_message]
|
386
|
-
end
|
387
374
|
end
|
388
375
|
end
|
@@ -142,7 +142,7 @@ module Kaui
|
|
142
142
|
else
|
143
143
|
errors = ''
|
144
144
|
catalog_validation_errors.each do |validation_error|
|
145
|
-
errors +=
|
145
|
+
errors += validation_error['errorDescription']
|
146
146
|
end
|
147
147
|
flash[:error] = errors
|
148
148
|
redirect_to admin_tenant_new_catalog_path(id: current_tenant.id)
|
@@ -41,6 +41,7 @@ module Kaui
|
|
41
41
|
# Until we support server-side sorting
|
42
42
|
ordering = (params[:order] || {})[:'0'] || {}
|
43
43
|
ordering_column = (ordering[:column] || 0).to_i
|
44
|
+
ordering_column = params[:colum_order][ordering_column].to_i if params[:colum_order].present?
|
44
45
|
ordering_dir = ordering[:dir] || 'asc'
|
45
46
|
unless search_key.nil?
|
46
47
|
pages.sort! do |a, b|
|
@@ -70,13 +70,7 @@ module Kaui
|
|
70
70
|
end
|
71
71
|
else
|
72
72
|
lambda do |invoice, column|
|
73
|
-
[
|
74
|
-
invoice.invoice_number.to_i,
|
75
|
-
invoice.invoice_date,
|
76
|
-
invoice.amount,
|
77
|
-
invoice.balance,
|
78
|
-
invoice.status
|
79
|
-
][column]
|
73
|
+
Kaui.account_invoices_columns.call(invoice, view_context)[2][column]
|
80
74
|
end
|
81
75
|
end
|
82
76
|
|
@@ -118,15 +118,7 @@ module Kaui
|
|
118
118
|
end
|
119
119
|
|
120
120
|
data_extractor = lambda do |payment, column|
|
121
|
-
[
|
122
|
-
payment.payment_number.to_i,
|
123
|
-
payment.payment_date,
|
124
|
-
payment.total_authed_amount_to_money,
|
125
|
-
payment.paid_amount_to_money,
|
126
|
-
payment.returned_amount_to_money,
|
127
|
-
payment.transactions.empty? ? nil : payment.transactions[-1].status,
|
128
|
-
payment.payment_external_key
|
129
|
-
][column]
|
121
|
+
Kaui.account_payments_columns.call(account, payment, view_context)[2][column]
|
130
122
|
end
|
131
123
|
|
132
124
|
formatter = lambda do |payment|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dependencies
|
4
|
+
module Kenui
|
5
|
+
class EmailNotification
|
6
|
+
ERROR_MESSAGE = I18n.translate('errors.messages.email_notification_plugin_not_available')
|
7
|
+
class << self
|
8
|
+
def email_notification_plugin_available?(options_for_klient)
|
9
|
+
is_available = ::Kenui::EmailNotificationService.email_notification_plugin_available?(options_for_klient)
|
10
|
+
[is_available, is_available ? nil : ERROR_MESSAGE]
|
11
|
+
rescue StandardError
|
12
|
+
[false, ERROR_MESSAGE]
|
13
|
+
end
|
14
|
+
|
15
|
+
def set_configuration_per_account(account_id, event_types, kb_username, reason, comment, options_for_klient)
|
16
|
+
::Kenui::EmailNotificationService.set_configuration_per_account(account_id,
|
17
|
+
event_types,
|
18
|
+
kb_username,
|
19
|
+
reason,
|
20
|
+
comment,
|
21
|
+
options_for_klient)
|
22
|
+
rescue StandardError
|
23
|
+
[false, ERROR_MESSAGE]
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_events_to_consider(options_for_klient)
|
27
|
+
::Kenui::EmailNotificationService.get_events_to_consider(options_for_klient)
|
28
|
+
rescue StandardError
|
29
|
+
{}
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_configuration_per_account(account_id, options_for_klient)
|
33
|
+
::Kenui::EmailNotificationService.get_configuration_per_account(account_id, options_for_klient)
|
34
|
+
rescue StandardError
|
35
|
+
[]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -64,6 +64,9 @@ $(document).ready(function() {
|
|
64
64
|
"search": {"search": "<%= @search_query %>"},
|
65
65
|
"ajax": {
|
66
66
|
url: "<%= invoices_pagination_path(:ordering => @ordering, :format => :json) %>",
|
67
|
+
data: function(d) {
|
68
|
+
d.colum_order = $('#invoices-table').DataTable().colReorder.order();
|
69
|
+
},
|
67
70
|
dataSrc: function(json) {
|
68
71
|
var colOrder = table.colReorder.order();
|
69
72
|
var reorderedData = json.data.map(function(row) {
|
@@ -76,6 +76,9 @@ $(document).ready(function() {
|
|
76
76
|
"paging": false,
|
77
77
|
"ajax": {
|
78
78
|
url: "<%= payments_pagination_path(:format => :json) %>",
|
79
|
+
data: function(d) {
|
80
|
+
d.colum_order = $('#payments-table').DataTable().colReorder.order();
|
81
|
+
},
|
79
82
|
dataSrc: function(json) {
|
80
83
|
var colOrder = $('#payments-table').DataTable().colReorder.order();
|
81
84
|
var reorderedData = json.data.map(function(row) {
|
data/lib/kaui/engine.rb
CHANGED
data/lib/kaui/version.rb
CHANGED
data/lib/kaui.rb
CHANGED
@@ -142,8 +142,10 @@ module Kaui
|
|
142
142
|
invoice&.send(attr.downcase)
|
143
143
|
end
|
144
144
|
end
|
145
|
-
|
146
|
-
|
145
|
+
|
146
|
+
raw_data = fields.map { |attr| invoice&.send(attr.downcase) }
|
147
|
+
|
148
|
+
[headers, values, raw_data]
|
147
149
|
end
|
148
150
|
|
149
151
|
self.account_payments_columns = lambda do |account = nil, payment = nil, view_context = nil|
|
@@ -177,8 +179,17 @@ module Kaui
|
|
177
179
|
end
|
178
180
|
end
|
179
181
|
|
182
|
+
raw_data = fields.map do |attr|
|
183
|
+
case attr
|
184
|
+
when 'status'
|
185
|
+
payment.transactions.empty? ? nil : payment.transactions[-1].status
|
186
|
+
else
|
187
|
+
payment&.send(attr.downcase)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
180
191
|
# Add additional values if needed
|
181
|
-
[headers, values]
|
192
|
+
[headers, values, raw_data]
|
182
193
|
end
|
183
194
|
|
184
195
|
self.account_audit_logs_columns = lambda do
|
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: 3.0.
|
4
|
+
version: 3.0.6
|
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: 2025-
|
11
|
+
date: 2025-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -150,20 +150,6 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: kenui
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :runtime
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
154
|
name: killbill-assets-ui
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -424,6 +410,7 @@ files:
|
|
424
410
|
- app/models/kaui/transaction.rb
|
425
411
|
- app/models/kaui/user.rb
|
426
412
|
- app/models/kaui/user_role.rb
|
413
|
+
- app/services/dependencies/kenui.rb
|
427
414
|
- app/views/kaui/account_children/index.html.erb
|
428
415
|
- app/views/kaui/account_custom_fields/index.html.erb
|
429
416
|
- app/views/kaui/account_emails/_account_emails_table.html.erb
|