stripe: Create customer if one doesn't exist.

Since this function can only be called by billing admins, it
is okay to allow them to create a customer if one doesn't exist.
This commit is contained in:
Aman Agrawal 2024-12-13 16:26:21 +05:30 committed by Tim Abbott
parent 9b96b45841
commit bb8a0ea1f4

View File

@ -818,12 +818,10 @@ class BillingSession(ABC):
setup_payment_by_invoice: bool = False,
) -> str:
customer = self.get_customer()
if setup_payment_by_invoice and (
customer is None or customer.stripe_customer_id is None
): # nocoverage
if customer is None or customer.stripe_customer_id is None: # nocoverage
customer = self.create_stripe_customer()
assert customer is not None and customer.stripe_customer_id is not None
assert customer.stripe_customer_id is not None
if return_to_billing_page:
return_url = f"{self.billing_session_url}/billing/"