Coverage for benefits/enrollment/context/flow.py: 100%
21 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-06 01:11 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-06 01:11 +0000
1from dataclasses import dataclass, asdict
2from typing import Optional
4from benefits.core.context import SystemName, formatted_gettext_lazy as _
7@dataclass
8class EnrollmentIndex:
9 headline: str
10 next_step: str
11 partner_post_link: str
12 alert_include: Optional[str] = ""
14 def dict(self):
15 return asdict(self)
18class DefaultEnrollmentIndex(EnrollmentIndex):
19 def __init__(
20 self,
21 headline=_("Your eligibility is confirmed! You’re almost there."),
22 next_step=_("The next step is to enroll the contactless card you will use to tap to ride for a reduced fare."),
23 partner_post_link=_(", to enter your contactless card details."),
24 alert_include="",
25 ):
26 super().__init__(
27 headline=headline, next_step=next_step, partner_post_link=partner_post_link, alert_include=alert_include
28 )
31class AgencyCardEnrollmentIndex(DefaultEnrollmentIndex):
32 def __init__(self):
33 super().__init__(headline=_("We found your record! Now let’s enroll your contactless card."))
36class CalFreshEnrollmentIndex(DefaultEnrollmentIndex):
37 def __init__(self):
38 super().__init__(
39 next_step=_("The next step is to connect your contactless card to your transit benefit"),
40 partner_post_link=".",
41 alert_include="enrollment/includes/alert-box--warning--calfresh.html",
42 )
45enrollment_index = {
46 SystemName.AGENCY_CARD: AgencyCardEnrollmentIndex(),
47 SystemName.COURTESY_CARD: AgencyCardEnrollmentIndex(),
48 SystemName.REDUCED_FARE_MOBILITY_ID: AgencyCardEnrollmentIndex(),
49 SystemName.CALFRESH: CalFreshEnrollmentIndex(),
50}