コード例 #1
0
ファイル: PaymentService.php プロジェクト: igaponov/shop
 public function verifyRequest(VerifyRequestCommand $command)
 {
     $token = $this->requestVerifier->verify($command->getRequest());
     $gateway = $this->registry->getGateway($token->getGatewayName());
     $gateway->execute($status = new GetHumanStatus($token));
     $payment = $status->getFirstModel();
     $this->requestVerifier->invalidate($token);
     $event = new RequestVerifiedEvent($status, $payment);
     $this->eventBus->handle($event);
 }
コード例 #2
0
ファイル: PurchaseStepSpec.php プロジェクト: Silwereth/Sylius
 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);
 }
コード例 #3
0
ファイル: PurchaseStepSpec.php プロジェクト: bcremer/Sylius
 function let(ContainerInterface $container, HttpRequestVerifierInterface $httpRequestVerifier, TokenInterface $token, Request $request, RequestStack $requestStack, CartProviderInterface $cartProvider, RegistryInterface $payum, PaymentInterface $payment, EventDispatcherInterface $eventDispatcher, DoctrinRegistryInterface $doctrine, ObjectManager $objectManager, Session $session, FlashBagInterface $flashBag, TranslatorInterface $translator, FactoryInterface $factory)
 {
     $requestStack->getCurrentRequest()->willReturn($request);
     $session->getFlashBag()->willReturn($flashBag);
     $doctrine->getManager()->willReturn($objectManager);
     $token->getPaymentName()->willReturn('aPaymentName');
     $payum->getPayment('aPaymentName')->willReturn($payment);
     $httpRequestVerifier->verify($request)->willReturn($token);
     $httpRequestVerifier->invalidate($token)->willReturn(null);
     $container->get('payum.security.http_request_verifier')->willReturn($httpRequestVerifier);
     $container->get('request')->willReturn($request);
     $container->get('request_stack')->willReturn($requestStack);
     $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);
     $container->get('sm.factory')->willReturn($factory);
     $this->setName('purchase');
     $this->setContainer($container);
 }
コード例 #4
0
 /**
  * getToken.
  *
  * @method getToken
  *
  * @param \Payum\Core\Security\HttpRequestVerifierInterface $httpRequestVerifier
  * @param \Illuminate\Http\Request                          $request
  * @param string                                            $payumToken
  *
  * @return \Payum\Core\Model\Token
  */
 protected function getToken(HttpRequestVerifierInterface $httpRequestVerifier, Request $request, $payumToken = null)
 {
     if (empty($payumToken) === true) {
         $session = $this->getSession($request);
         $payumToken = $session->get($this->payumTokenId);
         $session->forget($this->payumTokenId);
         $session->save();
         $session->start();
     }
     $request->merge([$this->payumTokenId => $payumToken]);
     return $httpRequestVerifier->verify($request);
 }
コード例 #5
0
 /**
  * @param Request $request
  *
  * @return Payment
  */
 protected function findRequestedPayment(Request $request)
 {
     $token = $this->httpRequestVerifier->verify($request);
     $storage = $this->registry->getStorage('Payum\\Server\\Model\\Payment');
     return $storage->find($token->getDetails());
 }