mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
stripe: Use absent days_until_due rather than invalid None.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 228ade86be
)
This commit is contained in:
committed by
Tim Abbott
parent
1327db6e9c
commit
c67f08b58a
@@ -1320,13 +1320,15 @@ class BillingSession(ABC):
|
||||
collection_method = "send_invoice"
|
||||
days_until_due = DEFAULT_INVOICE_DAYS_UNTIL_DUE
|
||||
|
||||
stripe_invoice = stripe.Invoice.create(
|
||||
invoice_params = stripe.Invoice.CreateParams(
|
||||
auto_advance=True,
|
||||
collection_method=collection_method,
|
||||
customer=customer.stripe_customer_id,
|
||||
days_until_due=days_until_due,
|
||||
statement_descriptor=plan.name,
|
||||
)
|
||||
if days_until_due is not None:
|
||||
invoice_params["days_until_due"] = days_until_due
|
||||
stripe_invoice = stripe.Invoice.create(**invoice_params)
|
||||
stripe.Invoice.finalize_invoice(stripe_invoice)
|
||||
|
||||
if plan.status < CustomerPlan.LIVE_STATUS_THRESHOLD:
|
||||
@@ -2264,13 +2266,15 @@ class BillingSession(ABC):
|
||||
else:
|
||||
collection_method = "send_invoice"
|
||||
days_until_due = DEFAULT_INVOICE_DAYS_UNTIL_DUE
|
||||
stripe_invoice = stripe.Invoice.create(
|
||||
invoice_params = stripe.Invoice.CreateParams(
|
||||
auto_advance=True,
|
||||
collection_method=collection_method,
|
||||
customer=plan.customer.stripe_customer_id,
|
||||
days_until_due=days_until_due,
|
||||
statement_descriptor=plan.name,
|
||||
)
|
||||
if days_until_due is not None:
|
||||
invoice_params["days_until_due"] = days_until_due
|
||||
stripe_invoice = stripe.Invoice.create(**invoice_params)
|
||||
stripe.Invoice.finalize_invoice(stripe_invoice)
|
||||
|
||||
plan.next_invoice_date = next_invoice_date(plan)
|
||||
|
@@ -134,7 +134,6 @@ def handle_payment_intent_succeeded_event(
|
||||
auto_advance=True,
|
||||
collection_method="charge_automatically",
|
||||
customer=stripe_payment_intent.customer,
|
||||
days_until_due=None,
|
||||
statement_descriptor=CustomerPlan.name_from_tier(plan_tier).replace("Zulip ", "")
|
||||
+ " Credit",
|
||||
)
|
||||
|
Reference in New Issue
Block a user