diff --git a/benefits/core/migrations/0027_enrollmentflow_supported_methods.py b/benefits/core/migrations/0027_enrollmentflow_supported_methods.py new file mode 100644 index 000000000..3c81ec0e7 --- /dev/null +++ b/benefits/core/migrations/0027_enrollmentflow_supported_methods.py @@ -0,0 +1,22 @@ +# Generated by Django 5.1 on 2024-09-18 19:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0026_enrollmentevent"), + ] + + operations = [ + migrations.AddField( + model_name="enrollmentflow", + name="supported_methods", + field=models.TextField( + choices=[("digital", "digital"), ("in_person", "in_person")], + default="", + help_text="If the flow is supported by digital, in-person, or both", + ), + ), + ] diff --git a/benefits/core/models.py b/benefits/core/models.py index 25abfea16..708e35d87 100644 --- a/benefits/core/models.py +++ b/benefits/core/models.py @@ -104,6 +104,11 @@ def __str__(self) -> str: return self.client_name +class EnrollmentMethods: + DIGITAL = "digital" + IN_PERSON = "in_person" + + class EnrollmentFlow(models.Model): """Represents a user journey through the Benefits app for a single eligibility type.""" @@ -216,6 +221,15 @@ class EnrollmentFlow(models.Model): enrollment_success_template = models.TextField( default="enrollment/success.html", help_text="Template for a successful enrollment associated with the enrollment flow" ) + supported_methods = models.TextField( + choices={ + EnrollmentMethods.DIGITAL: EnrollmentMethods.DIGITAL, + EnrollmentMethods.IN_PERSON: EnrollmentMethods.IN_PERSON, + f"{EnrollmentMethods.DIGITAL}, {EnrollmentMethods.IN_PERSON}": f"{EnrollmentMethods.DIGITAL} and {EnrollmentMethods.IN_PERSON}", # noqa: E501 + }, + default=EnrollmentMethods.DIGITAL, + help_text="If the flow is supported by digital enrollment, in-person enrollment, or both", + ) class Meta: ordering = ["display_order"] @@ -426,11 +440,6 @@ def for_user(user: User): return None -class EnrollmentMethods: - DIGITAL = "digital" - IN_PERSON = "in_person" - - class EnrollmentEvent(models.Model): """A record of a successful enrollment.""" diff --git a/tests/pytest/core/test_models.py b/tests/pytest/core/test_models.py index ac49a08df..6a807908e 100644 --- a/tests/pytest/core/test_models.py +++ b/tests/pytest/core/test_models.py @@ -186,6 +186,13 @@ def test_EnrollmentFlow_enrollment_success_template(): assert new_flow.enrollment_success_template == "enrollment/success.html" +@pytest.mark.django_db +def test_EnrollmentFlow_supported_methods(): + new_flow = EnrollmentFlow.objects.create() + + assert new_flow.supported_methods == "digital" + + class SampleFormClass: """A class for testing EligibilityVerificationForm references."""