mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-25 21:43:47 -04:00
Set up stubs for future subscription sales.
This commit is contained in:
parent
9e9c0e6fee
commit
aac1aa379e
2 changed files with 17 additions and 2 deletions
|
@ -53,10 +53,20 @@ module.exports = class SubscribeModal extends ModalView
|
|||
return @openModalView new AuthModal() if me.get('anonymous')
|
||||
application.tracker?.trackEvent 'Started subscription purchase', {}
|
||||
application.tracker?.trackPageView "subscription/start-purchase", ['Google Analytics']
|
||||
stripeHandler.open({
|
||||
options = {
|
||||
description: $.i18n.t('subscribe.stripe_description')
|
||||
amount: @product.amount
|
||||
})
|
||||
}
|
||||
|
||||
# SALE LOGIC
|
||||
# overwrite amount with sale price
|
||||
# maybe also put in another description with details about how long it lasts, etc
|
||||
# options = {
|
||||
# description: 'Subscription. Half price for three months!'
|
||||
# amount: 499
|
||||
# }
|
||||
|
||||
stripeHandler.open(options)
|
||||
|
||||
onStripeReceivedToken: (e) ->
|
||||
@state = 'purchasing'
|
||||
|
|
|
@ -68,6 +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
|
||||
|
||||
if subscription = customer.subscriptions?.data?[0]
|
||||
|
||||
if subscription.cancel_at_period_end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue