Make Stripe configurable

This commit is contained in:
2022-10-13 18:20:30 +01:00
parent e631811090
commit 1bf938c33e
6 changed files with 100 additions and 6 deletions

View File

@@ -1,9 +1,10 @@
import logging
import stripe
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.conf import settings
from core.lib.customers import get_or_create, update_customer_fields
logger = logging.getLogger(__name__)
@@ -37,7 +38,9 @@ class User(AbstractUser):
"""
if settings.STRIPE_ENABLED:
if not self.stripe_id: # stripe ID not stored
self.stripe_id = get_or_create(self.email, self.first_name, self.last_name)
self.stripe_id = get_or_create(
self.email, self.first_name, self.last_name
)
to_update = {}
if self.email != self._original.email: