mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
2nd HoC sub sale
This commit is contained in:
parent
2d7ac81221
commit
0c81942c71
3 changed files with 10 additions and 37 deletions
|
@ -151,18 +151,6 @@ 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,15 +28,12 @@ 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
|
||||||
# Testing alternate displayed subscription price of 1499
|
c.price = 3.99 # Sale
|
||||||
unless me.getSubscribePriceGroup() is 'control'
|
|
||||||
c.price = 14.99
|
|
||||||
else
|
|
||||||
c.price = @product.amount / 100
|
|
||||||
|
|
||||||
# A/B Testing alternate subscription copy
|
# A/B Testing alternate subscription copy
|
||||||
c.BTest = me.getSubscribeCopyGroup() is 'new'
|
c.BTest = me.getSubscribeCopyGroup() is 'new'
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
|
@ -45,8 +42,7 @@ module.exports = class SubscribeModal extends ModalView
|
||||||
popoverContent = "<p>" + $.i18n.t('subscribe.parents_blurb1') + "</p>"
|
popoverContent = "<p>" + $.i18n.t('subscribe.parents_blurb1') + "</p>"
|
||||||
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb2') + "</p>"
|
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb2') + "</p>"
|
||||||
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb3') + "</p>"
|
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb3') + "</p>"
|
||||||
unless me.getSubscribePriceGroup() is 'control'
|
popoverContent = popoverContent.replace /9[.,]99/g, '3.99' # Sale
|
||||||
popoverContent = popoverContent.replace /9[.,]99/g, '14.99'
|
|
||||||
window.popoverContent = popoverContent
|
window.popoverContent = popoverContent
|
||||||
@$el.find('#parents-info').popover(
|
@$el.find('#parents-info').popover(
|
||||||
animation: true
|
animation: true
|
||||||
|
@ -74,17 +70,11 @@ 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 = {
|
# NOTE: And, the popover content if necessary
|
||||||
# description: 'Monthly Subscription (HoC sale)'
|
options = {
|
||||||
# amount: 599
|
description: 'Monthly Subscription (HoC sale)'
|
||||||
# }
|
amount: 399
|
||||||
|
}
|
||||||
# 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_399' if not couponID
|
||||||
|
|
||||||
if subscription = customer.subscriptions?.data?[0]
|
if subscription = customer.subscriptions?.data?[0]
|
||||||
|
|
||||||
|
@ -117,11 +117,6 @@ 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 ?= {}
|
||||||
|
|
Loading…
Reference in a new issue