Repository: cal-itp/benefits

Issue:
Configure a payment-processor per agency
Right now in the [data migration](https://github.com/cal-itp/benefits/blob/dev/benefits/core/migrations/0002_data.py), we have a single `PaymentProcessor` definition that is reused for both agency definitions.

Let's create a second `PaymentProcessor` so that we can have different configuration per-agency.

Ultimately will be solved by #1313 and related work.

## Expected behavior

We should be able to vary the configuration between different agencies.

## Additional context

See [Slack thread](https://cal-itp.slack.com/archives/C013W8RUAMU/p1681771911527909).



Discussion:

Resolving patch:
diff --git a/benefits/core/migrations/0002_data.py b/benefits/core/migrations/0002_data.py
--- a/benefits/core/migrations/0002_data.py
+++ b/benefits/core/migrations/0002_data.py
@@ -89,19 +89,34 @@ def load_data(app, *args, **kwargs):
 -----END CERTIFICATE-----
 """
 
-    payment_processor_client_cert = PemData.objects.create(
-        text=os.environ.get("PAYMENT_PROCESSOR_CLIENT_CERT", dummy_cert_text),
-        label="Payment processor client certificate",
+    mst_payment_processor_client_cert = PemData.objects.create(
+        text=os.environ.get("MST_PAYMENT_PROCESSOR_CLIENT_CERT", dummy_cert_text),
+        label="MST payment processor client certificate",
     )
 
-    payment_processor_client_cert_private_key = PemData.objects.create(
-        text=os.environ.get("PAYMENT_PROCESSOR_CLIENT_CERT_PRIVATE_KEY", client_private_key.text),
-        label="Payment processor client certificate private key",
+    mst_payment_processor_client_cert_private_key = PemData.objects.create(
+        text=os.environ.get("MST_PAYMENT_PROCESSOR_CLIENT_CERT_PRIVATE_KEY", client_private_key.text),
+        label="MST payment processor client certificate private key",
     )
 
-    payment_processor_client_cert_root_ca = PemData.objects.create(
-        text=os.environ.get("PAYMENT_PROCESSOR_CLIENT_CERT_ROOT_CA", dummy_cert_text),
-        label="Payment processor client certificate root CA",
+    mst_payment_processor_client_cert_root_ca = PemData.objects.create(
+        text=os.environ.get("MST_PAYMENT_PROCESSOR_CLIENT_CERT_ROOT_CA", dummy_cert_text),
+        label="MST payment processor client certificate root CA",
+    )
+
+    sacrt_payment_processor_client_cert = PemData.objects.create(
+        text=os.environ.get("SACRT_PAYMENT_PROCESSOR_CLIENT_CERT", dummy_cert_text),
+        label="SacRT payment processor client certificate",
+    )
+
+    sacrt_payment_processor_client_cert_private_key = PemData.objects.create(
+        text=os.environ.get("SACRT_PAYMENT_PROCESSOR_CLIENT_CERT_PRIVATE_KEY", client_private_key.text),
+        label="SacRT payment processor client certificate private key",
+    )
+
+    sacrt_payment_processor_client_cert_root_ca = PemData.objects.create(
+        text=os.environ.get("SACRT_PAYMENT_PROCESSOR_CLIENT_CERT_ROOT_CA", dummy_cert_text),
+        label="SacRT payment processor client certificate root CA",
     )
 
     AuthProvider = app.get_model("core", "AuthProvider")
@@ -204,18 +219,35 @@ def load_data(app, *args, **kwargs):
 
     PaymentProcessor = app.get_model("core", "PaymentProcessor")
 
-    payment_processor = PaymentProcessor.objects.create(
-        name=os.environ.get("PAYMENT_PROCESSOR_NAME", "Test Payment Processor"),
-        api_base_url=os.environ.get("PAYMENT_PROCESSOR_API_BASE_URL", "http://server:8000"),
-        api_access_token_endpoint=os.environ.get("PAYMENT_PROCESSOR_API_ACCESS_TOKEN_ENDPOINT", "access-token"),
-        api_access_token_request_key=os.environ.get("PAYMENT_PROCESSOR_API_ACCESS_TOKEN_REQUEST_KEY", "request_access"),
-        api_access_token_request_val=os.environ.get("PAYMENT_PROCESSOR_API_ACCESS_TOKEN_REQUEST_VAL", "REQUEST_ACCESS"),
-        card_tokenize_url=os.environ.get("PAYMENT_PROCESSOR_CARD_TOKENIZE_URL", "http://server:8000/static/tokenize.js"),
-        card_tokenize_func=os.environ.get("PAYMENT_PROCESSOR_CARD_TOKENIZE_FUNC", "tokenize"),
-        card_tokenize_env=os.environ.get("PAYMENT_PROCESSOR_CARD_TOKENIZE_ENV", "test"),
-        client_cert=payment_processor_client_cert,
-        client_cert_private_key=payment_processor_client_cert_private_key,
-        client_cert_root_ca=payment_processor_client_cert_root_ca,
+    mst_payment_processor = PaymentProcessor.objects.create(
+        name=os.environ.get("MST_PAYMENT_PROCESSOR_NAME", "Test Payment Processor"),
+        api_base_url=os.environ.get("MST_PAYMENT_PROCESSOR_API_BASE_URL", "http://server:8000"),
+        api_access_token_endpoint=os.environ.get("MST_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_ENDPOINT", "access-token"),
+        api_access_token_request_key=os.environ.get("MST_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_REQUEST_KEY", "request_access"),
+        api_access_token_request_val=os.environ.get("MST_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_REQUEST_VAL", "REQUEST_ACCESS"),
+        card_tokenize_url=os.environ.get("MST_PAYMENT_PROCESSOR_CARD_TOKENIZE_URL", "http://server:8000/static/tokenize.js"),
+        card_tokenize_func=os.environ.get("MST_PAYMENT_PROCESSOR_CARD_TOKENIZE_FUNC", "tokenize"),
+        card_tokenize_env=os.environ.get("MST_PAYMENT_PROCESSOR_CARD_TOKENIZE_ENV", "test"),
+        client_cert=mst_payment_processor_client_cert,
+        client_cert_private_key=mst_payment_processor_client_cert_private_key,
+        client_cert_root_ca=mst_payment_processor_client_cert_root_ca,
+        customer_endpoint="customer",
+        customers_endpoint="customers",
+        group_endpoint="group",
+    )
+
+    sacrt_payment_processor = PaymentProcessor.objects.create(
+        name=os.environ.get("SACRT_PAYMENT_PROCESSOR_NAME", "Test Payment Processor"),
+        api_base_url=os.environ.get("SACRT_PAYMENT_PROCESSOR_API_BASE_URL", "http://server:8000"),
+        api_access_token_endpoint=os.environ.get("SACRT_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_ENDPOINT", "access-token"),
+        api_access_token_request_key=os.environ.get("SACRT_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_REQUEST_KEY", "request_access"),
+        api_access_token_request_val=os.environ.get("SACRT_PAYMENT_PROCESSOR_API_ACCESS_TOKEN_REQUEST_VAL", "REQUEST_ACCESS"),
+        card_tokenize_url=os.environ.get("SACRT_PAYMENT_PROCESSOR_CARD_TOKENIZE_URL", "http://server:8000/static/tokenize.js"),
+        card_tokenize_func=os.environ.get("SACRT_PAYMENT_PROCESSOR_CARD_TOKENIZE_FUNC", "tokenize"),
+        card_tokenize_env=os.environ.get("SACRT_PAYMENT_PROCESSOR_CARD_TOKENIZE_ENV", "test"),
+        client_cert=sacrt_payment_processor_client_cert,
+        client_cert_private_key=sacrt_payment_processor_client_cert_private_key,
+        client_cert_root_ca=sacrt_payment_processor_client_cert_root_ca,
         customer_endpoint="customer",
         customers_endpoint="customers",
         group_endpoint="group",
@@ -240,7 +272,7 @@ def load_data(app, *args, **kwargs):
         private_key=client_private_key,
         public_key=client_public_key,
         jws_signing_alg=os.environ.get("MST_AGENCY_JWS_SIGNING_ALG", "RS256"),
-        payment_processor=payment_processor,
+        payment_processor=mst_payment_processor,
         eligibility_index_intro=_("eligibility.pages.index.p[0].mst"),
     )
     mst_agency.eligibility_types.set([mst_senior_type, mst_courtesy_card_type])
@@ -258,7 +290,7 @@ def load_data(app, *args, **kwargs):
         private_key=client_private_key,
         public_key=client_public_key,
         jws_signing_alg=os.environ.get("SACRT_AGENCY_JWS_SIGNING_ALG", "RS256"),
-        payment_processor=payment_processor,
+        payment_processor=sacrt_payment_processor,
         eligibility_index_intro=_("eligibility.pages.index.p[0].sacrt"),
     )
     sacrt_agency.eligibility_types.set([sacrt_senior_type])


Test patch: