Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit bd566d0

Browse files
cleanup
1 parent 802225d commit bd566d0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

billing/views.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ def invoice_payment_succeeded(self, invoice: stripe.Invoice) -> None:
8888
**template_vars,
8989
)
9090

91-
# handler for Stripe event invoice.payment_failed
9291
def invoice_payment_failed(self, invoice: stripe.Invoice) -> None:
9392
"""
9493
Stripe invoice.payment_failed is called when an invoice is not paid. This happens
@@ -177,6 +176,10 @@ def invoice_payment_failed(self, invoice: stripe.Invoice) -> None:
177176

178177
# handler for Stripe event customer.subscription.deleted
179178
def customer_subscription_deleted(self, subscription: stripe.Subscription) -> None:
179+
"""
180+
Stripe customer.subscription.deleted is called when a subscription is deleted.
181+
This happens when an org goes from paid to free.
182+
"""
180183
log.info(
181184
"Customer Subscription Deleted - Setting free plan and deactivating repos for stripe customer",
182185
extra=dict(
@@ -286,8 +289,11 @@ def subscription_schedule_released(
286289
),
287290
)
288291

289-
# handler for Stripe event customer.created
290292
def customer_created(self, customer: stripe.Customer) -> None:
293+
"""
294+
Stripe customer.created is called when a customer is created.
295+
This happens when an owner completes a CheckoutSession for the first time.
296+
"""
291297
# Based on what stripe doesn't gives us (an ownerid!)
292298
# in this event we cannot reliably create a customer,
293299
# so we're just logging that we created the event and
@@ -563,10 +569,10 @@ def _check_and_handle_delayed_notification_payment_methods(
563569
owner.stripe_subscription_id, default_payment_method=payment_method
564570
)
565571

566-
# handler for Stripe event payment_intent.succeeded
567572
def payment_intent_succeeded(self, payment_intent: stripe.PaymentIntent) -> None:
568573
"""
569-
Stripe payment intent is used for the initial checkout session
574+
Stripe payment intent is used for the initial checkout session.
575+
Success is emitted when the payment intent goes to a success state.
570576
"""
571577
log.info(
572578
"Payment intent succeeded",
@@ -579,7 +585,6 @@ def payment_intent_succeeded(self, payment_intent: stripe.PaymentIntent) -> None
579585
payment_intent.customer, payment_intent.payment_method
580586
)
581587

582-
# handler for Stripe event setup_intent.succeeded
583588
def setup_intent_succeeded(self, setup_intent: stripe.SetupIntent) -> None:
584589
"""
585590
Stripe setup intent is used for subsequent edits to payment methods.

0 commit comments

Comments
 (0)