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

Keyless Entry Emails #1558

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
365574a
Email: Split EmailType specific tests into separate files
ranta Feb 6, 2025
7890326
Email: Simplify context definitions by merging common translations
ranta Jan 30, 2025
5a66621
Email: Merge reservation price contexts to a single function
ranta Jan 30, 2025
7df0aa2
Email: Merge context instructions label translations
ranta Jan 30, 2025
26e2df9
Email: Merge context reason label translations
ranta Jan 30, 2025
fc6b70c
Email: Merge context misc translations
ranta Jan 30, 2025
86e6175
Email: Fix mock data non_subsidised_price value
ranta Feb 3, 2025
535444e
Email: Add Access Code info to ReservationApproved email template
ranta Feb 6, 2025
77732a6
Email: Add Access Code info to ReservationConfirmed email template
ranta Feb 6, 2025
10e85ed
Email: Add Access Code info to ReservationModified email template
ranta Feb 4, 2025
3fae539
Email: Remove unused params from APPLICATION_SECTION_CANCELLED
ranta Feb 6, 2025
0f717f7
Email: Rename context instructions variables to be type specific
ranta Feb 6, 2025
50f5486
Email: Use similar variable values in tests and get_mock_data
ranta Feb 6, 2025
4b93b40
Email: Set time to all freeze_time calls
ranta Feb 6, 2025
3380609
Email: Refactor context tests with `parametrize` and `get_mock_params`
ranta Feb 6, 2025
6f77f45
Email: Move long common rendered texts to `helpers.py`
ranta Feb 6, 2025
1610e02
Email: Add template for Access Code changed emails
ranta Feb 7, 2025
a6aa2b7
Email: Fix tests calling Pindora to get email contexts
ranta Feb 11, 2025
44b8525
Email: Move `EmailType` from `enums` to `integrations/email/typing`
ranta Feb 10, 2025
648ea96
Email: Require `language` kwarg in `get_mock_params`
ranta Feb 10, 2025
871b488
Email: Refactor `EmailType` from Enum to classes
ranta Feb 11, 2025
9066775
Suppress only `PindoraClientError` instead of `Exception`
ranta Feb 11, 2025
413f09f
Email: Send emails when access code is created, updated or repaired
ranta Feb 11, 2025
24f0a85
Email: Simplify `get_my_applications_ext_link`
ranta Feb 12, 2025
fe133ea
Fix flaky tests near midnight
ranta Feb 12, 2025
61f531e
Email: Add Access Code changed for reservation series email template
ranta Feb 12, 2025
336bdee
Email: Refactor `EmailType`
ranta Feb 15, 2025
d0d9590
Move `tests/test_external_services` -> `tests/test_integrations`
ranta Feb 15, 2025
69dc4ea
Email: Simplify getting `EmailTesterForm`
ranta Feb 17, 2025
df0178b
Convert exceptions in BaseExternalServiceClient to ExternalServiceError
ranta Feb 17, 2025
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
430 changes: 240 additions & 190 deletions backend/locale/fi/LC_MESSAGES/django.po

Large diffs are not rendered by default.

445 changes: 248 additions & 197 deletions backend/locale/sv/LC_MESSAGES/django.po

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% extends "email/html/partials/base.jinja" %}

