mirror of
https://github.com/zulip/zulip.git
synced 2025-10-22 20:42:14 +00:00
corporate: Rename CustomerPlan.invoice_overdue_email_sent field.
Renames invoice_overdue_email_sent to stale_audit_log_data_email_sent to better reflect the email and state that field is tracking for the CustomerPlan.
This commit is contained in:
committed by
Tim Abbott
parent
9edabf5ac8
commit
2912d48579
@@ -3353,11 +3353,11 @@ class BillingSession(ABC):
|
||||
|
||||
plan.invoicing_status = CustomerPlan.INVOICING_STATUS_DONE
|
||||
plan.next_invoice_date = next_invoice_date(plan)
|
||||
plan.invoice_overdue_email_sent = False
|
||||
plan.stale_audit_log_data_email_sent = False
|
||||
plan.save(
|
||||
update_fields=[
|
||||
"next_invoice_date",
|
||||
"invoice_overdue_email_sent",
|
||||
"stale_audit_log_data_email_sent",
|
||||
"invoicing_status",
|
||||
]
|
||||
)
|
||||
@@ -5456,7 +5456,7 @@ def maybe_send_fixed_price_plan_renewal_reminder_email(
|
||||
plan.save(update_fields=["reminder_to_review_plan_email_sent"])
|
||||
|
||||
|
||||
def maybe_send_invoice_overdue_email(
|
||||
def maybe_send_stale_audit_log_data_email(
|
||||
plan: CustomerPlan,
|
||||
billing_session: BillingSession,
|
||||
next_invoice_date: datetime,
|
||||
@@ -5478,8 +5478,8 @@ def maybe_send_invoice_overdue_email(
|
||||
from_address=FromAddress.tokenized_no_reply_address(),
|
||||
context=context,
|
||||
)
|
||||
plan.invoice_overdue_email_sent = True
|
||||
plan.save(update_fields=["invoice_overdue_email_sent"])
|
||||
plan.stale_audit_log_data_email_sent = True
|
||||
plan.save(update_fields=["stale_audit_log_data_email_sent"])
|
||||
return
|
||||
|
||||
if next_invoice_date - last_audit_log_update < timedelta(days=1): # nocoverage
|
||||
@@ -5500,8 +5500,8 @@ def maybe_send_invoice_overdue_email(
|
||||
from_address=FromAddress.tokenized_no_reply_address(),
|
||||
context=context,
|
||||
)
|
||||
plan.invoice_overdue_email_sent = True
|
||||
plan.save(update_fields=["invoice_overdue_email_sent"])
|
||||
plan.stale_audit_log_data_email_sent = True
|
||||
plan.save(update_fields=["stale_audit_log_data_email_sent"])
|
||||
|
||||
|
||||
def check_remote_server_audit_log_data(
|
||||
@@ -5517,8 +5517,8 @@ def check_remote_server_audit_log_data(
|
||||
next_invoice_date = plan.next_invoice_date
|
||||
last_audit_log_update = remote_server.last_audit_log_update
|
||||
if last_audit_log_update is None or next_invoice_date > last_audit_log_update:
|
||||
if not plan.invoice_overdue_email_sent:
|
||||
maybe_send_invoice_overdue_email(
|
||||
if not plan.stale_audit_log_data_email_sent:
|
||||
maybe_send_stale_audit_log_data_email(
|
||||
plan, billing_session, next_invoice_date, last_audit_log_update
|
||||
)
|
||||
|
||||
|
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 5.1.8 on 2025-05-27 14:26
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("corporate", "0045_zulipsponsorshiprequest_plan_to_use_zulip"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name="customerplan",
|
||||
old_name="invoice_overdue_email_sent",
|
||||
new_name="stale_audit_log_data_email_sent",
|
||||
),
|
||||
]
|
@@ -110,10 +110,10 @@ class CustomerPlan(AbstractCustomerPlan):
|
||||
# next_invoice_date.
|
||||
next_invoice_date = models.DateTimeField(db_index=True, null=True)
|
||||
|
||||
# Flag to track if an email has been sent to Zulip team for
|
||||
# invoice overdue by >= one day. Helps to send an email only once
|
||||
# Flag to track if an email has been sent to Zulip team for delay
|
||||
# of invoicing by >= one day. Helps to send an email only once
|
||||
# and not every time when cron run.
|
||||
invoice_overdue_email_sent = models.BooleanField(default=False)
|
||||
stale_audit_log_data_email_sent = models.BooleanField(default=False)
|
||||
|
||||
# Flag to track if an email has been sent to Zulip team to
|
||||
# review the pricing, 60 days before the end date. Helps to send
|
||||
|
@@ -8724,7 +8724,7 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
|
||||
invoice_plans_as_needed(self.next_month)
|
||||
plan.refresh_from_db()
|
||||
self.assertEqual(plan.next_invoice_date, self.next_month)
|
||||
self.assertTrue(plan.invoice_overdue_email_sent)
|
||||
self.assertTrue(plan.stale_audit_log_data_email_sent)
|
||||
|
||||
from django.core.mail import outbox
|
||||
|
||||
@@ -8762,7 +8762,7 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
|
||||
invoice_plans_as_needed(self.next_month)
|
||||
plan.refresh_from_db()
|
||||
self.assertEqual(plan.next_invoice_date, add_months(self.next_month, 1))
|
||||
self.assertFalse(plan.invoice_overdue_email_sent)
|
||||
self.assertFalse(plan.stale_audit_log_data_email_sent)
|
||||
|
||||
assert customer.stripe_customer_id
|
||||
[invoice0, invoice1] = iter(stripe.Invoice.list(customer=customer.stripe_customer_id))
|
||||
@@ -10265,7 +10265,7 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
|
||||
invoice_plans_as_needed(self.next_month)
|
||||
plan.refresh_from_db()
|
||||
self.assertEqual(plan.next_invoice_date, self.next_month)
|
||||
self.assertTrue(plan.invoice_overdue_email_sent)
|
||||
self.assertTrue(plan.stale_audit_log_data_email_sent)
|
||||
|
||||
from django.core.mail import outbox
|
||||
|
||||
@@ -10303,7 +10303,7 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
|
||||
invoice_plans_as_needed(self.next_month)
|
||||
plan.refresh_from_db()
|
||||
self.assertEqual(plan.next_invoice_date, add_months(self.next_month, 1))
|
||||
self.assertFalse(plan.invoice_overdue_email_sent)
|
||||
self.assertFalse(plan.stale_audit_log_data_email_sent)
|
||||
|
||||
assert customer.stripe_customer_id
|
||||
[invoice0, invoice1] = iter(stripe.Invoice.list(customer=customer.stripe_customer_id))
|
||||
|
Reference in New Issue
Block a user