Discuss PayPal Express strategy

What is the need / problem

It would be great move away from customisation of the checkout_flow. The :confirm step customisation of the checkout flow is related to the current implementation of PayPal (Express) and will be the last remaining customisation of the checkout flow after the upgrade to Spree 2.0.0 is complete.

Who does it impact

Mostly developers, but potential solutions could impact any users who use the current implementation of PayPal (Express).

What is the current impact of this problem

Customisation of Spree’s checkout_flow makes it more difficult for developers to understand and follow the checkout process, which adds friction to the developments of features around this process. There is no impact of functionality of the platform.

What is the benefit in focusing on this

  • Happy developers
  • Less modification of Spree :thumbsup:

Potential solutions that will solve this problem

  • [Needs investigation] it may be possible to simply remove the :confirm step customisation, as it was added before the addition of the :restart event (commit here). Restarting the state machine (as we now do) should fix the issue that necessitated the removal of the confirm step in the first instance: that it was possible for an order with failed PayPal payment to get “stuck” in the :confirm step, because the CheckoutController is only redirecting to PayPal from the :payment step.
  • Remove support for PayPal (Express). If PayPal is something that we decide we need to support long term, we could maybe add a modern PayPal integration (ie. Checkout.js) instead.

I’d like to investigate @oeoeaio’s first proposal as that would be a great improvement. AFAIK that would mean just having a tiny customization on top of the checkout flow! It’d be reduced to:

state_machine.after_transition to: :payment, do: :charge_shipping_and_payment_fees!

state_machine.event :restart_checkout do                                      
  transition to: :cart, unless: :completed?                                   
end

Then, we the clear picture we can decided if it’s worth doing so in the ugprade. What do you guys think @maikel @Matt-Yorkley @luisramos0 @Hugs?

As we’ve done so far, I would not remove any feature from OFN due to the upgrade. The 2nd proposal is something can be investigated afterwards, IMO.

I moved the paypal integration upgrade and validation into the non-core epic a few weeks ago: https://github.com/openfoodfoundation/openfoodnetwork/issues/2225

Is the restart_checkout only used for paypal integration? If that is the case I’d move this into spree upgrade phase 2.

anyway, I think it’s definitely worth trying to remove this customization!

Is the restart_checkout only used for paypal integration? If that is the case I’d move this into spree upgrade phase 2.

Sounds good :+1:

We already changed our customisation of the checkout flow to just remove the confirm step instead of overriding the whole flow. If I understand it correctly, we are just discussing the removal of this line now:

remove_checkout_step :confirm

It would be nice to remove, but I don’t see why that is a big problem/priority at the moment.

Yes, it’s removing this line.

It would be nice to remove, but I don’t see why that is a big problem/priority at the moment.

To me, it’s more about sticking to Spree as much as possible so we avoid missing logic we’re not aware of and remove some of the confusion that is always around the checkout.

In any case, the suggestion is to tackle it in phase 2, so nothing to worry about now. We’ll see; things might have changed by then.