{% block content_main %}
<mj-text>{{ text_reservation_cancelled | sentence | safe }}</mj-text>
<mj-text>{{ cancel_reason_label | safe }}: {{ cancel_reason | safe }}</mj-text>
<mj-text>{{ text_seasonal_cancelled_by_staff | sentence | safe }}</mj-text>
<mj-text>{{ reason_label | safe }}: {{ cancel_reason | safe }}</mj-text>
{% include "email/html/partials/application_section_name.jinja" %}
<mj-spacer />
<mj-text>{{ check_booking_details_text | safe }}: {{ check_booking_details_url_html | safe }}</mj-text>
Expand Down
9 changes: 9 additions & 0 deletions backend/templates/email/html/partials/access_code.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% if access_code_is_used %}
<mj-spacer />
{% if access_code %}
<mj-text>{{ access_code_label | safe }}: {{ access_code }}</mj-text>
<mj-text>{{ access_code_validity_period_label | safe }}: {{ access_code_validity_period }}</mj-text>
{% else %}
<mj-text>{{ text_access_code_unavailable_instructions_html | sentence }}</mj-text>
{% endif %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% if access_code_is_used %}
<mj-spacer />
{% if access_code %}
<mj-text>{{ text_access_code_to_access | sentence }}</mj-text>
<mj-text>{{ access_code_label | safe }}: {{ access_code }}</mj-text>
<mj-text>{{ access_code_validity_period_label | safe }}: {{ access_code_validity_period }}</mj-text>
{% else %}
<mj-text>{{ text_access_code_unavailable_instructions_html | sentence }}</mj-text>
{% endif %}
{% endif %}
4 changes: 2 additions & 2 deletions backend/templates/email/html/partials/instructions.jinja
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<mj-text><h2>{{ instructions_label | safe }}</h2></mj-text>
<mj-text font-size="16px">{{ instructions_html | safe }}</mj-text>
<mj-text><h2>{{ instructions_booking_label | safe }}</h2></mj-text>
<mj-text font-size="16px">{{ instructions_confirmed_html | safe }}</mj-text>
1 change: 1 addition & 0 deletions backend/templates/email/html/reservation_approved.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<mj-text>{{ text_reservation_approved | sentence | safe }}</mj-text>
{% include "email/html/partials/reservation_basic_info.jinja" %}
{% include "email/html/partials/reservation_price.jinja" %}
{% include "email/html/partials/access_code_with_instructions.jinja" %}
{% endblock %}

{% block content_secondary %}
Expand Down
5 changes: 3 additions & 2 deletions backend/templates/email/html/reservation_cancelled.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

{% block content_main %}
<mj-text>{{ text_reservation_cancelled | sentence | safe }}</mj-text>
<mj-text>{{ cancel_reason_label | safe }}: {{ cancel_reason | safe }}</mj-text>
<mj-text>{{ reason_cancel_label | safe }}: {{ cancel_reason | safe }}</mj-text>
{% include "email/html/partials/reservation_basic_info.jinja" %}
{% include "email/html/partials/reservation_price.jinja" %}
{% endblock %}

{% block content_secondary %}
{% include "email/html/partials/instructions.jinja" %}
<mj-text><h2>{{ instructions_cancelled_label | safe }}</h2></mj-text>
<mj-text font-size="16px">{{ instructions_cancelled_html | safe }}</mj-text>
{% endblock %}

{% block content_closing %}
Expand Down
3 changes: 2 additions & 1 deletion backend/templates/email/html/reservation_confirmed.jinja
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{% extends "email/html/partials/base.jinja" %}

{% block content_main %}
<mj-text>{{ text_reservation_confirmed | sentence | safe }}</mj-text>
<mj-text>{{ text_reservation_confirmed | sentence | safe }}{% if access_code_is_used and access_code %} {{ text_access_code_confirmed | sentence | safe }}{% endif %}</mj-text>
{% include "email/html/partials/reservation_basic_info.jinja" %}
{% include "email/html/partials/reservation_price.jinja" %}
{% include "email/html/partials/access_code.jinja" %}
{% endblock %}

{% block content_secondary %}
Expand Down
3 changes: 2 additions & 1 deletion backend/templates/email/html/reservation_modified.jinja
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{% extends "email/html/partials/base.jinja" %}

{% block content_main %}
<mj-text>{{ text_reservation_modified | sentence | safe }}</mj-text>
<mj-text>{{ text_reservation_modified | sentence | safe }}{% if access_code_is_used and access_code %} {{ text_access_code_confirmed | sentence | safe }}{% endif %}</mj-text>
{% include "email/html/partials/reservation_basic_info.jinja" %}
{% include "email/html/partials/reservation_price.jinja" %}
{% include "email/html/partials/access_code.jinja" %}
{% endblock %}

{% block content_secondary %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "email/html/partials/base.jinja" %}

{% block content_main %}
<mj-text>{{ text_reservation_modified | sentence | safe }}</mj-text>
{% include "email/html/partials/reservation_basic_info.jinja" %}
{% include "email/html/partials/reservation_price.jinja" %}
{% include "email/html/partials/access_code.jinja" %}
{% endblock %}

{% block content_secondary %}
{% include "email/html/partials/instructions.jinja" %}
{% endblock %}

