output multiple messages
This commit is contained in:
parent
690ee1d25b
commit
1b3a104445
|
@ -9,19 +9,22 @@ module DiscourseDonations
|
|||
def create
|
||||
output = { 'messages' => [], 'rewards' => [] }
|
||||
|
||||
if create_account && (email.nil? || email.empty?)
|
||||
if create_account
|
||||
if (email.nil? || email.empty?)
|
||||
output['messages'] << 'Please enter your email address'
|
||||
elsif create_account && params[:username].nil?
|
||||
end
|
||||
if params[:username].nil?
|
||||
output['messages'] << 'Please enter a username'
|
||||
else
|
||||
end
|
||||
end
|
||||
|
||||
if output['messages'].present?
|
||||
render(:json => output) and return
|
||||
end
|
||||
|
||||
payment = DiscourseDonations::Stripe.new(secret_key, stripe_options)
|
||||
charge = payment.charge(email, params)
|
||||
output['messages'] = [charge['outcome']['seller_message']]
|
||||
end
|
||||
|
||||
if payment.nil?
|
||||
render(:json => output) and return
|
||||
end
|
||||
|
||||
if reward?(payment)
|
||||
if current_user.present?
|
||||
|
|
Loading…
Reference in New Issue