/** * Loads localization plugins from SBP for the given localization * * @param string $localization Localization for which to retrieve the plugins * @param LocaleStruct $locale Locale in which to translate the information * @param string $shopwareVersion Current Shopware version * @return array List of plugins */ public function getLocalizationPlugins($localization, $locale, $shopwareVersion) { $localeName = $locale ? $locale->getName() : null; $data = $this->storeClient->doGetRequest('/firstrunwizard/languages/' . $localization, ['locale' => $localeName, 'shopwareVersion' => $shopwareVersion]); $plugins = $this->hydrator->hydrateStorePlugins($data); return $this->getAdditionallyLocalData($plugins); }
/** * Gets a list of locales supported by the SBP * * @return LocaleStruct[] array of locale details * @throws \Exception */ public function getLocales() { try { $responseBody = $this->storeClient->doGetRequest("/locales"); } catch (StoreException $se) { throw $this->translateExceptionMessage($se); } return $this->hydrator->hydrateLocales($responseBody); }
/** * function that return not upgraded plugins, plugins with wrong version, plugins which loose subscription, information if license upgrade for shop was executed * @param String $secret * @return SubscriptionStateStruct */ public function getPluginsSubscriptionState($secret) { $params = ['domain' => $this->getDomain(), 'shopwareVersion' => \Shopware::VERSION, 'plugins' => $this->getPluginsNameAndVersion()]; $header = ['X-Shopware-Shop-Secret' => $secret]; $data = $this->storeClient->doGetRequest('/pluginStore/pluginSubscription', $params, $header); $technicalNames = array_column($data['subscription'], 'name'); $technicalNames = array_merge($technicalNames, array_column($data['notUpgraded'], 'name')); $technicalNames = array_merge($technicalNames, array_column($data['wrongVersion'], 'name')); $technicalNames = array_values(array_unique($technicalNames)); $labels = $this->getPluginLabelsByNames($technicalNames); $data['subscription'] = $this->assignLabels($data['subscription'], $labels); $data['notUpgraded'] = $this->assignLabels($data['notUpgraded'], $labels); $data['wrongVersion'] = $this->assignLabels($data['wrongVersion'], $labels); $subscriptionStateStruct = new SubscriptionStateStruct($data['shopUpgraded'], $data['notUpgraded'], $data['wrongVersion'], $data['subscription']); return $subscriptionStateStruct; }
/** * @return CategoryStruct[] * @throws \Exception */ public function getCategories() { $data = $this->storeClient->doGetRequest('/pluginStore/categories'); return $this->hydrator->hydrateCategories($data); }