Use the stripe publishable key for prod in prod. Track when a user signs up for a plan.
This commit is contained in:
parent
5a5ddf2c0e
commit
12e91022cc
2 changed files with 20 additions and 2 deletions
|
@ -36,6 +36,18 @@ quayApp = angular.module('quay', ['restangular', 'angularMoment', 'angulartics',
|
||||||
return userService;
|
return userService;
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
$provide.factory('KeyService', ['$location', function($location) {
|
||||||
|
var keyService = {}
|
||||||
|
|
||||||
|
if ($location.host() === 'quay.io') {
|
||||||
|
keyService['stripePublishableKey'] = 'pk_live_P5wLU0vGdHnZGyKnXlFG4oiu';
|
||||||
|
} else {
|
||||||
|
keyService['stripePublishableKey'] = 'pk_test_uEDHANKm9CHCvVa2DLcipGRh';
|
||||||
|
}
|
||||||
|
|
||||||
|
return keyService;
|
||||||
|
}]);
|
||||||
|
|
||||||
$provide.factory('PlanService', [function() {
|
$provide.factory('PlanService', [function() {
|
||||||
var plans = [
|
var plans = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -449,7 +449,7 @@ function RepoAdminCtrl($scope, Restangular, $routeParams, $rootScope) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function UserAdminCtrl($scope, Restangular, PlanService, $routeParams) {
|
function UserAdminCtrl($scope, Restangular, PlanService, KeyService, $routeParams) {
|
||||||
$scope.plans = PlanService.planList();
|
$scope.plans = PlanService.planList();
|
||||||
|
|
||||||
var subscribedToPlan = function(sub) {
|
var subscribedToPlan = function(sub) {
|
||||||
|
@ -463,6 +463,10 @@ function UserAdminCtrl($scope, Restangular, PlanService, $routeParams) {
|
||||||
|
|
||||||
$scope.planLoading = false;
|
$scope.planLoading = false;
|
||||||
$scope.planChanging = false;
|
$scope.planChanging = false;
|
||||||
|
|
||||||
|
mixpanel.people.set({
|
||||||
|
'plan': sub.plan
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.planLoading = true;
|
$scope.planLoading = true;
|
||||||
|
@ -476,6 +480,8 @@ function UserAdminCtrl($scope, Restangular, PlanService, $routeParams) {
|
||||||
$scope.subscribe = function(planId) {
|
$scope.subscribe = function(planId) {
|
||||||
var submitToken = function(token) {
|
var submitToken = function(token) {
|
||||||
$scope.$apply(function() {
|
$scope.$apply(function() {
|
||||||
|
mixpanel.track('plan_subscribe');
|
||||||
|
|
||||||
$scope.planChanging = true;
|
$scope.planChanging = true;
|
||||||
$scope.errorMessage = undefined;
|
$scope.errorMessage = undefined;
|
||||||
|
|
||||||
|
@ -494,7 +500,7 @@ function UserAdminCtrl($scope, Restangular, PlanService, $routeParams) {
|
||||||
|
|
||||||
var planDetails = PlanService.getPlan(planId)
|
var planDetails = PlanService.getPlan(planId)
|
||||||
StripeCheckout.open({
|
StripeCheckout.open({
|
||||||
key: 'pk_test_uEDHANKm9CHCvVa2DLcipGRh',
|
key: KeyService.stripePublishableKey,
|
||||||
address: false, // TODO change to true
|
address: false, // TODO change to true
|
||||||
amount: planDetails.price,
|
amount: planDetails.price,
|
||||||
currency: 'usd',
|
currency: 'usd',
|
||||||
|
|
Reference in a new issue