spryker extend DummyPaymentHandlerPlugin class

52 Views Asked by At

I am new to spryker and I want to extend this class DummyPaymentHandlerPlugin. I tried by adding the class to the factory but is not working. Can anyone help me to do this

1

There are 1 best solutions below

0
Herbert Scheffknecht On

Extending plugins in Spryker is possible. But instead of changing the factory method, you just have to change the use statement in the appropriate dependency provider.

In your case, it's \Pyz\Yves\CheckoutPage\CheckoutPageDependencyProvider::extendPaymentMethodHandler:

    protected function extendPaymentMethodHandler(Container $container): Container
    {
        $container->extend(static::PAYMENT_METHOD_HANDLER, function (StepHandlerPluginCollection $paymentMethodHandler) {
            $paymentMethodHandler->add(new DummyPaymentHandlerPlugin(), DummyPagmentConfig::PAYMENT_PROVIDER_NAME);

            return $paymentMethodHandler;
        });

        return $container;
    }