Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new go-live data to freshdesk integration #2374

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions app/clients/freshdesk.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,29 @@ 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 = "<br>".join(
[
f"{self.contact.service_name} just requested to go live.",
"",
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,
]
Expand Down
6 changes: 6 additions & 0 deletions app/user/contact_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="")
Expand Down
19 changes: 16 additions & 3 deletions tests/app/clients/test_freshdesk.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,19 @@ def match_json(request):
expected = {
"product_id": 42,
"subject": "Support Request",
"description": "t6 just requested to go live.<br><br>"
"description": "t6 just requested to go live.<br>"
"<br>"
"- Department/org: department_org_name<br>"
"- Intended recipients: internal, external, public<br>"
"- Purpose: main_use_case<br>"
"- Notification types: email, sms<br>"
"- Expected monthly volume: 100k+<br>"
"<br>"
"- Expected email volumes:<br>"
"- Daily: above_limit (None)<br>"
"- Yearly: within_limit<br>"
"<br>"
"- Expected SMS volumes:<br>"
"- Daily: more_sms (54321)<br>"
"- Yearly: above_limit<br>"
"---<br>"
"http://localhost:6012/services/8624bd36-b70b-4d4b-a459-13e1f4770b92",
"email": "[email protected]",
Expand Down Expand Up @@ -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()
Expand Down
Loading