* fix(enable-banking): only pin hidden, psu-applicable decoupled auth methods
PR #854 pinned the first DECOUPLED auth method for every bank to fix
Handelsbanken corporate consents (its Mobile BankID is a hidden_method
that Enable Banking only uses when requested explicitly). The blanket
pin also hit banks whose decoupled method is visible and whose default
flow already worked: Lunar users were asked for personnummer on the
hosted page, told to approve in the app, and no approval ever arrived.
Now a method is pinned only when pinning is necessary (hidden_method
is true, so the method is unreachable by default) and applicable
(psu_types missing/empty or containing the consent's psu_type).
Otherwise undefined is returned and the ASPSP default runs, matching
the stated intent of #854. The connect log now records the chosen
method's approach, hidden_method and psu_types so per-bank behavior
can be verified in prod after deploy.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(enable-banking): bind pinned auth method to the outgoing /auth request
Review follow-up on the auth-method pinning branch, two findings:
1. No test bound the selection result to the outgoing request: mutating
the connect route to stop forwarding the pinned method's name into
startAuthorization (the exact Handelsbanken-corporate regression this
code exists to prevent) passed all 157 tests. Add route-level wiring
tests asserting startAuthorization receives 'BANKID' in the
auth_method argument position (index 5) on both the fresh-connect and
reconnect call sites, plus the inverse: unpinned resolves to an
undefined auth_method.
2. The auth_method_psu_types log field printed '(aspsp default)' when a
method WAS pinned but carried no psu_types (the documented real
Handelsbanken shape), contradicting auth_method='BANKID' on the same
line. A pinned method without psu_types now logs '(all)';
'(aspsp default)' is reserved for the unpinned case.
Both fixes are mutation-verified: reverting either makes the new tests
fail (wiring mutation fails 2 tests, sentinel revert fails 1).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>