kaui 4.0.24 → 4.0.26

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/images/kaui/blocking-states/shield-white.svg +3 -0
  4. data/app/assets/images/kaui/timeline/block.svg +4 -0
  5. data/app/assets/stylesheets/kaui/auth_pages.css +9 -0
  6. data/app/assets/stylesheets/kaui/kaui.css +0 -206
  7. data/app/assets/stylesheets/kaui/subscription.css +38 -0
  8. data/app/assets/stylesheets/kaui/tags.css +7 -7
  9. data/app/controllers/kaui/account_timelines_controller.rb +24 -6
  10. data/app/controllers/kaui/accounts_controller.rb +24 -1
  11. data/app/controllers/kaui/bundles_controller.rb +14 -0
  12. data/app/controllers/kaui/subscriptions_controller.rb +14 -0
  13. data/app/helpers/kaui/date_helper.rb +12 -0
  14. data/app/helpers/kaui/exception_helper.rb +1 -1
  15. data/app/services/dependencies/aviate.rb +7 -4
  16. data/app/views/kaui/account_timelines/show.html.erb +247 -88
  17. data/app/views/kaui/accounts/_billing_details.html.erb +13 -1
  18. data/app/views/kaui/accounts/_billing_info.html.erb +5 -1
  19. data/app/views/kaui/accounts/block.html.erb +16 -0
  20. data/app/views/kaui/admin_allowed_users/_form.html.erb +5 -1
  21. data/app/views/kaui/bundles/block.html.erb +16 -0
  22. data/app/views/kaui/components/blocking_state_form/_about_panel.html.erb +9 -0
  23. data/app/views/kaui/components/blocking_state_form/_fields.html.erb +79 -0
  24. data/app/views/kaui/layouts/kaui_account_navbar.html.erb +1 -0
  25. data/app/views/kaui/layouts/kaui_account_sidebar.html.erb +1 -0
  26. data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +24 -0
  27. data/app/views/kaui/subscriptions/block.html.erb +16 -0
  28. data/config/locales/en.yml +4 -0
  29. data/config/routes.rb +6 -0
  30. data/lib/kaui/version.rb +1 -1
  31. metadata +26 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19115a4ca850dfd755598a560dc66e96b00694f00b305e057260fd6b13c57e3d
4
- data.tar.gz: 9780699cd5e97d8c6887b3e0c200d968a11e644afd5496c58829277d558a28bc
3
+ metadata.gz: 939bd1335abb8e3253fba3edb39871baab6a2bca5f7e10f26747b8bf22c3bfa9
4
+ data.tar.gz: eb850fd782524ffae4f8a7a652eece483244ddeb798d5221485b083e8f1d0039
5
5
  SHA512:
6
- metadata.gz: 8bcf2e6e322833277c4d305aca8621bf4495cc6443961af0a565bf7da0d6efdb5892d8b66ac31e820f08953d221ad54b309018fbd3d088032e211ea73d51abd9
7
- data.tar.gz: e1a44d558e7b996185be6a79cca68fb2eecb4e200f2affff7e5de3ccf0ca6a38f78d0ffdc814c67f3ab794585e6d7b4c4604dfe06ea77e7b7bc86360e229273e
6
+ metadata.gz: e07257d417598b8ef1514b22bf2551673b07c64aa66164f0e791751f2e93e362853a2d60c5d376bf3254b78498b208fb76c39abb7e342866288896b91acdeebe
7
+ data.tar.gz: a61104d90eddee06456c260d26c1adca1a6ad0fb0790587063592178ba40722be8b7efcbdaaf6de6575712f660d396b48613004dafadd43a12b7477c43495b79
data/README.md CHANGED
@@ -19,7 +19,7 @@ Kill Bill compatibility
19
19
  Dependencies
20
20
  ------------
21
21
 
22
- Ruby 3.2.2+ or JRuby 9.4.2.0+ required.
22
+ Ruby 3.1.0+ or JRuby 10.0.6.0+ required.
23
23
 
24
24
  Running Kaui locally
