bestit / klarna-ordermanagement
Klarna ordermanagement as a package for our Klarna plugins.
Requires
- php: ^7.2
- phpdocumentor/reflection-docblock: v5.1.0
- symfony/polyfill-intl-grapheme: 1.18.1
- symfony/polyfill-intl-normalizer: 1.18.1
- symfony/polyfill-mbstring: 1.18.1
- symfony/property-info: v5.1.0
Requires (Dev)
- phpunit/phpunit: ^5.7
- shopware/shopware: 5.7.0-RC1
This package is auto-updated.
Last update: 2021-03-29 13:09:38 UTC
README
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.