Ejemplo n.º 1
0
 /**
  * @param Gateway     $gateway
  * @param ArrayObject $config
  */
 protected function buildApis(Gateway $gateway, ArrayObject $config)
 {
     foreach ($config as $name => $value) {
         if (0 === strpos($name, 'payum.api')) {
             $prepend = in_array($name, $config['payum.prepend_apis']);
             if (is_callable($value)) {
                 $gateway->addApi(call_user_func_array($value, array($config)), $prepend);
             } else {
                 $gateway->addApi($value, $prepend);
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * @param Gateway     $gateway
  * @param ArrayObject $config
  */
 protected function buildApis(Gateway $gateway, ArrayObject $config)
 {
     foreach ($config as $name => $value) {
         if (0 === strpos($name, 'payum.api')) {
             $prepend = in_array($name, $config['payum.prepend_apis']);
             $gateway->addApi($value, $prepend);
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * @test
  *
  * @expectedException \Payum\Core\Exception\LogicException
  * @expectedExceptionMessage Cannot find right api supported by
  */
 public function throwIfGatewayNotHaveApiSupportedByActionOnExecute()
 {
     $gateway = new Gateway();
     $gateway->addApi($firstApi = new \stdClass());
     $gateway->addApi($secondApi = new \stdClass());
     $action = $this->getMockForAbstractClass(ApiAwareAction::class);
     $action->expects($this->at(0))->method('setApi')->with($this->identicalTo($firstApi))->will($this->throwException(new UnsupportedApiException('first api not supported')));
     $action->expects($this->at(1))->method('setApi')->with($this->identicalTo($secondApi))->will($this->throwException(new UnsupportedApiException('second api not supported')));
     $action->expects($this->never())->method('supports');
     $gateway->addAction($action);
     $gateway->execute(new \stdClass());
 }