{% block content_closing %}
{% include "email/html/partials/reservation_manage_link.jinja" %}
{% include "email/html/partials/closing_polite.jinja" %}
{% endblock %}
5 changes: 3 additions & 2 deletions backend/templates/email/html/reservation_rejected.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

{% block content_main %}
<mj-text>{{ text_reservation_rejected | sentence | safe }}</mj-text>
<mj-text>{{ rejection_reason_label | safe }}: {{ rejection_reason | safe }}</mj-text>
<mj-text>{{ reason_label | safe }}: {{ rejection_reason | safe }}</mj-text>
{% include "email/html/partials/reservation_basic_info.jinja" %}
<mj-spacer />
<mj-text>{{ booking_number_label | safe }}: {{ reservation_id }}</mj-text>
{% endblock %}

{% block content_secondary %}
{% include "email/html/partials/instructions.jinja" %}
<mj-text><h2>{{ instructions_rejected_label | safe }}</h2></mj-text>
<mj-text font-size="16px">{{ instructions_cancelled_html | safe }}</mj-text>
{% endblock %}

{% block content_closing %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

{% block content_secondary %}
<mj-text font-size="16px">{{ text_pending_notification | sentence | safe }}</mj-text>
{% include "email/html/partials/instructions.jinja" %}
<mj-text><h2>{{ instructions_booking_label | safe }}</h2></mj-text>
<mj-text font-size="16px">{{ instructions_pending_html | safe }}</mj-text>
{% endblock %}

{% block content_closing %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% extends "email/html/partials/base.jinja" %}

{% block content_main %}
<mj-text>{{ text_reservation_cancelled | sentence | safe }}</mj-text>
<mj-text>{{ cancel_reason_label | safe }}: {{ cancel_reason | safe }}</mj-text>
<mj-text>{{ text_seasonal_reservation_cancelled | sentence | safe }}</mj-text>
<mj-text>{{ reason_label | safe }}: {{ cancel_reason | safe }}</mj-text>
{% include "email/html/partials/reservation_basic_info.jinja" %}
<mj-spacer />
<mj-text>{{ check_booking_details_text | safe }}: {{ check_booking_details_url_html | safe }}</mj-text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<mj-spacer />
<mj-text>{{ weekday_label | safe }}: {{ weekday_value | safe }}</mj-text>
<mj-text>{{ time_label | safe }}: {{ time_value | safe }}</mj-text>
{% include "email/html/partials/access_code.jinja" %}
<mj-spacer />
<mj-text>{{ check_booking_details_text | safe }}: {{ check_booking_details_url_html | safe }}</mj-text>
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "email/html/seasonal_reservation_modified_series.jinja" %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block content_main %}
<mj-text>{{ text_reservation_rejected | sentence | safe }}</mj-text>
<mj-text>{{ rejection_reason_label | safe }}: {{ rejection_reason | safe }}</mj-text>
<mj-text>{{ reason_label | safe }}: {{ rejection_reason | safe }}</mj-text>
{% include "email/html/partials/application_section_name.jinja" %}
<mj-spacer />
<mj-text>{{ weekday_label | safe }}: {{ weekday_value | safe }}</mj-text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block content_main %}
<mj-text>{{ text_reservation_rejected | sentence | safe }}</mj-text>
<mj-text>{{ rejection_reason_label | safe }}: {{ rejection_reason | safe }}</mj-text>
<mj-text>{{ reason_label | safe }}: {{ rejection_reason | safe }}</mj-text>
{% include "email/html/partials/reservation_basic_info.jinja" %}
<mj-spacer />
<mj-text>{{ check_booking_details_text | safe }}: {{ check_booking_details_url_html | safe }}</mj-text>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{% extends "email/html/partials/base.jinja" %}

{% block content_main %}
<mj-text>{{ text_reservation_cancelled | sentence | safe }}</mj-text>
<mj-text>{{ cancel_reason_label | safe }}: {{ cancel_reason | safe }}</mj-text>
<mj-text>{{ text_seasonal_cancelled_by_customer | sentence | safe }}</mj-text>
<mj-text>{{ reason_label | safe }}: {{ cancel_reason | safe }}</mj-text>
{% include "email/html/partials/application_section_name.jinja" %}

