[PaymentRequest] Move providers to PaymentBundle

This commit is contained in:
Grzegorz Sadowski 2024-09-27 12:05:04 +02:00
parent 49a22c7826
commit 01749ff45a
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
30 changed files with 81 additions and 80 deletions

View file

@ -16,8 +16,8 @@ namespace Sylius\Bundle\ApiBundle\CommandHandler\Payment;
use Sylius\Bundle\ApiBundle\Command\Payment\AddPaymentRequest;
use Sylius\Bundle\ApiBundle\Exception\PaymentMethodNotFoundException;
use Sylius\Bundle\ApiBundle\Exception\PaymentNotFoundException;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\DefaultActionProviderInterface;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\DefaultPayloadProviderInterface;
use Sylius\Bundle\PaymentBundle\Provider\DefaultActionProviderInterface;
use Sylius\Bundle\PaymentBundle\Provider\DefaultPayloadProviderInterface;
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Core\Model\PaymentMethodInterface;
use Sylius\Component\Core\Repository\PaymentMethodRepositoryInterface;

View file

@ -196,7 +196,7 @@
<service id="Sylius\Bundle\ApiBundle\Validator\Constraints\ChosenPaymentRequestActionEligibilityValidator">
<argument type="service" id="sylius.repository.payment_method" />
<argument type="service" id="sylius.payment_request.command_provider.default" />
<argument type="service" id="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\GatewayFactoryNameProviderInterface" />
<argument type="service" id="sylius.payment_request.provider.gateway_factory_name" />
<tag name="validator.constraint_validator" alias="sylius_api_chosen_payment_request_action_eligibility" />
</service>

View file

@ -14,9 +14,9 @@ declare(strict_types=1);
namespace Sylius\Bundle\ApiBundle\Validator\Constraints;
use Sylius\Bundle\ApiBundle\Command\Payment\AddPaymentRequest;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\GatewayFactoryNameProviderInterface;
use Sylius\Bundle\PaymentBundle\CommandProvider\PaymentRequestCommandProviderInterface;
use Sylius\Bundle\PaymentBundle\CommandProvider\ServiceProviderAwareCommandProviderInterface;
use Sylius\Bundle\PaymentBundle\Provider\GatewayFactoryNameProviderInterface;
use Sylius\Component\Core\Model\PaymentMethodInterface;
use Sylius\Component\Core\Repository\PaymentMethodRepositoryInterface;
use Symfony\Component\Validator\Constraint;

View file

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\OrderPay\Provider\Offline;
use Sylius\Bundle\CoreBundle\OrderPay\Provider\FinalUrlProviderInterface;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\HttpResponseProviderInterface;
use Sylius\Bundle\PaymentBundle\Provider\HttpResponseProviderInterface;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration;
use Sylius\Component\Payment\Model\PaymentRequestInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;

View file

@ -14,9 +14,9 @@ declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\OrderPay\Provider;
use Sylius\Bundle\CoreBundle\OrderPay\Handler\PaymentStateFlashHandlerInterface;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\ServiceProviderAwareProviderInterface;
use Sylius\Bundle\PaymentBundle\Announcer\PaymentRequestAnnouncerInterface;
use Sylius\Bundle\PaymentBundle\CommandProvider\PaymentRequestCommandProviderInterface;
use Sylius\Bundle\PaymentBundle\Provider\ServiceProviderAwareProviderInterface;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration;
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Payment\Factory\PaymentRequestFactoryInterface;

View file

@ -14,10 +14,10 @@ declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\OrderPay\Provider;
use Sylius\Bundle\CoreBundle\OrderPay\Resolver\PaymentToPayResolverInterface;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\DefaultActionProviderInterface;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\DefaultPayloadProviderInterface;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\ServiceProviderAwareProviderInterface;
use Sylius\Bundle\PaymentBundle\Announcer\PaymentRequestAnnouncerInterface;
use Sylius\Bundle\PaymentBundle\Provider\DefaultActionProviderInterface;
use Sylius\Bundle\PaymentBundle\Provider\DefaultPayloadProviderInterface;
use Sylius\Bundle\PaymentBundle\Provider\ServiceProviderAwareProviderInterface;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Payment\Factory\PaymentRequestFactoryInterface;

