/** * request. * * @method request * * @param string $gatewayName * @param callable $closure * @param string $afterPath * @param array $afterParameters * @param string $tokenType * * @return mixed */ public function request($gatewayName, callable $closure, $afterPath = 'payment.done', array $afterParameters = [], $tokenType = 'Capture') { $payum = $this->getPayum(); $storage = $payum->getStorage($this->getPaymentModelName($payum)); $payment = $storage->create(); $closure($payment, $gatewayName, $storage, $this->payum); $storage->update($payment); $tokenFactory = $this->payum->getTokenFactory(); $method = 'create' . ucfirst($tokenType) . 'Token'; $token = call_user_func_array([$tokenFactory, $method], [$gatewayName, $payment, $afterPath, $afterParameters]); return $this->responseFactory->redirectTo($token->getTargetUrl()); }
/** * @return GenericTokenFactoryInterface */ private function getTokenFactory() { return $this->payum->getTokenFactory(); }
/** * @test */ public function shouldAllowGetGenericTokenFactorySetInConstructor() { $tokenFactory = $this->createGenericTokenFactoryMock(); $payum = new Payum($this->createRegistryMock(), $this->createHttpRequestVerifierMock(), $tokenFactory, $this->createTokenStorage()); $this->assertSame($tokenFactory, $payum->getTokenFactory()); }