Skip to content

Commit

Permalink
Temporary commit for handling save and continue integration until a p…
Browse files Browse the repository at this point in the history
…roper post hook is put in place.

spree-contrib#32 has the details.
Signed-off-by: Nathan Lowrie <nate@finelineautomation.com>
  • Loading branch information
FineLineAutomation committed Mar 11, 2014
1 parent 8b518b5 commit e2c39f4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/controllers/spree/checkout_controller_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Spree
CheckoutController.class_eval do
before_filter :redirect_to_paypal_express_form_if_needed, :only => [:update]

private
def redirect_to_paypal_express_form_if_needed
binding.pry
return unless (params[:state] == "payment") && params[:order][:payments_attributes]

payment_method = PaymentMethod.find(params[:order][:payments_attributes].first[:payment_method_id])
if payment_method.kind_of?(Spree::Gateway::PayPalExpress)
redirect_to paypal_express_url(:payment_method_id => payment_method.id)
end
end
end
end

0 comments on commit e2c39f4

Please sign in to comment.