Repository: cal-itp/benefits

Issue:
AttributeError: Unable to lookup 'transit_processor' on TransitAgency or TransitAgencyAdmin or TransitAgencyForm
Sentry Issue: [BENEFITS-F3](https://sentry.calitp.org/organizations/sentry/issues/86765/?referrer=github_integration)

```
KeyError: 'transit_processor'
  File "django/db/models/options.py", line 676, in get_field
    return self.fields_map[field_name]

FieldDoesNotExist: TransitAgency has no field named 'transit_processor'
  File "django/contrib/admin/utils.py", line 362, in label_for_field
    field = _get_non_gfk_field(model._meta, name)
  File "django/contrib/admin/utils.py", line 330, in _get_non_gfk_field
    field = opts.get_field(name)
  File "django/db/models/options.py", line 678, in get_field
    raise FieldDoesNotExist(

KeyError: 'transit_processor'
  File "django/db/models/options.py", line 676, in get_field
    return self.fields_map[field_name]

FieldDoesNotExist: TransitAgency has no field named 'transit_processor'
  File "django/contrib/admin/utils.py", line 383, in label_for_field
    attr = get_fields_from_path(model, name)[-1]
  File "django/contrib/admin/utils.py", line 545, in get_fields_from_path
    fields.append(parent._meta.get_field(piece))
  File "django/db/models/options.py", line 678, in get_field
    raise FieldDoesNotExist(

AttributeError: Unable to lookup 'transit_processor' on TransitAgency or TransitAgencyAdmin or TransitAgencyForm
(35 additional frame(s) were not displayed)
...
  File "django/template/base.py", line 969, in render_annotated
    return self.render(context)
  File "django/template/defaulttags.py", line 198, in render
    values = list(values)
  File "django/contrib/admin/helpers.py", line 154, in __iter__
    yield AdminReadonlyField(
  File "django/contrib/admin/helpers.py", line 213, in __init__
    label = label_for_field(field, form._meta.model, model_admin, form=form)
  File "django/contrib/admin/utils.py", line 390, in label_for_field
    raise AttributeError(message)
```

Discussion hints:

Solution patch:
diff --git a/benefits/core/admin/transit.py b/benefits/core/admin/transit.py
index 777e99b50..b7e03220c 100644
--- a/benefits/core/admin/transit.py
+++ b/benefits/core/admin/transit.py
@@ -2,6 +2,7 @@ from django.conf import settings
 from django.contrib import admin
 
 from benefits.core import models
+
 from .users import is_staff_member_or_superuser
 
 
@@ -16,8 +17,6 @@ class TransitAgencyAdmin(admin.ModelAdmin):
                     "eligibility_api_private_key",
                     "eligibility_api_public_key",
                     "sso_domain",
-                    "littlepay_config",
-                    "switchio_config",
                 ]
             )
 
@@ -30,7 +29,6 @@ class TransitAgencyAdmin(admin.ModelAdmin):
             fields.extend(
                 [
                     "eligibility_api_id",
-                    "transit_processor",
                 ]
             )
 


Test patch:
diff --git a/tests/pytest/core/admin/test_enrollment.py b/tests/pytest/core/admin/test_enrollment.py
index 990e2a9fd..c6768c447 100644
--- a/tests/pytest/core/admin/test_enrollment.py
+++ b/tests/pytest/core/admin/test_enrollment.py
@@ -102,6 +102,10 @@ class TestEnrollmentFlowAdmin:
         ],
     )
     def test_get_exclude(self, admin_user_request, flow_admin_model, user_type, expected):
+        if expected:
+            model_fields = [f.name for f in flow_admin_model.model._meta.get_fields()]
+            assert all(field in model_fields for field in expected)
+
         request = admin_user_request(user_type)
 
         excluded = flow_admin_model.get_exclude(request)
@@ -125,6 +129,10 @@ class TestEnrollmentFlowAdmin:
         ],
     )
     def test_get_readonly_fields(self, admin_user_request, flow_admin_model, user_type, expected):
+        if expected:
+            model_fields = [f.name for f in flow_admin_model.model._meta.get_fields()]
+            assert all(field in model_fields for field in expected)
+
         request = admin_user_request(user_type)
 
         readonly = flow_admin_model.get_readonly_fields(request)
diff --git a/tests/pytest/core/admin/test_transit.py b/tests/pytest/core/admin/test_transit.py
index 8eaca7fee..79548ee47 100644
--- a/tests/pytest/core/admin/test_transit.py
+++ b/tests/pytest/core/admin/test_transit.py
@@ -1,10 +1,9 @@
 import pytest
-
 from django.conf import settings
 from django.contrib import admin
 
-from benefits.core.admin.transit import TransitAgencyAdmin
 from benefits.core import models
+from benefits.core.admin.transit import TransitAgencyAdmin
 
 
 @pytest.fixture
@@ -24,14 +23,16 @@ class TestTransitAgencyAdmin:
                     "eligibility_api_private_key",
                     "eligibility_api_public_key",
                     "sso_domain",
-                    "littlepay_config",
-                    "switchio_config",
                 ],
             ),
-            ("super", None),
+            ("super", ()),
         ],
     )
     def test_get_exclude(self, admin_user_request, agency_admin_model, user_type, expected):
+        if expected:
+            model_fields = [f.name for f in agency_admin_model.model._meta.get_fields()]
+            assert all(field in model_fields for field in expected)
+
         request = admin_user_request(user_type)
 
         excluded = agency_admin_model.get_exclude(request)
@@ -46,12 +47,16 @@ class TestTransitAgencyAdmin:
         [
             (
                 "staff",
-                ["eligibility_api_id", "transit_processor"],
+                ["eligibility_api_id"],
             ),
             ("super", ()),
         ],
     )
     def test_get_readonly_fields(self, admin_user_request, agency_admin_model, user_type, expected):
+        if expected:
+            model_fields = [f.name for f in agency_admin_model.model._meta.get_fields()]
+            assert all(field in model_fields for field in expected)
+
         request = admin_user_request(user_type)
 
         readonly = agency_admin_model.get_readonly_fields(request)