It's used for the Payum factory name for example.
Context
The quickpay gateway factory name is a magic string in seven places today:
PHP (can use a constant):
src/Controller/NotifyAction.php — findBy(['factoryName' => 'quickpay']) for the per-gateway order-prefix resolution
src/Provider/PendingPaymentProvider.php — ->setParameter('factoryName', 'quickpay')
tests/Controller/NotifyActionTest.php, tests/StateMachine/PaymentProcessorTest.php
services.xml (cannot use a constant — XML tag attributes take literals only):
<tag name="payum.action" factory="quickpay">
<tag name="sylius.gateway_configuration_type" type="quickpay">
<tag name="payum.gateway_factory_builder" factory="quickpay"/>
And the list is about to grow: the RefundPlugin integration (#104) needs the factory name in the sylius_refund.supported_gateways parameter and in "is this a Quickpay method?" guards, and the admin features (#105, #107) need the same guard. Other plugins solved this the same way — e.g. Sylius/MolliePlugin guards its handlers with MollieGatewayFactory::FACTORY_NAME.
The constant is added upstream
The authority on the name is setono/payum-quickpay — the constant is being added there as QuickpayGatewayFactory::NAME: Setono/payum-quickpay#54. This issue tracks the plugin side only.
Tasks
It's used for the Payum factory name for example.
Context
The
quickpaygateway factory name is a magic string in seven places today:PHP (can use a constant):
src/Controller/NotifyAction.php—findBy(['factoryName' => 'quickpay'])for the per-gateway order-prefix resolutionsrc/Provider/PendingPaymentProvider.php—->setParameter('factoryName', 'quickpay')tests/Controller/NotifyActionTest.php,tests/StateMachine/PaymentProcessorTest.phpservices.xml (cannot use a constant — XML tag attributes take literals only):
<tag name="payum.action" factory="quickpay"><tag name="sylius.gateway_configuration_type" type="quickpay"><tag name="payum.gateway_factory_builder" factory="quickpay"/>And the list is about to grow: the RefundPlugin integration (#104) needs the factory name in the
sylius_refund.supported_gatewaysparameter and in "is this a Quickpay method?" guards, and the admin features (#105, #107) need the same guard. Other plugins solved this the same way — e.g. Sylius/MolliePlugin guards its handlers withMollieGatewayFactory::FACTORY_NAME.The constant is added upstream
The authority on the name is setono/payum-quickpay — the constant is being added there as
QuickpayGatewayFactory::NAME: Setono/payum-quickpay#54. This issue tracks the plugin side only.Tasks
services.xmltag attributes stay literal (XML limitation) — they're covered by the container/integration tests, which will use the constant