Created
August 13, 2015 02:41
-
-
Save Harrisonl/e7bfa3056adf36ebfc23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pay_by_card | |
# Get the credit card details submitted by the form | |
token = params[:stripeToken] | |
charge = charge_customer(@project, token) | |
if charge.successful? | |
create_payment(@project) | |
@project.update_attributes(paid: true) | |
@project.create_conversation_for_project | |
ProjectsMailer.inform_admin.deliver_later | |
session.delete(:signing_up_payment) | |
flash[:notice] = " Request Successfully added." | |
redirect_to dashboard_path | |
else | |
@payment = Payment.new | |
flash[:notice] = "An error occurred: #{charge.error_message}" | |
render :new_signup if session[:signing_up_payment] == true | |
render :new if session[:signing_up_payment] == nil | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment