mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
98 stars 49 forks source link

Undefined Property On Backend Order Create Page #743

Closed sprankhub closed 4 months ago

sprankhub commented 4 months ago

Describe the bug A clear and concise description of what the bug is.

Used versions

To Reproduce Steps to reproduce the behavior:

  1. Go to backend order create page
  2. Add product
  3. Refresh page
  4. See error

Expected behavior No error should be shown, backend order create page should be shown.

Actual behavior An error is shown:

1 exception(s):
Exception #0 (Exception): Warning: Undefined property: Mollie\Payment\Service\Mollie\Wrapper\MollieApiClientFallbackWrapper::$terminals in /var/www/html/vendor/mollie/magento2/Block/Form/Pointofsale.php on line 58

Exception #0 (Exception): Warning: Undefined property: Mollie\Payment\Service\Mollie\Wrapper\MollieApiClientFallbackWrapper::$terminals in /var/www/html/vendor/mollie/magento2/Block/Form/Pointofsale.php on line 58
<pre>#1 Mollie\Payment\Block\Form\Pointofsale->getTerminals() called at [vendor/mollie/magento2/view/adminhtml/templates/form/pointofsale.phtml:19]
#2 include('/var/www/html/ve...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:71]
#3 Magento\Framework\View\TemplateEngine\Php->render(&Mollie\Payment\Block\Form\Pointofsale#00000000000015ff0000000000000000#, '/var/www/html/ve...', array('secureRenderer' => &Magento\Framework\View\Helper\SecureHtmlRenderer\Proxy#000000000000171e0000000000000000#, 'escaper' => &Magento\Framework\Escaper#00000000000003e60000000000000000#, 'localeFormatter' => &Magento\Framework\Locale\LocaleFormatter#00000000000017200000000000000000#, 'viewModels' => &Hyva\Theme\Model\ViewModelRegistry#00000000000017160000000000000000#)) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#4 Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', array(&Mollie\Payment\Block\Form\Pointofsale#00000000000015ff0000000000000000#, '/var/www/html/ve...', array('viewModels' => &Hyva\Theme\Model\ViewModelRegistry#00000000000017160000000000000000#, 'escaper' => &Magento\Framework\Escaper#00000000000003e60000000000000000#))) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#5 Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}(&Mollie\Payment\Block\Form\Pointofsale#00000000000015ff0000000000000000#, '/var/www/html/ve...', array()) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#6 Magento\Framework\View\TemplateEngine\Php\Interceptor->___callPlugins('render', array(&Mollie\Payment\Block\Form\Pointofsale#00000000000015ff0000000000000000#, '/var/www/html/ve...', array()), array(array('php_template_eng...', 'Amasty_Base::Add...'))) called at [generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php:23]
[...]

Screenshots n/a

Additional context n/a

Frank-Magmodules commented 4 months ago

Goodmorning @sprankhub , Thank you for opening this issue. It sounds like your version of the mollie/mollie-api-php is a bit outdated. Can you try to run composer update mollie/mollie-api-php and see if the error persists? If not, we will lock a higher version of the library in the composer.json of the Magento extension.

sprankhub commented 4 months ago

Hey, @Frank-Magmodules, I checked the issue in the code and it should only relate to mollie/magento2 and should still be present.

Here, $mollieApiClient->terminals is referenced:

https://github.com/mollie/magento2/blob/ac30d841371b38ca4f68418a7e518f585666e22f/Block/Form/Pointofsale.php#L58

In MollieApiClient, this property is not defined:

https://github.com/mollie/magento2/blob/ac30d841371b38ca4f68418a7e518f585666e22f/Service/Mollie/MollieApiClient.php#L17-L45

Do I overlook something?

Frank-Magmodules commented 4 months ago

Hi Simon,

Thank you for your quick response. The naming might be a bit confusing, but there are actually 2 MollieApiClient classes: One in the Magento extension and one in the SDK. You are looking in the Magento extension, but the error is triggered from the SDK. If you look in the exception, you’ll see it’s triggered from MollieApiClientFallbackWrapper. When you inspect that class, you will see it extends from the SDK’s MollieApiClient: Mollie\Api\MollieApiClient. That’s why you need to update that library to fix this issue.

Next to that: You are running a few versions behind on the Magento plugin. It is always a good idea to update that too. ;-)

sprankhub commented 4 months ago

Hmm okay, the Pointofsale class explicitly references Mollie\Payment\Service\Mollie\MollieApiClient, but you might have some magic, which switches out the dependency. So all fine, if you are sure the issue is not present in the latest version, feel free to close this :)

Frank-Magmodules commented 4 months ago

Yes, we are sure about that, so we are closing this issue for now. Have a good week ahead @sprankhub !