import json import itertools USER_PLANS = [ { 'title': 'Open Source', 'price': 0, 'privateRepos': 0, 'stripeId': 'free', 'audience': 'Share with the world', }, { 'title': 'Micro', 'price': 700, 'privateRepos': 5, 'stripeId': 'micro', 'audience': 'For smaller teams', }, { 'title': 'Basic', 'price': 1200, 'privateRepos': 10, 'stripeId': 'small', 'audience': 'For your basic team', }, { 'title': 'Medium', 'price': 2200, 'privateRepos': 20, 'stripeId': 'medium', 'audience': 'For medium teams', }, { 'title': 'Large', 'price': 5000, 'privateRepos': 50, 'stripeId': 'large', 'audience': 'For larger teams', }, ] BUSINESS_PLANS = [ { 'title': 'Open Source', 'price': 0, 'privateRepos': 0, 'stripeId': 'bus-free', 'audience': 'Committment to FOSS', }, { 'title': 'Skiff', 'price': 2500, 'privateRepos': 10, 'stripeId': 'bus-micro', 'audience': 'For startups', }, { 'title': 'Yacht', 'price': 5000, 'privateRepos': 20, 'stripeId': 'bus-small', 'audience': 'For small businesses', }, { 'title': 'Freighter', 'price': 10000, 'privateRepos': 50, 'stripeId': 'bus-medium', 'audience': 'For normal businesses', }, { 'title': 'Tanker', 'price': 20000, 'privateRepos': 125, 'stripeId': 'bus-large', 'audience': 'For large businesses', }, ] def get_plan(id): """ Returns the plan with the given ID or None if none. """ for plan in itertools.chain(USER_PLANS, BUSINESS_PLANS): if plan['stripeId'] == id: return plan return None