wamoco/magento2-payment-method-filter

该包的最新版本(1.0.0)没有提供许可证信息。

用于过滤支付方式的Magento 2模块

安装: 147

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 0

开放问题: 0

类型:magento2-module

1.0.0 2021-01-09 11:33 UTC

This package is auto-updated.

Last update: 2024-09-09 20:06:40 UTC


README

实现自定义过滤逻辑的支付方式模块。

在你的模块 di.xml 中声明过滤器

<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>

并像这样实现它

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;
    }
}