Sub price test
This commit is contained in:
parent
02953d0e6c
commit
d4cfaac7e5
3 changed files with 37 additions and 7 deletions
|
@ -151,6 +151,18 @@ module.exports = class User extends CocoModel
|
||||||
@subscribeCopyGroup = 'original'
|
@subscribeCopyGroup = 'original'
|
||||||
@subscribeCopyGroup
|
@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: ->
|
isPremium: ->
|
||||||
return false unless stripe = @get('stripe')
|
return false unless stripe = @get('stripe')
|
||||||
return true if stripe.subscriptionID
|
return true if stripe.subscriptionID
|
||||||
|
|
|
@ -28,8 +28,14 @@ module.exports = class SubscribeModal extends ModalView
|
||||||
c = super()
|
c = super()
|
||||||
c.state = @state
|
c.state = @state
|
||||||
c.stateMessage = @stateMessage
|
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'
|
c.BTest = me.getSubscribeCopyGroup() is 'new'
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
@ -67,10 +73,17 @@ module.exports = class SubscribeModal extends ModalView
|
||||||
# overwrite amount with sale price
|
# overwrite amount with sale price
|
||||||
# maybe also put in another description with details about how long it lasts, etc
|
# 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
|
# NOTE: Do not change this price without updating the context.price in getRenderData
|
||||||
options = {
|
# options = {
|
||||||
description: 'Monthly Subscription (HoC sale)'
|
# description: 'Monthly Subscription (HoC sale)'
|
||||||
amount: 599
|
# 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
|
@purchasedAmount = options.amount
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class SubscriptionHandler extends Handler
|
||||||
|
|
||||||
# SALE LOGIC
|
# SALE LOGIC
|
||||||
# overwrite couponID with another for everyone-sales
|
# 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]
|
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
|
req.body.stripe = stripeInfo # to make sure things work for admins, who are mad with power
|
||||||
user.set('stripe', stripeInfo)
|
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
|
if increment
|
||||||
purchased = _.clone(user.get('purchased'))
|
purchased = _.clone(user.get('purchased'))
|
||||||
purchased ?= {}
|
purchased ?= {}
|
||||||
|
|
Reference in a new issue