fond-of-oryx/payment-product-restriction

This package is abandoned and no longer maintained. No replacement package was suggested.

1.0.2 2022-05-03 09:42 UTC

This package is auto-updated.

Last update: 2022-06-09 06:55:57 UTC


README

license

What it does

restriction on products for payment methods

Installation

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

Usage

register the plugin in your dependency provider

i.E.: 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 PaymentProductRestrictionPaymentMethodFilterPlugin(),
    ];
}

add the following configuration to your config-file

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

The attribute where the blacklisted payment methods are stored is expected a comma separated list. The list should contain the specific payment methods from the shop that are not permitted for the product.

####Example

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