New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes an issue with duplicate gold subscriptions #4597

Merged
merged 1 commit into from Sep 5, 2018

Conversation

Projects
None yet
3 participants
@davidfischer
Contributor

davidfischer commented Aug 31, 2018

This PR fixes a bug that could result in a user having multiple gold subscriptions.

I am also going to go back through our gold subscriptions and find any users that have more than 1 subscription as that is likely an error.

Fixes #4595
Fixes #4503

@davidfischer davidfischer added the Bug label Aug 31, 2018

@davidfischer davidfischer requested review from agjohnson and rtfd/core Aug 31, 2018

subscription = subscriptions.data[0]
subscription.plan = self.cleaned_data['level']
if 'stripe_token' in self.cleaned_data:
if 'stripe_token' in self.cleaned_data and self.cleaned_data['stripe_token']:

This comment has been minimized.

@davidfischer

davidfischer Aug 31, 2018

Contributor

The error was on this line specifically. In the case where the user is swapping their credit card, the stripe_token is present and the API call succeeds and everything is good. In the case where the user is just changing plans, stripe_token is None, the API call fails and the except clause is taken which adds a new subscription.

Because of that possibility of just having a failed API call result in more subscriptions, I rewrote that part of this function.

@davidfischer

davidfischer Aug 31, 2018

Contributor

The error was on this line specifically. In the case where the user is swapping their credit card, the stripe_token is present and the API call succeeds and everything is good. In the case where the user is just changing plans, stripe_token is None, the API call fails and the except clause is taken which adds a new subscription.

Because of that possibility of just having a failed API call result in more subscriptions, I rewrote that part of this function.

@humitos

humitos approved these changes Sep 4, 2018

Changes look good to me.

@davidfischer

This comment has been minimized.

Show comment
Hide comment
@davidfischer

davidfischer Sep 5, 2018

Contributor

I am also going to go back through our gold subscriptions and find any users that have more than 1 subscription as that is likely an error.

I have cancelled all duplicate subscriptions and refunded Gold Members for the duplicate charges.

Contributor

davidfischer commented Sep 5, 2018

I am also going to go back through our gold subscriptions and find any users that have more than 1 subscription as that is likely an error.

I have cancelled all duplicate subscriptions and refunded Gold Members for the duplicate charges.

@agjohnson

Looks great!

@agjohnson agjohnson merged commit 181a964 into master Sep 5, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@agjohnson agjohnson deleted the davidfischer/fix-subscriptions-doubling branch Sep 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment