From 234cb9af5f11953f93910e79143fcb842e924248 Mon Sep 17 00:00:00 2001 From: claucece Date: Wed, 16 Sep 2015 00:13:01 -0500 Subject: added payment_info, _customer_form, sucess instances --- engines/billing/app/controllers/payments_controller.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'engines/billing/app/controllers') diff --git a/engines/billing/app/controllers/payments_controller.rb b/engines/billing/app/controllers/payments_controller.rb index ece967b..7c2b2d3 100644 --- a/engines/billing/app/controllers/payments_controller.rb +++ b/engines/billing/app/controllers/payments_controller.rb @@ -6,11 +6,16 @@ class PaymentsController < BillingBaseController end def confirm - result = Braintree::Transaction.sale( + @result = Braintree::Transaction.sale( amount: params[:amount], - payment_method_nonce: params[:payment_method_nonce] + payment_method_nonce: params[:payment_method_nonce], ) - redirect_to action: :new, flash: { success: "done" } + if @result.success? == true + redirect_to action: :new, notice: "Congraulations! Your transaction has been successfully!" + else + flash[:alert] = "Something went wrong while processing your donation. Please try again!" + redirect_to action: :new + end end def index -- cgit v1.2.3