Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@
},
"require": {
"php": ">=8.1",
"symfony/psr-http-message-bridge": "2.* || ^7.0",
"symfony/routing": "^6.4 || ^7.0",
"symfony/psr-http-message-bridge": "2.* || ^7.0 || ^8.0",
"symfony/routing": "^6.4 || ^7.0 || ^8.0",
"shopware/app-php-sdk": ">=4.1.0",
"symfony/http-client": "^6.4 || ^7.0",
"symfony/http-client": "^6.4 || ^7.0 || ^8.0",
"nyholm/psr7": "^1.8"
},
"require-dev": {
"doctrine/doctrine-bundle": "^2.8",
"symfony/doctrine-bridge": "^6.4 || ^7.0",
"symfony/doctrine-bridge": "^6.4 || ^7.0 || ^8.0",
"doctrine/orm": "^3.0",
"async-aws/async-aws-bundle": "~1.12",
"async-aws/dynamo-db": "~3.2.1",
"symfony/polyfill-uuid": "~1.31.0",
"friendsofphp/php-cs-fixer": "^3.16",
"phpstan/phpstan": "^1.10.14",
"phpunit/phpunit": "^10.1",
"symfony/phpunit-bridge": "^6.2.10 || ^6.3 || ^6.4 || ^7.0",
"symfony/phpunit-bridge": "^6.2.10 || ^6.3 || ^6.4 || ^7.0 || ^8.0",
"infection/infection": "^0.26.21"
},
"suggest": {
Expand Down
6 changes: 3 additions & 3 deletions src/DependencyInjection/ShopwareAppExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Reference;

final class ShopwareAppExtension extends Extension
Expand All @@ -23,12 +23,12 @@ public function load(array $configs, ContainerBuilder $container): void
{
$config = $this->processConfiguration(new Configuration(), $configs);

$loader = new XmlFileLoader(
$loader = new PhpFileLoader(
$container,
new FileLocator(__DIR__ . '/../Resources/config')
);

$loader->load('services.xml');
$loader->load('services.php');

$storage = $config['storage'];

Expand Down
29 changes: 29 additions & 0 deletions src/Resources/config/routing/lifecycle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Shopware\AppBundle\Controller\LifecycleController;

return function (RoutingConfigurator $routes): void {
$routes->add('shopware_app_lifecycle_register', '/lifecycle/register')
->methods([Request::METHOD_GET])
->controller([LifecycleController::class, 'register']);

$routes->add('shopware_app_lifecycle_confirm', '/lifecycle/register-confirm')
->methods([Request::METHOD_POST])
->controller([LifecycleController::class, 'registerConfirm']);

$routes->add('shopware_app_lifecycle_activate', '/lifecycle/activate')
->methods([Request::METHOD_POST])
->controller([LifecycleController::class, 'activate']);

$routes->add('shopware_app_lifecycle_deactivate', '/lifecycle/deactivate')
->methods([Request::METHOD_POST])
->controller([LifecycleController::class, 'deactivate']);

$routes->add('shopware_app_lifecycle_delete', '/lifecycle/delete')
->methods([Request::METHOD_POST])
->controller([LifecycleController::class, 'delete']);
};
26 changes: 0 additions & 26 deletions src/Resources/config/routing/lifecycle.xml

This file was deleted.

13 changes: 13 additions & 0 deletions src/Resources/config/routing/webhook.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Shopware\AppBundle\Controller\WebhookController;

return function (RoutingConfigurator $routes): void {
$routes->add('shopware_app_webhook', '/webhook')
->methods([Request::METHOD_POST])
->controller([WebhookController::class, 'dispatch']);
};
10 changes: 0 additions & 10 deletions src/Resources/config/routing/webhook.xml

This file was deleted.

107 changes: 107 additions & 0 deletions src/Resources/config/services.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

return static function (ContainerConfigurator $container) {
$services = $container->services();

$services->defaults()
->autowire()
->autoconfigure();

$services->set(\Shopware\AppBundle\DependencyInjection\AppConfigurationFactory::class)
->args([
// Will be filled by \Shopware\AppBundle\DependencyInjection\ShopwareAppExtension::load
'',
'',
'',
service(\Symfony\Component\Routing\Generator\UrlGeneratorInterface::class),
]);

$services->set(\Shopware\App\SDK\HttpClient\ClientFactory::class);

$services->set(\Shopware\App\SDK\AppConfiguration::class)
->factory([service(\Shopware\AppBundle\DependencyInjection\AppConfigurationFactory::class), 'newConfiguration']);

$services->set(\Shopware\App\SDK\AppLifecycle::class)
->args([
service(\Shopware\App\SDK\Registration\RegistrationService::class),
service(\Shopware\App\SDK\Shop\ShopResolver::class),
service(\Shopware\App\SDK\Shop\ShopRepositoryInterface::class),
service(\Psr\Log\LoggerInterface::class),
service(\Psr\EventDispatcher\EventDispatcherInterface::class),
]);

$services->set(\Shopware\App\SDK\Authentication\RequestVerifier::class);

$services->set(\Shopware\App\SDK\Authentication\ResponseSigner::class);

$services->set(\Symfony\Component\Cache\Psr16Cache::class)
->args([service('cache.app')]);

$services->set(\Shopware\App\SDK\Context\InAppPurchase\SBPStoreKeyFetcher::class)
->args([
service(\Psr\Http\Client\ClientInterface::class),
service(\Symfony\Component\Cache\Psr16Cache::class),
service(\Psr\Log\LoggerInterface::class),
]);

$services->set(\Shopware\App\SDK\Context\InAppPurchase\InAppPurchaseProvider::class)
->args([
service(\Shopware\App\SDK\Context\InAppPurchase\SBPStoreKeyFetcher::class),
service(\Psr\Log\LoggerInterface::class),
]);

$services->set(\Shopware\App\SDK\Context\ContextResolver::class)
->args([service(\Shopware\App\SDK\Context\InAppPurchase\InAppPurchaseProvider::class)]);

$services->set(\Shopware\App\SDK\Shop\ShopResolver::class)
->args([service(\Shopware\App\SDK\Shop\ShopRepositoryInterface::class)]);

$services->set(\Shopware\App\SDK\Registration\RegistrationService::class)
->args([
service(\Shopware\App\SDK\AppConfiguration::class),
service(\Shopware\App\SDK\Shop\ShopRepositoryInterface::class),
service(\Shopware\App\SDK\Authentication\RequestVerifier::class),
service(\Shopware\App\SDK\Authentication\ResponseSigner::class),
service(\Shopware\App\SDK\Registration\ShopSecretGeneratorInterface::class),
service(\Psr\Log\LoggerInterface::class),
service(\Psr\EventDispatcher\EventDispatcherInterface::class),
]);

$services->set(\Shopware\App\SDK\Registration\ShopSecretGeneratorInterface::class, \Shopware\App\SDK\Registration\RandomStringShopSecretGenerator::class);

$services->set(\Shopware\App\SDK\Shop\ShopRepositoryInterface::class, \Shopware\AppBundle\Entity\ShopRepositoryBridge::class)
->args([
'',
service(\Doctrine\Persistence\ManagerRegistry::class),
]);

$services->set(\Shopware\AppBundle\Controller\LifecycleController::class)
->public()
->args([service(\Shopware\App\SDK\AppLifecycle::class)])
->tag('controller.service_arguments');

$services->set(\Shopware\AppBundle\Controller\WebhookController::class)
->public()
->args([service('event_dispatcher')])
->tag('controller.service_arguments');

$services->set(\Shopware\AppBundle\ArgumentValueResolver\ContextArgumentResolver::class);

$services->set(\Shopware\AppBundle\EventListener\ResponseSignerListener::class);

$services->set(\Shopware\AppBundle\EventListener\BeforeRegistrationStartsListener::class)
->args([
service(\Symfony\Contracts\HttpClient\HttpClientInterface::class),
'%shopware_app.check_if_shop_url_is_reachable%',
]);

$services->set(\Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface::class, \Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory::class);

$services->set(\Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface::class, \Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory::class);

$services->set(\Symfony\Bridge\PsrHttpMessage\EventListener\PsrResponseListener::class);
};
96 changes: 0 additions & 96 deletions src/Resources/config/services.xml

This file was deleted.