mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -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
|
||||
|
||||
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
|
||||
|
|
|
@ -28,15 +28,12 @@ module.exports = class SubscribeModal extends ModalView
|
|||
c = super()
|
||||
c.state = @state
|
||||
c.stateMessage = @stateMessage
|
||||
|
||||
# Testing alternate displayed subscription price of 1499
|
||||
unless me.getSubscribePriceGroup() is 'control'
|
||||
c.price = 14.99
|
||||
else
|
||||
c.price = @product.amount / 100
|
||||
# c.price = @product.amount / 100
|
||||
c.price = 3.99 # Sale
|
||||
|
||||
# A/B Testing alternate subscription copy
|
||||
c.BTest = me.getSubscribeCopyGroup() is 'new'
|
||||
|
||||
return c
|
||||
|
||||
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_blurb2') + "</p>"
|
||||
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb3') + "</p>"
|
||||
unless me.getSubscribePriceGroup() is 'control'
|
||||
popoverContent = popoverContent.replace /9[.,]99/g, '14.99'
|
||||
popoverContent = popoverContent.replace /9[.,]99/g, '3.99' # Sale
|
||||
window.popoverContent = popoverContent
|
||||
@$el.find('#parents-info').popover(
|
||||
animation: true
|
||||
|
@ -74,17 +70,11 @@ 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
|
||||
# }
|
||||
|
||||
# Testing alternate displayed subscription price of 1499
|
||||
unless me.getSubscribePriceGroup() is 'control'
|
||||
options = {
|
||||
description: $.i18n.t('subscribe.stripe_description')
|
||||
amount: 1499
|
||||
}
|
||||
# NOTE: And, the popover content if necessary
|
||||
options = {
|
||||
description: 'Monthly Subscription (HoC sale)'
|
||||
amount: 399
|
||||
}
|
||||
|
||||
@purchasedAmount = options.amount
|
||||
|
||||
|
|
|
@ -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_399' if not couponID
|
||||
|
||||
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
|
||||
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 ?= {}
|
||||
|
|
Loading…
Reference in a new issue