stripe: Rename CustomerPlan.is_paid.

This might not be the most meaningful change of phrasing, but .is_paid()
sounds like it's a check for whether the customer has already paid their
invoice. is_a_paid_plan() reflects better the meaning that it's whether
it's a plan of a "paid" type.
This commit is contained in:
Mateusz Mandera 2024-03-12 19:48:16 +01:00 committed by Tim Abbott
parent 8038e2322c
commit 4eacd25ad5
2 changed files with 6 additions and 4 deletions

View File

@ -2981,10 +2981,10 @@ class BillingSession(ABC):
self.make_end_of_cycle_updates_if_needed(plan, event_time)
# The primary way to not create an invoice for a plan is to not have
# any new ledger entry. The 'plan.is_paid()' check adds an extra
# any new ledger entry. The 'plan.is_a_paid_plan()' check adds an extra
# layer of defense to avoid creating any invoices for customers not on
# paid plan. It saves a DB query too.
if plan.is_paid():
if plan.is_a_paid_plan():
if plan.invoicing_status == CustomerPlan.INVOICING_STATUS_INITIAL_INVOICE_TO_BE_SENT:
invoiced_through_id = -1
licenses_base = None
@ -5174,7 +5174,9 @@ def invoice_plans_as_needed(event_time: Optional[datetime] = None) -> None:
plan.reminder_to_review_plan_email_sent = True
plan.save(update_fields=["reminder_to_review_plan_email_sent"])
free_plan_with_no_next_plan = not plan.is_paid() and plan.status == CustomerPlan.ACTIVE
free_plan_with_no_next_plan = (
not plan.is_a_paid_plan() and plan.status == CustomerPlan.ACTIVE
)
free_trial_pay_by_invoice_plan = plan.is_free_trial() and not plan.charge_automatically
last_audit_log_update = remote_server.last_audit_log_update
if not free_plan_with_no_next_plan and (

View File

@ -476,7 +476,7 @@ class CustomerPlan(AbstractCustomerPlan):
def is_free_trial(self) -> bool:
return self.status == CustomerPlan.FREE_TRIAL
def is_paid(self) -> bool:
def is_a_paid_plan(self) -> bool:
return self.tier in self.PAID_PLAN_TIERS