diff --git a/app/models/User.coffee b/app/models/User.coffee index ea4b5c3d0..2907d203a 100644 --- a/app/models/User.coffee +++ b/app/models/User.coffee @@ -151,6 +151,18 @@ module.exports = class User extends CocoModel @subscribeCopyGroup = 'original' @subscribeCopyGroup + getSubscribePriceGroup: -> + # Testing alternate displayed subscription price of 1499 + # NOTE: This grouping logic lives in server/payments/subscription_handler.coffee too. + return @subscribePriceGroup if @subscribePriceGroup + testStartTime = new Date("2014-12-11T01:00:00.000Z") # 12/10/14 5pm PST time + if new Date(me.get('dateCreated')) >= testStartTime + @subscribePriceGroup = '1499' + application.tracker.identify subscribePriceGroup: @subscribePriceGroup + else + @subscribePriceGroup = 'control' + @subscribePriceGroup + isPremium: -> return false unless stripe = @get('stripe') return true if stripe.subscriptionID diff --git a/app/views/play/modal/SubscribeModal.coffee b/app/views/play/modal/SubscribeModal.coffee index e2c6027e4..600ae42e4 100644 --- a/app/views/play/modal/SubscribeModal.coffee +++ b/app/views/play/modal/SubscribeModal.coffee @@ -28,8 +28,14 @@ module.exports = class SubscribeModal extends ModalView c = super() c.state = @state c.stateMessage = @stateMessage - #c.price = @product.amount / 100 - c.price = 5.99 # Sale + + # Testing alternate displayed subscription price of 1499 + unless me.getSubscribePriceGroup() is 'control' + c.price = 14.99 + else + c.price = @product.amount / 100 + + # A/B Testing alternate subscription copy c.BTest = me.getSubscribeCopyGroup() is 'new' return c @@ -67,10 +73,17 @@ module.exports = class SubscribeModal extends ModalView # overwrite amount with sale price # maybe also put in another description with details about how long it lasts, etc # NOTE: Do not change this price without updating the context.price in getRenderData - options = { - description: 'Monthly Subscription (HoC sale)' - amount: 599 - } + # options = { + # description: 'Monthly Subscription (HoC sale)' + # amount: 599 + # } + + # Testing alternate displayed subscription price of 1499 + unless me.getSubscribePriceGroup() is 'control' + options = { + description: $.i18n.t('subscribe.stripe_description') + amount: 1499 + } @purchasedAmount = options.amount diff --git a/server/payments/subscription_handler.coffee b/server/payments/subscription_handler.coffee index f21b657ff..0289440f6 100644 --- a/server/payments/subscription_handler.coffee +++ b/server/payments/subscription_handler.coffee @@ -71,7 +71,7 @@ class SubscriptionHandler extends Handler # SALE LOGIC # overwrite couponID with another for everyone-sales - couponID = 'hoc_599' if not couponID + # couponID = 'hoc_599' if not couponID if subscription = customer.subscriptions?.data?[0] @@ -117,6 +117,11 @@ class SubscriptionHandler extends Handler req.body.stripe = stripeInfo # to make sure things work for admins, who are mad with power user.set('stripe', stripeInfo) + # Testing alternate displayed subscription price of 1499 + testStartTime = new Date("2014-12-11T01:00:00.000Z") + if new Date(user.get('dateCreated')) >= testStartTime + stripe.customers.updateSubscription stripeInfo.customerID, stripeInfo.subscriptionID, {metadata: {priceTest: '1499'}} + if increment purchased = _.clone(user.get('purchased')) purchased ?= {}