View file

@ -11,16 +11,15 @@
-->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
<container
xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
<services>
<service id="sylius.payment_request.http_response.provider.offline" class="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\ActionsHttpResponseProvider">
<service id="sylius.payment_request.http_response.provider.offline" class="Sylius\Bundle\PaymentBundle\Provider\ActionsHttpResponseProvider">
<argument type="tagged_locator" tag="sylius.payment_request.http_response.provider.offline" index-by="action" />
<tag name="sylius.payment_request.http_response.provider" gateway-factory="offline" />
</service>
</services>
</container>

View file

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Sylius Sp. z o.o.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
<services>
<defaults public="true" />
<service id="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\GatewayFactoryNameProviderInterface" class="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\GatewayFactoryNameProvider" />
<service id="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\PaymentRequestProviderInterface" class="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\PaymentRequestProvider">
<argument type="service" id="sylius.repository.payment_request" />
</service>
<service id="sylius.payment_request.provider.http_response.gateway_factory" class="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\GatewayFactoryHttpResponseProvider">
<argument type="service" id="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\GatewayFactoryNameProviderInterface" />
<argument type="tagged_locator" tag="sylius.payment_request.http_response.provider" index-by="gateway-factory" />
</service>
<service id="sylius.payment_request.provider.http_response.default" alias="sylius.payment_request.provider.http_response.gateway_factory" />
<service id="sylius.payment_request.provider.default_action" class="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\DefaultActionProvider" />
<service id="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\DefaultActionProviderInterface" alias="sylius.payment_request.provider.default_action" />
<service id="sylius.payment_request.provider.default_payload" class="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\DefaultPayloadProvider" />
<service id="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\DefaultPayloadProviderInterface" alias="sylius.payment_request.provider.default_payload" />
</services>
</container>

View file

@ -13,8 +13,8 @@ declare(strict_types=1);
namespace Sylius\Bundle\PaymentBundle\CommandHandler\Offline;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\PaymentRequestProviderInterface;
use Sylius\Bundle\PaymentBundle\Command\Offline\CapturePaymentRequest;
use Sylius\Bundle\PaymentBundle\Provider\PaymentRequestProviderInterface;
use Sylius\Component\Payment\Model\PaymentRequestInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

View file

@ -13,8 +13,8 @@ declare(strict_types=1);
namespace Sylius\Bundle\PaymentBundle\CommandProvider;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\GatewayFactoryNameProviderInterface;
use Sylius\Bundle\PaymentBundle\Checker\PaymentRequestDuplicationCheckerInterface;
use Sylius\Bundle\PaymentBundle\Provider\GatewayFactoryNameProviderInterface;
use Sylius\Component\Payment\Model\PaymentRequestInterface;
use Symfony\Contracts\Service\ServiceProviderInterface;

View file

@ -11,7 +11,7 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Bundle\PaymentBundle\Exception\PaymentRequestNotSupportedException;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration;

View file

@ -11,7 +11,7 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Component\Payment\Model\PaymentRequestInterface;
use Symfony\Contracts\Service\ServiceProviderInterface;

View file

@ -11,9 +11,9 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Bundle\PayumBundle\Model\GatewayConfigInterface;
use Sylius\Component\Payment\Model\GatewayConfigInterface;
use Sylius\Component\Payment\Model\PaymentRequestInterface;
final class DefaultActionProvider implements DefaultActionProviderInterface

View file

@ -11,7 +11,7 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Component\Payment\Model\PaymentRequestInterface;

View file

@ -11,7 +11,7 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Component\Payment\Model\PaymentRequestInterface;

View file

@ -11,7 +11,7 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Component\Payment\Model\PaymentRequestInterface;

View file

