enable the transcation

This commit is contained in:
Rimian Perkins 2017-02-15 11:44:34 +11:00
parent 7d72c1f9cd
commit 938983341a
1 changed files with 19 additions and 19 deletions

View File

@ -9,25 +9,25 @@ module Choice
end
def create
# badge = Badge.find_by_name('Consumer Defender')
#
# if badge.nil?
# head 422 and return
# end
#
# customer = Stripe::Customer.create(
# :email => params[:stripeEmail],
# :source => params[:stripeToken]
# )
#
# charge = Stripe::Charge.create(
# :customer => customer.id,
# :amount => 1000,
# :description => 'Consumer Defender',
# :currency => 'aud'
# )
#
# BadgeGranter.grant(badge, current_user)
badge = Badge.find_by_name('Consumer Defender')
if badge.nil?
head 422 and return
end
customer = Stripe::Customer.create(
:email => params[:stripeEmail],
:source => params[:stripeToken]
)
charge = Stripe::Charge.create(
:customer => customer.id,
:amount => 1000,
:description => 'Consumer Defender',
:currency => 'aud'
)
BadgeGranter.grant(badge, current_user)
render :json => { status: 'OK' }
end