Sylius / PayPalPlugin

Official integration with PayPal Commerce Platform
37 stars 56 forks source link

Payment from cart page fails, if "Skip shipping step if only one shipping method is available" is activated for channel #218

Open HVStechnik opened 3 years ago

HVStechnik commented 3 years ago

I tried to setup Paypal Commerce Checkout. It works well as a payment method in the checkout process. If the user clicks on the Paypal button on the payment page in the checkout process and proceeds with the payment via Paypal, the shipping and order confimation page is skipped and the user gets directly to the "thank you" page.

However, the direct Paypal payment button on the card page did not work. I figured out that calling "process-pay-pal-order" failed with the following error:

Uncaught PHP Exception SM\SMException: "Transition "select_shipping" cannot be applied on state "shipping_skipped" of object "App\Entity\Order\Order" with graph "sylius_order_checkout"" at /vendor/winzou/state-machine/src/SM/StateMachine/StateMachine.php line 112 {"exception":"[object] (SM\\SMException(code: 0): Transition \"select_shipping\" cannot be applied on state \"shipping_skipped\" of object \"App\\Entity\\Order\\Order\" with graph \"sylius_order_checkout\" at vendor/winzou/state-machine/src/SM/StateMachine/StateMachine.php:112)"}

The error occurs, if for the channel "Skip shipping step if only one shipping method is available" is activated. Once I deactivate the option in the channel config, the Paypal button on the cart page brings the user to the "checkout/complete" page, on which the order has to be confirmed. That works well. However, I think that the order should be confirmed directly (similar as for the Paypal button on the payment page in the checkout process).

Version: v1.2.2