From a5c2fc71850b2f3ed16bd7bd89579e0fab60f176 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 23 Apr 2014 01:10:31 -0400 Subject: [PATCH] Add a display alert that shows when the trial period ends (if applicable). Also change the name of the Subscribe buttons to "Start Trial" when no existing subscription is found --- endpoints/api/subscribe.py | 6 +++++- static/directives/plan-manager.html | 13 ++++++++++++- static/js/app.js | 11 ++++++----- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/endpoints/api/subscribe.py b/endpoints/api/subscribe.py index 03d8a0b4c..9d3dcc00a 100644 --- a/endpoints/api/subscribe.py +++ b/endpoints/api/subscribe.py @@ -17,13 +17,17 @@ def carderror_response(exc): def subscription_view(stripe_subscription, used_repos): - return { + view = { 'currentPeriodStart': stripe_subscription.current_period_start, 'currentPeriodEnd': stripe_subscription.current_period_end, 'plan': stripe_subscription.plan.id, 'usedPrivateRepos': used_repos, + 'trialStart': stripe_subscription.trial_start, + 'trialEnd': stripe_subscription.trial_end } + return view + def subscribe(user, plan, token, require_business_plan): if not features.BILLING: diff --git a/static/directives/plan-manager.html b/static/directives/plan-manager.html index 5978043a7..da0975644 100644 --- a/static/directives/plan-manager.html +++ b/static/directives/plan-manager.html @@ -17,6 +17,11 @@ You are nearing the number of allowed private repositories. It might be time to think about upgrading your subscription to avoid future disruptions in your organization's service. + + +
+ Free trial until {{ parseDate(subscription.trialEnd) | date }} +
@@ -24,6 +29,11 @@ Repository Usage
+ +
+ Next billing period: {{ parseDate(subscription.currentPeriodEnd) | date }} +
+ @@ -57,7 +67,8 @@ ng-click="changeSubscription(plan.stripeId)"> Change - Subscribe + Start Trial + Subscribe