stripe: Use a common email template for internal billing notices.

This is a prep commit which replaces the 'invoice_overdue'
and 'reminder_to_review_plan' email templates with
'internal_billing_notice'.

This will help us to use the same template as we plan to
send an email to sales when a remote realm with paid plan
attached is locally deleted.
This commit is contained in:
Prakhar Pratyush 2024-02-29 14:56:41 +05:30 committed by Tim Abbott
parent 220c4cbdc2
commit 5d58a39087
9 changed files with 21 additions and 20 deletions

View File

@ -4859,9 +4859,10 @@ def invoice_plans_as_needed(event_time: Optional[datetime] = None) -> None:
"billing_entity": billing_session.billing_entity_display_name,
"end_date": plan.end_date.strftime("%Y-%m-%d"),
"support_url": billing_session.support_url(),
"notice_reason": "fixed_price_plan_ends_soon",
}
send_email(
"zerver/emails/reminder_to_review_plan",
"zerver/emails/internal_billing_notice",
to_emails=[BILLING_SUPPORT_EMAIL],
from_address=FromAddress.tokenized_no_reply_address(),
context=context,
@ -4881,9 +4882,10 @@ def invoice_plans_as_needed(event_time: Optional[datetime] = None) -> None:
context = {
"support_url": billing_session.support_url(),
"last_audit_log_update": last_audit_log_update_string,
"notice_reason": "invoice_overdue",
}
send_email(
"zerver/emails/invoice_overdue",
"zerver/emails/internal_billing_notice",
to_emails=[BILLING_SUPPORT_EMAIL],
from_address=FromAddress.tokenized_no_reply_address(),
context=context,

View File

@ -1,7 +1,12 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block content %}
{% if notice_reason == "fixed_price_plan_ends_soon" %}
<p>Reminder to re-evaluate the pricing and configure a new fixed-price plan accordingly.</p>
{% elif notice_reason == "invoice_overdue" %}
<b>Last data upload</b>: {{ last_audit_log_update }}
{% endif %}
<br /><br />

View File

@ -0,0 +1,5 @@
{% if notice_reason == "fixed_price_plan_ends_soon" %}
Fixed-price plan for {{billing_entity}} ends on {{end_date}}
{% elif notice_reason == "invoice_overdue" %}
Invoice overdue due to stale data
{% endif %}

View File

@ -0,0 +1,7 @@
{% if notice_reason == "fixed_price_plan_ends_soon" %}
Reminder to re-evaluate the pricing and configure a new fixed-price plan accordingly.
{% elif notice_reason == "invoice_overdue" %}
Last data upload: {{ last_audit_log_update }}
{% endif %}
Support URL: {{ support_url }}

View File

@ -1,10 +0,0 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block content %}
<b>Support URL</b>: <a href="{{ support_url }}">{{ support_url }}</a>
<br /><br />
<b>Last data upload</b>: {{ last_audit_log_update }}
{% endblock %}

View File

@ -1 +0,0 @@
Invoice overdue due to stale data

View File

@ -1,3 +0,0 @@
Support URL: {{ support_url }}
Last data upload: {{ last_audit_log_update }}

View File

@ -1 +0,0 @@
Fixed-price plan for {{billing_entity}} ends on {{end_date}}

View File

@ -1,3 +0,0 @@
Reminder to re-evaluate the pricing and configure a new fixed-price plan accordingly.
Support URL: {{ support_url }}