Closed knivets closed 6 years ago
Done
Apologies I did not caught this earlier. The pull request does not solve the issue #135. The pb is that when the following Stripe API is called with the same code
, Stripe will disconnect the account and return an error.
resp = requests.post('https://connect.stripe.com/oauth/token', params=data)
When resp.status_code != 200
we raise a stripe.error.AuthenticationError
.
In all likelihood, this should be a ProcessorError
otherwise we won't catch it in saas.views.BankAuthorizeView.get
. Alternatively BankAuthorizeView
even though using OAuth seems very Stripe-centric so maybe it should be moved to saas.backends.stripe_processor.views
and catch the currently raised stripe.error.AuthenticationError
.
As the exception is raised in connect_auth
, self.object.save()
is not called, hence the "cleared" processor keys are not saved.
You could put both self.object.save()
in a finally
statement. There might be subtle issues on the state of the processor keys vs. connected account on Stripe when an unexpected exception is raised. Still PR looks good.
I'm not sure if this is as simple as this. Let me know if I misunderstood the problem.