示例#1
0
 /**
  * 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());
 }
示例#2
0
 /**
  * @return GenericTokenFactoryInterface
  */
 private function getTokenFactory()
 {
     return $this->payum->getTokenFactory();
 }
示例#3
0
文件: PayumTest.php 项目: payum/core
 /**
  * @test
  */
 public function shouldAllowGetGenericTokenFactorySetInConstructor()
 {
     $tokenFactory = $this->createGenericTokenFactoryMock();
     $payum = new Payum($this->createRegistryMock(), $this->createHttpRequestVerifierMock(), $tokenFactory, $this->createTokenStorage());
     $this->assertSame($tokenFactory, $payum->getTokenFactory());
 }