/**
  * @param \Shopware_StoreApi_Models_Licence $licencedProduct
  * @return array
  */
 private function downloadProduct(\Shopware_StoreApi_Models_Licence $licencedProduct)
 {
     /**@var $licencedProduct \Shopware_StoreApi_Models_Licence*/
     $downloads = $licencedProduct->getDownloads();
     $namespace = Shopware()->Snippets()->getNamespace('backend/plugin_manager/main');
     if (empty($downloads)) {
         $this->handleError(array('message' => $namespace->get('no_download', 'No download available')));
     }
     $url = $downloads['download']['url'];
     $url = "http://localhost/SwagLicense.zip";
     $downloads['type'] = 'plain';
     if ($downloads['type'] === 'plain') {
         $result = $this->store->downloadPlugin($url);
         if ($result['success']) {
             return array('success' => true, 'license' => $licencedProduct->getLicence());
         } else {
             return $result;
         }
     }
     if (!$this->isIonCubeLoaderLoaded()) {
         $this->handleError(array('message' => 'Ioncube loader is requied to install this plugin.'));
     }
     $result = $this->store->downloadPlugin($url);
     if ($result['success']) {
         return array('success' => true, 'license' => $licencedProduct->getLicence());
     } else {
         return $result;
     }
 }
Exemplo n.º 2
0
 /**
  * @param \Shopware_StoreApi_Models_Auth $auth
  * @param string $hostname
  * @return int|\Shopware_StoreApi_Models_Domain
  */
 private function connect(\Shopware_StoreApi_Models_Auth $auth, $hostname)
 {
     /** @var $domain \Shopware_StoreApi_Models_Domain */
     $domain = $this->store->getAccountService()->getDomain($auth, $hostname);
     if ($domain instanceof \Shopware_StoreApi_Exception_Response) {
         $this->handleError(array('success' => false, 'code' => $domain->getCode(), 'message' => "Your currently used shop domain isn't associated with your shopware account."));
     }
     return $domain;
 }