renderjson:["Please confirm your password"],status::unprocessable_entity
end
end
# get /nonprofits/:nonprofit_id/bank_account/confirmation
defconfirmation
@nonprofit=Nonprofit.find(params[:nonprofit_id])
@bank_account=@nonprofit.bank_account
end
# post /nonprofits/:nonprofit_id/bank_account/confirmation
defconfirm
npo=current_nonprofit
ba=npo.bank_account
ifparams[:token]==ba.confirmation_token
ba.update_attribute(:pending_verification,false)
flash[:notice]="Your bank account is now confirmed!"
redirect_tononprofits_payouts_path(npo)
else
redirect_to(nonprofits_donations_path(npo),{:flash=>{:error=>"We could not confirm this bank account. Please follow the exact link provided in the confirmation email."}})
end
end
# get /nonprofits/:nonprofit_id/bank_account/cancellation
defcancellation
@nonprofit=Nonprofit.find(params[:nonprofit_id])
@bank_account=@nonprofit.bank_account
end
# post /nonprofits/:nonprofit_id/bank_account/cancel
defcancel
npo=current_nonprofit
ba=npo.bank_account
ifparams[:token]==ba.confirmation_token
ba.destroy
flash[:notice]="Your bank account has been removed."
redirect_tononprofits_donations_path(npo)
else
redirect_to(nonprofits_donations_path(npo),{:flash=>{:error=>"We could not remove this bank account. Please follow the exact link provided in the email."}})