From 7520f21b90c80a55a6a46ce16761d7b4a76f3e68 Mon Sep 17 00:00:00 2001 From: dripsmvcp <138900956+dripsmvcp@users.noreply.github.com> Date: Wed, 20 May 2026 02:35:30 +0900 Subject: [PATCH 1/2] fix(enable_banking): match bank list search against BIC, not just name Bank-search filter on the Enable Banking bank-selection modal only indexed `aspsp[:name]`, so users searching by BIC code (e.g. `INGDDEFF`) got no results even when the bank was rendered in the list. Switch the per-item data attribute to a `name + BIC` haystack and read from it in the Stimulus controller, so either token matches. Refs #1814 --- .../controllers/bank_search_controller.js | 4 +- .../enable_banking_items/select_bank.html.erb | 2 +- .../enable_banking_items_controller_test.rb | 42 +++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 test/controllers/enable_banking_items_controller_test.rb diff --git a/app/javascript/controllers/bank_search_controller.js b/app/javascript/controllers/bank_search_controller.js index a2c045cd98..d75a2f7de4 100644 --- a/app/javascript/controllers/bank_search_controller.js +++ b/app/javascript/controllers/bank_search_controller.js @@ -8,8 +8,8 @@ export default class extends Controller { let visibleCount = 0; this.itemTargets.forEach(item => { - const name = item.dataset.bankName?.toLocaleLowerCase() ?? ""; - const match = name.includes(query); + const haystack = (item.dataset.bankSearch ?? "").toLocaleLowerCase(); + const match = haystack.includes(query); item.style.display = match ? "" : "none"; if (match) visibleCount++; }); diff --git a/app/views/enable_banking_items/select_bank.html.erb b/app/views/enable_banking_items/select_bank.html.erb index 124c8e3ec2..095ae67380 100644 --- a/app/views/enable_banking_items/select_bank.html.erb +++ b/app/views/enable_banking_items/select_bank.html.erb @@ -28,7 +28,7 @@
<% @aspsps.each do |aspsp| %> -
+
"> <%= button_to authorize_enable_banking_item_path(@enable_banking_item), method: :post, params: { aspsp_name: aspsp[:name], new_connection: @new_connection }, diff --git a/test/controllers/enable_banking_items_controller_test.rb b/test/controllers/enable_banking_items_controller_test.rb new file mode 100644 index 0000000000..06005bc9a2 --- /dev/null +++ b/test/controllers/enable_banking_items_controller_test.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +require "test_helper" +require "openssl" + +class EnableBankingItemsControllerTest < ActionDispatch::IntegrationTest + setup do + sign_in users(:family_admin) + @family = families(:dylan_family) + @item = @family.enable_banking_items.create!( + name: "Test Connection", + country_code: "DE", + application_id: "test_app_id", + client_certificate: OpenSSL::PKey::RSA.new(2048).to_pem + ) + end + + test "select_bank exposes ASPSP BIC in the searchable data attribute" do + Provider::EnableBanking.any_instance.stubs(:get_aspsps).returns( + aspsps: [ + { + name: "ING-DiBa AG", + country: "DE", + bic: "INGDDEFF", + beta: false, + psu_types: [ "personal" ], + auth_methods: [ { approach: "REDIRECT" } ] + } + ] + ) + + get select_bank_enable_banking_item_url(@item) + + assert_response :success + haystack = @response.body[/data-bank-search="([^"]*)"/, 1] + assert haystack, "Expected list items to render a data-bank-search attribute the client filter reads from" + assert_includes haystack, "ingddeff", + "Expected the searchable data attribute to include the BIC so users can find banks by BIC code" + assert_includes haystack, "ing-diba ag", + "Expected the searchable data attribute to still include the bank name (existing name-search behavior)" + end +end From d47a4a244ef838fc34bb3da13174d8716fc1bb0f Mon Sep 17 00:00:00 2001 From: dripsmvcp <138900956+dripsmvcp@users.noreply.github.com> Date: Thu, 21 May 2026 10:40:09 +0900 Subject: [PATCH 2/2] style(bank_search): apply Biome formatting to forEach callback (#1874 review) --- app/javascript/controllers/bank_search_controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/controllers/bank_search_controller.js b/app/javascript/controllers/bank_search_controller.js index d75a2f7de4..155a7a8bb0 100644 --- a/app/javascript/controllers/bank_search_controller.js +++ b/app/javascript/controllers/bank_search_controller.js @@ -7,7 +7,7 @@ export default class extends Controller { const query = this.inputTarget.value.toLocaleLowerCase().trim(); let visibleCount = 0; - this.itemTargets.forEach(item => { + this.itemTargets.forEach((item) => { const haystack = (item.dataset.bankSearch ?? "").toLocaleLowerCase(); const match = haystack.includes(query); item.style.display = match ? "" : "none";