25
25
  ---------------------
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M10 1.66675L17.0833 4.16675V9.44119C17.0833 13.2489 14.5321 16.5934 10.8563 17.5793L10 17.8085L9.14367 17.5793C5.46791 16.5934 2.91667 13.2489 2.91667 9.44119V4.16675L10 1.66675Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M10 18.3337C14.6024 18.3337 18.3334 14.6027 18.3334 10.0003C18.3334 5.39795 14.6024 1.66699 10 1.66699C5.39765 1.66699 1.66669 5.39795 1.66669 10.0003C1.66669 14.6027 5.39765 18.3337 10 18.3337Z" stroke="#414651" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M4.39587 4.39795L15.6042 15.6062" stroke="#414651" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ </svg>
@@ -2,6 +2,15 @@
2
2
  min-height: 100vh;
3
3
  width: 100%;
4
4
  background-color: #fff;
5
+ overflow: hidden;
6
+ }
7
+
8
+ .auth-container .centered-absolute {
9
+ position: relative;
10
+ top: 0;
11
+ left: 0;
12
+ transform: none;
13
+ margin: 1.5rem auto 0;
5
14
  }
6
15
 
7
16
  .auth-form-container {
@@ -16,209 +16,3 @@
16
16
  image-url("glyphicons-halflings-regular.ttf") format("truetype"),
17
17
  image-url("glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg");
18
18
  }
19
-
20
- .tag-bar {
21
- border-bottom: 0.0625rem solid #ddd;
22
- margin-bottom: 0;
23
- position: relative;
24
- }
25
-
26
- .tag-bar .tag-select {
27
- display: inline-block;
28
- vertical-align: middle;
29
- }
30
-
31
- @media (max-width: 28.125rem) {
32
- .tag-bar .tag-select {
33
- width: 35%;
34
- }
35
- }
36
-
37
- .tag-bar .tag-select span {
38
- padding: 0.3125rem 1.25rem;
39
- text-align: center;
40
- display: block;
41
- border-right: 0.0625rem solid #ddd;
42
- }
43
-
44
- @media (max-width: 48rem) {
45
- .tag-bar .tag-select span {
46
- border: 0;
47
- }
48
- }
49
-
50
- .tag-bar .tag-select span i {
51
- margin: 0 0.3125rem;
52
- color: #515151;
53
- font-size: 1rem;
54
- }
55
-
56
- .tag-bar .tag-select span i.fa-caret-down {
57
- color: #999999;
58
- font-size: 0.75rem;
59
- }
60
-
61
- .tag-bar .tag-select span i.fa-tag {
62
- font-size: 1.125rem;
63
- }
64
-
65
- .tag-bar .tag-select span i.fa-money,
66
- .tag-bar .tag-select span i.fa-credit-card {
67
- font-size: 1rem;
68
- }
69
-
70
- .tag-bar .tag-select:hover .tag-select-box {
71
- max-height: 31.25rem;
72
- padding: 1.25rem 1.5625rem;
73
- border: 0.0625rem solid #ddd;
74
- box-shadow: 0.0625rem 0.1875rem 0.125rem rgba(0, 0, 0, 0.11);
75
- }
76
-
77
- .tag-bar .tag-select .tag-select-box {
78
- position: absolute;
79
- top: 100%;
80
- left: -0.0625rem;
81
- max-height: 0;
82
- background-color: #fff;
83
- z-index: 100;
84
- padding: 0 0.9375rem;
85
- font-size: 0.75rem;
86
- color: #999999;
87
- overflow: auto;
88
- width: auto;
89
- border-bottom: 0;
90
- display: inline-block;
91
- }
92
-
93
- @media (max-width: 48rem) {
94
- .tag-bar .tag-select .tag-select-box {
95
- border: 0;
96
- }
97
- }
98
-
99
- .tag-bar .tag-select .tag-select-box strong {
100
- display: block;
101
- font-weight: 400;
102
- margin: 0 0 0.625rem;
103
- }
104
-
105
- .tag-bar .tag-select .tag-select-box form {
106
- display: inline-block;
107
- width: 13.125rem;
108
- }
109
-
110
- .tag-bar .tag-select .tag-select-box input[type="checkbox"] {
111
- display: inline-block;
112
- width: 9%;
113
- margin: 0 1% 0 0;
114
- line-height: 1.25rem;
115
- vertical-align: middle;
116
- }
117
-
118
- .tag-bar .tag-select .tag-select-box label {
119
- font-size: 0.75rem;
120
- display: inline-block;
121
- width: 85%;
122
- line-height: 1.25rem;
123
- vertical-align: middle;
124
- margin: 0;
125
- font-weight: 400;
126
- }
127
-
128
- .tag-bar .tag-select .tag-select-box textarea {
129
- resize: none;
130
- height: 5rem;
131
- margin: 0 0 1.25rem;
132
- width: 100%;
133
- }
134
-
135
- .tag-bar .tag-select .tag-select-box a {
136
- display: block;
137
- font-size: 0.75rem;
138
- line-height: 1.25rem;
139
- }
140
-
141
- .tag-bar .tag-selected {
142
- display: inline-block;
143
- padding: 0.125rem 0.3125rem;
144
- vertical-align: middle;
145
- }
146
-
147
- @media (max-width: 48rem) {
148
- .tag-bar .tag-selected {
149
- width: 64%;
150
- padding: 0.125rem;
151
- overflow: hidden;
152
- border-left: 0.0625rem solid #ddd;
153
- }
154
- }
155
-
156
- .tag-bar .tag-selected span {
157
- display: inline-block;
158
- font-size: 0.75rem;
159
- color: #777777;
160
- background: #e5e5e5;
161
- padding: 0.1875rem 1.25rem;
162
- margin: 0 0.3125rem;
163
- transition: all 0.5s;
164
- cursor: pointer;
165
- }
166
-
167
- .tag-bar .tag-selected span:hover {
168
- background-color: #cce9eb;
169
- }
170
-
171
- @media (max-width: 48rem) {
172
- .tag-bar .tag-selected span {
173
- font-size: 0.625rem;
174
- padding: 0.1875rem 0.3125rem;
175
- display: block;
176
- margin: 0 0 0.125rem;
177
- }
178
- }
179
-
180
- .tag-bar-breathe {
181
- margin-bottom: 1.875rem;
182
- }
183
-
184
- .tag-bar-no-border {
185
- border-bottom: 0;
186
- }
187
-
188
- .tag-bar-no-border .tag-select span {
189
- border-right: 0;
190
- }
191
-
192
- #main-menu .tag-bar .tag-select {
193
- position: relative;
194
- }
195
-
196
- #main-menu .tag-bar .tag-select-box {
197
- word-break: keep-all;
198
- white-space: nowrap;
199
- }
200
-
201
- .inline-row-tag-bar {
202
- padding-left: 0.625rem !important;
203
- }
204
-
205
- .inline-row-tag-bar .tag-bar .tag-select span {
206
- padding: 0.3125rem;
207
- border-right: none;
208
- }
209
-
210
- .inline-row-tag-bar .tag-bar .tag-select span i {
211
- margin: 0 0.1875rem;
212
- font-size: 0.75rem;
213
- }
214
-
215
- .inline-row-tag-bar .tag-bar .tag-select span i.fa-tag {
216
- font-size: 0.75rem;
217
- }
218
-
219
- .inline-row-tag-bar .tag-bar .tag-select-box label {
220
- white-space: nowrap;
221
- }
222
-
223
-
224
- /*# sourceMappingURL=kaui2.css.map */
@@ -437,6 +437,44 @@ table tr.expired td {
437
437
  right: 0.5rem;
438
438
  }
