Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Commit

Permalink
Allow assigning our own reference to Notify emails
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelhwilliams committed Nov 28, 2024
1 parent 91856ad commit 177d5b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/notification/model/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Notification:
contact_info: str
contact_name: str
content: dict
reference: str | None = None

@staticmethod
def from_json(data: dict):
Expand All @@ -26,6 +27,7 @@ def from_json(data: dict):
contact_info=data.get("to"),
contact_name=data.get("full_name", ""),
content=data.get("content"),
reference=data.get("reference"),
)
current_app.logger.info(
f"Notification data template_type: ({notification_data.template_type}) "
Expand Down
7 changes: 7 additions & 0 deletions app/notification/model/notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def send_magic_link(notification: Notification, code: int = 200) -> tuple:
"request new link url": contents.request_new_link_url,
"contact details": contents.contact_help_email,
},
reference=notification.reference,
)
current_app.logger.info("Call made to govuk Notify API")
return response, code
Expand Down Expand Up @@ -83,6 +84,7 @@ def send_submitted_application(notification: Notification, code: int = 200) -> t
"retention_period": None,
},
},
reference=notification.reference,
)
current_app.logger.info("Call made to govuk Notify API")
return response, code
Expand Down Expand Up @@ -124,6 +126,7 @@ def send_submitted_eoi(notification: Notification, code: int = 200, template_nam
"caveats": contents.caveats,
"full name": contents.contact_name,
},
reference=notification.reference,
)
current_app.logger.info("Call made to govuk Notify API")
return response, code
Expand Down Expand Up @@ -164,6 +167,7 @@ def send_incomplete_application(notification: Notification, code: int = 200) ->
"retention_period": None,
},
},
reference=notification.reference,
)
current_app.logger.info("Call made to govuk Notify API")
return response, code
Expand Down Expand Up @@ -196,6 +200,7 @@ def send_application_reminder(notification: Notification, code: int = 200) -> tu
"round name": contents.round_name,
"application deadline": contents.deadline_date,
},
reference=notification.reference,
)
current_app.logger.info("Call made to govuk Notify API")
return response, code
Expand All @@ -222,6 +227,7 @@ def send_assessment_assigned(notification: Notification, code: int = 200) -> tup
"assessment link": contents.assessment_link,
"lead assessor email": contents.lead_assessor_email,
},
reference=notification.reference,
)
current_app.logger.info("Call made to govuk Notify API")
return response, code
Expand All @@ -248,6 +254,7 @@ def send_assessment_unassigned(notification: Notification, code: int = 200) -> t
"assessment link": contents.assessment_link,
"lead assessor email": contents.lead_assessor_email,
},
reference=notification.reference,
)
current_app.logger.info("Call made to govuk Notify API")
return response, code
Expand Down

0 comments on commit 177d5b8

Please sign in to comment.