Cleaned up a couple SubscribeModal things

This commit is contained in:
Nick Winter 2016-01-12 12:34:10 -08:00
parent 63d643ac13
commit 7aff24b3a6
2 changed files with 3 additions and 4 deletions

View file

@ -7,7 +7,6 @@ if StripeCheckout?
email: me.get('email')
image: "https://codecombat.com/images/pages/base/logo_square_250.png"
token: (token) ->
console.log 'trigger?', handler.trigger
handler.trigger 'received-token', { token: token }
Backbone.Mediator.publish 'stripe:received-token', { token: token }
locale: 'auto'
@ -15,4 +14,4 @@ if StripeCheckout?
else
module.exports = {}
console.error "Failure loading StripeCheckout API, returning empty object."
_.extend(handler, Backbone.Events)
_.extend(handler, Backbone.Events)

View file

@ -201,13 +201,13 @@ module.exports = class SubscribeModal extends ModalView
@state = 'unknown_error'
@stateMessage = "Uknown problem occurred while processing Stripe request"
onSubscriptionSuccess: =>
onSubscriptionSuccess: ->
application.tracker?.trackEvent 'Finished subscription purchase', value: @purchasedAmount
Backbone.Mediator.publish 'subscribe-modal:subscribed', {}
@playSound 'victory'
@hide()
onSubscriptionError: (user, response, options) =>
onSubscriptionError: (user, response, options) ->
console.error 'We got an error subscribing with Stripe from our server:', response
application.tracker?.trackEvent 'Failed to finish subscription purchase', status: options.xhr?.status, value: @purchasedAmount
stripe = me.get('stripe') ? {}