*/ /** * Klasa stLukasFrontendActions * * @package stLukasPlugin * @subpackage actions */ class stLukasFrontendActions extends stActions { /** * Składanie eWniosku */ public function executeEwniosek() { $this->setLayout(false); $stLukas = new stLukas(); $context = $this->getContext(); $this->url = ''; /** * Hack na zmianę języka */ stLanguage::getInstance($context)->clearPath(); if ($this->getRequest()->hasParameter('type')) { $type = $this->getRequest()->getParameter('type'); if ($type == stLukas::TYPE_ORDER) { $c = new Criteria(); $c->add(OrderPeer::ID, $this->getRequest()->getParameter('id')); $order = OrderPeer::doSelectOne($c); // $stWebRequest = new stWebRequest(); // $wsdlFilename = sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'lukas_bank.wsdl'; // // if (!file_exists($wsdlFilename) || (time() - filemtime($wsdlFilename)) > 864000) // { // $b = new sfWebBrowser(array(), 'sfCurlAdapter', array('ssl_verify' => false)); // $b->get(stLukas::LUKAS_WSDL_URL); // $wsdl = trim($b->getResponseText()); // // file_put_contents($wsdlFilename, $wsdl); // } $client = new SoapClient(stLukas::LUKAS_WSDL_URL, array('cache_wsdl' => 0, 'trace'=>1)); $xml = ''; $xml.= '
'; try { $paramSetup = $client->put($xml); } catch (Exception $e) { } $this->url = $stLukas->generateUrl(array('simulate' => true, 'param_setup' => $paramSetup)); } elseif ($type == stLukas::TYPE_PRODUCT) { $this->url = $stLukas->generateUrl(array('simulate' => true, 'amount' => $this->getRequest()->getParameter('price'))); } } else { if ($this->hasFlash('lukas_procedure') && $this->getFlash('lukas_procedure') == true) { $this->url = $stLukas->generateUrl(array('procedure' => true)); } else { $basket = stBasket::getInstance($context->getUser()); $delivery = stDeliveryFrontend::getInstance($basket); $this->url = $stLukas->generateUrl(array('simulate' => true, 'amount' => ($basket->getTotalAmount(true)+$delivery->getTotalDeliveryCost(true)))); } } } /** * Procedura składania wniosku */ public function executeProcedure() { $this->setFlash('lukas_procedure', true); $this->redirect('lukas/ewniosek'); } /** * Pozytywny powrót z płatności */ public function executeReturnSuccess() { $this->smarty = new stSmarty($this->getModuleName()); } /** * Negatywny powrót z płatności */ public function executeReturnFail() { $this->smarty = new stSmarty($this->getModuleName()); $this->contactPage = WebpagePeer::retrieveByState('CONTACT'); } }