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')
|
return @openModalView new AuthModal() if me.get('anonymous')
|
||||||
application.tracker?.trackEvent 'Started subscription purchase', {}
|
application.tracker?.trackEvent 'Started subscription purchase', {}
|
||||||
application.tracker?.trackPageView "subscription/start-purchase", ['Google Analytics']
|
application.tracker?.trackPageView "subscription/start-purchase", ['Google Analytics']
|
||||||
stripeHandler.open({
|
options = {
|
||||||
description: $.i18n.t('subscribe.stripe_description')
|
description: $.i18n.t('subscribe.stripe_description')
|
||||||
amount: @product.amount
|
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) ->
|
onStripeReceivedToken: (e) ->
|
||||||
@state = 'purchasing'
|
@state = 'purchasing'
|
||||||
|
|
|
@ -68,6 +68,11 @@ class SubscriptionHandler extends Handler
|
||||||
|
|
||||||
checkForExistingSubscription: (req, user, customer, done) ->
|
checkForExistingSubscription: (req, user, customer, done) ->
|
||||||
couponID = user.get('stripe')?.couponID
|
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 = customer.subscriptions?.data?[0]
|
||||||
|
|
||||||
if subscription.cancel_at_period_end
|
if subscription.cancel_at_period_end
|
||||||
|
|
Reference in a new issue