Skip to content

Allmethods config source model does not always report the full list of payment methods #13460

@moehrenzahn

Description

@moehrenzahn

The Magento\Payment\Model\Config\Source\Allmethods config source model does not display every available payment method.

Preconditions

  1. Magento version 2.1.11, plain fresh installation

Steps to reproduce

  1. Enable the Cash on Delivery payment method
  2. Define a config field like this:
<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>
  1. Load the config field in the Magento backend

Expected result

  1. The enabled Cash on Delivery payment method should be visible in the config field multiselect

Actual result

  1. The Cash On Delivery payment method is not listed in the widget

Comments

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions