enable the transcation
This commit is contained in:
parent
7d72c1f9cd
commit
938983341a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue