Skip to content

Commit

Permalink
Remove redundant transaction in customers.create
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeburden committed Sep 11, 2017
1 parent 8a47640 commit fb5977f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pinax/stripe/actions/customers.py
@@ -1,4 +1,4 @@
from django.db import IntegrityError, transaction
from django.db import IntegrityError
from django.utils import timezone
from django.utils.encoding import smart_str

Expand Down Expand Up @@ -54,11 +54,10 @@ def create(user, card=None, plan=settings.PINAX_STRIPE_DEFAULT_PLAN, charge_imme
trial_end=trial_end
)
try:
with transaction.atomic():
cus = models.Customer.objects.create(
user=user,
stripe_id=stripe_customer["id"]
)
cus = models.Customer.objects.create(
user=user,
stripe_id=stripe_customer["id"]
)
except IntegrityError:
# There is already a Customer object for this user
stripe.Customer.retrieve(stripe_customer["id"]).delete()
Expand Down

0 comments on commit fb5977f

Please sign in to comment.