Exemplo n.º 1
0
 public function initialize($container, PaymentServiceProvider $psp)
 {
     $this->container = $container;
     $this->parameters = $psp->getApiCredentialParameters();
     //        if(is_array($this->parameters)){
     //            foreach ($this->parameters as $param){
     //                try {
     //                    $service = $this->container->get($param);
     //                    $this->parameters[$param] = $service;
     //                } catch (\Exception $exc) {
     //                    throw new InvalidServiceException('Invalid service ' . $param);
     //                }
     //            }
     //        }
     $class = $psp->getModelClass();
     $this->setName($psp->getPaymentMethod()->getName());
     $this->setSlug($psp->getPaymentMethod()->getSlug());
     $this->setModelClass($class);
     $this->setForm($this->container->get('form.factory')->create($psp->getFormClass(), new $class($container->get('validator'))));
     $this->setFormView($this->getForm()->createView());
     $this->setTwig($psp->getAppendTwigToForm());
     return $this;
 }