コード例 #1
0
 /**
  * @param DownloadRequest $request
  * @return string
  */
 private function downloadFullZip(DownloadRequest $request)
 {
     if ($request->getToken()) {
         return $this->storeClient->doAuthGetRequestRaw($request->getToken(), '/pluginFiles/' . $request->getTechnicalName() . '/file', ['shopwareVersion' => $request->getShopwareVersion(), 'domain' => $request->getDomain()]);
     }
     return $this->storeClient->doGetRequestRaw('/pluginFiles/' . $request->getTechnicalName() . '/file', ['shopwareVersion' => $request->getShopwareVersion(), 'domain' => $request->getDomain()]);
 }
コード例 #2
0
 /**
  * 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);
 }
コード例 #3
0
 /**
  * Gets an access token from the server using the provided auth credentials
  *
  * @param string $shopwareId
  * @param string $password
  * @return AccessTokenStruct Token to access the API
  * @throws \Exception
  */
 public function getToken($shopwareId = null, $password = null)
 {
     try {
         return $this->storeClient->getAccessToken($shopwareId, $password);
     } catch (StoreException $se) {
         throw $this->translateExceptionMessage($se);
     }
 }
コード例 #4
0
 /**
  * generate new Secret by API Call
  * @return string
  */
 private function generateApiShopSecret()
 {
     $token = Shopware()->BackendSession()->offsetGet('store_token');
     $token = unserialize($token);
     if ($token == null) {
         $token = Shopware()->BackendSession()->accessToken;
     }
     $params = ['domain' => $this->getDomain()];
     $data = $this->storeClient->doAuthGetRequest($token, '/shopsecret', $params);
     return $data['secret'];
 }
コード例 #5
0
 /**
  * @param UpdateLicencesRequest $request
  * @return array
  */
 public function updateLicences(UpdateLicencesRequest $request)
 {
     $response = $this->storeClient->doAuthPostRequestRaw($request->getToken(), '/licenseupgrades/simple', ['domain' => $request->getDomain(), 'shopwareVersion' => $request->getShopwareVersion(), 'locale' => $request->getLocale()]);
     return $response;
 }
コード例 #6
0
 /**
  * @return CategoryStruct[]
  * @throws \Exception
  */
 public function getCategories()
 {
     $data = $this->storeClient->doGetRequest('/pluginStore/categories');
     return $this->hydrator->hydrateCategories($data);
 }
コード例 #7
0
 /**
  * @param AccessTokenStruct $accessToken
  * @param OrderRequest $context
  * @throws \Exception
  * @return bool
  */
 public function orderPlugin(AccessTokenStruct $accessToken, OrderRequest $context)
 {
     $data = ['origin' => ['name' => 'Shopware Backend'], 'shopwareId' => $accessToken->getShopwareId(), 'positions' => [['licenseShopDomain' => $context->getLicenceShop(), 'bookingShopDomain' => $context->getBookingShop(), 'orderNumber' => $context->getOrderNumber(), 'isArticle' => true, 'priceModel' => ['type' => $context->getPriceType(), 'price' => $context->getPrice()]]]];
     $response = $this->storeClient->doAuthPostRequestRaw($accessToken, '/orders', $data);
     return $response->getStatusCode() == 204;
 }