Skip to content

Should quickpay be a constant somewhere? #103

Description

@loevgaard

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.phpfindBy(['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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions