Ingenico-ePayments / connect-extension-magento2

Ingenico Connect based Shopping Cart Extension for Magento 2.x
https://epayments.developer-ingenico.com/documentation/ecommerce-extensions/magento-2/
MIT License
4 stars 4 forks source link

Invalid template file: '/var/www/html/vendor/composer/../ingenico-epayments Magento 2.4.5-p2 #28

Closed sergiuec closed 1 year ago

sergiuec commented 1 year ago

Hello, after upgrading to the version 3.0.0 from 2.7.1 in backend (Stores -> Configuration -> Sales - > Payment Methods) this exception is thrown:

`1 exception(s): Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: '/var/www/html/vendor/composer/../ingenico-epayments/connect-extension-magento2/view/adminhtml/templates/system/config/test_api_connection.phtml' in module: 'Worldline_Connect' block's name: 'adminhtml\system\config\field\testapiconnectionsandbox_0'

Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: '/var/www/html/vendor/composer/../ingenico-epayments/connect-extension-magento2/view/adminhtml/templates/system/config/test_api_connection.phtml' in module: 'Worldline_Connect' block's name: 'adminhtml\system\config\field\testapiconnectionsandbox_0'

#1 Worldline\Connect\Block\Adminhtml\System\Config\Field\TestApiConnectionSandbox\Interceptor->fetchView() called at [vendor/magento/framework/View/Element/Template.php:293]
#2 Magento\Framework\View\Element\Template->_toHtml() called at [vendor/magento/module-backend/Block/Template.php:141]
#3 Magento\Backend\Block\Template->_toHtml() called at [vendor/ingenico-epayments/connect-extension-magento2/Block/Adminhtml/System/Config/Field/TestApiConnection.php:27]
#4 Worldline\Connect\Block\Adminhtml\System\Config\Field\TestApiConnection->_getElementHtml() called at [vendor/magento/module-config/Block/System/Config/Form/Field.php:104]
#5 Magento\Config\Block\System\Config\Form\Field->_renderValue() called at [vendor/magento/module-config/Block/System/Config/Form/Field.php:78]
#6 Magento\Config\Block\System\Config\Form\Field->render() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#7 Worldline\Connect\Block\Adminhtml\System\Config\Field\TestApiConnectionSandbox\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#8 Worldline\Connect\Block\Adminhtml\System\Config\Field\TestApiConnectionSandbox\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#9 Worldline\Connect\Block\Adminhtml\System\Config\Field\TestApiConnectionSandbox\Interceptor->___callPlugins() called at [generated/code/Worldline/Connect/Block/Adminhtml/System/Config/Field/TestApiConnectionSandbox/Interceptor.php:50]
#10 Worldline\Connect\Block\Adminhtml\System\Config\Field\TestApiConnectionSandbox\Interceptor->render() called at [vendor/magento/framework/Data/Form/Element/AbstractElement.php:541]
#11 Magento\Framework\Data\Form\Element\AbstractElement->getHtml() called at [vendor/magento/framework/Data/Form/Element/AbstractElement.php:555]
#12 Magento\Framework\Data\Form\Element\AbstractElement->toHtml() called at [vendor/magento/module-config/Block/System/Config/Form/Fieldset.php:98]
#13 Magento\Config\Block\System\Config\Form\Fieldset->_getChildrenElementsHtml() called at [vendor/magento/module-config/Block/System/Config/Form/Fieldset.php:76]
#14 Magento\Config\Block\System\Config\Form\Fieldset->render() called at [vendor/magento/framework/Data/Form/Element/AbstractElement.php:541]
#15 Magento\Framework\Data\Form\Element\AbstractElement->getHtml() called at [generated/code/Magento/Framework/Data/Form/Element/Fieldset/Interceptor.php:338]
#16 Magento\Framework\Data\Form\Element\Fieldset\Interceptor->getHtml() called at [vendor/magento/framework/Data/Form/Element/AbstractElement.php:555]
#17 Magento\Framework\Data\Form\Element\AbstractElement->toHtml() called at [generated/code/Magento/Framework/Data/Form/Element/Fieldset/Interceptor.php:347]
#18 Magento\Framework\Data\Form\Element\Fieldset\Interceptor->toHtml() called at [vendor/magento/module-config/Block/System/Config/Form/Fieldset.php:96]
#19 Magento\Config\Block\System\Config\Form\Fieldset->_getChildrenElementsHtml() called at [vendor/magento/module-config/Block/System/Config/Form/Fieldset.php:76]
#20 Magento\Config\Block\System\Config\Form\Fieldset->render() called at [vendor/magento/framework/Data/Form/Element/AbstractElement.php:541]
#21 Magento\Framework\Data\Form\Element\AbstractElement->getHtml() called at [generated/code/Magento/Framework/Data/Form/Element/Fieldset/Interceptor.php:338]
#22 Magento\Framework\Data\Form\Element\Fieldset\Interceptor->getHtml() called at [vendor/magento/framework/Data/Form/Element/AbstractElement.php:555]
#23 Magento\Framework\Data\Form\Element\AbstractElement->toHtml() called at [generated/code/Magento/Framework/Data/Form/Element/Fieldset/Interceptor.php:347]
#24 Magento\Framework\Data\Form\Element\Fieldset\Interceptor->toHtml() called at [vendor/magento/module-config/Block/System/Config/Form/Fieldset.php:96]
#25 Magento\Config\Block\System\Config\Form\Fieldset->_getChildrenElementsHtml() called at [vendor/magento/module-config/Block/System/Config/Form/Fieldset.php:76]
#26 Magento\Config\Block\System\Config\Form\Fieldset->render() called at [vendor/magento/framework/Data/Form/Element/AbstractElement.php:541]
#27 Magento\Framework\Data\Form\Element\AbstractElement->getHtml() called at [generated/code/Magento/Framework/Data/Form/Element/Fieldset/Interceptor.php:338]
#28 Magento\Framework\Data\Form\Element\Fieldset\Interceptor->getHtml() called at [vendor/magento/framework/Data/Form/Element/AbstractElement.php:555]
#29 Magento\Framework\Data\Form\Element\AbstractElement->toHtml() called at [generated/code/Magento/Framework/Data/Form/Element/Fieldset/Interceptor.php:347]
#30 Magento\Framework\Data\Form\Element\Fieldset\Interceptor->toHtml() called at [vendor/magento/module-config/Block/System/Config/Form/Fieldset.php:96]
#31 Magento\Config\Block\System\Config\Form\Fieldset->_getChildrenElementsHtml() called at [vendor/magento/module-config/Block/System/Config/Form/Fieldset.php:76]
#32 Magento\Config\Block\System\Config\Form\Fieldset->render() called at [vendor/magento/framework/Data/Form/Element/AbstractElement.php:541]
#33 Magento\Framework\Data\Form\Element\AbstractElement->getHtml() called at [generated/code/Magento/Framework/Data/Form/Element/Fieldset/Interceptor.php:338]
#34 Magento\Framework\Data\Form\Element\Fieldset\Interceptor->getHtml() called at [vendor/magento/framework/Data/Form/Element/AbstractElement.php:555]
#35 Magento\Framework\Data\Form\Element\AbstractElement->toHtml() called at [generated/code/Magento/Framework/Data/Form/Element/Fieldset/Interceptor.php:347]
#36 Magento\Framework\Data\Form\Element\Fieldset\Interceptor->toHtml() called at [vendor/magento/framework/Data/Form.php:373]
#37 Magento\Framework\Data\Form->toHtml() called at [vendor/magento/framework/Data/Form.php:390]
#38 Magento\Framework\Data\Form->getHtml() called at [vendor/magento/module-backend/Block/Widget/Form.php:113]
#39 Magento\Backend\Block\Widget\Form->getFormHtml() called at [generated/code/Magento/Config/Block/System/Config/Form/Interceptor.php:158]
#40 Magento\Config\Block\System\Config\Form\Interceptor->getFormHtml() called at [vendor/magento/module-backend/view/adminhtml/templates/widget/form.phtml:13]
#41 include() called at [vendor/magento/framework/View/TemplateEngine/Php.php:71]
` PHP 8.1.17. Magento Version: Commerce Cloud 2.4.5-p2; Magento Mode: developer; Module Version: 3.0.0 Installation via composer.
sergiuec commented 1 year ago

