Skip to content
This repository has been archived by the owner on Nov 29, 2019. It is now read-only.

Unable to configure Checkout from Cart #140

Open
francisli opened this issue Apr 17, 2013 · 0 comments
Open

Unable to configure Checkout from Cart #140

francisli opened this issue Apr 17, 2013 · 0 comments

Comments

@francisli
Copy link

Hello, I apologize for opening an issue for this, but I'm not sure where else to go to work out how to fully configure PayPal Express Checkout to be able to Checkout from Cart.

Here's what I have so far:

  • A fresh Rails 3.2.13 app with Spree and the PayPal Express Checkout extension from the 1-3-stable branch. Here are the relevant Gemfile lines:

gem 'spree', :github => 'spree/spree', :branch => '1-3-stable'
gem 'spree_gateway', :github => 'spree/spree_gateway', :branch => '1-3-stable'
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => '1-3-stable'
gem 'spree_paypal_express', :git => 'git://github.com/spree/spree_paypal_express.git', :branch => '1-3-stable'

  • I've configured the PayPal Express Checkout piece in Payment Methods, including putting in my PayPal Sandbox user and API credentials.
  • Based on what I've read from some other issues here, I've created an override to add a PayPal Checkout link directly on the cart page:

Deface::Override.new(:virtual_path => "spree/orders/edit",
:insert_before => "[data-hook='cart_buttons']",
:text => "<%= link_to t(:paypal), paypal_payment_order_checkout_url(@order, :payment_method_id => @order.available_payment_methods.detect{ |method| method.type == 'Spree::BillingIntegration::PaypalExpress' }.id), :class => 'paypal-cart' %>",
:name => "checkout_from_cart")

  • So far, so good- I spin up the server, add a product to the cart, and click on my inserted PayPal link on the cart page. It redirects me to the Sign in/Guest Checkout page. I presume this is due to the registration requirement introduced with spree_auth_devise, so I modify my spree.rb initializer to disable the registration requirement:

Spree::Auth::Config[:registration_step] = false

  • I restart the server, and try again clicking on my inserted PayPal link on the cart page after adding a product. Now, I'm redirected to step 1 of the checkout flow, the Addresses page.

  • Looking through both the Spree and the Spree PayPal Express code, it seems to me that all the before_filters in the Spree CheckoutController are handling the request and redirecting based on the state of the order object, so that it never even reaches the paypal_payment controller action:

    before_filter :load_order
    before_filter :ensure_valid_state
    before_filter :associate_user
    before_filter :check_authorization

  • Should these be executing before the PayPal related actions defined in the extension's checkout controller decorator? I assume no, since the first line of each action is "load_order", which would be unnecessary if that were the case. If that's true, shouldn't there be a bunch of skip_before_filter declarations?

  • Before I start messing around with the code myself, I'm just wondering if I'm on the right track, or if I'm missing something completely, or is this simply an incomplete implementation in the extension right now?

Thanks for any assistance...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant