HoC sale.

This commit is contained in:
Nick Winter 2014-12-09 06:06:14 -08:00
parent 5365a9fdf1
commit a97baa2207
3 changed files with 14 additions and 11 deletions

View file

@ -29,7 +29,7 @@ elementAcceptsKeystrokes = (el) ->
# not radio, checkbox, range, or color
return (tag is 'textarea' or (tag is 'input' and type in textInputTypes) or el.contentEditable in ['', 'true']) and not (el.readOnly or el.disabled)
COMMON_FILES = ['/images/pages/base/modal_background.png', '/images/level/code_palette_wood_background.png', '/images/level/popover_background.png', '/images/level/code_editor_background.png']
COMMON_FILES = ['/images/pages/base/modal_background.png', '/images/level/popover_background.png'] #'/images/level/code_palette_wood_background.png', , '/images/level/code_editor_background.png'
preload = (arrayOfImages) ->
$(arrayOfImages).each ->
$('<img/>')[0].src = @

View file

@ -28,7 +28,8 @@ module.exports = class SubscribeModal extends ModalView
c = super()
c.state = @state
c.stateMessage = @stateMessage
c.price = @product.amount / 100
#c.price = @product.amount / 100
c.price = 5.99 # Sale
c.BTest = me.getSubscribeCopyGroup() is 'new'
return c
@ -38,6 +39,8 @@ 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>"
popoverContent = popoverContent.replace /9[.,]99/g, '5.99' # Sale
window.popoverContent = popoverContent
@$el.find('#parents-info').popover(
animation: true
html: true
@ -64,10 +67,10 @@ 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: 'Subscription. Half price for three months!'
# amount: 499
# }
options = {
description: 'Monthly Subscription (HoC sale)'
amount: 599
}
stripeHandler.open(options)

View file

@ -32,7 +32,7 @@ class SubscriptionHandler extends Handler
@logSubscriptionError(user, 'Cannot find customer: ', +customer.id + '\n\n' + err)
return done({res: 'Cannot find customer.', code: 404})
@checkForExistingSubscription(req, user, customer, done)
else
newCustomer = {
card: token
@ -47,7 +47,7 @@ class SubscriptionHandler extends Handler
else
@logSubscriptionError(user, 'Stripe customer creation error. '+err)
return done({res: 'Database error.', code: 500})
stripeInfo = _.cloneDeep(user.get('stripe') ? {})
stripeInfo.customerID = customer.id
user.set('stripe', stripeInfo)
@ -68,11 +68,11 @@ class SubscriptionHandler extends Handler
checkForExistingSubscription: (req, user, customer, done) ->
couponID = user.get('stripe')?.couponID
# SALE LOGIC
# overwrite couponID with another for everyone-sales
# couponID = 'hoc_bonanza' if not couponID
couponID = 'hoc_599' if not couponID
if subscription = customer.subscriptions?.data?[0]
if subscription.cancel_at_period_end