From 58d10fac842258e586b0a04dd6c43209af71c442 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 27 Mar 2018 11:55:56 +0200 Subject: [PATCH] Stripe Connect error handling --- src/pretix/plugins/stripe/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pretix/plugins/stripe/views.py b/src/pretix/plugins/stripe/views.py index 3e2cfdb2bc..00d02a3f8c 100644 --- a/src/pretix/plugins/stripe/views.py +++ b/src/pretix/plugins/stripe/views.py @@ -83,7 +83,7 @@ def oauth_return(request, *args, **kwargs): logger.exception('Failed to obtain OAuth token') messages.error(request, _('An error occured during connecting with Stripe, please try again.')) else: - if data['livemode']: + if 'error' not in data and data['livemode']: try: testresp = requests.post('https://connect.stripe.com/oauth/token', data={ 'grant_type': 'refresh_token', @@ -111,7 +111,8 @@ def oauth_return(request, *args, **kwargs): # event.settings.payment_stripe_connect_access_token = data['access_token'] we don't need it, right? event.settings.payment_stripe_connect_refresh_token = data['refresh_token'] event.settings.payment_stripe_connect_user_id = data['stripe_user_id'] - event.settings.payment_stripe_connect_user_name = account['business_name'] + if account.get('business_name'): + event.settings.payment_stripe_connect_user_name = account['business_name'] if data['livemode']: event.settings.payment_stripe_publishable_test_key = testdata['stripe_publishable_key']