/** * {@inheritDoc} */ public function getGateway($name) { /** @var GatewayConfigInterface[] $configs */ if ($configs = $this->gatewayConfigStore->findBy(array('gateway_name' => $name))) { $config = array_shift($configs); $factory = $this->getGatewayFactory($config->getFactoryName()); return $factory->create($config->getParameters()->toArray()); } return $this->staticRegistry->getGateway($name); }
function let(ContainerInterface $container, HttpRequestVerifierInterface $httpRequestVerifier, TokenInterface $token, Request $request, CartProviderInterface $cartProvider, RegistryInterface $payum, GatewayInterface $gateway, EventDispatcherInterface $eventDispatcher, DoctrinRegistryInterface $doctrine, ObjectManager $objectManager, Session $session, FlashBagInterface $flashBag, TranslatorInterface $translator) { $session->getFlashBag()->willReturn($flashBag); $doctrine->getManager()->willReturn($objectManager); $token->getGatewayName()->willReturn('aGatewayName'); $payum->getGateway('aGatewayName')->willReturn($gateway); $httpRequestVerifier->verify($request)->willReturn($token); $httpRequestVerifier->invalidate($token)->willReturn(null); $container->get('payum.security.http_request_verifier')->willReturn($httpRequestVerifier); $container->get('sylius.cart_provider')->willReturn($cartProvider); $container->get('payum')->willReturn($payum); $container->get('event_dispatcher')->willReturn($eventDispatcher); $container->get('session')->willReturn($session); $container->get('doctrine')->willReturn($doctrine); $container->has('doctrine')->willReturn(true); $container->get('translator')->willReturn($translator); $this->setName('purchase'); $this->setContainer($container); }
/** * {@inheritDoc} */ public function getGateway($name) { return $this->registry->getGateway($name); }