wamoco/magento2-payment-method-filter

There is no license information available for the latest version (1.0.0) of this package.

Magento 2 Module to filter payment methods

1.0.0 2021-01-09 11:33 UTC

This package is auto-updated.

Last update: 2024-06-09 19:39:37 UTC


README

Module to implement custom filter logic for payment methods.

In your module di.xml declare the filter:

<type name="Wamoco\PaymentMethodFilter\Model\FilterProcessor">
    <arguments>
        <argument name="filters" xsi:type="array">
            <item name="checkmo" xsi:type="object">Vendor\Module\Model\Filter</item>
        </argument>
    </arguments>
</type>

And implement it like this:

class Filter implements \Wamoco\PaymentMethodFilter\Api\FilterInterface
{
    public function isFiltered(
        \Magento\Quote\Api\Data\PaymentMethodInterface $method,
        \Magento\Quote\Api\Data\CartInterface $quote
    ) {
        if ($method->getCode() == 'checkmo') {
          return true;
        }
        return false;
    }
}