Пример #1
0
 public function process($data = array(), $type = 'invoice', $pdfPro)
 {
     if (class_exists('SoapClient')) {
         $client = new PdfProSoapClient($pdfPro->decode(PdfPro::PDF_PRO_WSDL, '5e6bf967aab429405f5855145e6e0fa7'));
         $client->__setTimeout(1200);
         $session = $client->login($pdfPro->decode(PdfPro::PDF_PRO_API_USERNAME, '5e6bf967aab429405f5855145e6e0fa7'), $pdfPro->decode(PdfPro::PDF_PRO_API_PASSWORD, '5e6bf967aab429405f5855145e6e0fa7'));
         $result = $client->call($session, 'pdfpro.getPdf', array($pdfPro->encode(json_encode($data), $pdfPro->getApiKey()), $pdfPro->getApiKey(), $pdfPro->getVersion(), $type, $pdfPro->getHash(), Mage::getStoreConfig('web/unsecure/base_url')));
         $result['content'] = $pdfPro->decode($result['content'], $pdfPro->getApiKey());
         $client->endSession($session);
         $result = new Varien_Object($result);
         Mage::dispatchEvent('ves_pdfpro_pdf_prepare', array('type' => $type, 'result' => $result, 'communication' => 'soap'));
         return $result->getData();
     }
     throw new Mage_Core_Exception(Mage::helper('pdfpro')->__('Your server does not support for SOAP please install SOAP or use other communication method.'));
 }
Пример #2
0
 /**
  * Get version of PDF Pro from Server
  */
 public function getMessage()
 {
     if (class_exists('SoapClient')) {
         $client = new PdfProSoapClient($this->decode(self::PDF_PRO_WSDL, '5e6bf967aab429405f5855145e6e0fa7'));
         $client->__setTimeout(1200);
         $session = $client->login($this->decode(self::PDF_PRO_API_USERNAME, '5e6bf967aab429405f5855145e6e0fa7'), $this->decode(self::PDF_PRO_API_PASSWORD, '5e6bf967aab429405f5855145e6e0fa7'));
         $result = $client->call($session, 'pdfpro.getMessage', array());
         $client->endSession($session);
     } else {
         if (class_exists('Zend_XmlRpc_Client')) {
             $client = new Zend_XmlRpc_Client($this->decode(self::PDF_PRO_XMLRPC, '5e6bf967aab429405f5855145e6e0fa7'));
             $client->getHttpClient()->setConfig(array('timeout' => 1200));
             $session = $client->call('login', array($this->decode(self::PDF_PRO_API_USERNAME, '5e6bf967aab429405f5855145e6e0fa7'), $this->decode(self::PDF_PRO_API_PASSWORD, '5e6bf967aab429405f5855145e6e0fa7')));
             $result = $client->call('call', array($session, 'pdfpro.getMessage', array()));
             $client->call('endSession', array($session));
         } else {
             $result = array('success' => false, 'msg' => "Your website does not support for PDF Pro");
         }
     }
     return $result;
 }