Add comments and clean up Lago customers
This commit is contained in:
@@ -106,6 +106,9 @@ class User(AbstractUser):
|
||||
if self.stripe_id:
|
||||
stripe.Customer.delete(self.stripe_id)
|
||||
log.info(f"Deleted Stripe customer {self.stripe_id}")
|
||||
if self.billing_provider_id:
|
||||
billing.delete_customer(self)
|
||||
log.info(f"Deleted Billing customer {self.billing_provider_id}")
|
||||
super().delete(*args, **kwargs)
|
||||
|
||||
# Override save to update attributes in Lago
|
||||
@@ -118,9 +121,8 @@ class User(AbstractUser):
|
||||
self.stripe_id = billing.get_or_create(
|
||||
self.email, self.first_name, self.last_name
|
||||
)
|
||||
|
||||
billing_id = billing.create_or_update_customer(self)
|
||||
self.billing_provider_id = billing_id
|
||||
if not self.billing_provider_id:
|
||||
self.billing_provider_id = billing.create_or_update_customer(self)
|
||||
|
||||
billing.update_customer_fields(self)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user