Subscriptions: avoid double deletion
Subscription is set to cascade delete
when an organization is deleted,
with this additional signal
we are cancelling the subscription twice,
and stripe is given an error.
@@ -70,22 +70,3 @@ def update_stripe_customer(sender, instance, created, **kwargs):
log.exception("Unable to update stripe customer.")
except Exception:
log.exception("Unknown error when updating stripe customer.")
-
-
-# pylint: disable=unused-argument
-@receiver(pre_delete, sender=Organization)
-def remove_subscription(sender, instance, using, **kwargs):
- """
- Deletes the subscription object and cancels it from Stripe.
-
- This is used as complement to ``remove_organization_completely``.
- """
- organization = instance
- try:
- subscription = organization.subscription
- subscription.delete()
- except Subscription.DoesNotExist:
- log.error(
- "Organization doesn't have a subscription to cancel.",
- organization_slug=organization.slug,
- )
