From 04fa7f9c40908e40080c20379e8ae4928f2b9dca Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 31 Jan 2013 22:51:27 +0100 Subject: [PATCH] Fix: Do not redirect to paypal if there is an error on the Order model In case there is a validation issue with the Order we do not want to redirect to the paypal page. --- app/controllers/spree/checkout_controller_decorator.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index 112b6d3..bee8bcf 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -227,6 +227,10 @@ module Spree end load_order + if not @order.errors.empty? + render :edit and return + end + payment_method = Spree::PaymentMethod.find(params[:order][:payments_attributes].first[:payment_method_id]) if payment_method.kind_of?(Spree::BillingIntegration::PaypalExpress) || payment_method.kind_of?(Spree::BillingIntegration::PaypalExpressUk)