From 177d5b8c7d9b0892e1cd65b87bbaf8de5a215e26 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 28 Nov 2024 21:45:13 +0000 Subject: [PATCH] Allow assigning our own reference to Notify emails --- app/notification/model/notification.py | 2 ++ app/notification/model/notifier.py | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/app/notification/model/notification.py b/app/notification/model/notification.py index 5f976275..18020ff8 100644 --- a/app/notification/model/notification.py +++ b/app/notification/model/notification.py @@ -13,6 +13,7 @@ class Notification: contact_info: str contact_name: str content: dict + reference: str | None = None @staticmethod def from_json(data: dict): @@ -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}) " diff --git a/app/notification/model/notifier.py b/app/notification/model/notifier.py index 03d29afb..c576825d 100644 --- a/app/notification/model/notifier.py +++ b/app/notification/model/notifier.py @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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