@ -11,7 +11,7 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Component\Payment\Model\PaymentRequestInterface;
use Symfony\Contracts\Service\ServiceProviderInterface;

View file

@ -11,10 +11,10 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Component\Core\Model\PaymentMethodInterface;
use Sylius\Component\Payment\Model\GatewayConfigInterface;
use Sylius\Component\Payment\Model\PaymentMethodInterface;
use Sylius\Component\Payment\Model\PaymentRequestInterface;
final class GatewayFactoryNameProvider implements GatewayFactoryNameProviderInterface

View file

@ -11,9 +11,9 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Component\Core\Model\PaymentMethodInterface;
use Sylius\Component\Payment\Model\PaymentMethodInterface;
use Sylius\Component\Payment\Model\PaymentRequestInterface;
interface GatewayFactoryNameProviderInterface

View file

@ -11,7 +11,7 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration;
use Sylius\Component\Payment\Model\PaymentRequestInterface;

View file

@ -11,7 +11,7 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Bundle\PaymentBundle\Command\PaymentRequestHashAwareInterface;
use Sylius\Component\Payment\Exception\PaymentRequestNotFoundException;

View file

@ -11,7 +11,7 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
use Sylius\Bundle\PaymentBundle\Command\PaymentRequestHashAwareInterface;
use Sylius\Component\Payment\Model\PaymentRequestInterface;

View file

