Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert ShippingAddress failed #3

Open
Loocos opened this issue Jul 5, 2022 · 1 comment
Open

Assert ShippingAddress failed #3

Loocos opened this issue Jul 5, 2022 · 1 comment

Comments

@Loocos
Copy link

Loocos commented Jul 5, 2022

Hi!

Just tried your plugin and it seems to have an error when going from cart to checkout (address).
An exception has been thrown during the rendering of a template ("Warning: assert(): assert($shippingAddress instanceof AddressInterface) failed").
At first time, the shipping and billing address are null.

And I saw in your MangoSyliusResolvePaymentMethodForOrder class than you :
$shippingAddress = $order->getShippingAddress(); assert($shippingAddress instanceof AddressInterface);
But you doesn't check if it's null or not.

I would suggest to add this between this two lines :
if(is_null($shippingAddress)) return true;
Everything should be eligible until we got an address, am I wrong ?
I would like to have your confirmation. Can submit a PR if you're ok with that.

@jaroslavtyc
Copy link
Collaborator

jaroslavtyc commented May 16, 2023

@Loocos Hi, I have made a fix proposal to 480f46e

It does not follow your suggestion as it would change current behavior, just solve fatal.

To make a payment allowed for order without shipping address (How did you do that? Do you have some "license delivered by email" products ?), simply do not set any restrictive zone to it. In that case this will be triggered

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

No branches or pull requests

2 participants