diff --git a/CLAUDE.md b/CLAUDE.md index 83dda54..b214e75 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -141,7 +141,7 @@ passed to the processor as container parameters). capped at 5s) — an explicit 401/403 raises a violation, anything else fails open. Sylius' admin form theme ignores Symfony's `help_html` option, so the `payment_methods` docs link renders through the plugin's own form theme - (`Resources/views/Form/theme.html.twig`, scoped to that field's block prefix and registered by + (`Resources/views/form/theme.html.twig`, scoped to that field's block prefix and registered by `SetonoSyliusQuickpayExtension::prepend()` via `twig.form_themes`). - `FactoryBuilder/QuickpayGatewayFactoryBuilder` injects a guessed UI `language` into the gateway default config at build time; `Guesser/LanguageGuesser` derives it from Sylius's locale context (mapping `nb`/`nn` → `no`). diff --git a/src/Controller/Admin/PaymentOperationsAction.php b/src/Controller/Admin/PaymentOperationsAction.php index d70f0d7..a8965de 100644 --- a/src/Controller/Admin/PaymentOperationsAction.php +++ b/src/Controller/Admin/PaymentOperationsAction.php @@ -50,12 +50,12 @@ public function __invoke(int $id): Response ; } catch (\Throwable) { return new Response( - $this->twig->render('@SetonoSyliusQuickpayPlugin/Admin/Order/Show/Payment/_operationsError.html.twig'), + $this->twig->render('@SetonoSyliusQuickpayPlugin/admin/order/show/payment/_operations_error.html.twig'), Response::HTTP_BAD_GATEWAY, ); } - return new Response($this->twig->render('@SetonoSyliusQuickpayPlugin/Admin/Order/Show/Payment/_operations.html.twig', [ + return new Response($this->twig->render('@SetonoSyliusQuickpayPlugin/admin/order/show/payment/_operations.html.twig', [ 'quickpay_payment' => $quickpayPayment, ])); } diff --git a/src/DependencyInjection/SetonoSyliusQuickpayExtension.php b/src/DependencyInjection/SetonoSyliusQuickpayExtension.php index f864db8..019142d 100644 --- a/src/DependencyInjection/SetonoSyliusQuickpayExtension.php +++ b/src/DependencyInjection/SetonoSyliusQuickpayExtension.php @@ -29,7 +29,7 @@ public function prepend(ContainerBuilder $container): void { if ($container->hasExtension('twig')) { $container->prependExtensionConfig('twig', [ - 'form_themes' => ['@SetonoSyliusQuickpayPlugin/Form/theme.html.twig'], + 'form_themes' => ['@SetonoSyliusQuickpayPlugin/form/theme.html.twig'], ]); } @@ -39,7 +39,7 @@ public function prepend(ContainerBuilder $container): void 'sylius.admin.order.show.payment_content' => [ 'blocks' => [ 'setono_sylius_quickpay_operations' => [ - 'template' => '@SetonoSyliusQuickpayPlugin/Admin/Order/Show/Payment/_quickpay.html.twig', + 'template' => '@SetonoSyliusQuickpayPlugin/admin/order/show/payment/_quickpay.html.twig', 'priority' => -10, ], ], diff --git a/src/Resources/views/Admin/Order/Show/Payment/_operations.html.twig b/src/Resources/views/admin/order/show/payment/_operations.html.twig similarity index 100% rename from src/Resources/views/Admin/Order/Show/Payment/_operations.html.twig rename to src/Resources/views/admin/order/show/payment/_operations.html.twig diff --git a/src/Resources/views/Admin/Order/Show/Payment/_operationsError.html.twig b/src/Resources/views/admin/order/show/payment/_operations_error.html.twig similarity index 100% rename from src/Resources/views/Admin/Order/Show/Payment/_operationsError.html.twig rename to src/Resources/views/admin/order/show/payment/_operations_error.html.twig diff --git a/src/Resources/views/Admin/Order/Show/Payment/_quickpay.html.twig b/src/Resources/views/admin/order/show/payment/_quickpay.html.twig similarity index 100% rename from src/Resources/views/Admin/Order/Show/Payment/_quickpay.html.twig rename to src/Resources/views/admin/order/show/payment/_quickpay.html.twig diff --git a/src/Resources/views/Form/theme.html.twig b/src/Resources/views/form/theme.html.twig similarity index 100% rename from src/Resources/views/Form/theme.html.twig rename to src/Resources/views/form/theme.html.twig diff --git a/tests/Controller/Admin/PaymentOperationsActionTest.php b/tests/Controller/Admin/PaymentOperationsActionTest.php index 73a4c98..c724ece 100644 --- a/tests/Controller/Admin/PaymentOperationsActionTest.php +++ b/tests/Controller/Admin/PaymentOperationsActionTest.php @@ -58,7 +58,7 @@ public function it_renders_the_operations_fetched_from_quickpay(): void $twig = $this->prophesize(Environment::class); $twig->render( - '@SetonoSyliusQuickpayPlugin/Admin/Order/Show/Payment/_operations.html.twig', + '@SetonoSyliusQuickpayPlugin/admin/order/show/payment/_operations.html.twig', Argument::that(static fn (array $context): bool => ($context['quickpay_payment'] ?? null) instanceof QuickpayPayment && 999999 === $context['quickpay_payment']->id && 1 === \count($context['quickpay_payment']->operations)), @@ -80,7 +80,7 @@ public function it_renders_an_error_when_quickpay_cannot_be_reached(): void $sdkClient->payments()->will(fn (): PaymentsEndpoint => new PaymentsEndpoint($sdkClient->reveal(), Client::configureMapperBuilder(new MapperBuilder()))); $twig = $this->prophesize(Environment::class); - $twig->render('@SetonoSyliusQuickpayPlugin/Admin/Order/Show/Payment/_operationsError.html.twig') + $twig->render('@SetonoSyliusQuickpayPlugin/admin/order/show/payment/_operations_error.html.twig') ->willReturn('
error
'); $response = ($this->createAction($sdkClient, $twig))(1); diff --git a/tests/DependencyInjection/SetonoSyliusQuickpayExtensionTest.php b/tests/DependencyInjection/SetonoSyliusQuickpayExtensionTest.php index 895a558..b5136e9 100644 --- a/tests/DependencyInjection/SetonoSyliusQuickpayExtensionTest.php +++ b/tests/DependencyInjection/SetonoSyliusQuickpayExtensionTest.php @@ -111,7 +111,7 @@ public function getAlias(): string (new SetonoSyliusQuickpayExtension())->prepend($container); self::assertSame([ - ['form_themes' => ['@SetonoSyliusQuickpayPlugin/Form/theme.html.twig']], + ['form_themes' => ['@SetonoSyliusQuickpayPlugin/form/theme.html.twig']], ], $container->getExtensionConfig('twig')); } @@ -152,7 +152,7 @@ public function getAlias(): string 'sylius.admin.order.show.payment_content' => [ 'blocks' => [ 'setono_sylius_quickpay_operations' => [ - 'template' => '@SetonoSyliusQuickpayPlugin/Admin/Order/Show/Payment/_quickpay.html.twig', + 'template' => '@SetonoSyliusQuickpayPlugin/admin/order/show/payment/_quickpay.html.twig', 'priority' => -10, ], ],