From bfde2e545ec8a9a697923ebf19c7adccac5186b2 Mon Sep 17 00:00:00 2001
From: Kegan Maher <kegan@compiler.la>
Date: Sat, 23 Nov 2024 02:29:53 +0000
Subject: [PATCH] chore(models): remove dupe field on TransitAgency

this field is now captured on EnrollmentFlow with the other
Eligibility API fields
---
 benefits/core/admin.py                          |  1 -
 benefits/core/migrations/0032_optionalfields.py | 11 ++++-------
 benefits/core/migrations/local_fixtures.json    |  1 -
 benefits/core/models.py                         |  5 -----
 benefits/eligibility/verify.py                  |  2 +-
 tests/pytest/conftest.py                        |  1 -
 6 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/benefits/core/admin.py b/benefits/core/admin.py
index ab874a846e..7af5cff497 100644
--- a/benefits/core/admin.py
+++ b/benefits/core/admin.py
@@ -104,7 +104,6 @@ def get_exclude(self, request, obj=None):
             return [
                 "eligibility_api_private_key",
                 "eligibility_api_public_key",
-                "eligibility_api_jws_signing_alg",
                 "transit_processor_client_id",
                 "transit_processor_client_secret_name",
                 "transit_processor_audience",
diff --git a/benefits/core/migrations/0032_optionalfields.py b/benefits/core/migrations/0032_optionalfields.py
index 47cf13eb9d..2113dabae4 100644
--- a/benefits/core/migrations/0032_optionalfields.py
+++ b/benefits/core/migrations/0032_optionalfields.py
@@ -45,6 +45,10 @@ class Migration(migrations.Migration):
                 help_text="The absolute base URL for the TransitProcessor's control portal, including https://.",
             ),
         ),
+        migrations.RemoveField(
+            model_name="transitagency",
+            name="eligibility_api_jws_signing_alg",
+        ),
         migrations.RenameField(
             model_name="transitagency", old_name="eligibility_index_template", new_name="eligibility_index_template_override"
         ),
@@ -72,13 +76,6 @@ class Migration(migrations.Migration):
                 blank=True, default="", help_text="The identifier for this agency used in Eligibility API calls."
             ),
         ),
-        migrations.AlterField(
-            model_name="transitagency",
-            name="eligibility_api_jws_signing_alg",
-            field=models.TextField(
-                blank=True, default="", help_text="The JWS-compatible signing algorithm used in Eligibility API calls."
-            ),
-        ),
         migrations.AlterField(
             model_name="transitagency",
             name="eligibility_api_private_key",
diff --git a/benefits/core/migrations/local_fixtures.json b/benefits/core/migrations/local_fixtures.json
index 9a10975947..882905e294 100644
--- a/benefits/core/migrations/local_fixtures.json
+++ b/benefits/core/migrations/local_fixtures.json
@@ -56,7 +56,6 @@
       "eligibility_api_id": "cst",
       "eligibility_api_private_key": 2,
       "eligibility_api_public_key": 3,
-      "eligibility_api_jws_signing_alg": "RS256",
       "transit_processor": 1,
       "transit_processor_audience": "",
       "transit_processor_client_id": "",
diff --git a/benefits/core/models.py b/benefits/core/models.py
index dfb7af425c..64a097587d 100644
--- a/benefits/core/models.py
+++ b/benefits/core/models.py
@@ -214,11 +214,6 @@ class TransitAgency(models.Model):
         blank=True,
         default=None,
     )
-    eligibility_api_jws_signing_alg = models.TextField(
-        help_text="The JWS-compatible signing algorithm used in Eligibility API calls.",
-        blank=True,
-        default="",
-    )
     transit_processor = models.ForeignKey(
         TransitProcessor,
         on_delete=models.PROTECT,
diff --git a/benefits/eligibility/verify.py b/benefits/eligibility/verify.py
index e1052123c5..6266893a01 100644
--- a/benefits/eligibility/verify.py
+++ b/benefits/eligibility/verify.py
@@ -13,7 +13,7 @@ def eligibility_from_api(flow: models.EnrollmentFlow, form, agency: models.Trans
         headers={flow.eligibility_api_auth_header: flow.eligibility_api_auth_key},
         issuer=settings.ALLOWED_HOSTS[0],
         agency=agency.eligibility_api_id,
-        jws_signing_alg=agency.eligibility_api_jws_signing_alg,
+        jws_signing_alg=flow.eligibility_api_jws_signing_alg,
         client_private_key=agency.eligibility_api_private_key_data,
         jwe_encryption_alg=flow.eligibility_api_jwe_encryption_alg,
         jwe_cek_enc=flow.eligibility_api_jwe_cek_enc,
diff --git a/tests/pytest/conftest.py b/tests/pytest/conftest.py
index 3e323eb48e..620622ba4f 100644
--- a/tests/pytest/conftest.py
+++ b/tests/pytest/conftest.py
@@ -175,7 +175,6 @@ def model_TransitAgency(model_PemData, model_TransitProcessor):
         eligibility_api_id="test123",
         eligibility_api_private_key=model_PemData,
         eligibility_api_public_key=model_PemData,
-        eligibility_api_jws_signing_alg="alg",
         index_template_override="core/agency-index.html",
         eligibility_index_template_override="eligibility/index.html",
         logo_large="agencies/cst-lg.png",