439
439
 
440
+ /* app/views/kaui/components/blocking_state_form/_about_panel.html.erb */
441
+
442
+ .blocking-state-about-panel {
443
+ flex: 0 0 20rem;
444
+ max-width: 20rem;
445
+ height: fit-content;
446
+ padding: 1.25rem;
447
+ background-color: #EFF6FF;
448
+ border: 0.0625rem solid #DBEAFE;
449
+ border-radius: 0.5rem;
450
+ }
451
+
452
+ .blocking-state-about-panel .icon-container {
453
+ display: inline-flex;
454
+ justify-content: center;
455
+ align-items: center;
456
+ width: 2.5rem;
457
+ height: 2.5rem;
458
+ border-radius: 50%;
459
+ background-color: #2563EB;
460
+ flex-shrink: 0;
461
+ }
462
+
463
+ .blocking-state-about-panel h6 {
464
+ font-weight: 600;
465
+ font-size: 1rem;
466
+ line-height: 1.5rem;
467
+ color: #1B1C1E;
468
+ }
469
+
470
+ .blocking-state-about-panel p {
471
+ font-size: 0.875rem;
472
+ font-weight: 400;
473
+ line-height: 1.25rem;
474
+ color: #414651;
475
+ margin-bottom: 0;
476
+ }
477
+
440
478
  .kaui-subscription-new .form-group.d-flex.pb-3 .form-control {
441
479
  height: 2.5rem;
442
480
  border-radius: 0.375rem;
@@ -15,7 +15,7 @@
15
15
  }
