コード例 #1
1
 public function __construct(Customweb_DependencyInjection_IContainer $container)
 {
     $this->container = $container;
     $this->providerService = $container->getBean('Customweb_Payment_ExternalCheckout_IProviderService');
     $this->entityManager = $container->getBean('Customweb_Database_Entity_IManager');
     $this->transactionHandler = $container->getBean('Customweb_Payment_ITransactionHandler');
 }
コード例 #2
0
 protected function postProcessActionInvocation($controllerObject, ReflectionMethod $method, array $arguements, Customweb_DependencyInjection_IContainer $container)
 {
     if ($container->hasBean('Customweb_Payment_Authorization_ITransaction')) {
         $transaction = $container->getBean('Customweb_Payment_Authorization_ITransaction');
         $this->getTransactionHandler()->persistTransactionObject($transaction);
     }
 }
コード例 #3
0
 /**
  * @param Customweb_Asset_IResolver $assetResolver        	
  * @param Customweb_DependencyInjection_IContainer $container        	
  */
 public function __construct(Customweb_Asset_IResolver $assetResolver, Customweb_DependencyInjection_IContainer $container)
 {
     $this->assetResolver = $assetResolver;
     if ($container->hasBean('Customweb_Cache_IBackend')) {
         $this->cacheBackend = $container->getBean('Customweb_Cache_IBackend');
     }
 }
コード例 #4
0
 /**
  * Removes the given alias from the database. In case it can be also removed on the remote system it will be also
  * removed their.
  *
  * @param int $transactionId
  * @throws Exception
  */
 public function removeAlias($transactionId)
 {
     $transaction = $this->manager->fetch($this->transactionClassName, $transactionId);
     if (!$transaction instanceof Customweb_Payment_Entity_AbstractTransaction) {
         throw new Exception("Transaction must be of type Customweb_Payment_Entity_AbstractTransaction");
     }
     $this->deactivateAlias($transactionId);
     if ($this->container->hasBean('Customweb_Payment_Alias_IRemoveAdapter')) {
         $removeAdapter = $this->container->getBean('Customweb_Payment_Alias_IRemoveAdapter');
         if (!$removeAdapter instanceof Customweb_Payment_Alias_IRemoveAdapter) {
             throw new Exception("Remove adapter must be of type 'Customweb_Payment_Alias_IRemoveAdapter'");
         }
         $removeAdapter->remove($transaction->getTransactionObject());
         $this->manager->persist($transaction);
     }
 }
コード例 #5
0
 /**
  * @return Customweb_Payment_Authorization_IAdapter[]
  */
 protected function getAuthorizationAdapters()
 {
     if ($this->adapters === null) {
         $adapters = $this->container->getBeansByType('Customweb_Payment_Authorization_IAdapter');
         $this->adapters = array();
         foreach ($adapters as $adapter) {
             /* @var $adapter Customweb_Payment_Authorization_IAdapter */
             $key = self::findNextBiggerKey($this->adapters, $adapter->getAdapterPriority());
             $this->adapters[$key] = $adapter;
         }
         ksort($this->adapters);
         foreach ($this->adapters as $adapter) {
             $key = strtolower($adapter->getAuthorizationMethodName());
             $this->adaptersByName[$key] = $adapter;
         }
     }
     return $this->adaptersByName;
 }
コード例 #6
0
 protected function resolveInvocationArguements(ReflectionMethod $method, Customweb_DependencyInjection_IContainer $container)
 {
     $args = array();
     foreach ($method->getParameters() as $parameter) {
         $type = self::getParameterType($parameter);
         if ($type === null) {
             throw new Customweb_Mvc_Controller_Exception_ActionArgumentScalarException($method->getName());
         }
         try {
             $args[] = $container->getBean($type);
         } catch (Customweb_DependencyInjection_Exception_BeanNotFoundException $e) {
             throw new Customweb_Mvc_Controller_Exception_ActionArgumentNotResolvableException($method->getName(), $type);
         }
     }
     return $args;
 }
コード例 #7
0
 public function getInstanceByInject(Customweb_DependencyInjection_IContainer $container, $inject)
 {
     return $container->getBean($inject);
 }
コード例 #8
0
 public function hasBean($identifier)
 {
     return $this->container->hasBean($identifier);
 }