diff --git a/app/clients/freshdesk.py b/app/clients/freshdesk.py index 785096af5a..791bd823e4 100644 --- a/app/clients/freshdesk.py +++ b/app/clients/freshdesk.py @@ -40,6 +40,14 @@ def _generate_description(self): # the ">" character breaks rendering for the freshdesk preview in slack if self.contact.department_org_name: self.contact.department_org_name = self.contact.department_org_name.replace(">", "/") + # Add custom limit only if requested + daily_email_volume = f"{self.contact.daily_email_volume}" + daily_sms_volume = f"{self.contact.daily_sms_volume}" + if self.contact.how_many_more_sms: + daily_email_volume += f" ({self.contact.how_many_more_email})" + if self.contact.how_many_more_sms: + daily_sms_volume += f" ({self.contact.how_many_more_sms})" + message = "
".join( [ f"{self.contact.service_name} just requested to go live.", @@ -47,8 +55,14 @@ def _generate_description(self): f"- Department/org: {self.contact.department_org_name}", f"- Intended recipients: {self.contact.intended_recipients}", f"- Purpose: {self.contact.main_use_case}", - f"- Notification types: {self.contact.notification_types}", - f"- Expected monthly volume: {self.contact.expected_volume}", + "", + "- Expected email volumes:", + f"- Daily: {daily_email_volume}", + f"- Yearly: {self.contact.annual_email_volume}", + "", + "- Expected SMS volumes:", + f"- Daily: {daily_sms_volume}", + f"- Yearly: {self.contact.annual_sms_volume}", "---", self.contact.service_url, ] diff --git a/app/user/contact_request.py b/app/user/contact_request.py index 3473db150a..24970b1844 100644 --- a/app/user/contact_request.py +++ b/app/user/contact_request.py @@ -30,6 +30,12 @@ class ContactRequest: service_url: str = field(default="") notification_types: str = field(default="") expected_volume: str = field(default="") + daily_email_volume: str = field(default="") + annual_email_volume: str = field(default="") + daily_sms_volume: str = field(default="") + annual_sms_volume: str = field(default="") + how_many_more_email: str = field(default="") + how_many_more_sms: str = field(default="") branding_url: str = field(default="") branding_logo_name: str = field(default="") alt_text_en: str = field(default="") diff --git a/tests/app/clients/test_freshdesk.py b/tests/app/clients/test_freshdesk.py index ae0ada8b7e..36002aca9b 100644 --- a/tests/app/clients/test_freshdesk.py +++ b/tests/app/clients/test_freshdesk.py @@ -73,12 +73,19 @@ def match_json(request): expected = { "product_id": 42, "subject": "Support Request", - "description": "t6 just requested to go live.

" + "description": "t6 just requested to go live.
" + "
" "- Department/org: department_org_name
" "- Intended recipients: internal, external, public
" "- Purpose: main_use_case
" - "- Notification types: email, sms
" - "- Expected monthly volume: 100k+
" + "
" + "- Expected email volumes:
" + "- Daily: above_limit (None)
" + "- Yearly: within_limit
" + "
" + "- Expected SMS volumes:
" + "- Daily: more_sms (54321)
" + "- Yearly: above_limit
" "---
" "http://localhost:6012/services/8624bd36-b70b-4d4b-a459-13e1f4770b92", "email": "test@email.com", @@ -113,6 +120,12 @@ def match_json(request): "service_url": "http://localhost:6012/services/8624bd36-b70b-4d4b-a459-13e1f4770b92", "notification_types": "email, sms", "expected_volume": "100k+", + "daily_email_volume": "above_limit", + "annual_email_volume": "within_limit", + "daily_sms_volume": "more_sms", + "annual_sms_volume": "above_limit", + "how_many_more_email": None, + "how_many_more_sms": 54321, } with notify_api.app_context(): response = freshdesk.Freshdesk(ContactRequest(**data)).send_ticket()