bestit/klarna-ordermanagement

This package is abandoned and no longer maintained. The author suggests using the k10r/klarna-ordermanagement package instead.

Klarna ordermanagement as a package for our Klarna plugins.


README

Latest Version on Packagist Software License Total Downloads

This is a package for shopware plugins. It adds support for the Klarna OrderManagement API and also includes a UI in the shopware backend. If using this package, you will need to implement Klarna Payments order Klarna Checkout yourself.

// TODO: Add Klarna Checkout link once its ready

Install

Via Composer

$ composer require bestit/klarna-ordermanagement

Registering dependencies

In your Shopware plugin entry file, you need to specify the following container parameters:

  • Plugin name
  • Plugin version
public function build(ContainerBuilder $containerBuilder)
{
    parent::build($containerBuilder);

    $containerBuilder->setParameter('bestit_klarna.plugin_name', 'ExamplePluginName');
    $containerBuilder->setParameter('bestit_klarna.plugin_version', '1.0.0');
}

And you will also need to register our dependencies:

public function build(ContainerBuilder $containerBuilder)
{
    parent::build($containerBuilder);

    //

    $dependencyInjectionExtensions = [
        \BestitKlarnaOrderManagement\Components\DependencyInjection\DependencyInjectionExtension::class
    ];

    foreach ($dependencyInjectionExtensions as $dependencyInjectionExtension) {
        if (!class_exists($dependencyInjectionExtension)) {
            continue;
        }

        $dependencyInjectionExtension = new $dependencyInjectionExtension();

        if (!$dependencyInjectionExtension instanceof \BestitKlarnaOrderManagement\Components\DependencyInjection\DependencyInjectionExtensionInterface) {
            continue;
        }

        $dependencyInjectionExtension->injectDependencies($containerBuilder);
    }
}

Then you can use the OMInstaller for any ohter necessary setup:

public function install(InstallContext $context)
{
    // ...

    $this->getOmInstaller()->install($this, $context);

    // ...
}

public function uninstall(UninstallContext $context)
{
    // ...

    $this->getOmInstaller()->uninstall($this, $context);

    // ...
}

public function update(UpdateContext $context)
{
    // ...

    $this->getOmInstaller()->update($this, $context);

    // ...
}

protected function getOmInstaller()
{
    if ($this->omInstaller !== null) {
        return $this->omInstaller;
    }

    $this->omInstaller = new OmInstaller($this->container->get('shopware.snippet_database_handler'));

    return $this->omInstaller;
}

Usage

See the docs for more information.

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email best it.

License

The MIT License (MIT). Please see License File for more information.