Sub price test

This commit is contained in:
Matt Lott 2014-12-10 16:05:51 -08:00
parent 02953d0e6c
commit d4cfaac7e5
3 changed files with 37 additions and 7 deletions
app
models
views/play/modal
server/payments

View file

@ -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

View file

@ -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

View file

@ -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 ?= {}