@ -11,7 +11,7 @@
declare(strict_types=1);
namespace Sylius\Bundle\CoreBundle\PaymentRequest\Provider;
namespace Sylius\Bundle\PaymentBundle\Provider;
interface ServiceProviderAwareProviderInterface extends HttpResponseProviderInterface
{

View file

@ -20,7 +20,7 @@
<defaults public="true" />
<service id="sylius.payment_request.offline.capture" class="Sylius\Bundle\PaymentBundle\CommandHandler\Offline\CapturePaymentRequestHandler">
<argument type="service" id="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\PaymentRequestProviderInterface" />
<argument type="service" id="sylius.payment_request.provider.payment_request" />
<tag name="messenger.message_handler" bus="sylius.payment_request.command_bus" />
</service>
</services>

View file

@ -21,7 +21,7 @@
<service id="sylius.payment_request.command_provider.gateway_factory" class="Sylius\Bundle\PaymentBundle\CommandProvider\GatewayFactoryCommandProvider">
<argument type="service" id="sylius.checker.payment_request_duplication" />
<argument type="service" id="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\GatewayFactoryNameProviderInterface" />
<argument type="service" id="sylius.payment_request.provider.gateway_factory_name" />
<argument type="tagged_locator" tag="sylius.payment_request.command_provider" index-by="gateway-factory" />
</service>
<service id="sylius.payment_request.command_provider.default" alias="sylius.payment_request.command_provider.gateway_factory" />

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Sylius Sp. z o.o.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container
xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
<services>
<defaults public="true" />
<service id="sylius.payment_request.provider.gateway_factory_name" class="Sylius\Bundle\PaymentBundle\Provider\GatewayFactoryNameProvider" />
<service id="Sylius\Bundle\PaymentBundle\Provider\GatewayFactoryNameProviderInterface" alias="sylius.payment_request.provider.gateway_factory_name" />
<service id="sylius.payment_request.provider.payment_request" class="Sylius\Bundle\PaymentBundle\Provider\PaymentRequestProvider">
<argument type="service" id="sylius.repository.payment_request" />
</service>
<service id="Sylius\Bundle\PaymentBundle\Provider\PaymentRequestProviderInterface" alias="sylius.payment_request.provider.payment_request" />
<service id="sylius.payment_request.provider.http_response.gateway_factory" class="Sylius\Bundle\PaymentBundle\Provider\GatewayFactoryHttpResponseProvider">
<argument type="service" id="sylius.payment_request.provider.gateway_factory_name" />
<argument type="tagged_locator" tag="sylius.payment_request.http_response.provider" index-by="gateway-factory" />
</service>
<service id="sylius.payment_request.provider.http_response.default" alias="sylius.payment_request.provider.http_response.gateway_factory" />
<service id="sylius.payment_request.provider.default_action" class="Sylius\Bundle\PaymentBundle\Provider\DefaultActionProvider" />
<service id="Sylius\Bundle\PaymentBundle\Provider\DefaultActionProviderInterface" alias="sylius.payment_request.provider.default_action" />
<service id="sylius.payment_request.provider.default_payload" class="Sylius\Bundle\PaymentBundle\Provider\DefaultPayloadProvider" />
<service id="Sylius\Bundle\PaymentBundle\Provider\DefaultPayloadProviderInterface" alias="sylius.payment_request.provider.default_payload" />
</services>
</container>

View file

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace spec\Sylius\Bundle\PaymentBundle\CommandHandler\Offline;
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\PaymentRequestProviderInterface;
use Sylius\Bundle\PaymentBundle\Command\Offline\CapturePaymentRequest;
use Sylius\Bundle\PaymentBundle\Provider\PaymentRequestProviderInterface;
use Sylius\Component\Payment\Model\PaymentRequestInterface;
final class CapturePaymentRequestHandlerSpec extends ObjectBehavior

View file

@ -13,8 +13,8 @@ declare(strict_types=1);
namespace Sylius\Bundle\PayumBundle\PaymentRequest\CommandHandler;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\PaymentRequestProviderInterface;
use Sylius\Bundle\PaymentBundle\Command\PaymentRequestHashAwareInterface;
use Sylius\Bundle\PaymentBundle\Provider\PaymentRequestProviderInterface;
use Sylius\Bundle\PayumBundle\Factory\GetStatusFactoryInterface;
use Sylius\Bundle\PayumBundle\Model\GatewayConfigInterface;
use Sylius\Bundle\PayumBundle\PaymentRequest\Processor\RequestProcessorInterface;

View file

@ -13,8 +13,8 @@ declare(strict_types=1);
namespace Sylius\Bundle\PayumBundle\PaymentRequest\CommandHandler;
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\PaymentRequestProviderInterface;
use Sylius\Bundle\PaymentBundle\Command\PaymentRequestHashAwareInterface;
use Sylius\Bundle\PaymentBundle\Provider\PaymentRequestProviderInterface;
use Sylius\Bundle\PayumBundle\Factory\TokenAggregateRequestFactoryInterface;
use Sylius\Bundle\PayumBundle\PaymentRequest\Factory\PayumTokenFactoryInterface;
use Sylius\Bundle\PayumBundle\PaymentRequest\Processor\AfterTokenRequestProcessorInterface;

View file

@ -20,7 +20,7 @@
<defaults public="true" />
<service id="sylius.payum.payment_request.command_handler.token_payment_request" class="Sylius\Bundle\PayumBundle\PaymentRequest\CommandHandler\TokenPaymentRequestHandler" abstract="true">
<argument type="service" id="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\PaymentRequestProviderInterface" />
<argument type="service" id="sylius.payment_request.provider.payment_request" />
<argument type="service" id="sylius.payum.payment_request.resolver.doctrine_proxy_object_resolver" />
<argument type="service" id="sylius.payum.payment_request.factory.payum_token" />
<argument type="service" id="sylius.payum.payment_request.processor.request" />
@ -38,7 +38,7 @@
</service>
<service id="sylius.payum.payment_request.command_handler.model_payment_request" class="Sylius\Bundle\PayumBundle\PaymentRequest\CommandHandler\ModelPaymentRequestHandler" abstract="true">
<argument type="service" id="Sylius\Bundle\CoreBundle\PaymentRequest\Provider\PaymentRequestProviderInterface" />
<argument type="service" id="sylius.payment_request.provider.payment_request" />
<argument type="service" id="sylius.payum.payment_request.resolver.doctrine_proxy_object_resolver" />
<argument type="service" id="sylius.payum.payment_request.processor.request" />
</service>