fond-of-oryx/product-payment-restriction

2.0.0 2023-01-20 13:06 UTC

This package is auto-updated.

Last update: 2024-08-27 12:32:12 UTC


README

license

功能说明

对支付方式的支付产品进行限制

安装

composer require fond-of-oryx/product-payment-restriction

使用

在您的依赖提供者中注册插件

例如:Pyz\Zed\Payment\PaymentDependencyProvider.php

/**
 * @return array<int, \Spryker\Zed\PaymentExtension\Dependency\Plugin\PaymentMethodFilterPluginInterface>|array<int, \Spryker\Zed\Payment\Dependency\Plugin\Payment\PaymentMethodFilterPluginInterface>
 */
protected function getPaymentMethodFilterPlugins(): array
{
    return [
        ...,
        new ProductPaymentRestrictionPaymentMethodFilterPlugin(),
    ];
}

将以下配置添加到您的配置文件中

$config[ProductPaymentRestrictionConstants::BLACKLISTED_PAYMENT_METHODS_PRODUCT_ATTRIBUTE] = 'blacklisted_payment_methods';

期望黑名单支付方式存储的属性是一个以逗号分隔的列表。列表应包含不允许用于产品的特定支付方式。

####示例

$product = [
    'abstract_attributes' => [
        '_' => [
            'blacklisted_payment_methods' => 'invoice',
        ]
    ]
]