Some small fixes in the API.

This commit is contained in:
jakedt 2014-03-18 14:22:14 -04:00
parent 3b3d71bfd7
commit 7d163833bd
4 changed files with 8 additions and 2584 deletions

View file

@ -206,12 +206,18 @@ class UserPlan(ApiResource):
plan = request_data['plan']
token = request_data['token'] if 'token' in request_data else None
user = get_authenticated_user()
if not user:
raise Unauthorized()
return subscribe(user, plan, token, False) # Business features not required
@nickname('getUserSubscription')
def get(self):
""" Fetch any existing subscription for the user. """
user = get_authenticated_user()
if not user:
raise Unauthorized()
private_repos = model.get_private_repo_count(user.username)
if user.stripe_id: