Skip to content

Commit 81d7965

Browse files
Add Discover, American Express copy under feature flag (#2945)
Feature flag called LITTLEPAY_ADDITIONAL_CARDTYPES controls whether Discover and American Express copy shows up or not.
2 parents eb61471 + be970ea commit 81d7965

File tree

10 files changed

+104
-8
lines changed

10 files changed

+104
-8
lines changed

benefits/core/context_processors.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ def enrollment(request):
103103
return {"enrollment": data}
104104

105105

106+
def feature_flags(request):
107+
"""Context processor adds feature flags to request context."""
108+
return {"feature_flags": {"LITTLEPAY_ADDITIONAL_CARDTYPES": settings.LITTLEPAY_ADDITIONAL_CARDTYPES}}
109+
110+
106111
def origin(request):
107112
"""Context processor adds session.origin to request context."""
108113
origin = session.origin(request)

benefits/core/templates/core/help.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@ <h2 class="h2-sm pt-4 pt-lg-8" id="payment-options">{% translate "What kind of c
4646
src="{% static 'img/icon/contactless.svg' %}"
4747
alt="{% translate "Four curved lines on contactless-enabled cards" context "image alt text" %}" />
4848
</p>
49-
<p class="pt-3 pt-lg-4">{% translate "Your card must include a Visa or Mastercard logo." %}</p>
49+
<p class="pt-3 pt-lg-4">
50+
{% if feature_flags.LITTLEPAY_ADDITIONAL_CARDTYPES %}
51+
{% translate "Your card must include a Visa, Mastercard, Discover, or American Express logo." %}
52+
{% else %}
53+
{% translate "Your card must include a Visa or Mastercard logo." %}
54+
{% endif %}
55+
</p>
5056
<p class="pt-3 pt-lg-4">
5157
{% blocktranslate trimmed %}
5258
Don’t have access to a contactless card? You can request a contactless card from your bank, or one of the companies

benefits/eligibility/templates/eligibility/includes/modal--contactless.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ <h2 id="contactless-modal" class="me-4 me-md-0">{% translate "Learn more about c
1919
src="{% static 'img/icon/contactless.svg' %}"
2020
alt="{% translate "Four curved lines on contactless-enabled cards" context "image alt text" %}" />
2121
</p>
22-
<p class="pt-4">{% translate "Your card must include a Visa or Mastercard logo." %}</p>
22+
<p class="pt-4">
23+
{% if feature_flags.LITTLEPAY_ADDITIONAL_CARDTYPES %}
24+
{% translate "Your card must include a Visa, Mastercard, Discover, or American Express logo." %}
25+
{% else %}
26+
{% translate "Your card must include a Visa or Mastercard logo." %}
27+
{% endif %}
28+
</p>
2329
<p class="pt-4">
2430
{% blocktranslate trimmed %}
2531
Don’t have access to a contactless card? You can request a contactless card from your bank, or one of the companies

benefits/eligibility/templates/eligibility/start.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ <h2 class="h3 pb-1">
4949
<li>
5050
<h2 class="h3 pb-1">{% translate "Your contactless card details" %}</h2>
5151
<p>
52-
{% translate "Your contactless card must be a debit or credit card by Visa or Mastercard." %}
52+
{% if feature_flags.LITTLEPAY_ADDITIONAL_CARDTYPES %}
53+
{% translate "Your contactless card must be a debit or credit card by Visa, Mastercard, Discover, or American Express." %}
54+
{% else %}
55+
{% translate "Your contactless card must be a debit or credit card by Visa or Mastercard." %}
56+
{% endif %}
5357
{% translate "Learn more about contactless cards" as text %}
5458
{% include "core/includes/modal-trigger.html" with modal="modal--contactless" text=text period=True %}
5559
</p>

benefits/enrollment/templates/enrollment/includes/alert-box--warning--calfresh.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
{% block alert-body %}
1313
{% translate "Read our guidance on the CalFresh benefit" as calfresh_modal_link %}
1414
<p>
15-
{% translate "You can’t pay for transit using the CalFresh funds on your Golden State Advantage card. Please provide details from your contactless debit or credit card issued by Visa or Mastercard and use that card to pay for transit." %}
15+
{% if feature_flags.LITTLEPAY_ADDITIONAL_CARDTYPES %}
16+
{% translate "You can’t pay for transit using the CalFresh funds on your Golden State Advantage card. Please provide details from your contactless debit or credit card issued by Visa, Mastercard, Discover, or American Express and use that card to pay for transit." %}
17+
{% else %}
18+
{% translate "You can’t pay for transit using the CalFresh funds on your Golden State Advantage card. Please provide details from your contactless debit or credit card issued by Visa or Mastercard and use that card to pay for transit." %}
19+
{% endif %}
1620
{% include "core/includes/modal-trigger.html" with modal="modal--calfresh" text=calfresh_modal_link period=True %}
1721
</p>
1822
{% include "eligibility/includes/modal--calfresh.html" with id="modal--calfresh" size="modal-lg" header="p-md-2 p-3" body="pb-md-3 mb-md-3 mx-md-3 py-0 pt-0 absolute-top" %}

benefits/enrollment/templates/enrollment/index-base.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ <h2 class="h3 pb-1">{{ next_step }}</h2>
2828
{% if alert_include %}
2929
{% include alert_include %}
3030
{% else %}
31-
<p>{% translate "Please use a debit or credit card by Visa or Mastercard." %}</p>
31+
<p>
32+
{% if feature_flags.LITTLEPAY_ADDITIONAL_CARDTYPES %}
33+
{% translate "Please use a debit or credit card by Visa, Mastercard, Discover, or American Express." %}
34+
{% else %}
35+
{% translate "Please use a debit or credit card by Visa or Mastercard." %}
36+
</p>
37+
{% endif %}
3238
{% endif %}
3339
</div>
3440
{% include "enrollment/includes/modal--transit-processor.html" with id="modal--transit-processor" size="modal-md" header="p-md-2 p-3" body="pb-md-3 mb-md-3 mx-md-3 py-0 pt-0 absolute-top" transit_processor=transit_processor %}

benefits/locale/en/LC_MESSAGES/django.po

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
msgid ""
77
msgstr ""
88
"Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n"
9-
"POT-Creation-Date: 2025-05-16 17:20-0700\n"
9+
"POT-Creation-Date: 2025-05-29 11:52-0700\n"
1010
"Language: English\n"
1111
"MIME-Version: 1.0\n"
1212
"Content-Type: text/plain; charset=UTF-8\n"
@@ -202,6 +202,11 @@ msgctxt "image alt text"
202202
msgid "Four curved lines on contactless-enabled cards"
203203
msgstr ""
204204

205+
msgid ""
206+
"Your card must include a Visa, Mastercard, Discover, or American Express "
207+
"logo."
208+
msgstr ""
209+
205210
msgid "Your card must include a Visa or Mastercard logo."
206211
msgstr ""
207212

@@ -689,6 +694,11 @@ msgstr ""
689694
msgid "Your contactless card details"
690695
msgstr ""
691696

697+
msgid ""
698+
"Your contactless card must be a debit or credit card by Visa, Mastercard, "
699+
"Discover, or American Express."
700+
msgstr ""
701+
692702
msgid ""
693703
"Your contactless card must be a debit or credit card by Visa or Mastercard."
694704
msgstr ""
@@ -777,6 +787,13 @@ msgstr ""
777787
msgid "Read our guidance on the CalFresh benefit"
778788
msgstr ""
779789

790+
msgid ""
791+
"You can’t pay for transit using the CalFresh funds on your Golden State "
792+
"Advantage card. Please provide details from your contactless debit or credit "
793+
"card issued by Visa, Mastercard, Discover, or American Express and use that "
794+
"card to pay for transit."
795+
msgstr ""
796+
780797
msgid ""
781798
"You can’t pay for transit using the CalFresh funds on your Golden State "
782799
"Advantage card. Please provide details from your contactless debit or credit "
@@ -805,6 +822,11 @@ msgstr ""
805822
msgid "We don’t store your information, and you won’t be charged."
806823
msgstr ""
807824

825+
msgid ""
826+
"Please use a debit or credit card by Visa, Mastercard, Discover, or American "
827+
"Express."
828+
msgstr ""
829+
808830
msgid "Please use a debit or credit card by Visa or Mastercard."
809831
msgstr ""
810832

benefits/locale/es/LC_MESSAGES/django.po

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
msgid ""
77
msgstr ""
88
"Report-Msgid-Bugs-To: https://github.com/cal-itp/benefits/issues \n"
9-
"POT-Creation-Date: 2025-05-16 17:20-0700\n"
9+
"POT-Creation-Date: 2025-05-29 11:52-0700\n"
1010
"Language: Español\n"
1111
"MIME-Version: 1.0\n"
1212
"Content-Type: text/plain; charset=UTF-8\n"
@@ -281,6 +281,13 @@ msgctxt "image alt text"
281281
msgid "Four curved lines on contactless-enabled cards"
282282
msgstr "Cuatro líneas curvas en las tarjetas habilitadas sin contacto"
283283

284+
msgid ""
285+
"Your card must include a Visa, Mastercard, Discover, or American Express "
286+
"logo."
287+
msgstr ""
288+
"Su tarjeta debe incluir un logotipo de Visa, Mastercard, Discover o American "
289+
"Express."
290+
284291
msgid "Your card must include a Visa or Mastercard logo."
285292
msgstr "Su tarjeta debe incluir un logotipo de Visa o Mastercard."
286293

@@ -877,6 +884,13 @@ msgstr ""
877884
msgid "Your contactless card details"
878885
msgstr "Los datos de su tarjeta sin contacto"
879886

887+
msgid ""
888+
"Your contactless card must be a debit or credit card by Visa, Mastercard, "
889+
"Discover, or American Express."
890+
msgstr ""
891+
"Su tarjeta sin contacto debe ser una tarjeta de débito o crédito de Visa, "
892+
"Mastercard, Discover o American Express."
893+
880894
msgid ""
881895
"Your contactless card must be a debit or credit card by Visa or Mastercard."
882896
msgstr ""
@@ -981,6 +995,17 @@ msgstr "No ingrese información de su tarjeta EBT."
981995
msgid "Read our guidance on the CalFresh benefit"
982996
msgstr "Lea nuestra guía sobre el beneficio de CalFresh."
983997

998+
msgid ""
999+
"You can’t pay for transit using the CalFresh funds on your Golden State "
1000+
"Advantage card. Please provide details from your contactless debit or credit "
1001+
"card issued by Visa, Mastercard, Discover, or American Express and use that "
1002+
"card to pay for transit."
1003+
msgstr ""
1004+
"No puede pagar el transporte público usando los fondos de CalFresh en su "
1005+
"tarjeta Golden State Advantage. Proporcione detalles de su tarjeta de débito "
1006+
"o crédito sin contacto emitida por Visa, Mastercard, Discover o American "
1007+
"Express y use esa tarjeta para pagar el transporte público."
1008+
9841009
msgid ""
9851010
"You can’t pay for transit using the CalFresh funds on your Golden State "
9861011
"Advantage card. Please provide details from your contactless debit or credit "
@@ -1019,6 +1044,13 @@ msgstr "Será dirigido a nuestro socio, "
10191044
msgid "We don’t store your information, and you won’t be charged."
10201045
msgstr "No almacenamos su información y no se le cobrará."
10211046

1047+
msgid ""
1048+
"Please use a debit or credit card by Visa, Mastercard, Discover, or American "
1049+
"Express."
1050+
msgstr ""
1051+
"Utilice una tarjeta de débito o crédito de Visa, Mastercard, Discover o "
1052+
"American Express."
1053+
10221054
msgid "Please use a debit or credit card by Visa or Mastercard."
10231055
msgstr "Utilice una tarjeta de débito o crédito de Visa o Mastercard."
10241056

benefits/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def RUNTIME_ENVIRONMENT():
156156
"benefits.core.context_processors.enrollment",
157157
"benefits.core.context_processors.origin",
158158
"benefits.core.context_processors.routes",
159+
"benefits.core.context_processors.feature_flags",
159160
]
160161

161162
if DEBUG:

tests/pytest/core/test_context_processors.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from benefits.routes import routes as app_routes
55
from benefits.core import session
6-
from benefits.core.context_processors import unique_values, enrollment, routes
6+
from benefits.core.context_processors import unique_values, enrollment, feature_flags, routes
77

88

99
def test_unique_values():
@@ -22,6 +22,16 @@ def test_enrollment_default(app_request):
2222
assert context["enrollment"] == {"expires": None, "reenrollment": None, "supports_expiration": False}
2323

2424

25+
@pytest.mark.parametrize("expected_flag", [True, False])
26+
def test_feature_flags(app_request, settings, expected_flag):
27+
settings.LITTLEPAY_ADDITIONAL_CARDTYPES = expected_flag
28+
29+
context = feature_flags(app_request)
30+
littlepay_flag = context["feature_flags"]["LITTLEPAY_ADDITIONAL_CARDTYPES"]
31+
32+
assert littlepay_flag == expected_flag
33+
34+
2535
@pytest.mark.django_db
2636
def test_enrollment_expiration(app_request, model_EnrollmentFlow_supports_expiration):
2737

0 commit comments

Comments
 (0)