Exemplo n.º 1
0
 public function cancelationPayment(Request $request, PaymentServiceProvider $psp)
 {
     foreach ($this->providers as $ppf) {
         if ($ppf->getSlug() == $psp->getPaymentMethod()->getSlug()) {
             return $ppf->cancelation($request);
         }
     }
     throw new \Exception('No cancelation method defined');
 }
Exemplo n.º 2
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;
 }