mollie / magento2

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

Cannot save API key in Mollie v2.35.0 #752

Closed KathiD303 closed 4 months ago

KathiD303 commented 4 months ago

Describe the bug Cannot save the API key in Mollie v2.35.0

Used versions

To Reproduce Steps to reproduce the behavior:

  1. Go to Mollie General settings in Magento backend.
  2. Insert Test API Key and select mode "Test".
  3. Save config.

Expected behavior API key can be saved.

Actual behavior API key can be saved and remains empty. Error: Something went wrong while saving this configuration: [2024-02-26T15:38:17+0000] Invalid API key: ''. An API key must start with 'test' or 'live' and must be at least 30 characters long

ImanuelBertrand commented 4 months ago

I can confirm this behaviour. Both TEST and LIVE api keys were filled when saving the form.

[2024-02-26T15:25:54.843492+00:00] report.CRITICAL: Exception message: [2024-02-26T15:25:54+0000] Invalid API key: ''. An API key must start with 'test_' or 'live_' and must be at least 30 characters long.
Trace: <pre>#1 Mollie\Payment\Service\Mollie\MollieApiClient->loadByApiKey() called at [vendor/mollie/magento2/Model/Adminhtml/Backend/UpdateProfileId.php:36]
#2 Mollie\Payment\Model\Adminhtml\Backend\UpdateProfileId->execute() called at [vendor/mollie/magento2/Model/Adminhtml/Backend/ChangeApiMode.php:72]
#3 Mollie\Payment\Model\Adminhtml\Backend\ChangeApiMode->afterSave() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#4 Mollie\Payment\Model\Adminhtml\Backend\ChangeApiMode\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#5 Mollie\Payment\Model\Adminhtml\Backend\ChangeApiMode\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#6 Mollie\Payment\Model\Adminhtml\Backend\ChangeApiMode\Interceptor->___callPlugins() called at [generated/code/Mollie/Payment/Model/Adminhtml/Backend/ChangeApiMode/Interceptor.php:23]
#7 Mollie\Payment\Model\Adminhtml\Backend\ChangeApiMode\Interceptor->afterSave() called at [vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php:842]
#8 Magento\Framework\Model\ResourceModel\Db\AbstractDb->processAfterSaves() called at [vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php:402]
#9 Magento\Framework\Model\ResourceModel\Db\AbstractDb->save() called at [vendor/magento/framework/Model/AbstractModel.php:658]
#10 Magento\Framework\Model\AbstractModel->save() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#11 Mollie\Payment\Model\Adminhtml\Backend\ChangeApiMode\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#12 Mollie\Payment\Model\Adminhtml\Backend\ChangeApiMode\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#13 Mollie\Payment\Model\Adminhtml\Backend\ChangeApiMode\Interceptor->___callPlugins() called at [generated/code/Mollie/Payment/Model/Adminhtml/Backend/ChangeApiMode/Interceptor.php:32]
#14 Mollie\Payment\Model\Adminhtml\Backend\ChangeApiMode\Interceptor->save() called at [vendor/magento/framework/DB/Transaction.php:134]
#15 Magento\Framework\DB\Transaction->save() called at [vendor/magento/module-config/Model/Config.php:214]
#16 Magento\Config\Model\Config->save() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#17 Magento\Config\Model\Config\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#18 Magento\Config\Model\Config\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#19 Magento\Config\Model\Config\Interceptor->___callPlugins() called at [generated/code/Magento/Config/Model/Config/Interceptor.php:23]
#20 Magento\Config\Model\Config\Interceptor->save() called at [vendor/magento/module-config/Controller/Adminhtml/System/Config/Save.php:226]
#21 Magento\Config\Controller\Adminhtml\System\Config\Save->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#22 Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#23 Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#24 Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->___callPlugins() called at [generated/code/Magento/Config/Controller/Adminhtml/System/Config/Save/Interceptor.php:23]
#25 Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111]
#26 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:151]
#27 Magento\Backend\App\AbstractAction->dispatch() called at [vendor/magento/module-config/Controller/Adminhtml/System/AbstractConfig.php:69]
#28 Magento\Config\Controller\Adminhtml\System\AbstractConfig->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#29 Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#30 Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:145]
#31 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#32 Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#33 Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->___callPlugins() called at [generated/code/Magento/Config/Controller/Adminhtml/System/Config/Save/Interceptor.php:32]
#34 Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:245]
#35 Magento\Framework\App\FrontController->getActionResponse() called at [vendor/magento/framework/App/FrontController.php:212]
#36 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:147]
#37 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#38 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#39 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#40 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#41 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#42 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#43 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:30]
</pre> [] []
gexxx05 commented 4 months ago

Hotfix:

Change the backend model of field "type" to old value like it was in v2.34.0. Note that changing core files is not a good idea and you should create a patch for this.

In File vendor\mollie\magento2\etc\adminhtml\system.xml change

<field id="type" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>Modus</label>
    <backend_model>Mollie\Payment\Model\Adminhtml\Backend\ChangeApiMode</backend_model>
    <source_model>Mollie\Payment\Model\Adminhtml\Source\ApiKey</source_model>
    <config_path>payment/mollie_general/type</config_path>
</field>

to

<field id="type" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>Modus</label>
    <backend_model>Mollie\Payment\Model\Adminhtml\Backend\FlushMollieCache</backend_model>
    <source_model>Mollie\Payment\Model\Adminhtml\Source\ApiKey</source_model>
    <config_path>payment/mollie_general/type</config_path>
</field>

Afterwards flush magento cache and try again.

joachimVT commented 4 months ago

I can also confirm this behaviour. Both TEST and LIVE api keys were filled when saving the form.

*Magento Version number: 2.4.6-p4 Open source/Enterprise/B2b: Open source Mollie version number (Check configuration): 2.35.0

Frank-Magmodules commented 4 months ago

Hello @joachimVT , @KathiD303 , and @ImanuelBertrand , thank you for opening this issue. We've solved the issue in a new release, version 2.35.1. Apologies for the inconvenience caused, and we appreciate your feedback. I'll mark this issue as resolved for now, but please don't hesitate to reopen it if necessary.