Example #1
0
 /**
  * @param array $methodConfig
  */
 public function addMethod($code, array $methodConfig)
 {
     $method = new Method();
     $method->setCode($code);
     foreach ($methodConfig as $key => $value) {
         $method->addAttribute($key, $value);
     }
     $this->methods->add($method);
 }
 /**
  * @param \Ilis\Bundle\PaymentBundle\Entity\Method $method
  * @return ProcessorAbstract
  * @throws \Ilis\Bundle\PaymentBundle\Exception\Exception
  */
 public static function makeProcessor(Method $method, $router)
 {
     $code = $method->getCode();
     switch ($code) {
         case Method::CODE_REDSYS_WEBSERVICE:
             $processor = new CreditCard\Redsys($method);
             break;
         case Method::CODE_PAYPAL_PAYMENTS_STANDARDS:
             $processor = new Paypal\PaymentsStandard($method, $router);
             break;
         default:
             throw new Exception(sprintf('Unhandled method code "%s". Cannot instantiate Processor', $code));
     }
     return $processor;
 }