Replace free-text institution entry with a searchable bank picker
GET /api/banking/institutions lists the banks Enable Banking can connect for a country (personal AIS, connectable consents only), with logos restricted to https Enable Banking hosts to match the CSP image allowlist. The connect form offers a filterable dropdown with bank logos, falling back to the previous free-text input when the list is unavailable or banking is not configured.
This commit is contained in:
@@ -251,6 +251,38 @@ func TestEnableBankingLongestStrategyIsOnlySentWhenRequested(t *testing.T) {
|
||||
t.Fatalf("wrong fetching strategies requested: %q", strategies)
|
||||
}
|
||||
}
|
||||
func TestEnableBankingInstitutionsListsOnlyConnectableBanksWithSafeLogos(t *testing.T) {
|
||||
p, _ := testProvider(t, func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/aspsps" || r.URL.Query().Get("country") != "DE" || r.URL.Query().Get("psu_type") != "personal" || r.URL.Query().Get("service") != "AIS" {
|
||||
t.Errorf("wrong institution listing request: %s", r.URL)
|
||||
}
|
||||
fmt.Fprint(w, `{"aspsps":[
|
||||
{"name":"Sparkasse","country":"DE","maximum_consent_validity":3600,"logo":"https://enablebanking.com/brands/DE/Sparkasse/"},
|
||||
{"name":"N26","country":"DE","maximum_consent_validity":3600,"logo":"http://enablebanking.com/brands/DE/N26/"},
|
||||
{"name":"Tracker Bank","country":"DE","maximum_consent_validity":3600,"logo":"https://tracker.example/pixel.png"},
|
||||
{"name":"Evil","country":"DE","maximum_consent_validity":3600,"logo":"https://evil-enablebanking.com/logo"},
|
||||
{"name":"Dormant","country":"DE","maximum_consent_validity":0},
|
||||
{"name":"Elsewhere","country":"AT","maximum_consent_validity":3600},
|
||||
{"name":"","country":"DE","maximum_consent_validity":3600}
|
||||
]}`)
|
||||
})
|
||||
list, err := p.Institutions(context.Background(), "de")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
expected := []Institution{
|
||||
{Name: "Evil", Country: "DE"},
|
||||
{Name: "N26", Country: "DE"},
|
||||
{Name: "Sparkasse", Country: "DE", Logo: "https://enablebanking.com/brands/DE/Sparkasse/"},
|
||||
{Name: "Tracker Bank", Country: "DE"},
|
||||
}
|
||||
if !reflect.DeepEqual(list, expected) {
|
||||
t.Fatalf("wrong connectable institutions: %+v", list)
|
||||
}
|
||||
if _, err := p.Institutions(context.Background(), "DEU"); err == nil {
|
||||
t.Fatal("accepted an invalid country code")
|
||||
}
|
||||
}
|
||||
func TestEnableBankingSurfacesOnlyDocumentedErrorCodes(t *testing.T) {
|
||||
body := ""
|
||||
p, _ := testProvider(t, func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user