I managed to fix it by replacing
isset($file) ? dirname($file) : __DIR__ with __DIR__ in registration.php. Now I have to figure out why this mess was added here (there is even a comment to bypass phpcs validation {// phpcs:ignore Generic.PHP.ForbiddenFunctions.Found} [clap clap]). This version of the module is horrible, all the cards are exploded in a separate payment methods (yes, visa, mastercard ... an so on, each of them as a separate payment method ). Hosted checkout doesn't work, there is a method called "Grouped Cards" which allows you to use hosted checkout payment flow but it is not displayed if so called "Other payment methods" or "Hosted payment pages" is not enabled, apparently this should be thing I looking for but it isn't because in this method the checkout agreements and billing address aren't displayed (btw in the "Grouped Cards" also is not displayed the billing address, I'm trying now to figure out why!!!?). So, basically all available methods for hosted checkout are useless.

If for someone this may be useful to make a decision: Avoid ingenico for your magento store as much as you can! I'm working and debugging this module the last 3 years and is always a big pain to make it work... and now with the version 3.0.0 it just gets worse.

bertterheide commented 1 year ago

@sergiuec this version of the module aims to resolve a lot of the issues that were caused by rendering all payment options under one single “Ingenico” (now Worldline) group. This is done by rendering all the available payment products separately, and is what is common for a Magento payment module to do, and what a lot of other vendors do too.

The reason for having this construction in the registration file is to enable this module while using symlinks (which is what is used to develop this module). It is taken from https://magento.stackexchange.com/questions/95071/magento-2-does-not-allow-linking-modules-using-symlinks. Apparently that line does not work anymore since Magento 2.3.5. I’ll see if I can find a different way to add support for symlinking this module.

Changing the billing address affects the available payment products, so we do not give the option to change it in the checkout as it could disable the payment product the user has currently chosen.

As for the issues you’re experiencing with Grouped Cards and the Hosted Checkout: I’ll reach out to Worldline’s support team and see if they can be of further assistance configuring your environment.

sergiuec commented 1 year ago

"The reason for having this construction in the registration file is to enable this module while using symlinks (which is what is used to develop this module). It is taken from https://magento.stackexchange.com/questions/95071/magento-2-does-not-allow-linking-modules-using-symlinks. Apparently that line does not work anymore since Magento 2.3.5. I’ll see if I can find a different way to add support for symlinking this module." - Ok, I got it but this stuff usually is not pushed on the master/production branch.

"Changing the billing address affects the available payment products, so we do not give the option to change it in the checkout as it could disable the payment product the user has currently chosen." - How about just disable the "place order" button and show a message that this method is not available in that country??? Most of the clients who chose different addresses for billing and shipping are changing only region and other data but keep the same country. A lot of the registered customers have different default billing and shipping country, i wonder which address will be considered as billing in this case (to be tested but i suppose the shipping address will become billing).

"As for the issues you’re experiencing with Grouped Cards and the Hosted Checkout: I’ll reach out to Worldline’s support team and see if they can be of further assistance configuring your environment." - i don't need a solution for the next year, so I have almost solved it. The last think to solve is the billing address, those limitations are unacceptable.

bertterheide commented 1 year ago

@sergiuec, I've resolved the issue regarding the installation without symlinks by resorting to a patch that disables the symlink check locally (on our development environment). This allows us to use the expected __DIR__ constant. I'm assuming you've already resolved this in your environment, so this will be released in the next version of the module.

The user is still able to change the billing address by configuring Magento to show it on the Payment Page. You can find this setting under Sales > Checkout > Checkout Options > Display Billing Address On. It defaults to Payment Method. Changing this to Payment Page will add a section in the Review & Payments step. It doesn't make sense for a user to change their billing address under a payment product that might disappear.

Thank you for reporting this issue. Please keep doing so, I'll answer your questions and try to resolve any issues as soon as possible.

sergiuec commented 1 year ago

"The user is still able to change the billing address by configuring Magento to show it on the Payment Page. " - Yep, I know about this config but unfortunately I must deal with approved design

bertterheide commented 1 year ago

@sergiuec version 3.0.1 was just released. We now use the __DIR__ constant in registration.php.

Thank you for reporting this issue. Can it be closed?

sergiuec commented 1 year ago

Yes, the issue can be closed. I have a small suggestion: the name of the block "Promo" on cart and checkout page is too common/generic, I have already another 3rd party module which adds on the cart page a block with exactly the same name.

P.S. I still find it weird that \Worldline\Connect\PaymentMethod\PaymentMethods::CARDS is not displayed if \Worldline\Connect\PaymentMethod\PaymentMethods::HOSTED is disabled.

bertterheide commented 1 year ago

@sergiuec I've just released 3.0.2 which also addresses the issue regarding being able to disable HPP.

sergiuec commented 1 year ago

Perfect, it works well now. Thank you.

ekupa commented 1 year ago

@sergiuec, thank you for the valuable feedback and for reporting these errors. We're happy we could work them out together. I'm the Product Manager responsible for this plugin, and would like to invite you to a feedback/brainstorming session. As you have years of experience with it, having your insight on what to further improve would be very beneficial in developing our roadmap. If you're open to it, please reach out to me via email (erzsebet.kupa@worldline.com), and we'll arrange a time that works for you.