Skip to content

Commit febcd5a

Browse files
committed
Fix failed CI
1 parent 4cbedaa commit febcd5a

10 files changed

Lines changed: 17 additions & 17 deletions

app/controllers/kaui/accounts_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def new
177177
def edit; end
178178

179179
def create
180-
@account = Kaui::Account.new(params.require(:account).to_h.compact_blank)
180+
@account = Kaui::Account.new(params.require(:account).permit!.to_h.compact_blank)
181181

182182
@account.errors.add(:phone, :invalid_phone) if !@account.phone.nil? && !@account.check_account_details_phone?
183183

@@ -202,7 +202,7 @@ def create
202202
end
203203

204204
def update
205-
@account = Kaui::Account.new(params.require(:account).to_h.compact_blank)
205+
@account = Kaui::Account.new(params.require(:account).permit!.to_h.compact_blank)
206206
@account.account_id = params.require(:account_id)
207207

208208
# Transform "1" into boolean
@@ -309,7 +309,7 @@ def validate_external_key
309309
end
310310

311311
def link_to_parent
312-
@account = Kaui::Account.new(params.require(:account).to_h.compact_blank)
312+
@account = Kaui::Account.new(params.require(:account).permit!.to_h.compact_blank)
313313
@account.account_id = params.require(:account_id)
314314
@account.is_payment_delegated_to_parent = @account.is_payment_delegated_to_parent == '1'
315315

app/controllers/kaui/admin_tenants_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def create_simple_plan
234234
options = tenant_options_for_client
235235
fetch_state_for_new_catalog_screen(options)
236236

237-
simple_plan = params.require(:simple_plan).to_h.compact_blank
237+
simple_plan = params.require(:simple_plan).permit!.to_h.compact_blank
238238
# Fix issue in Rails where first entry in the multi-select array is an empty string
239239
simple_plan['available_base_products']&.reject!(&:blank?)
240240

@@ -298,7 +298,7 @@ def modify_overdue_config
298298
options[:api_key] = current_tenant.api_key
299299
options[:api_secret] = current_tenant.api_secret
300300

301-
view_form_model = params.require(:kill_bill_client_model_overdue).to_h.compact_blank
301+
view_form_model = params.require(:kill_bill_client_model_overdue).permit!.to_h.compact_blank
302302
view_form_model['states'] = view_form_model['states'].values if view_form_model['states'].present?
303303

304304
overdue = Kaui::Overdue.from_overdue_form_model(view_form_model)

app/controllers/kaui/charges_controller.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ def new
1919
end
2020

2121
def create
22-
charge = Kaui::InvoiceItem.new(params.require(:invoice_item).to_h.compact_blank)
22+
charge = Kaui::InvoiceItem.new(params.require(:invoice_item).permit!.to_h.compact_blank)
2323
charge.account_id ||= params.require(:account_id)
2424

25+
# Preserve the original invoice_id since the API may not return it
26+
original_invoice_id = charge.invoice_id
27+
2528
auto_commit = params[:auto_commit] == '1'
2629

2730
charge = charge.create(auto_commit, current_user.kb_username, params[:reason], params[:comment], options_for_klient)
28-
redirect_to kaui_engine.account_invoice_path(charge.account_id, charge.invoice_id), notice: 'Charge was successfully created'
31+
redirect_to kaui_engine.account_invoice_path(charge.account_id, charge.invoice_id || original_invoice_id), notice: 'Charge was successfully created'
2932
end
3033
end
3134
end

app/controllers/kaui/credits_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def new
1919
end
2020

2121
def create
22-
credit = Kaui::Credit.new(params[:credit].to_h.compact_blank)
22+
credit = Kaui::Credit.new(params[:credit].permit!.to_h.compact_blank)
2323
credit.account_id ||= params.require(:account_id)
2424

2525
# No need to show the newly created invoice for account level credits

app/controllers/kaui/payment_methods_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def new
1212
end
1313

1414
def create
15-
@payment_method = Kaui::PaymentMethod.new(params[:payment_method].to_h.compact_blank)
15+
@payment_method = Kaui::PaymentMethod.new(params[:payment_method].permit!.to_h.compact_blank)
1616
# Transform "1" into boolean
1717
@payment_method.is_default = @payment_method.is_default == '1'
1818
# Sensible default

app/controllers/kaui/subscriptions_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def edit
3535
def create
3636
plan_name = params.require(:plan_name)
3737
@base_product_name = params[:base_product_name]
38-
@subscription = Kaui::Subscription.new(params.require(:subscription).to_h.compact_blank)
38+
@subscription = Kaui::Subscription.new(params.require(:subscription).permit!.to_h.compact_blank)
3939

4040
begin
4141
@bundle, plans_details = lookup_bundle_and_plan_details(@subscription, @base_product_name)

app/controllers/kaui/transactions_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def new
2424
end
2525

2626
def create
27-
transaction = Kaui::Transaction.new(params[:transaction].to_h.compact_blank)
27+
transaction = Kaui::Transaction.new(params[:transaction].permit!.to_h.compact_blank)
2828

2929
plugin_properties = params[:plugin_properties].values.reject { |item| item['value'].blank? || item['key'].blank? } if params[:plugin_properties].present?
3030
if plugin_properties.present?
@@ -43,7 +43,7 @@ def create
4343
end
4444

4545
def fix_transaction_state
46-
transaction = Kaui::Transaction.new(params[:transaction].to_h.compact_blank)
46+
transaction = Kaui::Transaction.new(params[:transaction].permit!.to_h.compact_blank)
4747
payment_id = transaction.payment_id
4848
transaction_id = transaction.transaction_id
4949
transaction_status = transaction.status

app/models/kaui/killbill_authenticatable.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
require 'killbill_client'
44

5-
# rubocop:disable Style/ClassAndModuleChildren, Style/OneClassPerFile
6-
75
# Hack for Zeitwerk - must define Kaui::KillbillAuthenticatable before Devise::Models::KillbillAuthenticatable
86
module Kaui
97
module KillbillAuthenticatable; end

app/models/kaui/killbill_registerable.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
# rubocop:disable Style/ClassAndModuleChildren, Style/OneClassPerFile
4-
53
# Hack for Zeitwerk - must define Kaui::KillbillRegisterable before Devise::Models::KillbillRegisterable
64
module Kaui
75
module KillbillRegisterable; end
@@ -14,4 +12,3 @@ module KillbillRegisterable
1412
end
1513
end
1614
end
17-
# rubocop:enable Style/ClassAndModuleChildren, Style/OneClassPerFile

test/functional/kaui/functional_test_helper_nosetup.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def login_as_admin
4848
get :new
4949
post :create, params: { user: { kb_username: USERNAME, password: PASSWORD } }
5050
end
51+
# Clear Devise's "Signed in successfully." flash to avoid polluting subsequent assertions
52+
flash.clear
5153
end
5254

5355
def logout

0 commit comments

Comments
 (0)