16
16
  }
17
17
 
18
- .tag-bar .tag-select span {
18
+ .tag-bar .tag-select > span {
19
19
  padding: 0.3125rem 1.25rem;
20
20
  text-align: center;
21
21
  display: block;
@@ -23,7 +23,7 @@
23
23
  }
24
24
 
25
25
  @media (max-width: 48rem) {
26
- .tag-bar .tag-select span {
26
+ .tag-bar .tag-select > span {
27
27
  border: 0;
28
28
  }
29
29
  }
@@ -67,9 +67,8 @@
67
67
  font-size: 0.75rem;
68
68
  color: #999999;
69
69
  overflow: hidden;
70
- min-width: 15rem;
71
- width: max-content;
72
- max-width: min(25rem, 95vw);
70
+ width: 17rem;
71
+ max-width: min(17rem, 95vw);
73
72
  border-bottom: 0;
74
73
  display: inline-block;
75
74
  }
@@ -107,6 +106,7 @@
107
106
  vertical-align: middle;
108
107
  margin: 0;
109
108
  font-weight: 400;
109
+ overflow-wrap: anywhere;
110
110
  }
111
111
 
112
112
  .tag-bar .tag-select .tag-select-box textarea {
@@ -169,7 +169,7 @@
169
169
  border-bottom: 0;
170
170
  }
171
171
 
172
- .tag-bar-no-border .tag-select span {
172
+ .tag-bar-no-border .tag-select > span {
173
173
  border-right: 0;
174
174
  }
175
175
 
@@ -186,7 +186,7 @@
186
186
  padding-left: 0.625rem !important;
187
187
  }
188
188
 
