Open Loocos opened 2 years ago
@Loocos Hi, I have made a fix proposal to https://github.com/3BRS/sylius-payment-restrictions-plugin/pull/4/commits/480f46e131cf210d6e98b19d82234698842355b6
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 https://github.com/3BRS/sylius-payment-restrictions-plugin/blob/05d9815f88adbaf86974adec54a5116b96873c21/src/Model/ThreeBRSSyliusResolvePaymentMethodForOrder.php#L34
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.