diff --git a/help_to_heat/frontdoor/views.py b/help_to_heat/frontdoor/views.py index 288d2a12..a98753eb 100644 --- a/help_to_heat/frontdoor/views.py +++ b/help_to_heat/frontdoor/views.py @@ -82,6 +82,10 @@ unavailable_suppliers = [] +def format_referral_id(referral_id): + return f"GBIS{referral_id:07}" + + def unavailable_supplier_redirect(session_id): session_data = interface.api.session.get_session(session_id) supplier = session_data["supplier"] @@ -840,7 +844,8 @@ class SuccessView(PageView): def get_context(self, session_id, *args, **kwargs): supplier = SupplierConverter(session_id).get_supplier_on_success_page() session = interface.api.session.get_session(session_id) - return {"supplier": supplier, "safe_to_cache": True, "referral_id": session.get("referral_id")} + referral_id = format_referral_id(session.get("referral_id")) + return {"supplier": supplier, "safe_to_cache": True, "referral_id": referral_id} class FeedbackView(utils.MethodDispatcher): diff --git a/help_to_heat/portal/email_handler.py b/help_to_heat/portal/email_handler.py index 30322f18..71ba47b0 100644 --- a/help_to_heat/portal/email_handler.py +++ b/help_to_heat/portal/email_handler.py @@ -8,6 +8,7 @@ from django.urls import reverse from django.utils import timezone +from help_to_heat.frontdoor import views from help_to_heat.portal import models logger = logging.getLogger(__name__) @@ -127,7 +128,8 @@ def send_referral_confirmation_email(session_data, language_code): else: data = EMAIL_MAPPING["referral-confirmation"] data["subject"] = f"Referral to {session_data.get('supplier')} successful" - context = {"supplier_name": session_data.get("supplier")} + referral_id = views.format_referral_id(session_data["referral_id"]) + context = {"supplier_name": session_data.get("supplier"), "referral_id": referral_id} return _send_normal_email(to_address=session_data.get("email"), context=context, **data) diff --git a/help_to_heat/templates/frontdoor/success.html b/help_to_heat/templates/frontdoor/success.html index 8e607798..dbdbbc7f 100644 --- a/help_to_heat/templates/frontdoor/success.html +++ b/help_to_heat/templates/frontdoor/success.html @@ -12,7 +12,7 @@

{{_("Your details have been submitted to %(supplier)s") % { "supplier": supplier }}}

-

{{_("Your referral ID is %(referral_id)s") % { "referral_id": referral_id }}}

+
{{_("Your reference number is %(referral_id)s") % { "referral_id": referral_id }}}

{{_("If you provided an email address in your referral then we have sent you a confirmation email.")}}

diff --git a/help_to_heat/templates/portal/email/referral-confirmation.txt b/help_to_heat/templates/portal/email/referral-confirmation.txt index 3cdefbd4..caf1bf8c 100644 --- a/help_to_heat/templates/portal/email/referral-confirmation.txt +++ b/help_to_heat/templates/portal/email/referral-confirmation.txt @@ -1,5 +1,7 @@ Hi, +Your reference number is {{referral_id}} + Your details have been submitted to {{supplier_name}}. # What happens next?