Stripe: more informative error message for unrecognized event types.

This commit is contained in:
Brian Simpson
2013-07-16 17:30:20 -04:00
committed by Chad Birch
parent ab980f1ad3
commit 9b037e0a8f

View File

@@ -709,7 +709,10 @@ class StripeController(GoldPaymentController):
event_dict = json.loads(request.body)
event = stripe.Event.construct_from(event_dict, g.STRIPE_SECRET_KEY)
status = event.type
if cls.event_type_mappings.get(status) == 'noop':
event_type = cls.event_type_mappings.get(status)
if not event_type:
raise ValueError('Stripe: unrecognized status %s' % status)
elif event_type == 'noop':
return status, None, None, None, None
charge = event.data.object