189
- .inline-row-tag-bar .tag-bar .tag-select span {
189
+ .inline-row-tag-bar .tag-bar .tag-select > span {
190
190
  padding: 0.3125rem;
191
191
  border-right: none;
192
192
  }
@@ -11,6 +11,7 @@ module Kaui
11
11
  @invoices = timeline.invoices
12
12
  @payments = timeline.payments
13
13
  extract_invoices_by_id(@invoices)
14
+ @account_blocking_states = fetch_account_blocking_states(@account)
14
15
 
15
16
  # Lookup all bundle names
16
17
  @bundle_names = {}
@@ -51,6 +52,7 @@ module Kaui
51
52
  @invoices = timeline.invoices
52
53
  @payments = timeline.payments
53
54
  extract_invoices_by_id(@invoices)
55
+ @account_blocking_states = fetch_account_blocking_states(@account)
54
56
 
55
57
  # Lookup all bundle names
56
58
  @bundle_names = {}
@@ -117,20 +119,30 @@ module Kaui
117
119
  @bundles.each do |bundle|
118
120
  bundle.subscriptions.each do |sub|
119
121
  sub.events.each do |event|
120
- # Skip SERVICE_STATE_CHANGE events
121
- next if event.event_type == 'SERVICE_STATE_CHANGE'
122
-
123
122
  effective_date = event.effective_date.present? ? Date.parse(event.effective_date).to_s : '[unknown]'
124
123
  bundle_keys = @bundle_names[bundle.external_key]
125
- event_type = event.event_type
126
- phase = event.phase
127
124
  audit_logs = event.audit_logs.present? ? event.audit_logs.map { |entry| Kaui::AuditLog.description(entry) }.join(', ') : ''
125
+ details = if event.event_type == 'SERVICE_STATE_CHANGE' || event.is_blocked_billing || event.is_blocked_entitlement
126
+ "#{event.service_name}/#{event.service_state_name} (billing=#{event.is_blocked_billing}, entitlement=#{event.is_blocked_entitlement})"
127
+ else
128
+ event.phase
129
+ end
128
130
 
129
- csv << [effective_date, bundle_keys, event_type, phase, audit_logs] if filter_date?(effective_date, start_date, end_date)
131
+ csv << [effective_date, bundle_keys, event.event_type, details, audit_logs] if filter_date?(effective_date, start_date, end_date)
130
132
  end
131
133
  end
132
134
  end
133
135
  end
136
+
137
+ if %w[ENTITLEMENT ALL].include?(event_type)
138
+ @account_blocking_states.each do |blocking_state|
139
+ effective_date = blocking_state.effective_date.present? ? Date.parse(blocking_state.effective_date).to_s : '[unknown]'
140
+ audit_logs = blocking_state.audit_logs.present? ? blocking_state.audit_logs.map { |entry| Kaui::AuditLog.description(entry) }.join(', ') : ''
141
+ details = "#{blocking_state.service}/#{blocking_state.state_name} (billing=#{blocking_state.is_block_billing}, entitlement=#{blocking_state.is_block_entitlement}, change=#{blocking_state.is_block_change})"
142
+
143
+ csv << [effective_date, '', 'SERVICE_STATE_CHANGE', details, audit_logs] if filter_date?(effective_date, start_date, end_date)
144
+ end
145
+ end
134
146
  end
135
147
 
136
148
  send_data csv_string, filename: "account-timelines-#{Time.zone.today}.csv", type: 'text/csv'
@@ -161,5 +173,11 @@ module Kaui
161
173
  [invoice.invoice_id, Kaui::Invoice.build_from_raw_invoice(invoice)]
162
174
  end
163
175
  end
176
+
177
+ def fetch_account_blocking_states(account)
178
+ account.blocking_states(nil, nil, 'NONE', options_for_klient)
179
+ rescue StandardError
180
+ []
181
+ end
164
182
  end
165
183
  end
@@ -156,7 +156,15 @@ module Kaui
156
156
  @children = wait(fetch_children)
157
157
  @account_parent = @account.parent_account_id.nil? ? nil : wait(fetch_parent)
158
158
  @email_notification_configuration = is_email_notifications_plugin_available ? wait(fetch_email_notification_configuration) : []
159
- @bundles = wait(fetch_bundles)
159
+ @bundles = begin
160
+ wait(fetch_bundles)
161
+ rescue KillBillClient::API::ResponseError => e
162
+ # e.g. a subscription references a plan that no longer exists in the currently loaded catalog.
163
+ # Don't fail the whole account page for this, just warn and show it without bundle-derived data.
164
+ Rails.logger.warn("Unable to fetch bundles for account #{@account.account_id}: #{as_string(e)}")
165
+ flash.now[:warning] = "Unable to load some subscription details: #{as_string(e)}"
166
+ []
167
+ end
160
168
 
161
169
  @last_transaction_by_payment_method_id = {}
162
170
  wait(fetch_payments).each do |payment|
@@ -383,5 +391,20 @@ module Kaui
383
391
  data = KillBillClient::Model::Export.find_by_account_id(params[:account_id], current_user.kb_username, options_for_klient)
384
392
  send_data data, filename: "account#{params[:account_id]}.txt", type: :txt
385
393
  end
394
+
395
+ def block
396
+ @account = Kaui::Account.find_by_id(params.require(:account_id), false, false, options_for_klient)
397
+ end
398
+
399
+ def do_block
400
+ account_id = params.require(:account_id)
401
+ account = Kaui::Account.new(account_id:)
402
+ account.set_blocking_state(params.require(:state_name), params.require(:service),
403
+ params[:is_block_change] == '1', params[:is_block_entitlement] == '1',
404
+ params[:is_block_billing] == '1', params[:requested_date].presence,
405
+ current_user.kb_username, params[:reason], params[:comment], options_for_klient)
406
+
407
+ redirect_to account_path(account_id), notice: 'Blocking state was successfully created'
408
+ end
386
409
  end
387
410
  end
@@ -128,6 +128,20 @@ module Kaui
128
128
  redirect_to kaui_engine.account_bundles_path(@account.account_id), notice: msg
129
129
  end
130
130
 
131
+ def block
132
+ @bundle = Kaui::Bundle.find_by_id_or_key(params.require(:id), options_for_klient)
133
+ end
134
+
135
+ def do_block
136
+ bundle = Kaui::Bundle.new(bundle_id: params.require(:id))
137
+ bundle.set_blocking_state(params.require(:state_name), params.require(:service),
138
+ params[:is_block_change] == '1', params[:is_block_entitlement] == '1',
139
+ params[:is_block_billing] == '1', params[:requested_date].presence,
140
+ current_user.kb_username, params[:reason], params[:comment], options_for_klient)
141
+
142
+ redirect_to kaui_engine.account_bundles_path(params.require(:account_id)), notice: 'Blocking state was successfully created'
143
+ end
144
+
131
145
  private
132
146
 
133
147
  def search_bundles(query, search_by, options)
@@ -150,6 +150,20 @@ module Kaui
150
150
  redirect_to kaui_engine.account_bundles_path(input_subscription['account_id']), notice: 'Subscription BCD was successfully changed'
151
151
  end
152
152
 
153
+ def block
154
+ @subscription = Kaui::Subscription.find_by_id(params.require(:id), 'NONE', options_for_klient)
155
+ end
156
+
157
+ def do_block
158
+ subscription = Kaui::Subscription.new(subscription_id: params.require(:id))
159
+ subscription.set_blocking_state(params.require(:state_name), params.require(:service),
160
+ params[:is_block_change] == '1', params[:is_block_entitlement] == '1',
161
+ params[:is_block_billing] == '1', params[:requested_date].presence,
162
+ current_user.kb_username, params[:reason], params[:comment], options_for_klient)
163
+
164
+ redirect_to kaui_engine.account_bundles_path(params.require(:account_id)), notice: 'Blocking state was successfully created'
165
+ end
166
+
153
167
  def edit_quantity
154
168
  @subscription = Kaui::Subscription.find_by_id(params.require(:id), 'NONE', options_for_klient)
155
169
  end
@@ -24,6 +24,18 @@ module Kaui
24
24
  DateTime.parse(date_s).strftime('%FT%T')
25
25
  end
26
26
 
27
+ # Best-effort epoch (seconds) timestamp for a timeline entry's date/time
28
+ # value, used purely for client-side "Sort by Date" ordering on the
29
+ # account timeline page. Returns nil if the date is missing or cannot be
30
+ # parsed (entries without a usable timestamp are sorted last).
31
+ def timeline_sort_timestamp(date)
32
+ return nil if date.blank?
33
+
34
+ DateTime.parse(date.to_s).to_i
35
+ rescue ArgumentError, TypeError
36
+ nil
37
+ end
38
+
27
39
  # Retrieve current killbill server time based on a time zone.
28
40
  # if no time zone is provided it will return UTC.
29
41
  # if the killbill server is not reachable it will return the time of the Kaui server
@@ -21,7 +21,7 @@ module Kaui
21
21
  I18n.t('errors.messages.error_communicating_killbill')
22
22
  else
23
23
  # Show detailed error in development/test, or when KAUI_SHOW_ERROR_DETAILS is set (for Docker)
24
- show_details = Rails.env.development? || Rails.env.test? || ENV['KAUI_SHOW_ERROR_DETAILS'].present?
24
+ show_details = Rails.env.local? || ENV['KAUI_SHOW_ERROR_DETAILS'].present?
25
25
  show_details ? exception.message : nil
26
26
  end
27
27
  end
@@ -21,10 +21,13 @@ module Dependencies
21
21
  # Any error (plugin not installed, missing/invalid JWT, network issue, etc.) is treated as
22
22
  # "not Aviate" so that callers can safely fall back to the existing XML-catalog behavior.
23
23
  def aviate_catalog?(account_id, options_for_klient)
24
- response = KillBillClient::API.get("#{KILLBILL_AVIATE_PREFIX}/catalog/info", catalog_params(account_id), request_options(options_for_klient))
25
- JSON.parse(response.body)['state'] == CATALOG_STATE_AVIATE
26
- rescue StandardError => e
27
- Rails.logger.warn("Failed to retrieve Aviate catalog info: #{e.class}: #{e.message}")
24
+ params_list = account_id.present? ? [{ accountId: account_id }, {}] : [{}]
25
+ params_list.each do |params|
26
+ response = KillBillClient::API.get("#{KILLBILL_AVIATE_PREFIX}/catalog/info", params, request_options(options_for_klient))
27
+ return true if JSON.parse(response.body)['state'] == CATALOG_STATE_AVIATE
28
+ rescue StandardError => e
29
+ Rails.logger.warn("Failed to retrieve Aviate catalog info (params=#{params}): #{e.class}: #{e.message}")
30
+ end
28
31
  false
29
32
  end
30
33