diff --git a/composer.json b/composer.json index 9b586f9..4c9e3c3 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mondu/shopware6-payment", "description": "Mondu payment for Shopware 6", - "version": "1.1.4", + "version": "2.0.0", "type": "shopware-platform-plugin", "license": "proprietary", "authors": [ @@ -15,7 +15,7 @@ } }, "require": { - "shopware/core": "^6.5", + "shopware/core": "^6.6", "ext-json": "*" }, "extra": { diff --git a/src/Bootstrap/AbstractBootstrap.php b/src/Bootstrap/AbstractBootstrap.php index 085f42d..17cbccd 100644 --- a/src/Bootstrap/AbstractBootstrap.php +++ b/src/Bootstrap/AbstractBootstrap.php @@ -9,13 +9,10 @@ use Shopware\Core\Framework\Plugin\Context\InstallContext; use Shopware\Core\Framework\Plugin\Context\UpdateContext; use Shopware\Core\Framework\Plugin\PluginEntity; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; -abstract class AbstractBootstrap implements ContainerAwareInterface +abstract class AbstractBootstrap { - use ContainerAwareTrait; - /** * @var Context */ @@ -41,8 +38,12 @@ abstract class AbstractBootstrap implements ContainerAwareInterface */ protected PluginEntity $plugin; - final public function __construct() - { + /** + * @param ContainerInterface $container + */ + final public function __construct( + protected ContainerInterface $container, + ) { } abstract public function install(): void; diff --git a/src/Components/Order/Controller/CreditNoteController.php b/src/Components/Order/Controller/CreditNoteController.php index 81a407e..4cc6a7b 100644 --- a/src/Components/Order/Controller/CreditNoteController.php +++ b/src/Components/Order/Controller/CreditNoteController.php @@ -10,14 +10,11 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; -/** - * @Route(defaults={"_routeScope"={"api"}}) - */ +#[Route(defaults: ['_routeScope' => ['api']])] class CreditNoteController extends AbstractController { public function __construct( @@ -28,9 +25,7 @@ public function __construct( private readonly EntityRepository $documentRepository ) {} - /** - * @Route(name="mondu-payment.credit_note.cancel", path="/api/mondu/orders/{orderId}/credit_notes/{creditNoteId}/cancel", defaults={"csrf_protected"=false}, methods={"POST"}) - */ + #[Route(path: '/api/mondu/orders/{orderId}/credit_notes/{creditNoteId}/cancel', name: 'mondu-payment.credit_note.cancel', methods: ['POST'])] public function cancel(Request $request, string $orderId, string $creditNoteId, Context $context): Response { try { diff --git a/src/Components/Order/Controller/DocumentController.php b/src/Components/Order/Controller/DocumentController.php index 3836083..13fce02 100644 --- a/src/Components/Order/Controller/DocumentController.php +++ b/src/Components/Order/Controller/DocumentController.php @@ -16,7 +16,6 @@ use Symfony\Component\Routing\Annotation\Route; #[Route(defaults: ['_routeScope' => ['storefront']])] - class DocumentController extends AbstractController { /** @@ -26,9 +25,7 @@ public function __construct( private readonly DocumentGenerator $documentGenerator ) {} - /** - * @Route(name="mondu-payment.payment.document", path="/mondu/document/{documentId}/{deepLinkCode}/{token}") - */ + #[Route(path: '/mondu/document/{documentId}/{deepLinkCode}/{token}', name: 'mondu-payment.payment.document')] public function downloadDocument(Request $request, string $documentId, string $deepLinkCode, Context $context): Response { $documentUrlHelper = $this->container->get(DocumentUrlHelper::class); diff --git a/src/Components/Order/Controller/InvoiceController.php b/src/Components/Order/Controller/InvoiceController.php index 4192176..43503fd 100644 --- a/src/Components/Order/Controller/InvoiceController.php +++ b/src/Components/Order/Controller/InvoiceController.php @@ -15,9 +15,7 @@ use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; use Mondu\MonduPayment\Util\CriteriaHelper; -/** - * @Route(defaults={"_routeScope"={"api"}}) - */ +#[Route(defaults: ['_routeScope' => ['api']])] class InvoiceController extends AbstractController { public function __construct( @@ -27,9 +25,7 @@ public function __construct( private readonly EntityRepository $orderDataRepository ) {} - /** - * @Route(name="mondu-payment.invoice.cancel", path="/api/mondu/orders/{orderId}/{invoiceId}/cancel", defaults={"csrf_protected"=false}, methods={"POST"}) - */ + #[Route(path: '/api/mondu/orders/{orderId}/{invoiceId}/cancel', name: 'mondu-payment.invoice.cancel', methods: ['POST'])] public function cancel(Request $request, string $orderId, string $invoiceId, Context $context): Response { try { diff --git a/src/Components/Order/DependencyInjection/controllers.xml b/src/Components/Order/DependencyInjection/controllers.xml index 6128995..180ae9d 100644 --- a/src/Components/Order/DependencyInjection/controllers.xml +++ b/src/Components/Order/DependencyInjection/controllers.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="https://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -18,18 +18,18 @@ - - - + + + - - - + + + diff --git a/src/Components/Order/Model/OrderDataEntity.php b/src/Components/Order/Model/OrderDataEntity.php index acf1e0d..78feb79 100644 --- a/src/Components/Order/Model/OrderDataEntity.php +++ b/src/Components/Order/Model/OrderDataEntity.php @@ -47,7 +47,7 @@ class OrderDataEntity extends Entity /** * @var OrderEntity */ - protected OrderEntity $order; + protected $order; /** * @var string diff --git a/src/Components/PluginConfig/Controller/ConfigController.php b/src/Components/PluginConfig/Controller/ConfigController.php index cd42e9d..3fa31ca 100644 --- a/src/Components/PluginConfig/Controller/ConfigController.php +++ b/src/Components/PluginConfig/Controller/ConfigController.php @@ -11,18 +11,14 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route(defaults={"_routeScope"={"api"}}) - */ +#[Route(defaults: ['_routeScope' => ['api']])] class ConfigController extends AbstractController { public function __construct( private readonly MonduClient $monduClient ) {} - /** - * @Route(name="mondu-payment.config.test", path="/api/mondu/config/test", defaults={"csrf_protected"=false}, methods={"POST"}) - */ + #[Route(path: '/api/mondu/config/test', name: 'mondu-payment.config.test', methods: ['POST'])] public function test(Request $request, Context $context): Response { try { diff --git a/src/Components/PluginConfig/DependencyInjection/controllers.xml b/src/Components/PluginConfig/DependencyInjection/controllers.xml index aec05ef..3ba9932 100644 --- a/src/Components/PluginConfig/DependencyInjection/controllers.xml +++ b/src/Components/PluginConfig/DependencyInjection/controllers.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="https://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd"> diff --git a/src/Components/PluginConfig/DependencyInjection/services.xml b/src/Components/PluginConfig/DependencyInjection/services.xml index 70def6b..aec1902 100644 --- a/src/Components/PluginConfig/DependencyInjection/services.xml +++ b/src/Components/PluginConfig/DependencyInjection/services.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="https://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> diff --git a/src/Components/StateMachine/DependencyInjection/services.xml b/src/Components/StateMachine/DependencyInjection/services.xml index 61f8011..01ea15b 100644 --- a/src/Components/StateMachine/DependencyInjection/services.xml +++ b/src/Components/StateMachine/DependencyInjection/services.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="https://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> diff --git a/src/Components/StateMachine/DependencyInjection/subscriber.xml b/src/Components/StateMachine/DependencyInjection/subscriber.xml index 6355caf..7a3a7ed 100644 --- a/src/Components/StateMachine/DependencyInjection/subscriber.xml +++ b/src/Components/StateMachine/DependencyInjection/subscriber.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="https://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> diff --git a/src/Components/Webhooks/Controller/WebhooksController.php b/src/Components/Webhooks/Controller/WebhooksController.php index 3d73f76..568426e 100644 --- a/src/Components/Webhooks/Controller/WebhooksController.php +++ b/src/Components/Webhooks/Controller/WebhooksController.php @@ -13,9 +13,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route(defaults={"_routeScope"={"storefront"}}) - */ +#[Route(defaults: ['_routeScope' => ['storefront']])] class WebhooksController extends StorefrontController { private ConfigService $configService; @@ -29,9 +27,7 @@ public function __construct( $this->webhookService = $webhookService; } - /** - * @Route("/mondu/webhooks", name="mondu-payment.webhooks", defaults={"csrf_protected"=false}, methods={"POST"}) - */ + #[Route(path: '/mondu/webhooks', name: 'mondu-payment.webhooks', methods: ['POST'])] public function process(Request $request, Context $context): Response { $content = $request->getContent(); diff --git a/src/Components/Webhooks/DependencyInjection/controllers.xml b/src/Components/Webhooks/DependencyInjection/controllers.xml index 3eefa6c..d11fd0d 100644 --- a/src/Components/Webhooks/DependencyInjection/controllers.xml +++ b/src/Components/Webhooks/DependencyInjection/controllers.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="https://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> diff --git a/src/Components/Webhooks/DependencyInjection/services.xml b/src/Components/Webhooks/DependencyInjection/services.xml index a91fb64..0587f4d 100644 --- a/src/Components/Webhooks/DependencyInjection/services.xml +++ b/src/Components/Webhooks/DependencyInjection/services.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="https://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> diff --git a/src/Mond1SW6.php b/src/Mond1SW6.php index c25dc29..0665758 100644 --- a/src/Mond1SW6.php +++ b/src/Mond1SW6.php @@ -13,6 +13,7 @@ use Shopware\Core\Framework\Plugin\Context\UninstallContext; use Shopware\Core\Framework\Plugin\Context\UpdateContext; use Shopware\Core\Framework\Plugin\Context\ActivateContext; +use Symfony\Component\DependencyInjection\ContainerInterface; class Mond1SW6 extends Plugin { @@ -76,8 +77,8 @@ public function uninstall(UninstallContext $uninstallContext): void protected function getBootstrapClasses(InstallContext $installContext): array { $bootstrapper = [ - new PaymentMethods(), - new Database() + new PaymentMethods($this->container), + new Database($this->container) ]; $pluginRepository = $this->container->get('plugin.repository'); @@ -91,7 +92,6 @@ protected function getBootstrapClasses(InstallContext $installContext): array foreach ($bootstrapper as $bootstrap) { $bootstrap->setContext($installContext->getContext()); $bootstrap->setInstallContext($installContext); - $bootstrap->setContainer($this->container); $bootstrap->injectServices(); $bootstrap->setPlugin($plugin); } diff --git a/src/Pos/Run/LoggerFactory.php b/src/Pos/Run/LoggerFactory.php new file mode 100644 index 0000000..de20d16 --- /dev/null +++ b/src/Pos/Run/LoggerFactory.php @@ -0,0 +1,23 @@ +pushHandler(new LogHandler()); + $logger->pushProcessor(new PsrLogMessageProcessor()); + + return $logger; + } +} diff --git a/src/Resources/config/routes.xml b/src/Resources/config/routes.xml index 407b13e..bcf0085 100644 --- a/src/Resources/config/routes.xml +++ b/src/Resources/config/routes.xml @@ -2,7 +2,7 @@ + https://symfony.com/schema/routing/routing-1.0.xsd"> - + diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 2780c91..f64a3a0 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="https://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -104,8 +104,10 @@ + + - + mondu_payment