diff --git a/app/config/eccube/services.yaml b/app/config/eccube/services.yaml index ae666313f51..18e0254779d 100644 --- a/app/config/eccube/services.yaml +++ b/app/config/eccube/services.yaml @@ -325,13 +325,11 @@ services: arguments: $accessTokenHandler: '@?Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface' - # Agent Commerce 決済ハンドラ (#6574 UCP / #6776 ACP) - # 具象ハンドラは決済プラグインが agent_commerce.payment_handler タグで寄与する。 - _instanceof: - Eccube\Service\AgentCommerce\Payment\AgentCheckoutPaymentHandlerInterface: - tags: ['agent_commerce.payment_handler'] - - # 決済ハンドラレジストリ。具象ハンドラ (決済プラグイン) は agent_commerce.payment_handler タグで寄与する。 + # Agent Commerce 決済ハンドラレジストリ (#6574 UCP / #6776 ACP) + # 具象ハンドラ (決済プラグイン) は agent_commerce.payment_handler タグで寄与する。 + # タグ付けは Kernel::build() の registerForAutoconfiguration で行う (PaymentMethodInterface と同様)。 + # services.yaml の _instanceof はファイルスコープのため、Plugin\ glob (services.php・#6915) で + # 登録される決済プラグインの具象ハンドラには届かない。 Eccube\Service\AgentCommerce\Payment\AgentCheckoutPaymentHandlerRegistry: arguments: $handlers: !tagged_iterator agent_commerce.payment_handler diff --git a/src/Eccube/Kernel.php b/src/Eccube/Kernel.php index 85eca1463c4..8dc950ff1f0 100644 --- a/src/Eccube/Kernel.php +++ b/src/Eccube/Kernel.php @@ -34,6 +34,7 @@ use Eccube\Doctrine\ORM\Mapping\Driver\TraitProxyAttributeDriver; use Eccube\Doctrine\Query\QueryCustomizer; use Eccube\Log\Logger; +use Eccube\Service\AgentCommerce\Payment\AgentCheckoutPaymentHandlerInterface; use Eccube\Service\Payment\PaymentMethodInterface; use Eccube\Service\PurchaseFlow\DiscountProcessor; use Eccube\Service\PurchaseFlow\ItemHolderPostValidator; @@ -268,6 +269,13 @@ protected function build(ContainerBuilder $container): void ->addTag(PaymentMethodPass::PAYMENT_METHOD_TAG); $container->addCompilerPass(new PaymentMethodPass()); + // Agent Commerce 決済ハンドラ (#6574 UCP / #6776 ACP) の拡張。 + // 決済プラグインの具象ハンドラは Plugin\ glob (services.php・#6915) で登録されるため、 + // services.yaml のファイルスコープな _instanceof ではタグが付かない。 + // PaymentMethodInterface と同様にコンテナ全体へ効く registerForAutoconfiguration でタグ付けする。 + $container->registerForAutoconfiguration(AgentCheckoutPaymentHandlerInterface::class) + ->addTag('agent_commerce.payment_handler'); + // PurchaseFlow の拡張 $container->registerForAutoconfiguration(ItemPreprocessor::class) ->addTag(PurchaseFlowPass::ITEM_PREPROCESSOR_TAG);