Skip to content

Instantly share code, notes, and snippets.

@afuggini
Created July 4, 2014 21:07
Show Gist options
  • Save afuggini/e838d2051149c78ab0be to your computer and use it in GitHub Desktop.
Save afuggini/e838d2051149c78ab0be to your computer and use it in GitHub Desktop.
@CallbackController = RouteController.extend(
fastRender: true
onBeforeAction: (pause) ->
p = @params
run = false
switch p.key
when "stripe"
u = Meteor.user()
if u?
r = Roles.userIsInRole(u._id, 'stripe-connected')
if p.code and p.state and not r and not run
Meteor.call('saveStripeToken', p.code, (e, r)->
if e
App.debug e
else
Router.go(p.state)
Meteor.setTimeout(()->
App.alert.success 'Your Stripe account has been successfully connected', 7000
App.debug p
,500)
)
run = true
pause()
return
Router.go 'homepage'
return
action: ()->
@render 'NotFound'
return
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment