The Magento\Payment\Model\Config\Source\Allmethods config source model does not display every available payment method.
<field id="test" type="multiselect">
<label>Test case for displaying all payment methods</label>
<source_model>Magento\Payment\Model\Config\Source\Allmethods</source_model>
</field>
I have tracked the source of the issue down to the app/code/Magento/Payment/Helper/Data.php::getPaymentMethodList() method, which does not report the full list of payment methods when $asLabelValue = true and $withGroups = true.
The issue was apparently introduced with this commit, which does not consider that a group's $labelValues[$code]['value'] might already hold payment method information:
$labelValues[$code]['value'] = null;
This is the issue for that pull request:
And this is the issue that prompted the problematic pull request:
@moehrenzahn, thank you for your report.
We've acknowledged the issue and added to our backlog.
@moehrenzahn The issue is already fixed in 2.2.
Closing ticket for now. Please reopen if you need any further assistance with this.
@magento-engcom-team What are the commits for this issue?
I want to note that this issue is definitively still reproducible on 2.2.4. @magento-engcom-team, can you please check this.
(I am not able to reopen this issue, but please consider it reopened.)
@magento-engcom-team
We also could reproduce the issue on 2.2.4. This malfunction happens only when $withGroups is true.
When adding the group, the mentioned line of code "$labelValues[$code]['value'] = null;" causes the already set method values to be overridden. Due to sorting the array alphabetically first, the group "offline" e.g. overrides four already set values such as "checkmo".
A quick fix would be to only set the value if it doesn't already exist (fixed in src/vendor/magento/module-payment/Helper/Data.php lines 296-298)
if (!isset($labelValues[$code]['value'])) {
$labelValues[$code]['value'] = null;
}
Hi @moehrenzahn. Thank you for your report.
The issue has been fixed in magento/magento2#15032 by @mash1t in 2.2-develop branch
Related commit(s):
The fix will be available with the upcoming 2.2.5 release.
Hi @moehrenzahn. Thank you for your report.
The issue has been fixed in magento/magento2#15134 by @mzeis in 2.3-develop branch
Related commit(s):
The fix will be available with the upcoming 2.3.0 release.
FYI it will be released in 2.2.6 we see that the PR is merged only in this version