<mj-spacer />
<mj-text>{{ view_booking_at_label | safe }}:</mj-text>
{% for series in cancelled_reservation_series %}
<mj-text>{{ series.weekday_value | safe }}: {{ series.time_value | safe }}</mj-text>
<mj-text><a href="{{ series.url | safe }}">{{ series.url | safe }}</a></mj-text>
<mj-text><a href="{{ series.reservation_url | safe }}">{{ series.reservation_url | safe }}</a></mj-text>
{% endfor %}
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% endblock %}

{% block content_secondary %}
<mj-text><h2>{{ text_check_details | safe }}</h2></mj-text>
<mj-text><h2>{{ text_view_booking_at | safe }}</h2></mj-text>
<mj-text font-size="16px">{{ staff_reservations_ext_link_html | safe }}</mj-text>
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% endblock %}

{% block content_secondary %}
<mj-text><h2>{{ text_check_details | safe }}</h2></mj-text>
<mj-text><h2>{{ text_view_and_handle_at | safe }}</h2></mj-text>
<mj-text font-size="16px">{{ staff_reservations_ext_link_html | safe }}</mj-text>
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ salutation | safe }} {{ email_recipient_name | safe }},

{{ text_reservation_cancelled | sentence | safe }}
{{ cancel_reason_label | safe }}: {{ cancel_reason }}
{{ text_seasonal_cancelled_by_staff | sentence | safe }}
{{ reason_label | safe }}: {{ cancel_reason }}

{% include "email/text/partials/application_section_name.jinja" %}

Expand Down
6 changes: 6 additions & 0 deletions backend/templates/email/text/partials/access_code.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% if access_code_is_used %}{% if access_code %}
{{ access_code_label | safe }}: {{ access_code }}
{{ access_code_validity_period_label | safe }}: {{ access_code_validity_period }}
{% else %}
{{ text_access_code_unavailable_instructions | safe | sentence }}
{% endif %}{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% if access_code_is_used %}{% if access_code %}
{{ text_access_code_to_access | sentence }}
{{ access_code_label | safe }}: {{ access_code }}
{{ access_code_validity_period_label | safe }}: {{ access_code_validity_period }}
{% else %}
{{ text_access_code_unavailable_instructions | safe | sentence }}
{% endif %}{% endif %}
4 changes: 2 additions & 2 deletions backend/templates/email/text/partials/instructions.jinja
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{ instructions_label | safe }}:
{{ instructions_text | safe }}
{{ instructions_booking_label | safe }}:
{{ instructions_confirmed_text | safe }}
2 changes: 1 addition & 1 deletion backend/templates/email/text/reservation_approved.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% include "email/text/partials/reservation_basic_info.jinja" %}

{% include "email/text/partials/reservation_price.jinja" %}

{% include "email/text/partials/access_code_with_instructions.jinja" %}
{% include "email/text/partials/instructions.jinja" %}

{% include "email/text/partials/reservation_manage_link.jinja" %}
Expand Down
5 changes: 3 additions & 2 deletions backend/templates/email/text/reservation_cancelled.jinja
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{{ salutation | safe }} {{ email_recipient_name | safe }},

{{ text_reservation_cancelled | sentence | safe }}
{{ cancel_reason_label | safe }}: {{ cancel_reason }}
{{ reason_cancel_label | safe }}: {{ cancel_reason }}

{% include "email/text/partials/reservation_basic_info.jinja" %}

{% include "email/text/partials/reservation_price.jinja" %}

{% include "email/text/partials/instructions.jinja" %}
{{ instructions_cancelled_label | safe }}:
{{ instructions_cancelled_text | safe }}

{% include "email/text/partials/closing.jinja" %}
4 changes: 2 additions & 2 deletions backend/templates/email/text/reservation_confirmed.jinja
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{ salutation | safe }} {{ email_recipient_name | safe }},

{{ text_reservation_confirmed | sentence | safe }}
{{ text_reservation_confirmed | sentence | safe }}{% if access_code_is_used and access_code %} {{ text_access_code_confirmed | sentence | safe }}{% endif %}

{% include "email/text/partials/reservation_basic_info.jinja" %}

{% include "email/text/partials/reservation_price.jinja" %}

{% include "email/text/partials/access_code.jinja" %}
{% include "email/text/partials/instructions.jinja" %}

{% include "email/text/partials/reservation_manage_link.jinja" %}
Expand Down
4 changes: 2 additions & 2 deletions backend/templates/email/text/reservation_modified.jinja
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{ salutation | safe }} {{ email_recipient_name | safe }},

{{ text_reservation_modified | sentence | safe }}
{{ text_reservation_modified | sentence | safe }}{% if access_code_is_used and access_code %} {{ text_access_code_confirmed | sentence | safe }}{% endif %}

{% include "email/text/partials/reservation_basic_info.jinja" %}

{% include "email/text/partials/reservation_price.jinja" %}

{% include "email/text/partials/access_code.jinja" %}
{% include "email/text/partials/instructions.jinja" %}

{% include "email/text/partials/reservation_manage_link.jinja" %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{ salutation | safe }} {{ email_recipient_name | safe }},

{{ text_reservation_modified | sentence | safe }}

{% include "email/text/partials/reservation_basic_info.jinja" %}

{% include "email/text/partials/reservation_price.jinja" %}
{% include "email/text/partials/access_code.jinja" %}
{% include "email/text/partials/instructions.jinja" %}

{% include "email/text/partials/reservation_manage_link.jinja" %}

{% include "email/text/partials/closing_polite.jinja" %}

{% include "email/text/partials/automatic_message.jinja" %}
5 changes: 3 additions & 2 deletions backend/templates/email/text/reservation_rejected.jinja
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{{ salutation | safe }} {{ email_recipient_name | safe }},

{{ text_reservation_rejected | sentence | safe }}
{{ rejection_reason_label | safe }}: {{ rejection_reason }}
{{ reason_label | safe }}: {{ rejection_reason }}

{% include "email/text/partials/reservation_basic_info.jinja" %}

{{ booking_number_label | safe }}: {{ reservation_id }}

{% include "email/text/partials/instructions.jinja" %}
{{ instructions_rejected_label | safe }}:
{{ instructions_cancelled_text | safe }}

{% include "email/text/partials/closing.jinja" %}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

{{ text_pending_notification | sentence | safe }}

{% include "email/text/partials/instructions.jinja" %}
{{ instructions_booking_label | safe }}:
{{ instructions_pending_text | safe }}

{% include "email/text/partials/reservation_manage_link.jinja" %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ salutation | safe }} {{ email_recipient_name | safe }},

{{ text_reservation_cancelled | sentence | safe }}
{{ cancel_reason_label | safe }}: {{ cancel_reason }}
{{ text_seasonal_reservation_cancelled | sentence | safe }}
{{ reason_label | safe }}: {{ cancel_reason }}

{% include "email/text/partials/reservation_basic_info.jinja" %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{{ weekday_label | safe }}: {{ weekday_value | safe }}
{{ time_label | safe }}: {{ time_value | safe }}

{% include "email/text/partials/access_code.jinja" %}
{{ check_booking_details_text | safe }}: {{ check_booking_details_url }}

{% include "email/text/partials/closing.jinja" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "email/text/seasonal_reservation_modified_series.jinja" %}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ salutation | safe }} {{ email_recipient_name | safe }},

{{ text_reservation_rejected | sentence | safe }}
{{ rejection_reason_label | safe }}: {{ rejection_reason }}
{{ reason_label | safe }}: {{ rejection_reason }}

{% include "email/text/partials/application_section_name.jinja" %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ salutation | safe }} {{ email_recipient_name | safe }},

{{ text_reservation_rejected | sentence | safe }}
{{ rejection_reason_label | safe }}: {{ rejection_reason }}
{{ reason_label | safe }}: {{ rejection_reason }}

{% include "email/text/partials/reservation_basic_info.jinja" %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{{ salutation | safe }},

{{ text_reservation_cancelled | sentence | safe }}
{{ text_seasonal_cancelled_by_customer | sentence | safe }}

{{ cancel_reason_label | safe }}: {{ cancel_reason | safe }}
{{ reason_label | safe }}: {{ cancel_reason | safe }}

{% include "email/text/partials/application_section_name.jinja" %}

{{ view_booking_at_label | safe }}:

{% for series in cancelled_reservation_series %}{{ series.weekday_value | safe }} {{ series.time_value | safe }}
{{ series.url | safe }}
{{ series.reservation_url | safe }}
{% endfor %}
{% include "email/text/partials/closing_staff.jinja" %}
Loading