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
Avoid exception when config.xml nodes exist for not-installed payment methods #27940
Avoid exception when config.xml nodes exist for not-installed payment methods #27940
Conversation
When a payment configuration node exists in XML but there is no <model> defined, getList() will throw an UnexpectedValueException. One use case for creating such a set-up is a module that provides default configuration overrides for payment methods which are not installed on the current website. For example: <config> <default> <payment> <checkmo> <active>0</active> </checkmo> <not_installed_here> <debug>0</debug> <environment>production</environment> </not_installed_here> </payment> </default> </config> In this case, the payment method 'not_installed_here' does not have a <model> node defined, as the payment method module is not installed on the website.
Hi @fredden. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
With this code change applied, there are issues reloading checkout payments. An example from internal testing: Expected Result:
Actual Result:
This is perhaps due to the second parameter of the |
@magento create issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fredden, can you please look through at comment #27940 (comment) ? |
The risk was set to |
Now instead of using the helper, we are only catching the exception thrown. See previous commit for full description.
…/model-not-provided-in-config
@fredden can you please fix static tests and cover changes by autotest? |
…/model-not-provided-in-config
@fredden can you please cover changes by autotest? Otherwise, we can't proceed with your PR. |
@engcom-Charlie, how would you suggest writing a test for this? I'm considering adding some XML nodes to |
@fredden, you can do this, for example like here |
…/model-not-provided-in-config
@sidolov I checked test With changes from this PR test passed. |
@engcom-Charlie sounds reasonable, I see additional config was added for the exceptional case, so, it's enough to proceed with PR. Thank you! |
Hi @sidolov, thank you for the review.
|
✔️ QA passed Result according comment with coupon code: |
Note: Automation tests are passed |
…alled payment methods #27940
Hi @fredden, thank you for your contribution! |
Description
When a payment configuration node exists in XML but there is no
<model>
defined,getList()
will throw anUnexpectedValueException
. One use case for creating such a set-up is a module that provides default configuration overrides for payment methods which are not installed on the current website. For example:In this case, the payment method
not_installed_here
does not have a<model>
node defined, as the payment method module is not installed on the website.Related Pull Requests
None known
Fixed Issues
None known
Manual testing scenarios (*)
config.xml
Questions or comments
I have not yet written/changed any unit/functional tests for this change. I suspect some existing tests may fail which I will review at a later date.
Contribution checklist (*)
Resolved issues: