From 544885e0b631659b8575d02b8b605b5569ba390c Mon Sep 17 00:00:00 2001 From: jajjibhai008 Date: Thu, 19 Sep 2024 16:06:01 +0500 Subject: [PATCH] feat: Add fields related to custom expiration messaging to CustomerAgreement --- license_manager/apps/api/serializers.py | 4 ++ license_manager/apps/subscriptions/admin.py | 6 ++- ..._override_for_expired_licenses_and_more.py | 53 +++++++++++++++++++ license_manager/apps/subscriptions/models.py | 33 ++++++++++++ 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 license_manager/apps/subscriptions/migrations/0070_customeragreement_disabled_enroll_reason_override_for_expired_licenses_and_more.py diff --git a/license_manager/apps/api/serializers.py b/license_manager/apps/api/serializers.py index 2215e073..48ac7a00 100644 --- a/license_manager/apps/api/serializers.py +++ b/license_manager/apps/api/serializers.py @@ -371,6 +371,10 @@ class Meta: model = CustomerAgreement fields = MinimalCustomerAgreementSerializer.Meta.fields + [ 'subscriptions', + 'has_custom_license_expiration_messaging', + 'disabled_enroll_reason_override_for_expired_licenses', + 'includes_b2c_marketing_website_cta', + 'expired_subscription_modal_messaging', ] @property diff --git a/license_manager/apps/subscriptions/admin.py b/license_manager/apps/subscriptions/admin.py index 0879002c..a2081831 100644 --- a/license_manager/apps/subscriptions/admin.py +++ b/license_manager/apps/subscriptions/admin.py @@ -416,7 +416,11 @@ class CustomerAgreementAdmin(admin.ModelAdmin): 'default_enterprise_catalog_uuid', 'disable_expiration_notifications', 'license_duration_before_purge', - 'disable_onboarding_notifications' + 'disable_onboarding_notifications', + 'has_custom_license_expiration_messaging', + 'disabled_enroll_reason_override_for_expired_licenses', + 'includes_b2c_marketing_website_cta', + 'expired_subscription_modal_messaging', ) custom_fields = ('subscription_for_auto_applied_licenses',) diff --git a/license_manager/apps/subscriptions/migrations/0070_customeragreement_disabled_enroll_reason_override_for_expired_licenses_and_more.py b/license_manager/apps/subscriptions/migrations/0070_customeragreement_disabled_enroll_reason_override_for_expired_licenses_and_more.py new file mode 100644 index 00000000..4595ce4a --- /dev/null +++ b/license_manager/apps/subscriptions/migrations/0070_customeragreement_disabled_enroll_reason_override_for_expired_licenses_and_more.py @@ -0,0 +1,53 @@ +# Generated by Django 4.2.16 on 2024-09-19 08:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('subscriptions', '0069_alter_customeragreement_disable_expiration_notifications_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='customeragreement', + name='disabled_enroll_reason_override_for_expired_licenses', + field=models.CharField(blank=True, help_text='Custom message shown when a learner’s subscription expires and they can no longer enroll.', max_length=255, null=True), + ), + migrations.AddField( + model_name='customeragreement', + name='expired_subscription_modal_messaging', + field=models.CharField(blank=True, help_text='The content of a modal that provides instructions on how learners can continue their journey on the B2C site with a discount code.', max_length=255, null=True), + ), + migrations.AddField( + model_name='customeragreement', + name='has_custom_license_expiration_messaging', + field=models.BooleanField(default=False, help_text='Indicates if the customer has a unique license expiration experience, instead of the standard one.'), + ), + migrations.AddField( + model_name='customeragreement', + name='includes_b2c_marketing_website_cta', + field=models.BooleanField(default=True, help_text='If checked, a link to the B2C course page will be appended to the expired license messaging.'), + ), + migrations.AddField( + model_name='historicalcustomeragreement', + name='disabled_enroll_reason_override_for_expired_licenses', + field=models.CharField(blank=True, help_text='Custom message shown when a learner’s subscription expires and they can no longer enroll.', max_length=255, null=True), + ), + migrations.AddField( + model_name='historicalcustomeragreement', + name='expired_subscription_modal_messaging', + field=models.CharField(blank=True, help_text='The content of a modal that provides instructions on how learners can continue their journey on the B2C site with a discount code.', max_length=255, null=True), + ), + migrations.AddField( + model_name='historicalcustomeragreement', + name='has_custom_license_expiration_messaging', + field=models.BooleanField(default=False, help_text='Indicates if the customer has a unique license expiration experience, instead of the standard one.'), + ), + migrations.AddField( + model_name='historicalcustomeragreement', + name='includes_b2c_marketing_website_cta', + field=models.BooleanField(default=True, help_text='If checked, a link to the B2C course page will be appended to the expired license messaging.'), + ), + ] diff --git a/license_manager/apps/subscriptions/models.py b/license_manager/apps/subscriptions/models.py index 933e9aba..e2b8ce33 100644 --- a/license_manager/apps/subscriptions/models.py +++ b/license_manager/apps/subscriptions/models.py @@ -143,6 +143,39 @@ class CustomerAgreement(TimeStampedModel): ), ) + has_custom_license_expiration_messaging = models.BooleanField( + default=False, + help_text=_( + "Indicates if the customer has a unique license expiration experience, instead of the standard one." + ) + ) + + disabled_enroll_reason_override_for_expired_licenses = models.CharField( + max_length=255, + blank=True, + null=True, + help_text=_( + "Custom message shown when a learner’s subscription expires and they can no longer enroll." + ) + ) + + includes_b2c_marketing_website_cta = models.BooleanField( + default=True, + help_text=_( + "If checked, a link to the B2C course page will be appended to the expired license messaging." + ) + ) + + expired_subscription_modal_messaging = models.CharField( + max_length=255, + blank=True, + null=True, + help_text=_( + "The content of a modal that provides instructions on how learners can continue their journey on " + "the B2C site with a discount code." + ) + ) + history = HistoricalRecords() @property